@dxc-technology/halstack-react 0.0.0-63ee6f9 → 0.0.0-64ec938

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 (163) hide show
  1. package/HalstackContext.d.ts +12 -0
  2. package/HalstackContext.js +295 -0
  3. package/accordion/Accordion.d.ts +1 -1
  4. package/accordion/Accordion.js +7 -28
  5. package/accordion/Accordion.stories.tsx +12 -12
  6. package/accordion/Accordion.test.js +19 -4
  7. package/accordion/types.d.ts +4 -0
  8. package/accordion-group/AccordionGroup.d.ts +1 -1
  9. package/accordion-group/AccordionGroup.js +14 -15
  10. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  11. package/accordion-group/AccordionGroup.test.js +24 -6
  12. package/accordion-group/types.d.ts +4 -0
  13. package/alert/Alert.js +4 -1
  14. package/badge/Badge.d.ts +1 -1
  15. package/badge/Badge.js +5 -3
  16. package/badge/types.d.ts +1 -0
  17. package/bleed/Bleed.js +1 -34
  18. package/bleed/Bleed.stories.tsx +94 -95
  19. package/bleed/types.d.ts +1 -1
  20. package/box/Box.js +22 -32
  21. package/bulleted-list/BulletedList.d.ts +7 -0
  22. package/bulleted-list/BulletedList.js +123 -0
  23. package/bulleted-list/BulletedList.stories.tsx +200 -0
  24. package/bulleted-list/types.d.ts +11 -0
  25. package/{list → bulleted-list}/types.js +0 -0
  26. package/button/Button.js +14 -11
  27. package/card/Card.js +24 -27
  28. package/checkbox/Checkbox.d.ts +1 -1
  29. package/checkbox/Checkbox.js +38 -28
  30. package/checkbox/Checkbox.stories.tsx +124 -128
  31. package/checkbox/types.d.ts +3 -3
  32. package/common/variables.js +197 -84
  33. package/date-input/DateInput.js +38 -20
  34. package/date-input/DateInput.test.js +9 -22
  35. package/date-input/types.d.ts +12 -9
  36. package/dialog/Dialog.js +4 -32
  37. package/dropdown/Dropdown.js +13 -17
  38. package/dropdown/Dropdown.stories.tsx +1 -1
  39. package/file-input/FileInput.js +9 -6
  40. package/file-input/FileItem.js +7 -5
  41. package/flex/Flex.d.ts +3 -0
  42. package/flex/Flex.js +74 -0
  43. package/flex/Flex.stories.tsx +103 -0
  44. package/flex/types.d.ts +21 -0
  45. package/{radio → flex}/types.js +0 -0
  46. package/footer/Footer.js +15 -88
  47. package/footer/Icons.js +1 -1
  48. package/header/Header.js +27 -48
  49. package/header/Header.stories.tsx +46 -36
  50. package/header/Header.test.js +18 -2
  51. package/inset/Inset.js +1 -34
  52. package/inset/Inset.stories.tsx +36 -36
  53. package/inset/types.d.ts +25 -1
  54. package/layout/ApplicationLayout.d.ts +4 -3
  55. package/layout/ApplicationLayout.js +68 -113
  56. package/layout/ApplicationLayout.stories.tsx +14 -59
  57. package/layout/Icons.d.ts +5 -0
  58. package/layout/Icons.js +13 -2
  59. package/layout/SidenavContext.d.ts +5 -0
  60. package/layout/SidenavContext.js +19 -0
  61. package/layout/types.d.ts +5 -10
  62. package/link/Link.d.ts +3 -2
  63. package/link/Link.js +57 -74
  64. package/link/Link.stories.tsx +88 -53
  65. package/link/Link.test.js +7 -15
  66. package/link/types.d.ts +7 -23
  67. package/main.d.ts +8 -5
  68. package/main.js +51 -21
  69. package/number-input/NumberInput.test.js +2 -4
  70. package/number-input/types.d.ts +13 -10
  71. package/package.json +7 -5
  72. package/paginator/Paginator.js +17 -38
  73. package/paginator/Paginator.test.js +42 -0
  74. package/paragraph/Paragraph.d.ts +6 -0
  75. package/paragraph/Paragraph.js +38 -0
  76. package/paragraph/Paragraph.stories.tsx +44 -0
  77. package/password-input/PasswordInput.js +7 -4
  78. package/password-input/PasswordInput.test.js +3 -6
  79. package/password-input/types.d.ts +14 -11
  80. package/progress-bar/ProgressBar.js +1 -1
  81. package/progress-bar/ProgressBar.stories.jsx +11 -11
  82. package/quick-nav/QuickNav.d.ts +4 -0
  83. package/quick-nav/QuickNav.js +118 -0
  84. package/quick-nav/QuickNav.stories.tsx +264 -0
  85. package/quick-nav/types.d.ts +21 -0
  86. package/quick-nav/types.js +5 -0
  87. package/radio-group/Radio.js +1 -1
  88. package/radio-group/RadioGroup.js +10 -7
  89. package/resultsetTable/ResultsetTable.test.js +42 -0
  90. package/select/Listbox.d.ts +4 -0
  91. package/select/Listbox.js +175 -0
  92. package/select/Option.js +1 -1
  93. package/select/Select.js +106 -186
  94. package/select/Select.stories.tsx +144 -100
  95. package/select/Select.test.js +377 -231
  96. package/select/types.d.ts +32 -11
  97. package/sidenav/Sidenav.d.ts +1 -1
  98. package/sidenav/Sidenav.js +20 -9
  99. package/slider/Slider.d.ts +1 -1
  100. package/slider/Slider.js +2 -1
  101. package/slider/Slider.stories.tsx +8 -8
  102. package/slider/Slider.test.js +31 -10
  103. package/slider/types.d.ts +4 -0
  104. package/spinner/Spinner.js +1 -1
  105. package/stack/Stack.d.ts +2 -1
  106. package/stack/Stack.js +29 -70
  107. package/stack/Stack.stories.tsx +189 -90
  108. package/stack/types.d.ts +15 -7
  109. package/switch/Switch.d.ts +1 -1
  110. package/switch/Switch.js +35 -19
  111. package/switch/Switch.stories.tsx +14 -14
  112. package/switch/Switch.test.js +25 -0
  113. package/switch/types.d.ts +6 -2
  114. package/tabs/Tabs.d.ts +1 -1
  115. package/tabs/Tabs.js +9 -11
  116. package/tabs/Tabs.stories.tsx +0 -8
  117. package/tabs/Tabs.test.js +26 -9
  118. package/tabs/types.d.ts +4 -0
  119. package/tabs-nav/NavTabs.d.ts +8 -0
  120. package/tabs-nav/NavTabs.js +125 -0
  121. package/tabs-nav/NavTabs.stories.tsx +170 -0
  122. package/tabs-nav/NavTabs.test.js +82 -0
  123. package/tabs-nav/Tab.d.ts +4 -0
  124. package/tabs-nav/Tab.js +132 -0
  125. package/tabs-nav/types.d.ts +53 -0
  126. package/tabs-nav/types.js +5 -0
  127. package/tag/Tag.js +5 -8
  128. package/text-input/Suggestion.d.ts +4 -0
  129. package/text-input/Suggestion.js +55 -0
  130. package/text-input/TextInput.js +48 -76
  131. package/text-input/TextInput.test.js +22 -35
  132. package/text-input/types.d.ts +27 -12
  133. package/textarea/Textarea.js +12 -23
  134. package/textarea/Textarea.test.js +10 -20
  135. package/textarea/types.d.ts +14 -11
  136. package/toggle-group/ToggleGroup.d.ts +1 -1
  137. package/toggle-group/ToggleGroup.js +5 -4
  138. package/toggle-group/ToggleGroup.stories.tsx +4 -4
  139. package/toggle-group/ToggleGroup.test.js +35 -4
  140. package/toggle-group/types.d.ts +8 -0
  141. package/typography/Typography.d.ts +4 -0
  142. package/typography/Typography.js +131 -0
  143. package/typography/Typography.stories.tsx +198 -0
  144. package/typography/types.d.ts +18 -0
  145. package/typography/types.js +5 -0
  146. package/useTheme.js +2 -2
  147. package/useTranslatedLabels.d.ts +2 -0
  148. package/useTranslatedLabels.js +20 -0
  149. package/wizard/Wizard.js +35 -29
  150. package/ThemeContext.d.ts +0 -10
  151. package/ThemeContext.js +0 -243
  152. package/list/List.d.ts +0 -4
  153. package/list/List.js +0 -47
  154. package/list/List.stories.tsx +0 -95
  155. package/list/types.d.ts +0 -7
  156. package/radio/Radio.d.ts +0 -4
  157. package/radio/Radio.js +0 -174
  158. package/radio/Radio.stories.tsx +0 -192
  159. package/radio/Radio.test.js +0 -71
  160. package/radio/types.d.ts +0 -54
  161. package/text/Text.d.ts +0 -7
  162. package/text/Text.js +0 -30
  163. package/text/Text.stories.tsx +0 -19
