@dxc-technology/halstack-react 0.0.0-9bd9511 → 0.0.0-9c20370

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 (213) hide show
  1. package/BackgroundColorContext.d.ts +3 -3
  2. package/BackgroundColorContext.js +12 -2
  3. package/HalstackContext.d.ts +1330 -7
  4. package/HalstackContext.js +84 -67
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +74 -55
  7. package/accordion/Accordion.stories.tsx +3 -101
  8. package/accordion/Accordion.test.js +34 -19
  9. package/accordion/types.d.ts +4 -16
  10. package/accordion-group/AccordionGroup.d.ts +4 -3
  11. package/accordion-group/AccordionGroup.js +49 -42
  12. package/accordion-group/AccordionGroup.stories.tsx +77 -76
  13. package/accordion-group/AccordionGroup.test.js +62 -54
  14. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  15. package/accordion-group/AccordionGroupAccordion.js +43 -0
  16. package/accordion-group/types.d.ts +6 -18
  17. package/alert/Alert.js +47 -20
  18. package/alert/Alert.test.js +46 -29
  19. package/alert/types.d.ts +3 -3
  20. package/badge/Badge.js +14 -2
  21. package/badge/types.d.ts +1 -1
  22. package/bleed/Bleed.js +21 -13
  23. package/bleed/Bleed.stories.tsx +1 -0
  24. package/bleed/types.d.ts +2 -2
  25. package/box/Box.d.ts +1 -1
  26. package/box/Box.js +33 -33
  27. package/box/Box.stories.tsx +25 -53
  28. package/box/Box.test.js +7 -2
  29. package/box/types.d.ts +3 -15
  30. package/bulleted-list/BulletedList.js +36 -9
  31. package/bulleted-list/BulletedList.stories.tsx +7 -1
  32. package/bulleted-list/types.d.ts +32 -5
  33. package/button/Button.d.ts +1 -1
  34. package/button/Button.js +83 -71
  35. package/button/Button.stories.tsx +4 -4
  36. package/button/Button.test.js +28 -8
  37. package/button/types.d.ts +8 -4
  38. package/card/Card.d.ts +1 -1
  39. package/card/Card.js +67 -62
  40. package/card/Card.stories.tsx +12 -42
  41. package/card/Card.test.js +22 -11
  42. package/card/types.d.ts +4 -10
  43. package/checkbox/Checkbox.js +71 -27
  44. package/checkbox/Checkbox.test.js +60 -33
  45. package/checkbox/types.d.ts +4 -4
  46. package/chip/Chip.js +51 -48
  47. package/chip/Chip.stories.tsx +25 -17
  48. package/chip/Chip.test.js +29 -17
  49. package/chip/types.d.ts +4 -4
  50. package/common/OpenSans.css +68 -80
  51. package/common/coreTokens.d.ts +146 -0
  52. package/common/coreTokens.js +167 -0
  53. package/common/utils.d.ts +1 -0
  54. package/common/utils.js +8 -3
  55. package/common/variables.d.ts +226 -175
  56. package/common/variables.js +956 -1133
  57. package/date-input/Calendar.js +55 -12
  58. package/date-input/DateInput.js +82 -35
  59. package/date-input/DateInput.test.js +351 -164
  60. package/date-input/DatePicker.js +38 -8
  61. package/date-input/Icons.js +12 -0
  62. package/date-input/YearPicker.js +30 -5
  63. package/date-input/types.d.ts +7 -7
  64. package/dialog/Dialog.d.ts +1 -1
  65. package/dialog/Dialog.js +83 -86
  66. package/dialog/Dialog.stories.tsx +127 -221
  67. package/dialog/Dialog.test.js +331 -18
  68. package/dialog/types.d.ts +1 -14
  69. package/dropdown/Dropdown.js +86 -32
  70. package/dropdown/Dropdown.test.js +211 -104
  71. package/dropdown/DropdownMenu.js +22 -8
  72. package/dropdown/DropdownMenuItem.js +15 -6
  73. package/dropdown/types.d.ts +8 -8
  74. package/file-input/FileInput.js +218 -134
  75. package/file-input/FileInput.test.js +343 -331
  76. package/file-input/FileItem.js +39 -12
  77. package/file-input/types.d.ts +10 -10
  78. package/flex/Flex.js +39 -25
  79. package/flex/Flex.stories.tsx +35 -26
  80. package/flex/types.d.ts +74 -9
  81. package/footer/Footer.d.ts +1 -1
  82. package/footer/Footer.js +80 -68
  83. package/footer/Footer.stories.tsx +12 -89
  84. package/footer/Footer.test.js +47 -40
  85. package/footer/Icons.js +4 -0
  86. package/footer/types.d.ts +15 -17
  87. package/grid/Grid.d.ts +7 -0
  88. package/grid/Grid.js +91 -0
  89. package/grid/Grid.stories.tsx +219 -0
  90. package/grid/types.d.ts +115 -0
  91. package/header/Header.d.ts +4 -3
  92. package/header/Header.js +72 -55
  93. package/header/Header.stories.tsx +7 -71
  94. package/header/Header.test.js +26 -13
  95. package/header/Icons.js +4 -0
  96. package/header/types.d.ts +2 -16
  97. package/heading/Heading.js +28 -7
  98. package/heading/Heading.test.js +88 -71
  99. package/heading/types.d.ts +3 -3
  100. package/inset/Inset.js +21 -13
  101. package/inset/Inset.stories.tsx +2 -1
  102. package/inset/types.d.ts +2 -2
  103. package/layout/ApplicationLayout.d.ts +5 -5
  104. package/layout/ApplicationLayout.js +57 -15
  105. package/layout/Icons.js +10 -0
  106. package/layout/SidenavContext.d.ts +1 -1
  107. package/layout/SidenavContext.js +4 -0
  108. package/layout/types.d.ts +5 -6
  109. package/link/Link.js +41 -21
  110. package/link/Link.test.js +42 -26
  111. package/link/types.d.ts +4 -4
  112. package/main.d.ts +2 -1
  113. package/main.js +55 -0
  114. package/nav-tabs/NavTabs.d.ts +2 -2
  115. package/nav-tabs/NavTabs.js +43 -16
  116. package/nav-tabs/NavTabs.stories.tsx +14 -0
  117. package/nav-tabs/NavTabs.test.js +44 -37
  118. package/nav-tabs/Tab.js +71 -45
  119. package/nav-tabs/types.d.ts +10 -11
  120. package/number-input/NumberInput.js +30 -20
  121. package/number-input/NumberInput.test.js +249 -113
  122. package/number-input/NumberInputContext.js +5 -0
  123. package/number-input/numberInputContextTypes.d.ts +1 -1
  124. package/number-input/types.d.ts +4 -4
  125. package/package.json +7 -7
  126. package/paginator/Icons.js +10 -0
  127. package/paginator/Paginator.js +39 -17
  128. package/paginator/Paginator.test.js +156 -104
  129. package/paginator/types.d.ts +1 -1
  130. package/paragraph/Paragraph.d.ts +3 -4
  131. package/paragraph/Paragraph.js +18 -8
  132. package/password-input/PasswordInput.js +51 -22
  133. package/password-input/PasswordInput.test.js +94 -51
  134. package/password-input/types.d.ts +4 -4
  135. package/progress-bar/ProgressBar.d.ts +2 -2
  136. package/progress-bar/ProgressBar.js +39 -14
  137. package/progress-bar/ProgressBar.test.js +53 -36
  138. package/progress-bar/types.d.ts +4 -3
  139. package/quick-nav/QuickNav.js +24 -2
  140. package/quick-nav/types.d.ts +2 -2
  141. package/radio-group/Radio.js +53 -22
  142. package/radio-group/RadioGroup.js +84 -41
  143. package/radio-group/RadioGroup.test.js +288 -186
  144. package/radio-group/types.d.ts +4 -4
  145. package/resultsetTable/Icons.js +3 -0
  146. package/resultsetTable/ResultsetTable.js +56 -21
  147. package/resultsetTable/ResultsetTable.test.js +75 -42
  148. package/resultsetTable/types.d.ts +5 -5
  149. package/select/Icons.js +3 -0
  150. package/select/Listbox.js +35 -10
  151. package/select/Option.js +24 -8
  152. package/select/Select.js +143 -56
  153. package/select/Select.test.js +839 -456
  154. package/select/types.d.ts +12 -12
  155. package/sidenav/Icons.d.ts +7 -0
  156. package/sidenav/Icons.js +51 -0
  157. package/sidenav/Sidenav.d.ts +2 -2
  158. package/sidenav/Sidenav.js +116 -104
  159. package/sidenav/Sidenav.stories.tsx +60 -60
  160. package/sidenav/Sidenav.test.js +10 -3
  161. package/sidenav/types.d.ts +26 -23
  162. package/slider/Slider.js +84 -38
  163. package/slider/Slider.test.js +104 -76
  164. package/slider/types.d.ts +4 -4
  165. package/spinner/Spinner.js +51 -28
  166. package/spinner/Spinner.stories.jsx +28 -28
  167. package/spinner/Spinner.test.js +35 -26
  168. package/spinner/types.d.ts +3 -3
  169. package/switch/Switch.js +66 -24
  170. package/switch/Switch.test.js +97 -52
  171. package/switch/types.d.ts +4 -4
  172. package/table/Table.js +22 -4
  173. package/table/Table.test.js +7 -2
  174. package/table/types.d.ts +3 -3
  175. package/tabs/Tab.js +39 -22
  176. package/tabs/Tabs.js +131 -62
  177. package/tabs/Tabs.test.js +122 -67
  178. package/tabs/types.d.ts +8 -8
  179. package/tag/Tag.js +54 -27
  180. package/tag/Tag.test.js +31 -20
  181. package/tag/types.d.ts +7 -7
  182. package/text-input/Icons.js +3 -0
  183. package/text-input/Suggestion.js +24 -8
  184. package/text-input/Suggestions.js +36 -11
  185. package/text-input/TextInput.js +144 -59
  186. package/text-input/TextInput.stories.tsx +1 -1
  187. package/text-input/TextInput.test.js +858 -539
  188. package/text-input/types.d.ts +9 -9
  189. package/textarea/Textarea.js +73 -38
  190. package/textarea/Textarea.test.js +173 -98
  191. package/textarea/types.d.ts +4 -4
  192. package/toggle-group/ToggleGroup.d.ts +2 -2
  193. package/toggle-group/ToggleGroup.js +59 -21
  194. package/toggle-group/ToggleGroup.test.js +72 -40
  195. package/toggle-group/types.d.ts +11 -11
  196. package/typography/Typography.d.ts +2 -2
  197. package/typography/Typography.js +23 -110
  198. package/typography/Typography.stories.tsx +1 -1
  199. package/typography/types.d.ts +1 -1
  200. package/useTheme.d.ts +1234 -1
  201. package/useTheme.js +6 -0
  202. package/useTranslatedLabels.d.ts +84 -2
  203. package/useTranslatedLabels.js +5 -0
  204. package/utils/BaseTypography.d.ts +21 -0
  205. package/utils/BaseTypography.js +108 -0
  206. package/utils/FocusLock.d.ts +13 -0
  207. package/utils/FocusLock.js +138 -0
  208. package/wizard/Wizard.js +47 -13
  209. package/wizard/Wizard.test.js +81 -54
  210. package/wizard/types.d.ts +7 -8
  211. package/card/ice-cream.jpg +0 -0
  212. package/translatedLabelsType.d.ts +0 -82
  213. /package/{translatedLabelsType.js → grid/types.js} +0 -0
