@dxc-technology/halstack-react 0.0.0-0e90110 → 0.0.0-1021ecf
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.js +0 -1
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.js +4 -4
- package/chip/types.d.ts +2 -2
- package/common/variables.js +55 -21
- package/date-input/DateInput.js +9 -12
- package/dialog/Dialog.js +2 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +147 -68
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +2 -2
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +10 -16
- 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 +5 -9
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.stories.tsx +3 -2
- package/layout/ApplicationLayout.js +2 -1
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/list/List.d.ts +8 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/main.d.ts +5 -1
- package/main.js +32 -0
- package/number-input/NumberInput.js +3 -6
- package/package.json +4 -2
- package/paginator/Paginator.js +0 -6
- package/password-input/PasswordInput.js +12 -13
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +130 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +268 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.js +1 -1
- package/resultsetTable/ResultsetTable.stories.tsx +277 -0
- package/resultsetTable/types.d.ts +1 -1
- package/row/Row.d.ts +11 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +239 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +19 -21
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +166 -0
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.stories.tsx +1 -0
- package/tag/Tag.stories.tsx +1 -1
- 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 +26 -20
- package/text-input/TextInput.stories.tsx +4 -4
- package/text-input/types.d.ts +1 -1
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +14 -46
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.js +12 -15
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +38 -25
- package/wizard/Wizard.js +58 -8
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +2 -6
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -127
- package/wizard/Icons.js +0 -65
package/select/Select.js
CHANGED
|
@@ -153,7 +153,7 @@ var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, s
|
|
|
153
153
|
|
|
154
154
|
var getSelectedOption = function getSelectedOption(options, multiple, optional, optionalEmptyOption, value, innerValue) {
|
|
155
155
|
var val = value !== null && value !== void 0 ? value : innerValue;
|
|
156
|
-
var selectedOption = multiple ? [] :
|
|
156
|
+
var selectedOption = multiple ? [] : {};
|
|
157
157
|
var singleSelectionIndex;
|
|
158
158
|
|
|
159
159
|
if (multiple) {
|
|
@@ -201,14 +201,12 @@ var getSelectedOption = function getSelectedOption(options, multiple, optional,
|
|
|
201
201
|
var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
202
202
|
var _selectedOption$label;
|
|
203
203
|
|
|
204
|
-
var
|
|
205
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
204
|
+
var label = _ref.label,
|
|
206
205
|
_ref$name = _ref.name,
|
|
207
206
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
208
207
|
value = _ref.value,
|
|
209
208
|
options = _ref.options,
|
|
210
|
-
|
|
211
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
209
|
+
helperText = _ref.helperText,
|
|
212
210
|
_ref$placeholder = _ref.placeholder,
|
|
213
211
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
214
212
|
_ref$disabled = _ref.disabled,
|
|
@@ -221,8 +219,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
221
219
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
222
220
|
onChange = _ref.onChange,
|
|
223
221
|
onBlur = _ref.onBlur,
|
|
224
|
-
|
|
225
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
222
|
+
error = _ref.error,
|
|
226
223
|
margin = _ref.margin,
|
|
227
224
|
_ref$size = _ref.size,
|
|
228
225
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
@@ -549,13 +546,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
549
546
|
margin: margin,
|
|
550
547
|
size: size,
|
|
551
548
|
ref: ref
|
|
552
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
549
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
553
550
|
id: selectLabelId,
|
|
554
551
|
disabled: disabled,
|
|
555
552
|
onClick: function onClick() {
|
|
556
553
|
selectContainerRef.current.focus();
|
|
557
|
-
}
|
|
558
|
-
|
|
554
|
+
},
|
|
555
|
+
helperText: helperText
|
|
556
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
559
557
|
disabled: disabled
|
|
560
558
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Select, {
|
|
561
559
|
id: selectId,
|
|
@@ -585,8 +583,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
585
583
|
},
|
|
586
584
|
onClick: handleClearOptionsActionOnClick,
|
|
587
585
|
tabIndex: -1,
|
|
588
|
-
title: "Clear
|
|
589
|
-
"aria-label": "Clear
|
|
586
|
+
title: "Clear selection",
|
|
587
|
+
"aria-label": "Clear selection"
|
|
590
588
|
}, selectIcons.clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
591
589
|
name: name,
|
|
592
590
|
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
|
|
@@ -615,8 +613,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
615
613
|
},
|
|
616
614
|
onClick: handleClearSearchActionOnClick,
|
|
617
615
|
tabIndex: -1,
|
|
618
|
-
title: "Clear search
|
|
619
|
-
"aria-label": "Clear search
|
|
616
|
+
title: "Clear search",
|
|
617
|
+
"aria-label": "Clear search"
|
|
620
618
|
}, selectIcons.clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
621
619
|
disabled: disabled
|
|
622
620
|
}, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, {
|
|
@@ -633,7 +631,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
633
631
|
}, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional && !multiple && /*#__PURE__*/_react["default"].createElement(Option, {
|
|
634
632
|
option: optionalEmptyOption,
|
|
635
633
|
index: 0
|
|
636
|
-
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
|
|
634
|
+
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
|
|
637
635
|
});
|
|
638
636
|
|
|
639
637
|
var sizes = {
|
|
@@ -661,7 +659,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
661
659
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
662
660
|
});
|
|
663
661
|
|
|
664
|
-
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n"])), function (props) {
|
|
662
|
+
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
|
|
665
663
|
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
666
664
|
}, function (props) {
|
|
667
665
|
return props.theme.fontFamily;
|
|
@@ -673,13 +671,15 @@ var Label = _styledComponents["default"].span(_templateObject2 || (_templateObje
|
|
|
673
671
|
return props.theme.labelFontWeight;
|
|
674
672
|
}, function (props) {
|
|
675
673
|
return props.theme.labelLineHeight;
|
|
674
|
+
}, function (props) {
|
|
675
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
676
676
|
});
|
|
677
677
|
|
|
678
678
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
679
679
|
return props.theme.optionalLabelFontWeight;
|
|
680
680
|
});
|
|
681
681
|
|
|
682
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
682
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
683
683
|
return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
|
|
684
684
|
}, function (props) {
|
|
685
685
|
return props.theme.fontFamily;
|
|
@@ -693,9 +693,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
693
693
|
return props.theme.helperTextLineHeight;
|
|
694
694
|
});
|
|
695
695
|
|
|
696
|
-
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n
|
|
697
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
698
|
-
}, function (props) {
|
|
696
|
+
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n outline: none;\n ", ";\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
699
697
|
return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
|
|
700
698
|
}, function (props) {
|
|
701
699
|
return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
|
|
@@ -773,7 +771,7 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject13 || (_templat
|
|
|
773
771
|
return props.theme.errorIconColor;
|
|
774
772
|
});
|
|
775
773
|
|
|
776
|
-
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n"])), function (props) {
|
|
774
|
+
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
777
775
|
return props.theme.errorMessageColor;
|
|
778
776
|
}, function (props) {
|
|
779
777
|
return props.theme.fontFamily;
|
|
@@ -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
|
@@ -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>
|
|
@@ -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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type StackProps = {
|
|
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 function Stack({ gutter, divider, align, as, children }: StackProps): JSX.Element;
|
|
10
|
+
export {};
|
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,166 @@
|
|
|
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: #d0d0d0;
|
|
154
|
+
padding: 10px;
|
|
155
|
+
border-radius: 10px;
|
|
156
|
+
`;
|
|
157
|
+
|
|
158
|
+
const Placeholder = styled.div`
|
|
159
|
+
min-height: 80px;
|
|
160
|
+
min-width: 120px;
|
|
161
|
+
border: 1px solid #fabada;
|
|
162
|
+
background-color: #fff7fb;
|
|
163
|
+
border-radius: 5px;
|
|
164
|
+
padding-left: ${({ paddingLeft }) => `${paddingLeft ?? 0}px`};
|
|
165
|
+
padding-right: ${({ paddingRight }) => `${paddingRight ?? 0}px`};
|
|
166
|
+
`;
|
|
@@ -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.stories.jsx
CHANGED
package/tabs/Tabs.stories.tsx
CHANGED
package/tag/Tag.stories.tsx
CHANGED
|
@@ -132,7 +132,7 @@ export const Chromatic = () => (
|
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
const LinkTag = () => (
|
|
135
|
-
<ExampleContainer>
|
|
135
|
+
<ExampleContainer expanded>
|
|
136
136
|
<Title title="Hover link tag" theme="light" level={4} />
|
|
137
137
|
<DxcTag label="Tag" icon={icon} linkHref="https://www.dxc.com" />
|
|
138
138
|
</ExampleContainer>
|