@dxc-technology/halstack-react 0.0.0-fdc49d2 → 0.0.0-ff5083e

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 (145) hide show
  1. package/HalstackContext.d.ts +12 -0
  2. package/HalstackContext.js +295 -0
  3. package/accordion/Accordion.js +5 -27
  4. package/accordion/Accordion.stories.tsx +3 -3
  5. package/accordion-group/AccordionGroup.d.ts +1 -1
  6. package/accordion-group/AccordionGroup.js +13 -15
  7. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  8. package/accordion-group/AccordionGroup.test.js +24 -6
  9. package/accordion-group/types.d.ts +4 -0
  10. package/alert/Alert.js +4 -1
  11. package/badge/Badge.d.ts +1 -1
  12. package/badge/Badge.js +5 -3
  13. package/badge/types.d.ts +1 -0
  14. package/bleed/Bleed.js +1 -34
  15. package/bleed/Bleed.stories.tsx +31 -32
  16. package/bleed/types.d.ts +1 -1
  17. package/box/Box.js +22 -32
  18. package/bulleted-list/BulletedList.d.ts +7 -0
  19. package/bulleted-list/BulletedList.js +120 -0
  20. package/bulleted-list/BulletedList.stories.tsx +203 -0
  21. package/bulleted-list/types.d.ts +11 -0
  22. package/{list → bulleted-list}/types.js +0 -0
  23. package/button/Button.js +14 -11
  24. package/card/Card.js +24 -27
  25. package/checkbox/Checkbox.d.ts +1 -1
  26. package/checkbox/Checkbox.js +38 -28
  27. package/checkbox/Checkbox.stories.tsx +124 -128
  28. package/checkbox/types.d.ts +3 -3
  29. package/common/variables.js +197 -84
  30. package/date-input/DateInput.js +38 -20
  31. package/date-input/DateInput.test.js +9 -22
  32. package/date-input/types.d.ts +12 -9
  33. package/dialog/Dialog.js +4 -32
  34. package/dropdown/Dropdown.js +13 -17
  35. package/file-input/FileInput.js +9 -6
  36. package/file-input/FileItem.js +7 -5
  37. package/footer/Footer.js +15 -88
  38. package/header/Header.js +27 -48
  39. package/header/Header.stories.tsx +46 -36
  40. package/header/Header.test.js +18 -2
  41. package/inset/Inset.js +1 -34
  42. package/inset/Inset.stories.tsx +32 -32
  43. package/inset/types.d.ts +25 -1
  44. package/layout/ApplicationLayout.d.ts +4 -3
  45. package/layout/ApplicationLayout.js +82 -114
  46. package/layout/ApplicationLayout.stories.tsx +14 -59
  47. package/layout/Icons.d.ts +5 -0
  48. package/layout/Icons.js +13 -2
  49. package/layout/SidenavContext.d.ts +5 -0
  50. package/layout/SidenavContext.js +19 -0
  51. package/layout/types.d.ts +5 -10
  52. package/link/Link.d.ts +3 -2
  53. package/link/Link.js +57 -74
  54. package/link/Link.stories.tsx +87 -52
  55. package/link/Link.test.js +7 -15
  56. package/link/types.d.ts +7 -23
  57. package/main.d.ts +6 -5
  58. package/main.js +37 -23
  59. package/number-input/NumberInput.test.js +2 -4
  60. package/number-input/types.d.ts +13 -10
  61. package/package.json +6 -5
  62. package/paginator/Paginator.js +17 -38
  63. package/paragraph/Paragraph.d.ts +6 -0
  64. package/paragraph/Paragraph.js +38 -0
  65. package/paragraph/Paragraph.stories.tsx +44 -0
  66. package/password-input/PasswordInput.js +7 -4
  67. package/password-input/PasswordInput.test.js +3 -6
  68. package/password-input/types.d.ts +14 -11
  69. package/progress-bar/ProgressBar.js +1 -1
  70. package/progress-bar/ProgressBar.stories.jsx +11 -11
  71. package/quick-nav/QuickNav.js +75 -23
  72. package/quick-nav/QuickNav.stories.tsx +13 -13
  73. package/quick-nav/types.d.ts +4 -8
  74. package/radio-group/Radio.js +1 -1
  75. package/radio-group/RadioGroup.js +8 -6
  76. package/select/Listbox.d.ts +4 -0
  77. package/select/Listbox.js +152 -0
  78. package/select/Option.js +1 -1
  79. package/select/Select.js +66 -161
  80. package/select/Select.stories.tsx +14 -2
  81. package/select/Select.test.js +335 -231
  82. package/select/types.d.ts +33 -11
  83. package/sidenav/Sidenav.d.ts +1 -1
  84. package/sidenav/Sidenav.js +20 -9
  85. package/slider/Slider.d.ts +1 -1
  86. package/slider/Slider.js +2 -1
  87. package/slider/Slider.stories.tsx +8 -8
  88. package/slider/Slider.test.js +31 -10
  89. package/slider/types.d.ts +4 -0
  90. package/spinner/Spinner.js +1 -1
  91. package/switch/Switch.d.ts +1 -1
  92. package/switch/Switch.js +19 -16
  93. package/switch/Switch.stories.tsx +8 -8
  94. package/switch/types.d.ts +2 -2
  95. package/tabs/Tabs.d.ts +1 -1
  96. package/tabs/Tabs.js +9 -11
  97. package/tabs/Tabs.stories.tsx +0 -8
  98. package/tabs/Tabs.test.js +26 -9
  99. package/tabs/types.d.ts +4 -0
  100. package/tabs-nav/NavTabs.d.ts +8 -0
  101. package/tabs-nav/NavTabs.js +125 -0
  102. package/tabs-nav/NavTabs.stories.tsx +170 -0
  103. package/tabs-nav/NavTabs.test.js +82 -0
  104. package/tabs-nav/Tab.d.ts +4 -0
  105. package/tabs-nav/Tab.js +132 -0
  106. package/tabs-nav/types.d.ts +53 -0
  107. package/{radio → tabs-nav}/types.js +0 -0
  108. package/tag/Tag.js +5 -8
  109. package/text-input/Suggestion.d.ts +4 -0
  110. package/text-input/Suggestion.js +55 -0
  111. package/text-input/TextInput.js +48 -76
  112. package/text-input/TextInput.test.js +22 -35
  113. package/text-input/types.d.ts +27 -12
  114. package/textarea/Textarea.js +10 -19
  115. package/textarea/types.d.ts +10 -7
  116. package/toggle-group/ToggleGroup.d.ts +1 -1
  117. package/toggle-group/ToggleGroup.js +5 -4
  118. package/toggle-group/ToggleGroup.stories.tsx +4 -4
  119. package/toggle-group/ToggleGroup.test.js +35 -4
  120. package/toggle-group/types.d.ts +8 -0
  121. package/typography/Typography.d.ts +4 -0
  122. package/typography/Typography.js +131 -0
  123. package/typography/Typography.stories.tsx +175 -0
  124. package/typography/types.d.ts +18 -0
  125. package/typography/types.js +5 -0
  126. package/typography/typographyContextTypes.d.ts +16 -0
  127. package/typography/typographyContextTypes.js +5 -0
  128. package/useTheme.js +2 -2
  129. package/useTranslatedLabels.d.ts +2 -0
  130. package/useTranslatedLabels.js +20 -0
  131. package/wizard/Wizard.js +35 -29
  132. package/ThemeContext.d.ts +0 -10
  133. package/ThemeContext.js +0 -243
  134. package/list/List.d.ts +0 -4
  135. package/list/List.js +0 -47
  136. package/list/List.stories.tsx +0 -95
  137. package/list/types.d.ts +0 -7
  138. package/radio/Radio.d.ts +0 -4
  139. package/radio/Radio.js +0 -174
  140. package/radio/Radio.stories.tsx +0 -192
  141. package/radio/Radio.test.js +0 -71
  142. package/radio/types.d.ts +0 -54
  143. package/text/Text.d.ts +0 -7
  144. package/text/Text.js +0 -30
  145. package/text/Text.stories.tsx +0 -19
