@dxc-technology/halstack-react 0.0.0-ec7b867 → 0.0.0-ecc45e2
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/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +12 -12
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +5 -1
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +14 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +5 -1
- package/alert/Alert.js +4 -1
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +5 -0
- package/{list → badge}/types.js +0 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +22 -32
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{radio → bulleted-list}/types.js +0 -0
- package/button/Button.js +53 -68
- package/button/Button.stories.tsx +9 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +24 -27
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +7 -3
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +1 -1
- package/common/variables.js +229 -336
- package/date-input/DateInput.js +56 -42
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +46 -50
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -250
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +591 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.js +9 -6
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/{row → flex}/types.js +0 -0
- package/footer/Footer.js +15 -88
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +1 -1
- package/header/Header.js +95 -114
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +71 -131
- package/layout/ApplicationLayout.stories.tsx +83 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +95 -53
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +7 -23
- package/main.d.ts +10 -15
- package/main.js +48 -82
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +12 -10
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +308 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +57 -51
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -0
- package/quick-nav/types.d.ts +21 -0
- package/{stack → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +25 -24
- package/radio-group/RadioGroup.js +58 -50
- package/radio-group/RadioGroup.stories.tsx +60 -39
- package/radio-group/RadioGroup.test.js +530 -83
- package/radio-group/types.d.ts +80 -2
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +199 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +145 -365
- package/select/Select.stories.tsx +231 -176
- package/select/Select.test.js +2175 -0
- package/select/types.d.ts +52 -12
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +5 -4
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +187 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/spinner/Spinner.test.js +64 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +127 -55
- package/switch/Switch.stories.tsx +20 -42
- package/switch/Switch.test.js +212 -0
- package/switch/types.d.ts +9 -6
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +5 -1
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +14 -19
- package/tag/Tag.stories.tsx +12 -8
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +1 -1
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +68 -101
- package/text-input/TextInput.stories.tsx +31 -14
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +31 -12
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +33 -12
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +9 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +58 -54
- package/wizard/Wizard.stories.tsx +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -10
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -9
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
-
|
|
9
5
|
import DxcSelect from "./Select";
|
|
6
|
+
import Listbox from "./Listbox";
|
|
7
|
+
import DxcButton from "../button/Button";
|
|
8
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "Select",
|
|
13
12
|
component: DxcSelect,
|
|
14
13
|
};
|
|
15
|
-
const one_option = [{ label: "Option 01", value: "1" }];
|
|
16
14
|
|
|
15
|
+
const one_option = [{ label: "Option 01", value: "1" }];
|
|
17
16
|
const single_options = [
|
|
18
17
|
{ label: "Option 01", value: "1" },
|
|
19
18
|
{ label: "Option 02", value: "2" },
|
|
@@ -224,10 +223,12 @@ const optionsWithEllipsisMedium = [
|
|
|
224
223
|
{ label: "Optiond1234567890123456789012345678901234", value: "1" },
|
|
225
224
|
{ label: "Optiond12345678901234567890123456789012345", value: "2" },
|
|
226
225
|
{ label: "Option 031111111111111111111111111111222", value: "3" },
|
|
227
|
-
{ label: "Option
|
|
226
|
+
{ label: "Option 03111111111111111111111111111222", value: "4" },
|
|
228
227
|
];
|
|
228
|
+
|
|
229
229
|
const Select = () => (
|
|
230
230
|
<>
|
|
231
|
+
<Title title="States" theme="light" level={2} />
|
|
231
232
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
232
233
|
<Title title="Hovered" theme="light" level={4} />
|
|
233
234
|
<DxcSelect label="Hovered" options={single_options} />
|
|
@@ -242,115 +243,211 @@ const Select = () => (
|
|
|
242
243
|
</ExampleContainer>
|
|
243
244
|
<ExampleContainer>
|
|
244
245
|
<Title title="Disabled with value" theme="light" level={4} />
|
|
245
|
-
<DxcSelect label="Disabled with value" disabled options={single_options}
|
|
246
|
+
<DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
|
|
246
247
|
</ExampleContainer>
|
|
247
248
|
<ExampleContainer>
|
|
248
|
-
<Title title="With label" theme="light" level={4} />
|
|
249
|
-
<DxcSelect label="Label" options={single_options} />
|
|
250
|
-
<Title title="Label and placeholder" theme="light" level={4} />
|
|
251
|
-
<DxcSelect label="Label" options={single_options} placeholder="Placeholder" />
|
|
252
|
-
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
253
|
-
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
254
249
|
<Title title="Error" theme="light" level={4} />
|
|
255
250
|
<DxcSelect
|
|
256
251
|
label="Label"
|
|
257
252
|
options={single_options}
|
|
258
|
-
error="Error message"
|
|
253
|
+
error="Error message."
|
|
259
254
|
helperText="Helper text"
|
|
260
255
|
placeholder="Placeholder"
|
|
261
256
|
/>
|
|
257
|
+
</ExampleContainer>
|
|
258
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
259
|
+
<Title title="Hovered error" theme="light" level={4} />
|
|
260
|
+
<DxcSelect
|
|
261
|
+
label="Label"
|
|
262
|
+
options={single_options}
|
|
263
|
+
error="Error message."
|
|
264
|
+
helperText="Helper text"
|
|
265
|
+
placeholder="Placeholder"
|
|
266
|
+
/>
|
|
267
|
+
</ExampleContainer>
|
|
268
|
+
<Title title="Anatomy" theme="light" level={2} />
|
|
269
|
+
<ExampleContainer>
|
|
270
|
+
<Title title="Label, placeholder and helper text" theme="light" level={4} />
|
|
271
|
+
<DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
|
|
272
|
+
</ExampleContainer>
|
|
273
|
+
<Title title="Variants" theme="light" level={2} />
|
|
274
|
+
<ExampleContainer>
|
|
262
275
|
<Title title="Simple selection" theme="light" level={4} />
|
|
263
|
-
<DxcSelect label="Simple selection" searchable options={single_options}
|
|
276
|
+
<DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
|
|
277
|
+
</ExampleContainer>
|
|
278
|
+
<ExampleContainer>
|
|
264
279
|
<Title title="Multiple selection" theme="light" level={4} />
|
|
265
|
-
<DxcSelect label="Multiple select" searchable options={single_options} multiple
|
|
280
|
+
<DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
|
|
266
281
|
</ExampleContainer>
|
|
267
|
-
|
|
268
282
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
269
283
|
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
270
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
284
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
271
285
|
</ExampleContainer>
|
|
272
|
-
|
|
273
286
|
<ExampleContainer pseudoState="pseudo-active">
|
|
274
287
|
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
275
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
288
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
289
|
+
</ExampleContainer>
|
|
290
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
291
|
+
<ExampleContainer>
|
|
292
|
+
<Title title="Small size" theme="light" level={4} />
|
|
293
|
+
<DxcSelect label="Small" options={single_options} size="small" />
|
|
294
|
+
</ExampleContainer>
|
|
295
|
+
<ExampleContainer>
|
|
296
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
297
|
+
<DxcSelect label="Medium" options={single_options} size="medium" />
|
|
298
|
+
</ExampleContainer>
|
|
299
|
+
<ExampleContainer>
|
|
300
|
+
<Title title="Large size" theme="light" level={4} />
|
|
301
|
+
<DxcSelect label="Large" options={single_options} size="large" />
|
|
302
|
+
</ExampleContainer>
|
|
303
|
+
<ExampleContainer>
|
|
304
|
+
<Title title="Fillparent size" theme="light" level={4} />
|
|
305
|
+
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
306
|
+
</ExampleContainer>
|
|
307
|
+
<Title title="Margins" theme="light" level={2} />
|
|
308
|
+
<ExampleContainer>
|
|
309
|
+
<Title title="xxsmall margin" theme="light" level={4} />
|
|
310
|
+
<DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
|
|
311
|
+
</ExampleContainer>
|
|
312
|
+
<ExampleContainer>
|
|
313
|
+
<Title title="xsmall margin" theme="light" level={4} />
|
|
314
|
+
<DxcSelect label="xSmall" options={single_options} margin="xsmall" />
|
|
315
|
+
</ExampleContainer>
|
|
316
|
+
<ExampleContainer>
|
|
317
|
+
<Title title="small margin" theme="light" level={4} />
|
|
318
|
+
<DxcSelect label="Small" options={single_options} margin="small" />
|
|
319
|
+
</ExampleContainer>
|
|
320
|
+
<ExampleContainer>
|
|
321
|
+
<Title title="medium margin" theme="light" level={4} />
|
|
322
|
+
<DxcSelect label="Medium" options={single_options} margin="medium" />
|
|
323
|
+
</ExampleContainer>
|
|
324
|
+
<ExampleContainer>
|
|
325
|
+
<Title title="large margin" theme="light" level={4} />
|
|
326
|
+
<DxcSelect label="Large" options={single_options} margin="large" />
|
|
327
|
+
</ExampleContainer>
|
|
328
|
+
<ExampleContainer>
|
|
329
|
+
<Title title="xlarge margin" theme="light" level={4} />
|
|
330
|
+
<DxcSelect label="xLarge" options={single_options} margin="xlarge" />
|
|
331
|
+
</ExampleContainer>
|
|
332
|
+
<ExampleContainer>
|
|
333
|
+
<Title title="xxlarge margin" theme="light" level={4} />
|
|
334
|
+
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
276
335
|
</ExampleContainer>
|
|
277
|
-
<>
|
|
278
|
-
<Title title="Sizes" theme="light" level={2} />
|
|
279
|
-
<ExampleContainer>
|
|
280
|
-
<Title title="Small size" theme="light" level={4} />
|
|
281
|
-
<DxcSelect label="Small" options={single_options} size="small" />
|
|
282
|
-
</ExampleContainer>
|
|
283
|
-
<ExampleContainer>
|
|
284
|
-
<Title title="Medium size" theme="light" level={4} />
|
|
285
|
-
<DxcSelect label="Medium" options={single_options} size="medium" />
|
|
286
|
-
</ExampleContainer>
|
|
287
|
-
<ExampleContainer>
|
|
288
|
-
<Title title="Large size" theme="light" level={4} />
|
|
289
|
-
<DxcSelect label="Large" options={single_options} size="large" />
|
|
290
|
-
</ExampleContainer>
|
|
291
|
-
<ExampleContainer>
|
|
292
|
-
<Title title="Fillparent size" theme="light" level={4} />
|
|
293
|
-
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
294
|
-
</ExampleContainer>
|
|
295
|
-
</>
|
|
296
|
-
<>
|
|
297
|
-
<Title title="Margins" theme="light" level={2} />
|
|
298
|
-
<ExampleContainer>
|
|
299
|
-
<Title title="xxsmall margin" theme="light" level={4} />
|
|
300
|
-
<DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
|
|
301
|
-
</ExampleContainer>
|
|
302
|
-
<ExampleContainer>
|
|
303
|
-
<Title title="xsmall margin" theme="light" level={4} />
|
|
304
|
-
<DxcSelect label="xSmall" options={single_options} margin="xsmall" />
|
|
305
|
-
</ExampleContainer>
|
|
306
|
-
<ExampleContainer>
|
|
307
|
-
<Title title="small margin" theme="light" level={4} />
|
|
308
|
-
<DxcSelect label="Small" options={single_options} margin="small" />
|
|
309
|
-
</ExampleContainer>
|
|
310
|
-
<ExampleContainer>
|
|
311
|
-
<Title title="medium margin" theme="light" level={4} />
|
|
312
|
-
<DxcSelect label="Medium" options={single_options} margin="medium" />
|
|
313
|
-
</ExampleContainer>
|
|
314
|
-
<ExampleContainer>
|
|
315
|
-
<Title title="large margin" theme="light" level={4} />
|
|
316
|
-
<DxcSelect label="Large" options={single_options} margin="large" />
|
|
317
|
-
</ExampleContainer>
|
|
318
|
-
<ExampleContainer>
|
|
319
|
-
<Title title="xlarge margin" theme="light" level={4} />
|
|
320
|
-
<DxcSelect label="xLarge" options={single_options} margin="xlarge" />
|
|
321
|
-
</ExampleContainer>
|
|
322
|
-
<ExampleContainer>
|
|
323
|
-
<Title title="xxlarge margin" theme="light" level={4} />
|
|
324
|
-
<DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
|
|
325
|
-
</ExampleContainer>
|
|
326
|
-
</>
|
|
327
336
|
<ExampleContainer expanded>
|
|
328
337
|
<Title title="Ellipsis" theme="light" level={2} />
|
|
329
338
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
330
|
-
<DxcSelect label="Label" options={single_options} multiple
|
|
339
|
+
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
331
340
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
332
|
-
<DxcSelect label="Label" options={optionsWithEllipsisMedium}
|
|
333
|
-
<Title title="
|
|
341
|
+
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
|
|
342
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
334
343
|
<DxcSelect
|
|
335
344
|
label="Label"
|
|
336
345
|
placeholder="Choose an option"
|
|
337
|
-
|
|
346
|
+
defaultValue="1"
|
|
338
347
|
options={optionsWithEllipsisMedium}
|
|
339
348
|
size="medium"
|
|
340
349
|
/>
|
|
341
350
|
</ExampleContainer>
|
|
342
351
|
</>
|
|
343
352
|
);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const SelectListbox = () => (
|
|
354
|
+
<>
|
|
355
|
+
<Title title="Listbox" theme="light" level={2} />
|
|
356
|
+
<Title title="Default with opened listbox" theme="light" level={3} />
|
|
357
|
+
<ExampleContainer>
|
|
358
|
+
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
359
|
+
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
360
|
+
<DxcCheckbox
|
|
361
|
+
label="You understand the selection and give your consent"
|
|
362
|
+
onChange={() => {}}
|
|
363
|
+
labelPosition="after"
|
|
364
|
+
/>
|
|
365
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" />
|
|
366
|
+
</div>
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<Title title="Listbox option states" theme="light" level={3} />
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
371
|
+
<Listbox
|
|
372
|
+
id="x"
|
|
373
|
+
currentValue=""
|
|
374
|
+
options={one_option}
|
|
375
|
+
visualFocusIndex={-1}
|
|
376
|
+
lastOptionIndex={0}
|
|
377
|
+
multiple={false}
|
|
378
|
+
optional={false}
|
|
379
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
380
|
+
searchable={false}
|
|
381
|
+
handleOptionOnClick={() => {}}
|
|
382
|
+
getSelectWidth={() => 360}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active option" theme="light" level={4} />
|
|
387
|
+
<Listbox
|
|
388
|
+
id="x"
|
|
389
|
+
currentValue=""
|
|
390
|
+
options={one_option}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
lastOptionIndex={0}
|
|
393
|
+
multiple={false}
|
|
394
|
+
optional={false}
|
|
395
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
396
|
+
searchable={false}
|
|
397
|
+
handleOptionOnClick={() => {}}
|
|
398
|
+
getSelectWidth={() => 360}
|
|
399
|
+
|
|
400
|
+
/>
|
|
401
|
+
</ExampleContainer>
|
|
402
|
+
<ExampleContainer>
|
|
403
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
404
|
+
<Listbox
|
|
405
|
+
id="x"
|
|
406
|
+
currentValue=""
|
|
407
|
+
options={one_option}
|
|
408
|
+
visualFocusIndex={0}
|
|
409
|
+
lastOptionIndex={0}
|
|
410
|
+
multiple={false}
|
|
411
|
+
optional={false}
|
|
412
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
413
|
+
searchable={false}
|
|
414
|
+
handleOptionOnClick={() => {}}
|
|
415
|
+
getSelectWidth={() => 360}
|
|
416
|
+
/>
|
|
417
|
+
</ExampleContainer>
|
|
418
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
419
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
420
|
+
<Listbox
|
|
421
|
+
id="x"
|
|
422
|
+
currentValue="1"
|
|
423
|
+
options={single_options}
|
|
424
|
+
visualFocusIndex={-1}
|
|
425
|
+
lastOptionIndex={3}
|
|
426
|
+
multiple={false}
|
|
427
|
+
optional={false}
|
|
428
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
429
|
+
searchable={false}
|
|
430
|
+
handleOptionOnClick={() => {}}
|
|
431
|
+
getSelectWidth={() => 360}
|
|
432
|
+
/>
|
|
433
|
+
</ExampleContainer>
|
|
434
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
435
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
436
|
+
<Listbox
|
|
437
|
+
id="x"
|
|
438
|
+
currentValue="2"
|
|
439
|
+
options={single_options}
|
|
440
|
+
visualFocusIndex={0}
|
|
441
|
+
lastOptionIndex={3}
|
|
442
|
+
multiple={false}
|
|
443
|
+
optional={false}
|
|
444
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
445
|
+
searchable={false}
|
|
446
|
+
handleOptionOnClick={() => {}}
|
|
447
|
+
getSelectWidth={() => 360}
|
|
448
|
+
/>
|
|
449
|
+
</ExampleContainer>
|
|
450
|
+
</>
|
|
354
451
|
);
|
|
355
452
|
const SearchableSelect = () => (
|
|
356
453
|
<ExampleContainer expanded>
|
|
@@ -358,13 +455,18 @@ const SearchableSelect = () => (
|
|
|
358
455
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
359
456
|
</ExampleContainer>
|
|
360
457
|
);
|
|
361
|
-
const
|
|
458
|
+
const SearchValue = () => (
|
|
362
459
|
<ExampleContainer expanded>
|
|
363
460
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
364
|
-
<DxcSelect
|
|
461
|
+
<DxcSelect
|
|
462
|
+
label="Select Label"
|
|
463
|
+
searchable
|
|
464
|
+
defaultValue="1"
|
|
465
|
+
options={single_options}
|
|
466
|
+
placeholder="Choose an option"
|
|
467
|
+
/>
|
|
365
468
|
</ExampleContainer>
|
|
366
469
|
);
|
|
367
|
-
|
|
368
470
|
const MultipleSelect = () => (
|
|
369
471
|
<>
|
|
370
472
|
<ExampleContainer expanded>
|
|
@@ -372,7 +474,7 @@ const MultipleSelect = () => (
|
|
|
372
474
|
<DxcSelect
|
|
373
475
|
label="Select label"
|
|
374
476
|
options={single_options}
|
|
375
|
-
|
|
477
|
+
defaultValue={["1", "4"]}
|
|
376
478
|
multiple
|
|
377
479
|
placeholder="Choose an option"
|
|
378
480
|
/>
|
|
@@ -382,31 +484,37 @@ const MultipleSelect = () => (
|
|
|
382
484
|
const DefaultGroupedOptionsSelect = () => (
|
|
383
485
|
<ExampleContainer expanded>
|
|
384
486
|
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
385
|
-
<DxcSelect label="Label" options={group_options}
|
|
487
|
+
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
386
488
|
</ExampleContainer>
|
|
387
489
|
);
|
|
388
490
|
const MultipleGroupedOptionsSelect = () => (
|
|
389
491
|
<ExampleContainer expanded>
|
|
390
492
|
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
391
|
-
<DxcSelect
|
|
493
|
+
<DxcSelect
|
|
494
|
+
label="Label"
|
|
495
|
+
options={group_options}
|
|
496
|
+
defaultValue={["0", "2"]}
|
|
497
|
+
multiple
|
|
498
|
+
placeholder="Choose an option"
|
|
499
|
+
/>
|
|
392
500
|
</ExampleContainer>
|
|
393
501
|
);
|
|
394
502
|
const RescaledIcons = () => (
|
|
395
503
|
<ExampleContainer expanded>
|
|
396
504
|
<Title title="Rescaled icons displayed" theme="light" level={4} />
|
|
397
|
-
<DxcSelect label="Label" options={url_options}
|
|
505
|
+
<DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
|
|
398
506
|
</ExampleContainer>
|
|
399
507
|
);
|
|
400
508
|
const SelectWithIcons = () => (
|
|
401
509
|
<ExampleContainer expanded>
|
|
402
510
|
<Title title="Normal icons displayed" theme="light" level={4} />
|
|
403
|
-
<DxcSelect label="Label" options={icon_options}
|
|
511
|
+
<DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
|
|
404
512
|
</ExampleContainer>
|
|
405
513
|
);
|
|
406
514
|
const SelectMultipleWithIcons = () => (
|
|
407
515
|
<ExampleContainer expanded>
|
|
408
516
|
<Title title="Multiple select with icons" theme="light" level={4} />
|
|
409
|
-
<DxcSelect label="Label" options={icon_options} multiple
|
|
517
|
+
<DxcSelect label="Label" options={icon_options} multiple defaultValue={["1", "3"]} placeholder="Choose an option" />
|
|
410
518
|
</ExampleContainer>
|
|
411
519
|
);
|
|
412
520
|
const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
@@ -416,41 +524,12 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
416
524
|
label="Label"
|
|
417
525
|
options={icon_options_grouped}
|
|
418
526
|
multiple
|
|
419
|
-
|
|
527
|
+
defaultValue={["3", "2"]}
|
|
420
528
|
placeholder="Choose an option"
|
|
421
529
|
/>
|
|
422
530
|
</ExampleContainer>
|
|
423
531
|
);
|
|
424
|
-
|
|
425
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
426
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
427
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
428
|
-
</ExampleContainer>
|
|
429
|
-
);
|
|
430
|
-
const OnlyOneOptionFocused = () => (
|
|
431
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
432
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
433
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
434
|
-
</ExampleContainer>
|
|
435
|
-
);
|
|
436
|
-
const OnlyOneOptionActived = () => (
|
|
437
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
438
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
439
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
440
|
-
</ExampleContainer>
|
|
441
|
-
);
|
|
442
|
-
const SelectedOptionHovered = () => (
|
|
443
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
444
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
445
|
-
<DxcSelect label="Hovered" value="1" options={one_option} placeholder="Choose an option" />
|
|
446
|
-
</ExampleContainer>
|
|
447
|
-
);
|
|
448
|
-
const SelectedOptionActived = () => (
|
|
449
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
450
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
451
|
-
<DxcSelect label="Actived" value="1" options={one_option} placeholder="Choose an option" />
|
|
452
|
-
</ExampleContainer>
|
|
453
|
-
);
|
|
532
|
+
|
|
454
533
|
const MultipleSearchable = () => (
|
|
455
534
|
<ExampleContainer expanded>
|
|
456
535
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -458,18 +537,26 @@ const MultipleSearchable = () => (
|
|
|
458
537
|
label="Select Label"
|
|
459
538
|
searchable
|
|
460
539
|
multiple
|
|
461
|
-
|
|
540
|
+
defaultValue={["1", "4"]}
|
|
462
541
|
options={single_options}
|
|
463
542
|
placeholder="Choose an option"
|
|
464
543
|
/>
|
|
465
544
|
</ExampleContainer>
|
|
466
545
|
);
|
|
467
|
-
|
|
468
|
-
|
|
546
|
+
|
|
547
|
+
export const Chromatic = Select.bind({});
|
|
548
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
549
|
+
const canvas = within(canvasElement);
|
|
550
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
554
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
469
555
|
const canvas = within(canvasElement);
|
|
470
556
|
const select = canvas.getByRole("combobox");
|
|
471
557
|
await userEvent.click(select);
|
|
472
558
|
};
|
|
559
|
+
|
|
473
560
|
export const Searchable = SearchableSelect.bind({});
|
|
474
561
|
Searchable.play = async ({ canvasElement }) => {
|
|
475
562
|
const canvas = within(canvasElement);
|
|
@@ -478,14 +565,15 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
478
565
|
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
479
566
|
});
|
|
480
567
|
};
|
|
481
|
-
|
|
482
|
-
|
|
568
|
+
|
|
569
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
570
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
483
571
|
const canvas = within(canvasElement);
|
|
484
572
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
485
573
|
};
|
|
486
574
|
|
|
487
|
-
export const
|
|
488
|
-
|
|
575
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
576
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
489
577
|
const canvas = within(canvasElement);
|
|
490
578
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
491
579
|
};
|
|
@@ -497,75 +585,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
497
585
|
await userEvent.click(select);
|
|
498
586
|
};
|
|
499
587
|
|
|
500
|
-
export const
|
|
501
|
-
|
|
588
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
589
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
502
590
|
const canvas = within(canvasElement);
|
|
503
591
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
504
592
|
};
|
|
505
593
|
|
|
506
|
-
export const
|
|
507
|
-
|
|
508
|
-
const canvas = within(canvasElement);
|
|
509
|
-
const select = canvas.getByRole("combobox");
|
|
510
|
-
await userEvent.click(select);
|
|
511
|
-
};
|
|
512
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
513
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
594
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
595
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
514
596
|
const canvas = within(canvasElement);
|
|
515
597
|
const select = canvas.getByRole("combobox");
|
|
516
598
|
await userEvent.click(select);
|
|
517
599
|
};
|
|
518
600
|
|
|
519
|
-
export const
|
|
520
|
-
|
|
521
|
-
const canvas = within(canvasElement);
|
|
522
|
-
const select = canvas.getByRole("combobox");
|
|
523
|
-
await userEvent.click(select);
|
|
524
|
-
};
|
|
525
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
526
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
601
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
602
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
527
603
|
const canvas = within(canvasElement);
|
|
528
604
|
const select = canvas.getByRole("combobox");
|
|
529
605
|
await userEvent.click(select);
|
|
530
606
|
};
|
|
531
607
|
|
|
532
|
-
export const
|
|
533
|
-
|
|
608
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
609
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
534
610
|
const canvas = within(canvasElement);
|
|
535
611
|
const select = canvas.getByRole("combobox");
|
|
536
612
|
await userEvent.click(select);
|
|
537
613
|
};
|
|
538
614
|
|
|
539
|
-
export const
|
|
540
|
-
|
|
615
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
616
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
541
617
|
const canvas = within(canvasElement);
|
|
542
618
|
const select = canvas.getByRole("combobox");
|
|
543
619
|
await userEvent.click(select);
|
|
544
620
|
};
|
|
545
621
|
|
|
546
|
-
export const
|
|
547
|
-
|
|
548
|
-
const canvas = within(canvasElement);
|
|
549
|
-
const select = canvas.getByRole("combobox");
|
|
550
|
-
await userEvent.click(select);
|
|
551
|
-
await waitFor(async () => {
|
|
552
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
553
|
-
});
|
|
554
|
-
};
|
|
555
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
556
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
557
|
-
const canvas = within(canvasElement);
|
|
558
|
-
const select = canvas.getByRole("combobox");
|
|
559
|
-
await userEvent.click(select);
|
|
560
|
-
};
|
|
561
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
562
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
563
|
-
const canvas = within(canvasElement);
|
|
564
|
-
const select = canvas.getByRole("combobox");
|
|
565
|
-
await userEvent.click(select);
|
|
566
|
-
};
|
|
567
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
568
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
622
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
623
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
569
624
|
const canvas = within(canvasElement);
|
|
570
625
|
const select = canvas.getByRole("combobox");
|
|
571
626
|
await userEvent.click(select);
|