@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-eefd559

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 (205) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.d.ts +1 -1
  8. package/accordion/Accordion.js +11 -22
  9. package/accordion/Accordion.stories.tsx +307 -0
  10. package/accordion/types.d.ts +4 -8
  11. package/accordion-group/AccordionGroup.js +2 -2
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/types.d.ts +4 -8
  14. package/alert/Alert.js +2 -2
  15. package/alert/Alert.stories.tsx +170 -0
  16. package/alert/types.d.ts +1 -1
  17. package/badge/Badge.js +1 -1
  18. package/bleed/Bleed.d.ts +3 -0
  19. package/bleed/Bleed.js +84 -0
  20. package/bleed/Bleed.stories.tsx +342 -0
  21. package/bleed/types.d.ts +13 -0
  22. package/bleed/types.js +5 -0
  23. package/box/Box.d.ts +1 -1
  24. package/box/Box.js +4 -7
  25. package/box/types.d.ts +0 -4
  26. package/button/Button.d.ts +1 -1
  27. package/button/Button.js +13 -19
  28. package/button/Button.stories.tsx +222 -241
  29. package/button/types.d.ts +5 -9
  30. package/card/Card.js +5 -6
  31. package/card/Card.stories.tsx +201 -0
  32. package/card/ice-cream.jpg +0 -0
  33. package/card/types.d.ts +4 -6
  34. package/checkbox/Checkbox.js +2 -2
  35. package/checkbox/types.d.ts +2 -2
  36. package/chip/Chip.d.ts +4 -0
  37. package/chip/Chip.js +16 -76
  38. package/chip/Chip.stories.tsx +119 -0
  39. package/chip/types.d.ts +45 -0
  40. package/chip/types.js +5 -0
  41. package/common/variables.js +70 -28
  42. package/date/Date.js +1 -1
  43. package/date-input/DateInput.js +10 -13
  44. package/date-input/DateInput.stories.tsx +138 -0
  45. package/dialog/Dialog.js +4 -3
  46. package/dialog/Dialog.stories.tsx +212 -0
  47. package/dropdown/Dropdown.d.ts +1 -1
  48. package/dropdown/Dropdown.js +13 -35
  49. package/dropdown/Dropdown.stories.tsx +249 -0
  50. package/dropdown/types.d.ts +6 -15
  51. package/file-input/FileInput.d.ts +4 -0
  52. package/file-input/FileInput.js +167 -109
  53. package/file-input/FileInput.stories.tsx +507 -0
  54. package/file-input/FileItem.d.ts +14 -0
  55. package/file-input/FileItem.js +12 -21
  56. package/file-input/types.d.ts +112 -0
  57. package/file-input/types.js +5 -0
  58. package/footer/Footer.d.ts +1 -1
  59. package/footer/Footer.js +28 -36
  60. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  61. package/footer/Icons.d.ts +2 -0
  62. package/footer/Icons.js +3 -3
  63. package/footer/types.d.ts +22 -18
  64. package/header/Header.js +2 -2
  65. package/header/Header.stories.tsx +162 -0
  66. package/header/Icons.d.ts +2 -0
  67. package/header/types.d.ts +4 -2
  68. package/heading/Heading.d.ts +4 -0
  69. package/heading/Heading.js +7 -24
  70. package/heading/Heading.stories.tsx +54 -0
  71. package/heading/types.d.ts +33 -0
  72. package/heading/types.js +5 -0
  73. package/input-text/InputText.js +2 -2
  74. package/inset/Inset.d.ts +3 -0
  75. package/inset/Inset.js +84 -0
  76. package/inset/Inset.stories.tsx +229 -0
  77. package/inset/types.d.ts +13 -0
  78. package/inset/types.js +5 -0
  79. package/layout/ApplicationLayout.d.ts +10 -0
  80. package/layout/ApplicationLayout.js +9 -19
  81. package/layout/ApplicationLayout.stories.tsx +171 -0
  82. package/layout/types.d.ts +57 -0
  83. package/layout/types.js +5 -0
  84. package/link/Link.js +3 -3
  85. package/link/Link.stories.tsx +146 -0
  86. package/list/List.d.ts +4 -0
  87. package/list/List.js +47 -0
  88. package/list/List.stories.tsx +95 -0
  89. package/list/types.d.ts +7 -0
  90. package/list/types.js +5 -0
  91. package/main.d.ts +7 -3
  92. package/main.js +34 -2
  93. package/number-input/NumberInput.d.ts +4 -0
  94. package/number-input/NumberInput.js +5 -50
  95. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  96. package/number-input/NumberInputContext.d.ts +4 -0
  97. package/number-input/NumberInputContext.js +5 -2
  98. package/number-input/numberInputContextTypes.d.ts +19 -0
  99. package/number-input/numberInputContextTypes.js +5 -0
  100. package/number-input/types.d.ts +117 -0
  101. package/number-input/types.js +5 -0
  102. package/package.json +4 -2
  103. package/paginator/Paginator.js +2 -8
  104. package/password-input/PasswordInput.js +19 -18
  105. package/password-input/PasswordInput.stories.tsx +3 -3
  106. package/password-input/types.d.ts +17 -10
  107. package/progress-bar/ProgressBar.js +4 -4
  108. package/radio/Radio.js +2 -2
  109. package/radio/types.d.ts +2 -2
  110. package/radio-group/Radio.d.ts +4 -0
  111. package/radio-group/Radio.js +140 -0
  112. package/radio-group/RadioGroup.d.ts +4 -0
  113. package/radio-group/RadioGroup.js +273 -0
  114. package/radio-group/RadioGroup.stories.tsx +79 -0
  115. package/radio-group/RadioGroup.test.js +248 -0
  116. package/radio-group/types.d.ts +36 -0
  117. package/radio-group/types.js +5 -0
  118. package/resultsetTable/ResultsetTable.d.ts +4 -0
  119. package/resultsetTable/ResultsetTable.js +5 -28
  120. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  121. package/resultsetTable/types.d.ts +67 -0
  122. package/resultsetTable/types.js +5 -0
  123. package/row/Row.d.ts +3 -0
  124. package/row/Row.js +127 -0
  125. package/row/Row.stories.tsx +237 -0
  126. package/row/types.d.ts +10 -0
  127. package/row/types.js +5 -0
  128. package/select/Select.d.ts +4 -0
  129. package/select/Select.js +20 -22
  130. package/select/Select.stories.tsx +572 -0
  131. package/select/types.d.ts +170 -0
  132. package/select/types.js +5 -0
  133. package/sidenav/Sidenav.d.ts +9 -0
  134. package/sidenav/Sidenav.js +6 -15
  135. package/sidenav/Sidenav.stories.tsx +182 -0
  136. package/sidenav/types.d.ts +50 -0
  137. package/sidenav/types.js +5 -0
  138. package/slider/Slider.d.ts +1 -1
  139. package/slider/Slider.js +43 -32
  140. package/slider/Slider.stories.tsx +177 -0
  141. package/slider/types.d.ts +2 -7
  142. package/spinner/Spinner.js +2 -2
  143. package/spinner/Spinner.stories.jsx +1 -0
  144. package/stack/Stack.d.ts +3 -0
  145. package/stack/Stack.js +97 -0
  146. package/stack/Stack.stories.tsx +164 -0
  147. package/stack/types.d.ts +9 -0
  148. package/stack/types.js +5 -0
  149. package/switch/Switch.js +2 -2
  150. package/switch/Switch.stories.tsx +1 -1
  151. package/table/Table.js +3 -3
  152. package/table/Table.stories.jsx +2 -1
  153. package/tabs/Tabs.js +11 -9
  154. package/tabs/Tabs.stories.tsx +120 -0
  155. package/tabs/types.d.ts +25 -18
  156. package/tag/Tag.d.ts +4 -0
  157. package/tag/Tag.js +9 -35
  158. package/tag/{Tag.stories.jsx → Tag.stories.tsx} +15 -22
  159. package/tag/types.d.ts +69 -0
  160. package/tag/types.js +5 -0
  161. package/text/Text.d.ts +7 -0
  162. package/text/Text.js +30 -0
  163. package/text/Text.stories.tsx +19 -0
  164. package/text-input/TextInput.d.ts +4 -0
  165. package/text-input/TextInput.js +54 -85
  166. package/text-input/TextInput.stories.tsx +456 -0
  167. package/text-input/types.d.ts +159 -0
  168. package/text-input/types.js +5 -0
  169. package/textarea/Textarea.d.ts +4 -0
  170. package/textarea/Textarea.js +27 -60
  171. package/textarea/Textarea.stories.jsx +4 -3
  172. package/textarea/types.d.ts +130 -0
  173. package/textarea/types.js +5 -0
  174. package/toggle/Toggle.js +1 -1
  175. package/toggle-group/ToggleGroup.d.ts +4 -0
  176. package/toggle-group/ToggleGroup.js +16 -45
  177. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  178. package/toggle-group/types.d.ts +97 -0
  179. package/toggle-group/types.js +5 -0
  180. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  181. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  182. package/upload/file-upload/FileToUpload.js +1 -1
  183. package/upload/files-upload/FilesToUpload.js +1 -1
  184. package/upload/transaction/Transaction.js +2 -2
  185. package/upload/transactions/Transactions.js +1 -1
  186. package/useTheme.d.ts +2 -0
  187. package/useTheme.js +1 -1
  188. package/wizard/Wizard.d.ts +4 -0
  189. package/wizard/Wizard.js +69 -59
  190. package/wizard/Wizard.stories.tsx +224 -0
  191. package/wizard/types.d.ts +60 -0
  192. package/wizard/types.js +5 -0
  193. package/chip/index.d.ts +0 -22
  194. package/file-input/index.d.ts +0 -81
  195. package/heading/index.d.ts +0 -17
  196. package/number-input/index.d.ts +0 -113
  197. package/resultsetTable/index.d.ts +0 -19
  198. package/select/index.d.ts +0 -131
  199. package/sidenav/index.d.ts +0 -13
  200. package/tag/index.d.ts +0 -24
  201. package/text-input/index.d.ts +0 -135
  202. package/textarea/index.d.ts +0 -117
  203. package/toggle-group/index.d.ts +0 -21
  204. package/wizard/Icons.js +0 -65
  205. package/wizard/index.d.ts +0 -18
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
14
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
+
16
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
17
 