@@ -37,7 +37,7 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
37
37
  _ref$helperText = _ref.helperText,
38
38
  helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
39
39
  _ref$overlay = _ref.overlay,
40
- overlay = _ref$overlay === void 0 ? true : _ref$overlay,
40
+ overlay = _ref$overlay === void 0 ? false : _ref$overlay,
41
41
  value = _ref.value,
42
42
  _ref$showValue = _ref.showValue,
43
43
  showValue = _ref$showValue === void 0 ? false : _ref$showValue,
@@ -12,40 +12,40 @@ export const Chromatic = () => (
12
12
  <>
13
13
  <ExampleContainer>
14
14
  <Title title="Without labels" theme="light" level={4} />
15
- <DxcProgressBar overlay={false} value={50} showValue />
15
+ <DxcProgressBar value={50} showValue />
16
16
  <Title title="With helperText" theme="light" level={4} />
17
- <DxcProgressBar helperText="Helper text" value={50} overlay={false} showValue />
17
+ <DxcProgressBar helperText="Helper text" value={50} showValue />
18
18
  <Title title="Without default value" theme="light" level={4} />
19
- <DxcProgressBar label="Loading..." overlay={false} showValue />
19
+ <DxcProgressBar label="Loading..." showValue />
20
20
  </ExampleContainer>
21
21
  <Title title="Margins" theme="light" level={2} />
22
22
  <ExampleContainer>
23
23
  <Title title="Xxsmall margin" theme="light" level={4} />
24
- <DxcProgressBar label="Margin xxsmall" margin="xxsmall" overlay={false} value={50} showValue />
24
+ <DxcProgressBar label="Margin xxsmall" margin="xxsmall" value={50} showValue />
25
25
  </ExampleContainer>
26
26
  <ExampleContainer>
27
27
  <Title title="Xsmall margin" theme="light" level={4} />
28
- <DxcProgressBar label="Margin xsmall" margin="xsmall" overlay={false} value={50} showValue />
28
+ <DxcProgressBar label="Margin xsmall" margin="xsmall" value={50} showValue />
29
29
  </ExampleContainer>
30
30
  <ExampleContainer>
31
31
  <Title title="Small margin" theme="light" level={4} />
32
- <DxcProgressBar label="Margin small" margin="small" overlay={false} value={50} showValue />
32
+ <DxcProgressBar label="Margin small" margin="small" value={50} showValue />
33
33
  </ExampleContainer>
34
34
  <ExampleContainer>
35
35
  <Title title="Medium margin" theme="light" level={4} />
36
- <DxcProgressBar label="Margin medium" margin="medium" overlay={false} value={50} showValue />
36
+ <DxcProgressBar label="Margin medium" margin="medium" value={50} showValue />
37
37
  </ExampleContainer>
38
38
  <ExampleContainer>
39
39
  <Title title="Large margin" theme="light" level={4} />
40
- <DxcProgressBar label="Margin large" margin="large" overlay={false} value={50} showValue />
40
+ <DxcProgressBar label="Margin large" margin="large" value={50} showValue />
41
41
  </ExampleContainer>
42
42
  <ExampleContainer>
43
43
  <Title title="Xlarge margin" theme="light" level={4} />
44
- <DxcProgressBar label="Margin xlarge" margin="xlarge" overlay={false} value={50} showValue />
44
+ <DxcProgressBar label="Margin xlarge" margin="xlarge" value={50} showValue />
45
45
  </ExampleContainer>
46
46
  <ExampleContainer>
47
47
  <Title title="XxLarge margin" theme="light" level={4} />
48
- <DxcProgressBar label="Margin xxlarge" margin="xxlarge" overlay={false} value={50} showValue />
48
+ <DxcProgressBar label="Margin xxlarge" margin="xxlarge" value={50} showValue />
49
49
  </ExampleContainer>
50
50
  </>
51
51
  );
