@dxc-technology/halstack-react 8.0.0 → 9.0.0
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.
- package/HalstackContext.js +94 -45
- package/accordion/Accordion.js +7 -13
- package/accordion/Accordion.stories.tsx +102 -13
- package/alert/Alert.stories.tsx +28 -0
- package/box/Box.js +1 -3
- package/box/Box.stories.tsx +15 -0
- package/button/Button.js +11 -13
- package/button/Button.stories.tsx +150 -8
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/chip/Chip.js +16 -22
- package/chip/Chip.stories.tsx +96 -9
- package/common/variables.js +280 -288
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +43 -43
- package/date-input/DateInput.js +74 -32
- package/date-input/DateInput.stories.tsx +183 -30
- package/date-input/DateInput.test.js +120 -37
- package/date-input/DatePicker.js +38 -52
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +23 -12
- package/date-input/types.d.ts +6 -8
- package/dialog/Dialog.js +60 -73
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +301 -2
- package/dropdown/Dropdown.js +3 -6
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -15
- package/file-input/FileInput.js +3 -6
- package/file-input/FileInput.stories.tsx +85 -2
- package/file-input/FileInput.test.js +0 -41
- package/file-input/FileItem.js +1 -0
- package/footer/Footer.stories.tsx +91 -0
- package/header/Header.js +18 -20
- package/header/Header.stories.tsx +149 -6
- package/link/Link.stories.tsx +60 -0
- package/main.d.ts +1 -1
- package/main.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/Tab.js +35 -15
- package/package.json +1 -1
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +5 -11
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/resultsetTable/ResultsetTable.test.js +17 -22
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +43 -24
- package/select/Select.stories.tsx +492 -145
- package/select/Select.test.js +17 -22
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.js +8 -10
- package/sidenav/Sidenav.stories.tsx +148 -46
- package/slider/Slider.js +4 -4
- package/slider/Slider.stories.tsx +57 -0
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.js +1 -1
- package/switch/Switch.stories.tsx +33 -0
- package/table/Table.stories.jsx +80 -1
- package/tabs/Tab.js +3 -5
- package/tabs/Tabs.js +3 -3
- package/tabs/Tabs.stories.tsx +45 -5
- package/tag/Tag.stories.tsx +14 -1
- package/text-input/Suggestion.js +32 -5
- package/text-input/TextInput.js +7 -11
- package/text-input/TextInput.stories.tsx +92 -4
- package/text-input/TextInput.test.js +125 -25
- package/textarea/Textarea.stories.jsx +60 -1
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.stories.tsx +20 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.js +0 -0
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcNavTabs from "./NavTabs";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "NavTabs",
|
|
@@ -15,6 +16,15 @@ const iconSVG = (
|
|
|
15
16
|
</svg>
|
|
16
17
|
);
|
|
17
18
|
|
|
19
|
+
const largeIcon = "https://www.iconpacks.net/icons/1/free-pin-icon-48-thumb.png";
|
|
20
|
+
|
|
21
|
+
const opinionatedTheme = {
|
|
22
|
+
navTabs: {
|
|
23
|
+
baseColor: "#666666",
|
|
24
|
+
accentColor: "#5f249f",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
18
28
|
export const Chromatic = () => (
|
|
19
29
|
<>
|
|
20
30
|
<ExampleContainer>
|
|
@@ -93,10 +103,10 @@ export const Chromatic = () => (
|
|
|
93
103
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
|
|
94
104
|
Tab 2
|
|
95
105
|
</DxcNavTabs.Tab>
|
|
96
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
106
|
+
<DxcNavTabs.Tab href="#" icon={largeIcon}>
|
|
97
107
|
Tab 3
|
|
98
108
|
</DxcNavTabs.Tab>
|
|
99
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
109
|
+
<DxcNavTabs.Tab href="#" icon={largeIcon}>
|
|
100
110
|
Tab 4
|
|
101
111
|
</DxcNavTabs.Tab>
|
|
102
112
|
</DxcNavTabs>
|
|
@@ -104,7 +114,7 @@ export const Chromatic = () => (
|
|
|
104
114
|
<ExampleContainer>
|
|
105
115
|
<Title title="With icon position left" theme="light" level={4} />
|
|
106
116
|
<DxcNavTabs iconPosition="left">
|
|
107
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
117
|
+
<DxcNavTabs.Tab href="#" active icon={largeIcon}>
|
|
108
118
|
Tab 1
|
|
109
119
|
</DxcNavTabs.Tab>
|
|
110
120
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
|
|
@@ -121,7 +131,7 @@ export const Chromatic = () => (
|
|
|
121
131
|
<ExampleContainer>
|
|
122
132
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
123
133
|
<DxcNavTabs>
|
|
124
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
134
|
+
<DxcNavTabs.Tab href="#" active icon={largeIcon} notificationNumber>
|
|
125
135
|
Tab 1
|
|
126
136
|
</DxcNavTabs.Tab>
|
|
127
137
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
|
|
@@ -130,7 +140,7 @@ export const Chromatic = () => (
|
|
|
130
140
|
<DxcNavTabs.Tab href="#" icon={iconSVG} notificationNumber={120}>
|
|
131
141
|
Tab 3
|
|
132
142
|
</DxcNavTabs.Tab>
|
|
133
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
143
|
+
<DxcNavTabs.Tab href="#" icon={largeIcon}>
|
|
134
144
|
Tab 4
|
|
135
145
|
</DxcNavTabs.Tab>
|
|
136
146
|
</DxcNavTabs>
|
|
@@ -144,7 +154,7 @@ export const Chromatic = () => (
|
|
|
144
154
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
|
|
145
155
|
Tab 2
|
|
146
156
|
</DxcNavTabs.Tab>
|
|
147
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
157
|
+
<DxcNavTabs.Tab href="#" icon={largeIcon} notificationNumber={120}>
|
|
148
158
|
Tab 3
|
|
149
159
|
</DxcNavTabs.Tab>
|
|
150
160
|
<DxcNavTabs.Tab href="#" icon={iconSVG}>
|
|
@@ -166,5 +176,85 @@ export const Chromatic = () => (
|
|
|
166
176
|
</DxcNavTabs.Tab>
|
|
167
177
|
</DxcNavTabs>
|
|
168
178
|
</ExampleContainer>
|
|
179
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
180
|
+
<ExampleContainer>
|
|
181
|
+
<Title title="Only label" theme="light" level={4} />
|
|
182
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
183
|
+
<DxcNavTabs>
|
|
184
|
+
<DxcNavTabs.Tab href="#" active>
|
|
185
|
+
Tab 1
|
|
186
|
+
</DxcNavTabs.Tab>
|
|
187
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
188
|
+
Tab 2
|
|
189
|
+
</DxcNavTabs.Tab>
|
|
190
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
191
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
192
|
+
</DxcNavTabs>
|
|
193
|
+
</HalstackProvider>
|
|
194
|
+
</ExampleContainer>
|
|
195
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
196
|
+
<Title title="Hovered tabs" theme="light" level={4} />
|
|
197
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
198
|
+
<DxcNavTabs>
|
|
199
|
+
<DxcNavTabs.Tab href="#" active>
|
|
200
|
+
Tab 1
|
|
201
|
+
</DxcNavTabs.Tab>
|
|
202
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
203
|
+
Tab 2
|
|
204
|
+
</DxcNavTabs.Tab>
|
|
205
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
206
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
207
|
+
</DxcNavTabs>
|
|
208
|
+
</HalstackProvider>
|
|
209
|
+
</ExampleContainer>
|
|
210
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
211
|
+
<Title title="Focused tabs" theme="light" level={4} />
|
|
212
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
213
|
+
<DxcNavTabs>
|
|
214
|
+
<DxcNavTabs.Tab href="#" active>
|
|
215
|
+
Tab 1
|
|
216
|
+
</DxcNavTabs.Tab>
|
|
217
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
218
|
+
Tab 2
|
|
219
|
+
</DxcNavTabs.Tab>
|
|
220
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
221
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
222
|
+
</DxcNavTabs>
|
|
223
|
+
</HalstackProvider>
|
|
224
|
+
</ExampleContainer>
|
|
225
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
226
|
+
<Title title="Actived tabs" theme="light" level={4} />
|
|
227
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
228
|
+
<DxcNavTabs>
|
|
229
|
+
<DxcNavTabs.Tab href="#" active>
|
|
230
|
+
Tab 1
|
|
231
|
+
</DxcNavTabs.Tab>
|
|
232
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
233
|
+
Tab 2
|
|
234
|
+
</DxcNavTabs.Tab>
|
|
235
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
236
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
237
|
+
</DxcNavTabs>
|
|
238
|
+
</HalstackProvider>
|
|
239
|
+
</ExampleContainer>
|
|
240
|
+
<ExampleContainer>
|
|
241
|
+
<Title title="With icon and notification number" theme="light" level={4} />
|
|
242
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
243
|
+
<DxcNavTabs>
|
|
244
|
+
<DxcNavTabs.Tab href="#" active icon={iconSVG} notificationNumber>
|
|
245
|
+
Tab 1
|
|
246
|
+
</DxcNavTabs.Tab>
|
|
247
|
+
<DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
|
|
248
|
+
Tab 2
|
|
249
|
+
</DxcNavTabs.Tab>
|
|
250
|
+
<DxcNavTabs.Tab href="#" icon={iconSVG} notificationNumber={120}>
|
|
251
|
+
Tab 3
|
|
252
|
+
</DxcNavTabs.Tab>
|
|
253
|
+
<DxcNavTabs.Tab href="#" icon={iconSVG}>
|
|
254
|
+
Tab 4
|
|
255
|
+
</DxcNavTabs.Tab>
|
|
256
|
+
</DxcNavTabs>
|
|
257
|
+
</HalstackProvider>
|
|
258
|
+
</ExampleContainer>
|
|
169
259
|
</>
|
|
170
260
|
);
|
|
@@ -23,7 +23,11 @@ var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
|
23
23
|
|
|
24
24
|
var _NavTabs = require("./NavTabs");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _Typography = _interopRequireDefault(require("../typography/Typography"));
|
|
27
|
+
|
|
28
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
|
+
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
27
31
|
|
|
28
32
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
29
33
|
|
|
@@ -50,6 +54,7 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
50
54
|
hasIcons = _useContext.hasIcons,
|
|
51
55
|
focusedLabel = _useContext.focusedLabel;
|
|
52
56
|
|
|
57
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
53
58
|
(0, _react.useLayoutEffect)(function () {
|
|
54
59
|
var _tabRef$current;
|
|
55
60
|
|
|
@@ -71,10 +76,12 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
71
76
|
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
72
77
|
active: active,
|
|
73
78
|
role: "tab",
|
|
74
|
-
"aria-selected": active
|
|
79
|
+
"aria-selected": active,
|
|
80
|
+
"aria-disabled": disabled
|
|
75
81
|
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
76
82
|
href: !disabled && href ? href : undefined,
|
|
77
83
|
disabled: disabled,
|
|
84
|
+
active: active,
|
|
78
85
|
iconPosition: iconPosition,
|
|
79
86
|
hasIcon: hasIcons,
|
|
80
87
|
ref: function ref(anchorRef) {
|
|
@@ -90,41 +97,54 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
90
97
|
tabIndex: active ? tabIndex : -1
|
|
91
98
|
}, otherProps), icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
92
99
|
iconPosition: iconPosition
|
|
93
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
100
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
94
101
|
src: icon
|
|
95
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(LabelContainer, null,
|
|
102
|
+
}) : icon), /*#__PURE__*/_react["default"].createElement(LabelContainer, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
103
|
+
color: disabled ? colorsTheme.navTabs.disabledFontColor : active ? colorsTheme.navTabs.selectedFontColor : colorsTheme.navTabs.unselectedFontColor,
|
|
104
|
+
fontFamily: colorsTheme.navTabs.fontFamily,
|
|
105
|
+
fontSize: colorsTheme.navTabs.fontSize,
|
|
106
|
+
fontStyle: colorsTheme.navTabs.fontStyle,
|
|
107
|
+
fontWeight: colorsTheme.navTabs.fontWeight,
|
|
108
|
+
textAlign: "center",
|
|
109
|
+
letterSpacing: "0.025em",
|
|
110
|
+
lineHeight: "1.715em"
|
|
111
|
+
}, children), notificationNumber && /*#__PURE__*/_react["default"].createElement(BadgeContainer, null, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
96
112
|
notificationText: notificationNumber > 99 ? "+99" : notificationNumber,
|
|
97
113
|
disabled: disabled
|
|
98
114
|
})))));
|
|
99
115
|
});
|
|
100
116
|
|
|
101
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom: 2px solid ", ";\n"])), function (props) {
|
|
102
|
-
return props.active ?
|
|
117
|
+
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom: 2px solid ", ";\n svg {\n color: ", ";\n }\n\n &[aria-selected=\"true\"] {\n svg {\n color: ", ";\n }\n }\n\n &[aria-disabled=\"true\"] {\n svg {\n color: ", ";\n }\n }\n"])), function (props) {
|
|
118
|
+
return props.active ? props.theme.selectedUnderlineColor : props.theme.dividerColor;
|
|
119
|
+
}, function (props) {
|
|
120
|
+
return props.theme.unselectedIconColor;
|
|
121
|
+
}, function (props) {
|
|
122
|
+
return props.theme.selectedIconColor;
|
|
123
|
+
}, function (props) {
|
|
124
|
+
return props.theme.disabledIconColor;
|
|
103
125
|
});
|
|
104
126
|
|
|
105
|
-
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n\n
|
|
127
|
+
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n\n text-decoration-color: transparent;\n cursor: ", ";\n background: ", ";\n\n height: ", ";\n min-width: 164px;\n margin: 0.5rem;\n padding: 0.375rem;\n\n border-radius: 4px;\n\n ", "\n"])), function (props) {
|
|
106
128
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
107
|
-
}, function (props) {
|
|
108
|
-
return props.disabled ? "#0000004D" : "#333333";
|
|
109
129
|
}, function (props) {
|
|
110
130
|
return props.disabled ? "not-allowed" : "pointer";
|
|
131
|
+
}, function (props) {
|
|
132
|
+
return props.active ? props.theme.selectedBackgroundColor : props.theme.unselectedBackgroundColor;
|
|
111
133
|
}, function (props) {
|
|
112
134
|
return props.hasIcon && props.iconPosition === "top" ? "66px" : "32px";
|
|
113
135
|
}, function (props) {
|
|
114
|
-
return !props.disabled && ":hover {\n background:
|
|
136
|
+
return !props.disabled && ":hover {\n background: ".concat(props.theme.hoverBackgroundColor, ";\n }\n\n :focus {\n outline: 2px solid ").concat(props.theme.focusOutline, ";\n }\n\n :active {\n background: ").concat(props.theme.pressedBackgroundColor, ";\n outline: 2px solid #33aaff};\n }");
|
|
115
137
|
});
|
|
116
138
|
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-bottom: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n align-items: center;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
139
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
120
140
|
return props.iconPosition === "top" && "0.375rem";
|
|
121
141
|
}, function (props) {
|
|
122
142
|
return props.iconPosition === "left" && "0.625rem";
|
|
123
143
|
});
|
|
124
144
|
|
|
125
|
-
var LabelContainer = _styledComponents["default"].div(
|
|
145
|
+
var LabelContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
|
|
126
146
|
|
|
127
|
-
var BadgeContainer = _styledComponents["default"].div(
|
|
147
|
+
var BadgeContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 0.5rem;\n"])));
|
|
128
148
|
|
|
129
149
|
var _default = DxcTab;
|
|
130
150
|
exports["default"] = _default;
|
package/package.json
CHANGED
package/paginator/Icons.js
CHANGED
|
@@ -11,56 +11,44 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var firstIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
height: "24",
|
|
15
|
+
width: "24",
|
|
16
|
+
fill: "currentColor"
|
|
17
17
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
18
|
-
|
|
19
|
-
"data-name": "Path 2463",
|
|
20
|
-
d: "M18.41,16.59,13.82,12l4.59-4.59L17,6l-6,6,6,6ZM6,6H8V18H6Z",
|
|
21
|
-
transform: "translate(-6 -6)"
|
|
18
|
+
d: "M6 18V6h2v12Zm11 0-6-6 6-6 1.4 1.4-4.6 4.6 4.6 4.6Z"
|
|
22
19
|
}));
|
|
23
20
|
|
|
24
21
|
exports.firstIcon = firstIcon;
|
|
25
22
|
|
|
26
23
|
var previousIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
27
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
height: "24",
|
|
26
|
+
width: "24",
|
|
27
|
+
fill: "currentColor"
|
|
31
28
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
-
|
|
33
|
-
"data-name": "Path 2459",
|
|
34
|
-
d: "M15.41,7.41,14,6,8,12l6,6,1.41-1.41L10.83,12Z",
|
|
35
|
-
transform: "translate(-8 -6)"
|
|
29
|
+
d: "m14 18-6-6 6-6 1.4 1.4-4.6 4.6 4.6 4.6Z"
|
|
36
30
|
}));
|
|
37
31
|
|
|
38
32
|
exports.previousIcon = previousIcon;
|
|
39
33
|
|
|
40
34
|
var nextIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
35
|
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
height: "24",
|
|
37
|
+
width: "24",
|
|
38
|
+
fill: "currentColor"
|
|
45
39
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
-
|
|
47
|
-
"data-name": "Path 2461",
|
|
48
|
-
d: "M10,6,8.59,7.41,13.17,12,8.59,16.59,10,18l6-6Z",
|
|
49
|
-
transform: "translate(-8.59 -6)"
|
|
40
|
+
d: "M9.4 18 8 16.6l4.6-4.6L8 7.4 9.4 6l6 6Z"
|
|
50
41
|
}));
|
|
51
42
|
|
|
52
43
|
exports.nextIcon = nextIcon;
|
|
53
44
|
|
|
54
45
|
var lastIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
55
46
|
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
height: "24",
|
|
48
|
+
width: "24",
|
|
49
|
+
fill: "currentColor"
|
|
59
50
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
60
|
-
|
|
61
|
-
"data-name": "Path 2465",
|
|
62
|
-
d: "M5.59,7.41,10.18,12,5.59,16.59,7,18l6-6L7,6ZM16,6h2V18H16Z",
|
|
63
|
-
transform: "translate(-5.59 -6)"
|
|
51
|
+
d: "m7 18-1.4-1.4 4.6-4.6-4.6-4.6L7 6l6 6Zm9 0V6h2v12Z"
|
|
64
52
|
}));
|
|
65
53
|
|
|
66
54
|
exports.lastIcon = lastIcon;
|
package/paginator/Paginator.js
CHANGED
|
@@ -27,7 +27,7 @@ var _Icons = require("./Icons");
|
|
|
27
27
|
|
|
28
28
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
29
29
|
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
31
31
|
|
|
32
32
|
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); }
|
|
33
33
|
|
|
@@ -72,7 +72,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
72
72
|
size: "fillParent",
|
|
73
73
|
tabIndex: tabIndex
|
|
74
74
|
}))), /*#__PURE__*/_react["default"].createElement(TotalItemsContainer, null, translatedLabels.paginator.minToMaxOfText(minItemsPerPage, maxItemsPerPage, totalItems)), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
75
|
-
size: "small",
|
|
76
75
|
mode: "secondary",
|
|
77
76
|
disabled: currentPageInternal === 1 || currentPageInternal === 0,
|
|
78
77
|
icon: _Icons.firstIcon,
|
|
@@ -81,7 +80,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
81
80
|
onPageChange(1);
|
|
82
81
|
}
|
|
83
82
|
}), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
84
|
-
size: "small",
|
|
85
83
|
mode: "secondary",
|
|
86
84
|
disabled: currentPageInternal === 1 || currentPageInternal === 0,
|
|
87
85
|
icon: _Icons.previousIcon,
|
|
@@ -89,7 +87,7 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
89
87
|
onClick: function onClick() {
|
|
90
88
|
onPageChange(currentPage - 1);
|
|
91
89
|
}
|
|
92
|
-
}), showGoToPage
|
|
90
|
+
}), 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"], {
|
|
93
91
|
options: Array.from(Array(totalPages), function (e, num) {
|
|
94
92
|
return {
|
|
95
93
|
label: (num + 1).toString(),
|
|
@@ -102,8 +100,7 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
102
100
|
value: currentPage.toString(),
|
|
103
101
|
size: "fillParent",
|
|
104
102
|
tabIndex: tabIndex
|
|
105
|
-
})))
|
|
106
|
-
size: "small",
|
|
103
|
+
}))) : /*#__PURE__*/_react["default"].createElement("span", null, translatedLabels.paginator.pageOfText(currentPageInternal, totalPages)), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
107
104
|
mode: "secondary",
|
|
108
105
|
disabled: currentPageInternal === totalPages,
|
|
109
106
|
icon: _Icons.nextIcon,
|
|
@@ -112,7 +109,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
112
109
|
onPageChange(currentPage + 1);
|
|
113
110
|
}
|
|
114
111
|
}), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
115
|
-
size: "small",
|
|
116
112
|
mode: "secondary",
|
|
117
113
|
disabled: currentPageInternal === totalPages,
|
|
118
114
|
icon: _Icons.lastIcon,
|
|
@@ -145,7 +141,7 @@ var DxcPaginatorContainer = _styledComponents["default"].div(_templateObject ||
|
|
|
145
141
|
|
|
146
142
|
var SelectContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: 5.25rem;\n"])));
|
|
147
143
|
|
|
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
|
|
144
|
+
var ItemsPageContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
149
145
|
return props.theme.itemsPerPageSelectorMarginRight;
|
|
150
146
|
}, function (props) {
|
|
151
147
|
return props.theme.itemsPerPageSelectorMarginLeft;
|
|
@@ -163,9 +159,7 @@ var TotalItemsContainer = _styledComponents["default"].span(_templateObject6 ||
|
|
|
163
159
|
|
|
164
160
|
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"])));
|
|
165
161
|
|
|
166
|
-
var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: 0.5rem;\n
|
|
167
|
-
|
|
168
|
-
var TextContainer = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
162
|
+
var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: 0.5rem;\n"])));
|
|
169
163
|
|
|
170
164
|
var _default = DxcPaginator;
|
|
171
165
|
exports["default"] = _default;
|
|
@@ -2,12 +2,20 @@ import React from "react";
|
|
|
2
2
|
import DxcPaginator from "./Paginator";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Paginator",
|
|
8
9
|
component: DxcPaginator,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
paginator: {
|
|
14
|
+
baseColor: "#f2f2f2",
|
|
15
|
+
fontColor: "#000000",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
export const Chromatic = () => (
|
|
12
20
|
<>
|
|
13
21
|
<ExampleContainer>
|
|
@@ -59,5 +67,21 @@ export const Chromatic = () => (
|
|
|
59
67
|
showGoToPage
|
|
60
68
|
/>
|
|
61
69
|
</ExampleContainer>
|
|
70
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
71
|
+
<ExampleContainer>
|
|
72
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
73
|
+
<ExampleContainer>
|
|
74
|
+
<Title title="Page change and items per page options" theme="light" level={4} />
|
|
75
|
+
<DxcPaginator
|
|
76
|
+
currentPage={1}
|
|
77
|
+
itemsPerPage={10}
|
|
78
|
+
totalItems={27}
|
|
79
|
+
onPageChange={() => {}}
|
|
80
|
+
itemsPerPageOptions={[5, 10, 15]}
|
|
81
|
+
showGoToPage
|
|
82
|
+
/>
|
|
83
|
+
</ExampleContainer>
|
|
84
|
+
</HalstackProvider>
|
|
85
|
+
</ExampleContainer>
|
|
62
86
|
</>
|
|
63
87
|
);
|
|
@@ -16,26 +16,33 @@ var _Paginator = _interopRequireDefault(require("./Paginator"));
|
|
|
16
16
|
|
|
17
17
|
// Mocking DOMRect for Radix Primitive Popover
|
|
18
18
|
global.globalThis = global;
|
|
19
|
+
global.DOMRect = {
|
|
20
|
+
fromRect: function fromRect() {
|
|
21
|
+
return {
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
bottom: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
width: 0,
|
|
27
|
+
height: 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
19
31
|
|
|
20
32
|
global.ResizeObserver = /*#__PURE__*/function () {
|
|
21
|
-
function ResizeObserver(
|
|
33
|
+
function ResizeObserver() {
|
|
22
34
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
23
|
-
this.cb = cb;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
(0, _createClass2["default"])(ResizeObserver, [{
|
|
27
38
|
key: "observe",
|
|
28
|
-
value: function observe() {
|
|
29
|
-
this.cb([{
|
|
30
|
-
borderBoxSize: {
|
|
31
|
-
inlineSize: 0,
|
|
32
|
-
blockSize: 0
|
|
33
|
-
}
|
|
34
|
-
}]);
|
|
35
|
-
}
|
|
39
|
+
value: function observe() {}
|
|
36
40
|
}, {
|
|
37
41
|
key: "unobserve",
|
|
38
42
|
value: function unobserve() {}
|
|
43
|
+
}, {
|
|
44
|
+
key: "disconnect",
|
|
45
|
+
value: function disconnect() {}
|
|
39
46
|
}]);
|
|
40
47
|
return ResizeObserver;
|
|
41
48
|
}();
|
|
@@ -87,7 +87,7 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
87
87
|
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n display: flex;\n flex-wrap: wrap;\n min-width: 100px;\n width: 100%;\n"])), function (_ref2) {
|
|
88
88
|
var overlay = _ref2.overlay,
|
|
89
89
|
theme = _ref2.theme;
|
|
90
|
-
return overlay ? "background-color: ".concat(theme.overlayColor, ";\n
|
|
90
|
+
return overlay ? "background-color: ".concat(theme.overlayColor, ";\n width: 100%;\n justify-content: center;\n height: 100vh;\n align-items: center;\n max-width: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1300;") : "background-color: \"transparent\";";
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
var ProgressBarContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
@@ -119,7 +119,7 @@ var ProgressBarLabel = _styledComponents["default"].div(_templateObject4 || (_te
|
|
|
119
119
|
}, function (props) {
|
|
120
120
|
return props.theme.labelFontTextTransform;
|
|
121
121
|
}, function (props) {
|
|
122
|
-
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ?
|
|
122
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.labelFontColor;
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n display: ", ";\n flex-shrink: 0;\n"])), function (props) {
|
|
@@ -133,13 +133,13 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (
|
|
|
133
133
|
}, function (props) {
|
|
134
134
|
return props.theme.valueFontTextTransform;
|
|
135
135
|
}, function (props) {
|
|
136
|
-
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ?
|
|
136
|
+
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.valueFontColor;
|
|
137
137
|
}, function (props) {
|
|
138
138
|
return props.value !== undefined && props.value !== null && props.showValue === true && "block" || "none";
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
var HelperText = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
|
|
142
|
-
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ?
|
|
142
|
+
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.helperTextFontColor;
|
|
143
143
|
}, function (props) {
|
|
144
144
|
return props.theme.helperTextFontFamily;
|
|
145
145
|
}, function (props) {
|
|
@@ -2,12 +2,23 @@ import React from "react";
|
|
|
2
2
|
import DxcProgressBar from "./ProgressBar";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "ProgressBar",
|
|
8
9
|
component: DxcProgressBar,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
progressBar: {
|
|
14
|
+
accentColor: "#5f249f",
|
|
15
|
+
baseColor: "#e6e6e6",
|
|
16
|
+
fontColor: "#000000",
|
|
17
|
+
overlayColor: "#000000b3",
|
|
18
|
+
overlayFontColor: "#ffffff",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
11
22
|
export const Chromatic = () => (
|
|
12
23
|
<>
|
|
13
24
|
<ExampleContainer>
|
|
@@ -46,15 +57,37 @@ export const Chromatic = () => (
|
|
|
46
57
|
<DxcProgressBar label="Margin xlarge" margin="xlarge" value={50} showValue />
|
|
47
58
|
</ExampleContainer>
|
|
48
59
|
<ExampleContainer>
|
|
49
|
-
<Title title="
|
|
60
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
50
61
|
<DxcProgressBar label="Margin xxlarge" margin="xxlarge" value={50} showValue />
|
|
51
62
|
</ExampleContainer>
|
|
63
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
64
|
+
<ExampleContainer>
|
|
65
|
+
<Title title="Label and helper text" theme="light" level={4} />
|
|
66
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
67
|
+
<DxcProgressBar label="Loading..." helperText="Helper text" value={24} showValue />
|
|
68
|
+
</HalstackProvider>
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Without default value" theme="light" level={4} />
|
|
72
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
73
|
+
<DxcProgressBar label="Loading..." helperText="Helper text" showValue />
|
|
74
|
+
</HalstackProvider>
|
|
75
|
+
</ExampleContainer>
|
|
52
76
|
</>
|
|
53
77
|
);
|
|
54
78
|
|
|
55
79
|
export const ProgressBarOverlay = () => (
|
|
56
80
|
<ExampleContainer>
|
|
57
81
|
<Title title="Overlay" theme="dark" level={4} />
|
|
58
|
-
<DxcProgressBar label="Overlay" helperText="Helper text" overlay
|
|
82
|
+
<DxcProgressBar label="Overlay" helperText="Helper text" overlay showValue value={50} />
|
|
83
|
+
</ExampleContainer>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export const ProgressBarOverlayOpinionated = () => (
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="Overlay" theme="dark" level={4} />
|
|
89
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
90
|
+
<DxcProgressBar label="Overlay" helperText="Helper text" overlay showValue value={50} />
|
|
91
|
+
</HalstackProvider>
|
|
59
92
|
</ExampleContainer>
|
|
60
93
|
);
|
|
@@ -5,12 +5,20 @@ import DxcHeading from "../heading/Heading";
|
|
|
5
5
|
import DxcParagraph from "../paragraph/Paragraph";
|
|
6
6
|
import Title from "../../.storybook/components/Title";
|
|
7
7
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
title: "QuickNav",
|
|
11
12
|
component: DxcQuickNav,
|
|
12
13
|
};
|
|
13
14
|
|
|
15
|
+
const opinionatedTheme = {
|
|
16
|
+
quickNav: {
|
|
17
|
+
fontColor: "#666666",
|
|
18
|
+
accentColor: "#9a6bb2",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
const defaultLinks = [
|
|
15
23
|
{
|
|
16
24
|
label: "Overview",
|
|
@@ -315,6 +323,12 @@ export const Chromatic = () => (
|
|
|
315
323
|
</QuickNavContainer>
|
|
316
324
|
</Container>
|
|
317
325
|
</ExampleContainer>
|
|
326
|
+
<Title title="Opinionated theme" level={2} />
|
|
327
|
+
<ExampleContainer>
|
|
328
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
329
|
+
<DxcQuickNav links={defaultLinks} />
|
|
330
|
+
</HalstackProvider>
|
|
331
|
+
</ExampleContainer>
|
|
318
332
|
</>
|
|
319
333
|
);
|
|
320
334
|
|