18
18
  var _react = _interopRequireWildcard(require("react"));
@@ -35,7 +35,7 @@ var _variables = require("../common/variables.js");
35
35
 
36
36
  var _utils = require("../common/utils.js");
37
37
 
38
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
38
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
39
39
 
40
40
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
41
41
 
@@ -48,8 +48,6 @@ var DxcDropdown = function DxcDropdown(_ref) {
48
48
  _ref$optionsIconPosit = _ref.optionsIconPosition,
49
49
  optionsIconPosition = _ref$optionsIconPosit === void 0 ? "before" : _ref$optionsIconPosit,
50
50
  icon = _ref.icon,
51
- _ref$iconSrc = _ref.iconSrc,
52
- iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
53
51
  _ref$iconPosition = _ref.iconPosition,
54
52
  iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
55
53
  _ref$label = _ref.label,
@@ -164,15 +162,13 @@ var DxcDropdown = function DxcDropdown(_ref) {
164
162
  }, /*#__PURE__*/_react["default"].createElement(DropdownTriggerContainer, {
165
163
  iconPosition: iconPosition,
166
164
  caretHidden: caretHidden
167
- }, icon ? /*#__PURE__*/_react["default"].createElement(ButtonIconContainer, {
165
+ }, icon && /*#__PURE__*/_react["default"].createElement(ButtonIconContainer, {
168
166
  label: label,
169
167
  iconPosition: iconPosition,
170
168
  disabled: disabled
171
- }, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : iconSrc && /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
172
- label: label,
173
- src: iconSrc,
174
- iconPosition: iconPosition
175
- }), /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
169
+ }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
170
+ src: icon
171
+ }) : icon), /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
176
172
  iconPosition: iconPosition,
