@dxc-technology/halstack-react 0.0.0-c18d61a → 0.0.0-c1a6e05

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 (201) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1329 -5
  4. package/HalstackContext.js +117 -77
  5. package/accordion/Accordion.js +13 -24
  6. package/accordion/Accordion.stories.tsx +102 -13
  7. package/accordion/Accordion.test.js +1 -1
  8. package/accordion/types.d.ts +3 -3
  9. package/accordion-group/AccordionGroup.d.ts +4 -3
  10. package/accordion-group/AccordionGroup.js +23 -44
  11. package/accordion-group/AccordionGroup.test.js +1 -1
  12. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  13. package/accordion-group/AccordionGroupAccordion.js +43 -0
  14. package/accordion-group/types.d.ts +2 -2
  15. package/alert/Alert.js +4 -8
  16. package/alert/Alert.stories.tsx +28 -0
  17. package/alert/Alert.test.js +1 -1
  18. package/bleed/Bleed.stories.tsx +1 -0
  19. package/box/Box.js +3 -5
  20. package/box/Box.stories.tsx +15 -0
  21. package/box/Box.test.js +1 -1
  22. package/bulleted-list/BulletedList.js +4 -2
  23. package/bulleted-list/BulletedList.stories.tsx +7 -1
  24. package/bulleted-list/types.d.ts +31 -4
  25. package/button/Button.js +13 -16
  26. package/button/Button.stories.tsx +151 -9
  27. package/button/Button.test.js +1 -1
  28. package/button/types.d.ts +3 -3
  29. package/card/Card.js +12 -13
  30. package/card/Card.stories.tsx +12 -13
  31. package/card/Card.test.js +1 -1
  32. package/checkbox/Checkbox.d.ts +2 -2
  33. package/checkbox/Checkbox.js +18 -17
  34. package/checkbox/Checkbox.stories.tsx +131 -59
  35. package/checkbox/Checkbox.test.js +1 -1
  36. package/checkbox/types.d.ts +6 -2
  37. package/chip/Chip.js +28 -49
  38. package/chip/Chip.stories.tsx +121 -26
  39. package/chip/Chip.test.js +3 -5
  40. package/common/OpenSans.css +68 -80
  41. package/common/coreTokens.d.ts +146 -0
  42. package/common/coreTokens.js +167 -0
  43. package/common/utils.d.ts +1 -0
  44. package/common/utils.js +4 -4
  45. package/common/variables.d.ts +1482 -0
  46. package/common/variables.js +981 -1129
  47. package/date-input/Calendar.d.ts +4 -0
  48. package/date-input/Calendar.js +258 -0
  49. package/date-input/DateInput.js +134 -237
  50. package/date-input/DateInput.stories.tsx +199 -33
  51. package/date-input/DateInput.test.js +494 -138
  52. package/date-input/DatePicker.d.ts +4 -0
  53. package/date-input/DatePicker.js +146 -0
  54. package/date-input/Icons.d.ts +6 -0
  55. package/date-input/Icons.js +75 -0
  56. package/date-input/YearPicker.d.ts +4 -0
  57. package/date-input/YearPicker.js +126 -0
  58. package/date-input/types.d.ts +51 -0
  59. package/dialog/Dialog.js +61 -74
  60. package/dialog/Dialog.stories.tsx +211 -159
  61. package/dialog/Dialog.test.js +302 -3
  62. package/dialog/types.d.ts +2 -2
  63. package/dropdown/Dropdown.js +37 -37
  64. package/dropdown/Dropdown.stories.tsx +210 -84
  65. package/dropdown/Dropdown.test.js +20 -24
  66. package/dropdown/DropdownMenu.js +12 -18
  67. package/dropdown/DropdownMenuItem.js +4 -17
  68. package/dropdown/types.d.ts +3 -3
  69. package/file-input/FileInput.d.ts +2 -2
  70. package/file-input/FileInput.js +28 -52
  71. package/file-input/FileInput.stories.tsx +96 -17
  72. package/file-input/FileInput.test.js +14 -55
  73. package/file-input/FileItem.d.ts +2 -12
  74. package/file-input/FileItem.js +29 -41
  75. package/file-input/types.d.ts +17 -0
  76. package/flex/Flex.js +4 -2
  77. package/flex/Flex.stories.tsx +35 -26
  78. package/flex/types.d.ts +70 -5
  79. package/footer/Footer.js +6 -8
  80. package/footer/Footer.stories.tsx +91 -0
  81. package/footer/Footer.test.js +14 -26
  82. package/grid/Grid.d.ts +7 -0
  83. package/grid/Grid.js +91 -0
  84. package/grid/Grid.stories.tsx +219 -0
  85. package/grid/types.d.ts +115 -0
  86. package/header/Header.d.ts +3 -2
  87. package/header/Header.js +21 -23
  88. package/header/Header.stories.tsx +149 -6
  89. package/header/Header.test.js +2 -2
  90. package/header/types.d.ts +2 -2
  91. package/heading/Heading.js +1 -1
  92. package/heading/Heading.test.js +1 -1
  93. package/inset/Inset.stories.tsx +2 -1
  94. package/layout/ApplicationLayout.d.ts +3 -3
  95. package/layout/ApplicationLayout.js +1 -1
  96. package/layout/types.d.ts +2 -3
  97. package/link/Link.js +4 -4
  98. package/link/Link.stories.tsx +60 -0
  99. package/link/Link.test.js +2 -4
  100. package/link/types.d.ts +2 -2
  101. package/main.d.ts +3 -2
  102. package/main.js +9 -1
  103. package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
  104. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  105. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  106. package/{tabs-nav → nav-tabs}/Tab.js +37 -17
  107. package/nav-tabs/types.js +5 -0
  108. package/number-input/NumberInput.test.js +6 -7
  109. package/package.json +8 -13
  110. package/paginator/Icons.d.ts +5 -0
  111. package/paginator/Icons.js +16 -28
  112. package/paginator/Paginator.js +6 -14
  113. package/paginator/Paginator.stories.tsx +24 -0
  114. package/paginator/Paginator.test.js +44 -47
  115. package/paragraph/Paragraph.d.ts +3 -4
  116. package/paragraph/Paragraph.js +5 -5
  117. package/password-input/PasswordInput.test.js +1 -1
  118. package/progress-bar/ProgressBar.d.ts +2 -2
  119. package/progress-bar/ProgressBar.js +5 -5
  120. package/progress-bar/ProgressBar.stories.jsx +35 -2
  121. package/progress-bar/ProgressBar.test.js +1 -1
  122. package/progress-bar/types.d.ts +4 -3
  123. package/quick-nav/QuickNav.stories.tsx +14 -0
  124. package/radio-group/Radio.js +10 -10
  125. package/radio-group/RadioGroup.js +8 -10
  126. package/radio-group/RadioGroup.stories.tsx +131 -18
  127. package/radio-group/RadioGroup.test.js +1 -1
  128. package/resultsetTable/Icons.d.ts +7 -0
  129. package/resultsetTable/Icons.js +51 -0
  130. package/resultsetTable/ResultsetTable.js +49 -106
  131. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  132. package/resultsetTable/ResultsetTable.test.js +41 -64
  133. package/resultsetTable/types.d.ts +1 -1
  134. package/select/Listbox.d.ts +1 -1
  135. package/select/Listbox.js +5 -34
  136. package/select/Option.js +11 -24
  137. package/select/Select.js +56 -35
  138. package/select/Select.stories.tsx +494 -150
  139. package/select/Select.test.js +76 -81
  140. package/select/types.d.ts +2 -2
  141. package/sidenav/Icons.d.ts +7 -0
  142. package/sidenav/Icons.js +51 -0
  143. package/sidenav/Sidenav.d.ts +2 -2
  144. package/sidenav/Sidenav.js +66 -96
  145. package/sidenav/Sidenav.stories.tsx +165 -63
  146. package/sidenav/types.d.ts +21 -18
  147. package/slider/Slider.d.ts +2 -2
  148. package/slider/Slider.js +11 -11
  149. package/slider/Slider.stories.tsx +57 -0
  150. package/slider/Slider.test.js +1 -1
  151. package/slider/types.d.ts +6 -2
  152. package/spinner/Spinner.js +17 -23
  153. package/spinner/Spinner.stories.jsx +53 -27
  154. package/spinner/Spinner.test.js +1 -1
  155. package/switch/Switch.d.ts +3 -3
  156. package/switch/Switch.js +7 -6
  157. package/switch/Switch.stories.tsx +33 -0
  158. package/switch/Switch.test.js +1 -1
  159. package/switch/types.d.ts +8 -3
  160. package/table/Table.js +2 -2
  161. package/table/Table.stories.jsx +80 -1
  162. package/table/Table.test.js +2 -2
  163. package/tabs/Tab.js +12 -15
  164. package/tabs/Tabs.js +11 -17
  165. package/tabs/Tabs.stories.tsx +45 -5
  166. package/tabs/Tabs.test.js +4 -5
  167. package/tabs/types.d.ts +2 -2
  168. package/tag/Tag.js +7 -9
  169. package/tag/Tag.stories.tsx +14 -1
  170. package/tag/Tag.test.js +1 -1
  171. package/text-input/Suggestion.js +34 -7
  172. package/text-input/TextInput.js +11 -15
  173. package/text-input/TextInput.stories.tsx +93 -5
  174. package/text-input/TextInput.test.js +587 -635
  175. package/textarea/Textarea.js +3 -4
  176. package/textarea/Textarea.stories.jsx +60 -1
  177. package/textarea/Textarea.test.js +2 -4
  178. package/toggle-group/ToggleGroup.d.ts +2 -2
  179. package/toggle-group/ToggleGroup.js +7 -4
  180. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  181. package/toggle-group/ToggleGroup.test.js +1 -1
  182. package/toggle-group/types.d.ts +1 -1
  183. package/typography/Typography.d.ts +2 -2
  184. package/typography/Typography.js +14 -113
  185. package/typography/Typography.stories.tsx +1 -1
  186. package/useTheme.d.ts +1234 -1
  187. package/useTheme.js +1 -1
  188. package/useTranslatedLabels.d.ts +84 -1
  189. package/utils/BaseTypography.d.ts +21 -0
  190. package/utils/BaseTypography.js +108 -0
  191. package/utils/FocusLock.d.ts +13 -0
  192. package/utils/FocusLock.js +138 -0
  193. package/wizard/Wizard.js +2 -2
  194. package/wizard/Wizard.stories.tsx +20 -0
  195. package/wizard/Wizard.test.js +1 -1
  196. package/wizard/types.d.ts +5 -6
  197. package/common/RequiredComponent.js +0 -32
  198. /package/{tabs-nav → grid}/types.js +0 -0
  199. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  200. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  201. /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -9,12 +11,33 @@ exports["default"] = void 0;