@@ -0,0 +1,38 @@
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 _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _Typography = _interopRequireDefault(require("../typography/Typography"));
15
+
16
+ var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
17
+
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
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 Paragraph = function Paragraph(_ref) {
25
+ var children = _ref.children;
26
+ var colorsTheme = (0, _useTheme["default"])();
27
+ var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
28
+ return /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
29
+ as: "p",
30
+ display: colorsTheme.paragraph.display,
31
+ fontSize: colorsTheme.paragraph.fontSize,
32
+ fontWeight: colorsTheme.paragraph.fontWeight,
33
+ color: backgroundType && backgroundType === "dark" ? colorsTheme.paragraph.fontColorOnDark : colorsTheme.paragraph.fontColor
34
+ }, children);
35
+ };
36
+
37
+ var _default = Paragraph;
38
+ exports["default"] = _default;
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import Title from "../../.storybook/components/Title";
3
+ import DxcParagraph from "./Paragraph";
4
+ import { BackgroundColorProvider } from "../BackgroundColorContext";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+ import DarkContainer from "../../.storybook/components/DarkSection";
7
+
8
+ export default {
9
+ title: "Paragraph",
10
+ component: DxcParagraph,
11
+ };
12
+
13
+ export const Chromatic = () => (
14
+ <>
15
+ <ExampleContainer>
16
+ <Title title="Default Paragraph" level={4} />
17
+ <DxcParagraph>
18
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id tortor sit amet velit auctor cursus id eget
19
+ nisl. Vivamus luctus egestas eros, at mattis libero eleifend ac. Integer vel urna rutrum, pretium arcu
20
+ dignissim, fringilla turpis. Nullam luctus odio quis magna finibus, a pharetra magna euismod. Nullam efficitur
21
+ semper pellentesque. Nulla eget arcu ac diam fringilla vehicula. In imperdiet nisl hendrerit, elementum metus
22
+ eu, ornare risus. Aenean neque nibh, vestibulum vitae elit vel, imperdiet suscipit leo. Curabitur blandit
23
+ iaculis pretium. Fusce id imperdiet dui, ut laoreet justo. Sed maximus sollicitudin ipsum, et varius massa
24
+ condimentum eget. Vivamus id mauris et nisl mattis consequat et id lectus. Quisque mollis lacinia nisl.
25
+ Suspendisse sed quam tincidunt, commodo dolor vel, tincidunt nisl.
26
+ </DxcParagraph>
27
+ </ExampleContainer>
28
+ <BackgroundColorProvider color="#333333">
29
+ <DarkContainer>
30
+ <Title title="Default Paragraph" theme="dark" level={4} />
31
+ <DxcParagraph>
32
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id tortor sit amet velit auctor cursus id eget
33
+ nisl. Vivamus luctus egestas eros, at mattis libero eleifend ac. Integer vel urna rutrum, pretium arcu
34
+ dignissim, fringilla turpis. Nullam luctus odio quis magna finibus, a pharetra magna euismod. Nullam efficitur
35
+ semper pellentesque. Nulla eget arcu ac diam fringilla vehicula. In imperdiet nisl hendrerit, elementum metus
36
+ eu, ornare risus. Aenean neque nibh, vestibulum vitae elit vel, imperdiet suscipit leo. Curabitur blandit
37
+ iaculis pretium. Fusce id imperdiet dui, ut laoreet justo. Sed maximus sollicitudin ipsum, et varius massa
38
+ condimentum eget. Vivamus id mauris et nisl mattis consequat et id lectus. Quisque mollis lacinia nisl.
39
+ Suspendisse sed quam tincidunt, commodo dolor vel, tincidunt nisl.
40
+ </DxcParagraph>
41
+ </DarkContainer>
42
+ </BackgroundColorProvider>
43
+ </>
44
+ );
@@ -19,6 +19,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
19
19
 
