@dxc-technology/halstack-react 0.0.0-1819a7a → 0.0.0-1853afe

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 (84) hide show
  1. package/BackgroundColorContext.js +0 -1
  2. package/accordion/Accordion.d.ts +1 -1
  3. package/accordion/Accordion.js +9 -20
  4. package/accordion/Accordion.stories.tsx +9 -2
  5. package/accordion/types.d.ts +3 -7
  6. package/accordion-group/types.d.ts +3 -7
  7. package/bleed/Bleed.d.ts +3 -0
  8. package/bleed/Bleed.js +84 -0
  9. package/bleed/Bleed.stories.tsx +342 -0
  10. package/bleed/types.d.ts +13 -0
  11. package/bleed/types.js +5 -0
  12. package/button/Button.d.ts +1 -1
  13. package/button/Button.js +7 -15
  14. package/button/Button.stories.tsx +6 -8
  15. package/button/types.d.ts +3 -7
  16. package/card/Card.stories.tsx +1 -1
  17. package/checkbox/types.d.ts +1 -1
  18. package/chip/Chip.d.ts +1 -1
  19. package/chip/Chip.js +14 -52
  20. package/chip/Chip.stories.tsx +6 -8
  21. package/chip/types.d.ts +5 -13
  22. package/common/variables.js +38 -1
  23. package/date-input/DateInput.js +6 -6
  24. package/dialog/Dialog.js +2 -1
  25. package/dropdown/Dropdown.stories.tsx +247 -0
  26. package/file-input/FileInput.js +102 -33
  27. package/file-input/FileInput.stories.tsx +507 -0
  28. package/footer/Footer.js +18 -20
  29. package/heading/Heading.stories.tsx +3 -2
  30. package/inset/Inset.d.ts +3 -0
  31. package/inset/Inset.js +84 -0
  32. package/inset/Inset.stories.tsx +229 -0
  33. package/inset/types.d.ts +13 -0
  34. package/inset/types.js +5 -0
  35. package/layout/ApplicationLayout.js +1 -1
  36. package/list/List.d.ts +3 -6
  37. package/list/List.js +17 -7
  38. package/list/List.stories.tsx +25 -0
  39. package/list/types.d.ts +7 -0
  40. package/list/types.js +5 -0
  41. package/package.json +4 -2
  42. package/password-input/PasswordInput.stories.tsx +3 -3
  43. package/progress-bar/ProgressBar.js +2 -2
  44. package/radio-group/Radio.d.ts +4 -0
  45. package/radio-group/Radio.js +140 -0
  46. package/radio-group/RadioGroup.d.ts +4 -0
  47. package/radio-group/RadioGroup.js +273 -0
  48. package/radio-group/RadioGroup.stories.tsx +79 -0
  49. package/radio-group/RadioGroup.test.js +248 -0
  50. package/radio-group/types.d.ts +36 -0
  51. package/radio-group/types.js +5 -0
  52. package/resultsetTable/ResultsetTable.js +1 -1
  53. package/resultsetTable/ResultsetTable.stories.tsx +7 -8
  54. package/row/Row.d.ts +3 -11
  55. package/row/Row.js +12 -9
  56. package/row/Row.stories.tsx +20 -6
  57. package/row/types.d.ts +10 -0
  58. package/row/types.js +5 -0
  59. package/select/Select.d.ts +4 -0
  60. package/select/Select.js +5 -5
  61. package/select/types.d.ts +170 -0
  62. package/select/types.js +5 -0
  63. package/sidenav/Sidenav.stories.tsx +18 -1
  64. package/spinner/Spinner.stories.jsx +1 -0
  65. package/stack/Stack.d.ts +3 -10
  66. package/stack/Stack.js +12 -9
  67. package/stack/Stack.stories.tsx +20 -6
  68. package/stack/types.d.ts +9 -0
  69. package/stack/types.js +5 -0
  70. package/switch/Switch.stories.tsx +1 -1
  71. package/table/Table.stories.jsx +2 -1
  72. package/tabs/Tabs.js +7 -7
  73. package/tabs/Tabs.stories.tsx +7 -8
  74. package/tabs/types.d.ts +23 -15
  75. package/tag/Tag.stories.tsx +1 -1
  76. package/text/Text.js +1 -1
  77. package/text-input/TextInput.js +12 -4
  78. package/text-input/TextInput.stories.tsx +4 -4
  79. package/text-input/types.d.ts +1 -1
  80. package/textarea/Textarea.stories.jsx +4 -3
  81. package/toggle-group/ToggleGroup.js +10 -13
  82. package/toggle-group/ToggleGroup.stories.tsx +23 -28
  83. package/toggle-group/types.d.ts +38 -25
  84. package/select/index.d.ts +0 -131
