@dxc-technology/halstack-react 0.0.0-59568e7 → 0.0.0-5aa300b
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.js +7 -11
- package/accordion/Accordion.js +117 -104
- package/accordion/Accordion.stories.tsx +54 -15
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- package/box/types.d.ts +1 -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/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +50 -70
- package/button/Button.stories.tsx +61 -1
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +11 -23
- package/chip/Chip.stories.tsx +41 -9
- package/chip/types.d.ts +1 -1
- package/common/variables.js +186 -158
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -249
- package/dropdown/Dropdown.stories.tsx +135 -64
- package/dropdown/Dropdown.test.js +504 -108
- 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.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -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 +2 -2
- package/link/Link.js +24 -50
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +3 -4
- package/main.d.ts +6 -9
- package/main.js +32 -56
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -12
- package/paginator/Paginator.test.js +43 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Option.js +8 -10
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +225 -136
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +182 -52
- package/sidenav/Sidenav.stories.tsx +163 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +81 -5
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +172 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +128 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{row → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +195 -292
- package/text-input/TextInput.stories.tsx +211 -185
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -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/{stack → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- 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 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- 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 -28
- 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 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within
|
|
3
|
-
import { fireEvent } from "@testing-library/react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
4
3
|
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
4
|
import Title from "../../.storybook/components/Title";
|
|
6
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
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";
|
|
9
14
|
|
|
10
15
|
export default {
|
|
11
16
|
title: "Text input",
|
|
@@ -22,7 +27,7 @@ const action = {
|
|
|
22
27
|
),
|
|
23
28
|
};
|
|
24
29
|
|
|
25
|
-
const
|
|
30
|
+
const actionLargeIconSVG = {
|
|
26
31
|
onClick: () => {},
|
|
27
32
|
icon: (
|
|
28
33
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -32,6 +37,11 @@ const actionLargeIcon = {
|
|
|
32
37
|
),
|
|
33
38
|
};
|
|
34
39
|
|
|
40
|
+
const actionLargeIconURL = {
|
|
41
|
+
onClick: () => {},
|
|
42
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
43
|
+
};
|
|
44
|
+
|
|
35
45
|
const country = ["Afghanistan"];
|
|
36
46
|
const countries = [
|
|
37
47
|
"Afghanistan",
|
|
@@ -56,6 +66,7 @@ const countries = [
|
|
|
56
66
|
"Dominica",
|
|
57
67
|
"Denmark",
|
|
58
68
|
"Djibouti",
|
|
69
|
+
"*",
|
|
59
70
|
];
|
|
60
71
|
|
|
61
72
|
export const Chromatic = () => (
|
|
@@ -72,6 +83,14 @@ export const Chromatic = () => (
|
|
|
72
83
|
<Title title="Hovered action" theme="light" level={4} />
|
|
73
84
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
74
85
|
</ExampleContainer>
|
|
86
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
87
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
88
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
91
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
92
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
93
|
+
</ExampleContainer>
|
|
75
94
|
<ExampleContainer>
|
|
76
95
|
<Title title="Without label" theme="light" level={4} />
|
|
77
96
|
<DxcTextInput />
|
|
@@ -85,12 +104,21 @@ export const Chromatic = () => (
|
|
|
85
104
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
86
105
|
</ExampleContainer>
|
|
87
106
|
<ExampleContainer>
|
|
88
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
107
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
108
|
+
<DxcTextInput
|
|
109
|
+
label="Text input"
|
|
110
|
+
defaultValue="Text text text text text text text text text text"
|
|
111
|
+
clearable
|
|
112
|
+
action={actionLargeIconSVG}
|
|
113
|
+
/>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
89
117
|
<DxcTextInput
|
|
90
118
|
label="Text input"
|
|
91
119
|
defaultValue="Text text text text text text text text text text"
|
|
92
120
|
clearable
|
|
93
|
-
action={
|
|
121
|
+
action={actionLargeIconURL}
|
|
94
122
|
/>
|
|
95
123
|
</ExampleContainer>
|
|
96
124
|
<ExampleContainer>
|
|
@@ -152,7 +180,7 @@ export const Chromatic = () => (
|
|
|
152
180
|
</ExampleContainer>
|
|
153
181
|
<BackgroundColorProvider color="#333333">
|
|
154
182
|
<DarkContainer>
|
|
155
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
183
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
156
184
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
157
185
|
<Title title="Hovered" theme="dark" level={4} />
|
|
158
186
|
<DxcTextInput label="Text input" />
|
|
@@ -165,6 +193,14 @@ export const Chromatic = () => (
|
|
|
165
193
|
<Title title="Hovered action" theme="dark" level={4} />
|
|
166
194
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
167
195
|
</ExampleContainer>
|
|
196
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
197
|
+
<Title title="Actived action" theme="dark" level={4} />
|
|
198
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
199
|
+
</ExampleContainer>
|
|
200
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
201
|
+
<Title title="Focused action" theme="dark" level={4} />
|
|
202
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
203
|
+
</ExampleContainer>
|
|
168
204
|
<ExampleContainer>
|
|
169
205
|
<Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
|
|
170
206
|
<DxcTextInput
|
|
@@ -279,196 +315,186 @@ export const Chromatic = () => (
|
|
|
279
315
|
</>
|
|
280
316
|
);
|
|
281
317
|
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
<Title title="Focused action" theme="light" level={4} />
|
|
285
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
286
|
-
</ExampleContainer>
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
const ActivedActionTextInput = () => (
|
|
290
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
291
|
-
<Title title="Actived action" theme="light" level={4} />
|
|
292
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
293
|
-
</ExampleContainer>
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
const ShowOptionsAutosuggest = () => (
|
|
297
|
-
<ExampleContainer expanded>
|
|
298
|
-
<Title title="Show options" theme="light" level={4} />
|
|
299
|
-
<DxcTextInput label="Text input" suggestions={countries} clearable />
|
|
300
|
-
</ExampleContainer>
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
const HoveredOptionAutosuggest = () => (
|
|
304
|
-
<ExampleContainer expanded pseudoState="pseudo-hover">
|
|
305
|
-
<Title title="Hovered option" theme="light" level={4} />
|
|
306
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
307
|
-
</ExampleContainer>
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const FocusedOptionAutosuggest = () => (
|
|
311
|
-
<ExampleContainer expanded>
|
|
312
|
-
<Title title="Focused option" theme="light" level={4} />
|
|
313
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
314
|
-
</ExampleContainer>
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
const ActivedOptionAutosuggest = () => (
|
|
318
|
-
<ExampleContainer expanded pseudoState="pseudo-active">
|
|
319
|
-
<Title title="Actived option" theme="light" level={4} />
|
|
320
|
-
<DxcTextInput label="Text input" suggestions={country} clearable />
|
|
321
|
-
</ExampleContainer>
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
const FocusedActionTextInputOnDark = () => (
|
|
325
|
-
<BackgroundColorProvider color="#333333">
|
|
326
|
-
<DarkContainer>
|
|
327
|
-
<ExampleContainer expanded>
|
|
328
|
-
<Title title="Focused action" theme="dark" level={4} />
|
|
329
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
330
|
-
</ExampleContainer>
|
|
331
|
-
</DarkContainer>
|
|
332
|
-
</BackgroundColorProvider>
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
const ActivedActionTextInputOnDark = () => (
|
|
336
|
-
<BackgroundColorProvider color="#333333">
|
|
337
|
-
<DarkContainer>
|
|
338
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
339
|
-
<Title title="Actived action" theme="dark" level={4} />
|
|
340
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
341
|
-
</ExampleContainer>
|
|
342
|
-
</DarkContainer>
|
|
343
|
-
</BackgroundColorProvider>
|
|
344
|
-
);
|
|
318
|
+
const AutosuggestListbox = () => {
|
|
319
|
+
const colorsTheme: any = useTheme();
|
|
345
320
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
<
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
321
|
+
return (
|
|
322
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
323
|
+
<ExampleContainer>
|
|
324
|
+
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
325
|
+
<ExampleContainer>
|
|
326
|
+
<Title
|
|
327
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
328
|
+
theme="light"
|
|
329
|
+
level={3}
|
|
330
|
+
/>
|
|
331
|
+
<div
|
|
332
|
+
style={{
|
|
333
|
+
display: "flex",
|
|
334
|
+
flexDirection: "column",
|
|
335
|
+
gap: "20px",
|
|
336
|
+
height: "150px",
|
|
337
|
+
width: "500px",
|
|
338
|
+
marginBottom: "250px",
|
|
339
|
+
padding: "20px",
|
|
340
|
+
border: "1px solid black",
|
|
341
|
+
borderRadius: "4px",
|
|
342
|
+
overflow: "auto",
|
|
343
|
+
zIndex: "1300",
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
<DxcTextInput
|
|
347
|
+
label="Label"
|
|
348
|
+
suggestions={countries}
|
|
349
|
+
optional
|
|
350
|
+
placeholder="Choose an option"
|
|
351
|
+
size="fillParent"
|
|
352
|
+
/>
|
|
353
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
354
|
+
</div>
|
|
355
|
+
</ExampleContainer>
|
|
356
|
+
<Title title="Listbox suggestion states" theme="light" level={3} />
|
|
357
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
358
|
+
<Title title="Hovered suggestion" theme="light" level={4} />
|
|
359
|
+
<Suggestions
|
|
360
|
+
id="x"
|
|
361
|
+
value=""
|
|
362
|
+
suggestions={country}
|
|
363
|
+
visualFocusIndex={-1}
|
|
364
|
+
highlightedSuggestions={false}
|
|
365
|
+
searchHasErrors={false}
|
|
366
|
+
isSearching={false}
|
|
367
|
+
suggestionOnClick={() => {}}
|
|
368
|
+
getTextInputWidth={() => 350}
|
|
369
|
+
/>
|
|
370
|
+
</ExampleContainer>
|
|
371
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
372
|
+
<Title title="Active suggestion" theme="light" level={4} />
|
|
373
|
+
<Suggestions
|
|
374
|
+
id="x"
|
|
375
|
+
value=""
|
|
376
|
+
suggestions={country}
|
|
377
|
+
visualFocusIndex={-1}
|
|
378
|
+
highlightedSuggestions={false}
|
|
379
|
+
searchHasErrors={false}
|
|
380
|
+
isSearching={false}
|
|
381
|
+
suggestionOnClick={(suggestion) => {}}
|
|
382
|
+
getTextInputWidth={() => 350}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer>
|
|
386
|
+
<Title title="Focused suggestion" theme="light" level={4} />
|
|
387
|
+
<Suggestions
|
|
388
|
+
id="x"
|
|
389
|
+
value=""
|
|
390
|
+
suggestions={country}
|
|
391
|
+
visualFocusIndex={0}
|
|
392
|
+
highlightedSuggestions={false}
|
|
393
|
+
searchHasErrors={false}
|
|
394
|
+
isSearching={false}
|
|
395
|
+
suggestionOnClick={(suggestion) => {}}
|
|
396
|
+
getTextInputWidth={() => 350}
|
|
397
|
+
/>
|
|
398
|
+
</ExampleContainer>
|
|
399
|
+
<ExampleContainer>
|
|
400
|
+
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
401
|
+
<Suggestions
|
|
402
|
+
id="x"
|
|
403
|
+
value="Afgh"
|
|
404
|
+
suggestions={country}
|
|
405
|
+
visualFocusIndex={-1}
|
|
406
|
+
highlightedSuggestions={true}
|
|
407
|
+
searchHasErrors={false}
|
|
408
|
+
isSearching={false}
|
|
409
|
+
suggestionOnClick={(suggestion) => {}}
|
|
410
|
+
getTextInputWidth={() => 350}
|
|
411
|
+
/>
|
|
412
|
+
</ExampleContainer>
|
|
363
413
|
</ExampleContainer>
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
414
|
+
<ExampleContainer>
|
|
415
|
+
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
416
|
+
<Suggestions
|
|
417
|
+
id="x"
|
|
418
|
+
value=""
|
|
419
|
+
suggestions={country}
|
|
420
|
+
visualFocusIndex={-1}
|
|
421
|
+
highlightedSuggestions={false}
|
|
422
|
+
searchHasErrors={true}
|
|
423
|
+
isSearching={false}
|
|
424
|
+
suggestionOnClick={(suggestion) => {}}
|
|
425
|
+
getTextInputWidth={() => 350}
|
|
426
|
+
/>
|
|
374
427
|
</ExampleContainer>
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
428
|
+
<ExampleContainer>
|
|
429
|
+
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
430
|
+
<Suggestions
|
|
431
|
+
id="x"
|
|
432
|
+
value=""
|
|
433
|
+
suggestions={country}
|
|
434
|
+
visualFocusIndex={-1}
|
|
435
|
+
highlightedSuggestions={false}
|
|
436
|
+
searchHasErrors={false}
|
|
437
|
+
isSearching={true}
|
|
438
|
+
suggestionOnClick={(suggestion) => {}}
|
|
439
|
+
getTextInputWidth={() => 350}
|
|
440
|
+
/>
|
|
385
441
|
</ExampleContainer>
|
|
386
|
-
</
|
|
387
|
-
|
|
388
|
-
);
|
|
389
|
-
|
|
390
|
-
export const FocusedAction = FocusedActionTextInput.bind({});
|
|
391
|
-
FocusedAction.play = async ({ canvasElement }) => {
|
|
392
|
-
const canvas = within(canvasElement);
|
|
393
|
-
const action = canvas.getByRole("button");
|
|
394
|
-
await action.focus();
|
|
442
|
+
</ThemeProvider>
|
|
443
|
+
);
|
|
395
444
|
};
|
|
396
445
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
const canvas = within(canvasElement);
|
|
400
|
-
const action = canvas.getByRole("button");
|
|
401
|
-
await userEvent.click(action);
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
export const ShowOptions = ShowOptionsAutosuggest.bind({});
|
|
405
|
-
ShowOptions.play = async ({ canvasElement }) => {
|
|
406
|
-
const canvas = within(canvasElement);
|
|
407
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
408
|
-
await userEvent.click(autosuggest);
|
|
409
|
-
};
|
|
446
|
+
const DarkAutosuggestListbox = () => {
|
|
447
|
+
const colorsTheme: any = useTheme();
|
|
410
448
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
ShowOptionsOnDark.play = async ({ canvasElement }) => {
|
|
449
|
-
const canvas = within(canvasElement);
|
|
450
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
451
|
-
await userEvent.click(autosuggest);
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
export const HoveredActionOnDark = HoveredActionAutosuggestOnDark.bind({});
|
|
455
|
-
HoveredActionOnDark.play = async ({ canvasElement }) => {
|
|
456
|
-
const canvas = within(canvasElement);
|
|
457
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
458
|
-
await userEvent.click(autosuggest);
|
|
449
|
+
return (
|
|
450
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
451
|
+
<BackgroundColorProvider color="#333333">
|
|
452
|
+
<DarkContainer>
|
|
453
|
+
<Title title="Dark theme" theme="dark" level={2} />
|
|
454
|
+
<ExampleContainer>
|
|
455
|
+
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
456
|
+
<DxcFlex direction="column" gap="80px">
|
|
457
|
+
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
458
|
+
<DxcCheckbox
|
|
459
|
+
label="You understand the selection and give your consent"
|
|
460
|
+
onChange={() => {}}
|
|
461
|
+
labelPosition="after"
|
|
462
|
+
/>
|
|
463
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
|
|
464
|
+
</DxcFlex>
|
|
465
|
+
</ExampleContainer>
|
|
466
|
+
<ExampleContainer>
|
|
467
|
+
<Title title="Autosuggest Error" theme="dark" level={3} />
|
|
468
|
+
<div style={{ height: "100px" }}>
|
|
469
|
+
<Suggestions
|
|
470
|
+
id="x"
|
|
471
|
+
value=""
|
|
472
|
+
suggestions={country}
|
|
473
|
+
visualFocusIndex={-1}
|
|
474
|
+
highlightedSuggestions={false}
|
|
475
|
+
searchHasErrors={true}
|
|
476
|
+
isSearching={false}
|
|
477
|
+
suggestionOnClick={(suggestion) => {}}
|
|
478
|
+
getTextInputWidth={() => 350}
|
|
479
|
+
/>
|
|
480
|
+
</div>
|
|
481
|
+
</ExampleContainer>
|
|
482
|
+
</DarkContainer>
|
|
483
|
+
</BackgroundColorProvider>
|
|
484
|
+
</ThemeProvider>
|
|
485
|
+
);
|
|
459
486
|
};
|
|
460
487
|
|
|
461
|
-
export const
|
|
462
|
-
|
|
488
|
+
export const AutosuggestListboxStates = AutosuggestListbox.bind({});
|
|
489
|
+
AutosuggestListboxStates.play = async ({ canvasElement }) => {
|
|
463
490
|
const canvas = within(canvasElement);
|
|
464
|
-
const
|
|
465
|
-
await userEvent.click(
|
|
466
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
491
|
+
const select = canvas.getByRole("combobox");
|
|
492
|
+
await userEvent.click(select);
|
|
467
493
|
};
|
|
468
494
|
|
|
469
|
-
export const
|
|
470
|
-
|
|
495
|
+
export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
|
|
496
|
+
AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
|
|
471
497
|
const canvas = within(canvasElement);
|
|
472
|
-
const
|
|
473
|
-
await userEvent.click(
|
|
498
|
+
const select = canvas.getByRole("combobox");
|
|
499
|
+
await userEvent.click(select);
|
|
474
500
|
};
|