package/chip/Chip.js CHANGED
@@ -1,71 +1,83 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports["default"] = void 0;
11
+
9
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
+
10
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
+
11
16
  var _react = _interopRequireDefault(require("react"));
17
+
12
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
+
13
20
  var _variables = require("../common/variables");
14
- var _utils = require("../common/utils.js");
21
+
22
+ var _utils = require("../common/utils");
23
+
15
24
  var _useTheme = _interopRequireDefault(require("../useTheme"));
25
+
16
26
  var _templateObject, _templateObject2, _templateObject3;
27
+
17
28
  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); }
29
+
18
30
  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; }
31
+
19
32
  var DxcChip = function DxcChip(_ref) {
20
33
  var label = _ref.label,
21
- suffixIcon = _ref.suffixIcon,
22
- prefixIcon = _ref.prefixIcon,
23
- onClickSuffix = _ref.onClickSuffix,
24
- onClickPrefix = _ref.onClickPrefix,
25
- disabled = _ref.disabled,
26
- margin = _ref.margin,
27
- _ref$tabIndex = _ref.tabIndex,
28
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
34
+ suffixIcon = _ref.suffixIcon,
35
+ prefixIcon = _ref.prefixIcon,
36
+ onClickSuffix = _ref.onClickSuffix,
37
+ onClickPrefix = _ref.onClickPrefix,
38
+ disabled = _ref.disabled,
39
+ margin = _ref.margin,
40
+ _ref$tabIndex = _ref.tabIndex,
41
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
29
42
  var colorsTheme = (0, _useTheme["default"])();
30
43
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
31
- theme: colorsTheme["chip"]
32
- }, /*#__PURE__*/_react["default"].createElement(StyledDxcChip, {
44
+ theme: colorsTheme.chip
45
+ }, /*#__PURE__*/_react["default"].createElement(Chip, {
33
46
  disabled: disabled,
34
47
  margin: margin
35
48
  }, prefixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
49
+ role: typeof onClickPrefix === "function" ? "button" : undefined,
36
50
  disabled: disabled,
37
- prefixIcon: true,
38
- label: label,
39
- mode: "prefix",
51
+ interactuable: typeof onClickPrefix === "function" && !disabled,
40
52
  tabIndex: typeof onClickPrefix === "function" && !disabled ? tabIndex : -1,
41
53
  onClick: function onClick() {
42
54
  return onClickPrefix && !disabled && onClickPrefix();
43
- },
44
- interactuable: typeof onClickPrefix === "function" && !disabled
55
+ }
45
56
  }, typeof prefixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