package/button/Button.js CHANGED
@@ -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 _react = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
@@ -45,8 +45,6 @@ var DxcButton = function DxcButton(_ref) {
45
45
  _ref$type = _ref.type,
46
46
  type = _ref$type === void 0 ? "button" : _ref$type,
47
47
  icon = _ref.icon,
48
- _ref$iconSrc = _ref.iconSrc,
49
- iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
50
48
  _onClick = _ref.onClick,
51
49
  margin = _ref.margin,
52
50
  _ref$size = _ref.size,
@@ -78,14 +76,12 @@ var DxcButton = function DxcButton(_ref) {
78
76
  }, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
79
77
  icon: icon,
80
78
  iconPosition: iconPosition
81
- }, label), icon ? /*#__PURE__*/_react["default"].createElement(IconContainer, {
79
+ }, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
82
80
  label: label,
83
81
  iconPosition: iconPosition
84
- }, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : iconSrc && /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
85
- label: label,
86
- iconPosition: iconPosition,
87
- src: iconSrc
88
- }))));
82
+ }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
83
+ src: icon
84
+ }) : icon))));
89
85
  };
90
86
 
91
87
  var sizes = {
@@ -120,11 +116,7 @@ var IconContainer = _styledComponents["default"].div(_templateObject2 || (_templ
120
116
  return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
121
117
  });
122
118
 
123
- var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
124
- return props.iconPosition === "after" && props.label !== "" && "10px" || "0px";
125
- }, function (props) {
126
- return props.iconPosition === "before" && props.label !== "" && "10px" || "0px";
127
- });
119
+ var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
128
120
 