177
173
  label: label
178
174
  }, label)), /*#__PURE__*/_react["default"].createElement(CaretIconContainer, {
@@ -213,14 +209,12 @@ var DxcDropdown = function DxcDropdown(_ref) {
213
209
  onClick: function onClick(event) {
214
210
  return handleMenuItemClick(option);
215
211
  }
216
- }, option.icon ? /*#__PURE__*/_react["default"].createElement(ListIconContainer, {
217
- label: option.label,
218
- iconPosition: optionsIconPosition
219
- }, (0, _typeof2["default"])(option.icon) === "object" ? option.icon : /*#__PURE__*/_react["default"].createElement(option.icon)) : option.iconSrc && /*#__PURE__*/_react["default"].createElement(ListIcon, {
212
+ }, option.icon && /*#__PURE__*/_react["default"].createElement(ListIconContainer, {
220
213
  label: option.label,
221
- src: option.iconSrc,
222
214
  iconPosition: optionsIconPosition
223
- }), /*#__PURE__*/_react["default"].createElement("span", {
215
+ }, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ListIcon, {
216
+ src: option.icon
217
+ }) : option.icon), /*#__PURE__*/_react["default"].createElement("span", {
224
218
  className: "optionLabel"
225
219
  }, option.label));
226
220
  })))));
