@telus-uds/components-web 2.12.0 → 2.14.0
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/CHANGELOG.md +40 -2
- package/component-docs.json +105 -43
- package/lib/Autocomplete/Loading.js +5 -10
- package/lib/Autocomplete/dictionary.js +2 -2
- package/lib/Badge/Badge.js +10 -1
- package/lib/DatePicker/DatePicker.js +13 -0
- package/lib/NavigationBar/NavigationSubMenu.js +4 -8
- package/lib/QuantitySelector/QuantitySelector.js +67 -66
- package/lib/QuantitySelector/SideButton.js +93 -0
- package/lib/QuantitySelector/styles.js +4 -20
- package/lib/Spinner/Spinner.js +10 -1
- package/lib/Spinner/SpinnerContent.js +8 -0
- package/lib/Table/Cell.js +62 -91
- package/lib/Table/Header.js +4 -1
- package/lib/Table/SubHeading.js +4 -1
- package/lib/Table/Table.js +2 -1
- package/lib/TermsAndConditions/ExpandCollapse.js +31 -13
- package/lib/TermsAndConditions/TermsAndConditions.js +42 -10
- package/lib/Testimonial/Testimonial.js +48 -12
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +103 -60
- package/lib/VideoPicker/VideoSlider.js +2 -2
- package/lib-module/Autocomplete/Loading.js +6 -12
- package/lib-module/Autocomplete/dictionary.js +2 -2
- package/lib-module/Badge/Badge.js +10 -1
- package/lib-module/DatePicker/DatePicker.js +13 -1
- package/lib-module/NavigationBar/NavigationSubMenu.js +5 -9
- package/lib-module/QuantitySelector/QuantitySelector.js +68 -67
- package/lib-module/QuantitySelector/SideButton.js +80 -0
- package/lib-module/QuantitySelector/styles.js +3 -15
- package/lib-module/Spinner/Spinner.js +10 -1
- package/lib-module/Spinner/SpinnerContent.js +8 -0
- package/lib-module/Table/Cell.js +65 -90
- package/lib-module/Table/Header.js +4 -1
- package/lib-module/Table/SubHeading.js +4 -1
- package/lib-module/Table/Table.js +2 -1
- package/lib-module/TermsAndConditions/ExpandCollapse.js +33 -15
- package/lib-module/TermsAndConditions/TermsAndConditions.js +42 -11
- package/lib-module/Testimonial/Testimonial.js +49 -13
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +103 -61
- package/lib-module/VideoPicker/VideoSlider.js +2 -2
- package/package.json +4 -4
- package/src/Autocomplete/Loading.jsx +2 -5
- package/src/Autocomplete/dictionary.js +2 -2
- package/src/Badge/Badge.jsx +14 -2
- package/src/DatePicker/DatePicker.jsx +14 -1
- package/src/NavigationBar/NavigationSubMenu.jsx +3 -4
- package/src/QuantitySelector/QuantitySelector.jsx +60 -76
- package/src/QuantitySelector/SideButton.jsx +74 -0
- package/src/QuantitySelector/styles.js +4 -70
- package/src/Spinner/Spinner.jsx +9 -1
- package/src/Spinner/SpinnerContent.jsx +13 -1
- package/src/Table/Cell.jsx +58 -78
- package/src/Table/Header.jsx +6 -1
- package/src/Table/SubHeading.jsx +4 -1
- package/src/Table/Table.jsx +10 -2
- package/src/TermsAndConditions/ExpandCollapse.jsx +36 -14
- package/src/TermsAndConditions/TermsAndConditions.jsx +48 -10
- package/src/Testimonial/Testimonial.jsx +73 -11
- package/src/VideoPicker/VideoPickerPlayer.jsx +2 -2
- package/src/VideoPicker/VideoPickerThumbnail.jsx +51 -30
- package/src/VideoPicker/VideoSlider.jsx +2 -2
- package/types/BaseProvider.d.ts +25 -0
- package/types/index.d.ts +1 -1
|
@@ -11,12 +11,12 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _componentsBase = require("@telus-uds/components-base");
|
|
13
13
|
|
|
14
|
-
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
15
|
-
|
|
16
14
|
var _styles = require("./styles");
|
|
17
15
|
|
|
18
16
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
19
17
|
|
|
18
|
+
var _SideButton = _interopRequireDefault(require("./SideButton"));
|
|
19
|
+
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -39,6 +39,7 @@ const QuantitySelector = _ref => {
|
|
|
39
39
|
minNumber,
|
|
40
40
|
maxNumber,
|
|
41
41
|
defaultValue,
|
|
42
|
+
value,
|
|
42
43
|
label,
|
|
43
44
|
hint,
|
|
44
45
|
hintPosition,
|
|
@@ -52,19 +53,9 @@ const QuantitySelector = _ref => {
|
|
|
52
53
|
testID
|
|
53
54
|
} = _ref;
|
|
54
55
|
const {
|
|
55
|
-
|
|
56
|
-
QuantitySelector: componentTheme
|
|
57
|
-
}
|
|
58
|
-
} = (0, _componentsBase.useTheme)();
|
|
59
|
-
const {
|
|
60
|
-
leftIcon,
|
|
61
|
-
rightIcon,
|
|
62
|
-
padding
|
|
63
|
-
} = (0, _componentsBase.useThemeTokens)('QuantitySelector', tokens, variant);
|
|
64
|
-
const [error, setError] = (0, _react.useState)('');
|
|
65
|
-
const {
|
|
66
|
-
alternative
|
|
56
|
+
disabled
|
|
67
57
|
} = variant;
|
|
58
|
+
const [error, setError] = (0, _react.useState)('');
|
|
68
59
|
const getCopy = (0, _componentsBase.useCopy)({
|
|
69
60
|
dictionary,
|
|
70
61
|
copy
|
|
@@ -77,17 +68,16 @@ const QuantitySelector = _ref => {
|
|
|
77
68
|
return numberToEvaluate;
|
|
78
69
|
};
|
|
79
70
|
|
|
80
|
-
const initialValue = getValidatedNumber(defaultValue);
|
|
81
71
|
const {
|
|
82
72
|
currentValue: number,
|
|
83
73
|
setValue: setNumber
|
|
84
74
|
} = (0, _componentsBase.useInputValue)({
|
|
85
|
-
value:
|
|
86
|
-
initialValue,
|
|
75
|
+
value: getValidatedNumber(value),
|
|
76
|
+
initialValue: getValidatedNumber(defaultValue),
|
|
87
77
|
onChange
|
|
88
78
|
});
|
|
89
|
-
const isDecreaseEnabled = !isNumber(minNumber) || number > minNumber;
|
|
90
|
-
const isIncreaseEnabled = !isNumber(maxNumber) || number < maxNumber;
|
|
79
|
+
const isDecreaseEnabled = !disabled && !isNumber(minNumber) || number > minNumber;
|
|
80
|
+
const isIncreaseEnabled = !disabled && !isNumber(maxNumber) || number < maxNumber;
|
|
91
81
|
const inputValue = isNumber(number) ? number.toString() : '';
|
|
92
82
|
|
|
93
83
|
const updateNumber = (newNumber, originalInputEvent) => {
|
|
@@ -119,20 +109,31 @@ const QuantitySelector = _ref => {
|
|
|
119
109
|
tooltip: tooltip
|
|
120
110
|
}) : null;
|
|
121
111
|
|
|
112
|
+
const getTokens = (0, _componentsBase.useThemeTokensCallback)('QuantitySelector', tokens, variant);
|
|
113
|
+
|
|
122
114
|
const renderTextInput = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.TextInput, {
|
|
123
115
|
nativeID: id,
|
|
124
116
|
value: inputValue,
|
|
117
|
+
defaultValue: defaultValue,
|
|
125
118
|
tokens: textInputState => {
|
|
126
119
|
const {
|
|
120
|
+
inputWidth,
|
|
121
|
+
inputBorderWidth,
|
|
127
122
|
inputBorderColor,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
textColor,
|
|
124
|
+
inputBackgroundColor,
|
|
125
|
+
...rest
|
|
126
|
+
} = getTokens({ ...textInputState
|
|
127
|
+
});
|
|
128
|
+
return { ...rest,
|
|
129
|
+
order: 1,
|
|
130
|
+
borderWidth: inputBorderWidth,
|
|
131
|
+
backgroundColor: inputBackgroundColor,
|
|
132
|
+
color: textColor,
|
|
133
|
+
width: inputWidth,
|
|
134
134
|
borderColor: inputBorderColor,
|
|
135
|
-
|
|
135
|
+
borderRadius: 0,
|
|
136
|
+
outerBorderWidth: 0
|
|
136
137
|
};
|
|
137
138
|
},
|
|
138
139
|
onChange: inputChangeHandler // Using title as an accessibility workaround
|
|
@@ -146,38 +147,6 @@ const QuantitySelector = _ref => {
|
|
|
146
147
|
accessibilityValueNow: number
|
|
147
148
|
});
|
|
148
149
|
|
|
149
|
-
const getButtonTokens = isEnabled => buttonState => {
|
|
150
|
-
const disabled = !isEnabled;
|
|
151
|
-
const { ...buttonTokens
|
|
152
|
-
} = (0, _componentsBase.getThemeTokens)(componentTheme, tokens, variant, { ...buttonState,
|
|
153
|
-
disabled
|
|
154
|
-
});
|
|
155
|
-
return { ...buttonTokens,
|
|
156
|
-
outerBorderGap: 0,
|
|
157
|
-
padding
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const renderLeftButton = () => {
|
|
162
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
163
|
-
icon: leftIcon,
|
|
164
|
-
tokens: getButtonTokens(isDecreaseEnabled),
|
|
165
|
-
onPress: event => updateNumber(number - 1, event),
|
|
166
|
-
onDoubleClick: event => updateNumber(number - 1, event),
|
|
167
|
-
accessibilityLabel: getCopy('accessibility').decreaseButton,
|
|
168
|
-
accessibilityDisabled: !isDecreaseEnabled
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const renderRightButton = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
173
|
-
icon: rightIcon,
|
|
174
|
-
tokens: getButtonTokens(isIncreaseEnabled),
|
|
175
|
-
onPress: () => updateNumber(number + 1),
|
|
176
|
-
onDoubleClick: () => updateNumber(number + 1),
|
|
177
|
-
accessibilityLabel: getCopy('accessibility').increaseButton,
|
|
178
|
-
accessibilityDisabled: !isIncreaseEnabled
|
|
179
|
-
});
|
|
180
|
-
|
|
181
150
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
|
|
182
151
|
space: 2,
|
|
183
152
|
testID: testID,
|
|
@@ -185,14 +154,39 @@ const QuantitySelector = _ref => {
|
|
|
185
154
|
space: 2
|
|
186
155
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputWrapper, {
|
|
187
156
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputField, {
|
|
188
|
-
className: `${alternative ? 'alternative' : ''}`,
|
|
189
157
|
children: renderTextInput()
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
158
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
159
|
+
style: {
|
|
160
|
+
order: 0
|
|
161
|
+
},
|
|
162
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SideButton.default, {
|
|
163
|
+
isEnabled: isDecreaseEnabled,
|
|
164
|
+
onPress: () => updateNumber(number - 1),
|
|
165
|
+
onDoubleClick: () => updateNumber(number - 1),
|
|
166
|
+
tokens: tokens,
|
|
167
|
+
variant: {
|
|
168
|
+
decrease: true,
|
|
169
|
+
...variant
|
|
170
|
+
},
|
|
171
|
+
accessibilityLabel: getCopy('accessibility').decreaseButton,
|
|
172
|
+
accessibilityDisabled: !isDecreaseEnabled
|
|
173
|
+
})
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
175
|
+
style: {
|
|
176
|
+
order: 2
|
|
177
|
+
},
|
|
178
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SideButton.default, {
|
|
179
|
+
isEnabled: isIncreaseEnabled,
|
|
180
|
+
onPress: () => updateNumber(number + 1),
|
|
181
|
+
onDoubleClick: () => updateNumber(number + 1),
|
|
182
|
+
accessibilityLabel: getCopy('accessibility').increaseButton,
|
|
183
|
+
accessibilityDisabled: !isIncreaseEnabled,
|
|
184
|
+
tokens: tokens,
|
|
185
|
+
variant: {
|
|
186
|
+
increase: true,
|
|
187
|
+
...variant
|
|
188
|
+
}
|
|
189
|
+
})
|
|
196
190
|
})]
|
|
197
191
|
}), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Box, {
|
|
198
192
|
vertical: 2,
|
|
@@ -244,6 +238,12 @@ QuantitySelector.propTypes = {
|
|
|
244
238
|
*/
|
|
245
239
|
defaultValue: _propTypes.default.number,
|
|
246
240
|
|
|
241
|
+
/**
|
|
242
|
+
* If the input's state is to be controlled by a parent component, use this prop
|
|
243
|
+
* together with the `onChange` to pass down and update the lifted state.
|
|
244
|
+
*/
|
|
245
|
+
value: _propTypes.default.number,
|
|
246
|
+
|
|
247
247
|
/**
|
|
248
248
|
* The label of the input field
|
|
249
249
|
*/
|
|
@@ -282,7 +282,8 @@ QuantitySelector.propTypes = {
|
|
|
282
282
|
*/
|
|
283
283
|
copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr'])]),
|
|
284
284
|
variant: _propTypes.default.exact({
|
|
285
|
-
alternative: _propTypes.default.bool
|
|
285
|
+
alternative: _propTypes.default.bool,
|
|
286
|
+
disabled: _propTypes.default.bool
|
|
286
287
|
}),
|
|
287
288
|
tokens: _propTypes.default.oneOf([_propTypes.default.object, _propTypes.default.func]),
|
|
288
289
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const SideButton = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
isEnabled,
|
|
21
|
+
onPress,
|
|
22
|
+
onDoubleClick,
|
|
23
|
+
accessibilityLabel,
|
|
24
|
+
accessibilityDisabled,
|
|
25
|
+
tokens,
|
|
26
|
+
variant
|
|
27
|
+
} = _ref;
|
|
28
|
+
const getTokens = (0, _componentsBase.useThemeTokensCallback)('QuantitySelectorSideButton', tokens, variant);
|
|
29
|
+
|
|
30
|
+
const getButtonTokens = _ref2 => {
|
|
31
|
+
let {
|
|
32
|
+
buttonState,
|
|
33
|
+
disabled
|
|
34
|
+
} = _ref2;
|
|
35
|
+
const {
|
|
36
|
+
borderRadius,
|
|
37
|
+
borderTopLeftRadius,
|
|
38
|
+
borderTopRightRadius,
|
|
39
|
+
borderBottomLeftRadius,
|
|
40
|
+
borderBottomRightRadius,
|
|
41
|
+
...rest
|
|
42
|
+
} = getTokens({ ...buttonState,
|
|
43
|
+
disabled
|
|
44
|
+
});
|
|
45
|
+
return { ...rest,
|
|
46
|
+
borderRadius,
|
|
47
|
+
borderTopLeftRadius,
|
|
48
|
+
borderTopRightRadius,
|
|
49
|
+
borderBottomLeftRadius,
|
|
50
|
+
borderBottomRightRadius,
|
|
51
|
+
outerBorderRadius: borderRadius,
|
|
52
|
+
outerBorderTopLeftRadius: borderTopLeftRadius,
|
|
53
|
+
outerBorderTopRightRadius: borderTopRightRadius,
|
|
54
|
+
outerBorderBottomLeftRadius: borderBottomLeftRadius,
|
|
55
|
+
outerBorderBottomRightRadius: borderBottomRightRadius,
|
|
56
|
+
outerBorderGap: 0,
|
|
57
|
+
outerBorderWidth: 0
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
|
|
62
|
+
tokens: buttonState => getButtonTokens({
|
|
63
|
+
disabled: !isEnabled,
|
|
64
|
+
buttonState
|
|
65
|
+
}),
|
|
66
|
+
onPress: onPress,
|
|
67
|
+
onDoubleClick: onDoubleClick,
|
|
68
|
+
accessibilityLabel: accessibilityLabel,
|
|
69
|
+
accessibilityDisabled: accessibilityDisabled
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
SideButton.displayName = 'QuantitySelectorSideButton';
|
|
74
|
+
SideButton.defaultProps = {
|
|
75
|
+
isEnabled: true,
|
|
76
|
+
onPress: () => {},
|
|
77
|
+
onDoubleClick: () => {},
|
|
78
|
+
accessibilityLabel: '',
|
|
79
|
+
accessibilityDisabled: false,
|
|
80
|
+
tokens: {},
|
|
81
|
+
variant: {}
|
|
82
|
+
};
|
|
83
|
+
SideButton.propTypes = {
|
|
84
|
+
isEnabled: _propTypes.default.bool,
|
|
85
|
+
onPress: _propTypes.default.func,
|
|
86
|
+
onDoubleClick: _propTypes.default.func,
|
|
87
|
+
accessibilityLabel: _propTypes.default.string,
|
|
88
|
+
accessibilityDisabled: _propTypes.default.bool,
|
|
89
|
+
tokens: _propTypes.default.object,
|
|
90
|
+
variant: _propTypes.default.object
|
|
91
|
+
};
|
|
92
|
+
var _default = SideButton;
|
|
93
|
+
exports.default = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.InputWrapper = exports.InputField = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
|
@@ -12,29 +12,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
const InputField = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
13
13
|
displayName: "styles__InputField",
|
|
14
14
|
componentId: "components-web__sc-1lrz1xk-0"
|
|
15
|
-
})(["order:
|
|
15
|
+
})(["order:1;text-align:center;z-index:10;input{text-align:center;}"]);
|
|
16
16
|
|
|
17
17
|
exports.InputField = InputField;
|
|
18
18
|
|
|
19
|
-
const ButtonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
20
|
-
displayName: "styles__ButtonWrapper",
|
|
21
|
-
componentId: "components-web__sc-1lrz1xk-1"
|
|
22
|
-
})(["&.alternative{div[role='button']{height:42px;> div{height:40px;> div{padding:12px 16px;}}}}"]);
|
|
23
|
-
|
|
24
|
-
const LeftButtonWrapper = /*#__PURE__*/(0, _styledComponents.default)(ButtonWrapper).withConfig({
|
|
25
|
-
displayName: "styles__LeftButtonWrapper",
|
|
26
|
-
componentId: "components-web__sc-1lrz1xk-2"
|
|
27
|
-
})(["order:0;div[role='button']{border-radius:4px 0px 0px 4px !important;> div{border-right:none;border-radius:4px 0px 0px 4px !important;}}&.alternative{div[role='button']{border-radius:36px 0px 0px 36px !important;> div{border-radius:24px 0px 0px 24px !important;}}}"]);
|
|
28
|
-
exports.LeftButtonWrapper = LeftButtonWrapper;
|
|
29
|
-
const RightButtonWrapper = /*#__PURE__*/(0, _styledComponents.default)(ButtonWrapper).withConfig({
|
|
30
|
-
displayName: "styles__RightButtonWrapper",
|
|
31
|
-
componentId: "components-web__sc-1lrz1xk-3"
|
|
32
|
-
})(["order:3;div[role='button']{border-radius:0px 4px 4px 0px !important;> div{border-left:none;border-radius:0px 4px 4px 0px !important;}}&.alternative{div[role='button']{border-radius:0px 36px 36px 0px !important;> div{border-radius:0px 36px 36px 0px !important;}}}"]);
|
|
33
|
-
exports.RightButtonWrapper = RightButtonWrapper;
|
|
34
|
-
|
|
35
19
|
const InputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
36
20
|
displayName: "styles__InputWrapper",
|
|
37
|
-
componentId: "components-web__sc-1lrz1xk-
|
|
38
|
-
})(["
|
|
21
|
+
componentId: "components-web__sc-1lrz1xk-1"
|
|
22
|
+
})(["text-align:start;display:flex;flex-direction:row;flex-wrap:nowrap;"]);
|
|
39
23
|
|
|
40
24
|
exports.InputWrapper = InputWrapper;
|
package/lib/Spinner/Spinner.js
CHANGED
|
@@ -109,6 +109,7 @@ const Spinner = _ref3 => {
|
|
|
109
109
|
fullScreen = false,
|
|
110
110
|
inline = false,
|
|
111
111
|
label,
|
|
112
|
+
labelPosition,
|
|
112
113
|
show = false,
|
|
113
114
|
isStatic = false,
|
|
114
115
|
tokens,
|
|
@@ -141,6 +142,7 @@ const Spinner = _ref3 => {
|
|
|
141
142
|
...selectProps(rest),
|
|
142
143
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SpinnerContent.default, {
|
|
143
144
|
label: label,
|
|
145
|
+
labelPosition: labelPosition,
|
|
144
146
|
overlay: true,
|
|
145
147
|
size: size,
|
|
146
148
|
thickness: thickness,
|
|
@@ -160,6 +162,7 @@ const Spinner = _ref3 => {
|
|
|
160
162
|
...selectProps(rest),
|
|
161
163
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpinnerContent.default, {
|
|
162
164
|
label: label,
|
|
165
|
+
labelPosition: labelPosition,
|
|
163
166
|
overlay: true,
|
|
164
167
|
size: size,
|
|
165
168
|
thickness: thickness,
|
|
@@ -185,6 +188,7 @@ const Spinner = _ref3 => {
|
|
|
185
188
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SpinnerContainer, { ...selectProps(rest),
|
|
186
189
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SpinnerContent.default, {
|
|
187
190
|
label: label,
|
|
191
|
+
labelPosition: labelPosition,
|
|
188
192
|
size: size,
|
|
189
193
|
thickness: thickness,
|
|
190
194
|
sizeVariant: sizeVariant,
|
|
@@ -232,7 +236,12 @@ Spinner.propTypes = { ...selectedSystemPropTypes,
|
|
|
232
236
|
/**
|
|
233
237
|
* If true, it should render a static spinner
|
|
234
238
|
*/
|
|
235
|
-
isStatic: _propTypes.default.bool
|
|
239
|
+
isStatic: _propTypes.default.bool,
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Determine where the label of the spinner should be placed, left, right, bottom or top.
|
|
243
|
+
*/
|
|
244
|
+
labelPosition: _propTypes.default.string
|
|
236
245
|
};
|
|
237
246
|
var _default = Spinner;
|
|
238
247
|
exports.default = _default;
|
|
@@ -47,6 +47,7 @@ const Container = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
47
47
|
const SpinnerContent = _ref2 => {
|
|
48
48
|
let {
|
|
49
49
|
label,
|
|
50
|
+
labelPosition,
|
|
50
51
|
overlay = false,
|
|
51
52
|
sizeVariant,
|
|
52
53
|
size,
|
|
@@ -54,6 +55,12 @@ const SpinnerContent = _ref2 => {
|
|
|
54
55
|
isStatic,
|
|
55
56
|
...rest
|
|
56
57
|
} = _ref2;
|
|
58
|
+
const labelMapping = {
|
|
59
|
+
top: 'column-reverse',
|
|
60
|
+
bottom: 'column',
|
|
61
|
+
left: 'row-reverse',
|
|
62
|
+
right: 'row'
|
|
63
|
+
};
|
|
57
64
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
58
65
|
overlay: overlay,
|
|
59
66
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
|
|
@@ -61,6 +68,7 @@ const SpinnerContent = _ref2 => {
|
|
|
61
68
|
tokens: {
|
|
62
69
|
alignItems: 'center'
|
|
63
70
|
},
|
|
71
|
+
direction: labelMapping[labelPosition],
|
|
64
72
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ActivityIndicator, {
|
|
65
73
|
label: label,
|
|
66
74
|
tokens: {
|
package/lib/Table/Cell.js
CHANGED
|
@@ -23,94 +23,77 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const HEADER_TYPE = {
|
|
27
|
+
HEADING: 'heading',
|
|
28
|
+
SUBHEADING: 'subHeading',
|
|
29
|
+
ROWHEADING: 'rowHeading'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const stickyStyles = _ref => {
|
|
27
33
|
let {
|
|
28
|
-
cellStickyShadow
|
|
34
|
+
cellStickyShadow,
|
|
35
|
+
stickyBackgroundColor,
|
|
36
|
+
type
|
|
29
37
|
} = _ref;
|
|
30
|
-
return cellStickyShadow;
|
|
31
|
-
}
|
|
38
|
+
return (0, _styledComponents.css)(["position:sticky;left:0;z-index:2;clip-path:inset(0 -8px 0 0);", " &::before{content:'';box-shadow:", ";position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;}"], type !== HEADER_TYPE.SUBHEADING && type !== HEADER_TYPE.HEADING ? `background-color: ${stickyBackgroundColor};` : undefined, cellStickyShadow);
|
|
39
|
+
};
|
|
40
|
+
|
|
32
41
|
const sharedStyles = /*#__PURE__*/(0, _styledComponents.css)(["", ""], _ref2 => {
|
|
33
42
|
let {
|
|
34
43
|
isSticky,
|
|
35
|
-
cellBoxShadowColor,
|
|
36
44
|
align,
|
|
37
45
|
cellPaddingTop,
|
|
38
46
|
cellPaddingRight,
|
|
39
47
|
cellPaddingBottom,
|
|
40
48
|
cellPaddingLeft,
|
|
41
|
-
cellMinWidth
|
|
49
|
+
cellMinWidth,
|
|
50
|
+
cellBackground,
|
|
51
|
+
cellStickyShadow,
|
|
52
|
+
stickyBackgroundColor,
|
|
53
|
+
type
|
|
42
54
|
} = _ref2;
|
|
43
|
-
return (0, _styledComponents.css)(["
|
|
55
|
+
return (0, _styledComponents.css)(["text-align:", ";min-width:", "px;padding:", "px ", "px ", "px ", "px;background-color:", ";", ";"], align, cellMinWidth, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft, cellBackground, isSticky && stickyStyles({
|
|
56
|
+
type,
|
|
57
|
+
cellStickyShadow,
|
|
58
|
+
stickyBackgroundColor
|
|
59
|
+
}));
|
|
44
60
|
});
|
|
45
61
|
|
|
46
|
-
const
|
|
47
|
-
displayName: "
|
|
62
|
+
const createStyledCell = htmlElement => _styledComponents.default[htmlElement].withConfig({
|
|
63
|
+
displayName: "Cell__createStyledCell",
|
|
48
64
|
componentId: "components-web__sc-ltgfic-0"
|
|
49
|
-
})(["", ";", ""], sharedStyles, _ref3 => {
|
|
65
|
+
})(["", ";box-shadow:", ";"], sharedStyles, _ref3 => {
|
|
50
66
|
let {
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
cellBoxShadowColor,
|
|
68
|
+
type
|
|
53
69
|
} = _ref3;
|
|
54
|
-
return `
|
|
55
|
-
background-color: ${cellHeadingBackground};
|
|
56
|
-
box-shadow: inset 0 1px 0 ${cellHeadingBoxShadowColor}, inset 0 -1px 0 ${cellHeadingBoxShadowColor};`;
|
|
70
|
+
return type === HEADER_TYPE.HEADING ? `inset 0 1px 0 ${cellBoxShadowColor}, inset 0 -1px 0 ${cellBoxShadowColor}` : `inset 0 1px 0 ${cellBoxShadowColor}`;
|
|
57
71
|
});
|
|
58
72
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
componentId: "components-web__sc-ltgfic-1"
|
|
62
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref4 => {
|
|
63
|
-
let {
|
|
64
|
-
cellSubheadingBackground
|
|
65
|
-
} = _ref4;
|
|
66
|
-
return cellSubheadingBackground;
|
|
67
|
-
});
|
|
73
|
+
const StyledHeaderCell = createStyledCell('th');
|
|
74
|
+
const StyledDataCell = createStyledCell('td');
|
|
68
75
|
|
|
69
|
-
const
|
|
70
|
-
displayName: "Cell__StyledCell",
|
|
71
|
-
componentId: "components-web__sc-ltgfic-2"
|
|
72
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref5 => {
|
|
73
|
-
let {
|
|
74
|
-
cellBackground
|
|
75
|
-
} = _ref5;
|
|
76
|
-
return cellBackground;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const StyledRowHeading = /*#__PURE__*/_styledComponents.default.th.withConfig({
|
|
80
|
-
displayName: "Cell__StyledRowHeading",
|
|
81
|
-
componentId: "components-web__sc-ltgfic-3"
|
|
82
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref6 => {
|
|
83
|
-
let {
|
|
84
|
-
cellRowHeadingBackground
|
|
85
|
-
} = _ref6;
|
|
86
|
-
return cellRowHeadingBackground;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const Cell = _ref7 => {
|
|
76
|
+
const Cell = _ref4 => {
|
|
90
77
|
let {
|
|
91
78
|
children,
|
|
92
|
-
type = 'default',
|
|
93
79
|
isFirstInRow,
|
|
94
80
|
align = 'left',
|
|
95
|
-
tokens: cellTokens
|
|
96
|
-
|
|
81
|
+
tokens: cellTokens,
|
|
82
|
+
type
|
|
83
|
+
} = _ref4;
|
|
97
84
|
const {
|
|
98
85
|
text,
|
|
99
86
|
isScrollable: isTableScrollable,
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
tokens: tableTokens,
|
|
88
|
+
spacing
|
|
102
89
|
} = (0, _Table.useTableContext)();
|
|
103
90
|
const themeTokens = { ...tableTokens,
|
|
104
91
|
...cellTokens
|
|
105
92
|
};
|
|
106
93
|
const {
|
|
107
94
|
cellMinWidth,
|
|
108
|
-
cellHeadingBackground,
|
|
109
|
-
cellHeadingBoxShadowColor,
|
|
110
95
|
cellBoxShadowColor,
|
|
111
|
-
cellSubheadingBackground,
|
|
112
96
|
cellBackground,
|
|
113
|
-
cellRowHeadingBackground,
|
|
114
97
|
cellStickyShadow,
|
|
115
98
|
cellPaddingTop,
|
|
116
99
|
cellPaddingRight,
|
|
@@ -118,80 +101,72 @@ const Cell = _ref7 => {
|
|
|
118
101
|
cellPaddingBottom,
|
|
119
102
|
fontName,
|
|
120
103
|
fontWeight,
|
|
121
|
-
fontSize
|
|
122
|
-
|
|
104
|
+
fontSize,
|
|
105
|
+
lineHeight,
|
|
106
|
+
stickyBackgroundColor
|
|
107
|
+
} = (0, _componentsBase.useThemeTokens)('Table', themeTokens, {
|
|
108
|
+
spacing,
|
|
109
|
+
type,
|
|
110
|
+
text
|
|
111
|
+
});
|
|
123
112
|
const sharedProps = {
|
|
124
113
|
align,
|
|
125
114
|
isSticky: isTableScrollable && isFirstInRow,
|
|
115
|
+
cellBackground,
|
|
126
116
|
cellMinWidth,
|
|
127
|
-
cellStickyShadow,
|
|
117
|
+
cellStickyShadow: (0, _componentsBase.applyShadowToken)(cellStickyShadow).boxShadow,
|
|
128
118
|
cellPaddingTop,
|
|
129
119
|
cellPaddingRight,
|
|
130
120
|
cellPaddingLeft,
|
|
131
121
|
cellPaddingBottom,
|
|
122
|
+
stickyBackgroundColor,
|
|
132
123
|
cellBoxShadowColor
|
|
133
124
|
};
|
|
134
125
|
const typographyTokens = {
|
|
135
126
|
fontName,
|
|
136
127
|
fontWeight,
|
|
137
|
-
fontSize
|
|
128
|
+
fontSize,
|
|
129
|
+
lineHeight
|
|
138
130
|
};
|
|
139
131
|
|
|
140
132
|
switch (type) {
|
|
141
|
-
case
|
|
142
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
133
|
+
case HEADER_TYPE.HEADING:
|
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
143
135
|
scope: "col",
|
|
144
|
-
cellHeadingBackground: cellHeadingBackground,
|
|
145
|
-
cellHeadingBoxShadowColor: cellHeadingBoxShadowColor,
|
|
146
136
|
...sharedProps,
|
|
137
|
+
type: type,
|
|
147
138
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
148
139
|
tokens: typographyTokens,
|
|
149
|
-
variant: {
|
|
150
|
-
size: 'h4'
|
|
151
|
-
},
|
|
152
140
|
children: children
|
|
153
141
|
})
|
|
154
142
|
});
|
|
155
143
|
|
|
156
|
-
case
|
|
157
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
144
|
+
case HEADER_TYPE.SUBHEADING:
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
158
146
|
scope: "col",
|
|
159
|
-
cellSubheadingBackground: cellSubheadingBackground,
|
|
160
147
|
...sharedProps,
|
|
148
|
+
type: type,
|
|
161
149
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
162
150
|
tokens: typographyTokens,
|
|
163
|
-
variant: {
|
|
164
|
-
size: 'h5'
|
|
165
|
-
},
|
|
166
151
|
children: children
|
|
167
152
|
})
|
|
168
153
|
});
|
|
169
154
|
|
|
170
|
-
case
|
|
171
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
155
|
+
case HEADER_TYPE.ROWHEADING:
|
|
156
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
172
157
|
scope: "row",
|
|
173
|
-
cellRowHeadingBackground: cellRowHeadingBackground,
|
|
174
158
|
...sharedProps,
|
|
159
|
+
type: type,
|
|
175
160
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
176
161
|
tokens: typographyTokens,
|
|
177
|
-
variant: {
|
|
178
|
-
size: text === 'small' ? 'h5' : 'h4'
|
|
179
|
-
},
|
|
180
162
|
children: children
|
|
181
163
|
})
|
|
182
164
|
});
|
|
183
165
|
|
|
184
166
|
default:
|
|
185
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
186
|
-
cellBackground: cellBackground,
|
|
187
|
-
...sharedProps,
|
|
167
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDataCell, { ...sharedProps,
|
|
188
168
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
189
|
-
tokens:
|
|
190
|
-
fontSize
|
|
191
|
-
},
|
|
192
|
-
variant: {
|
|
193
|
-
size: text
|
|
194
|
-
},
|
|
169
|
+
tokens: typographyTokens,
|
|
195
170
|
children: children
|
|
196
171
|
})
|
|
197
172
|
});
|
|
@@ -199,14 +174,10 @@ const Cell = _ref7 => {
|
|
|
199
174
|
};
|
|
200
175
|
|
|
201
176
|
Cell.propTypes = {
|
|
177
|
+
type: _propTypes.default.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
202
178
|
tokens: _propTypes.default.object,
|
|
203
179
|
children: _propTypes.default.node,
|
|
204
180
|
|
|
205
|
-
/**
|
|
206
|
-
* Defines the visual styles of a cell, and whether it should be a `td` or `th` element
|
|
207
|
-
*/
|
|
208
|
-
type: _propTypes.default.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
209
|
-
|
|
210
181
|
/**
|
|
211
182
|
* @ignore
|
|
212
183
|
* Used internally for making the first column sticky
|
package/lib/Table/Header.js
CHANGED
|
@@ -25,7 +25,10 @@ const Header = _ref => {
|
|
|
25
25
|
} = _ref;
|
|
26
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
27
27
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Row.default, {
|
|
28
|
-
children: _react.default.Children.map(children, child =>
|
|
28
|
+
children: _react.default.Children.map(children, child =>
|
|
29
|
+
/*#__PURE__*/
|
|
30
|
+
// TO DO: pass type as a variant instead of prop
|
|
31
|
+
(0, _react.cloneElement)(child, {
|
|
29
32
|
type: 'heading'
|
|
30
33
|
}))
|
|
31
34
|
})
|