129
121
  var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-block;\n width: ", ";\n cursor: ", ";\n\n .MuiButtonBase-root {\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n\n .MuiButton-label {\n display: flex;\n flex-direction: ", ";\n align-items: center;\n }\n\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n min-width: ", ";\n width: 100%;\n height: 40px;\n transition: none !important;\n\n &:focus {\n border-color: transparent;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n ", "\n }\n"])), function (props) {
130
122
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
@@ -10,14 +10,12 @@ export default {
10
10
  component: DxcButton,
11
11
  };
12
12
 
13
- const iconSVG = () => {
14
- return (
15
- <svg viewBox="0 0 24 24" fill="currentColor">
16
- <path d="M0 0h24v24H0z" fill="none" />
17
- <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" />
18
- </svg>
19
- );
20
- };
13
+ const iconSVG = (
14
+ <svg viewBox="0 0 24 24" fill="currentColor">
15
+ <path d="M0 0h24v24H0z" fill="none" />
16
+ <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" />
17
+ </svg>
18
+ );
21
19
  export const Chromatic = () => (
22
20
  <>
23
21
  <Title title="Primary" theme="light" level={2} />
package/button/types.d.ts CHANGED
@@ -6,7 +6,7 @@ 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 Props = {
11
11
  /**
12
12
  * Text to be placed next to the button.
@@ -29,13 +29,9 @@ declare type Props = {
29
29
  */
30
30
  type?: "button" | "reset" | "submit";
31
31
  /**
32
- * Element used as the icon that will be placed next to the button label.
32
+ * Element or path used as the icon that will be placed next to the button label.
33
33
  */
34
- icon?: SVG;
35
- /**
36
- * @deprecated URL of the icon that will be placed next to the button label.
37
- */
38
- iconSrc?: string;
34
+ icon?: string | SVG;
39
35
  /**
40
36
  * This function will be called when the user clicks the button.
41
37
  */
@@ -174,7 +174,7 @@ const actionCard = () => (
174
174
  <Title title="Focused default with action" theme="light" level={4} />
175
175
  <DxcCard onClick={() => {}}>Focused default with action</DxcCard>
176
176
  </ExampleContainer>
177
- <ExampleContainer>
177
+ <ExampleContainer expanded>
178
178
  <Title title="Hovered default with action" theme="light" level={4} />
179
179
  <DxcCard onClick={() => {}}>Hovered default with action</DxcCard>
180
180
  </ExampleContainer>
@@ -19,7 +19,7 @@ declare type Props = {
19
19
  /**
20
20
  * Text to be placed next to the checkbox.
21
21
  */
22
- label: string;
22
+ label?: string;
23
23
  /**
24
24
  * Whether the label should appear after or before the checkbox.
25
25
  */
package/chip/Chip.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import ChipPropsType from "./types";
3
- declare const DxcChip: ({ label, suffixIcon, prefixIcon, suffixIconSrc, onClickSuffix, prefixIconSrc, onClickPrefix, disabled, margin, tabIndex, }: ChipPropsType) => JSX.Element;
3
+ declare const DxcChip: ({ label, suffixIcon, prefixIcon, onClickSuffix, onClickPrefix, disabled, margin, tabIndex, }: ChipPropsType) => JSX.Element;
4
4
  export default DxcChip;
package/chip/Chip.js CHANGED
@@ -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 _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
@@ -33,9 +33,7 @@ var DxcChip = function DxcChip(_ref) {
33
33
  var label = _ref.label,
34
34
  suffixIcon = _ref.suffixIcon,
35
35
  prefixIcon = _ref.prefixIcon,
36
- suffixIconSrc = _ref.suffixIconSrc,
37
36
  onClickSuffix = _ref.onClickSuffix,
38
- prefixIconSrc = _ref.prefixIconSrc,
39
37
  onClickPrefix = _ref.onClickPrefix,
40
38
  disabled = _ref.disabled,
41
39
  margin = _ref.margin,
@@ -47,7 +45,7 @@ var DxcChip = function DxcChip(_ref) {
47
45
  }, /*#__PURE__*/_react["default"].createElement(StyledDxcChip, {
48
46
  disabled: disabled,
49
47
  margin: margin
50
- }, prefixIcon ? /*#__PURE__*/_react["default"].createElement(IconContainer, {
48
+ }, prefixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
51
49
  disabled: disabled,
52
50
  prefixIcon: true,
53
51
  label: label,
@@ -57,20 +55,11 @@ var DxcChip = function DxcChip(_ref) {
57
55
  return onClickPrefix && !disabled && onClickPrefix();
58
56
  },
59
57
  interactuable: typeof onClickPrefix === "function" && !disabled
60
- }, (0, _typeof2["default"])(prefixIcon) === "object" ? prefixIcon : /*#__PURE__*/_react["default"].createElement(prefixIcon)) : prefixIconSrc && /*#__PURE__*/_react["default"].createElement(PrefixIconContainer, {
61
- disabled: disabled,
62
- src: prefixIconSrc,
63
- label: label,
64
- tabIndex: typeof onClickPrefix === "function" && !disabled ? tabIndex : -1,
65
- onClick: function onClick() {
66
- return onClickPrefix && !disabled && onClickPrefix();
67
- },
68
- interactuable: typeof onClickPrefix === "function" && !disabled
69
- }), label && /*#__PURE__*/_react["default"].createElement(ChipTextContainer, {
70
- disabled: disabled,
71
- prefixIconSrc: prefixIconSrc,
72
- suffixIconSrc: suffixIconSrc
73
- }, label), suffixIcon ? /*#__PURE__*/_react["default"].createElement(IconContainer, {
58
+ }, typeof prefixIcon === "string" ? /*#__PURE__*/_react["default"].createElement(PrefixIconContainer, {
59
+ src: prefixIcon
60
+ }) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(ChipTextContainer, {
61
+ disabled: disabled
62
+ }, label), suffixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
74
63
  disabled: disabled,
75
64
  suffixIcon: true,
76
65
  mode: "suffix",
@@ -80,16 +69,9 @@ var DxcChip = function DxcChip(_ref) {
80
69
  return onClickSuffix && !disabled && onClickSuffix();
81
70
  },
82
71
  interactuable: typeof onClickSuffix === "function" && !disabled
83
- }, (0, _typeof2["default"])(suffixIcon) === "object" ? suffixIcon : /*#__PURE__*/_react["default"].createElement(suffixIcon)) : suffixIconSrc && /*#__PURE__*/_react["default"].createElement(SuffixIconContainer, {
84
- disabled: disabled,
85
- src: suffixIconSrc,
86
- label: label,
87
- tabIndex: typeof onClickSuffix === "function" && !disabled ? tabIndex : -1,
88
- onClick: function onClick() {
89
- return onClickSuffix && !disabled && onClickSuffix();
90
- },
91
- interactuable: typeof onClickSuffix === "function" && !disabled
92
- })));
72
+ }, typeof suffixIcon === "string" ? /*#__PURE__*/_react["default"].createElement(SuffixIconContainer, {
73
+ src: suffixIcon
74
+ }) : suffixIcon)));
93
75
  };