9
11
 
10
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
13
 
12
- var _react = _interopRequireDefault(require("react"));
14
+ var _react = _interopRequireWildcard(require("react"));
13
15
 
14
16
  var _styledComponents = _interopRequireDefault(require("styled-components"));
15
17
 
16
18
  var _templateObject, _templateObject2;
17
19
 
20
+ 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); }
21
+
22
+ 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; }
23
+
24
+ var transformSpecialChars = function transformSpecialChars(str) {
25
+ var specialCharsRegex = /[\\*()\[\]{}+?/]/;
26
+ var value = str;
27
+
28
+ if (specialCharsRegex.test(value)) {
29
+ var regexAsString = specialCharsRegex.toString().split("");
30
+ var uniqueSpecialChars = regexAsString.filter(function (item, index) {
31
+ return regexAsString.indexOf(item) === index;
32
+ });
33
+ uniqueSpecialChars.forEach(function (specialChar) {
34
+ if (str.includes(specialChar)) value = value.replace(specialChar, "\\" + specialChar);
35
+ });
36
+ }
37
+
38
+ return value;
39
+ };
40
+
18
41
  var Suggestion = function Suggestion(_ref) {
19
42
  var id = _ref.id,
20
43
  value = _ref.value,
@@ -23,9 +46,13 @@ var Suggestion = function Suggestion(_ref) {
23
46
  isLast = _ref.isLast,
24
47
  visuallyFocused = _ref.visuallyFocused,
25
48
  highlighted = _ref.highlighted;
26
- var regEx = new RegExp(value, "i");
27
- var matchedWords = suggestion.match(regEx);
28
- var noMatchedWords = suggestion.replace(regEx, "");
49
+ var matchedSuggestion = (0, _react.useMemo)(function () {
50
+ var regEx = new RegExp(transformSpecialChars(value), "i");
51
+ return {
52
+ matchedWords: suggestion.match(regEx),
53
+ noMatchedWords: suggestion.replace(regEx, "")
54
+ };
55
+ }, [value, suggestion]);
29
56
  return /*#__PURE__*/_react["default"].createElement(SuggestionContainer, {
30
57
  id: id,
31
58
  onClick: function onClick() {
@@ -35,9 +62,9 @@ var Suggestion = function Suggestion(_ref) {
35
62
  role: "option",
36
63
  "aria-selected": visuallyFocused ? true : undefined
37
64
  }, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
38
- last: isLast,
65
+ isLast: isLast,
39
66
  visuallyFocused: visuallyFocused
40
- }, highlighted ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords) : suggestion));
67
+ }, highlighted ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedSuggestion.matchedWords), matchedSuggestion.noMatchedWords) : suggestion));
41
68
  };
