@telus-uds/components-web 2.13.0 → 2.15.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 +32 -2
- package/component-docs.json +46 -19
- package/lib/Badge/Badge.js +10 -1
- package/lib/Card/CardContent.js +6 -5
- package/lib/DatePicker/DatePicker.js +12 -11
- package/lib/QuantitySelector/QuantitySelector.js +67 -66
- package/lib/QuantitySelector/SideButton.js +93 -0
- package/lib/QuantitySelector/styles.js +4 -20
- package/lib/TermsAndConditions/TermsAndConditions.js +21 -4
- package/lib/Testimonial/Testimonial.js +48 -12
- package/lib/Toast/Toast.js +19 -7
- package/lib-module/Badge/Badge.js +10 -1
- package/lib-module/Card/CardContent.js +6 -5
- package/lib-module/DatePicker/DatePicker.js +11 -11
- 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/TermsAndConditions/TermsAndConditions.js +20 -4
- package/lib-module/Testimonial/Testimonial.js +49 -13
- package/lib-module/Toast/Toast.js +19 -7
- package/package.json +4 -4
- package/src/Badge/Badge.jsx +14 -2
- package/src/Card/CardContent.jsx +6 -5
- package/src/DatePicker/DatePicker.jsx +11 -13
- package/src/QuantitySelector/QuantitySelector.jsx +60 -76
- package/src/QuantitySelector/SideButton.jsx +74 -0
- package/src/QuantitySelector/styles.js +4 -70
- package/src/TermsAndConditions/TermsAndConditions.jsx +30 -4
- package/src/Testimonial/Testimonial.jsx +73 -11
- package/src/Toast/Toast.jsx +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 21 Jul 2023 00:42:38 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.15.0
|
|
8
|
+
|
|
9
|
+
Fri, 21 Jul 2023 00:42:38 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Adjusted CardContent to subtract borderWidth from padding to prevent a shifting issue(border was pushing content) (kyle.king2@telus.com)
|
|
14
|
+
- added padding token to Toast (kyle.king2@telus.com)
|
|
15
|
+
- Adjusted story for Listbox to not have "href" attributes on the children (kyle.king2@telus.com)
|
|
16
|
+
- Bump @telus-uds/components-base to v1.56.0
|
|
17
|
+
- Bump @telus-uds/system-theme-tokens to v2.39.0
|
|
18
|
+
|
|
19
|
+
## 2.14.0
|
|
20
|
+
|
|
21
|
+
Fri, 14 Jul 2023 19:47:50 GMT
|
|
22
|
+
|
|
23
|
+
### Minor changes
|
|
24
|
+
|
|
25
|
+
- `QuantitySelector` now can be controlled from the parent component (shahzaibkhalidmalik@outlook.com)
|
|
26
|
+
- Standardized QuantitySelector (wlsdud194@hotmail.com)
|
|
27
|
+
- Add dictionary override to `TermsAndConditions` (shahzaibkhalidmalik@outlook.com)
|
|
28
|
+
- New token fontSize added for the badge component (35577399+JoshHC@users.noreply.github.com)
|
|
29
|
+
- Bump @telus-uds/components-base to v1.55.0
|
|
30
|
+
- Bump @telus-uds/system-constants to v1.3.0
|
|
31
|
+
- Bump @telus-uds/system-theme-tokens to v2.38.0
|
|
32
|
+
|
|
33
|
+
### Patches
|
|
34
|
+
|
|
35
|
+
- Fix an issue where `DatePicker` may not close after date selection (shahzaibkhalidmalik@outlook.com)
|
|
36
|
+
|
|
7
37
|
## 2.13.0
|
|
8
38
|
|
|
9
|
-
Fri, 07 Jul 2023 19:
|
|
39
|
+
Fri, 07 Jul 2023 19:26:41 GMT
|
|
10
40
|
|
|
11
41
|
### Minor changes
|
|
12
42
|
|
package/component-docs.json
CHANGED
|
@@ -197,6 +197,7 @@
|
|
|
197
197
|
"name": "custom",
|
|
198
198
|
"raw": {
|
|
199
199
|
"fontWeight": "fontWeight",
|
|
200
|
+
"fontSize": "fontSize",
|
|
200
201
|
"fontName": "fontName",
|
|
201
202
|
"backgroundColor": "color",
|
|
202
203
|
"borderColor": "color",
|
|
@@ -2598,6 +2599,10 @@
|
|
|
2598
2599
|
"alternative": {
|
|
2599
2600
|
"name": "bool",
|
|
2600
2601
|
"required": false
|
|
2602
|
+
},
|
|
2603
|
+
"disabled": {
|
|
2604
|
+
"name": "bool",
|
|
2605
|
+
"required": false
|
|
2601
2606
|
}
|
|
2602
2607
|
}
|
|
2603
2608
|
},
|
|
@@ -2643,6 +2648,13 @@
|
|
|
2643
2648
|
"required": false,
|
|
2644
2649
|
"description": "The default value of the input field"
|
|
2645
2650
|
},
|
|
2651
|
+
"value": {
|
|
2652
|
+
"type": {
|
|
2653
|
+
"name": "number"
|
|
2654
|
+
},
|
|
2655
|
+
"required": false,
|
|
2656
|
+
"description": "If the input's state is to be controlled by a parent component, use this prop\ntogether with the `onChange` to pass down and update the lifted state."
|
|
2657
|
+
},
|
|
2646
2658
|
"label": {
|
|
2647
2659
|
"type": {
|
|
2648
2660
|
"name": "string"
|
|
@@ -3394,6 +3406,29 @@
|
|
|
3394
3406
|
},
|
|
3395
3407
|
"required": false
|
|
3396
3408
|
},
|
|
3409
|
+
"dictionary": {
|
|
3410
|
+
"defaultValue": {
|
|
3411
|
+
"value": "{\n en: {\n headingHide: 'Hide terms and conditions',\n headingView: 'View terms and conditions',\n nonIndexedTitle: 'The following applies to all terms and conditions above'\n },\n fr: {\n headingHide: 'Masquer les modalités et conditions',\n headingView: 'Voir les modalités et conditions',\n nonIndexedTitle: 'Ce qui suit s’applique aux modalités et conditions ci-dessus'\n }\n}",
|
|
3412
|
+
"computed": false
|
|
3413
|
+
},
|
|
3414
|
+
"type": {
|
|
3415
|
+
"name": "shape",
|
|
3416
|
+
"value": {
|
|
3417
|
+
"en": {
|
|
3418
|
+
"name": "custom",
|
|
3419
|
+
"raw": "dictionaryContentShape",
|
|
3420
|
+
"required": false
|
|
3421
|
+
},
|
|
3422
|
+
"fr": {
|
|
3423
|
+
"name": "custom",
|
|
3424
|
+
"raw": "dictionaryContentShape",
|
|
3425
|
+
"required": false
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
},
|
|
3429
|
+
"required": false,
|
|
3430
|
+
"description": "Custom dictionary containing the labels to use for `TermsAndConditions`"
|
|
3431
|
+
},
|
|
3397
3432
|
"indexedContent": {
|
|
3398
3433
|
"defaultValue": {
|
|
3399
3434
|
"value": "[]",
|
|
@@ -3467,7 +3502,7 @@
|
|
|
3467
3502
|
},
|
|
3468
3503
|
"testimonialStyle": {
|
|
3469
3504
|
"defaultValue": {
|
|
3470
|
-
"value": "'
|
|
3505
|
+
"value": "'large'",
|
|
3471
3506
|
"computed": false
|
|
3472
3507
|
},
|
|
3473
3508
|
"type": {
|
|
@@ -3486,6 +3521,13 @@
|
|
|
3486
3521
|
"required": false,
|
|
3487
3522
|
"description": "Testimonial style"
|
|
3488
3523
|
},
|
|
3524
|
+
"copy": {
|
|
3525
|
+
"defaultValue": {
|
|
3526
|
+
"value": "'en'",
|
|
3527
|
+
"computed": false
|
|
3528
|
+
},
|
|
3529
|
+
"required": false
|
|
3530
|
+
},
|
|
3489
3531
|
"variant": {
|
|
3490
3532
|
"defaultValue": {
|
|
3491
3533
|
"value": "{}",
|
|
@@ -5586,15 +5628,7 @@
|
|
|
5586
5628
|
"showPanelTabs": "show",
|
|
5587
5629
|
"spaceBetweenSlideAndPreviousNextNavigation": "size",
|
|
5588
5630
|
"spaceBetweenSlideAndPanelNavigation": "size",
|
|
5589
|
-
"
|
|
5590
|
-
"thumbnailBorderRadius": "radius",
|
|
5591
|
-
"thumbnailBorderWidth": "border",
|
|
5592
|
-
"thumbnailContainerPaddingTop": "size",
|
|
5593
|
-
"thumbnailMargin": "size",
|
|
5594
|
-
"thumbnailPadding": "size",
|
|
5595
|
-
"thumbnailSelectedBorderColor": "color",
|
|
5596
|
-
"thumbnailSelectedBorderWidth": "border",
|
|
5597
|
-
"thumbnailSize": "size"
|
|
5631
|
+
"stepTrackerCurrentBackgroundColor": "color"
|
|
5598
5632
|
}
|
|
5599
5633
|
},
|
|
5600
5634
|
"required": false,
|
|
@@ -5955,15 +5989,7 @@
|
|
|
5955
5989
|
"showPanelTabs": "show",
|
|
5956
5990
|
"spaceBetweenSlideAndPreviousNextNavigation": "size",
|
|
5957
5991
|
"spaceBetweenSlideAndPanelNavigation": "size",
|
|
5958
|
-
"
|
|
5959
|
-
"thumbnailBorderRadius": "radius",
|
|
5960
|
-
"thumbnailBorderWidth": "border",
|
|
5961
|
-
"thumbnailContainerPaddingTop": "size",
|
|
5962
|
-
"thumbnailMargin": "size",
|
|
5963
|
-
"thumbnailPadding": "size",
|
|
5964
|
-
"thumbnailSelectedBorderColor": "color",
|
|
5965
|
-
"thumbnailSelectedBorderWidth": "border",
|
|
5966
|
-
"thumbnailSize": "size"
|
|
5992
|
+
"stepTrackerCurrentBackgroundColor": "color"
|
|
5967
5993
|
}
|
|
5968
5994
|
},
|
|
5969
5995
|
"required": false,
|
|
@@ -13371,6 +13397,7 @@
|
|
|
13371
13397
|
"name": "custom",
|
|
13372
13398
|
"raw": {
|
|
13373
13399
|
"outerBorderColor": "color",
|
|
13400
|
+
"backgroundColor": "color",
|
|
13374
13401
|
"outerBorderWidth": "border",
|
|
13375
13402
|
"outerBorderGap": "size",
|
|
13376
13403
|
"borderRadius": "radius",
|
package/lib/Badge/Badge.js
CHANGED
|
@@ -77,7 +77,8 @@ const Badge = _ref6 => {
|
|
|
77
77
|
paddingTop,
|
|
78
78
|
paddingBottom,
|
|
79
79
|
fontName,
|
|
80
|
-
fontWeight
|
|
80
|
+
fontWeight,
|
|
81
|
+
fontSize
|
|
81
82
|
} = (0, _componentsBase.useThemeTokens)('Badge', tokens, variant);
|
|
82
83
|
const semanticGradient = gradient && (0, _utils.transformGradient)(gradient);
|
|
83
84
|
const {
|
|
@@ -94,6 +95,11 @@ const Badge = _ref6 => {
|
|
|
94
95
|
background = semanticGradient;
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
const fontSizeMapping = {
|
|
99
|
+
12: 'micro',
|
|
100
|
+
14: 'small',
|
|
101
|
+
16: 'h6'
|
|
102
|
+
};
|
|
97
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BadgeContainer, {
|
|
98
104
|
isOutlineOffer: isOutlineOffer,
|
|
99
105
|
isAlternative: alternative,
|
|
@@ -111,6 +117,9 @@ const Badge = _ref6 => {
|
|
|
111
117
|
fontWeight,
|
|
112
118
|
color
|
|
113
119
|
},
|
|
120
|
+
variant: {
|
|
121
|
+
size: fontSizeMapping[fontSize]
|
|
122
|
+
},
|
|
114
123
|
children: children
|
|
115
124
|
})
|
|
116
125
|
});
|
package/lib/Card/CardContent.js
CHANGED
|
@@ -35,7 +35,8 @@ const CardContentContainer = /*#__PURE__*/_styledComponents.default.div.withConf
|
|
|
35
35
|
contentAlignItems: alignItems,
|
|
36
36
|
contentFlexGrow: flexGrow,
|
|
37
37
|
contentFlexShrink: flexShrink,
|
|
38
|
-
contentJustifyContent: justifyContent
|
|
38
|
+
contentJustifyContent: justifyContent,
|
|
39
|
+
borderWidth
|
|
39
40
|
} = _ref;
|
|
40
41
|
return {
|
|
41
42
|
// We need to make sure to have sharp corners on the bottom
|
|
@@ -44,10 +45,10 @@ const CardContentContainer = /*#__PURE__*/_styledComponents.default.div.withConf
|
|
|
44
45
|
borderBottomRightRadius: withFooter ? 0 : borderRadius,
|
|
45
46
|
borderTopLeftRadius: borderRadius,
|
|
46
47
|
borderTopRightRadius: borderRadius,
|
|
47
|
-
paddingBottom,
|
|
48
|
-
paddingLeft,
|
|
49
|
-
paddingRight,
|
|
50
|
-
paddingTop,
|
|
48
|
+
paddingBottom: paddingBottom - borderWidth,
|
|
49
|
+
paddingLeft: paddingLeft - borderWidth,
|
|
50
|
+
paddingRight: paddingRight - borderWidth,
|
|
51
|
+
paddingTop: paddingTop - borderWidth,
|
|
51
52
|
display: 'flex',
|
|
52
53
|
flexDirection: 'column',
|
|
53
54
|
alignItems,
|
|
@@ -23,6 +23,8 @@ var _componentsBase = require("@telus-uds/components-base");
|
|
|
23
23
|
|
|
24
24
|
var _moment = _interopRequireDefault(require("moment"));
|
|
25
25
|
|
|
26
|
+
var _lodash = require("lodash");
|
|
27
|
+
|
|
26
28
|
var _CalendarContainer = _interopRequireDefault(require("./CalendarContainer"));
|
|
27
29
|
|
|
28
30
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
@@ -44,29 +46,23 @@ const dateFormatWithoutSpaces = 'DD/MM/YYYY';
|
|
|
44
46
|
const getResponsiveDaySize = function () {
|
|
45
47
|
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
46
48
|
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
47
|
-
let responsiveDaySize;
|
|
48
49
|
|
|
49
50
|
if (viewport === 'xs') {
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
responsiveDaySize = inline ? 60 : 44;
|
|
51
|
+
return inline ? undefined : 36;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
return
|
|
54
|
+
return inline ? 60 : 44;
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
const getResponsiveCircleSize = function () {
|
|
59
58
|
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
60
59
|
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
61
|
-
let responsiveCircleSize;
|
|
62
60
|
|
|
63
61
|
if (viewport === 'xs') {
|
|
64
|
-
|
|
65
|
-
} else {
|
|
66
|
-
responsiveCircleSize = inline ? 44 : 26;
|
|
62
|
+
return 26;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
return
|
|
65
|
+
return inline ? 44 : 26;
|
|
70
66
|
};
|
|
71
67
|
|
|
72
68
|
const MonthCenterContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
@@ -137,7 +133,11 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
137
133
|
copy
|
|
138
134
|
});
|
|
139
135
|
(0, _react.useEffect)(() => {
|
|
140
|
-
|
|
136
|
+
/**
|
|
137
|
+
* `date` could be passed as `null` to reset the value so explicitly
|
|
138
|
+
* checking for not being `undefined`
|
|
139
|
+
*/
|
|
140
|
+
if (!(0, _lodash.isUndefined)(date) && !(0, _moment.default)(date).isSame(inputDate)) {
|
|
141
141
|
setInputDate(date);
|
|
142
142
|
setInputText(date instanceof _moment.default ? date.format(dateFormat) : '');
|
|
143
143
|
}
|
|
@@ -179,6 +179,7 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
179
179
|
const onChange = value => {
|
|
180
180
|
setInputDate(value);
|
|
181
181
|
setInputText(value.format(dateFormat));
|
|
182
|
+
setIsFocused(false);
|
|
182
183
|
if (onDateChange) onDateChange(value);
|
|
183
184
|
};
|
|
184
185
|
|
|
@@ -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;
|