@dxc-technology/halstack-react 0.0.0-1e57e26 → 0.0.0-1e5db1e

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 (135) 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 +11 -11
  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 +13 -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/types.d.ts +24 -0
  18. package/box/Box.js +22 -32
  19. package/button/Button.js +14 -11
  20. package/card/Card.js +27 -28
  21. package/checkbox/Checkbox.d.ts +1 -1
  22. package/checkbox/Checkbox.js +43 -39
  23. package/checkbox/Checkbox.stories.tsx +124 -128
  24. package/checkbox/Checkbox.test.js +13 -0
  25. package/checkbox/types.d.ts +7 -3
  26. package/common/variables.js +181 -84
  27. package/date-input/DateInput.js +53 -39
  28. package/date-input/DateInput.stories.tsx +7 -7
  29. package/date-input/DateInput.test.js +69 -59
  30. package/date-input/types.d.ts +16 -9
  31. package/dialog/Dialog.js +4 -32
  32. package/dropdown/Dropdown.js +13 -17
  33. package/file-input/FileInput.js +9 -6
  34. package/file-input/FileItem.js +7 -5
  35. package/footer/Footer.js +15 -88
  36. package/header/Header.js +27 -48
  37. package/header/Header.stories.tsx +46 -36
  38. package/header/Header.test.js +18 -2
  39. package/inset/types.d.ts +24 -0
  40. package/layout/ApplicationLayout.d.ts +4 -3
  41. package/layout/ApplicationLayout.js +78 -114
  42. package/layout/ApplicationLayout.stories.tsx +14 -59
  43. package/layout/Icons.d.ts +5 -0
  44. package/layout/Icons.js +13 -2
  45. package/layout/SidenavContext.d.ts +5 -0
  46. package/layout/SidenavContext.js +19 -0
  47. package/layout/types.d.ts +4 -10
  48. package/link/Link.d.ts +3 -2
  49. package/link/Link.js +57 -74
  50. package/link/Link.stories.tsx +87 -52
  51. package/link/Link.test.js +7 -15
  52. package/link/types.d.ts +7 -23
  53. package/main.d.ts +4 -3
  54. package/main.js +23 -9
  55. package/number-input/NumberInput.js +11 -18
  56. package/number-input/NumberInput.stories.tsx +5 -5
  57. package/number-input/NumberInput.test.js +2 -4
  58. package/number-input/types.d.ts +17 -10
  59. package/package.json +6 -5
  60. package/paginator/Paginator.js +17 -38
  61. package/password-input/PasswordInput.js +7 -4
  62. package/password-input/PasswordInput.test.js +3 -6
  63. package/password-input/types.d.ts +14 -11
  64. package/progress-bar/ProgressBar.js +1 -1
  65. package/progress-bar/ProgressBar.stories.jsx +11 -11
  66. package/quick-nav/QuickNav.d.ts +4 -0
  67. package/quick-nav/QuickNav.js +112 -0
  68. package/quick-nav/QuickNav.stories.tsx +237 -0
  69. package/quick-nav/types.d.ts +21 -0
  70. package/{radio → quick-nav}/types.js +0 -0
  71. package/radio-group/Radio.js +1 -1
  72. package/radio-group/RadioGroup.js +8 -6
  73. package/row/types.d.ts +18 -0
  74. package/select/Listbox.d.ts +4 -0
  75. package/select/Listbox.js +152 -0
  76. package/select/Option.js +1 -1
  77. package/select/Select.js +66 -161
  78. package/select/Select.stories.tsx +14 -2
  79. package/select/Select.test.js +335 -231
  80. package/select/types.d.ts +33 -11
  81. package/sidenav/Sidenav.d.ts +1 -1
  82. package/sidenav/Sidenav.js +20 -9
  83. package/slider/Slider.d.ts +1 -1
  84. package/slider/Slider.js +2 -1
  85. package/slider/Slider.stories.tsx +8 -8
  86. package/slider/Slider.test.js +31 -10
  87. package/slider/types.d.ts +4 -0
  88. package/spinner/Spinner.js +1 -1
  89. package/switch/Switch.d.ts +1 -1
  90. package/switch/Switch.js +35 -19
  91. package/switch/Switch.stories.tsx +14 -14
  92. package/switch/Switch.test.js +25 -0
  93. package/switch/types.d.ts +6 -2
  94. package/tabs/Tabs.d.ts +1 -1
  95. package/tabs/Tabs.js +9 -11
  96. package/tabs/Tabs.stories.tsx +0 -8
  97. package/tabs/Tabs.test.js +26 -9
  98. package/tabs/types.d.ts +4 -0
  99. package/tabs-nav/NavTabs.d.ts +8 -0
  100. package/tabs-nav/NavTabs.js +125 -0
  101. package/tabs-nav/NavTabs.stories.tsx +170 -0
  102. package/tabs-nav/NavTabs.test.js +82 -0
  103. package/tabs-nav/Tab.d.ts +4 -0
  104. package/tabs-nav/Tab.js +132 -0
  105. package/tabs-nav/types.d.ts +53 -0
  106. package/tabs-nav/types.js +5 -0
  107. package/tag/Tag.js +5 -8
  108. package/text-input/Suggestion.d.ts +4 -0
  109. package/text-input/Suggestion.js +55 -0
  110. package/text-input/TextInput.js +48 -76
  111. package/text-input/TextInput.test.js +22 -35
  112. package/text-input/types.d.ts +27 -12
  113. package/textarea/Textarea.js +12 -23
  114. package/textarea/Textarea.test.js +10 -20
  115. package/textarea/types.d.ts +14 -11
  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/useTheme.js +2 -2
  122. package/useTranslatedLabels.d.ts +2 -0
  123. package/useTranslatedLabels.js +20 -0
  124. package/wizard/Wizard.d.ts +1 -1
  125. package/wizard/Wizard.js +55 -44
  126. package/wizard/Wizard.stories.tsx +13 -23
  127. package/wizard/Wizard.test.js +36 -23
  128. package/wizard/types.d.ts +6 -2
  129. package/ThemeContext.d.ts +0 -10
  130. package/ThemeContext.js +0 -243
  131. package/radio/Radio.d.ts +0 -4
  132. package/radio/Radio.js +0 -174
  133. package/radio/Radio.stories.tsx +0 -192
  134. package/radio/Radio.test.js +0 -71
  135. package/radio/types.d.ts +0 -54