20
20
  var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
21
21
 
22
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
23
+
22
24
  var _templateObject;
23
25
 
24
26
  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); }
@@ -53,6 +55,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
53
55
  setIsPasswordVisible = _useState2[1];
54
56
 
55
57
  var inputRef = (0, _react.useRef)(null);
58
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
56
59
 
57
60
  var setInputType = function setInputType(type) {
58
61
  var _inputRef$current, _inputRef$current$chi;
@@ -82,18 +85,18 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
82
85
  };
83
86
 
84
87
  var getIconTitle = function getIconTitle() {
85
- return isPasswordVisible ? "Hide password" : "Show password";
88
+ return isPasswordVisible ? translatedLabels.passwordInput.inputHidePasswordTitle : translatedLabels.passwordInput.inputShowPasswordTitle;
86
89
  };
87
90
 
88
91
  (0, _react.useEffect)(function () {
89
- setAriaAttributes(false, "Show password");
92
+ setAriaAttributes(false, translatedLabels.passwordInput.inputShowPasswordTitle);
90
93
 
91
94
  if (isPasswordVisible) {
92
95
  setInputType("text");
93
- setAriaAttributes(true, "Hide password");
96
+ setAriaAttributes(true, translatedLabels.passwordInput.inputHidePasswordTitle);
94
97
  } else {
95
98
  setInputType("password");
96
- setAriaAttributes(false, "Show password");
99
+ setAriaAttributes(false, translatedLabels.passwordInput.inputShowPasswordTitle);
97
100
  }
98
101
  }, [isPasswordVisible]);