@@ -357,15 +351,7 @@ var DropdownTriggerContainer = _styledComponents["default"].span(_templateObject
357
351
  return props.caretHidden ? "100%" : "calc(100% - 36px)";
358
352
  });
359
353
 
360
- var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
361
- return props.theme.buttonIconSize;
362
- }, function (props) {
363
- return props.theme.buttonIconSize;
364
- }, function (props) {
365
- return props.iconPosition === "after" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
366
- }, function (props) {
367
- return props.iconPosition === "before" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
368
- });
354
+ var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
369
355
 
370
356
  var ButtonIconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
371
357
  return props.theme.buttonIconSize;
@@ -379,15 +365,7 @@ var ButtonIconContainer = _styledComponents["default"].div(_templateObject7 || (
379
365
  return props.disabled ? props.theme.disabledColor : props.theme.buttonIconColor;
380
366
  });
381
367
 
382
- var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
383
- return props.theme.optionIconSize;
384
- }, function (props) {
385
- return props.theme.optionIconSize;
386
- }, function (props) {
387
- return props.iconPosition === "after" && props.label !== "" && props.theme.optionIconSpacing || "0px";
388
- }, function (props) {
389
- return props.iconPosition === "before" && props.label !== "" && props.theme.optionIconSpacing || "0px";
390
- });
368
+ var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
391
369
 
392
370
  var ListIconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n width: ", ";\n height: ", ";\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
393
371
  return props.theme.optionIconSize;