42
69
 
43
70
  var SuggestionContainer = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n box-shadow: inset 0 0 0 2px\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
@@ -49,7 +76,7 @@ var SuggestionContainer = _styledComponents["default"].li(_templateObject || (_t
49
76
  });
50
77
 
51
78
  var StyledSuggestion = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"])), function (props) {
52
- return props.last || props.visuallyFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
79
+ return props.isLast || props.visuallyFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
53
80
  });
54
81
 
55
82
  var _default = /*#__PURE__*/_react["default"].memo(Suggestion);
@@ -23,9 +23,9 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
23
23
 
24
24
  var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
25
25
 
26
- var _variables = require("../common/variables.js");
26
+ var _variables = require("../common/variables");
27
27
 
28
- var _utils = require("../common/utils.js");
28
+ var _utils = require("../common/utils");
29
29
 
30
30
  var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
31
31
 
@@ -39,7 +39,7 @@ var _Icons = _interopRequireDefault(require("./Icons"));
39
39
 
40
40
  var _uuid = require("uuid");
41
41
 
42
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
42
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
43
43
 
44
44
  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); }
45
45
 
@@ -547,7 +547,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
547
547
  backgroundType: backgroundType,
548
548
  tabIndex: tabIndex,
549
549
  type: "button"
550
- }, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
550
+ }, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
551
551
  src: action.icon