94
76
 
95
77
  var getCursor = function getCursor(interactuable, disabled) {
@@ -155,34 +137,14 @@ var ChipTextContainer = _styledComponents["default"].span(_templateObject2 || (_
155
137
  return disabled && "not-allowed" || "default";
156
138
  });
157
139
 
158
- var SuffixIconContainer = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n margin-left: ", ";\n width: ", ";\n height: ", ";\n"])), function (props) {
159
- return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
160
- }, function (props) {
161
- return getCursor(props.interactuable, props.disabled);
162
- }, function (props) {
163
- return (props.label || props.suffixIconSrc) && props.theme.iconSpacing || props.prefixIconSrc && "5px";
164
- }, function (props) {
165
- return props.theme.iconSize;
166
- }, function (props) {
167
- return props.theme.iconSize;
168
- });
140
+ var SuffixIconContainer = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
169
141
 
170
- var PrefixIconContainer = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n margin-right: ", ";\n width: ", ";\n height: ", ";\n"])), function (props) {
171
- return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
172
- }, function (props) {
173
- return getCursor(props.interactuable, props.disabled);
174
- }, function (props) {
175
- return (props.label || props.suffixIconSrc) && props.theme.iconSpacing || props.prefixIconSrc && "5px";
176
- }, function (props) {
177
- return props.theme.iconSize;
178
- }, function (props) {
179
- return props.theme.iconSize;
180
- });
142
+ var PrefixIconContainer = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])([""])));
181
143
 
182
144
  var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n ", "\n width: ", ";\n height: ", ";\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n &:focus {\n outline-color: ", ";\n outline-width: 2px;\n ", "\n }\n"])), function (props) {
183
145
  return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
184
146
  }, function (props) {
185
- return props.prefixIcon ? "margin-right: ".concat((props.label || props.suffixIcon || props.suffixIconSrc) && props.theme.iconSpacing || (props.prefixIcon || props.prefixIconSrc) && "0", ";") : "margin-left: ".concat((props.label || props.prefixIcon || props.prefixIconSrc) && props.theme.iconSpacing || (props.prefixIcon || props.prefixIconSrc) && "0", ";");
147
+ return props.prefixIcon ? "margin-right: ".concat((props.label || props.suffixIcon) && props.theme.iconSpacing || props.prefixIcon && "0", ";") : "margin-left: ".concat((props.label || props.prefixIcon) && props.theme.iconSpacing || props.prefixIcon && "0", ";");
186
148
  }, function (props) {
187
149
  return getCursor(props.interactuable, props.disabled);
188
150
  }, function (props) {
@@ -9,14 +9,12 @@ export default {
9
9
  component: DxcChip,
10
10
  };
11
11
 
12
- const iconSVG = () => {
13
- return (
14
- <svg viewBox="0 0 24 24" fill="currentColor">
15
- <path d="M0 0h24v24H0z" fill="none" />
16
- <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" />
17
- </svg>
18
- );
19
- };
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
+ );
20
18
 
