@dxc-technology/halstack-react 0.0.0-f53e801 → 0.0.0-f6290b3
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 +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1243 -6
- package/HalstackContext.js +125 -110
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +116 -160
- package/accordion/Accordion.stories.tsx +101 -125
- package/accordion/Accordion.test.js +25 -41
- package/accordion/types.d.ts +5 -16
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +30 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.js +52 -105
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +11 -16
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +47 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +20 -59
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -43
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +19 -60
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -14
- package/bulleted-list/BulletedList.js +19 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +69 -105
- package/button/Button.stories.tsx +152 -91
- package/button/Button.test.js +20 -17
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +48 -89
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +140 -182
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.js +160 -39
- package/checkbox/types.d.ts +11 -3
- package/chip/Chip.js +39 -79
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +16 -31
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1395 -0
- package/common/variables.js +927 -1164
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.js +150 -299
- package/date-input/DateInput.stories.tsx +203 -56
- package/date-input/DateInput.test.js +700 -371
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +115 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +60 -118
- package/dialog/Dialog.stories.tsx +320 -166
- package/dialog/Dialog.test.js +269 -32
- package/dialog/types.d.ts +18 -25
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +19 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.js +81 -132
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +410 -402
- package/dropdown/DropdownMenu.js +20 -37
- package/dropdown/DropdownMenuItem.js +10 -35
- package/dropdown/types.d.ts +18 -20
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +241 -355
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.js +369 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +45 -96
- package/file-input/types.d.ts +25 -8
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +40 -40
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +84 -8
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -117
- package/footer/Footer.stories.tsx +60 -19
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -26
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +48 -133
- package/header/Header.stories.tsx +118 -39
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +7 -21
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +2 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +5 -6
- package/link/Link.js +25 -46
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +24 -44
- package/link/types.d.ts +14 -14
- package/main.d.ts +9 -5
- package/main.js +40 -59
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +23 -55
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +115 -9
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +39 -45
- package/nav-tabs/Tab.js +118 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +14 -15
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +47 -37
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +860 -377
- package/number-input/types.d.ts +11 -5
- package/package.json +39 -42
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +21 -47
- package/paginator/Paginator.js +23 -59
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +253 -226
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +6 -22
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +160 -142
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +23 -55
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
- package/progress-bar/ProgressBar.test.js +36 -53
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +15 -39
- package/quick-nav/QuickNav.stories.tsx +112 -20
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -76
- package/radio-group/RadioGroup.js +59 -105
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +518 -457
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +166 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +152 -30
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +167 -144
- package/{resultsetTable → resultset-table}/types.d.ts +13 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +17 -73
- package/select/Option.js +27 -50
- package/select/Select.js +123 -176
- package/select/Select.stories.tsx +497 -153
- package/select/Select.test.js +1970 -1775
- package/select/types.d.ts +16 -17
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +82 -153
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +146 -179
- package/slider/Slider.test.js +164 -97
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.js +31 -75
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +113 -150
- package/switch/Switch.stories.tsx +33 -34
- package/switch/Switch.test.js +70 -102
- package/switch/types.d.ts +8 -3
- package/table/DropdownTheme.js +62 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +87 -35
- package/table/Table.stories.tsx +658 -0
- package/table/Table.test.js +95 -8
- package/table/types.d.ts +48 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +116 -0
- package/tabs/Tabs.js +314 -141
- package/tabs/Tabs.stories.tsx +120 -6
- package/tabs/Tabs.test.js +223 -69
- package/tabs/types.d.ts +28 -18
- package/tag/Tag.js +29 -61
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +20 -31
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +56 -0
- package/text-input/Suggestion.js +40 -28
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +84 -0
- package/text-input/TextInput.js +301 -497
- package/text-input/TextInput.stories.tsx +266 -274
- package/text-input/TextInput.test.js +1419 -1375
- package/text-input/types.d.ts +43 -16
- package/textarea/Textarea.js +70 -113
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -106
- package/toggle-group/ToggleGroup.stories.tsx +49 -4
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +15 -123
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1147 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +84 -1
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.js +16 -51
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +9 -10
- 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/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/slider/Slider.stories.tsx +0 -177
- package/table/Table.stories.jsx +0 -277
- package/tabs-nav/Tab.js +0 -130
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{tabs-nav → container}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → contextual-menu/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within
|
|
3
|
-
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
4
3
|
import Title from "../../.storybook/components/Title";
|
|
5
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
-
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
5
|
import DxcTextInput from "./TextInput";
|
|
6
|
+
import Suggestions from "./Suggestions";
|
|
7
|
+
import { ThemeProvider } from "styled-components";
|
|
8
|
+
import useTheme from "../useTheme";
|
|
9
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
8
10
|
|
|
9
11
|
export default {
|
|
10
|
-
title: "Text
|
|
12
|
+
title: "Text Input",
|
|
11
13
|
component: DxcTextInput,
|
|
12
14
|
};
|
|
13
15
|
|
|
@@ -21,7 +23,7 @@ const action = {
|
|
|
21
23
|
),
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
const
|
|
26
|
+
const actionLargeIconSVG = {
|
|
25
27
|
onClick: () => {},
|
|
26
28
|
icon: (
|
|
27
29
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -31,14 +33,19 @@ const actionLargeIcon = {
|
|
|
31
33
|
),
|
|
32
34
|
};
|
|
33
35
|
|
|
36
|
+
const actionLargeIconURL = {
|
|
37
|
+
onClick: () => {},
|
|
38
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
39
|
+
};
|
|
40
|
+
|
|
34
41
|
const country = ["Afghanistan"];
|
|
35
42
|
const countries = [
|
|
36
43
|
"Afghanistan",
|
|
37
44
|
"Albania",
|
|
38
45
|
"Algeria",
|
|
39
|
-
"Andorra
|
|
46
|
+
"Andorra",
|
|
40
47
|
"Angola",
|
|
41
|
-
"Antigua and Barbuda
|
|
48
|
+
"Antigua and Barbuda",
|
|
42
49
|
"Bahamas",
|
|
43
50
|
"Bahrain",
|
|
44
51
|
"Bangladesh",
|
|
@@ -57,6 +64,13 @@ const countries = [
|
|
|
57
64
|
"Djibouti",
|
|
58
65
|
];
|
|
59
66
|
|
|
67
|
+
const opinionatedTheme = {
|
|
68
|
+
textInput: {
|
|
69
|
+
fontColor: "#000000",
|
|
70
|
+
hoverBorderColor: "#a46ede",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
60
74
|
export const Chromatic = () => (
|
|
61
75
|
<>
|
|
62
76
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
@@ -71,6 +85,14 @@ export const Chromatic = () => (
|
|
|
71
85
|
<Title title="Hovered action" theme="light" level={4} />
|
|
72
86
|
<DxcTextInput label="Text input" defaultValue="Text" clearable />
|
|
73
87
|
</ExampleContainer>
|
|
88
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
89
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
90
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
93
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
94
|
+
<DxcTextInput label="Text input" action={action} clearable />
|
|
95
|
+
</ExampleContainer>
|
|
74
96
|
<ExampleContainer>
|
|
75
97
|
<Title title="Without label" theme="light" level={4} />
|
|
76
98
|
<DxcTextInput />
|
|
@@ -84,12 +106,21 @@ export const Chromatic = () => (
|
|
|
84
106
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
85
107
|
</ExampleContainer>
|
|
86
108
|
<ExampleContainer>
|
|
87
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
109
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
110
|
+
<DxcTextInput
|
|
111
|
+
label="Text input"
|
|
112
|
+
defaultValue="Text text text text text text text text text text"
|
|
113
|
+
clearable
|
|
114
|
+
action={actionLargeIconSVG}
|
|
115
|
+
/>
|
|
116
|
+
</ExampleContainer>
|
|
117
|
+
<ExampleContainer>
|
|
118
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
88
119
|
<DxcTextInput
|
|
89
120
|
label="Text input"
|
|
90
121
|
defaultValue="Text text text text text text text text text text"
|
|
91
122
|
clearable
|
|
92
|
-
action={
|
|
123
|
+
action={actionLargeIconURL}
|
|
93
124
|
/>
|
|
94
125
|
</ExampleContainer>
|
|
95
126
|
<ExampleContainer>
|
|
@@ -149,86 +180,45 @@ export const Chromatic = () => (
|
|
|
149
180
|
action={action}
|
|
150
181
|
/>
|
|
151
182
|
</ExampleContainer>
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
<DxcTextInput
|
|
192
|
-
label="Error text input"
|
|
193
|
-
helperText="Help message"
|
|
194
|
-
placeholder="Placeholder"
|
|
195
|
-
error="Error message."
|
|
196
|
-
/>
|
|
197
|
-
</ExampleContainer>
|
|
198
|
-
<ExampleContainer>
|
|
199
|
-
<Title title="Prefix and suffix" theme="dark" level={4} />
|
|
200
|
-
<DxcTextInput label="With prefix and suffix" prefix="+34" suffix="USD" />
|
|
201
|
-
</ExampleContainer>
|
|
202
|
-
<ExampleContainer>
|
|
203
|
-
<Title title="Disabled and placeholder" theme="dark" level={4} />
|
|
204
|
-
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" />
|
|
205
|
-
</ExampleContainer>
|
|
206
|
-
<ExampleContainer>
|
|
207
|
-
<Title title="Disabled, helper text, optional, value and action" theme="dark" level={4} />
|
|
208
|
-
<DxcTextInput
|
|
209
|
-
label="Disabled text input"
|
|
210
|
-
helperText="Help message"
|
|
211
|
-
disabled
|
|
212
|
-
optional
|
|
213
|
-
defaultValue="Text"
|
|
214
|
-
action={action}
|
|
215
|
-
/>
|
|
216
|
-
</ExampleContainer>
|
|
217
|
-
<ExampleContainer>
|
|
218
|
-
<Title title="Disabled with prefix and suffix" theme="dark" level={4} />
|
|
219
|
-
<DxcTextInput
|
|
220
|
-
label="Disabled text input"
|
|
221
|
-
helperText="Help message"
|
|
222
|
-
disabled
|
|
223
|
-
optional
|
|
224
|
-
prefix="+34"
|
|
225
|
-
suffix="USD"
|
|
226
|
-
defaultValue="Text"
|
|
227
|
-
action={action}
|
|
228
|
-
/>
|
|
229
|
-
</ExampleContainer>
|
|
230
|
-
</DarkContainer>
|
|
231
|
-
</BackgroundColorProvider>
|
|
183
|
+
<ExampleContainer>
|
|
184
|
+
<Title title="Read only" theme="light" level={4} />
|
|
185
|
+
<DxcTextInput
|
|
186
|
+
label="Example label"
|
|
187
|
+
helperText="Help message"
|
|
188
|
+
clearable
|
|
189
|
+
readOnly
|
|
190
|
+
optional
|
|
191
|
+
prefix="+34"
|
|
192
|
+
defaultValue="Text"
|
|
193
|
+
action={action}
|
|
194
|
+
/>
|
|
195
|
+
</ExampleContainer>
|
|
196
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
197
|
+
<Title title="Hovered read only" theme="light" level={4} />
|
|
198
|
+
<DxcTextInput
|
|
199
|
+
label="Example label"
|
|
200
|
+
helperText="Help message"
|
|
201
|
+
clearable
|
|
202
|
+
readOnly
|
|
203
|
+
optional
|
|
204
|
+
prefix="+34"
|
|
205
|
+
defaultValue="Text"
|
|
206
|
+
action={action}
|
|
207
|
+
/>
|
|
208
|
+
</ExampleContainer>
|
|
209
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
210
|
+
<Title title="Active read only" theme="light" level={4} />
|
|
211
|
+
<DxcTextInput
|
|
212
|
+
label="Example label"
|
|
213
|
+
helperText="Help message"
|
|
214
|
+
clearable
|
|
215
|
+
readOnly
|
|
216
|
+
optional
|
|
217
|
+
prefix="+34"
|
|
218
|
+
defaultValue="Text"
|
|
219
|
+
action={action}
|
|
220
|
+
/>
|
|
221
|
+
</ExampleContainer>
|
|
232
222
|
<Title title="Margins" theme="light" level={2} />
|
|
233
223
|
<ExampleContainer>
|
|
234
224
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
@@ -275,199 +265,201 @@ export const Chromatic = () => (
|
|
|
275
265
|
<Title title="FillParent size" theme="light" level={4} />
|
|
276
266
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
277
267
|
</ExampleContainer>
|
|
268
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
269
|
+
<ExampleContainer>
|
|
270
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
271
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
272
|
+
<Title title="Hovered input" theme="light" level={4} />
|
|
273
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
274
|
+
</ExampleContainer>
|
|
275
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
276
|
+
<Title title="Focused input" theme="light" level={4} />
|
|
277
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
278
|
+
</ExampleContainer>
|
|
279
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
280
|
+
<Title title="Hovered action" theme="light" level={4} />
|
|
281
|
+
<DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
|
|
282
|
+
</ExampleContainer>
|
|
283
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
284
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
285
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
286
|
+
</ExampleContainer>
|
|
287
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
288
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
289
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
290
|
+
</ExampleContainer>
|
|
291
|
+
<ExampleContainer>
|
|
292
|
+
<Title title="Prefix" theme="light" level={4} />
|
|
293
|
+
<DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
|
|
294
|
+
</ExampleContainer>
|
|
295
|
+
<ExampleContainer>
|
|
296
|
+
<Title title="Suffix and action" theme="light" level={4} />
|
|
297
|
+
<DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
|
|
298
|
+
</ExampleContainer>
|
|
299
|
+
<ExampleContainer>
|
|
300
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
301
|
+
<DxcTextInput
|
|
302
|
+
label="Error text input"
|
|
303
|
+
helperText="Help message"
|
|
304
|
+
error="Error message."
|
|
305
|
+
defaultValue="Text"
|
|
306
|
+
clearable
|
|
307
|
+
optional
|
|
308
|
+
action={action}
|
|
309
|
+
/>
|
|
310
|
+
</ExampleContainer>
|
|
311
|
+
<ExampleContainer>
|
|
312
|
+
<Title title="Disabled and placeholder" theme="light" level={4} />
|
|
313
|
+
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
|
|
314
|
+
</ExampleContainer>
|
|
315
|
+
<ExampleContainer>
|
|
316
|
+
<Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
|
|
317
|
+
<DxcTextInput
|
|
318
|
+
label="Disabled text input"
|
|
319
|
+
helperText="Help message"
|
|
320
|
+
disabled
|
|
321
|
+
optional
|
|
322
|
+
defaultValue="Text"
|
|
323
|
+
action={action}
|
|
324
|
+
/>
|
|
325
|
+
</ExampleContainer>
|
|
326
|
+
</HalstackProvider>
|
|
327
|
+
</ExampleContainer>
|
|
278
328
|
</>
|
|
279
329
|
);
|
|
280
330
|
|
|
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
|
-
);
|
|
322
|
-
|
|
323
|
-
const FocusedActionTextInputOnDark = () => (
|
|
324
|
-
<BackgroundColorProvider color="#333333">
|
|
325
|
-
<DarkContainer>
|
|
326
|
-
<ExampleContainer expanded>
|
|
327
|
-
<Title title="Focused action" theme="dark" level={4} />
|
|
328
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
329
|
-
</ExampleContainer>
|
|
330
|
-
</DarkContainer>
|
|
331
|
-
</BackgroundColorProvider>
|
|
332
|
-
);
|
|
333
|
-
|
|
334
|
-
const ActivedActionTextInputOnDark = () => (
|
|
335
|
-
<BackgroundColorProvider color="#333333">
|
|
336
|
-
<DarkContainer>
|
|
337
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
338
|
-
<Title title="Actived action" theme="dark" level={4} />
|
|
339
|
-
<DxcTextInput label="Text input" action={action} clearable />
|
|
340
|
-
</ExampleContainer>
|
|
341
|
-
</DarkContainer>
|
|
342
|
-
</BackgroundColorProvider>
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
const ShowOptionsAutosuggestOnDark = () => (
|
|
346
|
-
<BackgroundColorProvider color="#333333">
|
|
347
|
-
<DarkContainer>
|
|
348
|
-
<ExampleContainer expanded>
|
|
349
|
-
<Title title="Show options" theme="dark" level={4} />
|
|
350
|
-
<DxcTextInput label="Text input" suggestions={countries} clearable />
|
|
351
|
-
</ExampleContainer>
|
|
352
|
-
</DarkContainer>
|
|
353
|
-
</BackgroundColorProvider>
|
|
354
|
-
);
|
|
331
|
+
const AutosuggestListbox = () => {
|
|
332
|
+
const colorsTheme: any = useTheme();
|
|
355
333
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
<
|
|
361
|
-
|
|
334
|
+
return (
|
|
335
|
+
<ThemeProvider theme={colorsTheme.textInput}>
|
|
336
|
+
<ExampleContainer>
|
|
337
|
+
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
338
|
+
<ExampleContainer>
|
|
339
|
+
<Title
|
|
340
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
341
|
+
theme="light"
|
|
342
|
+
level={3}
|
|
343
|
+
/>
|
|
344
|
+
<div
|
|
345
|
+
style={{
|
|
346
|
+
display: "flex",
|
|
347
|
+
flexDirection: "column",
|
|
348
|
+
gap: "20px",
|
|
349
|
+
height: "150px",
|
|
350
|
+
width: "500px",
|
|
351
|
+
marginBottom: "250px",
|
|
352
|
+
padding: "20px",
|
|
353
|
+
border: "1px solid black",
|
|
354
|
+
borderRadius: "4px",
|
|
355
|
+
overflow: "auto",
|
|
356
|
+
zIndex: "1300",
|
|
357
|
+
position: "relative",
|
|
358
|
+
}}
|
|
359
|
+
>
|
|
360
|
+
<DxcTextInput
|
|
361
|
+
label="Label"
|
|
362
|
+
suggestions={countries}
|
|
363
|
+
optional
|
|
364
|
+
placeholder="Choose an option"
|
|
365
|
+
size="fillParent"
|
|
366
|
+
/>
|
|
367
|
+
<button style={{ zIndex: "1", width: "100px" }}>Submit</button>
|
|
368
|
+
</div>
|
|
369
|
+
</ExampleContainer>
|
|
370
|
+
<Title title="Listbox suggestion states" theme="light" level={3} />
|
|
371
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
372
|
+
<Title title="Hovered 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={() => {}}
|
|
382
|
+
styles={{ width: 350 }}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active suggestion" theme="light" level={4} />
|
|
387
|
+
<Suggestions
|
|
388
|
+
id="x"
|
|
389
|
+
value=""
|
|
390
|
+
suggestions={country}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
highlightedSuggestions={false}
|
|
393
|
+
searchHasErrors={false}
|
|
394
|
+
isSearching={false}
|
|
395
|
+
suggestionOnClick={(suggestion) => {}}
|
|
396
|
+
styles={{ width: 350 }}
|
|
397
|
+
/>
|
|
398
|
+
</ExampleContainer>
|
|
399
|
+
<ExampleContainer>
|
|
400
|
+
<Title title="Focused suggestion" theme="light" level={4} />
|
|
401
|
+
<Suggestions
|
|
402
|
+
id="x"
|
|
403
|
+
value=""
|
|
404
|
+
suggestions={country}
|
|
405
|
+
visualFocusIndex={0}
|
|
406
|
+
highlightedSuggestions={false}
|
|
407
|
+
searchHasErrors={false}
|
|
408
|
+
isSearching={false}
|
|
409
|
+
suggestionOnClick={(suggestion) => {}}
|
|
410
|
+
styles={{ width: 350 }}
|
|
411
|
+
/>
|
|
412
|
+
</ExampleContainer>
|
|
413
|
+
<ExampleContainer>
|
|
414
|
+
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
415
|
+
<Suggestions
|
|
416
|
+
id="x"
|
|
417
|
+
value="Afgh"
|
|
418
|
+
suggestions={country}
|
|
419
|
+
visualFocusIndex={-1}
|
|
420
|
+
highlightedSuggestions={true}
|
|
421
|
+
searchHasErrors={false}
|
|
422
|
+
isSearching={false}
|
|
423
|
+
suggestionOnClick={(suggestion) => {}}
|
|
424
|
+
styles={{ width: 350 }}
|
|
425
|
+
/>
|
|
426
|
+
</ExampleContainer>
|
|
362
427
|
</ExampleContainer>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
428
|
+
<ExampleContainer>
|
|
429
|
+
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
430
|
+
<Suggestions
|
|
431
|
+
id="x"
|
|
432
|
+
value=""
|
|
433
|
+
suggestions={country}
|
|
434
|
+
visualFocusIndex={-1}
|
|
435
|
+
highlightedSuggestions={false}
|
|
436
|
+
searchHasErrors={true}
|
|
437
|
+
isSearching={false}
|
|
438
|
+
suggestionOnClick={(suggestion) => {}}
|
|
439
|
+
styles={{ width: 350 }}
|
|
440
|
+
/>
|
|
373
441
|
</ExampleContainer>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
442
|
+
<ExampleContainer>
|
|
443
|
+
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
444
|
+
<Suggestions
|
|
445
|
+
id="x"
|
|
446
|
+
value=""
|
|
447
|
+
suggestions={country}
|
|
448
|
+
visualFocusIndex={-1}
|
|
449
|
+
highlightedSuggestions={false}
|
|
450
|
+
searchHasErrors={false}
|
|
451
|
+
isSearching={true}
|
|
452
|
+
suggestionOnClick={(suggestion) => {}}
|
|
453
|
+
styles={{ width: 350 }}
|
|
454
|
+
/>
|
|
384
455
|
</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);
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
export const HoveredOption = HoveredOptionAutosuggest.bind({});
|
|
411
|
-
HoveredOption.play = async ({ canvasElement }) => {
|
|
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
|
-
};
|
|
445
|
-
|
|
446
|
-
export const ShowOptionsOnDark = ShowOptionsAutosuggestOnDark.bind({});
|
|
447
|
-
ShowOptionsOnDark.play = async ({ canvasElement }) => {
|
|
448
|
-
const canvas = within(canvasElement);
|
|
449
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
450
|
-
await userEvent.click(autosuggest);
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
export const HoveredActionOnDark = HoveredActionAutosuggestOnDark.bind({});
|
|
454
|
-
HoveredActionOnDark.play = async ({ canvasElement }) => {
|
|
455
|
-
const canvas = within(canvasElement);
|
|
456
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
457
|
-
await userEvent.click(autosuggest);
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
export const FocusedOptionOnDark = FocusedOptionAutosuggestOnDark.bind({});
|
|
461
|
-
FocusedOptionOnDark.play = async ({ canvasElement }) => {
|
|
462
|
-
const canvas = within(canvasElement);
|
|
463
|
-
const autosuggest = canvas.getByRole("combobox");
|
|
464
|
-
await userEvent.click(autosuggest);
|
|
465
|
-
fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
456
|
+
</ThemeProvider>
|
|
457
|
+
);
|
|
466
458
|
};
|
|
467
459
|
|
|
468
|
-
export const
|
|
469
|
-
|
|
460
|
+
export const AutosuggestListboxStates = AutosuggestListbox.bind({});
|
|
461
|
+
AutosuggestListboxStates.play = async ({ canvasElement }) => {
|
|
470
462
|
const canvas = within(canvasElement);
|
|
471
|
-
const
|
|
472
|
-
await userEvent.click(
|
|
463
|
+
const select = canvas.getByRole("combobox");
|
|
464
|
+
await userEvent.click(select);
|
|
473
465
|
};
|