@kaizen/components 1.67.22 → 1.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/__actions__/Button/v3/Button.cjs +43 -8
- package/dist/cjs/__actions__/Button/v3/Button.module.css.cjs +21 -0
- package/dist/cjs/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.cjs +37 -0
- package/dist/cjs/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css.cjs +9 -0
- package/dist/cjs/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.cjs +35 -0
- package/dist/cjs/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css.cjs +8 -0
- package/dist/cjs/__overlays__/Tooltip/v3/Tooltip.cjs +2 -2
- package/dist/esm/__actions__/Button/v3/Button.mjs +44 -9
- package/dist/esm/__actions__/Button/v3/Button.module.css.mjs +19 -0
- package/dist/esm/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.mjs +28 -0
- package/dist/esm/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css.mjs +7 -0
- package/dist/esm/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.mjs +26 -0
- package/dist/esm/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css.mjs +6 -0
- package/dist/esm/__overlays__/Tooltip/v3/Tooltip.mjs +1 -1
- package/dist/styles.css +276 -91
- package/dist/types/__actions__/Button/v3/Button.d.ts +17 -4
- package/dist/types/__actions__/Button/v3/index.d.ts +1 -0
- package/dist/types/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.d.ts +11 -0
- package/dist/types/__actions__/Button/v3/subcomponents/ButtonContent/index.d.ts +1 -0
- package/dist/types/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.d.ts +5 -0
- package/dist/types/__actions__/Button/v3/subcomponents/PendingContent/index.d.ts +1 -0
- package/dist/types/__actions__/Button/v3/subcomponents/index.d.ts +2 -0
- package/dist/types/__actions__/Button/v3/types.d.ts +21 -0
- package/package.json +1 -1
- package/src/__actions__/Button/v3/Button.module.css +235 -0
- package/src/__actions__/Button/v3/Button.tsx +92 -29
- package/src/__actions__/Button/v3/_docs/Button--api-specification.mdx +150 -0
- package/src/__actions__/Button/v3/_docs/Button--usage-guidelines.mdx +30 -0
- package/src/__actions__/Button/v3/_docs/Button.docs.stories.tsx +112 -50
- package/src/__actions__/Button/v3/_docs/Button.spec.stories.tsx +80 -120
- package/src/__actions__/Button/v3/_docs/Button.stickersheet.stories.tsx +183 -81
- package/src/__actions__/Button/v3/index.ts +1 -0
- package/src/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css +19 -0
- package/src/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.tsx +40 -0
- package/src/__actions__/Button/v3/subcomponents/ButtonContent/index.ts +1 -0
- package/src/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css +16 -0
- package/src/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.tsx +28 -0
- package/src/__actions__/Button/v3/subcomponents/PendingContent/index.ts +1 -0
- package/src/__actions__/Button/v3/subcomponents/index.ts +2 -0
- package/src/__actions__/Button/v3/types.ts +25 -0
- package/src/__actions__/Menu/v3/_docs/Menu.docs.stories.tsx +54 -18
- package/src/__actions__/Menu/v3/_docs/Menu.spec.stories.tsx +30 -10
- package/src/__actions__/Menu/v3/_docs/Menu.stories.tsx +12 -4
- package/src/__future__/Icon/_docs/Icon.docs.stories.tsx +7 -7
- package/src/__overlays__/Tooltip/v3/Tooltip.tsx +1 -1
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.spec.stories.tsx +2 -0
- package/dist/cjs/__actions__/Button/v3/Button.module.scss.cjs +0 -9
- package/dist/esm/__actions__/Button/v3/Button.module.scss.mjs +0 -7
- package/src/__actions__/Button/v3/Button.module.scss +0 -104
- package/src/__actions__/Button/v3/_docs/ApiSpecification.mdx +0 -173
- package/src/__actions__/Button/v3/_docs/Button.mdx +0 -41
- package/src/__actions__/Button/v3/_docs/Button.stories.tsx +0 -98
|
@@ -1,112 +1,214 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { Meta } from "@storybook/react"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { within } from "@storybook/test"
|
|
4
|
+
import { Icon } from "~components/__future__/Icon"
|
|
5
5
|
import {
|
|
6
6
|
StickerSheet,
|
|
7
7
|
StickerSheetStory,
|
|
8
8
|
} from "~storybook/components/StickerSheet"
|
|
9
|
-
import { Button } from "../index"
|
|
9
|
+
import { Button, ButtonSizes, ButtonVariants } from "../index"
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
title: "Actions/Button/Button (v3)
|
|
12
|
+
title: "Actions/Button/Button (v3)",
|
|
13
13
|
parameters: {
|
|
14
14
|
chromatic: { disable: false },
|
|
15
15
|
controls: { disable: true },
|
|
16
16
|
},
|
|
17
17
|
} satisfies Meta
|
|
18
18
|
|
|
19
|
+
const variants = ["primary", "secondary", "tertiary"] satisfies ButtonVariants[]
|
|
20
|
+
const sizes = ["small", "medium", "large"] satisfies ButtonSizes[]
|
|
21
|
+
|
|
22
|
+
const RowTemplate = ({
|
|
23
|
+
isReversed = false,
|
|
24
|
+
}: {
|
|
25
|
+
isReversed?: boolean
|
|
26
|
+
}): JSX.Element => (
|
|
27
|
+
<>
|
|
28
|
+
{variants.map(variant =>
|
|
29
|
+
sizes.map(size => (
|
|
30
|
+
<StickerSheet.Row
|
|
31
|
+
key={size + variant}
|
|
32
|
+
isReversed={isReversed}
|
|
33
|
+
rowTitle={`${variant} (${size})`}
|
|
34
|
+
>
|
|
35
|
+
<Button variant={variant} size={size}>
|
|
36
|
+
Label
|
|
37
|
+
</Button>
|
|
38
|
+
<Button
|
|
39
|
+
icon={<Icon name="add" isPresentational />}
|
|
40
|
+
variant={variant}
|
|
41
|
+
size={size}
|
|
42
|
+
>
|
|
43
|
+
Label
|
|
44
|
+
</Button>
|
|
45
|
+
<Button
|
|
46
|
+
icon={
|
|
47
|
+
<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />
|
|
48
|
+
}
|
|
49
|
+
iconPosition="end"
|
|
50
|
+
variant={variant}
|
|
51
|
+
size={size}
|
|
52
|
+
>
|
|
53
|
+
Label
|
|
54
|
+
</Button>
|
|
55
|
+
<Button
|
|
56
|
+
icon={
|
|
57
|
+
<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />
|
|
58
|
+
}
|
|
59
|
+
iconPosition="end"
|
|
60
|
+
variant={variant}
|
|
61
|
+
isPending
|
|
62
|
+
pendingLabel="Submitting"
|
|
63
|
+
size={size}
|
|
64
|
+
>
|
|
65
|
+
Label
|
|
66
|
+
</Button>
|
|
67
|
+
<Button
|
|
68
|
+
icon={
|
|
69
|
+
<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />
|
|
70
|
+
}
|
|
71
|
+
iconPosition="end"
|
|
72
|
+
variant={variant}
|
|
73
|
+
isPending
|
|
74
|
+
pendingLabel="Submitting"
|
|
75
|
+
hasHiddenPendingLabel
|
|
76
|
+
size={size}
|
|
77
|
+
>
|
|
78
|
+
Label
|
|
79
|
+
</Button>
|
|
80
|
+
<Button
|
|
81
|
+
icon={
|
|
82
|
+
<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />
|
|
83
|
+
}
|
|
84
|
+
iconPosition="end"
|
|
85
|
+
variant={variant}
|
|
86
|
+
size={size}
|
|
87
|
+
isDisabled
|
|
88
|
+
>
|
|
89
|
+
Label
|
|
90
|
+
</Button>
|
|
91
|
+
</StickerSheet.Row>
|
|
92
|
+
))
|
|
93
|
+
)}
|
|
94
|
+
</>
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const IconButtonRowTemplate = ({
|
|
98
|
+
isReversed = false,
|
|
99
|
+
}: {
|
|
100
|
+
isReversed?: boolean
|
|
101
|
+
}): JSX.Element => (
|
|
102
|
+
<>
|
|
103
|
+
{sizes.map(size => (
|
|
104
|
+
<StickerSheet.Row
|
|
105
|
+
isReversed={isReversed}
|
|
106
|
+
rowTitle={size}
|
|
107
|
+
key={size + variants}
|
|
108
|
+
>
|
|
109
|
+
{variants.map(variant => (
|
|
110
|
+
<span className="flex gap-8" key={variant}>
|
|
111
|
+
<Button
|
|
112
|
+
icon={<Icon name="delete" isPresentational />}
|
|
113
|
+
hasHiddenLabel
|
|
114
|
+
size={size}
|
|
115
|
+
variant={variant}
|
|
116
|
+
>
|
|
117
|
+
Label
|
|
118
|
+
</Button>
|
|
119
|
+
<Button
|
|
120
|
+
icon={<Icon name="delete" isPresentational />}
|
|
121
|
+
size={size}
|
|
122
|
+
isPending
|
|
123
|
+
hasHiddenLabel
|
|
124
|
+
pendingLabel="Submitting"
|
|
125
|
+
variant={variant}
|
|
126
|
+
>
|
|
127
|
+
Label
|
|
128
|
+
</Button>
|
|
129
|
+
</span>
|
|
130
|
+
))}
|
|
131
|
+
</StickerSheet.Row>
|
|
132
|
+
))}
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
135
|
+
|
|
19
136
|
const StickerSheetTemplate: StickerSheetStory = {
|
|
20
137
|
render: ({ isReversed }) => (
|
|
21
138
|
<>
|
|
22
139
|
<StickerSheet heading="Button" isReversed={isReversed}>
|
|
23
140
|
<StickerSheet.Header
|
|
24
|
-
headings={[
|
|
141
|
+
headings={[
|
|
142
|
+
"Base",
|
|
143
|
+
"Icon start",
|
|
144
|
+
"Icon end",
|
|
145
|
+
"isPending",
|
|
146
|
+
"hasHiddenPendingLabel",
|
|
147
|
+
"isDisabled",
|
|
148
|
+
]}
|
|
25
149
|
headingsWidth="10rem"
|
|
26
150
|
hasVerticalHeadings
|
|
27
151
|
verticalHeadingsWidth="12rem"
|
|
28
152
|
/>
|
|
29
153
|
<StickerSheet.Body>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
68
|
-
|
|
69
|
-
<TrashIcon role="presentation" />
|
|
70
|
-
</Button>
|
|
71
|
-
<Button aria-label="Label" isDisabled>
|
|
72
|
-
<LoadingSpinner size="sm" accessibilityLabel="submitting label" />
|
|
73
|
-
</Button>
|
|
74
|
-
</StickerSheet.Row>
|
|
75
|
-
<StickerSheet.Row rowTitle="Small">
|
|
76
|
-
<Button size="small">
|
|
77
|
-
Label
|
|
78
|
-
<ArrowForwardIcon role="presentation" />
|
|
79
|
-
</Button>
|
|
80
|
-
<Button size="small" isDisabled>
|
|
81
|
-
Label
|
|
82
|
-
<ArrowForwardIcon role="presentation" />
|
|
83
|
-
</Button>
|
|
84
|
-
<Button size="small" isDisabled>
|
|
85
|
-
<LoadingSpinner size="xs" accessibilityLabel="submitting label" />
|
|
86
|
-
</Button>
|
|
87
|
-
</StickerSheet.Row>
|
|
88
|
-
<StickerSheet.Row rowTitle="Icon only small">
|
|
89
|
-
<Button size="small">
|
|
90
|
-
<TrashIcon role="img" aria-label="Remove label" />
|
|
91
|
-
</Button>
|
|
92
|
-
<Button size="small" isDisabled>
|
|
93
|
-
<TrashIcon role="img" aria-label="Remove label" />
|
|
94
|
-
</Button>
|
|
95
|
-
<Button size="small" isDisabled>
|
|
96
|
-
<LoadingSpinner size="xs" accessibilityLabel="Removing label" />
|
|
97
|
-
</Button>
|
|
98
|
-
</StickerSheet.Row>
|
|
154
|
+
<RowTemplate isReversed={isReversed} />
|
|
155
|
+
</StickerSheet.Body>
|
|
156
|
+
</StickerSheet>
|
|
157
|
+
<StickerSheet heading="Icon only button" isReversed={isReversed}>
|
|
158
|
+
<StickerSheet.Header
|
|
159
|
+
headings={["primary", "secondary", "tertiary"]}
|
|
160
|
+
headingsWidth="10rem"
|
|
161
|
+
hasVerticalHeadings
|
|
162
|
+
verticalHeadingsWidth="12rem"
|
|
163
|
+
/>
|
|
164
|
+
<StickerSheet.Body>
|
|
165
|
+
<IconButtonRowTemplate isReversed={isReversed} />
|
|
166
|
+
</StickerSheet.Body>
|
|
167
|
+
</StickerSheet>
|
|
168
|
+
<StickerSheet heading="Pseudo states" isReversed={isReversed}>
|
|
169
|
+
<StickerSheet.Header
|
|
170
|
+
headings={["isHovered", "isFocusVisible", "isPressed"]}
|
|
171
|
+
headingsWidth="10rem"
|
|
172
|
+
hasVerticalHeadings
|
|
173
|
+
verticalHeadingsWidth="12rem"
|
|
174
|
+
/>
|
|
175
|
+
<StickerSheet.Body>
|
|
176
|
+
{variants.map(variant => (
|
|
177
|
+
<StickerSheet.Row
|
|
178
|
+
key={variant}
|
|
179
|
+
isReversed={isReversed}
|
|
180
|
+
rowTitle={variant}
|
|
181
|
+
>
|
|
182
|
+
<Button data-testid="testid__button-hover" variant={variant}>
|
|
183
|
+
Label
|
|
184
|
+
</Button>
|
|
185
|
+
<Button data-testid="testid__button-focus" variant={variant}>
|
|
186
|
+
Label
|
|
187
|
+
</Button>
|
|
188
|
+
<Button data-testid="testid__button-pressed" variant={variant}>
|
|
189
|
+
Label
|
|
190
|
+
</Button>
|
|
191
|
+
</StickerSheet.Row>
|
|
192
|
+
))}
|
|
99
193
|
</StickerSheet.Body>
|
|
100
194
|
</StickerSheet>
|
|
101
195
|
</>
|
|
102
196
|
),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
197
|
+
play: ({ canvasElement }) => {
|
|
198
|
+
const canvas = within(canvasElement)
|
|
199
|
+
const focusButtons = canvas.getAllByTestId("testid__button-focus")
|
|
200
|
+
const hoverButtons = canvas.getAllByTestId("testid__button-hover")
|
|
201
|
+
const pressedButton = canvas.getAllByTestId("testid__button-pressed")
|
|
202
|
+
|
|
203
|
+
focusButtons.forEach(button => {
|
|
204
|
+
button.setAttribute("data-focus-visible", "true")
|
|
205
|
+
})
|
|
206
|
+
hoverButtons.forEach(button => {
|
|
207
|
+
button.setAttribute("data-hovered", "true")
|
|
208
|
+
})
|
|
209
|
+
pressedButton.forEach(button => {
|
|
210
|
+
button.setAttribute("data-pressed", "true")
|
|
211
|
+
})
|
|
110
212
|
},
|
|
111
213
|
}
|
|
112
214
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.buttonContent {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--button-icon-gap, var(--spacing-6));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.large {
|
|
8
|
+
--button-icon-gap: var(--spacing-8);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.buttonLabel {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.buttonIcon {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import { VisuallyHidden } from "~components/VisuallyHidden"
|
|
4
|
+
import { ButtonProps } from "../../Button"
|
|
5
|
+
import styles from "./ButtonContent.module.css"
|
|
6
|
+
|
|
7
|
+
type ButtonContentProps = {
|
|
8
|
+
size?: ButtonProps["size"]
|
|
9
|
+
icon?: ButtonProps["icon"]
|
|
10
|
+
iconPosition?: ButtonProps["iconPosition"]
|
|
11
|
+
hasHiddenLabel?: ButtonProps["hasHiddenLabel"]
|
|
12
|
+
} & HTMLAttributes<HTMLSpanElement>
|
|
13
|
+
|
|
14
|
+
/** Renders the inner content of the button, handling icon and label visibility */
|
|
15
|
+
export const ButtonContent = ({
|
|
16
|
+
children,
|
|
17
|
+
hasHiddenLabel,
|
|
18
|
+
size = "medium",
|
|
19
|
+
icon,
|
|
20
|
+
iconPosition = "start",
|
|
21
|
+
className,
|
|
22
|
+
...restProps
|
|
23
|
+
}: ButtonContentProps): JSX.Element => (
|
|
24
|
+
<span
|
|
25
|
+
className={classNames(className, styles.buttonContent, styles[size])}
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
{icon && iconPosition === "start" && (
|
|
29
|
+
<span className={styles.buttonIcon}>{icon}</span>
|
|
30
|
+
)}
|
|
31
|
+
{hasHiddenLabel ? (
|
|
32
|
+
<VisuallyHidden>{children}</VisuallyHidden>
|
|
33
|
+
) : (
|
|
34
|
+
<span className={styles.buttonLabel}>{children}</span>
|
|
35
|
+
)}
|
|
36
|
+
{icon && iconPosition === "end" && (
|
|
37
|
+
<span className={styles.buttonIcon}>{icon}</span>
|
|
38
|
+
)}
|
|
39
|
+
</span>
|
|
40
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ButtonContent"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.pendingContent {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--button-pending-content-gap, var(--spacing-6));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.large {
|
|
8
|
+
--button-pending-content-gap: var(--spacing-8);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.centerSpinner {
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 50%;
|
|
14
|
+
top: 50%;
|
|
15
|
+
transform: translate(-50%, -50%);
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import { LoadingSpinner } from "~components/Loading"
|
|
4
|
+
import { VisuallyHidden } from "~components/VisuallyHidden"
|
|
5
|
+
import { ButtonSizes, PendingProps } from "../../types"
|
|
6
|
+
import styles from "./PendingContent.module.css"
|
|
7
|
+
|
|
8
|
+
/** Renders the pending content of the button, handling pending label visibility and spinner positioning */
|
|
9
|
+
export const PendingContent = ({
|
|
10
|
+
pendingLabel,
|
|
11
|
+
hasHiddenPendingLabel = false,
|
|
12
|
+
size = "medium",
|
|
13
|
+
}: PendingProps & { size?: ButtonSizes }): JSX.Element => (
|
|
14
|
+
<span className={classNames(styles.pendingContent, styles[size])}>
|
|
15
|
+
{hasHiddenPendingLabel ? (
|
|
16
|
+
<VisuallyHidden>{pendingLabel}</VisuallyHidden>
|
|
17
|
+
) : (
|
|
18
|
+
<span>{pendingLabel}</span>
|
|
19
|
+
)}
|
|
20
|
+
<LoadingSpinner
|
|
21
|
+
size={size === "small" ? "xs" : "sm"}
|
|
22
|
+
accessibilityLabel=""
|
|
23
|
+
classNameOverride={
|
|
24
|
+
hasHiddenPendingLabel ? styles.centerSpinner : undefined
|
|
25
|
+
}
|
|
26
|
+
/>
|
|
27
|
+
</span>
|
|
28
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PendingContent"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ButtonVariants = "primary" | "secondary" | "tertiary"
|
|
2
|
+
|
|
3
|
+
export type ButtonSizes = "small" | "medium" | "large"
|
|
4
|
+
|
|
5
|
+
export type PendingPropsUndefined = {
|
|
6
|
+
isPending?: undefined
|
|
7
|
+
/** Rendered as the child while `isPending` is `true`. This determines the accessible label for the Button while pending. */
|
|
8
|
+
pendingLabel?: never
|
|
9
|
+
/** Visually hides the `pendingLabel` and renders the loading spinner. This will maintain the width of the Button's `children` to avoid layout shifts.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
hasHiddenPendingLabel?: never
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type PendingProps = {
|
|
16
|
+
isPending: boolean
|
|
17
|
+
/** Rendered as the child while `pendingLabel` is `true`. This determines the accessible label for the Button while pending. */
|
|
18
|
+
pendingLabel: string
|
|
19
|
+
/** Visually Hides the `pendingLabel` and renders the loading spinner. This will maintain the width of the Button's `children` to avoid layout shifts.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
hasHiddenPendingLabel?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type PendingButtonProps = PendingProps | PendingPropsUndefined
|
|
@@ -41,8 +41,12 @@ const DefaultMenuItems = (): ReactNode => (
|
|
|
41
41
|
export const Actions: Story = {
|
|
42
42
|
render: ({ defaultOpen: _, ...args }) => (
|
|
43
43
|
<MenuTrigger {...args}>
|
|
44
|
-
<Button
|
|
45
|
-
|
|
44
|
+
<Button
|
|
45
|
+
size="large"
|
|
46
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
47
|
+
hasHiddenLabel
|
|
48
|
+
>
|
|
49
|
+
Additional actions
|
|
46
50
|
</Button>
|
|
47
51
|
<Popover>
|
|
48
52
|
<Menu>
|
|
@@ -59,8 +63,12 @@ export const Actions: Story = {
|
|
|
59
63
|
export const ItemsDo: Story = {
|
|
60
64
|
render: ({ defaultOpen, ...args }) => (
|
|
61
65
|
<MenuTrigger defaultOpen={defaultOpen} {...args}>
|
|
62
|
-
<Button
|
|
63
|
-
|
|
66
|
+
<Button
|
|
67
|
+
size="large"
|
|
68
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
69
|
+
hasHiddenLabel
|
|
70
|
+
>
|
|
71
|
+
Additional actions
|
|
64
72
|
</Button>
|
|
65
73
|
<Popover>
|
|
66
74
|
<Menu>
|
|
@@ -74,8 +82,12 @@ export const ItemsDo: Story = {
|
|
|
74
82
|
export const ItemsDont: Story = {
|
|
75
83
|
render: ({ defaultOpen, ...args }) => (
|
|
76
84
|
<MenuTrigger defaultOpen={defaultOpen} {...args}>
|
|
77
|
-
<Button
|
|
78
|
-
|
|
85
|
+
<Button
|
|
86
|
+
size="large"
|
|
87
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
88
|
+
hasHiddenLabel
|
|
89
|
+
>
|
|
90
|
+
Additional actions
|
|
79
91
|
</Button>
|
|
80
92
|
<Popover>
|
|
81
93
|
<Menu>
|
|
@@ -171,8 +183,12 @@ export const LabelDont: Story = {
|
|
|
171
183
|
export const IconsDont: Story = {
|
|
172
184
|
render: ({ defaultOpen, ...args }) => (
|
|
173
185
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
174
|
-
<Button
|
|
175
|
-
|
|
186
|
+
<Button
|
|
187
|
+
size="large"
|
|
188
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
189
|
+
hasHiddenLabel
|
|
190
|
+
>
|
|
191
|
+
Additional actions
|
|
176
192
|
</Button>
|
|
177
193
|
<Popover>
|
|
178
194
|
<Menu {...args}>
|
|
@@ -193,8 +209,12 @@ export const IconsDont: Story = {
|
|
|
193
209
|
export const MenuItemLabelsDont: Story = {
|
|
194
210
|
render: ({ defaultOpen, ...args }) => (
|
|
195
211
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
196
|
-
<Button
|
|
197
|
-
|
|
212
|
+
<Button
|
|
213
|
+
size="large"
|
|
214
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
215
|
+
hasHiddenLabel
|
|
216
|
+
>
|
|
217
|
+
Additional actions
|
|
198
218
|
</Button>
|
|
199
219
|
<Popover>
|
|
200
220
|
<Menu {...args}>
|
|
@@ -210,8 +230,12 @@ export const MenuItemLabelsDont: Story = {
|
|
|
210
230
|
export const SentenceCaseDo: Story = {
|
|
211
231
|
render: ({ defaultOpen, ...args }) => (
|
|
212
232
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
213
|
-
<Button
|
|
214
|
-
|
|
233
|
+
<Button
|
|
234
|
+
size="large"
|
|
235
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
236
|
+
hasHiddenLabel
|
|
237
|
+
>
|
|
238
|
+
Additional actions
|
|
215
239
|
</Button>
|
|
216
240
|
<Popover>
|
|
217
241
|
<Menu {...args}>
|
|
@@ -227,8 +251,12 @@ export const SentenceCaseDo: Story = {
|
|
|
227
251
|
export const SentenceCaseDont: Story = {
|
|
228
252
|
render: ({ defaultOpen, ...args }) => (
|
|
229
253
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
230
|
-
<Button
|
|
231
|
-
|
|
254
|
+
<Button
|
|
255
|
+
size="large"
|
|
256
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
257
|
+
hasHiddenLabel
|
|
258
|
+
>
|
|
259
|
+
Additional actions
|
|
232
260
|
</Button>
|
|
233
261
|
<Popover>
|
|
234
262
|
<Menu {...args}>
|
|
@@ -244,8 +272,12 @@ export const SentenceCaseDont: Story = {
|
|
|
244
272
|
export const ElipsesDo: Story = {
|
|
245
273
|
render: ({ defaultOpen, ...args }) => (
|
|
246
274
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
247
|
-
<Button
|
|
248
|
-
|
|
275
|
+
<Button
|
|
276
|
+
size="large"
|
|
277
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
278
|
+
hasHiddenLabel
|
|
279
|
+
>
|
|
280
|
+
Additional actions
|
|
249
281
|
</Button>
|
|
250
282
|
<Popover>
|
|
251
283
|
<Menu {...args}>
|
|
@@ -261,8 +293,12 @@ export const ElipsesDo: Story = {
|
|
|
261
293
|
export const ElipsesDont: Story = {
|
|
262
294
|
render: ({ defaultOpen, ...args }) => (
|
|
263
295
|
<MenuTrigger defaultOpen={defaultOpen}>
|
|
264
|
-
<Button
|
|
265
|
-
|
|
296
|
+
<Button
|
|
297
|
+
size="large"
|
|
298
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
299
|
+
hasHiddenLabel
|
|
300
|
+
>
|
|
301
|
+
Additional actions
|
|
266
302
|
</Button>
|
|
267
303
|
<Popover>
|
|
268
304
|
<Menu {...args}>
|
|
@@ -36,8 +36,12 @@ export const KitchenSink: Story = {
|
|
|
36
36
|
],
|
|
37
37
|
render: ({ defaultOpen, ...args }) => (
|
|
38
38
|
<MenuTrigger defaultOpen={defaultOpen} {...args}>
|
|
39
|
-
<Button
|
|
40
|
-
|
|
39
|
+
<Button
|
|
40
|
+
size="large"
|
|
41
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
42
|
+
hasHiddenLabel
|
|
43
|
+
>
|
|
44
|
+
Additional actions
|
|
41
45
|
</Button>
|
|
42
46
|
<Popover>
|
|
43
47
|
<Menu>
|
|
@@ -84,9 +88,14 @@ export const KitchenSink: Story = {
|
|
|
84
88
|
export const Basic: Story = {
|
|
85
89
|
render: ({ defaultOpen, ...args }) => (
|
|
86
90
|
<MenuTrigger defaultOpen={defaultOpen} {...args}>
|
|
87
|
-
<Button
|
|
88
|
-
|
|
91
|
+
<Button
|
|
92
|
+
size="large"
|
|
93
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
94
|
+
hasHiddenLabel
|
|
95
|
+
>
|
|
96
|
+
Additional actions
|
|
89
97
|
</Button>
|
|
98
|
+
|
|
90
99
|
<Popover>
|
|
91
100
|
<Menu>
|
|
92
101
|
<MenuItem
|
|
@@ -165,8 +174,12 @@ const mockOnClick = fn()
|
|
|
165
174
|
export const DisabledItems: Story = {
|
|
166
175
|
render: () => (
|
|
167
176
|
<MenuTrigger>
|
|
168
|
-
<Button
|
|
169
|
-
|
|
177
|
+
<Button
|
|
178
|
+
size="large"
|
|
179
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
180
|
+
hasHiddenLabel
|
|
181
|
+
>
|
|
182
|
+
Additional actions
|
|
170
183
|
</Button>
|
|
171
184
|
<Popover>
|
|
172
185
|
<Menu>
|
|
@@ -205,8 +218,12 @@ export const DisabledItems: Story = {
|
|
|
205
218
|
export const WithSections: Story = {
|
|
206
219
|
render: () => (
|
|
207
220
|
<MenuTrigger>
|
|
208
|
-
<Button
|
|
209
|
-
|
|
221
|
+
<Button
|
|
222
|
+
size="large"
|
|
223
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
224
|
+
hasHiddenLabel
|
|
225
|
+
>
|
|
226
|
+
Additional actions
|
|
210
227
|
</Button>
|
|
211
228
|
<Popover>
|
|
212
229
|
<Menu>
|
|
@@ -237,8 +254,11 @@ export const Controlled: Story = {
|
|
|
237
254
|
Toggle open
|
|
238
255
|
</button>
|
|
239
256
|
<MenuTrigger isOpen={isOpen} onOpenChange={setOpen}>
|
|
240
|
-
<Button
|
|
241
|
-
<Icon name="more_horiz"
|
|
257
|
+
<Button
|
|
258
|
+
icon={<Icon name="more_horiz" isPresentational />}
|
|
259
|
+
hasHiddenLabel
|
|
260
|
+
>
|
|
261
|
+
Additional actions
|
|
242
262
|
</Button>
|
|
243
263
|
<Popover>
|
|
244
264
|
<Menu>
|