@dxc-technology/halstack-react 7.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 +98 -50
- 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.d.ts +2 -2
- package/checkbox/Checkbox.js +16 -15
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/types.d.ts +4 -0
- package/chip/Chip.js +16 -22
- package/chip/Chip.stories.tsx +96 -9
- package/common/variables.js +286 -290
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.js +60 -73
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +301 -2
- package/dropdown/Dropdown.js +35 -35
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +17 -22
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -15
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +169 -222
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +12 -53
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +17 -0
- package/footer/Footer.stories.tsx +91 -0
- package/header/Header.js +18 -20
- package/header/Header.stories.tsx +149 -6
- package/link/Link.js +1 -1
- 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/number-input/NumberInput.test.js +5 -6
- package/package.json +7 -12
- 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/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -105
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +40 -63
- package/resultsetTable/types.d.ts +2 -2
- 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 +494 -150
- 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.d.ts +2 -2
- package/slider/Slider.js +9 -8
- package/slider/Slider.stories.tsx +57 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +5 -4
- package/switch/Switch.stories.tsx +33 -0
- package/switch/types.d.ts +6 -1
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +1 -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 +587 -634
- 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/common/RequiredComponent.js +0 -32
- /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
package/alert/Alert.stories.tsx
CHANGED
|
@@ -2,12 +2,21 @@ import React from "react";
|
|
|
2
2
|
import DxcAlert from "./Alert";
|
|
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: "Alert",
|
|
8
9
|
component: DxcAlert,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
alert: {
|
|
14
|
+
baseColor: "#e6f4ff",
|
|
15
|
+
accentColor: "#0067b3",
|
|
16
|
+
overlayColor: "#000000b3",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
export const Chromatic = () => (
|
|
12
21
|
<>
|
|
13
22
|
<ExampleContainer>
|
|
@@ -155,6 +164,12 @@ export const Chromatic = () => (
|
|
|
155
164
|
</div>
|
|
156
165
|
</DxcAlert>
|
|
157
166
|
</ExampleContainer>
|
|
167
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
168
|
+
<ExampleContainer>
|
|
169
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
170
|
+
<DxcAlert inlineText="Info type alert with inline text." />
|
|
171
|
+
</HalstackProvider>
|
|
172
|
+
</ExampleContainer>
|
|
158
173
|
</>
|
|
159
174
|
);
|
|
160
175
|
|
|
@@ -168,3 +183,16 @@ export const ModalAlert = () => (
|
|
|
168
183
|
</DxcAlert>
|
|
169
184
|
</ExampleContainer>
|
|
170
185
|
);
|
|
186
|
+
|
|
187
|
+
export const ModalAlertOpinionated = () => (
|
|
188
|
+
<ExampleContainer>
|
|
189
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
190
|
+
<DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
|
|
191
|
+
<div>
|
|
192
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
193
|
+
lobortis eget.
|
|
194
|
+
</div>
|
|
195
|
+
</DxcAlert>
|
|
196
|
+
</HalstackProvider>
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
);
|
package/box/Box.js
CHANGED
|
@@ -71,7 +71,7 @@ var calculateWidth = function calculateWidth(margin, size, padding) {
|
|
|
71
71
|
return sizes[size];
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n
|
|
74
|
+
var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n overflow: hidden;\n width: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
75
75
|
return props.display;
|
|
76
76
|
}, function (props) {
|
|
77
77
|
return props.theme.borderRadius;
|
|
@@ -81,8 +81,6 @@ var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
81
81
|
return props.theme.borderStyle;
|
|
82
82
|
}, function (props) {
|
|
83
83
|
return props.theme.borderColor;
|
|
84
|
-
}, function (props) {
|
|
85
|
-
return props.theme.letterSpacing;
|
|
86
84
|
}, function (props) {
|
|
87
85
|
return calculateWidth(props.margin, props.size, props.padding);
|
|
88
86
|
}, function (props) {
|
package/box/Box.stories.tsx
CHANGED
|
@@ -2,12 +2,19 @@ import React from "react";
|
|
|
2
2
|
import Title from "../../.storybook/components/Title";
|
|
3
3
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
4
|
import DxcBox from "./Box";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Box ",
|
|
8
9
|
component: DxcBox,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const opinionatedTheme = {
|
|
13
|
+
box: {
|
|
14
|
+
baseColor: "#ffffff",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
11
18
|
export const Chromatic = () => (
|
|
12
19
|
<>
|
|
13
20
|
<Title title="Display flex" theme="light" level={2} />
|
|
@@ -128,5 +135,13 @@ export const Chromatic = () => (
|
|
|
128
135
|
<Title title="FitContent" theme="light" level={4} />
|
|
129
136
|
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
137
|
</ExampleContainer>
|
|
138
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
139
|
+
<ExampleContainer>
|
|
140
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
141
|
+
<DxcBox display="flex" padding="medium">
|
|
142
|
+
Box
|
|
143
|
+
</DxcBox>
|
|
144
|
+
</HalstackProvider>
|
|
145
|
+
</ExampleContainer>
|
|
131
146
|
</>
|
|
132
147
|
);
|
package/button/Button.js
CHANGED
|
@@ -25,7 +25,7 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
25
25
|
|
|
26
26
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
27
27
|
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
29
29
|
|
|
30
30
|
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); }
|
|
31
31
|
|
|
@@ -69,12 +69,6 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
69
69
|
|
|
70
70
|
var colorsTheme = (0, _useTheme["default"])();
|
|
71
71
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
72
|
-
|
|
73
|
-
var labelComponent = /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
74
|
-
icon: icon,
|
|
75
|
-
iconPosition: iconPosition
|
|
76
|
-
}, label);
|
|
77
|
-
|
|
78
72
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
79
73
|
theme: colorsTheme.button
|
|
80
74
|
}, /*#__PURE__*/_react["default"].createElement(Button, {
|
|
@@ -89,12 +83,18 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
89
83
|
onClick: function onClick() {
|
|
90
84
|
_onClick();
|
|
91
85
|
}
|
|
92
|
-
}, label && iconPosition === "after" &&
|
|
86
|
+
}, label && iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
87
|
+
icon: icon,
|
|
88
|
+
iconPosition: iconPosition
|
|
89
|
+
}, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
93
90
|
label: label,
|
|
94
91
|
iconPosition: iconPosition
|
|
95
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
92
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
96
93
|
src: icon
|
|
97
|
-
}) : icon), label && iconPosition === "before" &&
|
|
94
|
+
}) : icon), label && iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
95
|
+
icon: icon,
|
|
96
|
+
iconPosition: iconPosition
|
|
97
|
+
}, label)));
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
var Button = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-flex;\n width: ", ";\n height: 40px;\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n align-items: center;\n justify-content: center;\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n cursor: pointer;\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n ", "\n"])), function (props) {
|
|
@@ -144,13 +144,11 @@ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_tem
|
|
|
144
144
|
return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
-
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
147
|
+
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-left: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
148
148
|
return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
|
|
149
149
|
}, function (props) {
|
|
150
150
|
return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
var ButtonIcon = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])));
|
|
154
|
-
|
|
155
153
|
var _default = DxcButton;
|
|
156
154
|
exports["default"] = _default;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
2
3
|
import DxcButton from "./Button";
|
|
3
4
|
import DxcFlex from "./../flex/Flex";
|
|
4
|
-
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
5
|
import Title from "../../.storybook/components/Title";
|
|
6
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
7
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
title: "Button",
|
|
@@ -12,11 +13,50 @@ export default {
|
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const iconSVG = (
|
|
15
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
16
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" fill="currentColor">
|
|
16
17
|
<path d="M0 0h24v24H0z" fill="none" />
|
|
17
18
|
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
18
19
|
</svg>
|
|
19
20
|
);
|
|
21
|
+
|
|
22
|
+
const facebookIcon = (
|
|
23
|
+
<svg
|
|
24
|
+
version="1.1"
|
|
25
|
+
id="Capa_1"
|
|
26
|
+
x="0px"
|
|
27
|
+
y="0px"
|
|
28
|
+
width="438.536px"
|
|
29
|
+
height="438.536px"
|
|
30
|
+
viewBox="0 0 438.536 438.536"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
>
|
|
33
|
+
<g>
|
|
34
|
+
<path
|
|
35
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
36
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
37
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
38
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
39
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
40
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
41
|
+
/>
|
|
42
|
+
</g>
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const smallIcon = (
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20" fill="currentColor">
|
|
48
|
+
<path d="m7.646 18.333-.313-2.625q-.208-.125-.458-.27-.25-.146-.458-.271l-2.438 1.021-2.354-4.063 2.083-1.583V9.458L1.625 7.875l2.354-4.063 2.438 1.021q.208-.125.458-.27.25-.146.458-.271l.313-2.625h4.708l.313 2.625q.208.125.458.271.25.145.458.27l2.438-1.021 2.354 4.063-2.063 1.583v1.084l2.063 1.583-2.354 4.063-2.438-1.021q-.208.125-.458.271-.25.145-.458.27l-.313 2.625ZM10 12.979q1.229 0 2.104-.875T12.979 10q0-1.229-.875-2.104T10 7.021q-1.229 0-2.104.875T7.021 10q0 1.229.875 2.104t2.104.875Zm0-1.75q-.5 0-.865-.364-.364-.365-.364-.865t.364-.865q.365-.364.865-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.166q.605-.167 1.167-.5.562-.334 1.021-.792l2.021.854.833-1.375-1.771-1.354q.104-.292.146-.604.042-.313.042-.646 0-.292-.042-.594t-.125-.635l1.771-1.375-.834-1.375-2.02.875q-.48-.479-1.032-.802-.552-.323-1.156-.49l-.271-2.187H9.167l-.271 2.187q-.604.167-1.156.49-.552.323-1.011.781l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.459.458 1.011.781.552.323 1.156.49Z" />
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const opinionatedTheme = {
|
|
53
|
+
button: {
|
|
54
|
+
baseColor: "#5f249f",
|
|
55
|
+
primaryFontColor: "#ffffff",
|
|
56
|
+
secondaryHoverFontColor: "#ffffff",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
20
60
|
export const Chromatic = () => (
|
|
21
61
|
<>
|
|
22
62
|
<Title title="Primary" theme="light" level={2} />
|
|
@@ -38,7 +78,7 @@ export const Chromatic = () => (
|
|
|
38
78
|
</ExampleContainer>
|
|
39
79
|
<ExampleContainer>
|
|
40
80
|
<Title title="Disabled" theme="light" level={4} />
|
|
41
|
-
<DxcButton label="Primary disabled" disabled />
|
|
81
|
+
<DxcButton label="Primary disabled" disabled icon={iconSVG} />
|
|
42
82
|
</ExampleContainer>
|
|
43
83
|
<ExampleContainer>
|
|
44
84
|
<Title title="With left icon" theme="light" level={4} />
|
|
@@ -52,6 +92,18 @@ export const Chromatic = () => (
|
|
|
52
92
|
<Title title="Only icon" theme="light" level={4} />
|
|
53
93
|
<DxcButton icon={iconSVG} />
|
|
54
94
|
</ExampleContainer>
|
|
95
|
+
<ExampleContainer>
|
|
96
|
+
<Title title="Big icon (SVG)" theme="light" level={4} />
|
|
97
|
+
<DxcButton icon={facebookIcon} />
|
|
98
|
+
</ExampleContainer>
|
|
99
|
+
<ExampleContainer>
|
|
100
|
+
<Title title="Big icon (image)" theme="light" level={4} />
|
|
101
|
+
<DxcButton icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png" />
|
|
102
|
+
</ExampleContainer>
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<Title title="Small icon" theme="light" level={4} />
|
|
105
|
+
<DxcButton icon={smallIcon} />
|
|
106
|
+
</ExampleContainer>
|
|
55
107
|
<Title title="Secondary" theme="light" level={2} />
|
|
56
108
|
<ExampleContainer>
|
|
57
109
|
<Title title="Enabled" theme="light" level={4} />
|
|
@@ -71,12 +123,19 @@ export const Chromatic = () => (
|
|
|
71
123
|
</ExampleContainer>
|
|
72
124
|
<ExampleContainer>
|
|
73
125
|
<Title title="Disabled" theme="light" level={4} />
|
|
74
|
-
<DxcButton mode="secondary" disabled label="Secondary disabled" />
|
|
126
|
+
<DxcButton mode="secondary" disabled label="Secondary disabled" icon={iconSVG} />
|
|
75
127
|
</ExampleContainer>
|
|
76
128
|
<ExampleContainer>
|
|
77
129
|
<Title title="With icon" theme="light" level={4} />
|
|
78
130
|
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} />
|
|
79
131
|
</ExampleContainer>
|
|
132
|
+
<ExampleContainer>
|
|
133
|
+
<Title title="Only icon (image)" theme="light" level={4} />
|
|
134
|
+
<DxcButton
|
|
135
|
+
mode="secondary"
|
|
136
|
+
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
137
|
+
/>
|
|
138
|
+
</ExampleContainer>
|
|
80
139
|
<Title title="Text" theme="light" level={2} />
|
|
81
140
|
<ExampleContainer>
|
|
82
141
|
<Title title="Enabled" theme="light" level={4} />
|
|
@@ -96,12 +155,19 @@ export const Chromatic = () => (
|
|
|
96
155
|
</ExampleContainer>
|
|
97
156
|
<ExampleContainer>
|
|
98
157
|
<Title title="Disabled" theme="light" level={4} />
|
|
99
|
-
<DxcButton mode="text" label="Text disabled" disabled />
|
|
158
|
+
<DxcButton mode="text" label="Text disabled" disabled icon={iconSVG} />
|
|
100
159
|
</ExampleContainer>
|
|
101
160
|
<ExampleContainer>
|
|
102
161
|
<Title title="With icon" theme="light" level={4} />
|
|
103
162
|
<DxcButton label="Text" mode="text" icon={iconSVG} />
|
|
104
163
|
</ExampleContainer>
|
|
164
|
+
<ExampleContainer>
|
|
165
|
+
<Title title="Only icon (image)" theme="light" level={4} />
|
|
166
|
+
<DxcButton
|
|
167
|
+
mode="text"
|
|
168
|
+
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
169
|
+
/>
|
|
170
|
+
</ExampleContainer>
|
|
105
171
|
<BackgroundColorProvider color="#333333">
|
|
106
172
|
<DarkContainer>
|
|
107
173
|
<Title title="Primary" theme="dark" level={2} />
|
|
@@ -123,7 +189,7 @@ export const Chromatic = () => (
|
|
|
123
189
|
</ExampleContainer>
|
|
124
190
|
<ExampleContainer>
|
|
125
191
|
<Title title="Disabled" theme="dark" level={4} />
|
|
126
|
-
<DxcButton label="Primary disabled" disabled />
|
|
192
|
+
<DxcButton label="Primary disabled" disabled icon={iconSVG} />
|
|
127
193
|
</ExampleContainer>
|
|
128
194
|
<ExampleContainer>
|
|
129
195
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -148,7 +214,7 @@ export const Chromatic = () => (
|
|
|
148
214
|
</ExampleContainer>
|
|
149
215
|
<ExampleContainer>
|
|
150
216
|
<Title title="Disabled" theme="dark" level={4} />
|
|
151
|
-
<DxcButton mode="secondary" disabled label="Secondary disabled" />
|
|
217
|
+
<DxcButton mode="secondary" disabled label="Secondary disabled" icon={iconSVG} />
|
|
152
218
|
</ExampleContainer>
|
|
153
219
|
<ExampleContainer>
|
|
154
220
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -173,7 +239,7 @@ export const Chromatic = () => (
|
|
|
173
239
|
</ExampleContainer>
|
|
174
240
|
<ExampleContainer>
|
|
175
241
|
<Title title="Disabled" theme="dark" level={4} />
|
|
176
|
-
<DxcButton mode="text" label="Text disabled" disabled />
|
|
242
|
+
<DxcButton mode="text" label="Text disabled" disabled icon={iconSVG} />
|
|
177
243
|
</ExampleContainer>
|
|
178
244
|
<ExampleContainer>
|
|
179
245
|
<Title title="With icon" theme="dark" level={4} />
|
|
@@ -279,5 +345,81 @@ export const Chromatic = () => (
|
|
|
279
345
|
<DxcButton label="Button" />
|
|
280
346
|
</DxcFlex>
|
|
281
347
|
</ExampleContainer>
|
|
348
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
349
|
+
<Title title="Primary" theme="light" level={3} />
|
|
350
|
+
<ExampleContainer>
|
|
351
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
352
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
353
|
+
<DxcButton label="Primary" icon={iconSVG} />
|
|
354
|
+
</HalstackProvider>
|
|
355
|
+
</ExampleContainer>
|
|
356
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
357
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
358
|
+
<DxcButton label="Primary hovered" icon={iconSVG} />
|
|
359
|
+
</ExampleContainer>
|
|
360
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
361
|
+
<Title title="Focused" theme="light" level={4} />
|
|
362
|
+
<DxcButton label="Primary focused" icon={iconSVG} />
|
|
363
|
+
</ExampleContainer>
|
|
364
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
365
|
+
<Title title="Actived" theme="light" level={4} />
|
|
366
|
+
<DxcButton label="Primary actived" icon={iconSVG} />
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<ExampleContainer>
|
|
369
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
370
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
371
|
+
<DxcButton label="Primary" icon={iconSVG} disabled />
|
|
372
|
+
</HalstackProvider>
|
|
373
|
+
</ExampleContainer>
|
|
374
|
+
<Title title="Secondary" theme="light" level={3} />
|
|
375
|
+
<ExampleContainer>
|
|
376
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
377
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
378
|
+
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} />
|
|
379
|
+
</HalstackProvider>
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
382
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
383
|
+
<DxcButton mode="secondary" label="Secondary hovered" icon={iconSVG} />
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
386
|
+
<Title title="Focused" theme="light" level={4} />
|
|
387
|
+
<DxcButton mode="secondary" label="Secondary focused" icon={iconSVG} />
|
|
388
|
+
</ExampleContainer>
|
|
389
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
390
|
+
<Title title="Actived" theme="light" level={4} />
|
|
391
|
+
<DxcButton mode="secondary" label="Secondary actived" icon={iconSVG} />
|
|
392
|
+
</ExampleContainer>
|
|
393
|
+
<ExampleContainer>
|
|
394
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
395
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
396
|
+
<DxcButton mode="secondary" label="Secondary" icon={iconSVG} disabled />
|
|
397
|
+
</HalstackProvider>
|
|
398
|
+
</ExampleContainer>
|
|
399
|
+
<Title title="Text" theme="light" level={3} />
|
|
400
|
+
<ExampleContainer>
|
|
401
|
+
<Title title="Enabled" theme="light" level={4} />
|
|
402
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
403
|
+
<DxcButton mode="text" label="Text" icon={iconSVG} />
|
|
404
|
+
</HalstackProvider>
|
|
405
|
+
</ExampleContainer>
|
|
406
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
407
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
408
|
+
<DxcButton mode="text" label="Text hovered" icon={iconSVG} />
|
|
409
|
+
</ExampleContainer>
|
|
410
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
411
|
+
<Title title="Focused" theme="light" level={4} />
|
|
412
|
+
<DxcButton mode="text" label="Text focused" icon={iconSVG} />
|
|
413
|
+
</ExampleContainer>
|
|
414
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
415
|
+
<Title title="Actived" theme="light" level={4} />
|
|
416
|
+
<DxcButton mode="text" label="Text actived" icon={iconSVG} />
|
|
417
|
+
</ExampleContainer>
|
|
418
|
+
<ExampleContainer>
|
|
419
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
420
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
421
|
+
<DxcButton mode="text" label="Text disabled" icon={iconSVG} disabled />
|
|
422
|
+
</HalstackProvider>
|
|
423
|
+
</ExampleContainer>
|
|
282
424
|
</>
|
|
283
425
|
);
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import CheckboxPropsType from "./types";
|
|
3
|
-
declare const DxcCheckbox:
|
|
3
|
+
declare const DxcCheckbox: React.ForwardRefExoticComponent<CheckboxPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcCheckbox;
|
package/checkbox/Checkbox.js
CHANGED
|
@@ -46,7 +46,7 @@ var checkedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
46
46
|
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
47
47
|
}));
|
|
48
48
|
|
|
49
|
-
var DxcCheckbox = function
|
|
49
|
+
var DxcCheckbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
50
50
|
var checked = _ref.checked,
|
|
51
51
|
_ref$defaultChecked = _ref.defaultChecked,
|
|
52
52
|
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
@@ -109,7 +109,8 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
109
109
|
margin: margin,
|
|
110
110
|
size: size,
|
|
111
111
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
112
|
-
backgroundType: backgroundType
|
|
112
|
+
backgroundType: backgroundType,
|
|
113
|
+
ref: ref
|
|
113
114
|
}, label && labelPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
114
115
|
id: labelId,
|
|
115
116
|
disabled: disabled,
|
|
@@ -139,7 +140,7 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
139
140
|
disabled: disabled,
|
|
140
141
|
backgroundType: backgroundType
|
|
141
142
|
}, optional && "".concat(translatedLabels.formFields.optionalLabel, " "), label)));
|
|
142
|
-
};
|
|
143
|
+
});
|
|
143
144
|
|
|
144
145
|
var sizes = {
|
|
145
146
|
small: "120px",
|
|
@@ -173,7 +174,7 @@ var getDisabledColor = function getDisabledColor(props, element) {
|
|
|
173
174
|
}
|
|
174
175
|
};
|
|
175
176
|
|
|
176
|
-
var
|
|
177
|
+
var getEnabledColor = function getEnabledColor(props, element) {
|
|
177
178
|
switch (element) {
|
|
178
179
|
case "check":
|
|
179
180
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkColorOnDark : props.theme.checkColor;
|
|
@@ -196,7 +197,7 @@ var getNotDisabledColor = function getNotDisabledColor(props, element) {
|
|
|
196
197
|
};
|
|
197
198
|
|
|
198
199
|
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
199
|
-
return props.disabled ? getDisabledColor(props, "label") :
|
|
200
|
+
return props.disabled ? getDisabledColor(props, "label") : getEnabledColor(props, "label");
|
|
200
201
|
}, function (props) {
|
|
201
202
|
return props.theme.fontFamily;
|
|
202
203
|
}, function (props) {
|
|
@@ -209,19 +210,21 @@ var ValueInput = _styledComponents["default"].input(_templateObject2 || (_templa
|
|
|
209
210
|
|
|
210
211
|
var CheckboxContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
211
212
|
|
|
212
|
-
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: solid
|
|
213
|
-
return props.disabled ? getDisabledColor(props, "border") :
|
|
213
|
+
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: 2px solid\n ", ";\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 2px;\n }\n svg {\n position: absolute;\n width: 22px;\n height: 22px;\n }\n ", "\n"])), function (props) {
|
|
214
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "border");
|
|
214
215
|
}, function (props) {
|
|
215
|
-
return props.checked ? props.disabled ? getDisabledColor(props, "check") :
|
|
216
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
216
217
|
}, function (props) {
|
|
217
|
-
return props.disabled ? getDisabledColor(props, "background") :
|
|
218
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "background");
|
|
218
219
|
}, function (props) {
|
|
219
220
|
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
220
221
|
}, function (props) {
|
|
221
222
|
return props.disabled && "pointer-events: none;";
|
|
222
223
|
});
|
|
223
224
|
|
|
224
|
-
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n
|
|
225
|
+
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n &:hover ", " {\n border: 2px solid\n ", ";\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
|
|
226
|
+
return props.theme.checkLabelSpacing;
|
|
227
|
+
}, function (props) {
|
|
225
228
|
return calculateWidth(props.margin, props.size);
|
|
226
229
|
}, function (props) {
|
|
227
230
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -235,14 +238,12 @@ var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templ
|
|
|
235
238
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
236
239
|
}, function (props) {
|
|
237
240
|
return props.disabled ? "not-allowed" : "pointer";
|
|
238
|
-
}, function (props) {
|
|
239
|
-
return props.theme.checkLabelSpacing;
|
|
240
241
|
}, Checkbox, function (props) {
|
|
241
|
-
return props.disabled ? getDisabledColor(props, "border") :
|
|
242
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "hoverBorder");
|
|
242
243
|
}, function (props) {
|
|
243
|
-
return props.checked ? props.disabled ? getDisabledColor(props, "check") :
|
|
244
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
244
245
|
}, function (props) {
|
|
245
|
-
return props.disabled ? getDisabledColor(props, "background") :
|
|
246
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "hoverBackground");
|
|
246
247
|
});
|
|
247
248
|
|
|
248
249
|
var _default = DxcCheckbox;
|