@dxc-technology/halstack-react 0.0.0-d238e47 → 0.0.0-d30020b
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 -4
- 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 +1 -1
- package/accordion/Accordion.js +11 -22
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +4 -8
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +4 -8
- package/alert/Alert.js +2 -2
- package/badge/Badge.js +1 -1
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +2 -2
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -17
- package/button/Button.stories.tsx +6 -8
- package/button/types.d.ts +3 -7
- package/card/Card.js +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +57 -23
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/dialog/Dialog.js +4 -3
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +13 -35
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +160 -81
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +8 -6
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +28 -36
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +21 -17
- package/header/Header.js +2 -2
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +3 -2
- package/input-text/InputText.js +2 -2
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +17 -21
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +8 -16
- package/link/Link.stories.tsx +6 -1
- package/link/types.d.ts +5 -9
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +8 -3
- package/main.js +42 -2
- package/number-input/NumberInput.js +3 -6
- package/package.json +4 -2
- package/paginator/Paginator.js +2 -8
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/types.d.ts +13 -11
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +140 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +273 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/RadioGroup.test.js +248 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +1 -1
- package/resultsetTable/ResultsetTable.js +9 -4
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +6 -2
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +20 -22
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.js +2 -2
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/slider/Slider.js +2 -2
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +8 -8
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +23 -15
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +7 -12
- package/tag/Tag.stories.tsx +15 -22
- package/tag/types.d.ts +23 -14
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.js +50 -41
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +14 -12
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +27 -60
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +97 -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.js +59 -9
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +3 -7
- package/chip/index.d.ts +0 -22
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
|
@@ -0,0 +1,170 @@
|
|
|
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 SVG = React.SVGProps<SVGSVGElement>;
|
|
10
|
+
declare type OptionGroup = {
|
|
11
|
+
/**
|
|
12
|
+
* Label of the group to be shown in the select's listbox.
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of the grouped options.
|
|
17
|
+
*/
|
|
18
|
+
options: Option[];
|
|
19
|
+
};
|
|
20
|
+
declare type Option = {
|
|
21
|
+
/**
|
|
22
|
+
* Element used as the icon that will be placed before the option label.
|
|
23
|
+
* It can be a url of an image or an inline SVG. If the url option
|
|
24
|
+
* is the chosen one, take into account that the component's
|
|
25
|
+
* color styling tokens will not be applied to the image.
|
|
26
|
+
*/
|
|
27
|
+
icon?: string | SVG;
|
|
28
|
+
/**
|
|
29
|
+
* Label of the option to be shown in the select's listbox.
|
|
30
|
+
*/
|
|
31
|
+
label: string;
|
|
32
|
+
/**
|
|
33
|
+
* Value of the option. It should be unique and
|
|
34
|
+
* not an empty string, which is reserved to the empty option added
|
|
35
|
+
* by optional prop.
|
|
36
|
+
*/
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
declare type CommonProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Text to be placed above the select.
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Name attribute of the input element. This attribute will allow users
|
|
46
|
+
* to find the component's value during the submit event. In this event,
|
|
47
|
+
* the component's value will always be a regular string, for both single
|
|
48
|
+
* and multiple selection modes, been in the first one a single option
|
|
49
|
+
* value and in the multiple variant more than one option value,
|
|
50
|
+
* separated by commas.
|
|
51
|
+
*/
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* An array of objects representing the selectable options.
|
|
55
|
+
*/
|
|
56
|
+
options?: Option[] | OptionGroup[];
|
|
57
|
+
/**
|
|
58
|
+
* Helper text to be placed above the select.
|
|
59
|
+
*/
|
|
60
|
+
helperText?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Text to be put as placeholder of the select.
|
|
63
|
+
*/
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
/**
|
|
66
|
+
* If true, the component will be disabled.
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If true, the select will be optional, showing '(Optional)'
|
|
71
|
+
* next to the label and adding a default first option with an empty string as value,
|
|
72
|
+
* been the placeholder (if defined) its label. Otherwise, the field will be
|
|
73
|
+
* considered required and an error will be passed as a parameter to the
|
|
74
|
+
* OnBlur and onChange functions if an option wasn't selected.
|
|
75
|
+
*/
|
|
76
|
+
optional?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* If true, enables search functionality.
|
|
79
|
+
*/
|
|
80
|
+
searchable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* If it is defined, the component will change its appearance, showing
|
|
83
|
+
* the error below the select component. If it is not defined, the error
|
|
84
|
+
* messages will be managed internally, but never displayed on its own.
|
|
85
|
+
*/
|
|
86
|
+
error?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
89
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
90
|
+
*/
|
|
91
|
+
margin?: Space | Margin;
|
|
92
|
+
/**
|
|
93
|
+
* Size of the component.
|
|
94
|
+
*/
|
|
95
|
+
size?: "small" | "medium" | "large" | "fillParent";
|
|
96
|
+
/**
|
|
97
|
+
* Value of the tabindex attribute.
|
|
98
|
+
*/
|
|
99
|
+
tabIndex?: number;
|
|
100
|
+
};
|
|
101
|
+
declare type SingleSelect = CommonProps & {
|
|
102
|
+
/**
|
|
103
|
+
* If true, the select component will support multiple selected options.
|
|
104
|
+
* In that case, value will be an array of strings with each selected
|
|
105
|
+
* option value.
|
|
106
|
+
*/
|
|
107
|
+
multiple?: false;
|
|
108
|
+
/**
|
|
109
|
+
* Value of the select. If undefined, the component will be uncontrolled
|
|
110
|
+
* and the value will be managed internally by the component.
|
|
111
|
+
*/
|
|
112
|
+
value?: string;
|
|
113
|
+
/**
|
|
114
|
+
* This function will be called when the user selects an option.
|
|
115
|
+
* An object including the current value and the error (if the value entered is not valid)
|
|
116
|
+
* will be passed to this function. If there is no error, error will be null.
|
|
117
|
+
*/
|
|
118
|
+
onChange?: (val: {
|
|
119
|
+
value: string;
|
|
120
|
+
error: string;
|
|
121
|
+
}) => void;
|
|
122
|
+
/**
|
|
123
|
+
* This function will be called when the select loses the focus. An
|
|
124
|
+
* object including the value and the error (if the value
|
|
125
|
+
* selected is not valid) will be passed to this function. If there is no error,
|
|
126
|
+
* error will be null.
|
|
127
|
+
*/
|
|
128
|
+
onBlur?: (val: {
|
|
129
|
+
value: string;
|
|
130
|
+
error: string;
|
|
131
|
+
}) => void;
|
|
132
|
+
};
|
|
133
|
+
declare type MultipleSelect = CommonProps & {
|
|
134
|
+
/**
|
|
135
|
+
* If true, the select component will support multiple selected options.
|
|
136
|
+
* In that case, value will be an array of strings with each selected
|
|
137
|
+
* option value.
|
|
138
|
+
*/
|
|
139
|
+
multiple: true;
|
|
140
|
+
/**
|
|
141
|
+
* Value of the select. If undefined, the component will be uncontrolled
|
|
142
|
+
* and the value will be managed internally by the component.
|
|
143
|
+
*/
|
|
144
|
+
value?: string[];
|
|
145
|
+
/**
|
|
146
|
+
* This function will be called when the user selects an option.
|
|
147
|
+
* An object including the current selected values and the error (if the value entered is not valid)
|
|
148
|
+
* will be passed to this function. If there is no error, error will be null.
|
|
149
|
+
*/
|
|
150
|
+
onChange?: (val: {
|
|
151
|
+
value: string[];
|
|
152
|
+
error: string;
|
|
153
|
+
}) => void;
|
|
154
|
+
/**
|
|
155
|
+
* This function will be called when the select loses the focus. An
|
|
156
|
+
* object including the selected values and the error (if the value
|
|
157
|
+
* selected is not valid) will be passed to this function. If there is no error,
|
|
158
|
+
* error will be null.
|
|
159
|
+
*/
|
|
160
|
+
onBlur?: (val: {
|
|
161
|
+
value: string[];
|
|
162
|
+
error: string;
|
|
163
|
+
}) => void;
|
|
164
|
+
};
|
|
165
|
+
declare type Props = SingleSelect | MultipleSelect;
|
|
166
|
+
/**
|
|
167
|
+
* Reference to the component.
|
|
168
|
+
*/
|
|
169
|
+
export declare type RefType = HTMLDivElement;
|
|
170
|
+
export default Props;
|
package/select/types.js
ADDED
package/sidenav/Sidenav.js
CHANGED
|
@@ -17,9 +17,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
17
17
|
|
|
18
18
|
var _variables = require("../common/variables.js");
|
|
19
19
|
|
|
20
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
21
21
|
|
|
22
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
22
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
23
23
|
|
|
24
24
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
25
|
|
|
@@ -143,7 +143,24 @@ export const Chromatic = () => (
|
|
|
143
143
|
gravida enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare,
|
|
144
144
|
malesuada urna eu, fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam
|
|
145
145
|
sit amet maximus augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo.
|
|
146
|
-
Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus.
|
|
146
|
+
Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus. Lorem ipsum dolor sit amet,
|
|
147
|
+
consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna, placerat sit amet felis
|
|
148
|
+
eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec congue
|
|
149
|
+
laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus tincidunt. Vestibulum
|
|
150
|
+
cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus eros aliquam erat, ut
|
|
151
|
+
efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida enim. Donec rhoncus
|
|
152
|
+
aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu, fringilla mauris.
|
|
153
|
+
Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus augue. Vivamus erat
|
|
154
|
+
sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc dignissim, pharetra
|
|
155
|
+
neque molestie, molestie lectus.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas
|
|
156
|
+
luctus porttitor. Donec massa magna, placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum
|
|
157
|
+
dolor sit amet, consectetur adipiscing elit. Donec congue laoreet orci, nec elementum dolor consequat quis.
|
|
158
|
+
Curabitur rhoncus justo sed dapibus tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna
|
|
159
|
+
ullamcorper facilisis Jia Le, risus eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo,
|
|
160
|
+
dignissim sit amet dolor ut, congue gravida enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae.
|
|
161
|
+
Nunc sit amet elit ornare, malesuada urna eu, fringilla mauris. Vivamus bibendum turpis est, id elementum
|
|
162
|
+
purus euismod sit amet. Etiam sit amet maximus augue. Vivamus erat sapien, ultricies fringilla tellus id,
|
|
163
|
+
condimentum blandit justo. Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus.
|
|
147
164
|
</p>
|
|
148
165
|
</DxcSidenav>
|
|
149
166
|
</StyledContainer>
|
package/slider/Slider.js
CHANGED
|
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _utils = require("../common/utils.js");
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
34
|
var _uuid = require("uuid");
|
|
35
35
|
|
package/spinner/Spinner.js
CHANGED
|
@@ -19,9 +19,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
19
19
|
|
|
20
20
|
var _variables = require("../common/variables.js");
|
|
21
21
|
|
|
22
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
23
|
|
|
24
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
24
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
25
25
|
|
|
26
26
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
27
27
|
|
|
@@ -62,6 +62,7 @@ export const Chromatic = () => (
|
|
|
62
62
|
<DxcSpinner margin="xlarge" mode="small" value="75"></DxcSpinner>
|
|
63
63
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
64
64
|
<DxcSpinner margin="xxlarge" mode="small" value="75"></DxcSpinner>
|
|
65
|
+
<hr />
|
|
65
66
|
</ExampleContainer>
|
|
66
67
|
</>
|
|
67
68
|
);
|
package/stack/Stack.d.ts
ADDED
package/stack/Stack.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = Stack;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
|
+
|
|
18
|
+
function Stack(_ref) {
|
|
19
|
+
var gutter = _ref.gutter,
|
|
20
|
+
divider = _ref.divider,
|
|
21
|
+
align = _ref.align,
|
|
22
|
+
_ref$as = _ref.as,
|
|
23
|
+
as = _ref$as === void 0 ? "div" : _ref$as,
|
|
24
|
+
children = _ref.children;
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(StyledStack, {
|
|
26
|
+
gutter: gutter,
|
|
27
|
+
divider: divider,
|
|
28
|
+
align: align,
|
|
29
|
+
as: as
|
|
30
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
31
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var Divider = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n height: 1px;\n background-color: #999999;\n"])));
|
|
36
|
+
|
|
37
|
+
var StyledStack = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: ", ";\n gap: ", ";\n margin: 0;\n padding: 0;\n"])), function (_ref2) {
|
|
38
|
+
var align = _ref2.align;
|
|
39
|
+
|
|
40
|
+
switch (align) {
|
|
41
|
+
case "start":
|
|
42
|
+
return "flex-start";
|
|
43
|
+
|
|
44
|
+
case "center":
|
|
45
|
+
return "center";
|
|
46
|
+
|
|
47
|
+
case "end":
|
|
48
|
+
return "flex-end";
|
|
49
|
+
|
|
50
|
+
case "baseline":
|
|
51
|
+
return "baseline";
|
|
52
|
+
|
|
53
|
+
case "stretch":
|
|
54
|
+
return "stretch";
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
return "initial";
|
|
58
|
+
}
|
|
59
|
+
}, function (_ref3) {
|
|
60
|
+
var gutter = _ref3.gutter,
|
|
61
|
+
divider = _ref3.divider;
|
|
62
|
+
|
|
63
|
+
switch (gutter) {
|
|
64
|
+
case "none":
|
|
65
|
+
return "0";
|
|
66
|
+
|
|
67
|
+
case "xxxsmall":
|
|
68
|
+
return "calc(0.125rem / ".concat(divider ? 2 : 1, ")");
|
|
69
|
+
|
|
70
|
+
case "xxsmall":
|
|
71
|
+
return "calc(0.25rem / ".concat(divider ? 2 : 1, ")");
|
|
72
|
+
|
|
73
|
+
case "xsmall":
|
|
74
|
+
return "calc(0.5rem / ".concat(divider ? 2 : 1, ")");
|
|
75
|
+
|
|
76
|
+
case "small":
|
|
77
|
+
return "calc(1rem / ".concat(divider ? 2 : 1, ")");
|
|
78
|
+
|
|
79
|
+
case "medium":
|
|
80
|
+
return "calc(1.5rem / ".concat(divider ? 2 : 1, ")");
|
|
81
|
+
|
|
82
|
+
case "large":
|
|
83
|
+
return "calc(2rem / ".concat(divider ? 2 : 1, ")");
|
|
84
|
+
|
|
85
|
+
case "xlarge":
|
|
86
|
+
return "calc(3rem / ".concat(divider ? 2 : 1, ")");
|
|
87
|
+
|
|
88
|
+
case "xxlarge":
|
|
89
|
+
return "calc(4rem / ".concat(divider ? 2 : 1, ")");
|
|
90
|
+
|
|
91
|
+
case "xxxlarge":
|
|
92
|
+
return "calc(5rem / ".concat(divider ? 2 : 1, ")");
|
|
93
|
+
|
|
94
|
+
default:
|
|
95
|
+
return "0";
|
|
96
|
+
}
|
|
97
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcStack from "./Stack";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Stack",
|
|
8
|
+
component: DxcStack,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" theme="light" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcStack>
|
|
16
|
+
<Placeholder></Placeholder>
|
|
17
|
+
<Placeholder></Placeholder>
|
|
18
|
+
<Placeholder></Placeholder>
|
|
19
|
+
</DxcStack>
|
|
20
|
+
</Container>
|
|
21
|
+
<Title title="Align = baseline" theme="light" level={4} />
|
|
22
|
+
<Container>
|
|
23
|
+
<DxcStack align="baseline">
|
|
24
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
25
|
+
<Placeholder></Placeholder>
|
|
26
|
+
<Placeholder paddingRight={60}></Placeholder>
|
|
27
|
+
</DxcStack>
|
|
28
|
+
</Container>
|
|
29
|
+
<Title title="Align = center" theme="light" level={4} />
|
|
30
|
+
<Container>
|
|
31
|
+
<DxcStack align="center">
|
|
32
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
33
|
+
<Placeholder></Placeholder>
|
|
34
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
35
|
+
</DxcStack>
|
|
36
|
+
</Container>
|
|
37
|
+
<Title title="Align = end" theme="light" level={4} />
|
|
38
|
+
<Container>
|
|
39
|
+
<DxcStack align="end">
|
|
40
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
41
|
+
<Placeholder></Placeholder>
|
|
42
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
43
|
+
</DxcStack>
|
|
44
|
+
</Container>
|
|
45
|
+
<Title title="Align = start" theme="light" level={4} />
|
|
46
|
+
<Container>
|
|
47
|
+
<DxcStack align="start">
|
|
48
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
49
|
+
<Placeholder></Placeholder>
|
|
50
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
51
|
+
</DxcStack>
|
|
52
|
+
</Container>
|
|
53
|
+
<Title title="Align = stretch" theme="light" level={4} />
|
|
54
|
+
<Container>
|
|
55
|
+
<DxcStack align="stretch">
|
|
56
|
+
<Placeholder paddingLeft={20}></Placeholder>
|
|
57
|
+
<Placeholder></Placeholder>
|
|
58
|
+
<Placeholder paddingLeft={60}></Placeholder>
|
|
59
|
+
</DxcStack>
|
|
60
|
+
</Container>
|
|
61
|
+
<Title title="gutter = xxxsmall" theme="light" level={4} />
|
|
62
|
+
<Container>
|
|
63
|
+
<DxcStack gutter="xxxsmall">
|
|
64
|
+
<Placeholder></Placeholder>
|
|
65
|
+
<Placeholder></Placeholder>
|
|
66
|
+
<Placeholder></Placeholder>
|
|
67
|
+
</DxcStack>
|
|
68
|
+
</Container>
|
|
69
|
+
<Title title="gutter = xxsmall" theme="light" level={4} />
|
|
70
|
+
<Container>
|
|
71
|
+
<DxcStack gutter="xxsmall">
|
|
72
|
+
<Placeholder></Placeholder>
|
|
73
|
+
<Placeholder></Placeholder>
|
|
74
|
+
<Placeholder></Placeholder>
|
|
75
|
+
</DxcStack>
|
|
76
|
+
</Container>
|
|
77
|
+
<Title title="gutter = xsmall" theme="light" level={4} />
|
|
78
|
+
<Container>
|
|
79
|
+
<DxcStack gutter="xsmall">
|
|
80
|
+
<Placeholder></Placeholder>
|
|
81
|
+
<Placeholder></Placeholder>
|
|
82
|
+
<Placeholder></Placeholder>
|
|
83
|
+
</DxcStack>
|
|
84
|
+
</Container>
|
|
85
|
+
<Title title="gutter = small" theme="light" level={4} />
|
|
86
|
+
<Container>
|
|
87
|
+
<DxcStack gutter="small">
|
|
88
|
+
<Placeholder></Placeholder>
|
|
89
|
+
<Placeholder></Placeholder>
|
|
90
|
+
<Placeholder></Placeholder>
|
|
91
|
+
</DxcStack>
|
|
92
|
+
</Container>
|
|
93
|
+
<Title title="gutter = medium" theme="light" level={4} />
|
|
94
|
+
<Container>
|
|
95
|
+
<DxcStack gutter="medium">
|
|
96
|
+
<Placeholder></Placeholder>
|
|
97
|
+
<Placeholder></Placeholder>
|
|
98
|
+
<Placeholder></Placeholder>
|
|
99
|
+
</DxcStack>
|
|
100
|
+
</Container>
|
|
101
|
+
<Title title="gutter = large" theme="light" level={4} />
|
|
102
|
+
<Container>
|
|
103
|
+
<DxcStack gutter="large">
|
|
104
|
+
<Placeholder></Placeholder>
|
|
105
|
+
<Placeholder></Placeholder>
|
|
106
|
+
<Placeholder></Placeholder>
|
|
107
|
+
</DxcStack>
|
|
108
|
+
</Container>
|
|
109
|
+
<Title title="gutter = xlarge" theme="light" level={4} />
|
|
110
|
+
<Container>
|
|
111
|
+
<DxcStack gutter="xlarge">
|
|
112
|
+
<Placeholder></Placeholder>
|
|
113
|
+
<Placeholder></Placeholder>
|
|
114
|
+
<Placeholder></Placeholder>
|
|
115
|
+
</DxcStack>
|
|
116
|
+
</Container>
|
|
117
|
+
<Title title="gutter = xxlarge" theme="light" level={4} />
|
|
118
|
+
<Container>
|
|
119
|
+
<DxcStack gutter="xxlarge">
|
|
120
|
+
<Placeholder></Placeholder>
|
|
121
|
+
<Placeholder></Placeholder>
|
|
122
|
+
<Placeholder></Placeholder>
|
|
123
|
+
</DxcStack>
|
|
124
|
+
</Container>
|
|
125
|
+
<Title title="gutter = xxxlarge" theme="light" level={4} />
|
|
126
|
+
<Container>
|
|
127
|
+
<DxcStack gutter="xxxlarge">
|
|
128
|
+
<Placeholder></Placeholder>
|
|
129
|
+
<Placeholder></Placeholder>
|
|
130
|
+
<Placeholder></Placeholder>
|
|
131
|
+
</DxcStack>
|
|
132
|
+
</Container>
|
|
133
|
+
<Title title="gutter = xxlarge && divider" theme="light" level={4} />
|
|
134
|
+
<Container>
|
|
135
|
+
<DxcStack gutter="xxlarge" divider>
|
|
136
|
+
<Placeholder></Placeholder>
|
|
137
|
+
<Placeholder></Placeholder>
|
|
138
|
+
<Placeholder></Placeholder>
|
|
139
|
+
</DxcStack>
|
|
140
|
+
</Container>
|
|
141
|
+
<Title title="gutter = none" theme="light" level={4} />
|
|
142
|
+
<Container>
|
|
143
|
+
<DxcStack gutter="none">
|
|
144
|
+
<Placeholder></Placeholder>
|
|
145
|
+
<Placeholder></Placeholder>
|
|
146
|
+
<Placeholder></Placeholder>
|
|
147
|
+
</DxcStack>
|
|
148
|
+
</Container>
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const Container = styled.div`
|
|
153
|
+
background: #f2eafa;
|
|
154
|
+
padding: 10px;
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
const Placeholder = styled.div`
|
|
158
|
+
min-height: 40px;
|
|
159
|
+
min-width: 120px;
|
|
160
|
+
border: 1px solid #a46ede;
|
|
161
|
+
background-color: #e5d5f6;
|
|
162
|
+
padding-left: ${({ paddingLeft }) => `${paddingLeft ?? 0}px`};
|
|
163
|
+
padding-right: ${({ paddingRight }) => `${paddingRight ?? 0}px`};
|
|
164
|
+
`;
|
package/stack/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
4
|
+
divider?: boolean;
|
|
5
|
+
align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
6
|
+
as?: React.ElementType;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export default Props;
|
package/stack/types.js
ADDED
package/switch/Switch.js
CHANGED
|
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _utils = require("../common/utils.js");
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
34
|
var _templateObject, _templateObject2;
|
|
35
35
|
|
|
@@ -72,7 +72,7 @@ export const Chromatic = () => (
|
|
|
72
72
|
<Title title="Margins" theme="light" level={2} />
|
|
73
73
|
<ExampleContainer>
|
|
74
74
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
75
|
-
<DxcSwitch label="
|
|
75
|
+
<DxcSwitch label="Xxsmall" margin="xxsmall" />
|
|
76
76
|
</ExampleContainer>
|
|
77
77
|
<ExampleContainer>
|
|
78
78
|
<Title title="Xsmall margin" theme="light" level={4} />
|
package/table/Table.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;
|
|
29
29
|
|
package/table/Table.stories.jsx
CHANGED
package/tabs/Tabs.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -27,7 +27,7 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
32
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
33
33
|
|
|
@@ -70,12 +70,12 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
70
70
|
}, /*#__PURE__*/_react["default"].createElement(TabLabelContainer, {
|
|
71
71
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
72
72
|
iconPosition: iconPosition
|
|
73
|
-
}, tab.icon
|
|
73
|
+
}, tab.icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
74
74
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
75
75
|
iconPosition: iconPosition
|
|
76
|
-
},
|
|
77
|
-
src: tab.
|
|
78
|
-
}), /*#__PURE__*/_react["default"].createElement(LabelTextContainer, null, tab.label))), tab.notificationNumber && tab.notificationNumber !== false && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
|
|
76
|
+
}, typeof tab.icon === "string" ? /*#__PURE__*/_react["default"].createElement(TabIcon, {
|
|
77
|
+
src: tab.icon
|
|
78
|
+
}) : tab.icon), /*#__PURE__*/_react["default"].createElement(LabelTextContainer, null, tab.label))), tab.notificationNumber && tab.notificationNumber !== false && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
|
|
79
79
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
80
80
|
iconPosition: iconPosition
|
|
81
81
|
}, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
@@ -201,7 +201,7 @@ var DxCTabs = _styledComponents["default"].div(_templateObject7 || (_templateObj
|
|
|
201
201
|
return props.theme.scrollButtonsWidth;
|
|
202
202
|
});
|
|
203
203
|
|
|
204
|
-
var TabIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["
|
|
204
|
+
var TabIcon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
205
205
|
|
|
206
206
|
var TabIconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 22px;\n max-width: 22px;\n margin-bottom: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n align-items: center;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
207
207
|
return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
|