@dxc-technology/halstack-react 0.0.0-dcd93c4 → 0.0.0-dcee34a

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 (200) hide show
  1. package/HalstackContext.js +98 -50
  2. package/accordion/Accordion.js +117 -104
  3. package/accordion/Accordion.stories.tsx +103 -15
  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/alert/Alert.stories.tsx +28 -0
  12. package/bleed/Bleed.stories.tsx +63 -63
  13. package/box/Box.js +1 -1
  14. package/box/Box.stories.tsx +15 -0
  15. package/box/types.d.ts +1 -0
  16. package/bulleted-list/BulletedList.d.ts +7 -0
  17. package/bulleted-list/BulletedList.js +123 -0
  18. package/bulleted-list/BulletedList.stories.tsx +200 -0
  19. package/bulleted-list/types.d.ts +11 -0
  20. package/button/Button.js +50 -70
  21. package/button/Button.stories.tsx +159 -8
  22. package/button/types.d.ts +7 -7
  23. package/card/types.d.ts +1 -0
  24. package/checkbox/Checkbox.d.ts +2 -2
  25. package/checkbox/Checkbox.js +92 -99
  26. package/checkbox/Checkbox.stories.tsx +131 -59
  27. package/checkbox/Checkbox.test.js +93 -16
  28. package/checkbox/types.d.ts +6 -2
  29. package/chip/Chip.js +16 -22
  30. package/chip/Chip.stories.tsx +96 -9
  31. package/chip/types.d.ts +1 -1
  32. package/common/variables.js +328 -260
  33. package/date-input/Calendar.d.ts +4 -0
  34. package/date-input/Calendar.js +258 -0
  35. package/date-input/DateInput.js +134 -237
  36. package/date-input/DateInput.stories.tsx +199 -33
  37. package/date-input/DateInput.test.js +494 -138
  38. package/date-input/DatePicker.d.ts +4 -0
  39. package/date-input/DatePicker.js +146 -0
  40. package/date-input/Icons.d.ts +6 -0
  41. package/date-input/Icons.js +75 -0
  42. package/date-input/YearPicker.d.ts +4 -0
  43. package/date-input/YearPicker.js +126 -0
  44. package/date-input/types.d.ts +51 -0
  45. package/dialog/Dialog.js +50 -28
  46. package/dialog/Dialog.stories.tsx +99 -22
  47. package/dialog/Dialog.test.js +34 -4
  48. package/dialog/types.d.ts +3 -2
  49. package/dropdown/Dropdown.d.ts +1 -1
  50. package/dropdown/Dropdown.js +246 -249
  51. package/dropdown/Dropdown.stories.tsx +245 -56
  52. package/dropdown/Dropdown.test.js +504 -108
  53. package/dropdown/DropdownMenu.d.ts +4 -0
  54. package/dropdown/DropdownMenu.js +70 -0
  55. package/dropdown/DropdownMenuItem.d.ts +4 -0
  56. package/dropdown/DropdownMenuItem.js +81 -0
  57. package/dropdown/types.d.ts +25 -5
  58. package/file-input/FileInput.d.ts +2 -2
  59. package/file-input/FileInput.js +177 -219
  60. package/file-input/FileInput.stories.tsx +122 -11
  61. package/file-input/FileInput.test.js +53 -12
  62. package/file-input/FileItem.d.ts +4 -14
  63. package/file-input/FileItem.js +38 -63
  64. package/file-input/types.d.ts +17 -0
  65. package/flex/Flex.d.ts +4 -0
  66. package/flex/Flex.js +69 -0
  67. package/flex/Flex.stories.tsx +103 -0
  68. package/flex/types.d.ts +32 -0
  69. package/footer/Footer.stories.tsx +99 -1
  70. package/footer/types.d.ts +2 -1
  71. package/header/Header.js +87 -87
  72. package/header/Header.stories.tsx +152 -9
  73. package/header/Icons.js +2 -2
  74. package/header/types.d.ts +3 -2
  75. package/inset/Inset.stories.tsx +4 -4
  76. package/layout/ApplicationLayout.d.ts +15 -6
  77. package/layout/ApplicationLayout.js +36 -64
  78. package/layout/ApplicationLayout.stories.tsx +80 -44
  79. package/layout/types.d.ts +17 -27
  80. package/link/Link.js +2 -2
  81. package/link/Link.stories.tsx +72 -5
  82. package/link/types.d.ts +1 -1
  83. package/main.d.ts +6 -10
  84. package/main.js +28 -60
  85. package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
  86. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  87. package/{tabs-nav → nav-tabs}/Tab.js +37 -20
  88. package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
  89. package/number-input/NumberInput.test.js +43 -7
  90. package/package.json +16 -21
  91. package/paginator/Icons.d.ts +5 -0
  92. package/paginator/Icons.js +16 -28
  93. package/paginator/Paginator.js +6 -12
  94. package/paginator/Paginator.stories.tsx +24 -0
  95. package/paginator/Paginator.test.js +18 -11
  96. package/paragraph/Paragraph.d.ts +6 -0
  97. package/paragraph/Paragraph.js +38 -0
  98. package/paragraph/Paragraph.stories.tsx +44 -0
  99. package/password-input/PasswordInput.test.js +13 -12
  100. package/progress-bar/ProgressBar.d.ts +2 -2
  101. package/progress-bar/ProgressBar.js +59 -53
  102. package/progress-bar/ProgressBar.stories.jsx +38 -3
  103. package/progress-bar/ProgressBar.test.js +67 -22
  104. package/progress-bar/types.d.ts +3 -4
  105. package/quick-nav/QuickNav.js +18 -17
  106. package/quick-nav/QuickNav.stories.tsx +145 -26
  107. package/radio-group/Radio.d.ts +1 -1
  108. package/radio-group/Radio.js +43 -28
  109. package/radio-group/RadioGroup.js +24 -24
  110. package/radio-group/RadioGroup.stories.tsx +132 -18
  111. package/radio-group/RadioGroup.test.js +123 -96
  112. package/radio-group/types.d.ts +2 -2
  113. package/resultsetTable/Icons.d.ts +7 -0
  114. package/resultsetTable/Icons.js +51 -0
  115. package/resultsetTable/ResultsetTable.js +48 -107
  116. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  117. package/resultsetTable/ResultsetTable.test.js +40 -63
  118. package/resultsetTable/types.d.ts +2 -2
  119. package/select/Listbox.js +4 -10
  120. package/select/Option.js +11 -24
  121. package/select/Select.js +54 -50
  122. package/select/Select.stories.tsx +494 -149
  123. package/select/Select.test.js +338 -272
  124. package/select/types.d.ts +3 -5
  125. package/sidenav/Sidenav.d.ts +6 -5
  126. package/sidenav/Sidenav.js +174 -55
  127. package/sidenav/Sidenav.stories.tsx +249 -149
  128. package/sidenav/Sidenav.test.js +25 -37
  129. package/sidenav/types.d.ts +50 -27
  130. package/slider/Slider.d.ts +2 -2
  131. package/slider/Slider.js +120 -95
  132. package/slider/Slider.stories.tsx +64 -1
  133. package/slider/Slider.test.js +121 -21
  134. package/slider/types.d.ts +6 -2
  135. package/spinner/Spinner.js +2 -2
  136. package/spinner/Spinner.stories.jsx +27 -1
  137. package/switch/Switch.d.ts +2 -2
  138. package/switch/Switch.js +135 -68
  139. package/switch/Switch.stories.tsx +41 -30
  140. package/switch/Switch.test.js +144 -17
  141. package/switch/types.d.ts +6 -2
  142. package/table/Table.js +1 -1
  143. package/table/Table.stories.jsx +80 -1
  144. package/table/Table.test.js +1 -1
  145. package/tabs/Tab.d.ts +4 -0
  146. package/tabs/Tab.js +133 -0
  147. package/tabs/Tabs.js +360 -104
  148. package/tabs/Tabs.stories.tsx +119 -5
  149. package/tabs/Tabs.test.js +217 -6
  150. package/tabs/types.d.ts +15 -5
  151. package/tag/Tag.js +1 -1
  152. package/tag/Tag.stories.tsx +14 -1
  153. package/tag/types.d.ts +1 -1
  154. package/text-input/Icons.d.ts +8 -0
  155. package/text-input/Icons.js +60 -0
  156. package/text-input/Suggestion.js +38 -9
  157. package/text-input/Suggestions.d.ts +4 -0
  158. package/text-input/Suggestions.js +134 -0
  159. package/text-input/TextInput.js +195 -292
  160. package/text-input/TextInput.stories.tsx +280 -185
  161. package/text-input/TextInput.test.js +737 -725
  162. package/text-input/types.d.ts +22 -3
  163. package/textarea/Textarea.stories.jsx +60 -1
  164. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  165. package/toggle-group/types.d.ts +1 -1
  166. package/typography/Typography.d.ts +4 -0
  167. package/typography/Typography.js +131 -0
  168. package/typography/Typography.stories.tsx +198 -0
  169. package/typography/types.d.ts +18 -0
  170. package/wizard/Wizard.js +9 -16
  171. package/wizard/Wizard.stories.tsx +40 -1
  172. package/wizard/types.d.ts +5 -4
  173. package/common/RequiredComponent.js +0 -32
  174. package/inline/Inline.d.ts +0 -4
  175. package/inline/Inline.js +0 -60
  176. package/inline/Inline.stories.tsx +0 -319
  177. package/inline/types.d.ts +0 -36
  178. package/list/List.d.ts +0 -4
  179. package/list/List.js +0 -47
  180. package/list/List.stories.tsx +0 -89
  181. package/list/types.d.ts +0 -7
  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 -28
  186. package/stack/Stack.d.ts +0 -4
  187. package/stack/Stack.js +0 -56
  188. package/stack/Stack.stories.tsx +0 -263
  189. package/stack/types.d.ts +0 -32
  190. package/tabs-nav/types.js +0 -5
  191. package/text/Text.d.ts +0 -7
  192. package/text/Text.js +0 -30
  193. package/text/Text.stories.tsx +0 -19
  194. /package/{inline → bulleted-list}/types.js +0 -0
  195. /package/{list → flex}/types.js +0 -0
  196. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  197. /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
  198. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  199. /package/{row → nav-tabs}/types.js +0 -0
  200. /package/{stack → typography}/types.js +0 -0