46
57
  src: prefixIcon
47
- }) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(ChipTextContainer, {
58
+ }) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
48
59
  disabled: disabled
49
60
  }, label), suffixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
61
+ role: typeof onClickSuffix === "function" ? "button" : undefined,
50
62
  disabled: disabled,
51
- suffixIcon: true,
52
- mode: "suffix",
53
- label: label,
63
+ interactuable: typeof onClickSuffix === "function" && !disabled,
54
64
  tabIndex: typeof onClickSuffix === "function" && !disabled ? tabIndex : -1,
55
65
  onClick: function onClick() {
56
- return onClickSuffix && !disabled && onClickSuffix();
57
- },
58
- interactuable: typeof onClickSuffix === "function" && !disabled
66
+ return !disabled && (onClickSuffix === null || onClickSuffix === void 0 ? void 0 : onClickSuffix());
67
+ }
59
68
  }, typeof suffixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
60
69
  src: suffixIcon
61
70
  }) : suffixIcon)));
62
71
  };
63
- var getCursor = function getCursor(interactuable, disabled) {
64
- if (disabled) return "cursor: not-allowed;";else if (interactuable) return "cursor: pointer;";else return "cursor: default; outline:none;";
72
+
73
+ var calculateWidth = function calculateWidth(margin) {
74
+ return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
65
75
  };
66
- var StyledDxcChip = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n min-height: 40px;\n max-width: ", ";\n background-color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n"])), function (_ref2) {
67
- var margin = _ref2.margin;
68
- return "calc(100% - 40px - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
76
+
77
+ var Chip = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: ", ";\n min-height: 40px;\n max-width: ", ";\n background-color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n"])), function (props) {
78
+ return props.theme.iconSpacing;
79
+ }, function (props) {
80
+ return calculateWidth(props.margin);
69
81
  }, function (props) {
70
82
  return props.disabled && props.theme.disabledBackgroundColor || props.theme.backgroundColor;
71
83
  }, function (props) {
@@ -94,11 +106,12 @@ var StyledDxcChip = _styledComponents["default"].div(_templateObject || (_templa
94
106
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
95
107
  }, function (props) {
96
108
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
97
- }, function (_ref3) {
98
- var disabled = _ref3.disabled;
109
+ }, function (_ref2) {
110
+ var disabled = _ref2.disabled;
99
111
  return disabled && "not-allowed";
100
112
  });
101
- var ChipTextContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-style: ", ";\n color: ", ";\n cursor: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])), function (props) {
113
+
114
+ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-style: ", ";\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])), function (props) {
102
115
  return props.theme.fontSize;
103
116
  }, function (props) {
104
117
  return props.theme.fontFamily;
@@ -108,30 +121,20 @@ var ChipTextContainer = _styledComponents["default"].span(_templateObject2 || (_
108
121
  return props.theme.fontStyle;
109
122
  }, function (props) {
110
123
  return props.disabled ? props.theme.disabledFontColor : props.theme.fontColor;
111
- }, function (_ref4) {
112
- var disabled = _ref4.disabled;
113
- return disabled && "not-allowed" || "default";
114
124
  });
115
- var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n color: ", ";\n ", "\n\n &:hover {\n color: ", ";\n }\n &:focus {\n outline-color: ", ";\n outline-width: ", ";\n ", "\n }\n &:active {\n color: ", ";\n }\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
116
- 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", ";");
117
- }, function (props) {
125
+
126
+ var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border-radius: 0.25rem;\n color: ", ";\n ", "\n\n ", "\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
118
127
  return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
128
+ }, function (_ref3) {
129
+ var interactuable = _ref3.interactuable;
130
+ return interactuable && "cursor: pointer;";
119
131
  }, function (props) {
120
- return getCursor(props.interactuable, props.disabled);
121
- }, function (props) {
122
- return !props.disabled && props.theme.hoverIconColor;
123
- }, function (props) {
124
- return !props.disabled && props.theme.focusColor;
125
- }, function (props) {
126
- return !props.disabled && props.theme.focusBorderThickness;
127
- }, function (props) {
128
- return props.disabled && "outline: none;";
129
- }, function (props) {
130
- return !props.disabled && props.theme.activeIconColor;
132
+ return props.interactuable && "\n &:hover {\n color: ".concat(props.theme.hoverIconColor, ";\n }\n &:focus,\n &:focus-visible {\n outline: ").concat(props.theme.focusBorderThickness, " solid ").concat(props.theme.focusColor, ";\n }\n &:active {\n color: ").concat(props.theme.activeIconColor, ";\n }\n ");
131
133
  }, function (props) {
132
134
  return props.theme.iconSize;
133
135
  }, function (props) {
134
136
  return props.theme.iconSize;
135
137
  });
