@dxc-technology/halstack-react 0.0.0-b41d935 → 0.0.0-b4fde6b
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 +117 -77
- 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.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.test.js +1 -1
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -2
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +7 -26
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -12
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.js +13 -16
- package/button/Button.stories.tsx +151 -9
- 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.d.ts +2 -2
- package/checkbox/Checkbox.js +7 -6
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1482 -0
- package/common/variables.js +981 -1129
- 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.d.ts +1 -1
- package/dialog/Dialog.js +55 -86
- package/dialog/Dialog.stories.tsx +145 -217
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -13
- package/dropdown/Dropdown.js +37 -37
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +20 -24
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +14 -15
- package/file-input/FileInput.stories.tsx +85 -2
- package/file-input/FileInput.test.js +1 -42
- package/file-input/FileItem.js +1 -0
- package/file-input/types.d.ts +4 -0
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +70 -5
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +8 -23
- package/footer/Footer.stories.tsx +18 -15
- package/footer/Footer.test.js +14 -26
- package/footer/types.d.ts +0 -6
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- 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/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +4 -4
- package/layout/ApplicationLayout.js +1 -1
- package/layout/types.d.ts +2 -3
- package/link/Link.js +4 -4
- 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 +3 -2
- package/main.js +9 -1
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +48 -32
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +8 -13
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +7 -15
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +57 -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/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -106
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +41 -64
- package/resultsetTable/types.d.ts +1 -1
- 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 +494 -150
- package/select/Select.test.js +76 -81
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +11 -11
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +7 -6
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +8 -3
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- 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 +11 -15
- package/text-input/TextInput.stories.tsx +93 -5
- package/text-input/TextInput.test.js +587 -635
- package/textarea/Textarea.js +3 -4
- package/textarea/Textarea.stories.jsx +60 -1
- package/textarea/Textarea.test.js +2 -4
- package/toggle-group/ToggleGroup.d.ts +2 -2
- 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 +138 -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/common/RequiredComponent.js +0 -32
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
package/box/Box.stories.tsx
CHANGED
|
@@ -2,109 +2,88 @@ 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 DxcInset from "../inset/Inset";
|
|
6
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
9
|
title: "Box ",
|
|
8
10
|
component: DxcBox,
|
|
9
11
|
};
|
|
10
12
|
|
|
13
|
+
const opinionatedTheme = {
|
|
14
|
+
box: {
|
|
15
|
+
baseColor: "#ffffff",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
export const Chromatic = () => (
|
|
12
20
|
<>
|
|
13
21
|
<Title title="Display flex" theme="light" level={2} />
|
|
14
22
|
<ExampleContainer>
|
|
15
|
-
<DxcBox display="flex"
|
|
16
|
-
Box
|
|
23
|
+
<DxcBox display="flex">
|
|
24
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
17
25
|
</DxcBox>
|
|
18
26
|
</ExampleContainer>
|
|
19
27
|
<Title title="ShadowDepth" theme="light" level={2} />
|
|
20
28
|
<ExampleContainer>
|
|
21
29
|
<Title title="ShadowDepth 0" theme="light" level={4} />
|
|
22
|
-
<DxcBox shadowDepth={0} margin="medium"
|
|
23
|
-
Box
|
|
30
|
+
<DxcBox shadowDepth={0} margin="medium">
|
|
31
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
24
32
|
</DxcBox>
|
|
25
33
|
</ExampleContainer>
|
|
26
34
|
<ExampleContainer>
|
|
27
35
|
<Title title="ShadowDepth 1" theme="light" level={4} />
|
|
28
|
-
<DxcBox shadowDepth={1} margin="medium"
|
|
29
|
-
Box
|
|
36
|
+
<DxcBox shadowDepth={1} margin="medium">
|
|
37
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
30
38
|
</DxcBox>
|
|
31
39
|
</ExampleContainer>
|
|
32
40
|
<ExampleContainer>
|
|
33
41
|
<Title title="ShadowDepth 2" theme="light" level={4} />
|
|
34
|
-
<DxcBox shadowDepth={2} margin="medium"
|
|
35
|
-
Box
|
|
42
|
+
<DxcBox shadowDepth={2} margin="medium">
|
|
43
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
36
44
|
</DxcBox>
|
|
37
45
|
</ExampleContainer>
|
|
38
|
-
<Title title="Paddings" theme="light" level={2} />
|
|
39
|
-
<ExampleContainer>
|
|
40
|
-
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
41
|
-
<DxcBox padding="xxsmall">Box</DxcBox>
|
|
42
|
-
</ExampleContainer>
|
|
43
|
-
<ExampleContainer>
|
|
44
|
-
<Title title="Xsmall padding" theme="light" level={4} />
|
|
45
|
-
<DxcBox padding="xsmall">Box</DxcBox>
|
|
46
|
-
</ExampleContainer>
|
|
47
|
-
<ExampleContainer>
|
|
48
|
-
<Title title="Small padding" theme="light" level={4} />
|
|
49
|
-
<DxcBox padding="small">Box</DxcBox>
|
|
50
|
-
</ExampleContainer>
|
|
51
|
-
<ExampleContainer>
|
|
52
|
-
<Title title="Medium padding" theme="light" level={4} />
|
|
53
|
-
<DxcBox padding="medium">Box</DxcBox>
|
|
54
|
-
</ExampleContainer>
|
|
55
|
-
<ExampleContainer>
|
|
56
|
-
<Title title="Large padding" theme="light" level={4} />
|
|
57
|
-
<DxcBox padding="large">Box</DxcBox>
|
|
58
|
-
</ExampleContainer>
|
|
59
|
-
<ExampleContainer>
|
|
60
|
-
<Title title="Xlarge padding" theme="light" level={4} />
|
|
61
|
-
<DxcBox padding="xlarge">Box</DxcBox>
|
|
62
|
-
</ExampleContainer>
|
|
63
|
-
<ExampleContainer>
|
|
64
|
-
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
65
|
-
<DxcBox padding="xxlarge">Box</DxcBox>
|
|
66
|
-
</ExampleContainer>
|
|
67
46
|
<Title title="Margins" theme="light" level={2} />
|
|
68
47
|
<ExampleContainer>
|
|
69
48
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
70
|
-
<DxcBox margin="xxsmall"
|
|
71
|
-
Box
|
|
49
|
+
<DxcBox margin="xxsmall">
|
|
50
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
72
51
|
</DxcBox>
|
|
73
52
|
</ExampleContainer>
|
|
74
53
|
<ExampleContainer>
|
|
75
54
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
-
<DxcBox margin="xsmall"
|
|
77
|
-
Box
|
|
55
|
+
<DxcBox margin="xsmall">
|
|
56
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
78
57
|
</DxcBox>
|
|
79
58
|
</ExampleContainer>
|
|
80
59
|
<ExampleContainer>
|
|
81
60
|
<Title title="Small margin" theme="light" level={4} />
|
|
82
|
-
<DxcBox margin="small"
|
|
83
|
-
Box
|
|
61
|
+
<DxcBox margin="small">
|
|
62
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
84
63
|
</DxcBox>
|
|
85
64
|
</ExampleContainer>
|
|
86
65
|
<ExampleContainer>
|
|
87
66
|
<Title title="Medium margin" theme="light" level={4} />
|
|
88
|
-
<DxcBox margin="medium"
|
|
89
|
-
Box
|
|
67
|
+
<DxcBox margin="medium">
|
|
68
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
90
69
|
</DxcBox>
|
|
91
70
|
</ExampleContainer>
|
|
92
71
|
<ExampleContainer>
|
|
93
72
|
<Title title="Large margin" theme="light" level={4} />
|
|
94
|
-
<DxcBox margin="large"
|
|
95
|
-
Box
|
|
73
|
+
<DxcBox margin="large">
|
|
74
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
96
75
|
</DxcBox>
|
|
97
76
|
</ExampleContainer>
|
|
98
77
|
<ExampleContainer>
|
|
99
78
|
<Title title="Xlarge margin" theme="light" level={4} />
|
|
100
|
-
<DxcBox margin="xlarge"
|
|
101
|
-
Box
|
|
79
|
+
<DxcBox margin="xlarge">
|
|
80
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
102
81
|
</DxcBox>
|
|
103
82
|
</ExampleContainer>
|
|
104
83
|
<ExampleContainer>
|
|
105
84
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
106
|
-
<DxcBox margin="xxlarge"
|
|
107
|
-
Box
|
|
85
|
+
<DxcBox margin="xxlarge">
|
|
86
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
108
87
|
</DxcBox>
|
|
109
88
|
</ExampleContainer>
|
|
110
89
|
<Title title="Sizes" theme="light" level={2} />
|
|
@@ -128,5 +107,13 @@ export const Chromatic = () => (
|
|
|
128
107
|
<Title title="FitContent" theme="light" level={4} />
|
|
129
108
|
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
109
|
</ExampleContainer>
|
|
110
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
113
|
+
<DxcBox display="flex">
|
|
114
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
115
|
+
</DxcBox>
|
|
116
|
+
</HalstackProvider>
|
|
117
|
+
</ExampleContainer>
|
|
131
118
|
</>
|
|
132
119
|
);
|
package/box/Box.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Card = _interopRequireDefault(require("../card/Card"));
|
|
9
|
+
var _Card = _interopRequireDefault(require("../card/Card.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Box component tests", function () {
|
|
12
12
|
test("Box renders with correct text", function () {
|
package/box/types.d.ts
CHANGED
|
@@ -6,12 +6,6 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type Padding = {
|
|
10
|
-
top?: Space;
|
|
11
|
-
bottom?: Space;
|
|
12
|
-
left?: Space;
|
|
13
|
-
right?: Space;
|
|
14
|
-
};
|
|
15
9
|
declare type Props = {
|
|
16
10
|
/**
|
|
17
11
|
* The size of the shadow to be displayed around the box.
|
|
@@ -30,12 +24,6 @@ declare type Props = {
|
|
|
30
24
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
31
25
|
*/
|
|
32
26
|
margin?: Space | Margin;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
35
|
-
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
36
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
37
|
-
*/
|
|
38
|
-
padding?: Space | Padding;
|
|
39
27
|
/**
|
|
40
28
|
* Size of the component.
|
|
41
29
|
*/
|
|
@@ -57,7 +57,9 @@ var DxcBulletedList = function DxcBulletedList(_ref2) {
|
|
|
57
57
|
backgroundType: backgroundType
|
|
58
58
|
})) : type === "icon" ? /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
59
59
|
backgroundType: backgroundType
|
|
60
|
-
}, icon
|
|
60
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
61
|
+
src: icon
|
|
62
|
+
}) : icon)) : /*#__PURE__*/_react["default"].createElement(Bullet, null, /*#__PURE__*/_react["default"].createElement(Disc, {
|
|
61
63
|
backgroundType: backgroundType
|
|
62
64
|
})), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
63
65
|
color: backgroundType && backgroundType === "dark" ? colorsTheme.bulletedList.fontColorOnDark : colorsTheme.bulletedList.fontColor
|
|
@@ -73,7 +75,7 @@ var Bullet = _styledComponents["default"].div(_templateObject2 || (_templateObje
|
|
|
73
75
|
|
|
74
76
|
var GeneralContent = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n"])));
|
|
75
77
|
|
|
76
|
-
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n
|
|
78
|
+
var Icon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n width: auto;\n margin-right: ", ";\n align-content: center;\n color: ", ";\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
77
79
|
return props.theme.bulletMarginRight;
|
|
78
80
|
}, function (props) {
|
|
79
81
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
|
|
@@ -20,12 +20,18 @@ const icon = (
|
|
|
20
20
|
export const Chromatic = () => (
|
|
21
21
|
<>
|
|
22
22
|
<ExampleContainer>
|
|
23
|
-
<Title title="Icon list" level={4} />
|
|
23
|
+
<Title title="Icon list (SVG)" level={4} />
|
|
24
24
|
<DxcBulletedList type="icon" icon={icon}>
|
|
25
25
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
26
26
|
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
27
27
|
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
28
28
|
</DxcBulletedList>
|
|
29
|
+
<Title title="Icon list (path)" level={4} />
|
|
30
|
+
<DxcBulletedList type="icon" icon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg">
|
|
31
|
+
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
|
32
|
+
<DxcBulletedList.Item>Usage</DxcBulletedList.Item>
|
|
33
|
+
<DxcBulletedList.Item>Specifications</DxcBulletedList.Item>
|
|
34
|
+
</DxcBulletedList>
|
|
29
35
|
<Title title="Number list" level={4} />
|
|
30
36
|
<DxcBulletedList type="number">
|
|
31
37
|
<DxcBulletedList.Item>Code</DxcBulletedList.Item>
|
package/bulleted-list/types.d.ts
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type SVG = React.ReactNode &
|
|
3
|
-
declare type
|
|
2
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
+
declare type IconProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Defines the style of the bullet point in the list.
|
|
6
|
+
*/
|
|
7
|
+
type: "icon";
|
|
8
|
+
/**
|
|
9
|
+
* Icon to display as bullet.
|
|
10
|
+
*/
|
|
11
|
+
icon: string | SVG;
|
|
12
|
+
/**
|
|
13
|
+
* Text to be shown in the list.
|
|
14
|
+
*/
|
|
4
15
|
children: React.ReactNode;
|
|
5
|
-
type?: "disc" | "circle" | "square" | "number" | "icon";
|
|
6
|
-
icon?: string | SVG;
|
|
7
16
|
};
|
|
17
|
+
declare type OtherProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Defines the style of the bullet point in the list.
|
|
20
|
+
*/
|
|
21
|
+
type?: "disc" | "circle" | "square" | "number";
|
|
22
|
+
/**
|
|
23
|
+
* Icon to display as bullet.
|
|
24
|
+
*/
|
|
25
|
+
icon?: never;
|
|
26
|
+
/**
|
|
27
|
+
* Text to be shown in the list.
|
|
28
|
+
*/
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
declare type Props = IconProps | OtherProps;
|
|
8
32
|
export default Props;
|
|
9
33
|
export declare type BulletedListItemPropsType = {
|
|
34
|
+
/**
|
|
35
|
+
* Text to be shown in the list.
|
|
36
|
+
*/
|
|
10
37
|
children?: React.ReactNode;
|
|
11
38
|
};
|
package/button/Button.js
CHANGED
|
@@ -17,15 +17,15 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _variables = require("../common/variables
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
21
|
|
|
22
|
-
var _utils = require("../common/utils
|
|
22
|
+
var _utils = require("../common/utils");
|
|
23
23
|
|
|
24
24
|
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,19 +69,12 @@ 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, {
|
|
81
75
|
type: type,
|
|
82
76
|
mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
83
77
|
disabled: disabled,
|
|
84
|
-
"aria-disabled": disabled,
|
|
85
78
|
tabIndex: disabled ? -1 : tabIndex,
|
|
86
79
|
backgroundType: backgroundType,
|
|
87
80
|
size: size,
|
|
@@ -89,12 +82,18 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
89
82
|
onClick: function onClick() {
|
|
90
83
|
_onClick();
|
|
91
84
|
}
|
|
92
|
-
}, label && iconPosition === "after" &&
|
|
85
|
+
}, label && iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
86
|
+
icon: icon,
|
|
87
|
+
iconPosition: iconPosition
|
|
88
|
+
}, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
93
89
|
label: label,
|
|
94
90
|
iconPosition: iconPosition
|
|
95
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
91
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
96
92
|
src: icon
|
|
97
|
-
}) : icon), label && iconPosition === "before" &&
|
|
93
|
+
}) : icon), label && iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
94
|
+
icon: icon,
|
|
95
|
+
iconPosition: iconPosition
|
|
96
|
+
}, label)));
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
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 +143,11 @@ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_tem
|
|
|
144
143
|
return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
|
|
145
144
|
});
|
|
146
145
|
|
|
147
|
-
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
146
|
+
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
147
|
return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
|
|
149
148
|
}, function (props) {
|
|
150
149
|
return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
|
|
151
150
|
});
|
|
152
151
|
|
|
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
152
|
var _default = DxcButton;
|
|
156
153
|
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://www.freepnglogos.com/uploads/facebook-logo-design-1.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://www.freepnglogos.com/uploads/facebook-logo-design-1.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} />
|
|
@@ -273,11 +339,87 @@ export const Chromatic = () => (
|
|
|
273
339
|
</ExampleContainer>
|
|
274
340
|
<Title title="Inside a flex" theme="light" level={2} />
|
|
275
341
|
<ExampleContainer>
|
|
276
|
-
<DxcFlex direction="column" gap="
|
|
342
|
+
<DxcFlex direction="column" gap="1rem">
|
|
277
343
|
<DxcButton label="Button" />
|
|
278
344
|
<DxcButton label="Button" />
|
|
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/button/Button.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Button = _interopRequireDefault(require("./Button"));
|
|
9
|
+
var _Button = _interopRequireDefault(require("./Button.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Button component tests", function () {
|
|
12
12
|
test("Button renders with correct text", function () {
|
package/button/types.d.ts
CHANGED
|
@@ -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
|
-
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type Props = {
|
|
11
11
|
/**
|
|
12
12
|
* Text to be placed in the button.
|