@dxc-technology/halstack-react 8.0.0 → 9.0.1
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/BackgroundColorContext.d.ts +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1329 -5
- package/HalstackContext.js +114 -73
- package/accordion/Accordion.js +13 -24
- package/accordion/Accordion.stories.tsx +102 -13
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +3 -3
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.test.js +1 -1
- package/accordion-group/types.d.ts +2 -2
- package/alert/Alert.js +3 -5
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/box/Box.js +3 -5
- package/box/Box.stories.tsx +15 -0
- package/box/Box.test.js +1 -1
- package/button/Button.js +13 -15
- package/button/Button.stories.tsx +150 -8
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +3 -3
- package/card/Card.js +12 -13
- package/card/Card.stories.tsx +12 -13
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.js +3 -3
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.js +18 -26
- package/chip/Chip.stories.tsx +96 -9
- package/chip/Chip.test.js +3 -5
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1625 -0
- 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 +61 -74
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.js +5 -8
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +3 -2
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.js +4 -8
- package/file-input/FileInput.stories.tsx +85 -2
- package/file-input/FileInput.test.js +1 -42
- package/file-input/FileItem.js +1 -0
- package/footer/Footer.js +6 -8
- package/footer/Footer.stories.tsx +91 -0
- package/footer/Footer.test.js +14 -26
- package/header/Header.d.ts +3 -2
- package/header/Header.js +21 -23
- package/header/Header.stories.tsx +149 -6
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +1 -1
- package/link/Link.js +2 -2
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- 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}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +37 -17
- package/number-input/NumberInput.test.js +1 -1
- package/package.json +2 -2
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -14
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +44 -47
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/PasswordInput.test.js +1 -1
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/ResultsetTable.js +2 -2
- package/resultsetTable/ResultsetTable.test.js +18 -23
- package/resultsetTable/types.d.ts +3 -3
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +56 -35
- package/select/Select.stories.tsx +492 -145
- package/select/Select.test.js +76 -81
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.js +9 -11
- package/sidenav/Sidenav.stories.tsx +148 -46
- package/slider/Slider.js +6 -7
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +2 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.js +3 -3
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +2 -2
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.js +12 -14
- package/tabs/Tabs.js +4 -6
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +34 -7
- package/text-input/TextInput.js +10 -14
- package/text-input/TextInput.stories.tsx +92 -4
- package/text-input/TextInput.test.js +125 -26
- package/textarea/Textarea.js +3 -3
- package/textarea/Textarea.stories.jsx +60 -1
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.js +7 -4
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +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
|
@@ -12,7 +12,7 @@ var _react2 = require("@testing-library/react");
|
|
|
12
12
|
|
|
13
13
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
14
|
|
|
15
|
-
var _PasswordInput = _interopRequireDefault(require("./PasswordInput"));
|
|
15
|
+
var _PasswordInput = _interopRequireDefault(require("./PasswordInput.tsx"));
|
|
16
16
|
|
|
17
17
|
describe("Password input component tests", function () {
|
|
18
18
|
test("Password input renders with label", function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
declare const DxcProgressBar: ({ label, helperText, overlay, value, showValue, margin, }:
|
|
2
|
+
import ProgressBarPropsType from "./types";
|
|
3
|
+
declare const DxcProgressBar: ({ label, helperText, overlay, value, showValue, margin, }: ProgressBarPropsType) => JSX.Element;
|
|
4
4
|
export default DxcProgressBar;
|
|
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
@@ -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
|
);
|
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
|
|
9
|
+
var _ProgressBar = _interopRequireDefault(require("./ProgressBar.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("ProgressBar component tests", function () {
|
|
12
12
|
test("ProgressBar renders with label and helperText", function () {
|
package/progress-bar/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Size = {
|
|
3
3
|
top?: Space;
|
|
4
4
|
bottom?: Space;
|
|
5
5
|
left?: Space;
|
|
6
6
|
right?: Space;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
declare type Props = {
|
|
9
9
|
/**
|
|
10
10
|
* Text to be placed above the progress bar.
|
|
11
11
|
*/
|
|
@@ -34,3 +34,4 @@ export declare type Props = {
|
|
|
34
34
|
*/
|
|
35
35
|
margin?: Space | Size;
|
|
36
36
|
};
|
|
37
|
+
export default Props;
|
|
@@ -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
|
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import DxcRadioGroup from "./RadioGroup";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Radio Group",
|
|
@@ -19,83 +20,195 @@ const options = [
|
|
|
19
20
|
|
|
20
21
|
const single_disabled_options = [{ label: "Option A", value: "A", disabled: true }];
|
|
21
22
|
|
|
23
|
+
const opinionatedTheme = {
|
|
24
|
+
radioGroup: {
|
|
25
|
+
baseColor: "#0086e6",
|
|
26
|
+
fontColor: "#000000",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
22
30
|
export const Chromatic = () => (
|
|
23
31
|
<>
|
|
24
32
|
<Title title="Radio input states" theme="light" level={2} />
|
|
25
33
|
<ExampleContainer>
|
|
26
34
|
<Title title="Enabled" theme="light" level={4} />
|
|
27
|
-
<DxcRadioGroup label="
|
|
35
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
28
36
|
</ExampleContainer>
|
|
29
37
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
30
38
|
<Title title="Hovered" theme="light" level={4} />
|
|
31
|
-
<DxcRadioGroup label="
|
|
39
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
32
40
|
</ExampleContainer>
|
|
33
41
|
<ExampleContainer pseudoState="pseudo-active">
|
|
34
42
|
<Title title="Active" theme="light" level={4} />
|
|
35
|
-
<DxcRadioGroup label="
|
|
43
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
36
44
|
</ExampleContainer>
|
|
37
45
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
38
46
|
<Title title="Focused" theme="light" level={4} />
|
|
39
|
-
<DxcRadioGroup label="
|
|
47
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
40
48
|
</ExampleContainer>
|
|
41
49
|
<ExampleContainer>
|
|
42
50
|
<Title title="Disabled" theme="light" level={4} />
|
|
43
|
-
<DxcRadioGroup label="
|
|
51
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={single_disabled_options} defaultValue="A" />
|
|
44
52
|
</ExampleContainer>
|
|
45
53
|
<Title title="Readonly radio input sub-states" theme="light" level={3} />
|
|
46
54
|
<ExampleContainer>
|
|
47
55
|
<Title title="Enabled" theme="light" level={4} />
|
|
48
|
-
<DxcRadioGroup label="
|
|
56
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={single_option} defaultValue="A" readonly />
|
|
49
57
|
</ExampleContainer>
|
|
50
58
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
51
59
|
<Title title="Hovered" theme="light" level={4} />
|
|
52
|
-
<DxcRadioGroup label="
|
|
60
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={single_option} defaultValue="A" readonly />
|
|
53
61
|
</ExampleContainer>
|
|
54
62
|
<ExampleContainer pseudoState="pseudo-active">
|
|
55
63
|
<Title title="Active" theme="light" level={4} />
|
|
56
|
-
<DxcRadioGroup label="
|
|
64
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={single_option} defaultValue="A" readonly />
|
|
57
65
|
</ExampleContainer>
|
|
58
66
|
<Title title="Error radio input sub-states" theme="light" level={3} />
|
|
59
67
|
<ExampleContainer>
|
|
60
68
|
<Title title="Enabled" theme="light" level={4} />
|
|
61
|
-
<DxcRadioGroup
|
|
69
|
+
<DxcRadioGroup
|
|
70
|
+
label="Label"
|
|
71
|
+
helperText="Helper text"
|
|
72
|
+
options={single_option}
|
|
73
|
+
defaultValue="A"
|
|
74
|
+
error="Error message"
|
|
75
|
+
/>
|
|
62
76
|
</ExampleContainer>
|
|
63
77
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
64
78
|
<Title title="Hovered" theme="light" level={4} />
|
|
65
|
-
<DxcRadioGroup
|
|
79
|
+
<DxcRadioGroup
|
|
80
|
+
label="Label"
|
|
81
|
+
helperText="Helper text"
|
|
82
|
+
options={single_option}
|
|
83
|
+
defaultValue="A"
|
|
84
|
+
readonly
|
|
85
|
+
error="Error message"
|
|
86
|
+
/>
|
|
66
87
|
</ExampleContainer>
|
|
67
88
|
<ExampleContainer pseudoState="pseudo-active">
|
|
68
89
|
<Title title="Active" theme="light" level={4} />
|
|
69
|
-
<DxcRadioGroup
|
|
90
|
+
<DxcRadioGroup
|
|
91
|
+
label="Label"
|
|
92
|
+
helperText="Helper text"
|
|
93
|
+
options={single_option}
|
|
94
|
+
defaultValue="A"
|
|
95
|
+
readonly
|
|
96
|
+
error="Error message"
|
|
97
|
+
/>
|
|
70
98
|
</ExampleContainer>
|
|
71
99
|
<Title title="Variants" theme="light" level={2} />
|
|
72
100
|
<ExampleContainer>
|
|
73
101
|
<Title title="Column" theme="light" level={4} />
|
|
74
|
-
<DxcRadioGroup label="
|
|
102
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={options} />
|
|
75
103
|
</ExampleContainer>
|
|
76
104
|
<ExampleContainer>
|
|
77
105
|
<Title title="Row" theme="light" level={4} />
|
|
78
|
-
<DxcRadioGroup label="
|
|
106
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={options} stacking="row" />
|
|
79
107
|
</ExampleContainer>
|
|
80
108
|
<ExampleContainer>
|
|
81
109
|
<Title title="Optional" theme="light" level={4} />
|
|
82
|
-
<DxcRadioGroup label="
|
|
110
|
+
<DxcRadioGroup label="Label" optional helperText="Helper text" options={options} stacking="row" />
|
|
83
111
|
</ExampleContainer>
|
|
84
112
|
<ExampleContainer>
|
|
85
113
|
<Title title="Disabled" theme="light" level={4} />
|
|
86
|
-
<DxcRadioGroup label="
|
|
114
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={options} disabled />
|
|
87
115
|
</ExampleContainer>
|
|
88
116
|
<ExampleContainer>
|
|
89
117
|
<Title title="Readonly" theme="light" level={4} />
|
|
90
|
-
<DxcRadioGroup label="
|
|
118
|
+
<DxcRadioGroup label="Label" readonly helperText="Helper text" options={options} />
|
|
91
119
|
</ExampleContainer>
|
|
92
120
|
<ExampleContainer>
|
|
93
121
|
<Title title="Error space reserved" theme="light" level={4} />
|
|
94
|
-
<DxcRadioGroup label="
|
|
122
|
+
<DxcRadioGroup label="Label" error="" helperText="Helper text" options={options} />
|
|
95
123
|
</ExampleContainer>
|
|
96
124
|
<ExampleContainer>
|
|
97
125
|
<Title title="Error" theme="light" level={4} />
|
|
98
|
-
<DxcRadioGroup label="
|
|
126
|
+
<DxcRadioGroup label="Label" error="Error message" helperText="Helper text" options={options} />
|
|
127
|
+
</ExampleContainer>
|
|
128
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
129
|
+
<ExampleContainer>
|
|
130
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
131
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
132
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
133
|
+
</HalstackProvider>
|
|
134
|
+
</ExampleContainer>
|
|
135
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
136
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
137
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
138
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
139
|
+
</HalstackProvider>
|
|
140
|
+
</ExampleContainer>
|
|
141
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
142
|
+
<Title title="Active" theme="light" level={4} />
|
|
143
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
144
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
145
|
+
</HalstackProvider>
|
|
146
|
+
</ExampleContainer>
|
|
147
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
148
|
+
<Title title="Focused" theme="light" level={4} />
|
|
149
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
150
|
+
<DxcRadioGroup label="Label" helperText="Helper text" defaultValue="A" options={single_option} />
|
|
151
|
+
</HalstackProvider>
|
|
152
|
+
</ExampleContainer>
|
|
153
|
+
<ExampleContainer>
|
|
154
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
155
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
156
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={single_disabled_options} defaultValue="A" />
|
|
157
|
+
</HalstackProvider>
|
|
158
|
+
</ExampleContainer>
|
|
159
|
+
<ExampleContainer>
|
|
160
|
+
<Title title="Readonly enabled" theme="light" level={4} />
|
|
161
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
162
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" readonly />
|
|
163
|
+
</HalstackProvider>
|
|
164
|
+
</ExampleContainer>
|
|
165
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
166
|
+
<Title title="Readonly hovered" theme="light" level={4} />
|
|
167
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
168
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" readonly />
|
|
169
|
+
</HalstackProvider>
|
|
170
|
+
</ExampleContainer>
|
|
171
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
172
|
+
<Title title="Readonly active" theme="light" level={4} />
|
|
173
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
174
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" readonly />
|
|
175
|
+
</HalstackProvider>
|
|
176
|
+
</ExampleContainer>
|
|
177
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
178
|
+
<Title title="Readonly focused" theme="light" level={4} />
|
|
179
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
180
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" readonly />
|
|
181
|
+
</HalstackProvider>
|
|
182
|
+
</ExampleContainer>
|
|
183
|
+
<ExampleContainer>
|
|
184
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
185
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
186
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" error="Error message" />
|
|
187
|
+
</HalstackProvider>
|
|
188
|
+
</ExampleContainer>
|
|
189
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
190
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
191
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
192
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" error="Error message" />
|
|
193
|
+
</HalstackProvider>
|
|
194
|
+
</ExampleContainer>
|
|
195
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
196
|
+
<Title title="Active" theme="light" level={4} />
|
|
197
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
198
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" error="Error message" />
|
|
199
|
+
</HalstackProvider>
|
|
200
|
+
</ExampleContainer>
|
|
201
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
202
|
+
<Title title="Focused" theme="light" level={4} />
|
|
203
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
204
|
+
<DxcRadioGroup label="Label" options={single_option} defaultValue="A" error="Error message" />
|
|
205
|
+
</HalstackProvider>
|
|
206
|
+
</ExampleContainer>
|
|
207
|
+
<ExampleContainer>
|
|
208
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
209
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
210
|
+
<DxcRadioGroup label="Label" helperText="Helper text" options={options} disabled defaultValue="A" />
|
|
211
|
+
</HalstackProvider>
|
|
99
212
|
</ExampleContainer>
|
|
100
213
|
</>
|
|
101
214
|
);
|
|
@@ -73,7 +73,7 @@ describe("Radio Group component tests", function () {
|
|
|
73
73
|
expect(error.getAttribute("aria-live")).toBe("off");
|
|
74
74
|
radios.forEach(function (radio, index) {
|
|
75
75
|
// if no option was previously selected, first option is the focusable one
|
|
76
|
-
index === 0
|
|
76
|
+
if (index === 0) expect(radio.tabIndex).toBe(0);else expect(radio.tabIndex).toBe(-1);
|
|
77
77
|
expect(radio.getAttribute("aria-checked")).toBe("false");
|
|
78
78
|
expect(radio.getAttribute("aria-disabled")).toBe("false");
|
|
79
79
|
expect(radio.getAttribute("aria-labelledby")).toBe(getByText("Option 0".concat(index + 1)).id);
|
|
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _Table = _interopRequireDefault(require("../table/Table"));
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
29
29
|
|
|
30
30
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
31
31
|
|
|
32
|
-
var _utils = require("../common/utils
|
|
32
|
+
var _utils = require("../common/utils");
|
|
33
33
|
|
|
34
34
|
var _templateObject, _templateObject2, _templateObject3;
|
|
35
35
|
|
|
@@ -12,46 +12,41 @@ var _react2 = require("@testing-library/react");
|
|
|
12
12
|
|
|
13
13
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
14
|
|
|
15
|
-
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
15
|
+
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable.tsx"));
|
|
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
|
}();
|
|
42
49
|
|
|
43
|
-
global.DOMRect = {
|
|
44
|
-
fromRect: function fromRect() {
|
|
45
|
-
return {
|
|
46
|
-
top: 0,
|
|
47
|
-
left: 0,
|
|
48
|
-
bottom: 0,
|
|
49
|
-
right: 0,
|
|
50
|
-
width: 0,
|
|
51
|
-
height: 0
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
50
|
var columns = [{
|
|
56
51
|
displayValue: "Id",
|
|
57
52
|
isSortable: false
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type Column = {
|
|
9
|
+
export declare type Column = {
|
|
10
10
|
/**
|
|
11
11
|
* Column display value.
|
|
12
12
|
*/
|
package/select/Listbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ListboxProps } from "./types";
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ id, currentValue, options, visualFocusIndex, lastOptionIndex, multiple, optional, optionalItem, searchable, handleOptionOnClick,
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ id, currentValue, options, visualFocusIndex, lastOptionIndex, multiple, optional, optionalItem, searchable, handleOptionOnClick, styles, }: ListboxProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
package/select/Listbox.js
CHANGED
|
@@ -11,13 +11,9 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
15
|
|
|
18
|
-
var _styledComponents =
|
|
19
|
-
|
|
20
|
-
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
17
|
|
|
22
18
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
23
19
|
|
|
@@ -50,17 +46,10 @@ var Listbox = function Listbox(_ref) {
|
|
|
50
46
|
optionalItem = _ref.optionalItem,
|
|
51
47
|
searchable = _ref.searchable,
|
|
52
48
|
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
53
|
-
|
|
54
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
49
|
+
styles = _ref.styles;
|
|
55
50
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
56
51
|
var listboxRef = (0, _react.useRef)(null);
|
|
57
|
-
|
|
58
|
-
var _useState = (0, _react.useState)(null),
|
|
59
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
60
|
-
styles = _useState2[0],
|
|
61
|
-
setStyles = _useState2[1];
|
|
62
|
-
|
|
63
|
-
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
52
|
+
var globalIndex = optional && !multiple ? 0 : -1;
|
|
64
53
|
|
|
65
54
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
66
55
|
if (option.options) {
|
|
@@ -122,25 +111,7 @@ var Listbox = function Listbox(_ref) {
|
|
|
122
111
|
inline: "start"
|
|
123
112
|
});
|
|
124
113
|
}, [visualFocusIndex]);
|
|
125
|
-
|
|
126
|
-
var handleResize = function handleResize() {
|
|
127
|
-
setStyles({
|
|
128
|
-
width: getSelectWidth()
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
(0, _react.useLayoutEffect)(function () {
|
|
133
|
-
handleResize();
|
|
134
|
-
}, [getSelectWidth]);
|
|
135
|
-
(0, _react.useEffect)(function () {
|
|
136
|
-
window.addEventListener("resize", handleResize);
|
|
137
|
-
return function () {
|
|
138
|
-
window.removeEventListener("resize", handleResize);
|
|
139
|
-
};
|
|
140
|
-
}, [getSelectWidth]);
|
|
141
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
142
|
-
theme: colorsTheme.select
|
|
143
|
-
}, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
114
|
+
return /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
144
115
|
id: id,
|
|
145
116
|
onClick: function onClick(event) {
|
|
146
117
|
event.stopPropagation();
|
|
@@ -162,7 +133,7 @@ var Listbox = function Listbox(_ref) {
|
|
|
162
133
|
isGroupedOption: false,
|
|
163
134
|
isLastOption: lastOptionIndex === 0,
|
|
164
135
|
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
165
|
-
}), options.map(mapOptionFunc))
|
|
136
|
+
}), options.map(mapOptionFunc));
|
|
166
137
|
};
|
|
167
138
|
|
|
168
139
|
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|