@dxc-technology/halstack-react 0.0.0-61a8ced → 0.0.0-62702b8
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/BackgroundColorContext.d.ts +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1349 -5
- package/HalstackContext.js +117 -77
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +14 -37
- package/accordion/Accordion.stories.tsx +104 -113
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +2 -13
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +7 -17
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -13
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +7 -26
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -11
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +48 -60
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +7 -3
- package/card/Card.d.ts +1 -1
- package/card/Card.js +27 -45
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +74 -53
- package/checkbox/Checkbox.stories.tsx +146 -58
- package/checkbox/Checkbox.test.js +84 -11
- package/checkbox/types.d.ts +10 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1499 -0
- package/common/variables.js +1004 -1134
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +138 -239
- package/date-input/DateInput.stories.tsx +209 -33
- package/date-input/DateInput.test.js +519 -149
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +57 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +54 -85
- package/dialog/Dialog.stories.tsx +154 -170
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.js +42 -41
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +22 -27
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +5 -18
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +18 -1
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +33 -19
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +83 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +36 -21
- package/footer/Footer.test.js +16 -26
- package/footer/types.d.ts +10 -11
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +20 -49
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +1 -14
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/image/Image.d.ts +4 -0
- package/image/Image.js +85 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +15 -12
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -4
- package/layout/Icons.js +52 -56
- package/layout/types.d.ts +2 -3
- package/link/Link.js +4 -4
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +5 -3
- package/main.js +18 -2
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +49 -33
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +8 -4
- package/number-input/NumberInput.stories.tsx +47 -2
- package/number-input/NumberInput.test.js +354 -92
- package/number-input/types.d.ts +6 -0
- package/package.json +14 -19
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +8 -16
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +58 -48
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +34 -40
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +111 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +50 -35
- package/radio-group/RadioGroup.js +29 -29
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +153 -99
- package/radio-group/types.d.ts +5 -5
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +51 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +49 -108
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +41 -64
- package/{resultsetTable → resultset-table}/types.d.ts +1 -1
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -35
- package/select/Option.js +11 -24
- package/select/Select.js +59 -36
- package/select/Select.stories.tsx +497 -153
- package/select/Select.test.js +345 -292
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +17 -14
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +95 -84
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +27 -14
- package/switch/types.d.ts +8 -3
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +40 -11
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +232 -342
- package/text-input/TextInput.stories.tsx +319 -184
- package/text-input/TextInput.test.js +848 -726
- package/text-input/types.d.ts +27 -2
- package/textarea/Textarea.js +27 -26
- package/textarea/Textarea.stories.jsx +68 -1
- package/textarea/Textarea.test.js +61 -19
- package/textarea/types.d.ts +4 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +85 -59
- package/toggle-group/ToggleGroup.stories.tsx +48 -3
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +22 -13
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1251 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- /package/{resultsetTable → grid}/types.js +0 -0
- /package/{tabs-nav → image}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{number-input/numberInputContextTypes.js → nav-tabs/types.js} +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
3
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
7
|
import DxcTextInput from "./TextInput";
|
|
8
|
+
import DxcButton from "../button/Button";
|
|
9
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
|
+
import DxcFlex from "../flex/Flex";
|
|
11
|
+
import Suggestions from "./Suggestions";
|
|
12
|
+
import { ThemeProvider } from "styled-components";
|
|
13
|
+
import useTheme from "../useTheme";
|
|
14
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
8
15
|
|
|
9
16
|
export default {
|
|
10
17
|
title: "Text input",
|
|
@@ -21,7 +28,7 @@ const action = {
|
|
|
21
28
|
),
|
|
22
29
|
};
|
|
23
30
|
|
|
24
|
-
const
|
|
31
|
+
const actionLargeIconSVG = {
|
|
25
32
|
onClick: () => {},
|
|
26
33
|
icon: (
|
|
27
34
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -31,6 +38,11 @@ const actionLargeIcon = {
|
|
|
31
38
|
),
|
|
32
39
|
};
|
|
33
40
|
|
|
41
|
+
const actionLargeIconURL = {
|
|
42
|
+
onClick: () => {},
|
|
43
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
44
|
+
};
|
|
45
|
+
|
|
34
46
|
const country = ["Afghanistan"];
|
|
35
47
|
const countries = [
|
|
36
48
|
"Afghanistan",
|
|
@@ -55,8 +67,16 @@ const countries = [
|
|
|
55
67
|
"Dominica",
|
|
56
68
|
"Denmark",
|
|
57
69
|
"Djibouti",
|
|
70
|
+
"*",
|
|
58
71
|
];
|
|
59
72
|
|
|
73
|
+
const opinionatedTheme = {
|
|
74
|
+
textInput: {
|
|
75
|
+
fontColor: "#000000",
|
|
76
|
+
hoverBorderColor: "#a46ede",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
60
80
|
export const Chromatic = () => (
|
|
61
81
|
<>
|
|
62
82
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
@@ -71,6 +91,14 @@ export const Chromatic = () => (
|
|
|
71
91
|
<Title title="Hovered action" theme="light" level={4} />
|
|
72
92
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
73
93
|
</ExampleContainer>
|
|
94
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
95
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
96
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
99
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
100
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
101
|
+
</ExampleContainer>
|
|
74
102
|
<ExampleContainer>
|
|
75
103
|
<Title title="Without label" theme="light" level={4} />
|
|
76
104
|
<DxcTextInput />
|
|
@@ -84,12 +112,21 @@ export const Chromatic = () => (
|
|
|
84
112
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
85
113
|
</ExampleContainer>
|
|
86
114
|
<ExampleContainer>
|
|
87
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
115
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
88
116
|
<DxcTextInput
|
|
89
117
|
label="Text input"
|
|
90
118
|
defaultValue="Text text text text text text text text text text"
|
|
91
119
|
clearable
|
|
92
|
-
action={
|
|
120
|
+
action={actionLargeIconSVG}
|
|
121
|
+
/>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
125
|
+
<DxcTextInput
|
|
126
|
+
label="Text input"
|
|
127
|
+
defaultValue="Text text text text text text text text text text"
|
|
128
|
+
clearable
|
|
129
|
+
action={actionLargeIconURL}
|
|
93
130
|
/>
|
|
94
131
|
</ExampleContainer>
|
|
95
132
|
<ExampleContainer>
|
|
@@ -149,9 +186,48 @@ export const Chromatic = () => (
|
|
|
149
186
|
action={action}
|
|
150
187
|
/>
|
|
151
188
|
</ExampleContainer>
|
|
189
|
+
<ExampleContainer>
|
|
190
|
+
<Title title="Read only" theme="light" level={4} />
|
|
191
|
+
<DxcTextInput
|
|
192
|
+
label="Example label"
|
|
193
|
+
helperText="Help message"
|
|
194
|
+
clearable
|
|
195
|
+
readOnly
|
|
196
|
+
optional
|
|
197
|
+
prefix="+34"
|
|
198
|
+
defaultValue="Text"
|
|
199
|
+
action={action}
|
|
200
|
+
/>
|
|
201
|
+
</ExampleContainer>
|
|
202
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
203
|
+
<Title title="Hovered read only" theme="light" level={4} />
|
|
204
|
+
<DxcTextInput
|
|
205
|
+
label="Example label"
|
|
206
|
+
helperText="Help message"
|
|
207
|
+
clearable
|
|
208
|
+
readOnly
|
|
209
|
+
optional
|
|
210
|
+
prefix="+34"
|
|
211
|
+
defaultValue="Text"
|
|
212
|
+
action={action}
|
|
213
|
+
/>
|
|
214
|
+
</ExampleContainer>
|
|
215
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
216
|
+
<Title title="Active read only" theme="light" level={4} />
|
|
217
|
+
<DxcTextInput
|
|
218
|
+
label="Example label"
|
|
219
|
+
helperText="Help message"
|
|
220
|
+
clearable
|
|
221
|
+
readOnly
|
|
222
|
+
optional
|
|
223
|
+
prefix="+34"
|
|
224
|
+
defaultValue="Text"
|
|
225
|
+
action={action}
|
|
226
|
+
/>
|
|
227
|
+
</ExampleContainer>
|
|
152
228
|
<BackgroundColorProvider color="#333333">
|
|
153
229
|
<DarkContainer>
|
|
154
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
230
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
155
231
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
156
232
|
<Title title="Hovered" theme="dark" level={4} />
|
|
157
233
|
<DxcTextInput label="Text input" />
|
|
@@ -164,6 +240,14 @@ export const Chromatic = () => (
|
|
|
164
240
|
<Title title="Hovered action" theme="dark" level={4} />
|
|
165
241
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
166
242
|
</ExampleContainer>
|
|
243
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
244
|
+
<Title title="Actived action" theme="dark" level={4} />
|
|
245
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
246
|
+
</ExampleContainer>
|
|
247
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
248
|
+
<Title title="Focused action" theme="dark" level={4} />
|
|
249
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
250
|
+
</ExampleContainer>
|
|
167
251
|
<ExampleContainer>
|
|
168
252
|
<Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
|
|
169
253
|
<DxcTextInput
|
|
@@ -275,199 +359,250 @@ export const Chromatic = () => (
|
|
|
275
359
|
<Title title="FillParent size" theme="light" level={4} />
|
|
276
360
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
277
361
|
</ExampleContainer>
|
|
362
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
363
|
+
<ExampleContainer>
|
|
364
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
365
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
366
|
+
<Title title="Hovered input" theme="light" level={4} />
|
|
367
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
368
|
+
</ExampleContainer>
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
370
|
+
<Title title="Focused input" theme="light" level={4} />
|
|
371
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
372
|
+
</ExampleContainer>
|
|
373
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
374
|
+
<Title title="Hovered action" theme="light" level={4} />
|
|
375
|
+
<DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
|
|
376
|
+
</ExampleContainer>
|
|
377
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
378
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
379
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
382
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
383
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer>
|
|
386
|
+
<Title title="Prefix" theme="light" level={4} />
|
|
387
|
+
<DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
|
|
388
|
+
</ExampleContainer>
|
|
389
|
+
<ExampleContainer>
|
|
390
|
+
<Title title="Suffix and action" theme="light" level={4} />
|
|
391
|
+
<DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
|
|
392
|
+
</ExampleContainer>
|
|
393
|
+
<ExampleContainer>
|
|
394
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
395
|
+
<DxcTextInput
|
|
396
|
+
label="Error text input"
|
|
397
|
+
helperText="Help message"
|
|
398
|
+
error="Error message."
|
|
399
|
+
defaultValue="Text"
|
|
400
|
+
clearable
|
|
401
|
+
optional
|
|
402
|
+
action={action}
|
|
403
|
+
/>
|
|
404
|
+
</ExampleContainer>
|
|
405
|
+
<ExampleContainer>
|
|
406
|
+
<Title title="Disabled and placeholder" theme="light" level={4} />
|
|
407
|
+
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
|
|
408
|
+
</ExampleContainer>
|
|
409
|
+
<ExampleContainer>
|
|
410
|
+
<Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
|
|
411
|
+
<DxcTextInput
|
|
412
|
+
label="Disabled text input"
|
|
413
|
+
helperText="Help message"
|
|
414
|
+
disabled
|
|
415
|
+
optional
|
|
416
|
+
defaultValue="Text"
|
|
417
|
+
action={action}
|
|
418
|
+
/>
|
|
419
|
+
</ExampleContainer>
|
|
420
|
+
</HalstackProvider>
|
|
421
|
+
</ExampleContainer>
|
|
278
422
|
</>
|
|
279
423
|
);
|
|
280
424
|
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
<Title title="Focused action" theme="light" level={4} />
|
|
284
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
285
|
-
</ExampleContainer>
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
const ActivedActionTextInput = () => (
|
|
289
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
290
|
-
<Title title="Actived action" theme="light" level={4} />
|
|
291
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
292
|
-
</ExampleContainer>
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
const ShowOptionsAutosuggest = () => (
|
|
296
|
-
<ExampleContainer expanded>
|
|
297
|
-
<Title title="Show options" theme="light" level={4} />
|
|
298
|
-
<DxcTextInput label="Text input" suggestions={countries} clearable />
|
|
299
|
-
</ExampleContainer>
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
const HoveredOptionAutosuggest = () => (
|
|
303
|
-
<ExampleContainer expanded pseudoState="pseudo-hover">
|
|
304
|
-
<Title title="Hovered option" theme="light" level={4} />
|
|
305
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
306
|
-
</ExampleContainer>
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
const FocusedOptionAutosuggest = () => (
|
|
310
|
-
<ExampleContainer expanded>
|
|
311
|
-
<Title title="Focused option" theme="light" level={4} />
|
|
312
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
313
|
-
</ExampleContainer>
|
|
314
|
-
);
|
|
315
|
-
|
|
316
|
-
const ActivedOptionAutosuggest = () => (
|
|
317
|
-
<ExampleContainer expanded pseudoState="pseudo-active">
|
|
318
|
-
<Title title="Actived option" theme="light" level={4} />
|
|
319
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
320
|
-
</ExampleContainer>
|
|
321
|
-
);
|
|
425
|
+
const AutosuggestListbox = () => {
|
|
426
|
+
const colorsTheme: any = useTheme();
|
|
322
427
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
<
|
|
361
|
-
|
|
428
|
+
return (
|
|
429
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
430
|
+
<ExampleContainer>
|
|
431
|
+
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
432
|
+
<ExampleContainer>
|
|
433
|
+
<Title
|
|
434
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
435
|
+
theme="light"
|
|
436
|
+
level={3}
|
|
437
|
+
/>
|
|
438
|
+
<div
|
|
439
|
+
style={{
|
|
440
|
+
display: "flex",
|
|
441
|
+
flexDirection: "column",
|
|
442
|
+
gap: "20px",
|
|
443
|
+
height: "150px",
|
|
444
|
+
width: "500px",
|
|
445
|
+
marginBottom: "250px",
|
|
446
|
+
padding: "20px",
|
|
447
|
+
border: "1px solid black",
|
|
448
|
+
borderRadius: "4px",
|
|
449
|
+
overflow: "auto",
|
|
450
|
+
zIndex: "1300",
|
|
451
|
+
position: "relative",
|
|
452
|
+
}}
|
|
453
|
+
>
|
|
454
|
+
<DxcTextInput
|
|
455
|
+
label="Label"
|
|
456
|
+
suggestions={countries}
|
|
457
|
+
optional
|
|
458
|
+
placeholder="Choose an option"
|
|
459
|
+
size="fillParent"
|
|
460
|
+
/>
|
|
461
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
462
|
+
</div>
|
|
463
|
+
</ExampleContainer>
|
|
464
|
+
<Title title="Listbox suggestion states" theme="light" level={3} />
|
|
465
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
466
|
+
<Title title="Hovered suggestion" theme="light" level={4} />
|
|
467
|
+
<Suggestions
|
|
468
|
+
id="x"
|
|
469
|
+
value=""
|
|
470
|
+
suggestions={country}
|
|
471
|
+
visualFocusIndex={-1}
|
|
472
|
+
highlightedSuggestions={false}
|
|
473
|
+
searchHasErrors={false}
|
|
474
|
+
isSearching={false}
|
|
475
|
+
suggestionOnClick={() => {}}
|
|
476
|
+
getTextInputWidth={() => 350}
|
|
477
|
+
/>
|
|
478
|
+
</ExampleContainer>
|
|
479
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
480
|
+
<Title title="Active suggestion" theme="light" level={4} />
|
|
481
|
+
<Suggestions
|
|
482
|
+
id="x"
|
|
483
|
+
value=""
|
|
484
|
+
suggestions={country}
|
|
485
|
+
visualFocusIndex={-1}
|
|
486
|
+
highlightedSuggestions={false}
|
|
487
|
+
searchHasErrors={false}
|
|
488
|
+
isSearching={false}
|
|
489
|
+
suggestionOnClick={(suggestion) => {}}
|
|
490
|
+
getTextInputWidth={() => 350}
|
|
491
|
+
/>
|
|
492
|
+
</ExampleContainer>
|
|
493
|
+
<ExampleContainer>
|
|
494
|
+
<Title title="Focused suggestion" theme="light" level={4} />
|
|
495
|
+
<Suggestions
|
|
496
|
+
id="x"
|
|
497
|
+
value=""
|
|
498
|
+
suggestions={country}
|
|
499
|
+
visualFocusIndex={0}
|
|
500
|
+
highlightedSuggestions={false}
|
|
501
|
+
searchHasErrors={false}
|
|
502
|
+
isSearching={false}
|
|
503
|
+
suggestionOnClick={(suggestion) => {}}
|
|
504
|
+
getTextInputWidth={() => 350}
|
|
505
|
+
/>
|
|
506
|
+
</ExampleContainer>
|
|
507
|
+
<ExampleContainer>
|
|
508
|
+
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
509
|
+
<Suggestions
|
|
510
|
+
id="x"
|
|
511
|
+
value="Afgh"
|
|
512
|
+
suggestions={country}
|
|
513
|
+
visualFocusIndex={-1}
|
|
514
|
+
highlightedSuggestions={true}
|
|
515
|
+
searchHasErrors={false}
|
|
516
|
+
isSearching={false}
|
|
517
|
+
suggestionOnClick={(suggestion) => {}}
|
|
518
|
+
getTextInputWidth={() => 350}
|
|
519
|
+
/>
|
|
520
|
+
</ExampleContainer>
|
|
362
521
|
</ExampleContainer>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
522
|
+
<ExampleContainer>
|
|
523
|
+
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
524
|
+
<Suggestions
|
|
525
|
+
id="x"
|
|
526
|
+
value=""
|
|
527
|
+
suggestions={country}
|
|
528
|
+
visualFocusIndex={-1}
|
|
529
|
+
highlightedSuggestions={false}
|
|
530
|
+
searchHasErrors={true}
|
|
531
|
+
isSearching={false}
|
|
532
|
+
suggestionOnClick={(suggestion) => {}}
|
|
533
|
+
getTextInputWidth={() => 350}
|
|
534
|
+
/>
|
|
373
535
|
</ExampleContainer>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
536
|
+
<ExampleContainer>
|
|
537
|
+
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
538
|
+
<Suggestions
|
|
539
|
+
id="x"
|
|
540
|
+
value=""
|
|
541
|
+
suggestions={country}
|
|
542
|
+
visualFocusIndex={-1}
|
|
543
|
+
highlightedSuggestions={false}
|
|
544
|
+
searchHasErrors={false}
|
|
545
|
+
isSearching={true}
|
|
546
|
+
suggestionOnClick={(suggestion) => {}}
|
|
547
|
+
getTextInputWidth={() => 350}
|
|
548
|
+
/>
|
|
384
549
|
</ExampleContainer>
|
|
385
|
-
</
|
|
386
|
-
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
export const FocusedAction = FocusedActionTextInput.bind({});
|
|
390
|
-
FocusedAction.play = async ({ canvasElement }) => {
|
|
391
|
-
const canvas = within(canvasElement);
|
|
392
|
-
const action = canvas.getByRole("button");
|
|
393
|
-
await action.focus();
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
export const ActivedAction = ActivedActionTextInput.bind({});
|
|
397
|
-
ActivedAction.play = async ({ canvasElement }) => {
|
|
398
|
-
const canvas = within(canvasElement);
|
|
399
|
-
const action = canvas.getByRole("button");
|
|
400
|
-
await userEvent.click(action);
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
export const ShowOptions = ShowOptionsAutosuggest.bind({});
|
|
404
|
-
ShowOptions.play = async ({ canvasElement }) => {
|
|
405
|
-
const canvas = within(canvasElement);
|
|
406
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
407
|
-
await userEvent.click(autosuggest);
|
|
550
|
+
</ThemeProvider>
|
|
551
|
+
);
|
|
408
552
|
};
|
|
409
553
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const canvas = within(canvasElement);
|
|
413
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
414
|
-
await userEvent.click(autosuggest);
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
export const FocusedOption = FocusedOptionAutosuggest.bind({});
|
|
418
|
-
FocusedOption.play = async ({ canvasElement }) => {
|
|
419
|
-
const canvas = within(canvasElement);
|
|
420
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
421
|
-
await userEvent.click(autosuggest);
|
|
422
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
export const ActivedOption = ActivedOptionAutosuggest.bind({});
|
|
426
|
-
ActivedOption.play = async ({ canvasElement }) => {
|
|
427
|
-
const canvas = within(canvasElement);
|
|
428
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
429
|
-
await userEvent.click(autosuggest);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
export const FocusedActionOnDark = FocusedActionTextInputOnDark.bind({});
|
|
433
|
-
FocusedActionOnDark.play = async ({ canvasElement }) => {
|
|
434
|
-
const canvas = within(canvasElement);
|
|
435
|
-
const action = canvas.getByRole("button");
|
|
436
|
-
await action.focus();
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
export const ActivedActionOnDark = ActivedActionTextInputOnDark.bind({});
|
|
440
|
-
ActivedActionOnDark.play = async ({ canvasElement }) => {
|
|
441
|
-
const canvas = within(canvasElement);
|
|
442
|
-
const action = canvas.getByRole("button");
|
|
443
|
-
await userEvent.click(action);
|
|
444
|
-
};
|
|
554
|
+
const DarkAutosuggestListbox = () => {
|
|
555
|
+
const colorsTheme: any = useTheme();
|
|
445
556
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
557
|
+
return (
|
|
558
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
559
|
+
<BackgroundColorProvider color="#333333">
|
|
560
|
+
<DarkContainer>
|
|
561
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
562
|
+
<ExampleContainer>
|
|
563
|
+
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
564
|
+
<DxcFlex direction="column" gap="5rem">
|
|
565
|
+
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
566
|
+
<DxcCheckbox
|
|
567
|
+
label="You understand the selection and give your consent"
|
|
568
|
+
onChange={() => {}}
|
|
569
|
+
labelPosition="after"
|
|
570
|
+
/>
|
|
571
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
|
|
572
|
+
</DxcFlex>
|
|
573
|
+
</ExampleContainer>
|
|
574
|
+
<ExampleContainer>
|
|
575
|
+
<Title title="Autosuggest Error" theme="dark" level={3} />
|
|
576
|
+
<div style={{ height: "100px" }}>
|
|
577
|
+
<Suggestions
|
|
578
|
+
id="x"
|
|
579
|
+
value=""
|
|
580
|
+
suggestions={country}
|
|
581
|
+
visualFocusIndex={-1}
|
|
582
|
+
highlightedSuggestions={false}
|
|
583
|
+
searchHasErrors={true}
|
|
584
|
+
isSearching={false}
|
|
585
|
+
suggestionOnClick={(suggestion) => {}}
|
|
586
|
+
getTextInputWidth={() => 350}
|
|
587
|
+
/>
|
|
588
|
+
</div>
|
|
589
|
+
</ExampleContainer>
|
|
590
|
+
</DarkContainer>
|
|
591
|
+
</BackgroundColorProvider>
|
|
592
|
+
</ThemeProvider>
|
|
593
|
+
);
|
|
458
594
|
};
|
|
459
595
|
|
|
460
|
-
export const
|
|
461
|
-
|
|
596
|
+
export const AutosuggestListboxStates = AutosuggestListbox.bind({});
|
|
597
|
+
AutosuggestListboxStates.play = async ({ canvasElement }) => {
|
|
462
598
|
const canvas = within(canvasElement);
|
|
463
|
-
const
|
|
464
|
-
await userEvent.click(
|
|
465
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
599
|
+
const select = canvas.getByRole("combobox");
|
|
600
|
+
await userEvent.click(select);
|
|
466
601
|
};
|
|
467
602
|
|
|
468
|
-
export const
|
|
469
|
-
|
|
603
|
+
export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
|
|
604
|
+
AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
|
|
470
605
|
const canvas = within(canvasElement);
|
|
471
|
-
const
|
|
472
|
-
await userEvent.click(
|
|
606
|
+
const select = canvas.getByRole("combobox");
|
|
607
|
+
await userEvent.click(select);
|
|
473
608
|
};
|