@@ -53,6 +53,6 @@ export const Chromatic = () => (
53
53
  export const ProgressBarOverlay = () => (
54
54
  <ExampleContainer>
55
55
  <Title title="Overlay" theme="dark" level={4} />
56
- <DxcProgressBar label="Overlay" helperText="Helper text" showValue value={50} />
56
+ <DxcProgressBar label="Overlay" helperText="Helper text" overlay={true} showValue value={50} />
57
57
  </ExampleContainer>
58
58
  );
@@ -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
  });
@@ -11,7 +13,11 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
11
13
 
12
14
  var _react = _interopRequireDefault(require("react"));
13
15
 
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
16
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
+
18
+ var _slugify = _interopRequireDefault(require("slugify"));
19
+
20
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
15
21
 
16
22
  var _Heading = _interopRequireDefault(require("../heading/Heading"));
17
23
 
@@ -19,42 +25,88 @@ var _Stack = _interopRequireDefault(require("../stack/Stack"));
19
25
 
20
26
  var _Inset = _interopRequireDefault(require("../inset/Inset"));
21
27
 
22
- var _templateObject, _templateObject2;
28
+ var _Typography = _interopRequireDefault(require("../typography/Typography"));
29
+
30
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
31
+
32
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
33
+
34
+ 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); }
35
+
36
+ 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
37
 
