@dxc-technology/halstack-react 0.0.0-d5ae9d7 → 0.0.0-d618bea
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 +10 -0
- package/BackgroundColorContext.js +1 -3
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.d.ts +2 -2
- package/accordion/Accordion.js +2 -2
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +59 -73
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.js +1 -1
- package/box/Box.d.ts +4 -0
- package/box/Box.js +6 -32
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -12
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +11 -11
- package/card/Card.d.ts +4 -0
- package/card/Card.js +17 -53
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +3 -4
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +1 -23
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +45 -38
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +4 -7
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +6 -25
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +8 -41
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +65 -76
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +11 -42
- package/footer/Footer.stories.tsx +151 -0
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +28 -30
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.js +2 -27
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/InputText.js +2 -2
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +8 -18
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +4 -26
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/list/List.d.ts +7 -0
- package/list/List.js +37 -0
- package/list/List.stories.tsx +70 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/paginator/Paginator.js +2 -8
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +19 -55
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +5 -23
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +4 -27
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +11 -0
- package/row/Row.js +124 -0
- package/row/Row.stories.tsx +223 -0
- package/select/Select.js +15 -17
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +4 -4
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +61 -84
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +8 -25
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +94 -0
- package/stack/Stack.stories.tsx +150 -0
- package/switch/Switch.js +4 -4
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +9 -55
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +21 -36
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +42 -81
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.js +29 -32
- package/textarea/Textarea.stories.jsx +135 -0
- package/textarea/index.d.ts +18 -8
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +8 -34
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +13 -53
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/accordion-group/index.d.ts +0 -16
- package/box/index.d.ts +0 -25
- package/card/index.d.ts +0 -22
- package/chip/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Padding = {
|
|
10
|
+
top?: Space;
|
|
11
|
+
bottom?: Space;
|
|
12
|
+
left?: Space;
|
|
13
|
+
right?: Space;
|
|
14
|
+
};
|
|
15
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
16
|
+
export declare type AccordionPropsType = {
|
|
17
|
+
/**
|
|
18
|
+
* The panel label.
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Element used as the icon that will be placed next to panel label.
|
|
23
|
+
*/
|
|
24
|
+
icon?: SVG;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated URL of the icon that will be placed next to panel label.
|
|
27
|
+
*/
|
|
28
|
+
iconSrc?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Assistive text to be placed on the right side of the panel.
|
|
31
|
+
*/
|
|
32
|
+
assistiveText?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If true, the component will be disabled.
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
39
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
40
|
+
*/
|
|
41
|
+
padding?: Space | Padding;
|
|
42
|
+
/**
|
|
43
|
+
* The expanded panel of the accordion. This area can be used to render
|
|
44
|
+
* custom content.
|
|
45
|
+
*/
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
declare type Props = {
|
|
49
|
+
/**
|
|
50
|
+
* The index of the active accordion. If undefined, the component will be uncontrolled and the active accordion will be managed internally by the component.
|
|
51
|
+
* If null, the component will be controlled and all accordions will be closed.
|
|
52
|
+
*/
|
|
53
|
+
indexActive?: number;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the component will be disabled.
|
|
56
|
+
*/
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* This function will be called when the user clicks on an accordion. The index of the clicked accordion will be passed as a parameter.
|
|
60
|
+
*/
|
|
61
|
+
onActiveChange?: (indexActive: number) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
64
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
65
|
+
*/
|
|
66
|
+
margin?: Space | Margin;
|
|
67
|
+
/**
|
|
68
|
+
* Customized accordion(s) that are allowed inside an Accordion Group.
|
|
69
|
+
*/
|
|
70
|
+
children: React.ReactElement<AccordionPropsType>[] | React.ReactElement<AccordionPropsType>;
|
|
71
|
+
};
|
|
72
|
+
export default Props;
|
package/alert/Alert.js
CHANGED
|
@@ -21,9 +21,9 @@ var _variables = require("../common/variables.js");
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../common/utils.js");
|
|
23
23
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
27
|
|
|
28
28
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
29
29
|
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcAlert from "./Alert";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Alert",
|
|
8
|
+
component: DxcAlert,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="Info" theme="light" level={4} />
|
|
15
|
+
<DxcAlert inlineText="Info type alert with inline text." />
|
|
16
|
+
</ExampleContainer>
|
|
17
|
+
<ExampleContainer>
|
|
18
|
+
<Title title="Confirm" theme="light" level={4} />
|
|
19
|
+
<DxcAlert type="confirm" inlineText="Confirm type alert with inline text." />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Warning" theme="light" level={4} />
|
|
23
|
+
<DxcAlert type="warning" inlineText="Warning type alert with inline text." />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Error" theme="light" level={4} />
|
|
27
|
+
<DxcAlert type="error" inlineText="Error type alert with inline text." />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="With close button" theme="light" level={4} />
|
|
31
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
34
|
+
<Title title="With hovered close button" theme="light" level={4} />
|
|
35
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
38
|
+
<Title title="With focused close button" theme="light" level={4} />
|
|
39
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
42
|
+
<Title title="With actived close button" theme="light" level={4} />
|
|
43
|
+
<DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
|
|
44
|
+
</ExampleContainer>
|
|
45
|
+
<ExampleContainer>
|
|
46
|
+
<Title title="With children" theme="light" level={4} />
|
|
47
|
+
<DxcAlert>
|
|
48
|
+
<div>
|
|
49
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
50
|
+
lobortis eget.
|
|
51
|
+
</div>
|
|
52
|
+
</DxcAlert>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="With inline text and children" theme="light" level={4} />
|
|
56
|
+
<DxcAlert inlineText="Info type alert with inline text.">
|
|
57
|
+
<div>
|
|
58
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
59
|
+
lobortis eget.
|
|
60
|
+
</div>
|
|
61
|
+
</DxcAlert>
|
|
62
|
+
</ExampleContainer>
|
|
63
|
+
<Title title="Margins" theme="light" level={2} />
|
|
64
|
+
<ExampleContainer>
|
|
65
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
66
|
+
<DxcAlert margin="xxsmall" inlineText="Info type alert with inline text and xxsmall margin." />
|
|
67
|
+
</ExampleContainer>
|
|
68
|
+
<ExampleContainer>
|
|
69
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
70
|
+
<DxcAlert margin="xsmall" inlineText="Info type alert with inline text and xsmall margin." />
|
|
71
|
+
</ExampleContainer>
|
|
72
|
+
<ExampleContainer>
|
|
73
|
+
<Title title="Small" theme="light" level={4} />
|
|
74
|
+
<DxcAlert margin="small" inlineText="Info type alert with inline text and small margin." />
|
|
75
|
+
</ExampleContainer>
|
|
76
|
+
<ExampleContainer>
|
|
77
|
+
<Title title="Medium" theme="light" level={4} />
|
|
78
|
+
<DxcAlert margin="medium" inlineText="Info type alert with inline text and medium margin." />
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Large" theme="light" level={4} />
|
|
82
|
+
<DxcAlert margin="large" inlineText="Info type alert with inline text and large margin." />
|
|
83
|
+
</ExampleContainer>
|
|
84
|
+
<ExampleContainer>
|
|
85
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
86
|
+
<DxcAlert margin="xlarge" inlineText="Info type alert with inline text and xlarge margin." />
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
<ExampleContainer>
|
|
89
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
90
|
+
<DxcAlert margin="xxlarge" inlineText="Info type alert with inline text and xxlarge margin." />
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
93
|
+
<ExampleContainer>
|
|
94
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
95
|
+
<DxcAlert
|
|
96
|
+
size="fitContent"
|
|
97
|
+
inlineText="Info type alert with inline text, children, close button and fitContent size."
|
|
98
|
+
onClose={() => {}}
|
|
99
|
+
>
|
|
100
|
+
<div>
|
|
101
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
102
|
+
lobortis eget.
|
|
103
|
+
</div>
|
|
104
|
+
</DxcAlert>
|
|
105
|
+
</ExampleContainer>
|
|
106
|
+
<ExampleContainer>
|
|
107
|
+
<Title title="Small" theme="light" level={4} />
|
|
108
|
+
<DxcAlert
|
|
109
|
+
size="small"
|
|
110
|
+
inlineText="Info type alert with inline text, children, close button and small size."
|
|
111
|
+
onClose={() => {}}
|
|
112
|
+
>
|
|
113
|
+
<div>
|
|
114
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
115
|
+
lobortis eget.
|
|
116
|
+
</div>
|
|
117
|
+
</DxcAlert>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Medium" theme="light" level={4} />
|
|
121
|
+
<DxcAlert
|
|
122
|
+
size="medium"
|
|
123
|
+
inlineText="Info type alert with inline text, children, close button and medium size."
|
|
124
|
+
onClose={() => {}}
|
|
125
|
+
>
|
|
126
|
+
<div>
|
|
127
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
128
|
+
lobortis eget.
|
|
129
|
+
</div>
|
|
130
|
+
</DxcAlert>
|
|
131
|
+
</ExampleContainer>
|
|
132
|
+
<ExampleContainer>
|
|
133
|
+
<Title title="Large" theme="light" level={4} />
|
|
134
|
+
<DxcAlert
|
|
135
|
+
size="large"
|
|
136
|
+
inlineText="Info type alert with inline text, children, close button and large size."
|
|
137
|
+
onClose={() => {}}
|
|
138
|
+
>
|
|
139
|
+
<div>
|
|
140
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
141
|
+
lobortis eget.
|
|
142
|
+
</div>
|
|
143
|
+
</DxcAlert>
|
|
144
|
+
</ExampleContainer>
|
|
145
|
+
<ExampleContainer>
|
|
146
|
+
<Title title="FillParent" theme="light" level={4} />
|
|
147
|
+
<DxcAlert
|
|
148
|
+
size="fillParent"
|
|
149
|
+
inlineText="Info type alert with inline text, children, close button and fillParent size."
|
|
150
|
+
onClose={() => {}}
|
|
151
|
+
>
|
|
152
|
+
<div>
|
|
153
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
154
|
+
lobortis eget.
|
|
155
|
+
</div>
|
|
156
|
+
</DxcAlert>
|
|
157
|
+
</ExampleContainer>
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
export const ModalAlert = () => (
|
|
162
|
+
<ExampleContainer>
|
|
163
|
+
<DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
|
|
164
|
+
<div>
|
|
165
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
166
|
+
lobortis eget.
|
|
167
|
+
</div>
|
|
168
|
+
</DxcAlert>
|
|
169
|
+
</ExampleContainer>
|
|
170
|
+
);
|
package/alert/types.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare type Props = {
|
|
|
38
38
|
*/
|
|
39
39
|
margin?: Space | Margin;
|
|
40
40
|
/**
|
|
41
|
-
* Size of the component
|
|
41
|
+
* Size of the component.
|
|
42
42
|
*/
|
|
43
43
|
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
44
44
|
/**
|
package/badge/Badge.js
CHANGED
|
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
17
|
|
|
18
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
19
|
|
|
20
20
|
var _templateObject;
|
|
21
21
|
|
package/box/Box.d.ts
ADDED
package/box/Box.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -19,15 +17,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
19
17
|
|
|
20
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
19
|
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
20
|
var _variables = require("../common/variables.js");
|
|
25
21
|
|
|
26
22
|
var _utils = require("../common/utils.js");
|
|
27
23
|
|
|
28
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
25
|
|
|
30
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
31
27
|
|
|
32
28
|
var _templateObject;
|
|
33
29
|
|
|
@@ -36,12 +32,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
36
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
33
|
|
|
38
34
|
var DxcBox = function DxcBox(_ref) {
|
|
39
|
-
var shadowDepth = _ref.shadowDepth,
|
|
40
|
-
|
|
41
|
-
padding = _ref.padding,
|
|
35
|
+
var _ref$shadowDepth = _ref.shadowDepth,
|
|
36
|
+
shadowDepth = _ref$shadowDepth === void 0 ? 2 : _ref$shadowDepth,
|
|
42
37
|
_ref$display = _ref.display,
|
|
43
38
|
display = _ref$display === void 0 ? "inline-flex" : _ref$display,
|
|
44
39
|
children = _ref.children,
|
|
40
|
+
margin = _ref.margin,
|
|
41
|
+
padding = _ref.padding,
|
|
45
42
|
_ref$size = _ref.size,
|
|
46
43
|
size = _ref$size === void 0 ? "fitContent" : _ref$size;
|
|
47
44
|
var colorsTheme = (0, _useTheme["default"])();
|
|
@@ -125,28 +122,5 @@ var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
125
122
|
return padding && padding.left ? _variables.spaces[padding.left] : "";
|
|
126
123
|
});
|
|
127
124
|
|
|
128
|
-
DxcBox.propTypes = {
|
|
129
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
130
|
-
display: _propTypes["default"].string,
|
|
131
|
-
shadowDepth: _propTypes["default"].oneOf([0, 1, 2]),
|
|
132
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
133
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
134
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
135
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
136
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
137
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
138
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
139
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
140
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
141
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
142
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
143
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
144
|
-
};
|
|
145
|
-
DxcBox.defaultProps = {
|
|
146
|
-
shadowDepth: 2,
|
|
147
|
-
display: "inline-flex",
|
|
148
|
-
margin: null,
|
|
149
|
-
padding: null
|
|
150
|
-
};
|
|
151
125
|
var _default = DxcBox;
|
|
152
126
|
exports["default"] = _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcBox from "./Box";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Box ",
|
|
8
|
+
component: DxcBox,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Display flex" theme="light" level={2} />
|
|
14
|
+
<ExampleContainer>
|
|
15
|
+
<DxcBox display="flex" padding="medium">
|
|
16
|
+
Box
|
|
17
|
+
</DxcBox>
|
|
18
|
+
</ExampleContainer>
|
|
19
|
+
<Title title="ShadowDepth" theme="light" level={2} />
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="ShadowDepth 0" theme="light" level={4} />
|
|
22
|
+
<DxcBox shadowDepth={0} margin="medium" padding="medium">
|
|
23
|
+
Box
|
|
24
|
+
</DxcBox>
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<ExampleContainer>
|
|
27
|
+
<Title title="ShadowDepth 1" theme="light" level={4} />
|
|
28
|
+
<DxcBox shadowDepth={1} margin="medium" padding="medium">
|
|
29
|
+
Box
|
|
30
|
+
</DxcBox>
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<ExampleContainer>
|
|
33
|
+
<Title title="ShadowDepth 2" theme="light" level={4} />
|
|
34
|
+
<DxcBox shadowDepth={2} margin="medium" padding="medium">
|
|
35
|
+
Box
|
|
36
|
+
</DxcBox>
|
|
37
|
+
</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
|
+
<Title title="Margins" theme="light" level={2} />
|
|
68
|
+
<ExampleContainer>
|
|
69
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
70
|
+
<DxcBox margin="xxsmall" padding="medium">
|
|
71
|
+
Box
|
|
72
|
+
</DxcBox>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcBox margin="xsmall" padding="medium">
|
|
77
|
+
Box
|
|
78
|
+
</DxcBox>
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
82
|
+
<DxcBox margin="small" padding="medium">
|
|
83
|
+
Box
|
|
84
|
+
</DxcBox>
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
88
|
+
<DxcBox margin="medium" padding="medium">
|
|
89
|
+
Box
|
|
90
|
+
</DxcBox>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
94
|
+
<DxcBox margin="large" padding="medium">
|
|
95
|
+
Box
|
|
96
|
+
</DxcBox>
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
100
|
+
<DxcBox margin="xlarge" padding="medium">
|
|
101
|
+
Box
|
|
102
|
+
</DxcBox>
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
<ExampleContainer>
|
|
105
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
106
|
+
<DxcBox margin="xxlarge" padding="medium">
|
|
107
|
+
Box
|
|
108
|
+
</DxcBox>
|
|
109
|
+
</ExampleContainer>
|
|
110
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Small size" theme="light" level={4} />
|
|
113
|
+
<DxcBox size="small">Box</DxcBox>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
117
|
+
<DxcBox size="medium">Box</DxcBox>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Large size" theme="light" level={4} />
|
|
121
|
+
<DxcBox size="large">Box</DxcBox>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
125
|
+
<DxcBox size="fillParent">Box</DxcBox>
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
<ExampleContainer>
|
|
128
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
129
|
+
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
</>
|
|
132
|
+
);
|
package/box/types.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Padding = {
|
|
10
|
+
top?: Space;
|
|
11
|
+
bottom?: Space;
|
|
12
|
+
left?: Space;
|
|
13
|
+
right?: Space;
|
|
14
|
+
};
|
|
15
|
+
declare type Props = {
|
|
16
|
+
/**
|
|
17
|
+
* The size of the shadow to be displayed around the box.
|
|
18
|
+
*/
|
|
19
|
+
shadowDepth?: 0 | 1 | 2;
|
|
20
|
+
/**
|
|
21
|
+
* Changes the display CSS property of the box div.
|
|
22
|
+
*/
|
|
23
|
+
display?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Custom content that will be placed in the box component.
|
|
26
|
+
*/
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
30
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
31
|
+
*/
|
|
32
|
+
margin?: Space | Margin;
|
|
33
|
+
/**
|
|
34
|
+
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
35
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
36
|
+
*/
|
|
37
|
+
padding?: Space | Padding;
|
|
38
|
+
/**
|
|
39
|
+
* Size of the component.
|
|
40
|
+
*/
|
|
41
|
+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
42
|
+
};
|
|
43
|
+
export default Props;
|
package/box/types.js
ADDED
package/button/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import ButtonPropsType from "./types";
|
|
3
|
-
declare const DxcButton: ({ label, mode, disabled, iconPosition, type,
|
|
3
|
+
declare const DxcButton: ({ label, mode, disabled, iconPosition, type, icon, iconSrc, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
|
|
4
4
|
export default DxcButton;
|
package/button/Button.js
CHANGED
|
@@ -23,9 +23,9 @@ var _variables = require("../common/variables.js");
|
|
|
23
23
|
|
|
24
24
|
var _utils = require("../common/utils.js");
|
|
25
25
|
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
26
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
27
|
|
|
28
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
28
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
29
29
|
|
|
30
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
31
31
|
|
|
@@ -44,16 +44,15 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
44
44
|
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
45
45
|
_ref$type = _ref.type,
|
|
46
46
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
47
|
+
icon = _ref.icon,
|
|
47
48
|
_ref$iconSrc = _ref.iconSrc,
|
|
48
49
|
iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
|
|
49
|
-
|
|
50
|
-
_ref$onClick = _ref.onClick,
|
|
51
|
-
_onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
|
|
50
|
+
_onClick = _ref.onClick,
|
|
52
51
|
margin = _ref.margin,
|
|
53
|
-
size = _ref.size,
|
|
52
|
+
_ref$size = _ref.size,
|
|
53
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
54
54
|
_ref$tabIndex = _ref.tabIndex,
|
|
55
55
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
56
|
-
|
|
57
56
|
var colorsTheme = (0, _useTheme["default"])();
|
|
58
57
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
59
58
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
@@ -68,15 +67,13 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
68
67
|
backgroundType: backgroundType,
|
|
69
68
|
icon: icon
|
|
70
69
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
71
|
-
disabled: disabled,
|
|
72
70
|
type: type,
|
|
71
|
+
disabled: disabled,
|
|
73
72
|
disableRipple: true,
|
|
74
|
-
"aria-disabled": disabled
|
|
73
|
+
"aria-disabled": disabled,
|
|
75
74
|
tabIndex: disabled ? -1 : tabIndex,
|
|
76
75
|
onClick: function onClick() {
|
|
77
|
-
|
|
78
|
-
_onClick();
|
|
79
|
-
}
|
|
76
|
+
_onClick();
|
|
80
77
|
}
|
|
81
78
|
}, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
82
79
|
icon: icon,
|