552
552
  }) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
553
553
  disabled: disabled,
@@ -559,7 +559,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
559
559
  }, error)));
560
560
  });
561
561
 
562
- var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
562
+ var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
563
563
  return calculateWidth(props.margin, props.size);
564
564
  }, function (props) {
565
565
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
@@ -635,39 +635,35 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
635
635
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
636
636
  });
637
637
 
638
- var ActionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
639
-
640
- var Action = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"])), function (props) {
641
- return props.theme.fontFamily;
642
- }, function (props) {
638
+ var Action = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n border: 1px solid transparent;\n border-radius: 2px;\n width: 24px;\n height: 24px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n img, svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
643
639
  return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
644
640
  }, function (props) {
645
641
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
646
642
  }, function (props) {
647
643
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
648
644
  }, function (props) {
649
- return !props.disabled && "\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
645
+ return !props.disabled && "\n &:focus, \n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
650
646
  });
651
647
 
652
- var Prefix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
648
+ var Prefix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
653
649
  var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
654
650
  return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
655
651
  }, function (props) {
656
652
  return props.theme.fontFamily;
657
653
  });
658
654
 
659
- var Suffix = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
655
+ var Suffix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
660
656
  var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
661
657
  return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
662
658
  }, function (props) {
663
659
  return props.theme.fontFamily;
664
660
  });
665
661
 
666
- var ErrorIcon = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
662
+ var ErrorIcon = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
667
663
  return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
668
664
  });
669
665
 
670
- var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
666
+ var Error = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
671
667
  return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