24
38
  var DxcQuickNav = function DxcQuickNav(_ref) {
25
39
  var title = _ref.title,
26
40
  links = _ref.links;
27
- return /*#__PURE__*/_react["default"].createElement(QuickNavContainer, null, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
28
- gutter: "small"
41
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
42
+ var colorsTheme = (0, _useTheme["default"])();
43
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
44
+ theme: colorsTheme.quickNav
45
+ }, /*#__PURE__*/_react["default"].createElement(QuickNavContainer, null, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
46
+ gutter: "xsmall"
29
47
  }, /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
30
48
  level: 4,
31
- text: title
32
- }), /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
49
+ text: title || translatedLabels.quickNav.contentTitle
50
+ }), /*#__PURE__*/_react["default"].createElement(ListColumn, null, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
33
51
  gutter: "xsmall"
34
52
  }, links.map(function (link) {
35
53
  var _link$links;
36
54
 
37
- return /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
38
- space: "xxsmall"
39
- }, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
40
- gutter: "xsmall"
41
- }, /*#__PURE__*/_react["default"].createElement(Link, {
42
- href: "#".concat(link === null || link === void 0 ? void 0 : link.id)
55
+ return /*#__PURE__*/_react["default"].createElement(ListRow, null, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
56
+ space: "0.25rem"
57
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
58
+ href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
59
+ lower: true
60
+ }))
43
61
  }, link === null || link === void 0 ? void 0 : link.label), (_link$links = link.links) === null || _link$links === void 0 ? void 0 : _link$links.map(function (sublink) {
44
- return /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
45
- horizontal: "xsmall"
46
- }, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
47
- gutter: "xsmall"
48
- }, /*#__PURE__*/_react["default"].createElement(Link, {
49
- href: "#".concat(sublink === null || sublink === void 0 ? void 0 : sublink.id)
50
- }, sublink === null || sublink === void 0 ? void 0 : sublink.label)));
51
- })));
52
- }))));
62
+ return /*#__PURE__*/_react["default"].createElement(ListRow, null, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
63
+ horizontal: "0.5rem"
64
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
65
+ href: "#".concat((0, _slugify["default"])(sublink === null || sublink === void 0 ? void 0 : sublink.label, {
66
+ lower: true
67
+ }))
68
+ }, sublink === null || sublink === void 0 ? void 0 : sublink.label))));
69
+ }))));
70
+ }))))));
53
71
  };
54
72
 
