@dxc-technology/halstack-react 0.0.0-c67081d → 0.0.0-c6888e7

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 (349) hide show
  1. package/README.md +3 -4
  2. package/dist/index.d.mts +4364 -0
  3. package/dist/index.d.ts +4364 -0
  4. package/dist/index.js +19603 -0
  5. package/dist/index.mjs +19512 -0
  6. package/package.json +89 -68
  7. package/BackgroundColorContext.d.ts +0 -10
  8. package/BackgroundColorContext.js +0 -47
  9. package/HalstackContext.d.ts +0 -1356
  10. package/HalstackContext.js +0 -335
  11. package/accordion/Accordion.d.ts +0 -4
  12. package/accordion/Accordion.js +0 -222
  13. package/accordion/Accordion.stories.tsx +0 -297
  14. package/accordion/Accordion.test.js +0 -71
  15. package/accordion/types.d.ts +0 -57
  16. package/accordion/types.js +0 -5
  17. package/accordion-group/AccordionGroup.d.ts +0 -8
  18. package/accordion-group/AccordionGroup.js +0 -128
  19. package/accordion-group/AccordionGroup.stories.tsx +0 -252
  20. package/accordion-group/AccordionGroup.test.js +0 -116
  21. package/accordion-group/AccordionGroupAccordion.d.ts +0 -4
  22. package/accordion-group/AccordionGroupAccordion.js +0 -43
  23. package/accordion-group/types.d.ts +0 -67
  24. package/accordion-group/types.js +0 -5
  25. package/alert/Alert.d.ts +0 -4
  26. package/alert/Alert.js +0 -289
  27. package/alert/Alert.stories.tsx +0 -198
  28. package/alert/Alert.test.js +0 -92
  29. package/alert/types.d.ts +0 -49
  30. package/alert/types.js +0 -5
  31. package/badge/Badge.d.ts +0 -4
  32. package/badge/Badge.js +0 -61
  33. package/badge/types.d.ts +0 -5
  34. package/badge/types.js +0 -5
  35. package/bleed/Bleed.d.ts +0 -3
  36. package/bleed/Bleed.js +0 -51
  37. package/bleed/Bleed.stories.tsx +0 -342
  38. package/bleed/types.d.ts +0 -37
  39. package/bleed/types.js +0 -5
  40. package/box/Box.d.ts +0 -4
  41. package/box/Box.js +0 -97
  42. package/box/Box.stories.tsx +0 -119
  43. package/box/Box.test.js +0 -18
  44. package/box/types.d.ts +0 -32
  45. package/box/types.js +0 -5
  46. package/bulleted-list/BulletedList.d.ts +0 -7
  47. package/bulleted-list/BulletedList.js +0 -125
  48. package/bulleted-list/BulletedList.stories.tsx +0 -206
  49. package/bulleted-list/types.d.ts +0 -38
  50. package/bulleted-list/types.js +0 -5
  51. package/button/Button.d.ts +0 -4
  52. package/button/Button.js +0 -144
  53. package/button/Button.stories.tsx +0 -425
  54. package/button/Button.test.js +0 -46
  55. package/button/types.d.ts +0 -57
  56. package/button/types.js +0 -5
  57. package/card/Card.d.ts +0 -4
  58. package/card/Card.js +0 -143
  59. package/card/Card.stories.tsx +0 -171
  60. package/card/Card.test.js +0 -50
  61. package/card/types.d.ts +0 -62
  62. package/card/types.js +0 -5
  63. package/checkbox/Checkbox.d.ts +0 -4
  64. package/checkbox/Checkbox.js +0 -269
  65. package/checkbox/Checkbox.stories.tsx +0 -276
  66. package/checkbox/Checkbox.test.js +0 -228
  67. package/checkbox/types.d.ts +0 -72
  68. package/checkbox/types.js +0 -5
  69. package/chip/Chip.d.ts +0 -4
  70. package/chip/Chip.js +0 -140
  71. package/chip/Chip.stories.tsx +0 -214
  72. package/chip/Chip.test.js +0 -54
  73. package/chip/types.d.ts +0 -45
  74. package/chip/types.js +0 -5
  75. package/common/OpenSans.css +0 -69
  76. package/common/coreTokens.d.ts +0 -146
  77. package/common/coreTokens.js +0 -167
  78. package/common/fonts/OpenSans-Bold.ttf +0 -0
  79. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  80. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  81. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  82. package/common/fonts/OpenSans-Italic.ttf +0 -0
  83. package/common/fonts/OpenSans-Light.ttf +0 -0
  84. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  85. package/common/fonts/OpenSans-Regular.ttf +0 -0
  86. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  87. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  88. package/common/utils.d.ts +0 -1
  89. package/common/utils.js +0 -22
  90. package/common/variables.d.ts +0 -1499
  91. package/common/variables.js +0 -1378
  92. package/date-input/Calendar.d.ts +0 -4
  93. package/date-input/Calendar.js +0 -258
  94. package/date-input/DateInput.d.ts +0 -4
  95. package/date-input/DateInput.js +0 -271
  96. package/date-input/DateInput.stories.tsx +0 -314
  97. package/date-input/DateInput.test.js +0 -849
  98. package/date-input/DatePicker.d.ts +0 -4
  99. package/date-input/DatePicker.js +0 -146
  100. package/date-input/Icons.d.ts +0 -6
  101. package/date-input/Icons.js +0 -75
  102. package/date-input/YearPicker.d.ts +0 -4
  103. package/date-input/YearPicker.js +0 -126
  104. package/date-input/types.d.ts +0 -164
  105. package/date-input/types.js +0 -5
  106. package/dialog/Dialog.d.ts +0 -4
  107. package/dialog/Dialog.js +0 -131
  108. package/dialog/Dialog.stories.tsx +0 -195
  109. package/dialog/Dialog.test.js +0 -369
  110. package/dialog/types.d.ts +0 -31
  111. package/dialog/types.js +0 -5
  112. package/dropdown/Dropdown.d.ts +0 -4
  113. package/dropdown/Dropdown.js +0 -388
  114. package/dropdown/Dropdown.stories.tsx +0 -438
  115. package/dropdown/Dropdown.test.js +0 -586
  116. package/dropdown/DropdownMenu.d.ts +0 -4
  117. package/dropdown/DropdownMenu.js +0 -74
  118. package/dropdown/DropdownMenuItem.d.ts +0 -4
  119. package/dropdown/DropdownMenuItem.js +0 -79
  120. package/dropdown/types.d.ts +0 -100
  121. package/dropdown/types.js +0 -5
  122. package/file-input/FileInput.d.ts +0 -4
  123. package/file-input/FileInput.js +0 -547
  124. package/file-input/FileInput.stories.tsx +0 -618
  125. package/file-input/FileInput.test.js +0 -457
  126. package/file-input/FileItem.d.ts +0 -4
  127. package/file-input/FileItem.js +0 -162
  128. package/file-input/types.d.ts +0 -129
  129. package/file-input/types.js +0 -5
  130. package/flex/Flex.d.ts +0 -4
  131. package/flex/Flex.js +0 -71
  132. package/flex/Flex.stories.tsx +0 -112
  133. package/flex/types.d.ts +0 -97
  134. package/flex/types.js +0 -5
  135. package/footer/Footer.d.ts +0 -4
  136. package/footer/Footer.js +0 -165
  137. package/footer/Footer.stories.tsx +0 -152
  138. package/footer/Footer.test.js +0 -99
  139. package/footer/Icons.d.ts +0 -2
  140. package/footer/Icons.js +0 -77
  141. package/footer/types.d.ts +0 -64
  142. package/footer/types.js +0 -5
  143. package/grid/Grid.d.ts +0 -7
  144. package/grid/Grid.js +0 -91
  145. package/grid/Grid.stories.tsx +0 -219
  146. package/grid/types.d.ts +0 -115
  147. package/grid/types.js +0 -5
  148. package/header/Header.d.ts +0 -8
  149. package/header/Header.js +0 -276
  150. package/header/Header.stories.tsx +0 -251
  151. package/header/Header.test.js +0 -79
  152. package/header/Icons.d.ts +0 -2
  153. package/header/Icons.js +0 -34
  154. package/header/types.d.ts +0 -34
  155. package/header/types.js +0 -5
  156. package/heading/Heading.d.ts +0 -4
  157. package/heading/Heading.js +0 -159
  158. package/heading/Heading.stories.tsx +0 -54
  159. package/heading/Heading.test.js +0 -186
  160. package/heading/types.d.ts +0 -33
  161. package/heading/types.js +0 -5
  162. package/image/Image.d.ts +0 -4
  163. package/image/Image.js +0 -85
  164. package/image/Image.stories.tsx +0 -127
  165. package/image/types.d.ts +0 -72
  166. package/image/types.js +0 -5
  167. package/inset/Inset.d.ts +0 -3
  168. package/inset/Inset.js +0 -51
  169. package/inset/Inset.stories.tsx +0 -230
  170. package/inset/types.d.ts +0 -37
  171. package/inset/types.js +0 -5
  172. package/layout/ApplicationLayout.d.ts +0 -20
  173. package/layout/ApplicationLayout.js +0 -174
  174. package/layout/ApplicationLayout.stories.tsx +0 -162
  175. package/layout/Icons.d.ts +0 -8
  176. package/layout/Icons.js +0 -62
  177. package/layout/SidenavContext.d.ts +0 -5
  178. package/layout/SidenavContext.js +0 -19
  179. package/layout/types.d.ts +0 -41
  180. package/layout/types.js +0 -5
  181. package/link/Link.d.ts +0 -4
  182. package/link/Link.js +0 -136
  183. package/link/Link.stories.tsx +0 -253
  184. package/link/Link.test.js +0 -81
  185. package/link/types.d.ts +0 -54
  186. package/link/types.js +0 -5
  187. package/main.d.ts +0 -46
  188. package/main.js +0 -385
  189. package/nav-tabs/NavTabs.d.ts +0 -8
  190. package/nav-tabs/NavTabs.js +0 -122
  191. package/nav-tabs/NavTabs.stories.tsx +0 -274
  192. package/nav-tabs/NavTabs.test.js +0 -82
  193. package/nav-tabs/Tab.d.ts +0 -4
  194. package/nav-tabs/Tab.js +0 -146
  195. package/nav-tabs/types.d.ts +0 -52
  196. package/nav-tabs/types.js +0 -5
  197. package/number-input/NumberInput.d.ts +0 -11
  198. package/number-input/NumberInput.js +0 -80
  199. package/number-input/NumberInput.stories.tsx +0 -160
  200. package/number-input/NumberInput.test.js +0 -768
  201. package/number-input/types.d.ts +0 -130
  202. package/number-input/types.js +0 -5
  203. package/paginator/Icons.d.ts +0 -5
  204. package/paginator/Icons.js +0 -54
  205. package/paginator/Paginator.d.ts +0 -4
  206. package/paginator/Paginator.js +0 -163
  207. package/paginator/Paginator.stories.tsx +0 -87
  208. package/paginator/Paginator.test.js +0 -318
  209. package/paginator/types.d.ts +0 -38
  210. package/paginator/types.js +0 -5
  211. package/paragraph/Paragraph.d.ts +0 -5
  212. package/paragraph/Paragraph.js +0 -38
  213. package/paragraph/Paragraph.stories.tsx +0 -44
  214. package/password-input/Icons.d.ts +0 -6
  215. package/password-input/Icons.js +0 -39
  216. package/password-input/PasswordInput.d.ts +0 -4
  217. package/password-input/PasswordInput.js +0 -119
  218. package/password-input/PasswordInput.stories.tsx +0 -132
  219. package/password-input/PasswordInput.test.js +0 -174
  220. package/password-input/types.d.ts +0 -110
  221. package/password-input/types.js +0 -5
  222. package/progress-bar/ProgressBar.d.ts +0 -4
  223. package/progress-bar/ProgressBar.js +0 -176
  224. package/progress-bar/ProgressBar.stories.jsx +0 -93
  225. package/progress-bar/ProgressBar.test.js +0 -110
  226. package/progress-bar/types.d.ts +0 -37
  227. package/progress-bar/types.js +0 -5
  228. package/quick-nav/QuickNav.d.ts +0 -4
  229. package/quick-nav/QuickNav.js +0 -117
  230. package/quick-nav/QuickNav.stories.tsx +0 -356
  231. package/quick-nav/types.d.ts +0 -21
  232. package/quick-nav/types.js +0 -5
  233. package/radio-group/Radio.d.ts +0 -4
  234. package/radio-group/Radio.js +0 -156
  235. package/radio-group/RadioGroup.d.ts +0 -4
  236. package/radio-group/RadioGroup.js +0 -281
  237. package/radio-group/RadioGroup.stories.tsx +0 -214
  238. package/radio-group/RadioGroup.test.js +0 -749
  239. package/radio-group/types.d.ts +0 -114
  240. package/radio-group/types.js +0 -5
  241. package/resultsetTable/Icons.d.ts +0 -7
  242. package/resultsetTable/Icons.js +0 -51
  243. package/resultsetTable/ResultsetTable.d.ts +0 -4
  244. package/resultsetTable/ResultsetTable.js +0 -195
  245. package/resultsetTable/ResultsetTable.stories.tsx +0 -300
  246. package/resultsetTable/ResultsetTable.test.js +0 -325
  247. package/resultsetTable/types.d.ts +0 -67
  248. package/resultsetTable/types.js +0 -5
  249. package/select/Icons.d.ts +0 -10
  250. package/select/Icons.js +0 -93
  251. package/select/Listbox.d.ts +0 -4
  252. package/select/Listbox.js +0 -169
  253. package/select/Option.d.ts +0 -4
  254. package/select/Option.js +0 -97
  255. package/select/Select.d.ts +0 -4
  256. package/select/Select.js +0 -666
  257. package/select/Select.stories.tsx +0 -971
  258. package/select/Select.test.js +0 -2228
  259. package/select/types.d.ts +0 -210
  260. package/select/types.js +0 -5
  261. package/sidenav/Icons.d.ts +0 -7
  262. package/sidenav/Icons.js +0 -51
  263. package/sidenav/Sidenav.d.ts +0 -10
  264. package/sidenav/Sidenav.js +0 -238
  265. package/sidenav/Sidenav.stories.tsx +0 -282
  266. package/sidenav/Sidenav.test.js +0 -44
  267. package/sidenav/types.d.ts +0 -76
  268. package/sidenav/types.js +0 -5
  269. package/slider/Slider.d.ts +0 -4
  270. package/slider/Slider.js +0 -342
  271. package/slider/Slider.stories.tsx +0 -240
  272. package/slider/Slider.test.js +0 -250
  273. package/slider/types.d.ts +0 -86
  274. package/slider/types.js +0 -5
  275. package/spinner/Spinner.d.ts +0 -4
  276. package/spinner/Spinner.js +0 -244
  277. package/spinner/Spinner.stories.jsx +0 -129
  278. package/spinner/Spinner.test.js +0 -64
  279. package/spinner/types.d.ts +0 -32
  280. package/spinner/types.js +0 -5
  281. package/switch/Switch.d.ts +0 -4
  282. package/switch/Switch.js +0 -262
  283. package/switch/Switch.stories.tsx +0 -171
  284. package/switch/Switch.test.js +0 -225
  285. package/switch/types.d.ts +0 -66
  286. package/switch/types.js +0 -5
  287. package/table/Table.d.ts +0 -4
  288. package/table/Table.js +0 -118
  289. package/table/Table.stories.jsx +0 -356
  290. package/table/Table.test.js +0 -26
  291. package/table/types.d.ts +0 -21
  292. package/table/types.js +0 -5
  293. package/tabs/Tab.d.ts +0 -4
  294. package/tabs/Tab.js +0 -132
  295. package/tabs/Tabs.d.ts +0 -4
  296. package/tabs/Tabs.js +0 -461
  297. package/tabs/Tabs.stories.tsx +0 -226
  298. package/tabs/Tabs.test.js +0 -350
  299. package/tabs/types.d.ts +0 -92
  300. package/tabs/types.js +0 -5
  301. package/tag/Tag.d.ts +0 -4
  302. package/tag/Tag.js +0 -181
  303. package/tag/Tag.stories.tsx +0 -155
  304. package/tag/Tag.test.js +0 -60
  305. package/tag/types.d.ts +0 -69
  306. package/tag/types.js +0 -5
  307. package/text-input/Icons.d.ts +0 -8
  308. package/text-input/Icons.js +0 -60
  309. package/text-input/Suggestion.d.ts +0 -4
  310. package/text-input/Suggestion.js +0 -84
  311. package/text-input/Suggestions.d.ts +0 -4
  312. package/text-input/Suggestions.js +0 -134
  313. package/text-input/TextInput.d.ts +0 -4
  314. package/text-input/TextInput.js +0 -651
  315. package/text-input/TextInput.stories.tsx +0 -608
  316. package/text-input/TextInput.test.js +0 -1834
  317. package/text-input/types.d.ts +0 -203
  318. package/text-input/types.js +0 -5
  319. package/textarea/Textarea.d.ts +0 -4
  320. package/textarea/Textarea.js +0 -278
  321. package/textarea/Textarea.stories.jsx +0 -224
  322. package/textarea/Textarea.test.js +0 -479
  323. package/textarea/types.d.ts +0 -141
  324. package/textarea/types.js +0 -5
  325. package/toggle-group/ToggleGroup.d.ts +0 -4
  326. package/toggle-group/ToggleGroup.js +0 -241
  327. package/toggle-group/ToggleGroup.stories.tsx +0 -218
  328. package/toggle-group/ToggleGroup.test.js +0 -170
  329. package/toggle-group/types.d.ts +0 -114
  330. package/toggle-group/types.js +0 -5
  331. package/typography/Typography.d.ts +0 -4
  332. package/typography/Typography.js +0 -32
  333. package/typography/Typography.stories.tsx +0 -198
  334. package/typography/types.d.ts +0 -18
  335. package/typography/types.js +0 -5
  336. package/useTheme.d.ts +0 -1252
  337. package/useTheme.js +0 -22
  338. package/useTranslatedLabels.d.ts +0 -85
  339. package/useTranslatedLabels.js +0 -20
  340. package/utils/BaseTypography.d.ts +0 -21
  341. package/utils/BaseTypography.js +0 -108
  342. package/utils/FocusLock.d.ts +0 -13
  343. package/utils/FocusLock.js +0 -138
  344. package/wizard/Wizard.d.ts +0 -4
  345. package/wizard/Wizard.js +0 -285
  346. package/wizard/Wizard.stories.tsx +0 -253
  347. package/wizard/Wizard.test.js +0 -141
  348. package/wizard/types.d.ts +0 -64
  349. package/wizard/types.js +0 -5