672
668
  }, function (props) {
673
669
  return props.theme.fontFamily;
@@ -11,6 +11,7 @@ import DxcFlex from "../flex/Flex";
11
11
  import Suggestions from "./Suggestions";
12
12
  import { ThemeProvider } from "styled-components";
13
13
  import useTheme from "../useTheme";
14
+ import { HalstackProvider } from "../HalstackContext";
14
15
 
15
16
  export default {
16
17
  title: "Text input",
@@ -27,7 +28,7 @@ const action = {
27
28
  ),
28
29
  };
29
30
 
30
- const actionLargeIcon = {
31
+ const actionLargeIconSVG = {
31
32
  onClick: () => {},
32
33
  icon: (
33
34
  <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
@@ -37,6 +38,11 @@ const actionLargeIcon = {
37
38
  ),
38
39
  };
39
40
 
41
+ const actionLargeIconURL = {
42
+ onClick: () => {},
43
+ icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
44
+ };
45
+
40
46
  const country = ["Afghanistan"];
41
47
  const countries = [
42
48
  "Afghanistan",
@@ -61,8 +67,16 @@ const countries = [
61
67
  "Dominica",
62
68
  "Denmark",
63
69
  "Djibouti",
70
+ "*",
64
71
  ];
65
72
 
73
+ const opinionatedTheme = {
74
+ textInput: {
75
+ fontColor: "#000000",
76
+ hoverBorderColor: "#a46ede",
77
+ },
78
+ };
79
+
66
80
  export const Chromatic = () => (
67
81
  <>
68
82
  <ExampleContainer pseudoState="pseudo-hover">
@@ -98,12 +112,21 @@ export const Chromatic = () => (
98
112
  <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
99
113
  </ExampleContainer>
100
114
  <ExampleContainer>
101
- <Title title="Clearable and large icon action" theme="light" level={4} />
115
+ <Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
102
116
  <DxcTextInput
103
117
  label="Text input"
104
118
  defaultValue="Text text text text text text text text text text"
105
119
  clearable
106
- action={actionLargeIcon}
120
+ action={actionLargeIconSVG}
121
+ />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="Clearable and large icon action (URL)" theme="light" level={4} />
125
+ <DxcTextInput
126
+ label="Text input"
127
+ defaultValue="Text text text text text text text text text text"
128
+ clearable
129
+ action={actionLargeIconURL}
107
130
  />
108
131
  </ExampleContainer>
109
132
  <ExampleContainer>
@@ -297,6 +320,66 @@ export const Chromatic = () => (
297
320
  <Title title="FillParent size" theme="light" level={4} />
298
321
  <DxcTextInput label="FillParent" size="fillParent" />
299
322
  </ExampleContainer>
323
+ <Title title="Opinionated theme" theme="light" level={2} />
324
+ <ExampleContainer>
325
+ <HalstackProvider theme={opinionatedTheme}>
326
+ <ExampleContainer pseudoState="pseudo-hover">
327
+ <Title title="Hovered input" theme="light" level={4} />
328
+ <DxcTextInput label="Text input" helperText="Help message" />
329
+ </ExampleContainer>
330
+ <ExampleContainer pseudoState="pseudo-focus-within">
331
+ <Title title="Focused input" theme="light" level={4} />
332
+ <DxcTextInput label="Text input" helperText="Help message" />
333
+ </ExampleContainer>
334
+ <ExampleContainer pseudoState="pseudo-hover">
335
+ <Title title="Hovered action" theme="light" level={4} />
336
+ <DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
337
+ </ExampleContainer>
338
+ <ExampleContainer pseudoState="pseudo-active">
339
+ <Title title="Actived action" theme="light" level={4} />
340
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
341
+ </ExampleContainer>
342
+ <ExampleContainer pseudoState="pseudo-focus">
343
+ <Title title="Focused action" theme="light" level={4} />
344
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
345
+ </ExampleContainer>
346
+ <ExampleContainer>
347
+ <Title title="Prefix" theme="light" level={4} />
348
+ <DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
349
+ </ExampleContainer>
350
+ <ExampleContainer>
351
+ <Title title="Suffix and action" theme="light" level={4} />
352
+ <DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
353
+ </ExampleContainer>
354
+ <ExampleContainer>
355
+ <Title title="Invalid" theme="light" level={4} />
356
+ <DxcTextInput
357
+ label="Error text input"
358
+ helperText="Help message"
359
+ error="Error message."
360
+ defaultValue="Text"
361
+ clearable
362
+ optional
363
+ action={action}
364
+ />
365
+ </ExampleContainer>
366
+ <ExampleContainer>
367
+ <Title title="Disabled and placeholder" theme="light" level={4} />
368
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
369
+ </ExampleContainer>
370
+ <ExampleContainer>
371
+ <Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
372
+ <DxcTextInput
373
+ label="Disabled text input"
374
+ helperText="Help message"
375
+ disabled
376
+ optional
377
+ defaultValue="Text"
378
+ action={action}
379
+ />
380
+ </ExampleContainer>
381
+ </HalstackProvider>
382
+ </ExampleContainer>
300
383
  </>
301
384
  );
302
385
 
@@ -308,7 +391,11 @@ const AutosuggestListbox = () => {
308
391
  <ExampleContainer>
309
392
  <Title title="Autosuggest listbox" theme="light" level={2} />
310
393
  <ExampleContainer>
311
- <Title title="List dialog uses a Radix Popover to appear over elements with a certain z-index" theme="light" level={3} />
394
+ <Title
395
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
396
+ theme="light"
397
+ level={3}
398
+ />
312
399
  <div
313
400
  style={{
314
401
  display: "flex",
@@ -322,6 +409,7 @@ const AutosuggestListbox = () => {
322
409
  borderRadius: "4px",
323
410
  overflow: "auto",
324
411
  zIndex: "1300",
412
+ position: "relative",
325
413
  }}
326
414
  >
327
415
  <DxcTextInput
@@ -434,7 +522,7 @@ const DarkAutosuggestListbox = () => {
434
522
  <Title title="Dark theme" theme="dark" level={2} />
435
523
  <ExampleContainer>
436
524
  <Title title="Default with opened suggestions" theme="dark" level={3} />
437
- <DxcFlex direction="column" gap="80px">
525
+ <DxcFlex direction="column" gap="5rem">
438
526
  <DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
439
527
  <DxcCheckbox
440
528
  label="You understand the selection and give your consent"