99
102
 
@@ -53,8 +53,7 @@ describe("Password input component tests", function () {
53
53
  _userEvent["default"].type(passwordInput, "Pa$$w0rd");
54
54
 
55
55
  expect(onChange).toHaveBeenCalledWith({
56
- value: "P",
57
- error: null
56
+ value: "P"
58
57
  });
59
58
  expect(passwordInput.value).toBe("Pa$$w0rd");
60
59
  });
@@ -74,8 +73,7 @@ describe("Password input component tests", function () {
74
73
  _react2.fireEvent.blur(passwordInput);
75
74
 
76
75
  expect(onBlur).toHaveBeenCalledWith({
77
- value: "Pa$$w0rd",
78
- error: null
76
+ value: "Pa$$w0rd"
79
77
  });
80
78
  expect(passwordInput.value).toBe("Pa$$w0rd");
81
79
  });
@@ -171,13 +169,12 @@ describe("Password input component tests", function () {
171
169
  var passwordInput = getByRole("textbox");
172
170
  expect(passwordInput.getAttribute("aria-autocomplete")).toBeNull();
173
171
  expect(passwordInput.getAttribute("aria-controls")).toBeNull();
172
+ expect(passwordInput.getAttribute("aria-expanded")).toBeNull();
174
173
  var showButton = getByRole("button");
175
- expect(showButton.getAttribute("aria-expanded")).toBe("false");
176
174
  expect(showButton.getAttribute("aria-label")).toBe("Show password");
177
175
 
178
176
  _userEvent["default"].click(showButton);
179
177
 
180
- expect(showButton.getAttribute("aria-expanded")).toBe("true");
181
178
  expect(showButton.getAttribute("aria-label")).toBe("Hide password");
182
179
  });
183
180
  });