21
19
  export const Chromatic = () => (
22
20
  <>
package/chip/types.d.ts CHANGED
@@ -6,32 +6,24 @@ 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 Props = {
11
11
  /**
12
12
  * Text to be placed on the chip.
13
13
  */
14
14
  label?: string;
15
15
  /**
16
- * Element used as icon to be placed after the chip label.
16
+ * Element or path used as icon to be placed after the chip label.
17
17
  */
18
- suffixIcon?: SVG;
18
+ suffixIcon?: string | SVG;
19
19
  /**
20
- * Element used as icon to be placed before the chip label.
20
+ * Element or path used as icon to be placed before the chip label.
21
21
  */
22
- prefixIcon?: SVG;
23
- /**
24
- * @deprecated Path of the icon to be placed after the chip label.
25
- */
26
- suffixIconSrc?: string;
22
+ prefixIcon?: string | SVG;
27
23
  /**
28
24
  * This function will be called when the suffix is clicked.
29
25
  */
30
26
  onClickSuffix?: () => void;
31
- /**
32
- * @deprecated Path of the icon to be placed before the chip label.
33
- */
34
- prefixIconSrc?: string;
35
27
  /**
36
28
  * This function will be called when the prefix is clicked.
37
29
  */
@@ -162,7 +162,6 @@ exports.globalTokens = globalTokens;
162
162
  var componentTokens = {
163
163
  accordion: {
164
164
  backgroundColor: globalTokens.hal_white,
165
- disabledBackgroundColor: globalTokens.transparent,
166
165
  hoverBackgroundColor: globalTokens.hal_purple_l_95,
167
166
  arrowColor: globalTokens.hal_purple_s_38,
168
167
  disabledArrowColor: globalTokens.hal_grey_l_60,
@@ -877,6 +876,44 @@ var componentTokens = {
877
876
  fontStyle: globalTokens.type_normal,
878
877
  fontWeight: globalTokens.type_regular
879
878
  },
879
+ radioGroup: {
880
+ fontFamily: globalTokens.type_sans,
881
+ radioInputColor: globalTokens.hal_blue_l_45,
882
+ hoverRadioInputColor: globalTokens.hal_blue_s_35,
883
+ focusBorderColor: globalTokens.hal_blue_l_50,
884
+ activeRadioInputColor: globalTokens.hal_blue_d_20,
885
+ errorRadioInputColor: globalTokens.hal_red_s_41,
886
+ hoverErrorRadioInputColor: globalTokens.hal_red_d_30,
887
+ activeErrorRadioInputColor: globalTokens.hal_red_d_20,
888
+ readonlyRadioInputColor: globalTokens.hal_grey_l_60,
889
+ hoverReadonlyRadioInputColor: globalTokens.color_grey_600,
890
+ activeReadonlyRadioInputColor: globalTokens.hal_grey_s_40,
891
+ disabledRadioInputColor: globalTokens.hal_grey_l_60,
892
+ disabledLabelFontColor: globalTokens.hal_grey_l_60,
893
+ disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
894
+ disabledRadioInputLabelFontColor: globalTokens.hal_grey_l_60,
895
+ errorMessageColor: globalTokens.hal_red_s_41,
896
+ labelFontColor: globalTokens.hal_black,
897
+ labelFontSize: globalTokens.type_scale_02,
898
+ labelFontStyle: globalTokens.type_normal,
899
+ labelFontWeight: globalTokens.type_semibold,
900
+ labelLineHeight: globalTokens.type_leading_loose_01,
901
+ optionalLabelFontWeight: globalTokens.type_regular,
902
+ helperTextFontColor: globalTokens.hal_black,
903
+ helperTextFontSize: globalTokens.type_scale_01,
904
+ helperTextFontStyle: globalTokens.type_normal,
905
+ helperTextFontWeight: globalTokens.type_regular,
906
+ helperTextLineHeight: globalTokens.type_leading_normal,
907
+ radioInputLabelFontColor: globalTokens.hal_black,
908
+ radioInputLabelFontSize: globalTokens.type_scale_02,
909
+ radioInputLabelFontStyle: globalTokens.type_normal,
910
+ radioInputLabelFontWeight: globalTokens.type_regular,
911
+ radioInputLabelLineHeight: globalTokens.type_leading_loose_01,
912
+ groupLabelMargin: globalTokens.spacing_03,
913
+ radioInputLabelMargin: globalTokens.spacing_03,
914
+ groupVerticalGutter: globalTokens.spacing_02,
915
+ groupHorizontalGutter: globalTokens.spacing_07
916
+ },
880
917
  select: {
881
918
  fontFamily: globalTokens.type_sans,
882
919
  disabledColor: globalTokens.hal_grey_l_60,
@@ -82,6 +82,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
82
82
  setAnchorEl = _useState6[1];
83
83
 
84
84
  var colorsTheme = (0, _useTheme["default"])();
85
+ var refDate = ref || (0, _react.useRef)(null);
85
86
 
86
87
  var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
87
88
  switch (event.keyCode) {
@@ -132,11 +133,10 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
132
133
  return (0, _moment["default"])(value !== null && value !== void 0 ? value : innerValue, format.toUpperCase(), true).format();
133
134
  };
134
135
 
135
- var openCalendar = function openCalendar(event) {
136
- if (event) {
137
- setIsOpen(!isOpen);
138
- setAnchorEl(event.currentTarget);
139
- }
136
+ var openCalendar = function openCalendar() {
137
+ var dateBtn = refDate.current.getElementsByTagName("button")[0];
138
+ setIsOpen(!isOpen);
139
+ setAnchorEl(dateBtn);
140
140
  };
141
141
 
142
142
  var closeCalendar = function closeCalendar() {
@@ -318,7 +318,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
318
318
  margin: margin,
319
319
  size: size,
320
320
  tabIndex: tabIndex,
321
- ref: ref
321
+ ref: refDate
322
322
  }), /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
323
323
  onKeyDown: handleCalendarOnKeyDown,
324
324
  open: isOpen,
package/dialog/Dialog.js CHANGED
@@ -41,7 +41,8 @@ var DxcDialog = function DxcDialog(_ref) {
41
41
  _ref$overlay = _ref.overlay,
42
42
  overlay = _ref$overlay === void 0 ? true : _ref$overlay,
43
43
  onBackgroundClick = _ref.onBackgroundClick,
44
- padding = _ref.padding,
44
+ _ref$padding = _ref.padding,
45
+ padding = _ref$padding === void 0 ? "small" : _ref$padding,
45
46
  _ref$tabIndex = _ref.tabIndex,
46
47
  tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
47
48
 
@@ -0,0 +1,247 @@
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
+ return (
14
+ <svg viewBox="0 0 24 24" fill="currentColor">
15
+ <path d="M0 0h24v24H0z" fill="none" />
16
+ <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" />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ const iconSVGLarge = () => {
22
+ return (
23
+ <svg enable-background="new 0 0 24 24" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
24
+ <g>
25
+ <path d="M0,0h24v24H0V0z" fill="none" />
26
+ <path d="M0,0h24v24H0V0z" fill="none" />
27
+ </g>
28
+ <g>
29
+ <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" />
30
+ </g>
31
+ </svg>
32
+ );
33
+ };
34
+
35
+ const options: any = [
36
+ {
37
+ value: "1",
38
+ label: "Amazon with a very long text",
39
+ },
40
+ {
41
+ value: "2",
42
+ label: "Ebay",
43
+ },
44
+ {
45
+ value: "3",
46
+ label: "Apple",
47
+ },
48
+ ];
49
+
50
+ const option: any = [
51
+ {
52
+ value: "1",
53
+ label: "Ebay",
54
+ },
55
+ ];
56
+
57
+ const optionsIcon: any = options.map((op, i) => ({ ...op, icon: i === 1 ? iconSVGLarge : iconSVG }));
58
+
59
+ export const Chromatic = () => (
60
+ <>
61
+ <ExampleContainer>
62
+ <Title title="Default" theme="light" level={4} />
63
+ <DxcDropdown label="Default" options={options} onSelectOption={(value) => {}} />
64
+ </ExampleContainer>
65
+ <ExampleContainer pseudoState="pseudo-hover">
66
+ <Title title="Hovered" theme="light" level={4} />
67
+ <DxcDropdown label="Hovered" options={options} onSelectOption={(value) => {}} />
68
+ </ExampleContainer>
69
+ <ExampleContainer pseudoState="pseudo-focus-visible">
70
+ <Title title="Focused" theme="light" level={4} />
71
+ <DxcDropdown label="Focused" options={options} onSelectOption={(value) => {}} />
72
+ </ExampleContainer>
73
+ <ExampleContainer pseudoState="pseudo-active">
74
+ <Title title="Actived" theme="light" level={4} />
75
+ <DxcDropdown label="Actived" options={options} onSelectOption={(value) => {}} />
76
+ </ExampleContainer>
77
+ <ExampleContainer>
78
+ <Title title="Disabled" theme="light" level={4} />
79
+ <DxcDropdown label="Disabled" options={options} onSelectOption={(value) => {}} disabled />
80
+ </ExampleContainer>
81
+ <ExampleContainer>
82
+ <Title title="Caret hidden" theme="light" level={4} />
83
+ <DxcDropdown label="Caret hidden" options={options} onSelectOption={(value) => {}} caretHidden />
84
+ </ExampleContainer>
85
+ <ExampleContainer>
86
+ <Title title="With icon before" theme="light" level={4} />
87
+ <DxcDropdown label="Icon before" options={options} onSelectOption={(value) => {}} icon={iconSVG} />
88
+ </ExampleContainer>
89
+ <ExampleContainer>
90
+ <Title title="With icon after" theme="light" level={4} />
91
+ <DxcDropdown
92
+ label="Icon after"
93
+ options={options}
94
+ onSelectOption={(value) => {}}
95
+ icon={iconSVG}
96
+ iconPosition="after"
97
+ />
98
+ </ExampleContainer>
99
+ <ExampleContainer>
100
+ <Title title="Only icon" theme="light" level={4} />
101
+ <DxcDropdown options={options} onSelectOption={(value) => {}} icon={iconSVG} />
102
+ </ExampleContainer>
103
+ <ExampleContainer>
104
+ <Title title="Large icon" theme="light" level={4} />
105
+ <DxcDropdown label="Large icon" options={options} onSelectOption={(value) => {}} icon={iconSVGLarge} />
106
+ </ExampleContainer>
107
+ <ExampleContainer>
108
+ <Title title="Disabled with icon" theme="light" level={4} />
109
+ <DxcDropdown
110
+ label="Disabled with icon"
111
+ options={options}
112
+ onSelectOption={(value) => {}}
113
+ icon={iconSVG}
114
+ disabled
115
+ />
116
+ </ExampleContainer>
117
+ <ExampleContainer>
118
+ <Title title="Ellipsis" theme="light" level={4} />
119
+ <DxcDropdown
120
+ label="Very long text in dropdown button"
121
+ options={options}
122
+ onSelectOption={(value) => {}}
123
+ icon={iconSVG}
124
+ size="medium"
125
+ />
126
+ </ExampleContainer>
127
+ <Title title="Margins" theme="light" level={2} />
128
+ <ExampleContainer>
129
+ <Title title="Xxsmall" theme="light" level={4} />
130
+ <DxcDropdown label="Xxsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxsmall" />
131
+ </ExampleContainer>
132
+ <ExampleContainer>
133
+ <Title title="Xsmall" theme="light" level={4} />
134
+ <DxcDropdown label="Xsmall" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xsmall" />
135
+ </ExampleContainer>
136
+ <ExampleContainer>
137
+ <Title title="Small" theme="light" level={4} />
138
+ <DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="small" />
139
+ </ExampleContainer>
140
+ <ExampleContainer>
141
+ <Title title="Medium" theme="light" level={4} />
142
+ <DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="medium" />
143
+ </ExampleContainer>
144
+ <ExampleContainer>
145
+ <Title title="Large" theme="light" level={4} />
146
+ <DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="large" />
147
+ </ExampleContainer>
148
+ <ExampleContainer>
149
+ <Title title="Xlarge" theme="light" level={4} />
150
+ <DxcDropdown label="Xlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xlarge" />
151
+ </ExampleContainer>
152
+ <ExampleContainer>
153
+ <Title title="Xxlarge" theme="light" level={4} />
154
+ <DxcDropdown label="Xxlarge" options={options} onSelectOption={(value) => {}} icon={iconSVG} margin="xxlarge" />
155
+ </ExampleContainer>
156
+ <Title title="Sizes" theme="light" level={2} />
157
+ <ExampleContainer>
158
+ <Title title="Small" theme="light" level={4} />
159
+ <DxcDropdown label="Small" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="small" />
160
+ </ExampleContainer>
161
+ <ExampleContainer>
162
+ <Title title="Medium" theme="light" level={4} />
163
+ <DxcDropdown label="Medium" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="medium" />
164
+ </ExampleContainer>
165
+ <ExampleContainer>
166
+ <Title title="Large" theme="light" level={4} />
167
+ <DxcDropdown label="Large" options={options} onSelectOption={(value) => {}} icon={iconSVG} size="large" />
168
+ </ExampleContainer>
169
+ <ExampleContainer>
170
+ <Title title="FitContent" theme="light" level={4} />
171
+ <DxcDropdown
172
+ label="FitContent"
173
+ options={options}
174
+ onSelectOption={(value) => {}}
175
+ icon={iconSVG}
176
+ size="fitContent"
177
+ />
178
+ </ExampleContainer>
179
+ <ExampleContainer>
180
+ <Title title="FillParent" theme="light" level={4} />
181
+ <DxcDropdown
182
+ label="FillParent"
183
+ options={options}
184
+ onSelectOption={(value) => {}}
185
+ icon={iconSVG}
186
+ size="fillParent"
187
+ />
188
+ </ExampleContainer>
189
+ </>
190
+ );
191
+
192
+ const DropdownWithOptions = () => (
193
+ <ExampleContainer expanded>
194
+ <Title title="Options" theme="light" level={4} />
195
+ <DxcDropdown label="Options with icon" options={optionsIcon} onSelectOption={(value) => {}} />
196
+ </ExampleContainer>
197
+ );
198
+
199
+ const DropdownHoverOption = () => (
200
+ <ExampleContainer pseudoState="pseudo-hover" expanded>
201
+ <Title title="Hovered option" theme="light" level={4} />
202
+ <DxcDropdown label="Hovered options" options={option} onSelectOption={(value) => {}} />
203
+ </ExampleContainer>
204
+ );
205
+
206
+ const DropdownActiveOption = () => (
207
+ <ExampleContainer pseudoState="pseudo-active" expanded>
208
+ <Title title="Actived option" theme="light" level={4} />
209
+ <DxcDropdown label="Actived options" options={option} onSelectOption={(value) => {}} />
210
+ </ExampleContainer>
211
+ );
212
+
213
+ const DropdownWithOptionsIconAfter = () => (
214
+ <ExampleContainer expanded>
215
+ <Title title="Icon after options" theme="light" level={4} />
216
+ <DxcDropdown
217
+ label="Icon after options"
218
+ options={optionsIcon}
219
+ onSelectOption={(value) => {}}
220
+ optionsIconPosition="after"
221
+ />
222
+ </ExampleContainer>
223
+ );
224
+
225
+ export const DropdownOptions = DropdownWithOptions.bind({});
226
+ DropdownOptions.play = async ({ canvasElement }) => {
227
+ const canvas = within(canvasElement);
228
+ await userEvent.click(canvas.getByRole("button"));
229
+ };
230
+
231
+ export const DropdownHoveredOption = DropdownHoverOption.bind({});
232
+ DropdownHoveredOption.play = async ({ canvasElement }) => {
233
+ const canvas = within(canvasElement);
234
+ await userEvent.click(canvas.getByRole("button"));
235
+ };
236
+
237
+ export const DropdownActivedOption = DropdownActiveOption.bind({});
238
+ DropdownActivedOption.play = async ({ canvasElement }) => {
239
+ const canvas = within(canvasElement);
240
+ await userEvent.click(canvas.getByRole("button"));
241
+ };
242
+
243
+ export const DropdownOptionsIconAfter = DropdownWithOptionsIconAfter.bind({});
244
+ DropdownOptionsIconAfter.play = async ({ canvasElement }) => {
245
+ const canvas = within(canvasElement);
246
+ await userEvent.click(canvas.getByRole("button"));
247
+ };