@@ -0,0 +1,249 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcDropdown from "./Dropdown";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+
7
+ export default {
8
+ title: "Dropdown",
9
+ component: DxcDropdown,
10
+ };
11
+
12
+ const iconSVG = (
13
+ <svg viewBox="0 0 24 24" fill="currentColor">
14
+ <path d="M0 0h24v24H0z" fill="none" />
15
+ <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
16
+ </svg>
17
+ );
18
+
19
+ const iconSVGLarge = (
20
+ <svg enable-background="new 0 0 24 24" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
21
+ <g>
22
+ <path d="M0,0h24v24H0V0z" fill="none" />
23
+ <path d="M0,0h24v24H0V0z" fill="none" />
24
+ </g>
25
+ <g>
26
+ <path d="M12,17.27L18.18,21l-1.64-7.03L22,9.24l-7.19-0.61L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27z" />
27
+ </g>
28
+ </svg>
29
+ );
30
+
31
+ const options: any = [
32
+ {
33
+ value: "1",
34
+ label: "Amazon with a very long text",
35
+ },
36
+ {
37
+ value: "2",
38
+ label: "Ebay",
39
+ },
40
+ {
41
+ value: "3",
42
+ label: "Apple",
43
+ },
44
+ ];
45
+
46
+ const option: any = [
47
+ {
48
+ value: "1",
49
+ label: "Ebay",
50
+ },
51
+ ];
52
+
53
+ const icons = [
54
+ iconSVG,
55
+ iconSVGLarge,
56
+ "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
57
+ ];
58
+
59
+ const optionsIcon: any = options.map((op, i) => ({ ...op, icon: icons[i] }));
60
+
61
+ export const Chromatic = () => (
62
+ <>
63
+ <ExampleContainer>
64
+ <Title title="Default" theme="light" level={4} />
65
+ <DxcDropdown label="Default" options={options} onSelectOption={(value) => {}} />
66
+ </ExampleContainer>
67
+ <ExampleContainer pseudoState="pseudo-hover">
68
+ <Title title="Hovered" theme="light" level={4} />
69
+ <DxcDropdown label="Hovered" options={options} onSelectOption={(value) => {}} />
70
+ </ExampleContainer>
71
+ <ExampleContainer pseudoState="pseudo-focus-visible">
72
+ <Title title="Focused" theme="light" level={4} />
73
+ <DxcDropdown label="Focused" options={options} onSelectOption={(value) => {}} />
74
+ </ExampleContainer>
75
+ <ExampleContainer pseudoState="pseudo-active">
76
+ <Title title="Actived" theme="light" level={4} />
77
+ <DxcDropdown label="Actived" options={options} onSelectOption={(value) => {}} />
78
+ </ExampleContainer>
79
+ <ExampleContainer>
80
+ <Title title="Disabled" theme="light" level={4} />
81
+ <DxcDropdown label="Disabled" options={options} onSelectOption={(value) => {}} disabled />
82
+ </ExampleContainer>
83
+ <ExampleContainer>
84
+ <Title title="Caret hidden" theme="light" level={4} />
85
+ <DxcDropdown label="Caret hidden" options={options} onSelectOption={(value) => {}} caretHidden />
86
+ </ExampleContainer>
87
+ <ExampleContainer>
88
+ <Title title="With icon before" theme="light" level={4} />
89
+ <DxcDropdown label="Icon before" options={options} onSelectOption={(value) => {}} icon={iconSVG} />
90
+ </ExampleContainer>
91
+ <ExampleContainer>
92
+ <Title title="With icon after" theme="light" level={4} />
93
+ <DxcDropdown
94
+ label="Icon after"
95
+ options={options}
96
+ onSelectOption={(value) => {}}
97
+ icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png"
98
+ iconPosition="after"
99
+ />
100
+ </ExampleContainer>
101
+ <ExampleContainer>
102
+ <Title title="Only icon" theme="light" level={4} />
103
+ <DxcDropdown options={options} onSelectOption={(value) => {}} icon={iconSVG} />
104
+ </ExampleContainer>
105
+ <ExampleContainer>
106
+ <Title title="Large icon" theme="light" level={4} />
107
+ <DxcDropdown label="Large icon" options={options} onSelectOption={(value) => {}} icon={iconSVGLarge} />
108
+ </ExampleContainer>
109
+ <ExampleContainer>
110
+ <Title title="Disabled with icon" theme="light" level={4} />
111
+ <DxcDropdown
112
+ label="Disabled with icon"
113
+ options={options}
114
+ onSelectOption={(value) => {}}
115
+ icon={iconSVG}
116
+ disabled
117
+ />
118
+ </ExampleContainer>
119
+ <ExampleContainer>
120
+ <Title title="Ellipsis" theme="light" level={4} />
121
+ <DxcDropdown
122
+ label="Very long text in dropdown button"
123
+ options={options}
124
+ onSelectOption={(value) => {}}
125
+ icon={iconSVG}
126
+ size="medium"
127
+ />
128
+ </ExampleContainer>
129
+ <Title title="Margins" theme="light" level={2} />
130
+ <ExampleContainer>
131
+ <Title title="Xxsmall" theme="light" level={4} />
132
+ <DxcDropdown label="Xxsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxsmall" />
133
+ </ExampleContainer>
134
+ <ExampleContainer>
135
+ <Title title="Xsmall" theme="light" level={4} />
136
+ <DxcDropdown label="Xsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xsmall" />
137
+ </ExampleContainer>
138
+ <ExampleContainer>
139
+ <Title title="Small" theme="light" level={4} />
140
+ <DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="small" />
141
+ </ExampleContainer>
142
+ <ExampleContainer>
143
+ <Title title="Medium" theme="light" level={4} />
144
+ <DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="medium" />
145
+ </ExampleContainer>
146
+ <ExampleContainer>
147
+ <Title title="Large" theme="light" level={4} />
148
+ <DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="large" />
149
+ </ExampleContainer>
150
+ <ExampleContainer>
151
+ <Title title="Xlarge" theme="light" level={4} />
152
+ <DxcDropdown label="Xlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xlarge" />
153
+ </ExampleContainer>
154
+ <ExampleContainer>
155
+ <Title title="Xxlarge" theme="light" level={4} />
156
+ <DxcDropdown label="Xxlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxlarge" />
157
+ </ExampleContainer>
158
+ <Title title="Sizes" theme="light" level={2} />
159
+ <ExampleContainer>
160
+ <Title title="Small" theme="light" level={4} />
161
+ <DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="small" />
162
+ </ExampleContainer>
163
+ <ExampleContainer>
164
+ <Title title="Medium" theme="light" level={4} />
165
+ <DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="medium" />
166
+ </ExampleContainer>
167
+ <ExampleContainer>
168
+ <Title title="Large" theme="light" level={4} />
169
+ <DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="large" />
170
+ </ExampleContainer>
171
+ <ExampleContainer>
172
+ <Title title="FitContent" theme="light" level={4} />
173
+ <DxcDropdown
174
+ label="FitContent"
175
+ options={options}
176
+ onSelectOption={(value) => {}}
177
+ icon={iconSVG}
178
+ size="fitContent"
179
+ />
180
+ </ExampleContainer>
181
+ <ExampleContainer>
182
+ <Title title="FillParent" theme="light" level={4} />
183
+ <DxcDropdown
184
+ label="FillParent"
185
+ options={options}
186
+ onSelectOption={(value) => {}}
187
+ icon={iconSVG}
188
+ size="fillParent"
189
+ />
190
+ </ExampleContainer>
191
+ </>
192
+ );
193
+
194
+ const DropdownWithOptions = () => (
195
+ <ExampleContainer expanded>
196
+ <Title title="Options" theme="light" level={4} />
197
+ <DxcDropdown label="Options with icon" options={optionsIcon} onSelectOption={(value) => {}} />
198
+ </ExampleContainer>
199
+ );
200
+
201
+ const DropdownHoverOption = () => (
202
+ <ExampleContainer pseudoState="pseudo-hover" expanded>
203
+ <Title title="Hovered option" theme="light" level={4} />
204
+ <DxcDropdown label="Hovered options" options={option} onSelectOption={(value) => {}} />
205
+ </ExampleContainer>
206
+ );
207
+
208
+ const DropdownActiveOption = () => (
209
+ <ExampleContainer pseudoState="pseudo-active" expanded>
210
+ <Title title="Actived option" theme="light" level={4} />
211
+ <DxcDropdown label="Actived options" options={option} onSelectOption={(value) => {}} />
212
+ </ExampleContainer>
213
+ );
214
+
215
+ const DropdownWithOptionsIconAfter = () => (
216
+ <ExampleContainer expanded>
217
+ <Title title="Icon after options" theme="light" level={4} />
218
+ <DxcDropdown
219
+ label="Icon after options"
220
+ options={optionsIcon}
221
+ onSelectOption={(value) => {}}
222
+ optionsIconPosition="after"
223
+ />
224
+ </ExampleContainer>
225
+ );
226
+
227
+ export const DropdownOptions = DropdownWithOptions.bind({});
228
+ DropdownOptions.play = async ({ canvasElement }) => {
229
+ const canvas = within(canvasElement);
230
+ await userEvent.click(canvas.getByRole("button"));
231
+ };
232
+
233
+ export const DropdownHoveredOption = DropdownHoverOption.bind({});
234
+ DropdownHoveredOption.play = async ({ canvasElement }) => {
235
+ const canvas = within(canvasElement);
236
+ await userEvent.click(canvas.getByRole("button"));
237
+ };
238
+
239
+ export const DropdownActivedOption = DropdownActiveOption.bind({});
240
+ DropdownActivedOption.play = async ({ canvasElement }) => {
241
+ const canvas = within(canvasElement);
242
+ await userEvent.click(canvas.getByRole("button"));
243
+ };
244
+
245
+ export const DropdownOptionsIconAfter = DropdownWithOptionsIconAfter.bind({});
246
+ DropdownOptionsIconAfter.play = async ({ canvasElement }) => {
247
+ const canvas = within(canvasElement);
248
+ await userEvent.click(canvas.getByRole("button"));
249
+ };
@@ -6,21 +6,17 @@ declare type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
9
+ declare type SVG = React.SVGProps<SVGSVGElement>;
10
10
  declare type Option = {
11
11
  /**
12
12
  * Option display value.
13
13
  */
14
14
  label?: string;
15
15
  /**
16
- * Element used as the icon that will be placed next to the
16
+ * Element or path used as the icon that will be placed next to the
17
17
  * option label.
18
18
  */
19
- icon?: SVG;
20
- /**
21
- * @deprecated URL of the icon that will be placed next to the option label.
22
- */
23
- iconSrc?: string;
19
+ icon?: string | SVG;
24
20
  /**
25
21
  * Option inner value.
26
22
  */
@@ -30,22 +26,17 @@ declare type Props = {
30
26
  /**
31
27
  * An array of objects representing the options.
32
28
  */
33
- options: [Option, ...Option[]];
29
+ options: Option[];
34
30
  /**
35
31
  * In case options include icons, whether the icon should appear
36
32
  * after or before the label.
37
33
  */
38
34
  optionsIconPosition?: "before" | "after";
39
35
  /**
40
- * Element used as the icon that will be placed next to the
41
- * dropdown label.
42
- */
43
- icon?: SVG;
44
- /**
45
- * @deprecated URL of the icon that will be placed next to the
36
+ * Element or path used as the icon that will be placed next to the
46
37
  * dropdown label.
47
38
  */
48
- iconSrc?: string;
39
+ icon?: string | SVG;
49
40
  /**
50
41
  * Whether the icon should appear after or before the label.
51
42
  */
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import FileInputPropsType from "./types";
3
+ declare const DxcFileInput: ({ name, mode, label, buttonLabel, dropAreaLabel, helperText, accept, minSize, maxSize, showPreview, multiple, disabled, callbackFile, value, margin, tabIndex, }: FileInputPropsType) => JSX.Element;
4
+ export default DxcFileInput;