@@ -21,20 +21,15 @@ var _templateObject;
21
21
 
22
22
  var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
23
23
  var label = _ref.label,
24
- _ref$name = _ref.name,
25
- name = _ref$name === void 0 ? "" : _ref$name,
24
+ name = _ref.name,
25
+ defaultValue = _ref.defaultValue,
26
26
  value = _ref.value,
27
27
  helperText = _ref.helperText,
28
- _ref$placeholder = _ref.placeholder,
29
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
30
- _ref$disabled = _ref.disabled,
31
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
32
- _ref$optional = _ref.optional,
33
- optional = _ref$optional === void 0 ? false : _ref$optional,
34
- _ref$prefix = _ref.prefix,
35
- prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
36
- _ref$suffix = _ref.suffix,
37
- suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
28
+ placeholder = _ref.placeholder,
29
+ disabled = _ref.disabled,
30
+ optional = _ref.optional,
31
+ prefix = _ref.prefix,
32
+ suffix = _ref.suffix,
38
33
  min = _ref.min,
39
34
  max = _ref.max,
40
35
  _ref$step = _ref.step,
@@ -42,13 +37,10 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
42
37
  onChange = _ref.onChange,
43
38
  onBlur = _ref.onBlur,
44
39
  error = _ref.error,
45
- _ref$autocomplete = _ref.autocomplete,
46
- autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
40
+ autocomplete = _ref.autocomplete,
47
41
  margin = _ref.margin,