138
+
136
139
  var _default = DxcChip;
137
140
  exports["default"] = _default;
@@ -81,29 +81,37 @@ export const Chromatic = () => (
81
81
  </ExampleContainer>
82
82
  <ExampleContainer>
83
83
  <Title title="Chip with ellipsis" theme="light" level={4} />
84
- <DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
84
+ <div style={{ width: "200px" }}>
85
+ <DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
86
+ </div>
85
87
  </ExampleContainer>
86
88
  <ExampleContainer>
87
89
  <Title title="Chip with ellipsis and suffix" theme="light" level={4} />
88
- <DxcChip
89
- suffixIcon={iconSVG}
90
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
91
- />
90
+ <div style={{ width: "200px" }}>
91
+ <DxcChip
92
+ suffixIcon={iconSVG}
93
+ label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
94
+ />
95
+ </div>
92
96
  </ExampleContainer>
93
97
  <ExampleContainer>
94
98
  <Title title="Chip with ellipsis and prefix" theme="light" level={4} />
95
- <DxcChip
96
- prefixIcon={iconSVG}
97
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
98
- />
99
+ <div style={{ width: "200px" }}>
100
+ <DxcChip
101
+ prefixIcon={iconSVG}
102
+ label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
103
+ />
104
+ </div>
99
105
  </ExampleContainer>
100
106
  <ExampleContainer>
101
107
  <Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
102
- <DxcChip
103
- prefixIcon={iconSVG}
104
- suffixIcon={iconSVG}
105
- label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
106
- />
108
+ <div style={{ width: "200px" }}>
109
+ <DxcChip
110
+ prefixIcon={iconSVG}
111
+ suffixIcon={iconSVG}
112
+ label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
113
+ />
114
+ </div>
107
115
  </ExampleContainer>
108
116
  <Title title="Margins" theme="light" level={2} />
109
117
  <ExampleContainer>
@@ -191,16 +199,16 @@ const ChipPrefixFocused = () => (
191
199
  const ChipSuffixFocused = () => (
192
200
  <ExampleContainer>
193
201
  <Title title="Chip with suffix" theme="light" level={4} />
194
- <DxcChip label="Chip with suffix" suffixIcon={iconSVG} onClickSuffix={() => {}} />
202
+ <DxcChip label="Chip with suffix" suffixIcon="https://icons-for-free.com/download-icon-close+icon-1320184117228553763_512.png" onClickSuffix={() => {}} />
195
203
  </ExampleContainer>
196
204
  );
197
205
 
198
206
  export const PrefixFocused = ChipPrefixFocused.bind({});
199
- PrefixFocused.play = async ({ canvasElement }) => {
207
+ PrefixFocused.play = async () => {
200
208
  await userEvent.tab();
201
209
  };
202
210
 
203
211
  export const SuffixFocused = ChipSuffixFocused.bind({});
204
- SuffixFocused.play = async ({ canvasElement }) => {
212
+ SuffixFocused.play = async () => {
205
213
  await userEvent.tab();
206
214
  };
package/chip/Chip.test.js CHANGED
@@ -1,42 +1,54 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  var _react = _interopRequireDefault(require("react"));
6
+
5
7
  var _react2 = require("@testing-library/react");
6
- var _Chip = _interopRequireDefault(require("./Chip"));
7
- var _invision = _interopRequireDefault(require("../../app/src/images/invision.svg"));
8
+
9
+ var _Chip = _interopRequireDefault(require("./Chip.tsx"));
10
+
8
11
  describe("Chip component tests", function () {
9
12
  test("Chip renders with correct text", function () {
10
13
  var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
11
- label: "Chip"
12
- })),
13
- getByText = _render.getByText;
14
+ label: "Chip"
15
+ })),
16
+ getByText = _render.getByText;
17
+
14
18
  expect(getByText("Chip")).toBeTruthy();
15
19
  });
