@dxc-technology/halstack-react 0.0.0-ebf4fe2 → 0.0.0-ec06b53

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 (179) hide show
  1. package/HalstackContext.js +7 -8
  2. package/accordion/Accordion.js +122 -103
  3. package/accordion/Accordion.stories.tsx +2 -3
  4. package/accordion/Accordion.test.js +9 -10
  5. package/accordion/types.d.ts +5 -4
  6. package/accordion-group/AccordionGroup.js +1 -21
  7. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  8. package/accordion-group/AccordionGroup.test.js +20 -45
  9. package/accordion-group/types.d.ts +10 -3
  10. package/alert/Alert.js +1 -1
  11. package/bleed/Bleed.stories.tsx +63 -63
  12. package/box/Box.js +1 -1
  13. package/box/types.d.ts +1 -0
  14. package/bulleted-list/BulletedList.d.ts +7 -0
  15. package/bulleted-list/BulletedList.js +123 -0
  16. package/bulleted-list/BulletedList.stories.tsx +200 -0
  17. package/bulleted-list/types.d.ts +11 -0
  18. package/{inline → bulleted-list}/types.js +0 -0
  19. package/button/Button.js +43 -61
  20. package/button/Button.stories.tsx +9 -0
  21. package/button/types.d.ts +7 -7
  22. package/card/types.d.ts +1 -0
  23. package/checkbox/Checkbox.d.ts +2 -2
  24. package/checkbox/Checkbox.js +92 -99
  25. package/checkbox/Checkbox.stories.tsx +79 -59
  26. package/checkbox/Checkbox.test.js +93 -16
  27. package/checkbox/types.d.ts +6 -2
  28. package/chip/types.d.ts +1 -1
  29. package/common/variables.js +75 -33
  30. package/date-input/Calendar.d.ts +4 -0
  31. package/date-input/Calendar.js +258 -0
  32. package/date-input/DateInput.js +77 -222
  33. package/date-input/DateInput.stories.tsx +30 -17
  34. package/date-input/DateInput.test.js +411 -138
  35. package/date-input/DatePicker.d.ts +4 -0
  36. package/date-input/DatePicker.js +160 -0
  37. package/date-input/YearPicker.d.ts +4 -0
  38. package/date-input/YearPicker.js +115 -0
  39. package/date-input/types.d.ts +53 -0
  40. package/dialog/Dialog.js +52 -28
  41. package/dialog/Dialog.stories.tsx +57 -2
  42. package/dialog/Dialog.test.js +34 -4
  43. package/dialog/types.d.ts +3 -2
  44. package/dropdown/Dropdown.d.ts +1 -1
  45. package/dropdown/Dropdown.js +247 -247
  46. package/dropdown/Dropdown.stories.tsx +126 -63
  47. package/dropdown/Dropdown.test.js +504 -108
  48. package/dropdown/DropdownMenu.d.ts +4 -0
  49. package/dropdown/DropdownMenu.js +80 -0
  50. package/dropdown/DropdownMenuItem.d.ts +4 -0
  51. package/dropdown/DropdownMenuItem.js +92 -0
  52. package/dropdown/types.d.ts +25 -5
  53. package/file-input/FileInput.d.ts +2 -2
  54. package/file-input/FileInput.js +177 -219
  55. package/file-input/FileInput.stories.tsx +38 -10
  56. package/file-input/FileInput.test.js +53 -12
  57. package/file-input/FileItem.d.ts +4 -14
  58. package/file-input/FileItem.js +38 -63
  59. package/file-input/types.d.ts +17 -0
  60. package/flex/Flex.d.ts +4 -0
  61. package/flex/Flex.js +69 -0
  62. package/flex/Flex.stories.tsx +103 -0
  63. package/flex/types.d.ts +32 -0
  64. package/{list → flex}/types.js +0 -0
  65. package/footer/Footer.stories.tsx +8 -1
  66. package/footer/types.d.ts +2 -1
  67. package/header/Header.js +74 -72
  68. package/header/Header.stories.tsx +4 -4
  69. package/header/Icons.js +2 -2
  70. package/header/types.d.ts +3 -2
  71. package/inset/Inset.stories.tsx +4 -4
  72. package/layout/ApplicationLayout.d.ts +15 -6
  73. package/layout/ApplicationLayout.js +36 -64
  74. package/layout/ApplicationLayout.stories.tsx +80 -44
  75. package/layout/types.d.ts +17 -27
  76. package/link/Link.js +2 -2
  77. package/link/Link.stories.tsx +13 -6
  78. package/link/types.d.ts +1 -1
  79. package/main.d.ts +5 -9
  80. package/main.js +27 -59
  81. package/number-input/NumberInput.test.js +43 -7
  82. package/package.json +16 -20
  83. package/paginator/Paginator.js +2 -2
  84. package/paginator/Paginator.test.js +1 -1
  85. package/paragraph/Paragraph.d.ts +6 -0
  86. package/paragraph/Paragraph.js +38 -0
  87. package/paragraph/Paragraph.stories.tsx +44 -0
  88. package/password-input/PasswordInput.test.js +13 -12
  89. package/progress-bar/ProgressBar.d.ts +2 -2
  90. package/progress-bar/ProgressBar.js +56 -50
  91. package/progress-bar/ProgressBar.stories.jsx +3 -1
  92. package/progress-bar/ProgressBar.test.js +67 -22
  93. package/progress-bar/types.d.ts +3 -4
  94. package/quick-nav/QuickNav.js +18 -17
  95. package/quick-nav/QuickNav.stories.tsx +131 -26
  96. package/radio-group/Radio.d.ts +1 -1
  97. package/radio-group/Radio.js +43 -28
  98. package/radio-group/RadioGroup.js +23 -22
  99. package/radio-group/RadioGroup.stories.tsx +1 -0
  100. package/radio-group/RadioGroup.test.js +123 -96
  101. package/radio-group/types.d.ts +2 -2
  102. package/resultsetTable/Icons.d.ts +7 -0
  103. package/resultsetTable/Icons.js +51 -0
  104. package/resultsetTable/ResultsetTable.js +48 -107
  105. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  106. package/resultsetTable/ResultsetTable.test.js +23 -41
  107. package/resultsetTable/types.d.ts +2 -2
  108. package/select/Listbox.d.ts +1 -1
  109. package/select/Listbox.js +25 -2
  110. package/select/Select.js +17 -32
  111. package/select/Select.stories.tsx +6 -5
  112. package/select/Select.test.js +321 -250
  113. package/select/types.d.ts +2 -4
  114. package/sidenav/Sidenav.d.ts +6 -5
  115. package/sidenav/Sidenav.js +176 -55
  116. package/sidenav/Sidenav.stories.tsx +154 -156
  117. package/sidenav/Sidenav.test.js +25 -37
  118. package/sidenav/types.d.ts +50 -27
  119. package/slider/Slider.d.ts +2 -2
  120. package/slider/Slider.js +120 -95
  121. package/slider/Slider.stories.tsx +7 -1
  122. package/slider/Slider.test.js +121 -21
  123. package/slider/types.d.ts +6 -2
  124. package/switch/Switch.d.ts +2 -2
  125. package/switch/Switch.js +135 -68
  126. package/switch/Switch.stories.tsx +8 -30
  127. package/switch/Switch.test.js +144 -17
  128. package/switch/types.d.ts +6 -2
  129. package/table/Table.js +1 -1
  130. package/table/Table.test.js +1 -1
  131. package/tabs/Tab.d.ts +4 -0
  132. package/tabs/Tab.js +135 -0
  133. package/tabs/Tabs.js +360 -104
  134. package/tabs/Tabs.stories.tsx +74 -0
  135. package/tabs/Tabs.test.js +217 -6
  136. package/tabs/types.d.ts +15 -5
  137. package/tabs-nav/NavTabs.js +5 -5
  138. package/tabs-nav/Tab.js +3 -5
  139. package/tabs-nav/types.d.ts +1 -1
  140. package/tag/Tag.js +1 -1
  141. package/tag/types.d.ts +1 -1
  142. package/text-input/Icons.d.ts +8 -0
  143. package/text-input/Icons.js +60 -0
  144. package/text-input/Suggestion.js +7 -5
  145. package/text-input/Suggestions.d.ts +4 -0
  146. package/text-input/Suggestions.js +134 -0
  147. package/text-input/TextInput.js +189 -282
  148. package/text-input/TextInput.stories.tsx +189 -182
  149. package/text-input/TextInput.test.js +639 -727
  150. package/text-input/types.d.ts +22 -3
  151. package/toggle-group/types.d.ts +1 -1
  152. package/typography/Typography.d.ts +4 -0
  153. package/typography/Typography.js +131 -0
  154. package/typography/Typography.stories.tsx +198 -0
  155. package/typography/types.d.ts +18 -0
  156. package/{row → typography}/types.js +0 -0
  157. package/wizard/Wizard.js +9 -16
  158. package/wizard/Wizard.stories.tsx +20 -1
  159. package/wizard/types.d.ts +5 -4
  160. package/inline/Inline.d.ts +0 -4
  161. package/inline/Inline.js +0 -60
  162. package/inline/Inline.stories.tsx +0 -305
  163. package/inline/types.d.ts +0 -36
  164. package/list/List.d.ts +0 -4
  165. package/list/List.js +0 -47
  166. package/list/List.stories.tsx +0 -89
  167. package/list/types.d.ts +0 -7
  168. package/row/Row.d.ts +0 -3
  169. package/row/Row.js +0 -127
  170. package/row/Row.stories.tsx +0 -237
  171. package/row/types.d.ts +0 -28
  172. package/stack/Stack.d.ts +0 -4
  173. package/stack/Stack.js +0 -52
  174. package/stack/Stack.stories.tsx +0 -225
  175. package/stack/types.d.ts +0 -28
  176. package/stack/types.js +0 -5
  177. package/text/Text.d.ts +0 -7
  178. package/text/Text.js +0 -30
  179. package/text/Text.stories.tsx +0 -19
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { DropdownMenuProps } from "./types";
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DropdownMenuProps & React.RefAttributes<HTMLUListElement>>>;
4
+ export default _default;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
+
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
19
+
20
+ var _DropdownMenuItem = _interopRequireDefault(require("./DropdownMenuItem"));
21
+
22
+ var _templateObject;
23
+
24
+ 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); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
27
+
28
+ var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
29
+ var id = _ref.id,
30
+ dropdownTriggerId = _ref.dropdownTriggerId,
31
+ iconsPosition = _ref.iconsPosition,
32
+ visualFocusIndex = _ref.visualFocusIndex,
33
+ menuItemOnClick = _ref.menuItemOnClick,
34
+ onKeyDown = _ref.onKeyDown,
35
+ options = _ref.options,
36
+ styles = _ref.styles;
37
+ var colorsTheme = (0, _useTheme["default"])();
38
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
39
+ theme: colorsTheme.dropdown
40
+ }, /*#__PURE__*/_react["default"].createElement(DropdownMenuContainer, {
41
+ onMouseDown: function onMouseDown(event) {
42
+ // Prevent the onBlur event from closing menu when clicking on the menu since it is implemented with a Portal and the menu is not a child of the container
43
+ event.preventDefault();
44
+ },
45
+ onKeyDown: onKeyDown,
46
+ id: id,
47
+ role: "menu",
48
+ "aria-labelledby": dropdownTriggerId,
49
+ "aria-orientation": "vertical",
50
+ "aria-activedescendant": "option-".concat(visualFocusIndex),
51
+ tabIndex: -1,
52
+ style: styles,
53
+ ref: ref
54
+ }, options.map(function (option, index) {
55
+ return /*#__PURE__*/_react["default"].createElement(_DropdownMenuItem["default"], {
56
+ id: "option-".concat(index),
57
+ key: "option-".concat(index),
58
+ visuallyFocused: index === visualFocusIndex,
59
+ iconPosition: iconsPosition,
60
+ onClick: menuItemOnClick,
61
+ option: option
62
+ });
63
+ })));
64
+ });
65
+
66
+ var DropdownMenuContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 230px;\n overflow-y: auto;\n padding: 0;\n margin: 0;\n background-color: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-radius: ", ";\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n outline: none;\n"])), function (props) {
67
+ return props.theme.optionBackgroundColor;
68
+ }, function (props) {
69
+ return props.theme.borderThickness;
70
+ }, function (props) {
71
+ return props.theme.borderStyle;
72
+ }, function (props) {
73
+ return props.theme.borderColor;
74
+ }, function (props) {
75
+ return props.theme.borderRadius;
76
+ });
77
+
78
+ var _default = /*#__PURE__*/_react["default"].memo(DropdownMenu);
79
+
80
+ exports["default"] = _default;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { DropdownMenuItemProps } from "./types";
3
+ declare const _default: React.MemoExoticComponent<({ id, visuallyFocused, iconPosition, onClick, option, }: DropdownMenuItemProps) => JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
+
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
19
+
20
+ var _templateObject, _templateObject2, _templateObject3;
21
+
22
+ 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); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
25
+
26
+ var DropdownMenuItem = function DropdownMenuItem(_ref) {
27
+ var id = _ref.id,
28
+ visuallyFocused = _ref.visuallyFocused,
29
+ iconPosition = _ref.iconPosition,
30
+ _onClick = _ref.onClick,
31
+ option = _ref.option;
32
+ var colorsTheme = (0, _useTheme["default"])();
33
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
34
+ theme: colorsTheme.dropdown
35
+ }, /*#__PURE__*/_react["default"].createElement(DropdownMenuItemContainer, {
36
+ visuallyFocused: visuallyFocused,
37
+ onClick: function onClick() {
38
+ _onClick(option.value);
39
+ },
40
+ id: id,
41
+ role: "menuitem",
42
+ tabIndex: -1
43
+ }, iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label), option.icon && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemIcon, {
44
+ iconPosition: iconPosition,
45
+ label: option.label,
46
+ role: typeof option.icon === "string" ? undefined : "img"
47
+ }, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
48
+ src: option.icon
49
+ }) : option.icon), iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label)));
50
+ };
51
+
52
+ var DropdownMenuItemContainer = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: ", ";\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n cursor: pointer;\n\n ", "\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
53
+ return props.theme.optionIconSpacing;
54
+ }, function (props) {
55
+ return props.theme.optionPaddingTop;
56
+ }, function (props) {
57
+ return props.theme.optionPaddingBottom;
58
+ }, function (props) {
59
+ return props.theme.optionPaddingLeft;
60
+ }, function (props) {
61
+ return props.theme.optionPaddingRight;
62
+ }, function (props) {
63
+ return props.visuallyFocused && "outline: ".concat(props.theme.focusColor, " solid 2px; outline-offset: -2px;");
64
+ }, function (props) {
65
+ return props.theme.hoverOptionBackgroundColor;
66
+ }, function (props) {
67
+ return props.theme.activeOptionBackgroundColor;
68
+ });
69
+
70
+ var DropdownMenuItemLabel = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5rem;\n color: ", ";\n"])), function (props) {
71
+ return props.theme.optionFontFamily;
72
+ }, function (props) {
73
+ return props.theme.optionFontSize;
74
+ }, function (props) {
75
+ return props.theme.optionFontStyle;
76
+ }, function (props) {
77
+ return props.theme.optionFontWeight;
78
+ }, function (props) {
79
+ return props.theme.optionFontColor;
80
+ });
81
+
82
+ var DropdownMenuItemIcon = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n color: ", ";\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
83
+ return props.theme.optionIconColor;
84
+ }, function (props) {
85
+ return props.theme.optionIconSize;
86
+ }, function (props) {
87
+ return props.theme.optionIconSize;
88
+ });
89
+
90
+ var _default = /*#__PURE__*/_react["default"].memo(DropdownMenuItem);
91
+
92
+ exports["default"] = _default;
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ export declare type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement>;
10
- declare type Option = {
9
+ export declare type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
10
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
11
+ export declare type Option = {
11
12
  /**
12
13
  * Option display value.
13
14
  */
@@ -67,7 +68,7 @@ declare type Props = {
67
68
  /**
68
69
  * Size of the component.
69
70
  */
70
- size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
71
+ size?: Size;
71
72
  /**
72
73
  * Value of the tabindex.
73
74
  */
@@ -77,4 +78,23 @@ declare type Props = {
77
78
  */
78
79
  disabled?: boolean;
79
80
  };
81
+ export declare type DropdownMenuProps = {
82
+ id: string;
83
+ dropdownTriggerId: string;
84
+ iconsPosition: "before" | "after";
85
+ visualFocusIndex: number;
86
+ menuItemOnClick: (value: string) => void;
87
+ onKeyDown: (event: React.KeyboardEvent<HTMLUListElement>) => void;
88
+ options: Option[];
89
+ styles: {
90
+ width: number;
91
+ };
92
+ };
93
+ export declare type DropdownMenuItemProps = {
94
+ id: string;
95
+ visuallyFocused: boolean;
96
+ iconPosition: "before" | "after";
97
+ onClick: (value: string) => void;
98
+ option: Option;
99
+ };
80
100
  export default Props;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
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;
3
+ declare const DxcFileInput: React.ForwardRefExoticComponent<FileInputPropsType & React.RefAttributes<HTMLDivElement>>;
4
4
  export default DxcFileInput;