@dxc-technology/halstack-react 0.0.0-a062293 → 0.0.0-a0cade1

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.
Files changed (330) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6516 -0
  3. package/dist/index.d.ts +6516 -0
  4. package/dist/index.js +12982 -0
  5. package/dist/index.mjs +12925 -0
  6. package/package.json +75 -67
  7. package/BackgroundColorContext.d.ts +0 -10
  8. package/BackgroundColorContext.js +0 -47
  9. package/HalstackContext.d.ts +0 -12
  10. package/HalstackContext.js +0 -294
  11. package/accordion/Accordion.d.ts +0 -4
  12. package/accordion/Accordion.js +0 -239
  13. package/accordion/Accordion.stories.tsx +0 -346
  14. package/accordion/Accordion.test.js +0 -71
  15. package/accordion/types.d.ts +0 -69
  16. package/accordion/types.js +0 -5
  17. package/accordion-group/AccordionGroup.d.ts +0 -7
  18. package/accordion-group/AccordionGroup.js +0 -149
  19. package/accordion-group/AccordionGroup.stories.tsx +0 -251
  20. package/accordion-group/AccordionGroup.test.js +0 -126
  21. package/accordion-group/types.d.ts +0 -79
  22. package/accordion-group/types.js +0 -5
  23. package/alert/Alert.d.ts +0 -4
  24. package/alert/Alert.js +0 -293
  25. package/alert/Alert.stories.tsx +0 -170
  26. package/alert/Alert.test.js +0 -92
  27. package/alert/types.d.ts +0 -49
  28. package/alert/types.js +0 -5
  29. package/badge/Badge.d.ts +0 -4
  30. package/badge/Badge.js +0 -61
  31. package/badge/types.d.ts +0 -5
  32. package/badge/types.js +0 -5
  33. package/bleed/Bleed.d.ts +0 -3
  34. package/bleed/Bleed.js +0 -51
  35. package/bleed/Bleed.stories.tsx +0 -341
  36. package/bleed/types.d.ts +0 -37
  37. package/bleed/types.js +0 -5
  38. package/box/Box.d.ts +0 -4
  39. package/box/Box.js +0 -116
  40. package/box/Box.stories.tsx +0 -132
  41. package/box/Box.test.js +0 -18
  42. package/box/types.d.ts +0 -44
  43. package/box/types.js +0 -5
  44. package/bulleted-list/BulletedList.d.ts +0 -7
  45. package/bulleted-list/BulletedList.js +0 -123
  46. package/bulleted-list/BulletedList.stories.tsx +0 -200
  47. package/bulleted-list/types.d.ts +0 -11
  48. package/bulleted-list/types.js +0 -5
  49. package/button/Button.d.ts +0 -4
  50. package/button/Button.js +0 -154
  51. package/button/Button.stories.tsx +0 -334
  52. package/button/Button.test.js +0 -35
  53. package/button/types.d.ts +0 -53
  54. package/button/types.js +0 -5
  55. package/card/Card.d.ts +0 -4
  56. package/card/Card.js +0 -161
  57. package/card/Card.stories.tsx +0 -201
  58. package/card/Card.test.js +0 -50
  59. package/card/ice-cream.jpg +0 -0
  60. package/card/types.d.ts +0 -68
  61. package/card/types.js +0 -5
  62. package/checkbox/Checkbox.d.ts +0 -4
  63. package/checkbox/Checkbox.js +0 -250
  64. package/checkbox/Checkbox.stories.tsx +0 -208
  65. package/checkbox/Checkbox.test.js +0 -155
  66. package/checkbox/types.d.ts +0 -68
  67. package/checkbox/types.js +0 -5
  68. package/chip/Chip.d.ts +0 -4
  69. package/chip/Chip.js +0 -149
  70. package/chip/Chip.stories.tsx +0 -151
  71. package/chip/Chip.test.js +0 -56
  72. package/chip/types.d.ts +0 -45
  73. package/chip/types.js +0 -5
  74. package/common/OpenSans.css +0 -81
  75. package/common/fonts/OpenSans-Bold.ttf +0 -0
  76. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  77. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  78. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  79. package/common/fonts/OpenSans-Italic.ttf +0 -0
  80. package/common/fonts/OpenSans-Light.ttf +0 -0
  81. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  82. package/common/fonts/OpenSans-Regular.ttf +0 -0
  83. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  84. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  85. package/common/utils.js +0 -22
  86. package/common/variables.js +0 -1512
  87. package/date-input/Calendar.d.ts +0 -4
  88. package/date-input/Calendar.js +0 -246
  89. package/date-input/DateInput.d.ts +0 -4
  90. package/date-input/DateInput.js +0 -269
  91. package/date-input/DateInput.stories.tsx +0 -237
  92. package/date-input/DateInput.test.js +0 -835
  93. package/date-input/DatePicker.d.ts +0 -4
  94. package/date-input/DatePicker.js +0 -132
  95. package/date-input/Icons.d.ts +0 -6
  96. package/date-input/Icons.js +0 -75
  97. package/date-input/YearPicker.d.ts +0 -4
  98. package/date-input/YearPicker.js +0 -116
  99. package/date-input/types.d.ts +0 -158
  100. package/date-input/types.js +0 -5
  101. package/dialog/Dialog.d.ts +0 -4
  102. package/dialog/Dialog.js +0 -162
  103. package/dialog/Dialog.stories.tsx +0 -267
  104. package/dialog/Dialog.test.js +0 -70
  105. package/dialog/types.d.ts +0 -44
  106. package/dialog/types.js +0 -5
  107. package/dropdown/Dropdown.d.ts +0 -4
  108. package/dropdown/Dropdown.js +0 -389
  109. package/dropdown/Dropdown.stories.tsx +0 -320
  110. package/dropdown/Dropdown.test.js +0 -585
  111. package/dropdown/DropdownMenu.d.ts +0 -4
  112. package/dropdown/DropdownMenu.js +0 -80
  113. package/dropdown/DropdownMenuItem.d.ts +0 -4
  114. package/dropdown/DropdownMenuItem.js +0 -92
  115. package/dropdown/types.d.ts +0 -100
  116. package/dropdown/types.js +0 -5
  117. package/file-input/FileInput.d.ts +0 -4
  118. package/file-input/FileInput.js +0 -551
  119. package/file-input/FileInput.stories.tsx +0 -535
  120. package/file-input/FileInput.test.js +0 -498
  121. package/file-input/FileItem.d.ts +0 -4
  122. package/file-input/FileItem.js +0 -161
  123. package/file-input/types.d.ts +0 -129
  124. package/file-input/types.js +0 -5
  125. package/flex/Flex.d.ts +0 -4
  126. package/flex/Flex.js +0 -69
  127. package/flex/Flex.stories.tsx +0 -103
  128. package/flex/types.d.ts +0 -32
  129. package/flex/types.js +0 -5
  130. package/footer/Footer.d.ts +0 -4
  131. package/footer/Footer.js +0 -185
  132. package/footer/Footer.stories.tsx +0 -137
  133. package/footer/Footer.test.js +0 -109
  134. package/footer/Icons.d.ts +0 -2
  135. package/footer/Icons.js +0 -77
  136. package/footer/types.d.ts +0 -66
  137. package/footer/types.js +0 -5
  138. package/header/Header.d.ts +0 -7
  139. package/header/Header.js +0 -305
  140. package/header/Header.stories.tsx +0 -172
  141. package/header/Header.test.js +0 -79
  142. package/header/Icons.d.ts +0 -2
  143. package/header/Icons.js +0 -34
  144. package/header/types.d.ts +0 -48
  145. package/header/types.js +0 -5
  146. package/heading/Heading.d.ts +0 -4
  147. package/heading/Heading.js +0 -159
  148. package/heading/Heading.stories.tsx +0 -54
  149. package/heading/Heading.test.js +0 -186
  150. package/heading/types.d.ts +0 -33
  151. package/heading/types.js +0 -5
  152. package/inset/Inset.d.ts +0 -3
  153. package/inset/Inset.js +0 -51
  154. package/inset/Inset.stories.tsx +0 -229
  155. package/inset/types.d.ts +0 -37
  156. package/inset/types.js +0 -5
  157. package/layout/ApplicationLayout.d.ts +0 -20
  158. package/layout/ApplicationLayout.js +0 -171
  159. package/layout/ApplicationLayout.stories.tsx +0 -162
  160. package/layout/Icons.d.ts +0 -5
  161. package/layout/Icons.js +0 -66
  162. package/layout/SidenavContext.d.ts +0 -5
  163. package/layout/SidenavContext.js +0 -19
  164. package/layout/types.d.ts +0 -42
  165. package/layout/types.js +0 -5
  166. package/link/Link.d.ts +0 -4
  167. package/link/Link.js +0 -136
  168. package/link/Link.stories.tsx +0 -193
  169. package/link/Link.test.js +0 -83
  170. package/link/types.d.ts +0 -54
  171. package/link/types.js +0 -5
  172. package/main.d.ts +0 -44
  173. package/main.js +0 -369
  174. package/number-input/NumberInput.d.ts +0 -4
  175. package/number-input/NumberInput.js +0 -76
  176. package/number-input/NumberInput.stories.tsx +0 -115
  177. package/number-input/NumberInput.test.js +0 -542
  178. package/number-input/NumberInputContext.d.ts +0 -4
  179. package/number-input/NumberInputContext.js +0 -19
  180. package/number-input/numberInputContextTypes.d.ts +0 -19
  181. package/number-input/numberInputContextTypes.js +0 -5
  182. package/number-input/types.d.ts +0 -124
  183. package/number-input/types.js +0 -5
  184. package/paginator/Icons.d.ts +0 -5
  185. package/paginator/Icons.js +0 -54
  186. package/paginator/Paginator.d.ts +0 -4
  187. package/paginator/Paginator.js +0 -165
  188. package/paginator/Paginator.stories.tsx +0 -63
  189. package/paginator/Paginator.test.js +0 -315
  190. package/paginator/types.d.ts +0 -38
  191. package/paginator/types.js +0 -5
  192. package/paragraph/Paragraph.d.ts +0 -6
  193. package/paragraph/Paragraph.js +0 -38
  194. package/paragraph/Paragraph.stories.tsx +0 -44
  195. package/password-input/PasswordInput.d.ts +0 -4
  196. package/password-input/PasswordInput.js +0 -166
  197. package/password-input/PasswordInput.stories.tsx +0 -131
  198. package/password-input/PasswordInput.test.js +0 -181
  199. package/password-input/types.d.ts +0 -110
  200. package/password-input/types.js +0 -5
  201. package/progress-bar/ProgressBar.d.ts +0 -4
  202. package/progress-bar/ProgressBar.js +0 -176
  203. package/progress-bar/ProgressBar.stories.jsx +0 -60
  204. package/progress-bar/ProgressBar.test.js +0 -110
  205. package/progress-bar/types.d.ts +0 -36
  206. package/progress-bar/types.js +0 -5
  207. package/quick-nav/QuickNav.d.ts +0 -4
  208. package/quick-nav/QuickNav.js +0 -117
  209. package/quick-nav/QuickNav.stories.tsx +0 -342
  210. package/quick-nav/types.d.ts +0 -21
  211. package/quick-nav/types.js +0 -5
  212. package/radio-group/Radio.d.ts +0 -4
  213. package/radio-group/Radio.js +0 -156
  214. package/radio-group/RadioGroup.d.ts +0 -4
  215. package/radio-group/RadioGroup.js +0 -283
  216. package/radio-group/RadioGroup.stories.tsx +0 -101
  217. package/radio-group/RadioGroup.test.js +0 -722
  218. package/radio-group/types.d.ts +0 -114
  219. package/radio-group/types.js +0 -5
  220. package/resultsetTable/Icons.d.ts +0 -7
  221. package/resultsetTable/Icons.js +0 -51
  222. package/resultsetTable/ResultsetTable.d.ts +0 -4
  223. package/resultsetTable/ResultsetTable.js +0 -195
  224. package/resultsetTable/ResultsetTable.stories.tsx +0 -300
  225. package/resultsetTable/ResultsetTable.test.js +0 -325
  226. package/resultsetTable/types.d.ts +0 -67
  227. package/resultsetTable/types.js +0 -5
  228. package/select/Icons.d.ts +0 -10
  229. package/select/Icons.js +0 -93
  230. package/select/Listbox.d.ts +0 -4
  231. package/select/Listbox.js +0 -169
  232. package/select/Option.d.ts +0 -4
  233. package/select/Option.js +0 -97
  234. package/select/Select.d.ts +0 -4
  235. package/select/Select.js +0 -664
  236. package/select/Select.stories.tsx +0 -670
  237. package/select/Select.test.js +0 -2228
  238. package/select/types.d.ts +0 -210
  239. package/select/types.js +0 -5
  240. package/sidenav/Sidenav.d.ts +0 -10
  241. package/sidenav/Sidenav.js +0 -266
  242. package/sidenav/Sidenav.stories.tsx +0 -189
  243. package/sidenav/Sidenav.test.js +0 -44
  244. package/sidenav/types.d.ts +0 -73
  245. package/sidenav/types.js +0 -5
  246. package/slider/Slider.d.ts +0 -4
  247. package/slider/Slider.js +0 -343
  248. package/slider/Slider.stories.tsx +0 -183
  249. package/slider/Slider.test.js +0 -250
  250. package/slider/types.d.ts +0 -86
  251. package/slider/types.js +0 -5
  252. package/spinner/Spinner.d.ts +0 -4
  253. package/spinner/Spinner.js +0 -250
  254. package/spinner/Spinner.stories.jsx +0 -103
  255. package/spinner/Spinner.test.js +0 -64
  256. package/spinner/types.d.ts +0 -32
  257. package/spinner/types.js +0 -5
  258. package/switch/Switch.d.ts +0 -4
  259. package/switch/Switch.js +0 -262
  260. package/switch/Switch.stories.tsx +0 -138
  261. package/switch/Switch.test.js +0 -225
  262. package/switch/types.d.ts +0 -66
  263. package/switch/types.js +0 -5
  264. package/table/Table.d.ts +0 -4
  265. package/table/Table.js +0 -118
  266. package/table/Table.stories.jsx +0 -277
  267. package/table/Table.test.js +0 -26
  268. package/table/types.d.ts +0 -21
  269. package/table/types.js +0 -5
  270. package/tabs/Tab.d.ts +0 -4
  271. package/tabs/Tab.js +0 -133
  272. package/tabs/Tabs.d.ts +0 -4
  273. package/tabs/Tabs.js +0 -467
  274. package/tabs/Tabs.stories.tsx +0 -188
  275. package/tabs/Tabs.test.js +0 -351
  276. package/tabs/types.d.ts +0 -92
  277. package/tabs/types.js +0 -5
  278. package/tabs-nav/NavTabs.d.ts +0 -8
  279. package/tabs-nav/NavTabs.js +0 -125
  280. package/tabs-nav/NavTabs.stories.tsx +0 -172
  281. package/tabs-nav/NavTabs.test.js +0 -82
  282. package/tabs-nav/Tab.d.ts +0 -4
  283. package/tabs-nav/Tab.js +0 -128
  284. package/tabs-nav/types.d.ts +0 -53
  285. package/tabs-nav/types.js +0 -5
  286. package/tag/Tag.d.ts +0 -4
  287. package/tag/Tag.js +0 -183
  288. package/tag/Tag.stories.tsx +0 -142
  289. package/tag/Tag.test.js +0 -60
  290. package/tag/types.d.ts +0 -69
  291. package/tag/types.js +0 -5
  292. package/text-input/Icons.d.ts +0 -8
  293. package/text-input/Icons.js +0 -60
  294. package/text-input/Suggestion.d.ts +0 -4
  295. package/text-input/Suggestion.js +0 -84
  296. package/text-input/Suggestions.d.ts +0 -4
  297. package/text-input/Suggestions.js +0 -134
  298. package/text-input/TextInput.d.ts +0 -4
  299. package/text-input/TextInput.js +0 -673
  300. package/text-input/TextInput.stories.tsx +0 -501
  301. package/text-input/TextInput.test.js +0 -1724
  302. package/text-input/types.d.ts +0 -197
  303. package/text-input/types.js +0 -5
  304. package/textarea/Textarea.d.ts +0 -4
  305. package/textarea/Textarea.js +0 -277
  306. package/textarea/Textarea.stories.jsx +0 -157
  307. package/textarea/Textarea.test.js +0 -437
  308. package/textarea/types.d.ts +0 -137
  309. package/textarea/types.js +0 -5
  310. package/toggle-group/ToggleGroup.d.ts +0 -4
  311. package/toggle-group/ToggleGroup.js +0 -215
  312. package/toggle-group/ToggleGroup.stories.tsx +0 -173
  313. package/toggle-group/ToggleGroup.test.js +0 -156
  314. package/toggle-group/types.d.ts +0 -105
  315. package/toggle-group/types.js +0 -5
  316. package/typography/Typography.d.ts +0 -4
  317. package/typography/Typography.js +0 -131
  318. package/typography/Typography.stories.tsx +0 -198
  319. package/typography/types.d.ts +0 -18
  320. package/typography/types.js +0 -5
  321. package/useTheme.d.ts +0 -2
  322. package/useTheme.js +0 -22
  323. package/useTranslatedLabels.d.ts +0 -2
  324. package/useTranslatedLabels.js +0 -20
  325. package/wizard/Wizard.d.ts +0 -4
  326. package/wizard/Wizard.js +0 -285
  327. package/wizard/Wizard.stories.tsx +0 -233
  328. package/wizard/Wizard.test.js +0 -141
  329. package/wizard/types.d.ts +0 -65
  330. package/wizard/types.js +0 -5