16
20
  test("Calls correct function when clicking on prefix icon", function () {
17
21
  var onClick = jest.fn();
22
+
18
23
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
19
- label: "Chip",
20
- prefixIcon: _invision["default"],
21
- onClickPrefix: onClick
22
- })),
23
- getByText = _render2.getByText,
24
- getByRole = _render2.getByRole;
24
+ label: "Chip",
25
+ prefixIcon: "https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png",
26
+ onClickPrefix: onClick
27
+ })),
28
+ getByText = _render2.getByText,
29
+ getByRole = _render2.getByRole;
30
+
25
31
  expect(getByText("Chip")).toBeTruthy();
32
+
26
33
  _react2.fireEvent.click(getByRole("img"));
34
+
27
35
  expect(onClick).toHaveBeenCalled();
28
36
  });
29
37
  test("Calls correct function when clicking on suffix icon", function () {
30
38
  var onClick = jest.fn();
39
+
31
40
  var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
32
- label: "Chip",
33
- suffixIcon: _invision["default"],
34
- onClickSuffix: onClick
35
- })),
36
- getByText = _render3.getByText,
37
- getByRole = _render3.getByRole;
41
+ label: "Chip",
42
+ suffixIcon: "https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png",
43
+ onClickSuffix: onClick
44
+ })),
45
+ getByText = _render3.getByText,
46
+ getByRole = _render3.getByRole;
47
+
38
48
  expect(getByText("Chip")).toBeTruthy();