@@ -1,228 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _react = _interopRequireDefault(require("react"));
6
-
7
- var _react2 = require("@testing-library/react");
8
-
9
- var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
10
-
11
- var _Checkbox = _interopRequireDefault(require("./Checkbox.tsx"));
12
-
13
- describe("Checkbox component tests", function () {
14
- test("Checkbox renders with correct aria-labelledby and aria-required", function () {
15
- var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
16
- label: "Checkbox"
17
- })),
18
- getByText = _render.getByText,
19
- getByRole = _render.getByRole;
20
-
21
- var labelId = getByText("Checkbox").getAttribute("id");
22
- expect(getByRole("checkbox").getAttribute("aria-labelledby")).toBe(labelId);
23
- expect(getByRole("checkbox").getAttribute("aria-required")).toBe("true");
24
- expect(getByRole("checkbox").getAttribute("aria-readonly")).toBe("false");
25
- expect(getByRole("checkbox").getAttribute("aria-disabled")).toBe("false");
26
- });
27
- test("Optional checkbox renders with correct aria-required", function () {
28
- var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
29
- label: "Checkbox",
30
- optional: true
31
- })),
32
- getByRole = _render2.getByRole;
33
-
34
- expect(getByRole("checkbox").getAttribute("aria-required")).toBe("false");
35
- });
36
- test("Calls correct function onChange", function () {
37
- var onChange = jest.fn();
38
-
39
- var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
40
- label: "Checkbox",
41
- onChange: onChange
42
- })),
43
- getByText = _render3.getByText;
44
-
45
- _react2.fireEvent.click(getByText("Checkbox"));
46
-
47
- expect(onChange).toHaveBeenCalled();
48
- });
49
- test("Read-only checkbox does not trigger onChange function", function () {
50
- var onChange = jest.fn();
51
-
52
- var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
53
- label: "Checkbox",
54
- onChange: onChange,
55
- readOnly: true
56
- })),
57
- getByRole = _render4.getByRole;
58
-
59
- var checkbox = getByRole("checkbox");
60
- expect(checkbox.getAttribute("aria-readonly")).toBe("true");
61
-
62
- _react2.fireEvent.click(checkbox);
63
-
64
- expect(onChange).not.toHaveBeenCalled();
65
- });
66
- test("Read-only checkbox sends its value on submit", function () {
67
- var handlerOnSubmit = jest.fn(function (e) {
68
- e.preventDefault();
69
- var formData = new FormData(e.target);
70
- var formProps = Object.fromEntries(formData);
71
- expect(formProps).toStrictEqual({
72
- data: "checked"
73
- });
74
- });
75
-
76
- var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
77
- onSubmit: handlerOnSubmit
78
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
79
- label: "Checkbox",
80
- name: "data",
81
- value: "checked",
82
- readOnly: true,
83
- defaultChecked: true
84
- }), /*#__PURE__*/_react["default"].createElement("button", {
85
- type: "submit"
86
- }, "Submit"))),
87
- getByText = _render5.getByText;
88
-
89
- var submit = getByText("Submit");
90
-
91
- _userEvent["default"].click(submit);
92
-
93
- expect(handlerOnSubmit).toHaveBeenCalled();
94
- });
95
- test("Read-only checkbox doesn't change its value with Space key", function () {
96
- var onChange = jest.fn();
97
-
98
- var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
99
- label: "Checkbox",
100
- onChange: onChange,
101
- readOnly: true
102
- })),
103
- getByRole = _render6.getByRole;
104
-
105
- var checkbox = getByRole("checkbox");
106
-
107
- _userEvent["default"].tab();
108
-
109
- expect(document.activeElement === checkbox).toBeTruthy();
110
-
111
- _react2.fireEvent.keyDown(checkbox, {
112
- key: " ",
113
- code: "Space",
114
- keyCode: 32,
115
- charCode: 32
116
- });
117
-
118
- expect(onChange).not.toHaveBeenCalled();
119
- });
120
- test("Uncontrolled checkbox", function () {
121
- var onChange = jest.fn();
122
- var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
123
- label: "Checkbox",
124
- onChange: onChange,
125
- name: "test"
126
- }));
127
- var visibleCheckbox = component.getByText("Checkbox");
128
- var input = component.getByRole("checkbox");
129
- var submitInput = component.container.querySelector("input[name=\"test\"]");
130
- expect(input.getAttribute("aria-checked")).toBe("false");
131
- expect(submitInput.checked).toBe(false);
132
-
133
- _react2.fireEvent.click(visibleCheckbox);
134
-
135
- expect(onChange).toHaveBeenCalled();
136
- expect(onChange).toHaveBeenCalledWith(true);
137
- expect(input.getAttribute("aria-checked")).toBe("true");
138
- expect(submitInput.checked).toBe(true);
139
- });
140
- test("Controlled checkbox", function () {
141
- var onChange = jest.fn();
142
- var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
143
- label: "Checkbox",
144
- checked: false,
145
- onChange: onChange,
146
- name: "test"
147
- }));
148
- var input = component.getByRole("checkbox");
149
- var visibleCheckbox = component.getByText("Checkbox");
150
- var submitInput = component.container.querySelector("input[name=\"test\"]");
151
-
152
- _react2.fireEvent.click(visibleCheckbox);
153
-
154
- expect(onChange).toHaveBeenCalled();
155
- expect(onChange).toHaveBeenCalledWith(true);
156
- expect(input.getAttribute("aria-checked")).toBe("false");
157
- expect(submitInput.checked).toBe(false);
158
- });
159
- test("Renders with correct initial value and initial state when it is uncontrolled", function () {
160
- var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
161
- label: "Default label",
162
- defaultChecked: true,
163
- value: "test-defaultChecked",
164
- name: "test"
165
- })),
166
- getByRole = _render7.getByRole,
167
- container = _render7.container;
168
-
169
- var checkbox = getByRole("checkbox");
170
- var submitInput = container.querySelector("input[name=\"test\"]");
171
- expect(submitInput.value).toBe("test-defaultChecked");
172
- expect(checkbox.getAttribute("aria-checked")).toBe("true");
173
- expect(submitInput.checked).toBe(true);
174
- });
175
- test("Test disable keyboard and mouse interactions", function () {
176
- var onChange = jest.fn();
177
-
178
- var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
179
- label: "Checkbox",
180
- onChange: onChange,
181
- disabled: true,
182
- name: "test"
183
- })),
184
- getByRole = _render8.getByRole,
185
- getByText = _render8.getByText,
186
- container = _render8.container;
187
-
188
- var input = getByRole("checkbox");
189
- var visibleCheckbox = getByText("Checkbox");
190
- var submitInput = container.querySelector("input[name=\"test\"]");
191
-
192
- _react2.fireEvent.click(visibleCheckbox);
193
-
194
- expect(onChange).toHaveBeenCalledTimes(0);
195
- expect(input.getAttribute("aria-checked")).toBe("false");
196
- expect(input.getAttribute("aria-disabled")).toBe("true");
197
- expect(submitInput.checked).toBe(false);
198
-
199
- _userEvent["default"].tab();
200
-
201
- expect(document.activeElement === input).toBeFalsy();
202
- });
203
- test("Test keyboard interactions", function () {
204
- var onChange = jest.fn();
205
-
206
- var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
207
- label: "Checkbox",
208
- name: "test",
209
- onChange: onChange
210
- })),
211
- getByRole = _render9.getByRole;
212
-
213
- var checkbox = getByRole("checkbox");
214
-
215
- _userEvent["default"].tab();
216
-
217
- expect(document.activeElement === checkbox).toBeTruthy();
218
-
219
- _react2.fireEvent.keyDown(checkbox, {
220
- key: " ",
221
- code: "Space",
222
- keyCode: 32,
223
- charCode: 32
224
- });
225
-
226
- expect(onChange).toHaveBeenCalledWith(true);
227
- });
228
- });
@@ -1,72 +0,0 @@
1
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- declare type Margin = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
- declare type Props = {
9
- /**
10
- * Initial state of the checkbox, only when it is uncontrolled.
11
- */
12
- defaultChecked?: boolean;
13
- /**
14
- * If true, the component is checked. If undefined the component will be
15
- * uncontrolled and the value will be managed internally by the component.
16
- */
17
- checked?: boolean;
18
- /**
19
- * Will be passed to the value attribute of the html input element.
20
- * When inside a form, this value will be only submitted if the checkbox is checked.
21
- */
22
- value?: string;
23
- /**
24
- * Text to be placed next to the checkbox.
25
- */
26
- label?: string;
27
- /**
28
- * Whether the label should appear after or before the checkbox.
29
- */
30
- labelPosition?: "before" | "after";
31
- /**
32
- * Name attribute of the input element.
33
- */
34
- name?: string;
35
- /**
36
- * If true, the component will be disabled.
37
- */
38
- disabled?: boolean;
39
- /**
40
- * If true, the component will display '(Optional)' next to the label.
41
- */
42
- optional?: boolean;
43
- /**
44
- * If true, the component will not be mutable, meaning the user can not edit the control.
45
- */
46
- readOnly?: boolean;
47
- /**
48
- * This function will be called when the user clicks the checkbox.
49
- * The new value will be passed as a parameter.
50
- */
51
- onChange?: (value: boolean) => void;
52
- /**
53
- * Size of the margin to be applied to the component
54
- * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
55
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties
56
- * in order to specify different margin sizes.
57
- */
58
- margin?: Space | Margin;
59
- /**
60
- * Size of the component.
61
- */
62
- size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
63
- /**
64
- * Value of the tabindex.
65
- */
66
- tabIndex?: number;
67
- };
68
- /**
69
- * Reference to the component.
70
- */
71
- export declare type RefType = HTMLDivElement;
72
- export default Props;
package/checkbox/types.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
package/chip/Chip.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import ChipPropsType from "./types";
3
- declare const DxcChip: ({ label, suffixIcon, prefixIcon, onClickSuffix, onClickPrefix, disabled, margin, tabIndex, }: ChipPropsType) => JSX.Element;
4
- export default DxcChip;
package/chip/Chip.js DELETED
@@ -1,140 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _react = _interopRequireDefault(require("react"));
17
-
18
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
-
20
- var _variables = require("../common/variables");
21
-
22
- var _utils = require("../common/utils");
23
-
24
- var _useTheme = _interopRequireDefault(require("../useTheme"));
25
-
26
- var _templateObject, _templateObject2, _templateObject3;
27
-
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
-
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
-
32
- var DxcChip = function DxcChip(_ref) {
33
- var label = _ref.label,
34
- suffixIcon = _ref.suffixIcon,
35
- prefixIcon = _ref.prefixIcon,
36
- onClickSuffix = _ref.onClickSuffix,
37
- onClickPrefix = _ref.onClickPrefix,
38
- disabled = _ref.disabled,
39
- margin = _ref.margin,
40
- _ref$tabIndex = _ref.tabIndex,
41
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
42
- var colorsTheme = (0, _useTheme["default"])();
43
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
44
- theme: colorsTheme.chip
45
- }, /*#__PURE__*/_react["default"].createElement(Chip, {
46
- disabled: disabled,
47
- margin: margin
48
- }, prefixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
49
- role: typeof onClickPrefix === "function" ? "button" : undefined,
50
- disabled: disabled,
51
- interactuable: typeof onClickPrefix === "function" && !disabled,
52
- tabIndex: typeof onClickPrefix === "function" && !disabled ? tabIndex : -1,
53
- onClick: function onClick() {
54
- return onClickPrefix && !disabled && onClickPrefix();
55
- }
56
- }, typeof prefixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
57
- src: prefixIcon
58
- }) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
59
- disabled: disabled
60
- }, label), suffixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
61
- role: typeof onClickSuffix === "function" ? "button" : undefined,
62
- disabled: disabled,
63
- interactuable: typeof onClickSuffix === "function" && !disabled,
64
- tabIndex: typeof onClickSuffix === "function" && !disabled ? tabIndex : -1,
65
- onClick: function onClick() {
66
- return !disabled && (onClickSuffix === null || onClickSuffix === void 0 ? void 0 : onClickSuffix());
67
- }
68
- }, typeof suffixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
69
- src: suffixIcon
70
- }) : suffixIcon)));
71
- };
72
-
73
- var calculateWidth = function calculateWidth(margin) {
74
- return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
75
- };
76
-
77
- var Chip = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: ", ";\n min-height: 40px;\n max-width: ", ";\n background-color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n"])), function (props) {
78
- return props.theme.iconSpacing;
79
- }, function (props) {
80
- return calculateWidth(props.margin);
81
- }, function (props) {
82
- return props.disabled && props.theme.disabledBackgroundColor || props.theme.backgroundColor;
83
- }, function (props) {
84
- return props.theme.borderRadius;
85
- }, function (props) {
86
- return props.theme.borderThickness;
87
- }, function (props) {
88
- return props.theme.borderStyle;
89
- }, function (props) {
90
- return props.theme.borderColor;
91
- }, function (props) {
92
- return props.theme.contentPaddingTop;
93
- }, function (props) {
94
- return props.theme.contentPaddingBottom;
95
- }, function (props) {
96
- return props.theme.contentPaddingLeft;
97
- }, function (props) {
98
- return props.theme.contentPaddingRight;
99
- }, function (props) {
100
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
101
- }, function (props) {
102
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
103
- }, function (props) {
104
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
105
- }, function (props) {
106
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
107
- }, function (props) {
108
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
109
- }, function (_ref2) {
110
- var disabled = _ref2.disabled;
111
- return disabled && "not-allowed";
112
- });
113
-
114
- var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-style: ", ";\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])), function (props) {
115
- return props.theme.fontSize;
116
- }, function (props) {
117
- return props.theme.fontFamily;
118
- }, function (props) {
119
- return props.theme.fontWeight;
120
- }, function (props) {
121
- return props.theme.fontStyle;
122
- }, function (props) {
123
- return props.disabled ? props.theme.disabledFontColor : props.theme.fontColor;
124
- });
125
-
126
- var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border-radius: 0.25rem;\n color: ", ";\n ", "\n\n ", "\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
127
- return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
128
- }, function (_ref3) {
129
- var interactuable = _ref3.interactuable;
130
- return interactuable && "cursor: pointer;";
131
- }, function (props) {
132
- return props.interactuable && "\n &:hover {\n color: ".concat(props.theme.hoverIconColor, ";\n }\n &:focus,\n &:focus-visible {\n outline: ").concat(props.theme.focusBorderThickness, " solid ").concat(props.theme.focusColor, ";\n }\n &:active {\n color: ").concat(props.theme.activeIconColor, ";\n }\n ");
133
- }, function (props) {
134
- return props.theme.iconSize;
135
- }, function (props) {
136
- return props.theme.iconSize;
137
- });
138
-
139
- var _default = DxcChip;
140
- exports["default"] = _default;
@@ -1,214 +0,0 @@
1
- import React from "react";
2
- import { userEvent, within } from "@storybook/testing-library";
3
- import DxcChip from "./Chip";
4
- import Title from "../../.storybook/components/Title";
5
- import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
- import { HalstackProvider } from "../HalstackContext";
7
-
8
- export default {
9
- title: "Chip",
10
- component: DxcChip,
11
- };
12
-
13
- const iconSVG = (
14
- <svg
15
- version="1.1"
16
- id="Capa_1"
17
- x="0px"
18
- y="0px"
19
- width="438.536px"
20
- height="438.536px"
21
- viewBox="0 0 438.536 438.536"
22
- fill="currentColor"
23
- >
24
- <g>
25
- <path
26
- 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
27
- 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
28
- h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
29
- 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
30
- 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
31
- 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"
32
- />
33
- </g>
34
- </svg>
35
- );
36
-
37
- const smallIconSVG = (
38
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
39
- <path d="m10 17-1.042-.938q-2.083-1.854-3.437-3.177-1.354-1.323-2.136-2.354Q2.604 9.5 2.302 8.646 2 7.792 2 6.896q0-1.854 1.271-3.125T6.396 2.5q1.021 0 1.979.438.958.437 1.625 1.229.667-.792 1.625-1.229.958-.438 1.979-.438 1.854 0 3.125 1.271T18 6.896q0 .896-.292 1.729-.291.833-1.073 1.854-.781 1.021-2.145 2.365-1.365 1.344-3.49 3.26Zm0-2.021q1.938-1.729 3.188-2.948 1.25-1.219 1.989-2.125.74-.906 1.031-1.614.292-.709.292-1.396 0-1.229-.833-2.063Q14.833 4 13.604 4q-.729 0-1.364.302-.636.302-1.094.844L10.417 6h-.834l-.729-.854q-.458-.542-1.114-.844Q7.083 4 6.396 4q-1.229 0-2.063.833-.833.834-.833 2.063 0 .687.271 1.364.271.678.989 1.573.719.896 1.98 2.125Q8 13.188 10 14.979Zm0-5.5Z" />
40
- </svg>
41
- );
42
-
43
- const opinionatedTheme = {
44
- chip: {
45
- baseColor: "#e6e6e6",
46
- fontColor: "#000000",
47
- iconColor: "#4d4d4d",
48
- },
49
- };
50
-
51
- export const Chromatic = () => (
52
- <>
53
- <ExampleContainer>
54
- <Title title="Basic chip" theme="light" level={4} />
55
- <DxcChip label="Default Chip" />
56
- </ExampleContainer>
57
- <ExampleContainer>
58
- <Title title="Chip with prefix SVG (small icon)" theme="light" level={4} />
59
- <DxcChip label="Chip with prefix" prefixIcon={smallIconSVG} />
60
- </ExampleContainer>
61
- <ExampleContainer>
62
- <Title title="Chip with suffix SVG (large icon)" theme="light" level={4} />
63
- <DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
64
- </ExampleContainer>
65
- <ExampleContainer>
66
- <Title title="Chip with prefix (SVG) and suffix (URL)" theme="light" level={4} />
67
- <DxcChip
68
- label="Chip with prefix and suffix"
69
- prefixIcon={iconSVG}
70
- suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
71
- />
72
- </ExampleContainer>
73
- <ExampleContainer>
74
- <Title title="Disabled chip" theme="light" level={4} />
75
- <DxcChip
76
- label="Disabled"
77
- disabled
78
- prefixIcon={iconSVG}
79
- suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
80
- />
81
- </ExampleContainer>
82
- <ExampleContainer>
83
- <Title title="Chip with ellipsis" theme="light" level={4} />
84
- <div style={{ width: "200px" }}>
85
- <DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
86
- </div>
87
- </ExampleContainer>
88
- <ExampleContainer>
89
- <Title title="Chip with ellipsis and suffix" theme="light" level={4} />
90
- <div style={{ width: "200px" }}>
91
- <DxcChip
92
- suffixIcon={iconSVG}
93
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
94
- />
95
- </div>
96
- </ExampleContainer>
97
- <ExampleContainer>
98
- <Title title="Chip with ellipsis and prefix" theme="light" level={4} />
99
- <div style={{ width: "200px" }}>
100
- <DxcChip
101
- prefixIcon={iconSVG}
102
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
103
- />
104
- </div>
105
- </ExampleContainer>
106
- <ExampleContainer>
107
- <Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
108
- <div style={{ width: "200px" }}>
109
- <DxcChip
110
- prefixIcon={iconSVG}
111
- suffixIcon={iconSVG}
112
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
113
- />
114
- </div>
115
- </ExampleContainer>
116
- <Title title="Margins" theme="light" level={2} />
117
- <ExampleContainer>
118
- <Title title="Xxsmall margin" theme="light" level={4} />
119
- <DxcChip label="xxsmall" margin="xxsmall" />
120
- </ExampleContainer>
121
- <ExampleContainer>
122
- <Title title="Xsmall margin" theme="light" level={4} />
123
- <DxcChip label="xsmall" margin="xsmall" />
124
- </ExampleContainer>
125
- <ExampleContainer>
126
- <Title title="Small margin" theme="light" level={4} />
127
- <DxcChip label="small" margin="small" />
128
- </ExampleContainer>
129
- <ExampleContainer>
130
- <Title title="Medium margin" theme="light" level={4} />
131
- <DxcChip label="medium" margin="medium" />
132
- </ExampleContainer>
133
- <ExampleContainer>
134
- <Title title="Large margin" theme="light" level={4} />
135
- <DxcChip label="large" margin="large" />
136
- </ExampleContainer>
137
- <ExampleContainer>
138
- <Title title="Xlarge margin" theme="light" level={4} />
139
- <DxcChip label="xlarge" margin="xlarge" />
140
- </ExampleContainer>
141
- <ExampleContainer>
142
- <Title title="Xxlarge margin" theme="light" level={4} />
143
- <DxcChip label="xxlarge" margin="xxlarge" />
144
- </ExampleContainer>
145
- <Title title="Opinionated theme" theme="light" level={2} />
146
- <ExampleContainer>
147
- <Title title="Chip with prefix and suffix" theme="light" level={4} />
148
- <HalstackProvider theme={opinionatedTheme}>
149
- <DxcChip
150
- label="Chip"
151
- prefixIcon={iconSVG}
152
- suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
153
- />
154
- </HalstackProvider>
155
- </ExampleContainer>
156
- <ExampleContainer>
157
- <Title title="Chip with prefix and suffix" theme="light" level={4} />
158
- <HalstackProvider theme={opinionatedTheme}>
159
- <DxcChip
160
- label="Chip"
161
- disabled
162
- prefixIcon={iconSVG}
163
- suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
164
- />
165
- </HalstackProvider>
166
- </ExampleContainer>
167
- <ExampleContainer pseudoState="pseudo-hover">
168
- <Title title="Hovered" theme="light" level={4} />
169
- <HalstackProvider theme={opinionatedTheme}>
170
- <DxcChip
171
- label="Chip"
172
- prefixIcon={iconSVG}
173
- suffixIcon={iconSVG}
174
- onClickPrefix={() => {}}
175
- onClickSuffix={() => {}}
176
- />
177
- </HalstackProvider>
178
- </ExampleContainer>
179
- <ExampleContainer pseudoState="pseudo-active">
180
- <Title title="Actived" theme="light" level={4} />
181
- <HalstackProvider theme={opinionatedTheme}>
182
- <DxcChip
183
- label="Chip"
184
- prefixIcon={iconSVG}
185
- suffixIcon={iconSVG}
186
- onClickPrefix={() => {}}
187
- onClickSuffix={() => {}}
188
- />
189
- </HalstackProvider>
190
- </ExampleContainer>
191
- </>
192
- );
193
- const ChipPrefixFocused = () => (
194
- <ExampleContainer>
195
- <Title title="Chip with prefix" theme="light" level={4} />
196
- <DxcChip label="Chip with prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
197
- </ExampleContainer>
198
- );
199
- const ChipSuffixFocused = () => (
200
- <ExampleContainer>
201
- <Title title="Chip with suffix" theme="light" level={4} />
202
- <DxcChip label="Chip with suffix" suffixIcon="https://icons-for-free.com/download-icon-close+icon-1320184117228553763_512.png" onClickSuffix={() => {}} />
203
- </ExampleContainer>
204
- );
205
-
206
- export const PrefixFocused = ChipPrefixFocused.bind({});
207
- PrefixFocused.play = async () => {
208
- await userEvent.tab();
209
- };
210
-
211
- export const SuffixFocused = ChipSuffixFocused.bind({});
212
- SuffixFocused.play = async () => {
213
- await userEvent.tab();
214
- };