Skip to content

Commit e12f250

Browse files
author
github-actions
committed
chore: sync clay source from liferay-portal
1 parent 7790d72 commit e12f250

37 files changed

Lines changed: 555 additions & 639 deletions

packages/clay-card/src/Card.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ interface ICardProps extends IContext {
2323
*/
2424
active?: boolean;
2525

26+
/**
27+
* Flag that indicates if `disabled` class is applied
28+
*/
29+
disabled?: boolean;
30+
2631
/**
2732
* Determines the style of the card
2833
*/
@@ -44,6 +49,7 @@ function CardBase({
4449
active,
4550
children,
4651
className,
52+
disabled = false,
4753
displayType,
4854
selectable = false,
4955
...otherProps
@@ -62,6 +68,7 @@ function CardBase({
6268
{
6369
active,
6470
'card': !selectable,
71+
disabled,
6572
'file-card': isCardType.file,
6673
'form-check-card form-check form-check-top-left':
6774
selectable,

packages/clay-card/src/CardHorizontal.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ interface IProps extends React.BaseHTMLAttributes<HTMLDivElement> {
1515
*/
1616
active?: boolean;
1717

18+
/**
19+
* Flag that indicates if `disabled` class is applied
20+
*/
21+
disabled?: boolean;
22+
1823
/**
1924
* Flag that indicates if the card can be selectable.
2025
*/
@@ -40,6 +45,7 @@ export function ClayCardHorizontal({
4045
active,
4146
children,
4247
className,
48+
disabled,
4349
selectable,
4450
...otherProps
4551
}: IProps) {
@@ -51,6 +57,7 @@ export function ClayCardHorizontal({
5157
{
5258
active,
5359
'card card-horizontal': !selectable,
60+
disabled,
5461
'form-check-card form-check form-check-middle-left':
5562
selectable,
5663
},

packages/clay-card/src/CardWithHorizontal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export function ClayCardWithHorizontal({
152152
<ClayCardHorizontal
153153
{...otherProps}
154154
active={selected}
155+
disabled={disabled}
155156
selectable={!!onSelectChange}
156157
>
157158
{onSelectChange &&

packages/clay-card/src/CardWithInfo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export function ClayCardWithInfo({
229229
<ClayCard
230230
{...otherProps}
231231
active={selected}
232+
disabled={disabled}
232233
displayType={isCardType.image ? 'image' : 'file'}
233234
selectable={!!onSelectChange}
234235
>

packages/clay-card/src/CardWithUser.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export function ClayCardWithUser({
169169
<ClayCard
170170
{...otherProps}
171171
active={selected}
172+
disabled={disabled}
172173
displayType="user"
173174
selectable={!!onSelectChange}
174175
>

packages/clay-card/src/__tests__/__snapshots__/index.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ exports[`ClayCard renders a group of ClayCards 1`] = `
13741374
exports[`ClayCardWithHorizontal renders as disabled 1`] = `
13751375
<div>
13761376
<div
1377-
class="form-check-card form-check form-check-middle-left card-type-directory"
1377+
class="disabled form-check-card form-check form-check-middle-left card-type-directory"
13781378
>
13791379
<div
13801380
class="custom-control custom-checkbox"
@@ -1655,7 +1655,7 @@ exports[`ClayCardWithHorizontal renders with no truncate text 1`] = `
16551655
exports[`ClayCardWithHorizontal renders with radio button 1`] = `
16561656
<div>
16571657
<div
1658-
class="form-check-card form-check form-check-middle-left card-type-directory"
1658+
class="disabled form-check-card form-check form-check-middle-left card-type-directory"
16591659
>
16601660
<div
16611661
class="custom-control custom-radio"
@@ -1732,7 +1732,7 @@ exports[`ClayCardWithHorizontal renders with radio button 1`] = `
17321732
exports[`ClayCardWithInfo renders as disabled 1`] = `
17331733
<div>
17341734
<div
1735-
class="file-card form-check-card form-check form-check-top-left card-type-asset"
1735+
class="disabled file-card form-check-card form-check form-check-top-left card-type-asset"
17361736
>
17371737
<div
17381738
class="card"
@@ -1818,7 +1818,7 @@ exports[`ClayCardWithInfo renders as disabled 1`] = `
18181818
exports[`ClayCardWithInfo renders as file card specifying the displayType 1`] = `
18191819
<div>
18201820
<div
1821-
class="file-card form-check-card form-check form-check-top-left card-type-asset"
1821+
class="disabled file-card form-check-card form-check form-check-top-left card-type-asset"
18221822
>
18231823
<div
18241824
class="card"
@@ -1904,7 +1904,7 @@ exports[`ClayCardWithInfo renders as file card specifying the displayType 1`] =
19041904
exports[`ClayCardWithInfo renders as image card specifying imageProps and not the displayType 1`] = `
19051905
<div>
19061906
<div
1907-
class="form-check-card form-check form-check-top-left image-card card-type-asset"
1907+
class="disabled form-check-card form-check form-check-top-left image-card card-type-asset"
19081908
>
19091909
<div
19101910
class="card"
@@ -1983,7 +1983,7 @@ exports[`ClayCardWithInfo renders as image card specifying imageProps and not th
19831983
exports[`ClayCardWithInfo renders as image card specifying the displayType and imageProps 1`] = `
19841984
<div>
19851985
<div
1986-
class="form-check-card form-check form-check-top-left image-card card-type-asset"
1986+
class="disabled form-check-card form-check form-check-top-left image-card card-type-asset"
19871987
>
19881988
<div
19891989
class="card"
@@ -2062,7 +2062,7 @@ exports[`ClayCardWithInfo renders as image card specifying the displayType and i
20622062
exports[`ClayCardWithInfo renders as image card specifying the displayType and no imageProps 1`] = `
20632063
<div>
20642064
<div
2065-
class="form-check-card form-check form-check-top-left image-card card-type-asset"
2065+
class="disabled form-check-card form-check form-check-top-left image-card card-type-asset"
20662066
>
20672067
<div
20682068
class="card"
@@ -3024,7 +3024,7 @@ exports[`ClayCardWithUser renders ClayCardWithNavigation with image 1`] = `
30243024
exports[`ClayCardWithUser renders as disabled 1`] = `
30253025
<div>
30263026
<div
3027-
class="form-check-card form-check form-check-top-left user-card card-type-asset"
3027+
class="disabled form-check-card form-check form-check-top-left user-card card-type-asset"
30283028
>
30293029
<div
30303030
class="card"

packages/clay-card/stories/Card.stories.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function ClayCheckboxWithState(props: any) {
3939
</ClayCheckbox>
4040
);
4141
}
42-
export function CardWithInfo(args: any) {
42+
export function CardWithInfo(args: {disabled?: boolean}) {
4343
const [value, setValue] = useState<boolean>(false);
4444
const [radioValue, setRadioValue] = useState<string>('');
4545

@@ -107,6 +107,7 @@ export function CardWithInfo(args: any) {
107107
<ClayCard.Group label="Radio Card Group">
108108
<ClayCardWithInfo
109109
description="A cool description"
110+
disabled={args.disabled}
110111
labels={[
111112
{
112113
displayType: 'danger',
@@ -124,6 +125,7 @@ export function CardWithInfo(args: any) {
124125

125126
<ClayCardWithInfo
126127
description="A cool description"
128+
disabled={args.disabled}
127129
labels={[
128130
{
129131
displayType: 'success',
@@ -372,7 +374,6 @@ export function CardWithUser(args: any) {
372374
<div className="col-md-4">
373375
<ClayCardWithUser
374376
description="Assistant to the regional manager"
375-
disabled={args.disabled}
376377
name="Abraham Kuyper"
377378
stickerTitle="User Icon"
378379
userImageSrc="https://via.placeholder.com/256"

packages/clay-core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ export {IconSelector} from './icon-selector';
99
export {KeyboardArrowsIndicator} from './keyboard-arrows-indicator';
1010
export type {
1111
KeyboardArrowsIndicatorDirection,
12-
KeyboardArrowsIndicatorPlacement,
1312
KeyboardArrowsIndicatorProps,
14-
KeyboardArrowsIndicatorSize,
15-
KeyboardArrowsIndicatorVisibility,
1613
} from './keyboard-arrows-indicator';
1714
export {LanguagePicker} from './language-picker';
1815

packages/clay-core/src/keyboard-arrows-indicator/Key.tsx

Lines changed: 0 additions & 31 deletions
This file was deleted.

packages/clay-core/src/keyboard-arrows-indicator/KeyboardArrowsIndicator.tsx

Lines changed: 10 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@
33
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
44
*/
55

6+
import ClayIcon from '@clayui/icon';
67
import classNames from 'classnames';
78
import React from 'react';
89

9-
import {Key} from './Key';
10-
1110
export type Direction = 'all' | 'horizontal' | 'vertical';
1211

13-
export type Placement = 'floating' | 'inline';
14-
15-
export type Size = 'md' | 'sm';
16-
17-
export type Visibility = 'always' | 'on-focus';
18-
1912
export type Props = {
2013

2114
/**
@@ -24,8 +17,11 @@ export type Props = {
2417
className?: string;
2518

2619
/**
27-
* Which arrow keys are active for navigation. Inactive keys are rendered
28-
* muted but remain visible so the inverted-T layout stays recognizable.
20+
* Which arrow keys are active for navigation. Selects the matching
21+
* state class (`clay-keyboard-arrows-all`,
22+
* `clay-keyboard-arrows-horizontal`, or `clay-keyboard-arrows-vertical`)
23+
* on the wrapper, which CSS uses to mute the inactive keycap paths
24+
* inside the single `arrows-all` icon.
2925
*/
3026
direction: Direction;
3127

@@ -37,35 +33,10 @@ export type Props = {
3733
label?: string;
3834

3935
/**
40-
* How the indicator is positioned within its parent. `inline` (default)
41-
* leaves the indicator in normal flow. `floating` pins it to the
42-
* bottom-right corner of the closest positioned ancestor — useful for
43-
* popup chrome (DropDown, Picker, Autocomplete) where the indicator
44-
* should overlay the panel without shifting content.
45-
*/
46-
placement?: Placement;
47-
48-
/**
49-
* Pixel scale of the indicator. `md` (default) ≈ 64×40 px to match the
50-
* source mockup; `sm` ≈ 48×30 px for tighter chrome.
51-
*/
52-
size?: Size;
53-
54-
/**
55-
* Path to the Clay icon spritemap. Required when the consumer cannot
56-
* resolve `ClayIcon`'s default spritemap from context.
36+
* Path to the Clay icon spritemap. Optional when `ClayIconSpriteContext`
37+
* is provided by an ancestor `Provider`.
5738
*/
5839
spritemap?: string;
59-
60-
/**
61-
* When the indicator becomes visible. `always` (default) keeps it on
62-
* screen as long as the indicator is rendered. `on-focus` hides it
63-
* until the indicator's direct parent receives `:focus-within`, which
64-
* keeps inline consumers (Tables, navs, pickers in their resting state)
65-
* from showing the hint when the user isn't actually navigating with
66-
* the keyboard.
67-
*/
68-
visibility?: Visibility;
6940
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'aria-label' | 'role'>;
7041

7142
const DEFAULT_LABELS: Record<Direction, string> = {
@@ -78,51 +49,21 @@ export function KeyboardArrowsIndicator({
7849
className,
7950
direction,
8051
label,
81-
placement = 'inline',
82-
size = 'md',
8352
spritemap,
84-
visibility = 'always',
8553
...otherProps
8654
}: Props) {
87-
const verticalActive = direction === 'all' || direction === 'vertical';
88-
const horizontalActive = direction === 'all' || direction === 'horizontal';
89-
9055
return (
9156
<div
9257
{...otherProps}
9358
aria-label={label ?? DEFAULT_LABELS[direction]}
9459
className={classNames(
9560
'clay-keyboard-arrows-indicator',
96-
`clay-keyboard-arrows-indicator-${size}`,
97-
{
98-
'clay-keyboard-arrows-indicator-floating':
99-
placement === 'floating',
100-
'clay-keyboard-arrows-indicator-on-focus':
101-
visibility === 'on-focus',
102-
},
61+
`clay-keyboard-arrows-${direction}`,
10362
className
10463
)}
10564
role="img"
10665
>
107-
<Key active={verticalActive} position="up" spritemap={spritemap} />
108-
109-
<Key
110-
active={horizontalActive}
111-
position="left"
112-
spritemap={spritemap}
113-
/>
114-
115-
<Key
116-
active={verticalActive}
117-
position="down"
118-
spritemap={spritemap}
119-
/>
120-
121-
<Key
122-
active={horizontalActive}
123-
position="right"
124-
spritemap={spritemap}
125-
/>
66+
<ClayIcon spritemap={spritemap} symbol="arrows-all" />
12667
</div>
12768
);
12869
}

0 commit comments

Comments
 (0)