49
+
39
50
  _react2.fireEvent.click(getByRole("img"));
51
+
40
52
  expect(onClick).toHaveBeenCalled();
41
53
  });
42
54
  });
package/chip/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
- type Props = {
9
+ declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
+ declare type Props = {
11
11
  /**
12
12
  * Text to be placed on the chip.
13
13
  */
@@ -1,81 +1,69 @@
1
+ @font-face {
2
+ font-family: "Open Sans";
3
+ src: url("./fonts/OpenSans-Light.ttf") format("truetype");
4
+ font-style: normal;
5
+ font-weight: 200;
6
+ }
1
7
 
2
- @font-face {
3
- font-family: 'Open Sans';
4
- src: url('./fonts/OpenSans-Light.ttf')
5
- format('truetype');
6
- font-style: normal;
7
- font-weight: 200;
8
- }
9
-
10
- @font-face {
11
- font-family: 'Open Sans';
12
- src: url('./fonts/OpenSans-Regular.ttf')
13
- format('truetype');
14
- font-style: normal;
15
- font-weight: 400;
16
- }
17
-
18
- @font-face {
19
- font-family: 'Open Sans';
20
- src: url('./fonts/OpenSans-SemiBold.ttf')
21
- format('truetype');
22
- font-style: normal;
23
- font-weight: 600;
24
- }
25
-
26
- @font-face {
27
- font-family: 'Open Sans';
28
- src: url('./fonts/OpenSans-Bold.ttf')
29
- format('truetype');
30
- font-style: normal;
31
- font-weight: 700;
32
- }
33
-
34
- @font-face {
35
- font-family: 'Open Sans';
36
- src: url('./fonts/OpenSans-ExtraBold.ttf')
37
- format('truetype');
38
- font-style: normal;
39
- font-weight: 800;
40
- }
41
-
42
- @font-face {
43
- font-family: 'Open Sans';
44
- src: url('./fonts/OpenSans-LightItalic.ttf')
45
- format('truetype');
46
- font-style: italic;
47
- font-weight: 200;
48
- }
49
-
50
- @font-face {
51
- font-family: 'Open Sans';
52
- src: url('./fonts/OpenSans-Italic.ttf')
53
- format('truetype');
54
- font-style: italic;
55
- font-weight: 400;
56
- }
57
-
58
- @font-face {
59
- font-family: 'Open Sans';
60
- src: url('./fonts/OpenSans-SemiBoldItalic.ttf')
61
- format('truetype');
62
- font-style: italic;
63
- font-weight: 600;
64
- }
65
-
66
- @font-face {
67
- font-family: 'Open Sans';
68
- src: url('./fonts/OpenSans-BoldItalic.ttf')
69
- format('truetype');
70
- font-style: italic;
71
- font-weight: 700;
72
- }
73
-
74
- @font-face {
75
- font-family: 'Open Sans';
76
- src: url('./fonts/OpenSans-ExtraBoldItalic.ttf')
77
- format('truetype');
78
- font-style: italic;
79
- font-weight: 800;
80
- }
81
-
8
+ @font-face {
9
+ font-family: "Open Sans";
10
+ src: url("./fonts/OpenSans-Regular.ttf") format("truetype");
11
+ font-style: normal;
12
+ font-weight: 400;
13
+ }
14
+
15
+ @font-face {
16
+ font-family: "Open Sans";
17
+ src: url("./fonts/OpenSans-SemiBold.ttf") format("truetype");
18
+ font-style: normal;
19
+ font-weight: 600;
20
+ }
21
+
22
+ @font-face {
23
+ font-family: "Open Sans";
24
+ src: url("./fonts/OpenSans-Bold.ttf") format("truetype");
25
+ font-style: normal;
26
+ font-weight: 700;
27
+ }
28
+
29
+ @font-face {
30
+ font-family: "Open Sans";
31
+ src: url("./fonts/OpenSans-ExtraBold.ttf") format("truetype");
32
+ font-style: normal;
33
+ font-weight: 800;
34
+ }
35
+
36
+ @font-face {
37
+ font-family: "Open Sans";
38
+ src: url("./fonts/OpenSans-LightItalic.ttf") format("truetype");
39
+ font-style: italic;
40
+ font-weight: 200;
41
+ }
42
+
43
+ @font-face {
44
+ font-family: "Open Sans";
45
+ src: url("./fonts/OpenSans-Italic.ttf") format("truetype");
46
+ font-style: italic;
47
+ font-weight: 400;
48
+ }
49
+
50
+ @font-face {
51
+ font-family: "Open Sans";
52
+ src: url("./fonts/OpenSans-SemiBoldItalic.ttf") format("truetype");
53
+ font-style: italic;
54
+ font-weight: 600;
55
+ }
56
+
57
+ @font-face {
58
+ font-family: "Open Sans";
59
+ src: url("./fonts/OpenSans-BoldItalic.ttf") format("truetype");
60
+ font-style: italic;
61
+ font-weight: 700;
62
+ }
63
+
64
+ @font-face {
65
+ font-family: "Open Sans";
66
+ src: url("./fonts/OpenSans-ExtraBoldItalic.ttf") format("truetype");
67
+ font-style: italic;
68
+ font-weight: 800;
69
+ }
@@ -0,0 +1,146 @@
1
+ declare const CORE_TOKENS: {
2
+ inherit: string;
3
+ color_black: string;
4
+ color_white: string;
5
+ color_transparent: string;
6
+ color_grey_50: string;
7
+ color_grey_100: string;
8
+ color_grey_200: string;
9
+ color_grey_300: string;
10
+ color_grey_400: string;
11
+ color_grey_500: string;
12
+ color_grey_600: string;
13
+ color_grey_700: string;
14
+ color_grey_800: string;
15
+ color_grey_900: string;
16
+ color_grey_50_a: string;
17
+ color_grey_100_a: string;
18
+ color_grey_200_a: string;
19
+ color_grey_300_a: string;
20
+ color_grey_400_a: string;
21
+ color_grey_500_a: string;
22
+ color_grey_600_a: string;
23
+ color_grey_700_a: string;
24
+ color_grey_800_a: string;
25
+ color_grey_900_a: string;
26
+ color_purple_50: string;
27
+ color_purple_100: string;
28
+ color_purple_200: string;
29
+ color_purple_300: string;
30
+ color_purple_400: string;
31
+ color_purple_500: string;
32
+ color_purple_600: string;
33
+ color_purple_700: string;
34
+ color_purple_800: string;
35
+ color_purple_900: string;
36
+ color_blue_50: string;
37
+ color_blue_100: string;
38
+ color_blue_200: string;
39
+ color_blue_300: string;
40
+ color_blue_400: string;
41
+ color_blue_500: string;
42
+ color_blue_600: string;
43
+ color_blue_700: string;
44
+ color_blue_800: string;
45
+ color_blue_900: string;
46
+ color_red_50: string;
47
+ color_red_100: string;
48
+ color_red_200: string;
49
+ color_red_300: string;
50
+ color_red_400: string;
51
+ color_red_500: string;
52
+ color_red_600: string;
53
+ color_red_700: string;
54
+ color_red_800: string;
55
+ color_red_900: string;
56
+ color_green_50: string;
57
+ color_green_100: string;
58
+ color_green_200: string;
59
+ color_green_300: string;
60
+ color_green_400: string;
61
+ color_green_500: string;
62
+ color_green_600: string;
63
+ color_green_700: string;
64
+ color_green_800: string;
65
+ color_green_900: string;
66
+ color_yellow_50: string;
67
+ color_yellow_100: string;
68
+ color_yellow_200: string;
69
+ color_yellow_300: string;
70
+ color_yellow_400: string;
71
+ color_yellow_500: string;
72
+ color_yellow_600: string;
73
+ color_yellow_700: string;
74
+ color_yellow_800: string;
75
+ color_yellow_900: string;
76
+ color_orange_50: string;
77
+ color_orange_100: string;
78
+ color_orange_200: string;
79
+ color_orange_300: string;
80
+ color_orange_400: string;
81
+ color_orange_500: string;
82
+ color_orange_600: string;
83
+ color_orange_700: string;
84
+ color_orange_800: string;
85
+ color_orange_900: string;
86
+ type_sans: string;
87
+ type_scale_root: string;
88
+ type_scale_08: string;
89
+ type_scale_07: string;
90
+ type_scale_06: string;
91
+ type_scale_05: string;
92
+ type_scale_04: string;
93
+ type_scale_03: string;
94
+ type_scale_02: string;
95
+ type_scale_01: string;
96
+ type_light: string;
97
+ type_regular: string;
98
+ type_semibold: string;
99
+ type_bold: string;
100
+ type_italic: string;
101
+ type_normal: string;
102
+ type_spacing_tight_02: string;
103
+ type_spacing_tight_01: string;
104
+ type_spacing_normal: string;
105
+ type_spacing_wide_01: string;
106
+ type_spacing_wide_02: string;
107
+ type_spacing_wide_03: string;
108
+ type_initial: string;
109
+ type_uppercase: string;
110
+ type_no_line: string;
111
+ type_underline: string;
112
+ type_line_through: string;
113
+ type_leading_compact_03: string;
114
+ type_leading_compact_02: string;
115
+ type_leading_compact_01: string;
116
+ type_leading_normal: string;
117
+ type_leading_loose_01: string;
118
+ type_leading_loose_02: string;
119
+ spacing_0: string;
120
+ spacing_2: string;
121
+ spacing_4: string;
122
+ spacing_8: string;
123
+ spacing_12: string;
124
+ spacing_16: string;
125
+ spacing_24: string;
126
+ spacing_32: string;
127
+ spacing_40: string;
128
+ spacing_48: string;
129
+ spacing_56: string;
130
+ spacing_64: string;
131
+ spacing_80: string;
132
+ spacing_96: string;
133
+ spacing_112: string;
134
+ border_width_0: string;
135
+ border_width_1: string;
136
+ border_width_2: string;
137
+ border_width_4: string;
138
+ border_radius_none: string;
139
+ border_radius_small: string;
140
+ border_radius_medium: string;
141
+ border_radius_large: string;
142
+ border_solid: string;
143
+ border_dashed: string;
144
+ border_none: string;
145
+ };
146
+ export default CORE_TOKENS;