@dxc-technology/halstack-react 0.0.0-3de3cec → 0.0.0-3def5d3
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.d.ts +3 -6
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +2 -14
- package/accordion/Accordion.stories.tsx +2 -100
- package/accordion/types.d.ts +0 -12
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +21 -42
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +6 -16
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +0 -12
- package/alert/Alert.js +1 -3
- package/box/Box.d.ts +1 -1
- package/box/Box.js +5 -22
- package/box/Box.stories.tsx +25 -53
- 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 +0 -1
- package/button/Button.stories.tsx +2 -2
- package/card/Card.d.ts +1 -1
- package/card/Card.js +18 -35
- package/card/Card.stories.tsx +0 -29
- package/card/types.d.ts +1 -7
- package/chip/Chip.js +23 -36
- package/chip/Chip.stories.tsx +25 -17
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/variables.d.ts +1 -144
- package/common/variables.js +952 -1095
- package/date-input/Calendar.js +2 -2
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +4 -22
- package/dialog/Dialog.stories.tsx +52 -176
- package/dialog/types.d.ts +0 -13
- package/dropdown/DropdownMenu.js +5 -1
- package/file-input/FileItem.js +2 -2
- package/file-input/types.d.ts +1 -1
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +24 -10
- package/flex/types.d.ts +70 -5
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +43 -61
- package/footer/Footer.stories.tsx +12 -89
- package/footer/Footer.test.js +3 -1
- package/footer/types.d.ts +10 -12
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +1 -1
- package/grid/Grid.stories.tsx +38 -38
- package/header/Header.d.ts +1 -1
- package/header/Header.js +3 -30
- package/header/Header.stories.tsx +7 -71
- package/header/types.d.ts +0 -14
- package/inset/Inset.stories.tsx +1 -1
- package/layout/ApplicationLayout.d.ts +4 -4
- package/layout/ApplicationLayout.js +7 -4
- package/layout/types.d.ts +2 -3
- package/link/Link.js +1 -1
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +7 -10
- package/nav-tabs/NavTabs.stories.tsx +14 -0
- package/nav-tabs/Tab.js +22 -26
- package/nav-tabs/types.d.ts +8 -9
- package/package.json +1 -1
- package/paginator/Paginator.js +1 -1
- package/paginator/Paginator.test.js +13 -0
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +65 -93
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/types.d.ts +21 -18
- package/tabs/Tab.js +1 -2
- package/tabs/Tabs.js +10 -14
- package/text-input/TextInput.js +1 -1
- package/text-input/TextInput.stories.tsx +1 -1
- package/textarea/Textarea.js +0 -1
- package/textarea/Textarea.test.js +1 -3
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/useTheme.d.ts +1 -1
- package/utils/FocusLock.js +3 -4
- package/card/ice-cream.jpg +0 -0
package/box/Box.stories.tsx
CHANGED
|
@@ -2,6 +2,7 @@ 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";
|
|
5
6
|
import { HalstackProvider } from "../HalstackContext";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
@@ -19,99 +20,70 @@ export const Chromatic = () => (
|
|
|
19
20
|
<>
|
|
20
21
|
<Title title="Display flex" theme="light" level={2} />
|
|
21
22
|
<ExampleContainer>
|
|
22
|
-
<DxcBox display="flex"
|
|
23
|
-
Box
|
|
23
|
+
<DxcBox display="flex">
|
|
24
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
24
25
|
</DxcBox>
|
|
25
26
|
</ExampleContainer>
|
|
26
27
|
<Title title="ShadowDepth" theme="light" level={2} />
|
|
27
28
|
<ExampleContainer>
|
|
28
29
|
<Title title="ShadowDepth 0" theme="light" level={4} />
|
|
29
|
-
<DxcBox shadowDepth={0} margin="medium"
|
|
30
|
-
Box
|
|
30
|
+
<DxcBox shadowDepth={0} margin="medium">
|
|
31
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
31
32
|
</DxcBox>
|
|
32
33
|
</ExampleContainer>
|
|
33
34
|
<ExampleContainer>
|
|
34
35
|
<Title title="ShadowDepth 1" theme="light" level={4} />
|
|
35
|
-
<DxcBox shadowDepth={1} margin="medium"
|
|
36
|
-
Box
|
|
36
|
+
<DxcBox shadowDepth={1} margin="medium">
|
|
37
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
37
38
|
</DxcBox>
|
|
38
39
|
</ExampleContainer>
|
|
39
40
|
<ExampleContainer>
|
|
40
41
|
<Title title="ShadowDepth 2" theme="light" level={4} />
|
|
41
|
-
<DxcBox shadowDepth={2} margin="medium"
|
|
42
|
-
Box
|
|
42
|
+
<DxcBox shadowDepth={2} margin="medium">
|
|
43
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
43
44
|
</DxcBox>
|
|
44
45
|
</ExampleContainer>
|
|
45
|
-
<Title title="Paddings" theme="light" level={2} />
|
|
46
|
-
<ExampleContainer>
|
|
47
|
-
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
48
|
-
<DxcBox padding="xxsmall">Box</DxcBox>
|
|
49
|
-
</ExampleContainer>
|
|
50
|
-
<ExampleContainer>
|
|
51
|
-
<Title title="Xsmall padding" theme="light" level={4} />
|
|
52
|
-
<DxcBox padding="xsmall">Box</DxcBox>
|
|
53
|
-
</ExampleContainer>
|
|
54
|
-
<ExampleContainer>
|
|
55
|
-
<Title title="Small padding" theme="light" level={4} />
|
|
56
|
-
<DxcBox padding="small">Box</DxcBox>
|
|
57
|
-
</ExampleContainer>
|
|
58
|
-
<ExampleContainer>
|
|
59
|
-
<Title title="Medium padding" theme="light" level={4} />
|
|
60
|
-
<DxcBox padding="medium">Box</DxcBox>
|
|
61
|
-
</ExampleContainer>
|
|
62
|
-
<ExampleContainer>
|
|
63
|
-
<Title title="Large padding" theme="light" level={4} />
|
|
64
|
-
<DxcBox padding="large">Box</DxcBox>
|
|
65
|
-
</ExampleContainer>
|
|
66
|
-
<ExampleContainer>
|
|
67
|
-
<Title title="Xlarge padding" theme="light" level={4} />
|
|
68
|
-
<DxcBox padding="xlarge">Box</DxcBox>
|
|
69
|
-
</ExampleContainer>
|
|
70
|
-
<ExampleContainer>
|
|
71
|
-
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
72
|
-
<DxcBox padding="xxlarge">Box</DxcBox>
|
|
73
|
-
</ExampleContainer>
|
|
74
46
|
<Title title="Margins" theme="light" level={2} />
|
|
75
47
|
<ExampleContainer>
|
|
76
48
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
77
|
-
<DxcBox margin="xxsmall"
|
|
78
|
-
Box
|
|
49
|
+
<DxcBox margin="xxsmall">
|
|
50
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
79
51
|
</DxcBox>
|
|
80
52
|
</ExampleContainer>
|
|
81
53
|
<ExampleContainer>
|
|
82
54
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
83
|
-
<DxcBox margin="xsmall"
|
|
84
|
-
Box
|
|
55
|
+
<DxcBox margin="xsmall">
|
|
56
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
85
57
|
</DxcBox>
|
|
86
58
|
</ExampleContainer>
|
|
87
59
|
<ExampleContainer>
|
|
88
60
|
<Title title="Small margin" theme="light" level={4} />
|
|
89
|
-
<DxcBox margin="small"
|
|
90
|
-
Box
|
|
61
|
+
<DxcBox margin="small">
|
|
62
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
91
63
|
</DxcBox>
|
|
92
64
|
</ExampleContainer>
|
|
93
65
|
<ExampleContainer>
|
|
94
66
|
<Title title="Medium margin" theme="light" level={4} />
|
|
95
|
-
<DxcBox margin="medium"
|
|
96
|
-
Box
|
|
67
|
+
<DxcBox margin="medium">
|
|
68
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
97
69
|
</DxcBox>
|
|
98
70
|
</ExampleContainer>
|
|
99
71
|
<ExampleContainer>
|
|
100
72
|
<Title title="Large margin" theme="light" level={4} />
|
|
101
|
-
<DxcBox margin="large"
|
|
102
|
-
Box
|
|
73
|
+
<DxcBox margin="large">
|
|
74
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
103
75
|
</DxcBox>
|
|
104
76
|
</ExampleContainer>
|
|
105
77
|
<ExampleContainer>
|
|
106
78
|
<Title title="Xlarge margin" theme="light" level={4} />
|
|
107
|
-
<DxcBox margin="xlarge"
|
|
108
|
-
Box
|
|
79
|
+
<DxcBox margin="xlarge">
|
|
80
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
109
81
|
</DxcBox>
|
|
110
82
|
</ExampleContainer>
|
|
111
83
|
<ExampleContainer>
|
|
112
84
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
113
|
-
<DxcBox margin="xxlarge"
|
|
114
|
-
Box
|
|
85
|
+
<DxcBox margin="xxlarge">
|
|
86
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
115
87
|
</DxcBox>
|
|
116
88
|
</ExampleContainer>
|
|
117
89
|
<Title title="Sizes" theme="light" level={2} />
|
|
@@ -138,8 +110,8 @@ export const Chromatic = () => (
|
|
|
138
110
|
<Title title="Opinionated theme" theme="light" level={2} />
|
|
139
111
|
<ExampleContainer>
|
|
140
112
|
<HalstackProvider theme={opinionatedTheme}>
|
|
141
|
-
<DxcBox display="flex"
|
|
142
|
-
Box
|
|
113
|
+
<DxcBox display="flex">
|
|
114
|
+
<DxcInset space="2rem">Box</DxcInset>
|
|
143
115
|
</DxcBox>
|
|
144
116
|
</HalstackProvider>
|
|
145
117
|
</ExampleContainer>
|
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
|
@@ -75,7 +75,6 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
75
75
|
type: type,
|
|
76
76
|
mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
|
|
77
77
|
disabled: disabled,
|
|
78
|
-
"aria-disabled": disabled,
|
|
79
78
|
tabIndex: disabled ? -1 : tabIndex,
|
|
80
79
|
backgroundType: backgroundType,
|
|
81
80
|
size: size,
|
|
@@ -133,7 +133,7 @@ export const Chromatic = () => (
|
|
|
133
133
|
<Title title="Only icon (image)" theme="light" level={4} />
|
|
134
134
|
<DxcButton
|
|
135
135
|
mode="secondary"
|
|
136
|
-
icon="https://
|
|
136
|
+
icon="https://www.freepnglogos.com/uploads/facebook-logo-design-1.png"
|
|
137
137
|
/>
|
|
138
138
|
</ExampleContainer>
|
|
139
139
|
<Title title="Text" theme="light" level={2} />
|
|
@@ -339,7 +339,7 @@ export const Chromatic = () => (
|
|
|
339
339
|
</ExampleContainer>
|
|
340
340
|
<Title title="Inside a flex" theme="light" level={2} />
|
|
341
341
|
<ExampleContainer>
|
|
342
|
-
<DxcFlex direction="column" gap="
|
|
342
|
+
<DxcFlex direction="column" gap="1rem">
|
|
343
343
|
<DxcButton label="Button" />
|
|
344
344
|
<DxcButton label="Button" />
|
|
345
345
|
<DxcButton label="Button" />
|
package/card/Card.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import CardPropsType from "./types";
|
|
3
|
-
declare const DxcCard: ({ imageSrc, imageBgColor, imagePadding, imagePosition, linkHref, onClick, imageCover, margin,
|
|
3
|
+
declare const DxcCard: ({ imageSrc, imageBgColor, imagePadding, imagePosition, linkHref, onClick, imageCover, margin, tabIndex, outlined, children, }: CardPropsType) => JSX.Element;
|
|
4
4
|
export default DxcCard;
|
package/card/Card.js
CHANGED
|
@@ -43,7 +43,6 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
43
43
|
_ref$imageCover = _ref.imageCover,
|
|
44
44
|
imageCover = _ref$imageCover === void 0 ? false : _ref$imageCover,
|
|
45
45
|
margin = _ref.margin,
|
|
46
|
-
contentPadding = _ref.contentPadding,
|
|
47
46
|
_ref$tabIndex = _ref.tabIndex,
|
|
48
47
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
49
48
|
_ref$outlined = _ref.outlined,
|
|
@@ -56,15 +55,8 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
56
55
|
isHovered = _useState2[0],
|
|
57
56
|
changeIsHovered = _useState2[1];
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(TagImage, {
|
|
62
|
-
imagePadding: imagePadding,
|
|
63
|
-
imageCover: imageCover,
|
|
64
|
-
src: imageSrc
|
|
65
|
-
}));
|
|
66
|
-
|
|
67
|
-
return /*#__PURE__*/_react["default"].createElement(StyledDxcCard, {
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(Card, {
|
|
59
|
+
hasAction: onClick || linkHref ? true : false,
|
|
68
60
|
margin: margin,
|
|
69
61
|
onMouseEnter: function onMouseEnter() {
|
|
70
62
|
return changeIsHovered(true);
|
|
@@ -73,7 +65,6 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
73
65
|
return changeIsHovered(false);
|
|
74
66
|
},
|
|
75
67
|
onClick: onClick,
|
|
76
|
-
hasAction: onClick || linkHref,
|
|
77
68
|
tabIndex: onClick || linkHref ? tabIndex : -1,
|
|
78
69
|
as: linkHref && "a",
|
|
79
70
|
href: linkHref
|
|
@@ -82,13 +73,18 @@ var DxcCard = function DxcCard(_ref) {
|
|
|
82
73
|
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
83
74
|
theme: colorsTheme.card
|
|
84
75
|
}, /*#__PURE__*/_react["default"].createElement(CardContainer, {
|
|
85
|
-
hasAction: onClick || linkHref
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
hasAction: onClick || linkHref ? true : false,
|
|
77
|
+
imagePosition: imageSrc ? imagePosition : "none"
|
|
78
|
+
}, imageSrc && /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
79
|
+
imageBgColor: imageBgColor
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(TagImage, {
|
|
81
|
+
imagePadding: imagePadding,
|
|
82
|
+
imageCover: imageCover,
|
|
83
|
+
src: imageSrc
|
|
84
|
+
})), /*#__PURE__*/_react["default"].createElement(CardContent, null, children)))));
|
|
89
85
|
};
|
|
90
86
|
|
|
91
|
-
var
|
|
87
|
+
var Card = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n outline: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n text-decoration: none;\n ", "\n"])), function (_ref2) {
|
|
92
88
|
var hasAction = _ref2.hasAction;
|
|
93
89
|
return hasAction && "pointer" || "unset";
|
|
94
90
|
}, function (_ref3) {
|
|
@@ -111,10 +107,12 @@ var StyledDxcCard = _styledComponents["default"].div(_templateObject || (_templa
|
|
|
111
107
|
return margin && (0, _typeof2["default"])(margin) === "object" && margin.left ? _variables.spaces[margin.left] : "";
|
|
112
108
|
}, function (_ref9) {
|
|
113
109
|
var hasAction = _ref9.hasAction;
|
|
114
|
-
return hasAction && ":focus {\n
|
|
110
|
+
return hasAction && ":focus {\n outline: #0095ff auto 1px;\n }";
|
|
115
111
|
});
|
|
116
112
|
|
|
117
|
-
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n height: ", ";\n width: ", ";\n &:hover {\n border-color: ", ";\n }\n"])), function (props) {
|
|
113
|
+
var CardContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: ", ";\n height: ", ";\n width: ", ";\n &:hover {\n border-color: ", ";\n }\n"])), function (props) {
|
|
114
|
+
return props.imagePosition === "after" ? "row-reverse" : "row";
|
|
115
|
+
}, function (props) {
|
|
118
116
|
return props.theme.height;
|
|
119
117
|
}, function (props) {
|
|
120
118
|
return props.theme.width;
|
|
@@ -134,27 +132,12 @@ var TagImage = _styledComponents["default"].img(_templateObject3 || (_templateOb
|
|
|
134
132
|
return imageCover ? "cover" : "contain";
|
|
135
133
|
});
|
|
136
134
|
|
|
137
|
-
var ImageContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
135
|
+
var ImageContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n width: 35%;\n height: 100%;\n background-color: ", ";\n"])), function (_ref14) {
|
|
138
136
|
var imageBgColor = _ref14.imageBgColor;
|
|
139
137
|
return imageBgColor;
|
|
140
138
|
});
|
|
141
139
|
|
|
142
|
-
var CardContent = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n
|
|
143
|
-
var contentPadding = _ref15.contentPadding;
|
|
144
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) !== "object" ? _variables.spaces[contentPadding] : "0px";
|
|
145
|
-
}, function (_ref16) {
|
|
146
|
-
var contentPadding = _ref16.contentPadding;
|
|
147
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.top ? _variables.spaces[contentPadding.top] : "";
|
|
148
|
-
}, function (_ref17) {
|
|
149
|
-
var contentPadding = _ref17.contentPadding;
|
|
150
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.right ? _variables.spaces[contentPadding.right] : "";
|
|
151
|
-
}, function (_ref18) {
|
|
152
|
-
var contentPadding = _ref18.contentPadding;
|
|
153
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.bottom ? _variables.spaces[contentPadding.bottom] : "";
|
|
154
|
-
}, function (_ref19) {
|
|
155
|
-
var contentPadding = _ref19.contentPadding;
|
|
156
|
-
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.left ? _variables.spaces[contentPadding.left] : "";
|
|
157
|
-
});
|
|
140
|
+
var CardContent = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n overflow: hidden;\n"])));
|
|
158
141
|
|
|
159
142
|
var _default = DxcCard;
|
|
160
143
|
exports["default"] = _default;
|
package/card/Card.stories.tsx
CHANGED
|
@@ -106,35 +106,6 @@ const Card = () => (
|
|
|
106
106
|
Xxlarge
|
|
107
107
|
</DxcCard>
|
|
108
108
|
</ExampleContainer>
|
|
109
|
-
<Title title="Content padding" theme="light" level={2} />
|
|
110
|
-
<ExampleContainer>
|
|
111
|
-
<Title title="Xxsmall" theme="light" level={4} />
|
|
112
|
-
<DxcCard contentPadding="xxsmall">Xxsmall</DxcCard>
|
|
113
|
-
</ExampleContainer>
|
|
114
|
-
<ExampleContainer>
|
|
115
|
-
<Title title="Xsmall" theme="light" level={4} />
|
|
116
|
-
<DxcCard contentPadding="xsmall">Xsmall</DxcCard>
|
|
117
|
-
</ExampleContainer>
|
|
118
|
-
<ExampleContainer>
|
|
119
|
-
<Title title="Small" theme="light" level={4} />
|
|
120
|
-
<DxcCard contentPadding="small">Small</DxcCard>
|
|
121
|
-
</ExampleContainer>
|
|
122
|
-
<ExampleContainer>
|
|
123
|
-
<Title title="Medium" theme="light" level={4} />
|
|
124
|
-
<DxcCard contentPadding="medium">Medium</DxcCard>
|
|
125
|
-
</ExampleContainer>
|
|
126
|
-
<ExampleContainer>
|
|
127
|
-
<Title title="Large" theme="light" level={4} />
|
|
128
|
-
<DxcCard contentPadding="large">Large</DxcCard>
|
|
129
|
-
</ExampleContainer>
|
|
130
|
-
<ExampleContainer>
|
|
131
|
-
<Title title="Xlarge" theme="light" level={4} />
|
|
132
|
-
<DxcCard contentPadding="xlarge">Xlarge</DxcCard>
|
|
133
|
-
</ExampleContainer>
|
|
134
|
-
<ExampleContainer>
|
|
135
|
-
<Title title="Xxlarge" theme="light" level={4} />
|
|
136
|
-
<DxcCard contentPadding="xxlarge">Xxlarge</DxcCard>
|
|
137
|
-
</ExampleContainer>
|
|
138
109
|
<Title title="Margin" theme="light" level={2} />
|
|
139
110
|
<ExampleContainer>
|
|
140
111
|
<Title title="Xxsmall" theme="light" level={4} />
|
package/card/types.d.ts
CHANGED
|
@@ -46,18 +46,12 @@ declare type Props = {
|
|
|
46
46
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
47
47
|
*/
|
|
48
48
|
margin?: Space | Size;
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
51
|
-
* Size of the padding to be applied to the content area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
52
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
53
|
-
*/
|
|
54
|
-
contentPadding?: Space | Size;
|
|
55
49
|
/**
|
|
56
50
|
* Value of the tabindex given when there is an href.
|
|
57
51
|
*/
|
|
58
52
|
tabIndex?: number;
|
|
59
53
|
/**
|
|
60
|
-
*
|
|
54
|
+
* Determines whether or not the component should have an outline.
|
|
61
55
|
*/
|
|
62
56
|
outlined?: boolean;
|
|
63
57
|
/**
|
package/chip/Chip.js
CHANGED
|
@@ -42,43 +42,42 @@ var DxcChip = function DxcChip(_ref) {
|
|
|
42
42
|
var colorsTheme = (0, _useTheme["default"])();
|
|
43
43
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
44
44
|
theme: colorsTheme.chip
|
|
45
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement(Chip, {
|
|
46
46
|
disabled: disabled,
|
|
47
47
|
margin: margin
|
|
48
48
|
}, prefixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
49
|
+
role: typeof onClickPrefix === "function" ? "button" : undefined,
|
|
49
50
|
disabled: disabled,
|
|
50
|
-
|
|
51
|
-
label: label,
|
|
51
|
+
interactuable: typeof onClickPrefix === "function" && !disabled,
|
|
52
52
|
tabIndex: typeof onClickPrefix === "function" && !disabled ? tabIndex : -1,
|
|
53
53
|
onClick: function onClick() {
|
|
54
54
|
return onClickPrefix && !disabled && onClickPrefix();
|
|
55
|
-
}
|
|
56
|
-
interactuable: typeof onClickPrefix === "function" && !disabled
|
|
55
|
+
}
|
|
57
56
|
}, typeof prefixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
58
57
|
src: prefixIcon
|
|
59
|
-
}) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(
|
|
58
|
+
}) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
60
59
|
disabled: disabled
|
|
61
60
|
}, label), suffixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
61
|
+
role: typeof onClickSuffix === "function" ? "button" : undefined,
|
|
62
62
|
disabled: disabled,
|
|
63
|
-
|
|
64
|
-
label: label,
|
|
63
|
+
interactuable: typeof onClickSuffix === "function" && !disabled,
|
|
65
64
|
tabIndex: typeof onClickSuffix === "function" && !disabled ? tabIndex : -1,
|
|
66
65
|
onClick: function onClick() {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
interactuable: typeof onClickSuffix === "function" && !disabled
|
|
66
|
+
return !disabled && (onClickSuffix === null || onClickSuffix === void 0 ? void 0 : onClickSuffix());
|
|
67
|
+
}
|
|
70
68
|
}, typeof suffixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
71
69
|
src: suffixIcon
|
|
72
70
|
}) : suffixIcon)));
|
|
73
71
|
};
|
|
74
72
|
|
|
75
|
-
var
|
|
76
|
-
|
|
73
|
+
var calculateWidth = function calculateWidth(margin) {
|
|
74
|
+
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
77
75
|
};
|
|
78
76
|
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
var Chip = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: ", ";\n min-height: 40px;\n max-width: ", ";\n background-color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n"])), function (props) {
|
|
78
|
+
return props.theme.iconSpacing;
|
|
79
|
+
}, function (props) {
|
|
80
|
+
return calculateWidth(props.margin);
|
|
82
81
|
}, function (props) {
|
|
83
82
|
return props.disabled && props.theme.disabledBackgroundColor || props.theme.backgroundColor;
|
|
84
83
|
}, function (props) {
|
|
@@ -107,12 +106,12 @@ var StyledDxcChip = _styledComponents["default"].div(_templateObject || (_templa
|
|
|
107
106
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
108
107
|
}, function (props) {
|
|
109
108
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
110
|
-
}, function (
|
|
111
|
-
var disabled =
|
|
109
|
+
}, function (_ref2) {
|
|
110
|
+
var disabled = _ref2.disabled;
|
|
112
111
|
return disabled && "not-allowed";
|
|
113
112
|
});
|
|
114
113
|
|
|
115
|
-
var
|
|
114
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-style: ", ";\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])), function (props) {
|
|
116
115
|
return props.theme.fontSize;
|
|
117
116
|
}, function (props) {
|
|
118
117
|
return props.theme.fontFamily;
|
|
@@ -122,27 +121,15 @@ var ChipTextContainer = _styledComponents["default"].span(_templateObject2 || (_
|
|
|
122
121
|
return props.theme.fontStyle;
|
|
123
122
|
}, function (props) {
|
|
124
123
|
return props.disabled ? props.theme.disabledFontColor : props.theme.fontColor;
|
|
125
|
-
}, function (_ref4) {
|
|
126
|
-
var disabled = _ref4.disabled;
|
|
127
|
-
return disabled && "not-allowed" || "default";
|
|
128
124
|
});
|
|
129
125
|
|
|
130
|
-
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
131
|
-
return props.prefixIcon ? "margin-right: ".concat((props.label || props.suffixIcon) && props.theme.iconSpacing || props.prefixIcon && "0", ";") : "margin-left: ".concat((props.label || props.prefixIcon) && props.theme.iconSpacing || props.prefixIcon && "0", ";");
|
|
132
|
-
}, function (props) {
|
|
126
|
+
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border-radius: 0.25rem;\n color: ", ";\n ", "\n\n ", "\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
133
127
|
return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
|
|
128
|
+
}, function (_ref3) {
|
|
129
|
+
var interactuable = _ref3.interactuable;
|
|
130
|
+
return interactuable && "cursor: pointer;";
|
|
134
131
|
}, function (props) {
|
|
135
|
-
return
|
|
136
|
-
}, function (props) {
|
|
137
|
-
return !props.disabled && props.theme.hoverIconColor;
|
|
138
|
-
}, function (props) {
|
|
139
|
-
return !props.disabled && props.theme.focusColor;
|
|
140
|
-
}, function (props) {
|
|
141
|
-
return !props.disabled && props.theme.focusBorderThickness;
|
|
142
|
-
}, function (props) {
|
|
143
|
-
return props.disabled && "outline: none;";
|
|
144
|
-
}, function (props) {
|
|
145
|
-
return !props.disabled && props.theme.activeIconColor;
|
|
132
|
+
return props.interactuable && "\n &:hover {\n color: ".concat(props.theme.hoverIconColor, ";\n }\n &:focus,\n &:focus-visible {\n outline: ").concat(props.theme.focusBorderThickness, " solid ").concat(props.theme.focusColor, ";\n }\n &:active {\n color: ").concat(props.theme.activeIconColor, ";\n }\n ");
|
|
146
133
|
}, function (props) {
|
|
147
134
|
return props.theme.iconSize;
|
|
148
135
|
}, function (props) {
|
package/chip/Chip.stories.tsx
CHANGED
|
@@ -81,29 +81,37 @@ export const Chromatic = () => (
|
|
|
81
81
|
</ExampleContainer>
|
|
82
82
|
<ExampleContainer>
|
|
83
83
|
<Title title="Chip with ellipsis" theme="light" level={4} />
|
|
84
|
-
<
|
|
84
|
+
<div style={{ width: "200px" }}>
|
|
85
|
+
<DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
|
|
86
|
+
</div>
|
|
85
87
|
</ExampleContainer>
|
|
86
88
|
<ExampleContainer>
|
|
87
89
|
<Title title="Chip with ellipsis and suffix" theme="light" level={4} />
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
<div style={{ width: "200px" }}>
|
|
91
|
+
<DxcChip
|
|
92
|
+
suffixIcon={iconSVG}
|
|
93
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
92
96
|
</ExampleContainer>
|
|
93
97
|
<ExampleContainer>
|
|
94
98
|
<Title title="Chip with ellipsis and prefix" theme="light" level={4} />
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
<div style={{ width: "200px" }}>
|
|
100
|
+
<DxcChip
|
|
101
|
+
prefixIcon={iconSVG}
|
|
102
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
99
105
|
</ExampleContainer>
|
|
100
106
|
<ExampleContainer>
|
|
101
107
|
<Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
<div style={{ width: "200px" }}>
|
|
109
|
+
<DxcChip
|
|
110
|
+
prefixIcon={iconSVG}
|
|
111
|
+
suffixIcon={iconSVG}
|
|
112
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
107
115
|
</ExampleContainer>
|
|
108
116
|
<Title title="Margins" theme="light" level={2} />
|
|
109
117
|
<ExampleContainer>
|
|
@@ -191,16 +199,16 @@ const ChipPrefixFocused = () => (
|
|
|
191
199
|
const ChipSuffixFocused = () => (
|
|
192
200
|
<ExampleContainer>
|
|
193
201
|
<Title title="Chip with suffix" theme="light" level={4} />
|
|
194
|
-
<DxcChip label="Chip with suffix" suffixIcon=
|
|
202
|
+
<DxcChip label="Chip with suffix" suffixIcon="https://icons-for-free.com/download-icon-close+icon-1320184117228553763_512.png" onClickSuffix={() => {}} />
|
|
195
203
|
</ExampleContainer>
|
|
196
204
|
);
|
|
197
205
|
|
|
198
206
|
export const PrefixFocused = ChipPrefixFocused.bind({});
|
|
199
|
-
PrefixFocused.play = async (
|
|
207
|
+
PrefixFocused.play = async () => {
|
|
200
208
|
await userEvent.tab();
|
|
201
209
|
};
|
|
202
210
|
|
|
203
211
|
export const SuffixFocused = ChipSuffixFocused.bind({});
|
|
204
|
-
SuffixFocused.play = async (
|
|
212
|
+
SuffixFocused.play = async () => {
|
|
205
213
|
await userEvent.tab();
|
|
206
214
|
};
|