@@ -30,25 +30,28 @@ declare type Props = {
30
30
  * This function will be called when the user types within the input
31
31
  * element of the component. An object including the current value and
32
32
  * the error (if the value entered is not valid) will be passed to this
33
- * function. If there is no error, error will be null.
33
+ * function. If there is no error, error will not be defined.
34
34
  * */
35
35
  onChange?: (val: {
36
36
  value: string;
37
- error: string | null;
37
+ error?: string;
38
38
  }) => void;
39
39
  /**
40
40
  * This function will be called when the input element loses the focus.
41
41
  * An object including the input value and the error (if the value entered is
42
- * not valid) will be passed to this function. If there is no error, error will be null.
42
+ * not valid) will be passed to this function. If there is no error, error will not be defined.
43
43
  */
44
44
  onBlur?: (val: {
45
45
  value: string;
46
- error: string | null;
46
+ error?: string;
47
47
  }) => void;
48
48
  /**
49
- * If it is defined, the component will change its appearance, showing
50
- * the error below the password input component. If it is not defined, the
51
- * error messages will be managed internally, but never displayed on its own.
49
+ * If it is a defined value and also a truthy string, the component will
50
+ * change its appearance, showing the error below the password input
51
+ * component. If the defined value is an empty string, it will reserve a
52
+ * space below the component for a future error, but it would not change
53
+ * its look. In case of being undefined or null, both the appearance and
54
+ * the space for the error message would not be modified.
52
55
  */
53
56
  error?: string;
54
57
  /**
@@ -58,7 +61,7 @@ declare type Props = {
58
61
  * the pattern, the onBlur and onChange functions will be called with the
59
62
  * current value and an internal error informing that this value does not
60
63
  * match the pattern. If the pattern is met, the error parameter of both
61
- * events will be null.
64
+ * events will not be defined.
62
65
  */
63
66
  pattern?: string;
64
67
  /**
@@ -68,7 +71,7 @@ declare type Props = {
68
71
  * comply the minimum length, the onBlur and onChange functions will be called
69
72
  * with the current value and an internal error informing that the value
70
73
  * length does not comply the specified range. If a valid length is
71
- * reached, the error parameter of both events will be null.
74
+ * reached, the error parameter of both events will not be defined.
72
75
  */
73
76
  minLength?: number;
74
77
  /**
@@ -78,7 +81,7 @@ declare type Props = {
78
81
  * comply the maximum length, the onBlur and onChange functions will be called
79
82
  * with the current value and an internal error informing that the value
80
83
  * length does not comply the specified range. If a valid length is
81
- * reached, the error parameter of both events will be null.
84
+ * reached, the error parameter of both events will not be defined.
82
85
  */
83
86
  maxLength?: number;
84
87
  /**
@@ -92,7 +95,7 @@ declare type Props = {
92
95
  */
93
96
  margin?: Space | Margin;
94
97
  /**
95
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
98
+ * Size of the component.
96
99
  */
97
100
  size?: "small" | "medium" | "large" | "fillParent";
98
101
  /**
@@ -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
  );
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import QuickNavTypes from "./types";
3
+ declare const DxcQuickNav: ({ title, links }: QuickNavTypes) => JSX.Element;
4
+ export default DxcQuickNav;
@@ -0,0 +1,118 @@
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 _slugify = _interopRequireDefault(require("slugify"));
19
+
20
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
21
+
22
+ var _Heading = _interopRequireDefault(require("../heading/Heading"));
23
+
24
+ var _Flex = _interopRequireDefault(require("../flex/Flex"));
25
+
26
+ var _Inset = _interopRequireDefault(require("../inset/Inset"));
27
+
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; }
37
+
38
+ var DxcQuickNav = function DxcQuickNav(_ref) {
39
+ var title = _ref.title,
40
+ links = _ref.links;
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(_Flex["default"], {
46
+ direction: "column",
47
+ gap: "0.5rem"
48
+ }, /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
49
+ level: 4,
50
+ text: title || translatedLabels.quickNav.contentTitle
51
+ }), /*#__PURE__*/_react["default"].createElement(ListColumn, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
52
+ direction: "column",
53
+ gap: "0.5rem"
54
+ }, links.map(function (link) {
55
+ var _link$links;
56
+
57
+ return /*#__PURE__*/_react["default"].createElement(ListRow, {
58
+ key: link.label
59
+ }, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
60
+ space: "0.25rem"
61
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
62
+ href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
63
+ lower: true
64
+ }))
65
+ }, 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) {
66
+ return /*#__PURE__*/_react["default"].createElement(ListRow, {
67
+ key: sublink.label
68
+ }, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
69
+ horizontal: "0.5rem"
70
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
71
+ href: "#".concat((0, _slugify["default"])(sublink === null || sublink === void 0 ? void 0 : sublink.label, {
72
+ lower: true
73
+ }))
74
+ }, sublink === null || sublink === void 0 ? void 0 : sublink.label))));
75
+ }))));
76
+ }))))));
77
+ };
78
+
79
+ 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) {
80
+ return props.theme.paddingTop;
81
+ }, function (props) {
82
+ return props.theme.paddingBottom;
83
+ }, function (props) {
84
+ return props.theme.paddingLeft;
85
+ }, function (props) {
86
+ return props.theme.paddingRight;
87
+ }, function (props) {
88
+ return props.theme.dividerBorderColor;
89
+ });
90
+
91
+ var ListColumn = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n list-style-type: none;\n margin: 0;\n padding: 0;\n width: 100%;\n"])));
92
+
93
+ var ListRow = _styledComponents["default"].li(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n"])));
94
+
95
+ 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 display: block;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n width: fit-content;\n max-width: 100%;\n\n &:hover {\n color: ", ";\n }\n &:focus {\n outline-color: ", ";\n outline-style: ", ";\n outline-width: ", ";\n border-radius: ", ";\n }\n"])), function (props) {
96
+ return props.theme.fontSize;
97
+ }, function (props) {
98
+ return props.theme.fontFamily;
99
+ }, function (props) {
100
+ return props.theme.fontStyle;
101
+ }, function (props) {
102
+ return props.theme.fontWeight;
103
+ }, function (props) {
104
+ return props.theme.fontColor;
105
+ }, function (props) {
106
+ return props.theme.hoverFontColor;
107
+ }, function (props) {
108
+ return props.theme.focusBorderColor;
109
+ }, function (props) {
110
+ return props.theme.focusBorderStyle;
111
+ }, function (props) {
112
+ return props.theme.focusBorderThickness;
113
+ }, function (props) {
114
+ return props.theme.focusBorderRadius;
115
+ });
116
+
117
+ var _default = DxcQuickNav;
118
+ exports["default"] = _default;