@dxc-technology/halstack-react 0.0.0-4b95ba0 → 0.0.0-4bb3d50

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 (256) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6518 -0
  3. package/dist/index.d.ts +6518 -0
  4. package/dist/index.js +13490 -0
  5. package/dist/index.mjs +13433 -0
  6. package/package.json +69 -70
  7. package/BackgroundColorContext.d.ts +0 -10
  8. package/BackgroundColorContext.js +0 -47
  9. package/ThemeContext.d.ts +0 -15
  10. package/ThemeContext.js +0 -235
  11. package/accordion/Accordion.d.ts +0 -4
  12. package/accordion/Accordion.js +0 -247
  13. package/accordion/Accordion.stories.tsx +0 -307
  14. package/accordion/types.d.ts +0 -64
  15. package/accordion/types.js +0 -5
  16. package/accordion-group/AccordionGroup.d.ts +0 -7
  17. package/accordion-group/AccordionGroup.js +0 -170
  18. package/accordion-group/AccordionGroup.stories.tsx +0 -225
  19. package/accordion-group/types.d.ts +0 -68
  20. package/accordion-group/types.js +0 -5
  21. package/alert/Alert.d.ts +0 -4
  22. package/alert/Alert.js +0 -290
  23. package/alert/Alert.stories.tsx +0 -170
  24. package/alert/types.d.ts +0 -49
  25. package/alert/types.js +0 -5
  26. package/badge/Badge.d.ts +0 -4
  27. package/badge/Badge.js +0 -59
  28. package/badge/types.d.ts +0 -4
  29. package/badge/types.js +0 -5
  30. package/bleed/Bleed.d.ts +0 -3
  31. package/bleed/Bleed.js +0 -84
  32. package/bleed/Bleed.stories.tsx +0 -342
  33. package/bleed/types.d.ts +0 -13
  34. package/bleed/types.js +0 -5
  35. package/box/Box.d.ts +0 -4
  36. package/box/Box.js +0 -126
  37. package/box/Box.stories.tsx +0 -132
  38. package/box/types.d.ts +0 -43
  39. package/box/types.js +0 -5
  40. package/button/Button.d.ts +0 -4
  41. package/button/Button.js +0 -171
  42. package/button/Button.stories.tsx +0 -274
  43. package/button/types.d.ts +0 -53
  44. package/button/types.js +0 -5
  45. package/card/Card.d.ts +0 -4
  46. package/card/Card.js +0 -164
  47. package/card/Card.stories.tsx +0 -201
  48. package/card/ice-cream.jpg +0 -0
  49. package/card/types.d.ts +0 -67
  50. package/card/types.js +0 -5
  51. package/checkbox/Checkbox.d.ts +0 -4
  52. package/checkbox/Checkbox.js +0 -253
  53. package/checkbox/Checkbox.stories.tsx +0 -192
  54. package/checkbox/types.d.ts +0 -60
  55. package/checkbox/types.js +0 -5
  56. package/chip/Chip.d.ts +0 -4
  57. package/chip/Chip.js +0 -161
  58. package/chip/Chip.stories.tsx +0 -119
  59. package/chip/types.d.ts +0 -45
  60. package/chip/types.js +0 -5
  61. package/common/OpenSans.css +0 -81
  62. package/common/RequiredComponent.js +0 -32
  63. package/common/fonts/OpenSans-Bold.ttf +0 -0
  64. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  65. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  66. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  67. package/common/fonts/OpenSans-Italic.ttf +0 -0
  68. package/common/fonts/OpenSans-Light.ttf +0 -0
  69. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  70. package/common/fonts/OpenSans-Regular.ttf +0 -0
  71. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  72. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  73. package/common/utils.js +0 -22
  74. package/common/variables.js +0 -1378
  75. package/date-input/DateInput.d.ts +0 -4
  76. package/date-input/DateInput.js +0 -358
  77. package/date-input/DateInput.stories.tsx +0 -138
  78. package/date-input/types.d.ts +0 -100
  79. package/date-input/types.js +0 -5
  80. package/dialog/Dialog.d.ts +0 -4
  81. package/dialog/Dialog.js +0 -166
  82. package/dialog/Dialog.stories.tsx +0 -212
  83. package/dialog/types.d.ts +0 -43
  84. package/dialog/types.js +0 -5
  85. package/dropdown/Dropdown.d.ts +0 -4
  86. package/dropdown/Dropdown.js +0 -395
  87. package/dropdown/Dropdown.stories.tsx +0 -249
  88. package/dropdown/types.d.ts +0 -80
  89. package/dropdown/types.js +0 -5
  90. package/file-input/FileInput.d.ts +0 -4
  91. package/file-input/FileInput.js +0 -590
  92. package/file-input/FileInput.stories.tsx +0 -507
  93. package/file-input/FileItem.d.ts +0 -14
  94. package/file-input/FileItem.js +0 -184
  95. package/file-input/types.d.ts +0 -112
  96. package/file-input/types.js +0 -5
  97. package/footer/Footer.d.ts +0 -4
  98. package/footer/Footer.js +0 -258
  99. package/footer/Footer.stories.tsx +0 -130
  100. package/footer/Icons.d.ts +0 -2
  101. package/footer/Icons.js +0 -77
  102. package/footer/types.d.ts +0 -65
  103. package/footer/types.js +0 -5
  104. package/header/Header.d.ts +0 -7
  105. package/header/Header.js +0 -324
  106. package/header/Header.stories.tsx +0 -162
  107. package/header/Icons.d.ts +0 -2
  108. package/header/Icons.js +0 -34
  109. package/header/types.d.ts +0 -47
  110. package/header/types.js +0 -5
  111. package/heading/Heading.d.ts +0 -4
  112. package/heading/Heading.js +0 -159
  113. package/heading/Heading.stories.tsx +0 -54
  114. package/heading/types.d.ts +0 -33
  115. package/heading/types.js +0 -5
  116. package/inset/Inset.d.ts +0 -3
  117. package/inset/Inset.js +0 -84
  118. package/inset/Inset.stories.tsx +0 -229
  119. package/inset/types.d.ts +0 -13
  120. package/inset/types.js +0 -5
  121. package/layout/ApplicationLayout.d.ts +0 -10
  122. package/layout/ApplicationLayout.js +0 -231
  123. package/layout/ApplicationLayout.stories.tsx +0 -171
  124. package/layout/Icons.js +0 -55
  125. package/layout/types.d.ts +0 -57
  126. package/layout/types.js +0 -5
  127. package/link/Link.d.ts +0 -3
  128. package/link/Link.js +0 -153
  129. package/link/Link.stories.tsx +0 -151
  130. package/link/types.d.ts +0 -70
  131. package/link/types.js +0 -5
  132. package/list/List.d.ts +0 -4
  133. package/list/List.js +0 -47
  134. package/list/List.stories.tsx +0 -95
  135. package/list/types.d.ts +0 -7
  136. package/list/types.js +0 -5
  137. package/main.d.ts +0 -46
  138. package/main.js +0 -379
  139. package/number-input/NumberInput.d.ts +0 -4
  140. package/number-input/NumberInput.js +0 -83
  141. package/number-input/NumberInput.stories.tsx +0 -115
  142. package/number-input/NumberInputContext.d.ts +0 -4
  143. package/number-input/NumberInputContext.js +0 -19
  144. package/number-input/numberInputContextTypes.d.ts +0 -19
  145. package/number-input/numberInputContextTypes.js +0 -5
  146. package/number-input/types.d.ts +0 -117
  147. package/number-input/types.js +0 -5
  148. package/paginator/Icons.js +0 -66
  149. package/paginator/Paginator.d.ts +0 -4
  150. package/paginator/Paginator.js +0 -192
  151. package/paginator/Paginator.stories.tsx +0 -63
  152. package/paginator/types.d.ts +0 -38
  153. package/paginator/types.js +0 -5
  154. package/password-input/PasswordInput.d.ts +0 -4
  155. package/password-input/PasswordInput.js +0 -163
  156. package/password-input/PasswordInput.stories.tsx +0 -131
  157. package/password-input/types.d.ts +0 -107
  158. package/password-input/types.js +0 -5
  159. package/progress-bar/ProgressBar.d.ts +0 -4
  160. package/progress-bar/ProgressBar.js +0 -170
  161. package/progress-bar/ProgressBar.stories.jsx +0 -58
  162. package/progress-bar/types.d.ts +0 -37
  163. package/progress-bar/types.js +0 -5
  164. package/radio/Radio.d.ts +0 -4
  165. package/radio/Radio.js +0 -174
  166. package/radio/Radio.stories.tsx +0 -192
  167. package/radio/types.d.ts +0 -54
  168. package/radio/types.js +0 -5
  169. package/radio-group/Radio.d.ts +0 -4
  170. package/radio-group/Radio.js +0 -140
  171. package/radio-group/RadioGroup.d.ts +0 -4
  172. package/radio-group/RadioGroup.js +0 -273
  173. package/radio-group/RadioGroup.stories.tsx +0 -79
  174. package/radio-group/RadioGroup.test.js +0 -248
  175. package/radio-group/types.d.ts +0 -36
  176. package/radio-group/types.js +0 -5
  177. package/resultsetTable/ResultsetTable.d.ts +0 -4
  178. package/resultsetTable/ResultsetTable.js +0 -254
  179. package/resultsetTable/ResultsetTable.stories.tsx +0 -275
  180. package/resultsetTable/types.d.ts +0 -67
  181. package/resultsetTable/types.js +0 -5
  182. package/row/Row.d.ts +0 -3
  183. package/row/Row.js +0 -127
  184. package/row/Row.stories.tsx +0 -237
  185. package/row/types.d.ts +0 -10
  186. package/row/types.js +0 -5
  187. package/select/Select.d.ts +0 -4
  188. package/select/Select.js +0 -869
  189. package/select/Select.stories.tsx +0 -572
  190. package/select/types.d.ts +0 -170
  191. package/select/types.js +0 -5
  192. package/sidenav/Sidenav.d.ts +0 -9
  193. package/sidenav/Sidenav.js +0 -136
  194. package/sidenav/Sidenav.stories.tsx +0 -182
  195. package/sidenav/types.d.ts +0 -50
  196. package/sidenav/types.js +0 -5
  197. package/slider/Slider.d.ts +0 -4
  198. package/slider/Slider.js +0 -317
  199. package/slider/Slider.stories.tsx +0 -177
  200. package/slider/types.d.ts +0 -78
  201. package/slider/types.js +0 -5
  202. package/spinner/Spinner.d.ts +0 -4
  203. package/spinner/Spinner.js +0 -250
  204. package/spinner/Spinner.stories.jsx +0 -103
  205. package/spinner/types.d.ts +0 -32
  206. package/spinner/types.js +0 -5
  207. package/stack/Stack.d.ts +0 -3
  208. package/stack/Stack.js +0 -97
  209. package/stack/Stack.stories.tsx +0 -164
  210. package/stack/types.d.ts +0 -9
  211. package/stack/types.js +0 -5
  212. package/switch/Switch.d.ts +0 -4
  213. package/switch/Switch.js +0 -179
  214. package/switch/Switch.stories.tsx +0 -160
  215. package/switch/types.d.ts +0 -58
  216. package/switch/types.js +0 -5
  217. package/table/Table.d.ts +0 -4
  218. package/table/Table.js +0 -118
  219. package/table/Table.stories.jsx +0 -277
  220. package/table/types.d.ts +0 -21
  221. package/table/types.js +0 -5
  222. package/tabs/Tabs.d.ts +0 -4
  223. package/tabs/Tabs.js +0 -213
  224. package/tabs/Tabs.stories.tsx +0 -120
  225. package/tabs/types.d.ts +0 -78
  226. package/tabs/types.js +0 -5
  227. package/tag/Tag.d.ts +0 -4
  228. package/tag/Tag.js +0 -188
  229. package/tag/Tag.stories.tsx +0 -138
  230. package/tag/types.d.ts +0 -69
  231. package/tag/types.js +0 -5
  232. package/text/Text.d.ts +0 -7
  233. package/text/Text.js +0 -30
  234. package/text/Text.stories.tsx +0 -19
  235. package/text-input/TextInput.d.ts +0 -4
  236. package/text-input/TextInput.js +0 -796
  237. package/text-input/TextInput.stories.tsx +0 -456
  238. package/text-input/types.d.ts +0 -159
  239. package/text-input/types.js +0 -5
  240. package/textarea/Textarea.d.ts +0 -4
  241. package/textarea/Textarea.js +0 -286
  242. package/textarea/Textarea.stories.jsx +0 -136
  243. package/textarea/types.d.ts +0 -130
  244. package/textarea/types.js +0 -5
  245. package/toggle-group/ToggleGroup.d.ts +0 -4
  246. package/toggle-group/ToggleGroup.js +0 -214
  247. package/toggle-group/ToggleGroup.stories.tsx +0 -173
  248. package/toggle-group/types.d.ts +0 -97
  249. package/toggle-group/types.js +0 -5
  250. package/useTheme.d.ts +0 -2
  251. package/useTheme.js +0 -22
  252. package/wizard/Wizard.d.ts +0 -4
  253. package/wizard/Wizard.js +0 -281
  254. package/wizard/Wizard.stories.tsx +0 -224
  255. package/wizard/types.d.ts +0 -60
  256. package/wizard/types.js +0 -5