48
- _ref$size = _ref.size,
49
- size = _ref$size === void 0 ? "medium" : _ref$size,
50
- _ref$tabIndex = _ref.tabIndex,
51
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
42
+ size = _ref.size,
43
+ tabIndex = _ref.tabIndex;
52
44
  return /*#__PURE__*/_react["default"].createElement(_NumberInputContext["default"].Provider, {
53
45
  value: {
54
46
  typeNumber: "number",
@@ -59,6 +51,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
59
51
  }, /*#__PURE__*/_react["default"].createElement(NumberInputContainer, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
60
52
  label: label,
61
53
  name: name,
54
+ defaultValue: defaultValue,
62
55
  value: value,
63
56
  helperText: helperText,
64
57
  placeholder: placeholder,
@@ -22,7 +22,7 @@ export const Chromatic = () => (
22
22
  </ExampleContainer>
23
23
  <ExampleContainer>
24
24
  <Title title="Helper text, optional and value" theme="light" level={4} />
25
- <DxcNumberInput label="Number input" value="12" helperText="Help message" optional />
25
+ <DxcNumberInput label="Number input" defaultValue="12" helperText="Help message" optional />
26
26
  </ExampleContainer>
27
27
  <ExampleContainer>
28
28
  <Title title="Disabled and placeholder" theme="light" level={4} />
@@ -30,7 +30,7 @@ export const Chromatic = () => (
30
30
  </ExampleContainer>
31
31
  <ExampleContainer>
32
32
  <Title title="Disabled, helper text, optional and value" theme="light" level={4} />
33
- <DxcNumberInput label="Disabled number input" helperText="Help message" disabled optional value="10" />
33
+ <DxcNumberInput label="Disabled number input" helperText="Help message" disabled optional defaultValue="10" />
34
34
  </ExampleContainer>
35
35
  <ExampleContainer>
36
36
  <Title title="Prefix" theme="light" level={4} />
@@ -42,7 +42,7 @@ export const Chromatic = () => (
42
42
  </ExampleContainer>
43
43
  <ExampleContainer>
44
44
  <Title title="Invalid" theme="light" level={4} />
45
- <DxcNumberInput label="Error number input" helperText="Help message" error="Error message." value="23" optional />
45
+ <DxcNumberInput label="Error number input" helperText="Help message" error="Error message." defaultValue="23" optional />
46
46
  </ExampleContainer>
47
47
  <BackgroundColorProvider color="#333333">
48
48
  <DarkContainer>
@@ -53,7 +53,7 @@ export const Chromatic = () => (
53
53
  </ExampleContainer>
54
54
  <ExampleContainer>
55
55
  <Title title="Helper text, value and error" theme="dark" level={4} />
56
- <DxcNumberInput label="Number input" helperText="Help message" error="Error message." value="199" />
56
+ <DxcNumberInput label="Number input" helperText="Help message" error="Error message." defaultValue="199" />
57
57
  </ExampleContainer>
58
58
  <ExampleContainer>
59
59
  <Title title="Disabled and placeholder" theme="dark" level={4} />
@@ -61,7 +61,7 @@ export const Chromatic = () => (
61
61
  </ExampleContainer>
62
62
  <ExampleContainer>
63
63
  <Title title="Disabled, helper text, optional and value" theme="dark" level={4} />
64
- <DxcNumberInput label="Disabled number input" helperText="Help message" disabled optional value="1232454" />
64
+ <DxcNumberInput label="Disabled number input" helperText="Help message" disabled optional defaultValue="1232454" />
65
65
  </ExampleContainer>
66
66
  </DarkContainer>
67
67
  </BackgroundColorProvider>
@@ -135,16 +135,14 @@ describe("Number input component tests", function () {
135
135
  _userEvent["default"].type(number, "t");
136
136
 
137
137
  expect(onChange).not.toHaveBeenCalledWith({
138
- value: "t",
139
- error: null
138
+ value: "t"
140
139
  });
141
140
  expect(number.value).toBe("");
142
141
 
143
142
  _userEvent["default"].type(number, "1");
144
143
 
145
144
  expect(onChange).toHaveBeenCalledWith({
146
- value: "1",
147
- error: null
145
+ value: "1"
148
146
  });
149
147
  expect(number.value).toBe("1");
150
148
  });
@@ -14,6 +14,10 @@ declare type Props = {
14
14
  * Name attribute of the input element.
15
15
  */
16
16
  name?: string;
17
+ /**
18
+ * Initial value of the input element, only when it is uncontrolled.
19
+ */
20
+ defaultValue?: string;
17
21
  /**
18
22
  * Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
19
23
  */
@@ -50,7 +54,7 @@ declare type Props = {
50
54
  * lower than min, the onBlur and onChange functions will be called with
51
55
  * the current value and an internal error informing that the current
52
56
  * value is not correct. If a valid state is reached, the error parameter
53
- * will be null in both events.
57
+ * will not be defined in both events.
54
58
  */
55
59
  min?: number;
56
60
  /**
@@ -58,7 +62,7 @@ declare type Props = {
58
62
  * surpasses max, the onBlur and onChange functions will be called with
59
63
  * the current value and an internal error informing that the current
60
64
  * value is not correct. If a valid state is reached, the error parameter
61
- * will be null in both events.
65
+ * will not be defined in both events.
62
66
  */
63
67
  max?: number;
64
68
  /**
@@ -69,26 +73,29 @@ declare type Props = {
69
73
  * This function will be called when the user types within the input
70
74
  * element of the component. An object including the current value and
71
75
  * the error (if the value entered is not valid) will be passed to this
72
- * function. If there is no error, error will be null.
76
+ * function. If there is no error, error will not be defined.
73
77
  */
74
78
  onChange?: (val: {
75
79
  value: string;
76
- error: string | null;
80
+ error?: string;
77
81
  }) => void;
78
82
  /**
79
83
  * This function will be called when the input element loses the focus.
80
84
  * An object including the input value and the error (if the value
81
85
  * entered is not valid) will be passed to this function. If there is no error,
82
- * error will be null.
86
+ * error will not be defined.
83
87
  */
84
88
  onBlur?: (val: {
85
89
  value: string;
86
- error: string | null;
90
+ error?: string;
87
91
  }) => void;
88
92
  /**
89
- * If it is defined, the component will change its appearance, showing
90
- * the error below the input component. If it is not defined, the error
91
- * messages will be managed internally, but never displayed on its own.
93
+ * If it is a defined value and also a truthy string, the component will
94
+ * change its appearance, showing the error below the input component. If
95
+ * the defined value is an empty string, it will reserve a space below
96
+ * the component for a future error, but it would not change its look. In
97
+ * case of being undefined or null, both the appearance and the space for
98
+ * the error message would not be modified.
92
99
  */
93
100
  error?: string;
94
101
  /**
@@ -102,7 +109,7 @@ declare type Props = {
102
109
  */
103
110
  margin?: Space | Margin;
104
111
  /**
105
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
112
+ * Size of the component.
106
113
  */
107
114
  size?: "small" | "medium" | "large" | "fillParent";
108
115
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-1e57e26",
3
+ "version": "0.0.0-1e5db1e",
4
4
  "description": "DXC Halstack React components library",
5
5
  "repository": "dxc-technology/halstack-react",
6
6
  "homepage": "http://developer.dxc.com/tools/react",
@@ -18,7 +18,7 @@
18
18
  "styled-components": "^5.0.1"
19
19
  },
20
20
  "dependencies": {
21
- "@date-io/date-fns": "^1.3.9",
21
+ "@date-io/dayjs": "^1.3.9",
22
22
  "@material-ui/core": "4.11.1",
23
23
  "@material-ui/icons": "4.4.3",
24
24
  "@material-ui/lab": "4.0.0-alpha.17",
@@ -27,17 +27,17 @@
27
27
  "@types/styled-components": "^5.1.24",
28
28
  "@types/uuid": "^8.3.4",
29
29
  "color": "^3.1.3",
30
- "date-fns": "^2.0.0-beta.4",
31
- "moment": "2.24.0",
30
+ "dayjs": "^1.11.1",
32
31
  "prop-types": "^15.7.2",
33
32
  "rgb-hex": "^3.0.0",
33
+ "slugify": "^1.6.5",
34
34
  "uuid": "^8.3.2"
35
35
  },
36
36
  "scripts": {
37
37
  "test": "jest",
38
38
  "test:watch": "npm test -- --watch --coverage",
39
39
  "build": "babel src --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose && node ../scripts/build/copy-package.js && tsc ",
40
- "build:watch": "babel src --watch --out-dir ../dist --copy-files --verbose",
40
+ "build:watch": "babel src --watch --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose",
41
41
  "storybook": "start-storybook -p 6006",
42
42
  "build-storybook": "build-storybook"
43
43
  },
@@ -57,6 +57,7 @@
57
57
  "@storybook/testing-library": "0.0.7",
58
58
  "@testing-library/react": "^11.2.5",
59
59
  "@testing-library/user-event": "^12.6.3",
60
+ "@types/react": "16.9.5",
60
61
  "babel-jest": "^24.8.0",
61
62
  "babel-loader": "^8.0.6",
62
63
  "chromatic": "^6.3.3",
@@ -17,6 +17,8 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
17
 
18
18
  var _useTheme = _interopRequireDefault(require("../useTheme"));
19
19
 
20
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
21
+
20
22
  var _Button = _interopRequireDefault(require("../button/Button"));
21
23
 
22
24
  var _Select = _interopRequireDefault(require("../select/Select"));
@@ -49,13 +51,14 @@ var DxcPaginator = function DxcPaginator(_ref) {
49
51
  var minItemsPerPage = currentPageInternal === 1 || currentPageInternal === 0 ? currentPageInternal : (currentPageInternal - 1) * itemsPerPage + 1;
50
52
  var maxItemsPerPage = minItemsPerPage - 1 + itemsPerPage > totalItems ? totalItems : minItemsPerPage - 1 + itemsPerPage;
51
53
  var colorsTheme = (0, _useTheme["default"])();
54
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
52
55
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
53
56
  theme: colorsTheme.paginator
54
57
  }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
55
58
  color: colorsTheme.paginator.backgroundColor
56
59
  }, /*#__PURE__*/_react["default"].createElement(DxcPaginatorContainer, {
57
60
  disabled: currentPageInternal === 1
58
- }, /*#__PURE__*/_react["default"].createElement(LabelsContainer, null, itemsPerPageOptions && /*#__PURE__*/_react["default"].createElement(ItemsPageContainer, null, /*#__PURE__*/_react["default"].createElement(ItemsLabel, null, "Items per page "), /*#__PURE__*/_react["default"].createElement(SelectContainer, null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
61
+ }, /*#__PURE__*/_react["default"].createElement(LabelsContainer, null, itemsPerPageOptions && /*#__PURE__*/_react["default"].createElement(ItemsPageContainer, null, /*#__PURE__*/_react["default"].createElement(ItemsLabel, null, translatedLabels.paginator.itemsPerPageText), /*#__PURE__*/_react["default"].createElement(SelectContainer, null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
59
62
  options: itemsPerPageOptions.map(function (num) {
60
63
  return {
61
64
  label: num.toString(),
@@ -68,14 +71,10 @@ var DxcPaginator = function DxcPaginator(_ref) {
68
71
  value: itemsPerPage.toString(),
69
72
  size: "fillParent",
70
73
  tabIndex: tabIndex
71
- }))), /*#__PURE__*/_react["default"].createElement(TotalItemsContainer, null, minItemsPerPage, " to ", maxItemsPerPage, " of ", totalItems), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
74
+ }))), /*#__PURE__*/_react["default"].createElement(TotalItemsContainer, null, translatedLabels.paginator.minToMaxOfText(minItemsPerPage, maxItemsPerPage, totalItems)), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
72
75
  size: "small",
73
76
  mode: "secondary",
74
77
  disabled: currentPageInternal === 1 || currentPageInternal === 0,
75
- margin: {
76
- left: "xxsmall",
77
- right: "xxsmall"
78
- },
79
78
  icon: _Icons.firstIcon,
80
79
  tabIndex: tabIndex,
81
80
  onClick: function onClick() {
@@ -85,16 +84,12 @@ var DxcPaginator = function DxcPaginator(_ref) {
85
84
  size: "small",
86
85
  mode: "secondary",
87
86
  disabled: currentPageInternal === 1 || currentPageInternal === 0,
88
- margin: {
89
- left: "xxsmall",
90
- right: "xxsmall"
91
- },
92
87
  icon: _Icons.previousIcon,
93
88
  tabIndex: tabIndex,
94
89
  onClick: function onClick() {
95
90
  onPageChange(currentPage - 1);
96
91
  }
97
- }), showGoToPage && /*#__PURE__*/_react["default"].createElement(PageToSelectContainer, null, /*#__PURE__*/_react["default"].createElement(GoToLabel, null, "Go to page: "), /*#__PURE__*/_react["default"].createElement(SelectContainer, null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
92
+ }), showGoToPage && /*#__PURE__*/_react["default"].createElement(PageToSelectContainer, null, /*#__PURE__*/_react["default"].createElement(GoToLabel, null, translatedLabels.paginator.goToPageText, " "), /*#__PURE__*/_react["default"].createElement(SelectContainer, null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
98
93
  options: Array.from(Array(totalPages), function (e, num) {
99
94
  return {
100
95
  label: (num + 1).toString(),
@@ -107,14 +102,10 @@ var DxcPaginator = function DxcPaginator(_ref) {
107
102
  value: currentPage.toString(),
108
103
  size: "fillParent",
109
104
  tabIndex: tabIndex
110
- }))) || /*#__PURE__*/_react["default"].createElement(TextContainer, null, "Page: ", currentPageInternal, " of ", totalPages), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
105
+ }))) || /*#__PURE__*/_react["default"].createElement(TextContainer, null, translatedLabels.paginator.pageOfText(currentPageInternal, totalPages)), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
111
106
  size: "small",
112
107
  mode: "secondary",
113
108
  disabled: currentPageInternal === totalPages,
114
- margin: {
115
- left: "xxsmall",
116
- right: "xxsmall"
117
- },
118
109
  icon: _Icons.nextIcon,
119
110
  tabIndex: tabIndex,
120
111
  onClick: function onClick() {
@@ -124,10 +115,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
124
115
  size: "small",
125
116
  mode: "secondary",
126
117
  disabled: currentPageInternal === totalPages,
127
- margin: {
128
- left: "xxsmall",
129
- right: "xxsmall"
130
- },
131
118
  icon: _Icons.lastIcon,
132
119
  tabIndex: tabIndex,
133
120
  onClick: function onClick() {
@@ -136,11 +123,7 @@ var DxcPaginator = function DxcPaginator(_ref) {
136
123
  })))));
137
124
  };
138
125
 
139
- var DxcPaginatorContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: ", ";\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n text-transform: ", ";\n background-color: ", ";\n color: ", ";\n\n button {\n &:disabled {\n background-color: transparent !important;\n opacity: 0.3 !important;\n }\n }\n"])), function (props) {
140
- return props.theme.height;
141
- }, function (props) {
142
- return props.theme.width;
143
- }, function (props) {
126
+ var DxcPaginatorContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n text-transform: ", ";\n background-color: ", ";\n color: ", ";\n padding: ", " ", ";\n\n button {\n &:disabled {\n background-color: transparent !important;\n opacity: 0.3 !important;\n }\n }\n"])), function (props) {
144
127
  return props.theme.fontFamily;
145
128
  }, function (props) {
146
129
  return props.theme.fontSize;
@@ -154,9 +137,13 @@ var DxcPaginatorContainer = _styledComponents["default"].div(_templateObject ||
154
137
  return props.theme.backgroundColor;
155
138
  }, function (props) {
156
139
  return props.theme.fontColor;
140
+ }, function (props) {
141
+ return props.theme.verticalPadding;
142
+ }, function (props) {
143
+ return props.theme.horizontalPadding;
157
144
  });
158
145
 
159
- var SelectContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 100px;\n"])));
146
+ var SelectContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: 5.25rem;\n"])));
160
147
 
161
148
  var ItemsPageContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n margin-left: ", ";\n\n label {\n height: 0px;\n }\n label + .MuiInput-formControl {\n margin-top: 0px;\n }\n"])), function (props) {
162
149
  return props.theme.itemsPerPageSelectorMarginRight;
@@ -164,9 +151,9 @@ var ItemsPageContainer = _styledComponents["default"].span(_templateObject3 || (
164
151
  return props.theme.itemsPerPageSelectorMarginLeft;
165
152
  });
166
153
 
167
- var ItemsLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 15px;\n"])));
154
+ var ItemsLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 0.5rem;\n"])));
168
155
 
169
- var GoToLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 10px;\n margin-left: 10px;\n"])));
156
+ var GoToLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 0.5rem;\n margin-left: 1rem;\n"])));
170
157
 
171
158
  var TotalItemsContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
172
159
  return props.theme.totalItemsContainerMarginRight;
@@ -174,17 +161,9 @@ var TotalItemsContainer = _styledComponents["default"].span(_templateObject6 ||
174
161
  return props.theme.totalItemsContainerMarginLeft;
175
162
  });
176
163
 
177
- var LabelsContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n margin: 0 ", " 0 ", ";\n"])), function (props) {
178
- return props.theme.marginRight;
179
- }, function (props) {
180
- return props.theme.marginLeft;
181
- });
164
+ var LabelsContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n gap: 0.5rem;\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n"])));
182
165
 
183
- var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n margin-left: ", ";\n\n label {\n height: 0px;\n }\n label + .MuiInput-formControl {\n margin-top: 0px;\n }\n"])), function (props) {
184
- return props.theme.pageSelectorMarginRight;
185
- }, function (props) {
186
- return props.theme.pageSelectorMarginLeft;
187
- });
166
+ var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n\n label {\n height: 0px;\n }\n label + .MuiInput-formControl {\n margin-top: 0px;\n }\n"])));
188
167
 
189
168
  var TextContainer = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])([""])));
190
169
 
@@ -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;