55
- var QuickNavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding: 5px 15px;\n border-left: 2px solid #bfbfbf;\n"])));
73
+ var QuickNavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n border-left: 2px solid ", ";\n"])), function (props) {
74
+ return props.theme.paddingTop;
75
+ }, function (props) {
76
+ return props.theme.paddingBottom;
77
+ }, function (props) {
78
+ return props.theme.paddingLeft;
79
+ }, function (props) {
80
+ return props.theme.paddingRight;
81
+ }, function (props) {
82
+ return props.theme.dividerBorderColor;
83
+ });
84
+
85
+ var ListColumn = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n list-style-type: none;\n margin: 0;\n padding: 0;\n"])));
86
+
87
+ var ListRow = _styledComponents["default"].li(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
56
88
 
57
- var Link = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n font-size: 14px;\n color: #666666;\n &:hover {\n color: #ab63cf;\n }\n &:focus {\n border-radius: 2px;\n border-color: #0095ff;\n }\n"])));
89
+ var Link = _styledComponents["default"].a(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n &:focus {\n outline-color: ", ";\n outline-style: ", ";\n outline-width: ", ";\n border-radius: ", ";\n }\n"])), function (props) {
90
+ return props.theme.fontSize;
91
+ }, function (props) {
92
+ return props.theme.fontFamily;
93
+ }, function (props) {
94
+ return props.theme.fontStyle;
95
+ }, function (props) {
96
+ return props.theme.fontWeight;
97
+ }, function (props) {
98
+ return props.theme.fontColor;
99
+ }, function (props) {
100
+ return props.theme.hoverFontColor;
101
+ }, function (props) {
102
+ return props.theme.focusBorderColor;
103
+ }, function (props) {
104
+ return props.theme.focusBorderStyle;
105
+ }, function (props) {
106
+ return props.theme.focusBorderThickness;
107
+ }, function (props) {
108
+ return props.theme.focusBorderRadius;
109
+ });
58
110
 
59
111
  var _default = DxcQuickNav;
60
112
  exports["default"] = _default;
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import DxcQuickNav from "./QuickNav";
4
4
  import DxcHeading from "../heading/Heading";
5
- import DxcText from "../text/Text";
5
+ import DxcTypography from "../typography/Typography";
6
6
  import Title from "../../.storybook/components/Title";
7
7
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
8
8
 