@@ -1,395 +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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
23
-
24
- var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
25
-
26
- var _core = require("@material-ui/core");
27
-
28
- var _Grow = _interopRequireDefault(require("@material-ui/core/Grow"));
29
-
30
- var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
31
-
32
- var _MenuList = _interopRequireDefault(require("@material-ui/core/MenuList"));
33
-
34
- var _variables = require("../common/variables.js");
35
-
36
- var _utils = require("../common/utils.js");
37
-
38
- var _useTheme = _interopRequireDefault(require("../useTheme"));
39
-
40
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
41
-
42
- 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); }
43
-
44
- 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; }
45
-
46
- var DxcDropdown = function DxcDropdown(_ref) {
47
- var options = _ref.options,
48
- _ref$optionsIconPosit = _ref.optionsIconPosition,
49
- optionsIconPosition = _ref$optionsIconPosit === void 0 ? "before" : _ref$optionsIconPosit,
50
- icon = _ref.icon,
51
- _ref$iconPosition = _ref.iconPosition,
52
- iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
53
- _ref$label = _ref.label,
54
- label = _ref$label === void 0 ? "" : _ref$label,
55
- _ref$caretHidden = _ref.caretHidden,
56
- caretHidden = _ref$caretHidden === void 0 ? false : _ref$caretHidden,
57
- onSelectOption = _ref.onSelectOption,
58
- _ref$expandOnHover = _ref.expandOnHover,
59
- expandOnHover = _ref$expandOnHover === void 0 ? false : _ref$expandOnHover,
60
- margin = _ref.margin,
61
- _ref$size = _ref.size,
62
- size = _ref$size === void 0 ? "fitContent" : _ref$size,
63
- _ref$tabIndex = _ref.tabIndex,
64
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
65
- _ref$disabled = _ref.disabled,
66
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
67
-
68
- var _useState = (0, _react.useState)(),
69
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
70
- width = _useState2[0],
71
- setWidth = _useState2[1];
72
-
73
- var colorsTheme = (0, _useTheme["default"])();
74
- var ref = (0, _react.useRef)(null);
75
-
76
- var handleResize = function handleResize() {
77
- if (ref.current) setWidth(ref.current.offsetWidth);
78
- };
79
-
80
- (0, _react.useEffect)(function () {
81
- if (ref.current) {
82
- ref.current.addEventListener("resize", handleResize);
83
- handleResize();
84
- }
85
-
86
- return function () {
87
- if (ref.current) ref.current.removeEventListener("resize", handleResize);
88
- };
89
- }, []);
90
-
91
- var _useState3 = (0, _react.useState)(null),
92
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
93
- anchorEl = _useState4[0],
94
- setAnchorEl = _useState4[1];
95
-
96
- function handleClickListItem(event) {
97
- setAnchorEl(event.currentTarget);
98
- }
99
-
100
- function handleMenuItemClick(option) {
101
- setAnchorEl(null);
102
- onSelectOption(option.value);
103
- }
104
-
105
- function handleClose() {
106
- setAnchorEl(null);
107
- }
108
-
109
- var handleCloseOver = expandOnHover ? handleClose : undefined;
110
-
111
- var UpArrowIcon = function UpArrowIcon() {
112
- return /*#__PURE__*/_react["default"].createElement("svg", {
113
- xmlns: "http://www.w3.org/2000/svg",
114
- width: "24",
115
- height: "24",
116
- viewBox: "0 0 24 24",
117
- fill: "currentColor"
118
- }, /*#__PURE__*/_react["default"].createElement("path", {
119
- d: "M7 14l5-5 5 5z"
120
- }), /*#__PURE__*/_react["default"].createElement("path", {
121
- d: "M0 0h24v24H0z",
122
- fill: "none"
123
- }));
124
- };
125
-
126
- var DownArrowIcon = function DownArrowIcon() {
127
- return /*#__PURE__*/_react["default"].createElement("svg", {
128
- xmlns: "http://www.w3.org/2000/svg",
129
- width: "24",
130
- height: "24",
131
- viewBox: "0 0 24 24",
132
- fill: "currentColor"
133
- }, /*#__PURE__*/_react["default"].createElement("path", {
134
- d: "M7 10l5 5 5-5z"
135
- }), /*#__PURE__*/_react["default"].createElement("path", {
136
- d: "M0 0h24v24H0z",
137
- fill: "none"
138
- }));
139
- };
140
-
141
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
142
- theme: colorsTheme.dropdown
143
- }, /*#__PURE__*/_react["default"].createElement(DXCDropdownContainer, {
144
- margin: margin,
145
- size: size,
146
- disabled: disabled
147
- }, /*#__PURE__*/_react["default"].createElement("div", {
148
- onMouseOver: expandOnHover && !disabled ? handleClickListItem : undefined,
149
- onMouseOut: handleCloseOver,
150
- onFocus: handleCloseOver,
151
- onBlur: handleCloseOver
152
- }, /*#__PURE__*/_react["default"].createElement(DropdownTrigger, {
153
- opened: anchorEl === null ? false : true,
154
- onClick: handleClickListItem,
155
- disabled: disabled,
156
- label: label,
157
- caretHidden: caretHidden,
158
- margin: margin,
159
- size: size,
160
- ref: ref,
161
- tabIndex: tabIndex
162
- }, /*#__PURE__*/_react["default"].createElement(DropdownTriggerContainer, {
163
- iconPosition: iconPosition,
164
- caretHidden: caretHidden
165
- }, icon && /*#__PURE__*/_react["default"].createElement(ButtonIconContainer, {
166
- label: label,
167
- iconPosition: iconPosition,
168
- disabled: disabled
169
- }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
170
- src: icon
171
- }) : icon), /*#__PURE__*/_react["default"].createElement(DropdownTriggerLabel, {
172
- iconPosition: iconPosition,
173
- label: label
174
- }, label)), /*#__PURE__*/_react["default"].createElement(CaretIconContainer, {
175
- caretHidden: caretHidden,
176
- disabled: disabled
177
- }, !caretHidden && (anchorEl === null ? /*#__PURE__*/_react["default"].createElement(DownArrowIcon, null) : /*#__PURE__*/_react["default"].createElement(UpArrowIcon, null)))), /*#__PURE__*/_react["default"].createElement(DXCMenu, {
178
- anchorEl: anchorEl,
179
- open: Boolean(anchorEl),
180
- onClose: handleClose,
181
- getContentAnchorEl: null,
182
- anchorOrigin: {
183
- vertical: "bottom",
184
- horizontal: "left"
185
- },
186
- transformOrigin: {
187
- vertical: "top",
188
- horizontal: "left"
189
- },
190
- optionsIconPosition: optionsIconPosition,
191
- size: size,
192
- width: width,
193
- role: undefined,
194
- transition: true,
195
- disablePortal: true,
196
- placement: "bottom-start"
197
- }, function (_ref2) {
198
- var TransitionProps = _ref2.TransitionProps;
199
- return /*#__PURE__*/_react["default"].createElement(_Grow["default"], TransitionProps, /*#__PURE__*/_react["default"].createElement(_Paper["default"], null, /*#__PURE__*/_react["default"].createElement(_core.ClickAwayListener, {
200
- onClickAway: handleClose
201
- }, /*#__PURE__*/_react["default"].createElement(_MenuList["default"], {
202
- autoFocusItem: Boolean(anchorEl),
203
- id: "menu-list-grow"
204
- }, options.map(function (option) {
205
- return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
206
- key: option.value,
207
- value: option.value,
208
- disableRipple: true,
209
- onClick: function onClick(event) {
210
- return handleMenuItemClick(option);
211
- }
212
- }, option.icon && /*#__PURE__*/_react["default"].createElement(ListIconContainer, {
213
- label: option.label,
214
- iconPosition: optionsIconPosition
215
- }, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ListIcon, {
216
- src: option.icon
217
- }) : option.icon), /*#__PURE__*/_react["default"].createElement("span", {
218
- className: "optionLabel"
219
- }, option.label));
220
- })))));
221
- }))));
222
- };
223
-
224
- var sizes = {
225
- small: "60px",
226
- medium: "240px",
227
- large: "480px",
228
- fillParent: "100%",
229
- fitContent: "unset"
230
- };
231
-
232
- var calculateWidth = function calculateWidth(margin, size) {
233
- if (size === "fillParent") {
234
- return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
235
- }
236
-
237
- return sizes[size];
238
- };
239
-
240
- var DXCDropdownContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-block;\n"])), function (props) {
241
- return calculateWidth(props.margin, props.size);
242
- }, function (props) {
243
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
244
- }, function (props) {
245
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
246
- }, function (props) {
247
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
248
- }, function (props) {
249
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
250
- }, function (props) {
251
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
252
- });
253
-
254
- var DXCMenu = (0, _styledComponents["default"])(_Popper["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 1;\n\n .MuiMenuItem-gutters {\n width: ", ";\n }\n .MuiMenuItem-root {\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n height: auto;\n }\n .MuiPaper-root {\n min-width: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0px;\n border-top-right-radius: 0px;\n max-height: 230px;\n overflow-y: auto;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n\n .MuiList-padding {\n padding-top: 0px;\n padding-bottom: 0px;\n }\n .MuiListItem-button {\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n cursor: pointer;\n }\n .MuiListItem-button:focus {\n outline: ", " solid 2px;\n outline-offset: -2px;\n }\n .MuiListItem-button:hover {\n background-color: ", ";\n }\n .MuiListItem-button:active {\n background-color: ", ";\n outline: ", " solid 2px;\n outline-offset: -2px;\n }\n }\n"])), function (props) {
255
- return calculateWidth(props.margin, props.size);
256
- }, function (props) {
257
- return props.theme.optionPaddingTop;
258
- }, function (props) {
259
- return props.theme.optionPaddingBottom;
260
- }, function (props) {
261
- return props.theme.optionPaddingLeft;
262
- }, function (props) {
263
- return props.theme.optionPaddingRight;
264
- }, function (props) {
265
- return "".concat(props.width, "px");
266
- }, function (props) {
267
- return props.theme.borderThickness;
268
- }, function (props) {
269
- return props.theme.borderStyle;
270
- }, function (props) {
271
- return props.theme.borderColor;
272
- }, function (props) {
273
- return props.theme.borderRadius;
274
- }, function (props) {
275
- return props.theme.borderRadius;
276
- }, function (props) {
277
- return props.theme.scrollBarTrackColor;
278
- }, function (props) {
279
- return props.theme.scrollBarThumbColor;
280
- }, function (props) {
281
- return props.optionsIconPosition === "after" && "row-reverse" || "row";
282
- }, function (props) {
283
- return props.optionsIconPosition === "after" && "flex-end" || "";
284
- }, function (props) {
285
- return props.theme.optionBackgroundColor;
286
- }, function (props) {
287
- return props.theme.optionFontFamily;
288
- }, function (props) {
289
- return props.theme.optionFontSize;
290
- }, function (props) {
291
- return props.theme.optionFontStyle;
292
- }, function (props) {
293
- return props.theme.optionFontWeight;
294
- }, function (props) {
295
- return props.theme.optionFontColor;
296
- }, function (props) {
297
- return props.theme.focusColor;
298
- }, function (props) {
299
- return props.theme.hoverOptionBackgroundColor;
300
- }, function (props) {
301
- return props.theme.activeOptionBackgroundColor;
302
- }, function (props) {
303
- return props.theme.focusColor;
304
- });
305
-
306
- var DropdownTrigger = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: auto;\n min-height: 40px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n min-width: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n background-color: ", ";\n color: ", ";\n border-bottom-right-radius: ", ";\n border-bottom-left-radius: ", ";\n\n ", ";\n"])), function (props) {
307
- return props.disabled ? "not-allowed" : "pointer";
308
- }, function (props) {
309
- return props.theme.buttonFontFamily;
310
- }, function (props) {
311
- return props.theme.buttonFontSize;
312
- }, function (props) {
313
- return props.theme.buttonFontStyle;
314
- }, function (props) {
315
- return props.theme.buttonFontWeight;
316
- }, function (props) {
317
- return props.theme.borderRadius;
318
- }, function (props) {
319
- return props.theme.borderThickness;
320
- }, function (props) {
321
- return props.theme.borderStyle;
322
- }, function (props) {
323
- return props.disabled ? props.theme.disabledBorderColor : props.theme.borderColor;
324
- }, function (props) {
325
- return props.label === "" ? "0px" : calculateWidth(props.margin, props.size);
326
- }, function (props) {
327
- return props.theme.buttonPaddingTop;
328
- }, function (props) {
329
- return props.theme.buttonPaddingBottom;
330
- }, function (props) {
331
- return props.theme.buttonPaddingLeft;
332
- }, function (props) {
333
- return props.theme.buttonPaddingRight;
334
- }, function (props) {
335
- return props.disabled ? props.theme.disabledButtonBackgroundColor : props.theme.buttonBackgroundColor;
336
- }, function (props) {
337
- return props.disabled ? props.theme.disabledColor : props.theme.buttonFontColor;
338
- }, function (props) {
339
- return props.opened ? "0px" : props.theme.borderRadius;
340
- }, function (props) {
341
- return props.opened ? "0px" : props.theme.borderRadius;
342
- }, function (props) {
343
- return !props.disabled && " \n &:focus {\n outline: none;\n }\n &:focus-visible {\n outline: ".concat(props.theme.focusColor, " solid 2px;\n outline-offset: -2px;\n }\n &:hover {\n background-color: ").concat(props.theme.hoverButtonBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeButtonBackgroundColor, ";\n }\n ");
344
- });
345
-
346
- var DropdownTriggerLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: left;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
347
-
348
- var DropdownTriggerContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n flex-direction: ", ";\n margin-left: 0px;\n margin-right: 0px;\n width: ", ";\n white-space: nowrap;\n"])), function (props) {
349
- return props.iconPosition === "after" && "row-reverse" || "row";
350
- }, function (props) {
351
- return props.caretHidden ? "100%" : "calc(100% - 36px)";
352
- });
353
-
354
- var ButtonIcon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
355
-
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) {
357
- return props.theme.buttonIconSize;
358
- }, function (props) {
359
- return props.theme.buttonIconSize;
360
- }, function (props) {
361
- return props.iconPosition === "after" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
362
- }, function (props) {
363
- return props.iconPosition === "before" && props.label !== "" && props.theme.buttonIconSpacing || "0px";
364
- }, function (props) {
365
- return props.disabled ? props.theme.disabledColor : props.theme.buttonIconColor;
366
- });
367
-
368
- var ListIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
369
-
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) {
371
- return props.theme.optionIconSize;
372
- }, function (props) {
373
- return props.theme.optionIconSize;
374
- }, function (props) {
375
- return props.iconPosition === "after" && props.label !== "" && props.theme.optionIconSpacing || "0px";
376
- }, function (props) {
377
- return props.iconPosition === "before" && props.label !== "" && props.theme.optionIconSpacing || "0px";
378
- }, function (props) {
379
- return props.theme.optionIconColor;
380
- });
381
-
382
- var CaretIconContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n margin-left: ", ";\n color: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
383
- return props.caretHidden ? "none" : "inline-flex";
384
- }, function (props) {
385
- return props.theme.caretIconSpacing;
386
- }, function (props) {
387
- return props.disabled ? props.theme.disabledColor : props.theme.caretIconColor;
388
- }, function (props) {
389
- return props.theme.caretIconSize;
390
- }, function (props) {
391
- return props.theme.caretIconSize;
392
- });
393
-
394
- var _default = DxcDropdown;
395
- exports["default"] = _default;
@@ -1,249 +0,0 @@
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
- };