@@ -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,70 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _DropdownMenuItem = _interopRequireDefault(require("./DropdownMenuItem"));
17
+
18
+ var _templateObject;
19
+
20
+ var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
21
+ var id = _ref.id,
22
+ dropdownTriggerId = _ref.dropdownTriggerId,
23
+ iconsPosition = _ref.iconsPosition,
24
+ visualFocusIndex = _ref.visualFocusIndex,
25
+ menuItemOnClick = _ref.menuItemOnClick,
26
+ onKeyDown = _ref.onKeyDown,
27
+ options = _ref.options,
28
+ styles = _ref.styles;
29
+ return /*#__PURE__*/_react["default"].createElement(DropdownMenuContainer, {
30
+ onMouseDown: function onMouseDown(event) {
31
+ // Prevent the onBlur event from closing menu when clicking on the menu since
32
+ // it is implemented with a Portal and the menu is not a direct child of the container
33
+ event.preventDefault();
34
+ },
35
+ onKeyDown: onKeyDown,
36
+ id: id,
37
+ role: "menu",
38
+ "aria-labelledby": dropdownTriggerId,
39
+ "aria-orientation": "vertical",
40
+ "aria-activedescendant": "option-".concat(visualFocusIndex),
41
+ tabIndex: -1,
42
+ ref: ref,
43
+ style: styles
44
+ }, options.map(function (option, index) {
45
+ return /*#__PURE__*/_react["default"].createElement(_DropdownMenuItem["default"], {
46
+ id: "option-".concat(index),
47
+ key: "option-".concat(index),
48
+ visuallyFocused: index === visualFocusIndex,
49
+ iconPosition: iconsPosition,
50
+ onClick: menuItemOnClick,
51
+ option: option
52
+ });
53
+ }));
54
+ });
55
+
56
+ var DropdownMenuContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 230px;\n min-width: min-content;\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) {
57
+ return props.theme.optionBackgroundColor;
58
+ }, function (props) {
59
+ return props.theme.borderThickness;
60
+ }, function (props) {
61
+ return props.theme.borderStyle;
62
+ }, function (props) {
63
+ return props.theme.borderColor;
64
+ }, function (props) {
65
+ return props.theme.borderRadius;
66
+ });
67
+
68
+ var _default = /*#__PURE__*/_react["default"].memo(DropdownMenu);
69
+
70
+ 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,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _templateObject, _templateObject2, _templateObject3;
17
+
18
+ var DropdownMenuItem = function DropdownMenuItem(_ref) {
19
+ var id = _ref.id,
20
+ visuallyFocused = _ref.visuallyFocused,
21
+ iconPosition = _ref.iconPosition,
22
+ _onClick = _ref.onClick,
23
+ option = _ref.option;
24
+ return /*#__PURE__*/_react["default"].createElement(DropdownMenuItemContainer, {
25
+ visuallyFocused: visuallyFocused,
26
+ onClick: function onClick() {
27
+ _onClick(option.value);
28
+ },
29
+ id: id,
30
+ role: "menuitem",
31
+ tabIndex: -1
32
+ }, iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label), option.icon && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemIcon, {
33
+ iconPosition: iconPosition,
34
+ label: option.label,
35
+ role: typeof option.icon === "string" ? undefined : "img"
36
+ }, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
37
+ src: option.icon
38
+ }) : option.icon), iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label));
39
+ };
40
+
41
+ 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) {
42
+ return props.theme.optionIconSpacing;
43
+ }, function (props) {
44
+ return props.theme.optionPaddingTop;
45
+ }, function (props) {
46
+ return props.theme.optionPaddingBottom;
47
+ }, function (props) {
48
+ return props.theme.optionPaddingLeft;
49
+ }, function (props) {
50
+ return props.theme.optionPaddingRight;
51
+ }, function (props) {
52
+ return props.visuallyFocused && "outline: ".concat(props.theme.focusColor, " solid 2px; outline-offset: -2px;");
53
+ }, function (props) {
54
+ return props.theme.hoverOptionBackgroundColor;
55
+ }, function (props) {
56
+ return props.theme.activeOptionBackgroundColor;
57
+ });
58
+
59
+ 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 white-space: nowrap;\n"])), function (props) {
60
+ return props.theme.optionFontFamily;
61
+ }, function (props) {
62
+ return props.theme.optionFontSize;
63
+ }, function (props) {
64
+ return props.theme.optionFontStyle;
65
+ }, function (props) {
66
+ return props.theme.optionFontWeight;
67
+ }, function (props) {
68
+ return props.theme.optionFontColor;
69
+ });
70
+
71
+ 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) {
72
+ return props.theme.optionIconColor;
73
+ }, function (props) {
74
+ return props.theme.optionIconSize;
75
+ }, function (props) {
76
+ return props.theme.optionIconSize;
77
+ });
78
+
79
+ var _default = /*#__PURE__*/_react["default"].memo(DropdownMenuItem);
80
+
81
+ 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;