@@ -38,13 +38,13 @@ export const Chromatic = () => (
38
38
  <ExampleContainer>
39
39
  <Title title="Default" level={4} />
40
40
  <QuickNavContainer>
41
- <DxcQuickNav title="Sections" links={links}></DxcQuickNav>
41
+ <DxcQuickNav links={links}></DxcQuickNav>
42
42
  </QuickNavContainer>
43
43
  </ExampleContainer>
44
44
  <ExampleContainer pseudoState="pseudo-hover">
45
45
  <Title title="Link hovered" level={4} />
46
46
  <QuickNavContainer>
47
- <DxcQuickNav title="Sections" links={links}></DxcQuickNav>
47
+ <DxcQuickNav links={links}></DxcQuickNav>
48
48
  </QuickNavContainer>
49
49
  </ExampleContainer>
50
50
  <ExampleContainer>
@@ -53,7 +53,7 @@ export const Chromatic = () => (
53
53
  <ContentContainer>
54
54
  <Content id="overview">
55
55
  <DxcHeading level={1} text="Overview" margin={{ bottom: "small" }} />
56
- <DxcText>
56
+ <DxcTypography>
57
57
  Halstack is the DXC Technology's open source design system for insurance products and digital experiences.
58
58
  Our system provides all the tools and resources needed to create superior, beautiful but above all,
59
59
  functional user experiences. Halstack is the DXC Technology's open source design system for insurance
@@ -70,10 +70,10 @@ export const Chromatic = () => (
70
70
  create superior, beautiful but above all, functional user experiences.Halstack is the DXC Technology's
71
71
  open source design system for insurance products and digital experiences. Our system provides all the
72
72
  tools and resources needed to create superior, beautiful but above all, functional user experiences.
73
- </DxcText>
73
+ </DxcTypography>
74
74
  <Content id="introduction">
75
75
  <DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
76
- <DxcText>
76
+ <DxcTypography>
77
77
  Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
78
78
  provide guidance for development teams in order to deliver delightful and consistent user experiences to
79
79
  our customers: Balance Consistency Visual hierarchy All our components, design tokens, accessibility
@@ -103,14 +103,14 @@ export const Chromatic = () => (
103
103
  to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
104
104
  design new features, or help us improve the project documentation. If you're interested, definitely
105
105
  check out our contribution guidelines.
106
- </DxcText>
106
+ </DxcTypography>
107
107
  </Content>
108
108
  </Content>
109
109
  <Content id="principles">
110
110
  <DxcHeading level={1} text="Principles" margin={{ top: "small", bottom: "xsmall" }} />
111
111
  <Content id="color">
112
112
  <DxcHeading level={2} text="Color" margin={{ top: "xsmall", bottom: "xsmall" }} />
113
- <DxcText>
113
+ <DxcTypography>
114
114
  The color palette is an essential asset as a communication resource of our design system. Halstack color
115
115
  palette brings a unified consistency and helps in guiding the user's perception order. Our color palette
116
116
  is based in the HSL model . All our color families are calculated using the lightness value of the
@@ -143,11 +143,11 @@ export const Chromatic = () => (
143
143
  tokens to manage color. Appart from a multi-purpose greyscale family, purple and blue are the core color
144
144
  families used in our set of components. Additional families as red, green and yellow help as feedback
145
145
  role-based color palettes and must not be used outside this context.
146
- </DxcText>
146
+ </DxcTypography>
147
147
  </Content>
148
148
  <Content id="spacing">
149
149
  <DxcHeading level={2} text="Spacing" margin={{ top: "xsmall", bottom: "xsmall" }} />
150
- <DxcText>
150
+ <DxcTypography>
151
151
  In the search of consistent alignment between the elements we provide a spacing scale based on a root
152
152
  values of 8px and 4px. The numbers 4 and 8 are easily multiplied, they provide flexible and consistent,
153
153
  yet distinct enough, steps between them.In the search of consistent alignment between the elements we
@@ -165,11 +165,11 @@ export const Chromatic = () => (
165
165
  consistent, yet distinct enough, steps between them.In the search of consistent alignment between the
166
166
  elements we provide a spacing scale based on a root values of 8px and 4px. The numbers 4 and 8 are
167
167
  easily multiplied, they provide flexible and consistent, yet distinct enough, steps between them.
168
- </DxcText>
168
+ </DxcTypography>
169
169
  </Content>
170
170
  <Content id="typography">
171
171
  <DxcHeading level={2} text="Typography" margin={{ top: "xsmall", bottom: "xsmall" }} />
172
- <DxcText>
172
+ <DxcTypography>
173
173
  Our selected typography helps in structuring our user's experience based on the visual impact that it
174
174
  has on the user interface content. It defines what is the first noticeable piece of information or data
175
175
  based on the font shape, size, color, or type and it highlights some pieces of text over the rest. Some
@@ -201,7 +201,7 @@ export const Chromatic = () => (
201
201
  Halstack Design System include headers, body, taglines, captions, and labels. Make sure you include all
202
202
  the different typographic variants in order to enhance the application's content structure, including
203
203
  the Heading component which defines different levels of page and section titles.
204
- </DxcText>
204
+ </DxcTypography>
205
205
  </Content>
206
206
  </Content>
207
207
  </ContentContainer>
@@ -2,24 +2,20 @@ declare type Props = {
2
2
  /**
3
3
  * Title of the quick nav component.
4
4
  */
5
- title: string;
5
+ title?: string;
6
6
  /**
7
7
  * Links to be shown inside the quick nav component.
8
8
  */
9
- links: Link[];
9
+ links: LinkType[];
10
10
  };
11
- declare type Link = {
11
+ declare type LinkType = {
12
12
  /**
13
13
  * Label to be shown in the link.
14
14
  */
15
15
  label: string;
16
- /**
17
- * Id used to navigate to the section that the link refers. This id must be passed to the wrapper that contains the section to make possible the navigation.
18
- */
19
- id: string;
20
16
  /**
21
17
  * Sublinks of the link.
22
18
  */
23
- links?: Link[];
19
+ links?: LinkType[];
24
20
  };
25
21
  export default Props;
@@ -133,7 +133,7 @@ var Label = _styledComponents["default"].span(_templateObject6 || (_templateObje
133
133
  }, function (props) {
134
134
  return props.theme.radioInputLabelLineHeight;
135
135
  }, function (props) {
136
- return props.disabled && "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;");
136
+ return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;") : "color: ".concat(props.theme.radioInputLabelFontColor);
137
137
  });
138
138
 
139
139
  var _default = /*#__PURE__*/_react["default"].memo(DxcRadio);
@@ -23,6 +23,8 @@ var _uuid = require("uuid");
23
23
 
24
24
  var _useTheme = _interopRequireDefault(require("../useTheme"));
25
25
 
26
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
27
+
26
28
  var _Radio = _interopRequireDefault(require("./Radio"));
27
29
 
28
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
@@ -47,8 +49,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
47
49
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
48
50
  _ref$optional = _ref.optional,
49
51
  optional = _ref$optional === void 0 ? false : _ref$optional,
50
- _ref$optionalItemLabe = _ref.optionalItemLabel,
51
- optionalItemLabel = _ref$optionalItemLabe === void 0 ? "N/A" : _ref$optionalItemLabe,
52
+ optionalItemLabel = _ref.optionalItemLabel,
52
53
  _ref$readonly = _ref.readonly,
53
54
  readonly = _ref$readonly === void 0 ? false : _ref$readonly,
54
55
  _ref$stacking = _ref.stacking,
@@ -78,8 +79,10 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
78
79
  firstTimeFocus = _useState6[0],
79
80
  setFirstTimeFocus = _useState6[1];
80
81
 
82
+ var colorsTheme = (0, _useTheme["default"])();
83
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
81
84
  var optionalItem = {
82
- label: optionalItemLabel,
85
+ label: optionalItemLabel || translatedLabels.radioGroup.optionalItemLabelDefault,
83
86
  value: "",
84
87
  disabled: disabled
85
88
  };
@@ -92,7 +95,6 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
92
95
  currentFocusIndex = _useState8[0],
93
96
  setCurrentFocusIndex = _useState8[1];
94
97
 
95
- var colorsTheme = (0, _useTheme["default"])();
96
98
  var handleOnChange = (0, _react.useCallback)(function (newValue) {
97
99
  var currentValue = value !== null && value !== void 0 ? value : innerValue;
98
100
 
@@ -109,7 +111,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
109
111
  var currentValue = value !== null && value !== void 0 ? value : innerValue;
110
112
  !optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
111
113
  value: currentValue,
112
- error: "This field is required. Please, choose an option."
114
+ error: translatedLabels.formFields.requiredSelectionErrorMessage
113
115
  }) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
114
116
  value: currentValue
115
117
  });
@@ -182,7 +184,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
182
184
  id: radioGroupLabelId,
183
185
  helperText: helperText,
184
186
  disabled: disabled
185
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
187
+ }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
186
188
  disabled: disabled
187
189
  }, helperText), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
188
190
  onBlur: handleOnBlur,
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ListboxProps } from "./types";
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ListboxProps & React.RefAttributes<HTMLUListElement>>>;
4
+ export default _default;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
+
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
19
+
20
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
21
+
22
+ var _Option = _interopRequireDefault(require("./Option"));
23
+
24
+ var _Icons = _interopRequireDefault(require("./Icons"));
25
+
26
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
27
+
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
+
30
+ 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; }
31
+
32
+ var groupsHaveOptions = function groupsHaveOptions(options) {
33
+ return options !== null && options !== void 0 && options[0].options ? options.some(function (groupOption) {
34
+ var _groupOption$options;
35
+
36
+ return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
37
+ }) : true;
38
+ };
39
+
40
+ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
41
+ var id = _ref.id,
42
+ currentValue = _ref.currentValue,
43
+ options = _ref.options,
44
+ visualFocusIndex = _ref.visualFocusIndex,
45
+ lastOptionIndex = _ref.lastOptionIndex,
46
+ multiple = _ref.multiple,
47
+ optional = _ref.optional,
48
+ optionalItem = _ref.optionalItem,
49
+ searchable = _ref.searchable,
50
+ handleOptionOnClick = _ref.handleOptionOnClick;
51
+ var colorsTheme = (0, _useTheme["default"])();
52
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
53
+ var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
54
+
55
+ var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
56
+ if (option.options) {
57
+ var groupId = "group-".concat(mapIndex);
58
+ return option.options.length > 0 && /*#__PURE__*/_react["default"].createElement("li", {
59
+ key: "group-".concat(mapIndex)
60
+ }, /*#__PURE__*/_react["default"].createElement(GroupList, {
61
+ role: "group",
62
+ "aria-labelledby": groupId
63
+ }, /*#__PURE__*/_react["default"].createElement(GroupLabel, {
64
+ role: "presentation",
65
+ id: groupId
66
+ }, option.label), option.options.map(function (singleOption) {
67
+ globalIndex++;
68
+ return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
69
+ key: "option-".concat(singleOption.value),
70
+ id: "option-".concat(globalIndex),
71
+ option: singleOption,
72
+ onClick: handleOptionOnClick,
73
+ multiple: multiple,
74
+ visualFocused: visualFocusIndex === globalIndex,
75
+ isGroupedOption: true,
76
+ isLastOption: lastOptionIndex === globalIndex,
77
+ isSelected: multiple ? currentValue.includes(singleOption.value) : currentValue === singleOption.value
78
+ });
79
+ })));
80
+ } else {
81
+ globalIndex++;
82
+ return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
83
+ key: "option-".concat(option.value),
84
+ id: "option-".concat(globalIndex),
85
+ option: option,
86
+ onClick: handleOptionOnClick,
87
+ multiple: multiple,
88
+ visualFocused: visualFocusIndex === globalIndex,
89
+ isLastOption: lastOptionIndex === globalIndex,
90
+ isSelected: multiple ? currentValue.includes(option.value) : currentValue === option.value
91
+ });
92
+ }
93
+ };
94
+
95
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
96
+ theme: colorsTheme.select
97
+ }, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
98
+ id: id,
99
+ onClick: function onClick(event) {
100
+ event.stopPropagation();
101
+ },
102
+ onMouseDown: function onMouseDown(event) {
103
+ event.preventDefault();
104
+ },
105
+ ref: ref,
106
+ role: "listbox",
107
+ "aria-multiselectable": multiple,
108
+ "aria-orientation": "vertical"
109
+ }, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
110
+ key: "option-".concat(optionalItem.value),
111
+ id: "option-".concat(0),
112
+ option: optionalItem,
113
+ onClick: handleOptionOnClick,
114
+ multiple: multiple,
115
+ visualFocused: visualFocusIndex === 0,
116
+ isGroupedOption: false,
117
+ isLastOption: lastOptionIndex === 0,
118
+ isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
119
+ }), options.map(mapOptionFunc)));
120
+ });
121
+
122
+ var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-y: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0.25rem 0;\n width: 100%;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
123
+ return props.theme.listDialogBackgroundColor;
124
+ }, function (props) {
125
+ return props.theme.listDialogBorderColor;
126
+ }, function (props) {
127
+ return props.theme.listOptionFontColor;
128
+ }, function (props) {
129
+ return props.theme.fontFamily;
130
+ }, function (props) {
131
+ return props.theme.listOptionFontSize;
132
+ }, function (props) {
133
+ return props.theme.listOptionFontStyle;
134
+ }, function (props) {
135
+ return props.theme.listOptionFontWeight;
136
+ });
137
+
138
+ var OptionsSystemMessage = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"])), function (props) {
139
+ return props.theme.systemMessageFontColor;
140
+ });
141
+
142
+ var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: 0.25rem;\n"])));
143
+
144
+ var GroupList = _styledComponents["default"].ul(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0;\n"])));
145
+
146
+ var GroupLabel = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n font-weight: ", ";\n line-height: 1.715em;\n"])), function (props) {
147
+ return props.theme.listGroupLabelFontWeight;
148
+ });
149
+
150
+ var _default = /*#__PURE__*/_react["default"].memo(Listbox);
151
+
152
+ exports["default"] = _default;
package/select/Option.js CHANGED
@@ -39,7 +39,7 @@ var Option = function Option(_ref) {
39
39
  isSelected = _ref.isSelected;
40
40
  var colorsTheme = (0, _useTheme["default"])();
41
41
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
42
- theme: colorsTheme.radioGroup
42
+ theme: colorsTheme.select
43
43
  }, /*#__PURE__*/_react["default"].createElement(OptionItem, {
44
44
  id: id,
45
45
  onClick: function onClick() {