@@ -1,670 +0,0 @@
1
- import React from "react";
2
- import { userEvent, within } from "@storybook/testing-library";
3
- import Title from "../../.storybook/components/Title";
4
- import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
- import DxcSelect from "./Select";
6
- import Listbox from "./Listbox";
7
- import { ThemeProvider } from "styled-components";
8
- import useTheme from "../useTheme";
9
-
10
- export default {
11
- title: "Select",
12
- component: DxcSelect,
13
- };
14
-
15
- const one_option = [{ label: "Option 01", value: "1" }];
16
- const single_options = [
17
- { label: "Option 01", value: "1" },
18
- { label: "Option 02", value: "2" },
19
- { label: "Option 03", value: "3" },
20
- { label: "Option 04", value: "4" },
21
- ];
22
- const group_options = [
23
- {
24
- label: "Group 001",
25
- options: [
26
- { label: "Option 001", value: "1" },
27
- { label: "Option 002", value: "2" },
28
- { label: "Option 003", value: "3" },
29
- ],
30
- },
31
- {
32
- label: "Group 002",
33
- options: [
34
- { label: "Option 004", value: "4" },
35
- { label: "Option 005", value: "5" },
36
- { label: "Option 006", value: "6" },
37
- ],
38
- },
39
- {
40
- label: "Group 003",
41
- options: [
42
- { label: "Option 007", value: "7" },
43
- { label: "Option 008", value: "8" },
44
- { label: "Option 009", value: "9" },
45
- ],
46
- },
47
- {
48
- label: "Group 004",
49
- options: [
50
- { label: "Option 010", value: "10" },
51
- { label: "Option 011", value: "11" },
52
- { label: "Option 012", value: "12" },
53
- ],
54
- },
55
- {
56
- label: "Group 005",
57
- options: [
58
- { label: "Option 013", value: "13" },
59
- { label: "Option 014", value: "14" },
60
- { label: "Option 015", value: "15" },
61
- ],
62
- },
63
- ];
64
- const icon_options_grouped = [
65
- {
66
- label: "Group 001",
67
- options: [
68
- {
69
- label: "3G Mobile",
70
- value: "1",
71
- icon: (
72
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
73
- <g>
74
- <path d="M0,0h24v24H0V0z" fill="none" />
75
- </g>
76
- <g>
77
- <g>
78
- <path d="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z" />
79
- </g>
80
- </g>
81
- </svg>
82
- ),
83
- },
84
- ],
85
- },
86
- {
87
- label: "Group 002",
88
- options: [
89
- {
90
- label: "Ethernet",
91
- value: "2",
92
- icon: (
93
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
94
- <path d="M0 0h24v24H0V0z" fill="none" />
95
- <path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" />
96
- </svg>
97
- ),
98
- },
99
- ],
100
- },
101
- {
102
- label: "Group 003",
103
- options: [
104
- {
105
- label: "Wi-fi",
106
- value: "3",
107
- icon: (
108
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
109
- <path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
110
- <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
111
- </svg>
112
- ),
113
- },
114
- {
115
- label: "Settings backup restore (just for previous configuration)",
116
- value: "4",
117
- icon: (
118
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
119
- <path d="M0 0h24v24H0V0z" fill="none" />
120
- <path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z" />
121
- </svg>
122
- ),
123
- },
124
- ],
125
- },
126
- ];
127
- const icon_options = [
128
- {
129
- label: "3G Mobile",
130
- value: "1",
131
- icon: (
132
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
133
- <g>
134
- <path d="M0,0h24v24H0V0z" fill="none" />
135
- </g>
136
- <g>
137
- <g>
138
- <path d="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z" />
139
- </g>
140
- </g>
141
- </svg>
142
- ),
143
- },
144
- {
145
- label: "Ethernet",
146
- value: "2",
147
- icon: (
148
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
149
- <path d="M0 0h24v24H0V0z" fill="none" />
150
- <path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" />
151
- </svg>
152
- ),
153
- },
154
- {
155
- label: "Wi-fi",
156
- value: "3",
157
- icon: (
158
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
159
- <path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
160
- <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
161
- </svg>
162
- ),
163
- },
164
- {
165
- label: "Settings backup restore (just for previous configuration)",
166
- value: "4",
167
- icon: (
168
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
169
- <path d="M0 0h24v24H0V0z" fill="none" />
170
- <path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z" />
171
- </svg>
172
- ),
173
- },
174
- ];
175
- const url_options = [
176
- {
177
- label: "Social Media",
178
- options: [
179
- {
180
- label: "Instagram",
181
- value: "instagram",
182
- icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Instagram_logo_2016.svg/800px-Instagram_logo_2016.svg.png",
183
- },
184
- {
185
- label: "Twitter",
186
- value: "twitter",
187
- icon: "https://cdn.computerhoy.com/sites/navi.axelspringer.es/public/styles/480/public/media/image/2013/08/17981-logo-twitter.png?itok=dElA6iAV",
188
- },
189
- {
190
- label: "Facebook",
191
- value: "facebook",
192
- icon: (
193
- <svg
194
- version="1.1"
195
- id="Capa_1"
196
- x="0px"
197
- y="0px"
198
- width="438.536px"
199
- height="438.536px"
200
- viewBox="0 0 438.536 438.536"
201
- fill="#4267B2"
202
- >
203
- <g>
204
- <path
205
- d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
206
- C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
207
- h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
208
- C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
209
- c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
210
- c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
211
- />
212
- </g>
213
- </svg>
214
- ),
215
- },
216
- {
217
- label: "Pinterest",
218
- value: "pinterest",
219
- icon: "https://cdn-icons-png.flaticon.com/512/145/145808.png",
220
- },
221
- ],
222
- },
223
- {
224
- label: "Design",
225
- options: [
226
- {
227
- label: "Figma",
228
- value: "figma",
229
- icon: "https://logowik.com/content/uploads/images/figma.jpg",
230
- },
231
- {
232
- label: "Adobe XD",
233
- value: "adobexd",
234
- icon: "https://cdn.worldvectorlogo.com/logos/adobe-xd-2.svg",
235
- },
236
- {
237
- label: "Sketch",
238
- value: "sketch",
239
- icon: "https://cdn.worldvectorlogo.com/logos/sketch-2.svg",
240
- },
241
- ],
242
- },
243
- ];
244
- const optionsWithEllipsisMedium = [
245
- { label: "Optiond1234567890123456789012345678901234", value: "1" },
246
- { label: "Optiond12345678901234567890123456789012345", value: "2" },
247
- { label: "Option 031111111111111111111111111111222", value: "3" },
248
- { label: "Option 03111111111111111111111111111222", value: "4" },
249
- ];
250
-
251
- const Select = () => (
252
- <>
253
- <Title title="States" theme="light" level={2} />
254
- <ExampleContainer pseudoState="pseudo-hover">
255
- <Title title="Hovered" theme="light" level={4} />
256
- <DxcSelect label="Hovered" options={single_options} />
257
- </ExampleContainer>
258
- <ExampleContainer pseudoState="pseudo-focus-within">
259
- <Title title="Focused" theme="light" level={4} />
260
- <DxcSelect label="Focused" options={single_options} />
261
- </ExampleContainer>
262
- <ExampleContainer>
263
- <Title title="Disabled" theme="light" level={4} />
264
- <DxcSelect label="Disabled" placeholder="Placeholder" disabled options={single_options} />
265
- </ExampleContainer>
266
- <ExampleContainer>
267
- <Title title="Disabled with value" theme="light" level={4} />
268
- <DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
269
- </ExampleContainer>
270
- <ExampleContainer>
271
- <Title title="Error" theme="light" level={4} />
272
- <DxcSelect
273
- label="Label"
274
- options={single_options}
275
- error="Error message."
276
- helperText="Helper text"
277
- placeholder="Placeholder"
278
- />
279
- </ExampleContainer>
280
- <ExampleContainer pseudoState="pseudo-hover">
281
- <Title title="Hovered error" theme="light" level={4} />
282
- <DxcSelect
283
- label="Label"
284
- options={single_options}
285
- error="Error message."
286
- helperText="Helper text"
287
- placeholder="Placeholder"
288
- />
289
- </ExampleContainer>
290
- <Title title="Anatomy" theme="light" level={2} />
291
- <ExampleContainer>
292
- <Title title="Label, placeholder and helper text" theme="light" level={4} />
293
- <DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
294
- </ExampleContainer>
295
- <Title title="Variants" theme="light" level={2} />
296
- <ExampleContainer>
297
- <Title title="Simple selection" theme="light" level={4} />
298
- <DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
299
- </ExampleContainer>
300
- <ExampleContainer>
301
- <Title title="Multiple selection" theme="light" level={4} />
302
- <DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
303
- </ExampleContainer>
304
- <ExampleContainer pseudoState="pseudo-hover">
305
- <Title title="Multiple clear hovered" theme="light" level={4} />
306
- <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
307
- </ExampleContainer>
308
- <ExampleContainer pseudoState="pseudo-active">
309
- <Title title="Multiple clear actived" theme="light" level={4} />
310
- <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
311
- </ExampleContainer>
312
- <Title title="Sizes" theme="light" level={2} />
313
- <ExampleContainer>
314
- <Title title="Small size" theme="light" level={4} />
315
- <DxcSelect label="Small" options={single_options} size="small" />
316
- </ExampleContainer>
317
- <ExampleContainer>
318
- <Title title="Medium size" theme="light" level={4} />
319
- <DxcSelect label="Medium" options={single_options} size="medium" />
320
- </ExampleContainer>
321
- <ExampleContainer>
322
- <Title title="Large size" theme="light" level={4} />
323
- <DxcSelect label="Large" options={single_options} size="large" />
324
- </ExampleContainer>
325
- <ExampleContainer>
326
- <Title title="Fillparent size" theme="light" level={4} />
327
- <DxcSelect label="Fillparent" options={single_options} size="fillParent" />
328
- </ExampleContainer>
329
- <Title title="Margins" theme="light" level={2} />
330
- <ExampleContainer>
331
- <Title title="xxsmall margin" theme="light" level={4} />
332
- <DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
333
- </ExampleContainer>
334
- <ExampleContainer>
335
- <Title title="xsmall margin" theme="light" level={4} />
336
- <DxcSelect label="xSmall" options={single_options} margin="xsmall" />
337
- </ExampleContainer>
338
- <ExampleContainer>
339
- <Title title="small margin" theme="light" level={4} />
340
- <DxcSelect label="Small" options={single_options} margin="small" />
341
- </ExampleContainer>
342
- <ExampleContainer>
343
- <Title title="medium margin" theme="light" level={4} />
344
- <DxcSelect label="Medium" options={single_options} margin="medium" />
345
- </ExampleContainer>
346
- <ExampleContainer>
347
- <Title title="large margin" theme="light" level={4} />
348
- <DxcSelect label="Large" options={single_options} margin="large" />
349
- </ExampleContainer>
350
- <ExampleContainer>
351
- <Title title="xlarge margin" theme="light" level={4} />
352
- <DxcSelect label="xLarge" options={single_options} margin="xlarge" />
353
- </ExampleContainer>
354
- <ExampleContainer>
355
- <Title title="xxlarge margin" theme="light" level={4} />
356
- <DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
357
- </ExampleContainer>
358
- <ExampleContainer expanded>
359
- <Title title="Ellipsis" theme="light" level={2} />
360
- <Title title="Multiple selection with ellipsis" theme="light" level={4} />
361
- <DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
362
- <Title title="Value with ellipsis" theme="light" level={4} />
363
- <DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
364
- <Title title="Options with ellipsis" theme="light" level={4} />
365
- <DxcSelect
366
- label="Label"
367
- placeholder="Choose an option"
368
- defaultValue="1"
369
- options={optionsWithEllipsisMedium}
370
- size="medium"
371
- />
372
- </ExampleContainer>
373
- </>
374
- );
375
- const SelectListbox = () => {
376
- const colorsTheme: any = useTheme();
377
-
378
- return (
379
- <ThemeProvider theme={colorsTheme.select}>
380
- <Title title="Listbox" theme="light" level={2} />
381
- <ExampleContainer>
382
- <Title
383
- title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
384
- theme="light"
385
- level={3}
386
- />
387
- <div
388
- style={{
389
- position: "relative",
390
- display: "flex",
391
- flexDirection: "column",
392
- gap: "20px",
393
- height: "150px",
394
- width: "min-content",
395
- marginBottom: "100px",
396
- padding: "20px",
397
- border: "1px solid black",
398
- borderRadius: "4px",
399
- overflow: "auto",
400
- zIndex: "1300",
401
- }}
402
- >
403
- <DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
404
- <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
405
- </div>
406
- </ExampleContainer>
407
- <Title title="Listbox option states" theme="light" level={3} />
408
- <ExampleContainer pseudoState="pseudo-hover">
409
- <Title title="Hovered option" theme="light" level={4} />
410
- <Listbox
411
- id="x"
412
- currentValue=""
413
- options={one_option}
414
- visualFocusIndex={-1}
415
- lastOptionIndex={0}
416
- multiple={false}
417
- optional={false}
418
- optionalItem={{ label: "Empty", value: "" }}
419
- searchable={false}
420
- handleOptionOnClick={() => {}}
421
- styles={{ width: 360 }}
422
- />
423
- </ExampleContainer>
424
- <ExampleContainer pseudoState="pseudo-active">
425
- <Title title="Active option" theme="light" level={4} />
426
- <Listbox
427
- id="x"
428
- currentValue=""
429
- options={one_option}
430
- visualFocusIndex={-1}
431
- lastOptionIndex={0}
432
- multiple={false}
433
- optional={false}
434
- optionalItem={{ label: "Empty", value: "" }}
435
- searchable={false}
436
- handleOptionOnClick={() => {}}
437
- styles={{ width: 360 }}
438
- />
439
- </ExampleContainer>
440
- <ExampleContainer>
441
- <Title title="Focused option" theme="light" level={4} />
442
- <Listbox
443
- id="x"
444
- currentValue=""
445
- options={one_option}
446
- visualFocusIndex={0}
447
- lastOptionIndex={0}
448
- multiple={false}
449
- optional={false}
450
- optionalItem={{ label: "Empty", value: "" }}
451
- searchable={false}
452
- handleOptionOnClick={() => {}}
453
- styles={{ width: 360 }}
454
- />
455
- </ExampleContainer>
456
- <ExampleContainer pseudoState="pseudo-hover">
457
- <Title title="Hovered selected option" theme="light" level={4} />
458
- <Listbox
459
- id="x"
460
- currentValue="1"
461
- options={single_options}
462
- visualFocusIndex={-1}
463
- lastOptionIndex={3}
464
- multiple={false}
465
- optional={false}
466
- optionalItem={{ label: "Empty", value: "" }}
467
- searchable={false}
468
- handleOptionOnClick={() => {}}
469
- styles={{ width: 360 }}
470
- />
471
- </ExampleContainer>
472
- <ExampleContainer pseudoState="pseudo-active">
473
- <Title title="Active selected option" theme="light" level={4} />
474
- <Listbox
475
- id="x"
476
- currentValue="2"
477
- options={single_options}
478
- visualFocusIndex={0}
479
- lastOptionIndex={3}
480
- multiple={false}
481
- optional={false}
482
- optionalItem={{ label: "Empty", value: "" }}
483
- searchable={false}
484
- handleOptionOnClick={() => {}}
485
- styles={{ width: 360 }}
486
- />
487
- </ExampleContainer>
488
- <Title title="Listbox with icons" theme="light" level={3} />
489
- <ExampleContainer>
490
- <Title title="Icons (SVGs)" theme="light" level={4} />
491
- <Listbox
492
- id="x"
493
- currentValue="3"
494
- options={icon_options}
495
- visualFocusIndex={-1}
496
- lastOptionIndex={3}
497
- multiple={false}
498
- optional={false}
499
- optionalItem={{ label: "Empty", value: "" }}
500
- searchable={false}
501
- handleOptionOnClick={() => {}}
502
- styles={{ width: 360 }}
503
- />
504
- </ExampleContainer>
505
- <ExampleContainer>
506
- <Title title="Icons (Images)" theme="light" level={4} />
507
- <Listbox
508
- id="x"
509
- currentValue="facebook"
510
- options={url_options}
511
- visualFocusIndex={-1}
512
- lastOptionIndex={6}
513
- multiple={false}
514
- optional={false}
515
- optionalItem={{ label: "Empty", value: "" }}
516
- searchable={false}
517
- handleOptionOnClick={() => {}}
518
- styles={{ width: 360 }}
519
- />
520
- </ExampleContainer>
521
- <ExampleContainer>
522
- <Title title="Grouped icons (SVGs)" theme="light" level={4} />
523
- <Listbox
524
- id="x"
525
- currentValue={["0", "3"]}
526
- options={icon_options_grouped}
527
- visualFocusIndex={-1}
528
- lastOptionIndex={3}
529
- multiple={false}
530
- optional={false}
531
- optionalItem={{ label: "Empty", value: "" }}
532
- searchable={false}
533
- handleOptionOnClick={() => {}}
534
- styles={{ width: 360 }}
535
- />
536
- </ExampleContainer>
537
- <ExampleContainer>
538
- <Title title="Grouped icons (Images)" theme="light" level={4} />
539
- <Listbox
540
- id="x"
541
- currentValue={["facebook", "figma"]}
542
- options={url_options}
543
- visualFocusIndex={-1}
544
- lastOptionIndex={6}
545
- multiple={true}
546
- optional={false}
547
- optionalItem={{ label: "Empty", value: "" }}
548
- searchable={false}
549
- handleOptionOnClick={() => {}}
550
- styles={{ width: 360 }}
551
- />
552
- </ExampleContainer>
553
- </ThemeProvider>
554
- );
555
- };
556
-
557
- const SearchableSelect = () => (
558
- <ExampleContainer expanded>
559
- <Title title="Searchable select" theme="light" level={4} />
560
- <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
561
- </ExampleContainer>
562
- );
563
- const SearchValue = () => (
564
- <ExampleContainer expanded>
565
- <Title title="Searchable select with value" theme="light" level={4} />
566
- <DxcSelect
567
- label="Select Label"
568
- searchable
569
- defaultValue="1"
570
- options={single_options}
571
- placeholder="Choose an option"
572
- />
573
- </ExampleContainer>
574
- );
575
- const MultipleSelect = () => (
576
- <>
577
- <ExampleContainer expanded>
578
- <Title title="Multiple select" theme="light" level={4} />
579
- <DxcSelect
580
- label="Select label"
581
- options={single_options}
582
- defaultValue={["1", "4"]}
583
- multiple
584
- placeholder="Choose an option"
585
- />
586
- </ExampleContainer>
587
- </>
588
- );
589
- const DefaultGroupedOptionsSelect = () => (
590
- <ExampleContainer expanded>
591
- <Title title="Grouped options simple select" theme="light" level={4} />
592
- <DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
593
- </ExampleContainer>
594
- );
595
- const MultipleGroupedOptionsSelect = () => (
596
- <ExampleContainer expanded>
597
- <Title title="Grouped options multiple select" theme="light" level={4} />
598
- <DxcSelect
599
- label="Label"
600
- options={group_options}
601
- defaultValue={["0", "2"]}
602
- multiple
603
- placeholder="Choose an option"
604
- />
605
- </ExampleContainer>
606
- );
607
- const MultipleSearchable = () => (
608
- <ExampleContainer expanded>
609
- <Title title="Searchable multiple select with value" theme="light" level={4} />
610
- <DxcSelect
611
- label="Select Label"
612
- searchable
613
- multiple
614
- defaultValue={["1", "4"]}
615
- options={single_options}
616
- placeholder="Choose an option"
617
- />
618
- </ExampleContainer>
619
- );
620
-
621
- export const Chromatic = Select.bind({});
622
- Chromatic.play = async ({ canvasElement }) => {
623
- const canvas = within(canvasElement);
624
- await userEvent.click(canvas.getAllByRole("combobox")[24]);
625
- };
626
-
627
- export const ListboxStates = SelectListbox.bind({});
628
- ListboxStates.play = async ({ canvasElement }) => {
629
- const canvas = within(canvasElement);
630
- const select = canvas.getByRole("combobox");
631
- await userEvent.click(select);
632
- };
633
-
634
- export const Searchable = SearchableSelect.bind({});
635
- Searchable.play = async ({ canvasElement }) => {
636
- const canvas = within(canvasElement);
637
- await userEvent.type(canvas.getByRole("combobox"), "r");
638
- };
639
-
640
- export const SearchableWithValue = SearchValue.bind({});
641
- SearchableWithValue.play = async ({ canvasElement }) => {
642
- const canvas = within(canvasElement);
643
- await userEvent.click(canvas.getByRole("combobox"));
644
- };
645
-
646
- export const MultipleSearchableWithValue = MultipleSearchable.bind({});
647
- MultipleSearchableWithValue.play = async ({ canvasElement }) => {
648
- const canvas = within(canvasElement);
649
- await userEvent.click(canvas.getAllByRole("combobox")[0]);
650
- };
651
-
652
- export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
653
- GroupOptionsDisplayed.play = async ({ canvasElement }) => {
654
- const canvas = within(canvasElement);
655
- const select = canvas.getByRole("combobox");
656
- await userEvent.click(select);
657
- };
658
-
659
- export const MultipleOptionsDisplayed = MultipleSelect.bind({});
660
- MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
661
- const canvas = within(canvasElement);
662
- await userEvent.click(canvas.getAllByRole("combobox")[0]);
663
- };
664
-
665
- export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
666
- MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
667
- const canvas = within(canvasElement);
668
- const select = canvas.getByRole("combobox");
669
- await userEvent.click(select);
670
- };