@telus-uds/components-base 1.90.0 → 1.92.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 +29 -2
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +3 -1
- package/lib/MultiSelectFilter/MultiSelectFilter.js +6 -0
- package/lib/OrderedList/Item.js +7 -5
- package/lib/OrderedList/OrderedList.js +15 -7
- package/lib/Select/Picker.js +48 -23
- package/lib/Select/Select.js +4 -0
- package/lib/TextInput/TextInputBase.js +11 -5
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +3 -1
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +6 -0
- package/lib-module/OrderedList/Item.js +7 -5
- package/lib-module/OrderedList/OrderedList.js +16 -8
- package/lib-module/Select/Picker.js +48 -23
- package/lib-module/Select/Select.js +4 -0
- package/lib-module/TextInput/TextInputBase.js +11 -5
- package/package.json +2 -2
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +5 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +6 -0
- package/src/OrderedList/Item.jsx +6 -5
- package/src/OrderedList/OrderedList.jsx +35 -26
- package/src/Select/Picker.jsx +24 -2
- package/src/Select/Select.jsx +5 -0
- package/src/TextInput/TextInputBase.jsx +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 22 Aug 2024 18:17:39 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.92.0
|
|
8
|
+
|
|
9
|
+
Thu, 22 Aug 2024 18:17:39 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `Select`: Add `active` variant (Mauricio.BatresMontejo@telus.com)
|
|
14
|
+
- MultiSelectFilter: onOpen function added to component, the function is called when the modal is opened (35577399+JoshHC@users.noreply.github.com)
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.62.0
|
|
16
|
+
|
|
17
|
+
### Patches
|
|
18
|
+
|
|
19
|
+
- `carouseltabspanel`: pass accessibilityRole of presentation to divider so align with accessibility tests (<tony.eng@telus.com>)
|
|
20
|
+
|
|
21
|
+
## 1.91.0
|
|
22
|
+
|
|
23
|
+
Mon, 12 Aug 2024 06:35:32 GMT
|
|
24
|
+
|
|
25
|
+
### Minor changes
|
|
26
|
+
|
|
27
|
+
- OrderedList: add itemTextColor token and pass tokens down to children (jacqui.koroll@telus.com)
|
|
28
|
+
- Bump @telus-uds/system-theme-tokens to v2.61.0
|
|
29
|
+
|
|
30
|
+
### Patches
|
|
31
|
+
|
|
32
|
+
- `TextInputBase`: Update padding logic for TextInput component based on icon and buttons presence (jaime.tuyuc@telus.com)
|
|
33
|
+
|
|
7
34
|
## 1.90.0
|
|
8
35
|
|
|
9
|
-
Fri, 26 Jul 2024 21:
|
|
36
|
+
Fri, 26 Jul 2024 21:24:32 GMT
|
|
10
37
|
|
|
11
38
|
### Minor changes
|
|
12
39
|
|
|
@@ -47,7 +47,9 @@ const CarouselTabsPanel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
47
47
|
direction: "row",
|
|
48
48
|
space: 3,
|
|
49
49
|
divider: {
|
|
50
|
-
variant: dividerVariant
|
|
50
|
+
variant: dividerVariant,
|
|
51
|
+
accessibilityRole: 'presentation',
|
|
52
|
+
accessibilityOrientation: null
|
|
51
53
|
},
|
|
52
54
|
ref: ref,
|
|
53
55
|
accessibilityRole: "tablist",
|
|
@@ -66,6 +66,7 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
66
66
|
onChange,
|
|
67
67
|
onConfirm = () => {},
|
|
68
68
|
onCancel = () => {},
|
|
69
|
+
onOpen = () => {},
|
|
69
70
|
copy = 'en',
|
|
70
71
|
readOnly = false,
|
|
71
72
|
inactive = false,
|
|
@@ -136,6 +137,7 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
136
137
|
}]);
|
|
137
138
|
const handleChange = event => {
|
|
138
139
|
if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
|
|
140
|
+
if (isOpen) onOpen();
|
|
139
141
|
setIsOpen(!isOpen);
|
|
140
142
|
};
|
|
141
143
|
const onApply = e => {
|
|
@@ -452,6 +454,10 @@ MultiSelectFilter.propTypes = {
|
|
|
452
454
|
* If provided, this function is called when the selection is confirmed.
|
|
453
455
|
*/
|
|
454
456
|
onConfirm: _propTypes.default.func,
|
|
457
|
+
/**
|
|
458
|
+
* If provided, this function is called when the modal with options is opened.
|
|
459
|
+
* */
|
|
460
|
+
onOpen: _propTypes.default.func,
|
|
455
461
|
/**
|
|
456
462
|
* If provided, this function is called when `MultiSelectFilter` is closed.
|
|
457
463
|
* */
|
package/lib/OrderedList/Item.js
CHANGED
|
@@ -21,13 +21,14 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
21
21
|
itemFontSize,
|
|
22
22
|
itemLineHeight,
|
|
23
23
|
itemFontName,
|
|
24
|
-
itemColor
|
|
24
|
+
itemColor,
|
|
25
|
+
itemTextColor
|
|
25
26
|
} = _ref;
|
|
26
27
|
return (0, _ThemeProvider.applyTextStyles)({
|
|
27
28
|
fontWeight: itemFontHeight,
|
|
28
29
|
fontSize: itemFontSize,
|
|
29
30
|
fontName: itemFontName,
|
|
30
|
-
color: itemColor,
|
|
31
|
+
color: itemColor || itemTextColor,
|
|
31
32
|
themeOptions,
|
|
32
33
|
lineHeight: itemLineHeight
|
|
33
34
|
});
|
|
@@ -41,10 +42,11 @@ const selectItemCounterStyles = _ref2 => {
|
|
|
41
42
|
itemFontName,
|
|
42
43
|
itemLineHeight,
|
|
43
44
|
themeOptions,
|
|
44
|
-
itemColor
|
|
45
|
+
itemColor,
|
|
46
|
+
itemTextColor
|
|
45
47
|
} = _ref2;
|
|
46
48
|
return {
|
|
47
|
-
color: itemColor,
|
|
49
|
+
color: itemColor || itemTextColor,
|
|
48
50
|
width: itemBulletContainerWidth,
|
|
49
51
|
textAlign: itemBulletTextAlign,
|
|
50
52
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
@@ -82,7 +84,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
|
82
84
|
const headingTokens = title && {
|
|
83
85
|
lineHeight: themeTokens.itemLineHeight,
|
|
84
86
|
fontSize: themeTokens.itemFontSize,
|
|
85
|
-
color: themeTokens.itemColor,
|
|
87
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
86
88
|
fontName: themeTokens.headerFontName,
|
|
87
89
|
fontWeight: themeTokens.headerFontWeight
|
|
88
90
|
};
|
|
@@ -17,29 +17,36 @@ const OrderedList = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
17
17
|
children,
|
|
18
18
|
start = 1,
|
|
19
19
|
variant = {},
|
|
20
|
+
tokens = {},
|
|
20
21
|
...rest
|
|
21
22
|
} = _ref;
|
|
23
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
22
24
|
const childrenWithParentVariants = _react.default.useMemo(() => {
|
|
23
|
-
const
|
|
24
|
-
var _child$props;
|
|
25
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
26
|
+
var _child$props, _child$props2;
|
|
25
27
|
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
28
|
+
const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
|
|
26
29
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
27
30
|
index: start + i,
|
|
28
31
|
isLastChild,
|
|
29
32
|
variant: {
|
|
30
33
|
...existingChildVariants,
|
|
31
34
|
...variant
|
|
35
|
+
},
|
|
36
|
+
tokens: {
|
|
37
|
+
...existingChildTokens,
|
|
38
|
+
...tokens
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
41
|
};
|
|
35
|
-
if (variant) {
|
|
42
|
+
if (variant || tokens) {
|
|
36
43
|
if (Array.isArray(children)) {
|
|
37
|
-
return children.map((child, i) =>
|
|
44
|
+
return children.map((child, i) => addVariantAndTokensToProps(child, i, i === children.length - 1));
|
|
38
45
|
}
|
|
39
|
-
return [
|
|
46
|
+
return [addVariantAndTokensToProps(children, 0, true)];
|
|
40
47
|
}
|
|
41
48
|
return children;
|
|
42
|
-
}, [children, variant, start]);
|
|
49
|
+
}, [children, variant, start, tokens]);
|
|
43
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedListBase.default, {
|
|
44
51
|
ref: ref,
|
|
45
52
|
...selectProps(rest),
|
|
@@ -56,7 +63,8 @@ OrderedList.propTypes = {
|
|
|
56
63
|
* The position to start the list with.
|
|
57
64
|
*/
|
|
58
65
|
start: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
59
|
-
variant: _utils.variantProp.propType
|
|
66
|
+
variant: _utils.variantProp.propType,
|
|
67
|
+
tokens: (0, _utils.getTokensPropType)('OrderedList')
|
|
60
68
|
};
|
|
61
69
|
OrderedList.displayName = 'OrderedList';
|
|
62
70
|
OrderedList.Item = _Item.default;
|
package/lib/Select/Picker.js
CHANGED
|
@@ -18,6 +18,8 @@ const Picker = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
18
18
|
onBlur,
|
|
19
19
|
onMouseOver,
|
|
20
20
|
onMouseOut,
|
|
21
|
+
onOpen = () => {},
|
|
22
|
+
onClose = () => {},
|
|
21
23
|
style,
|
|
22
24
|
inactive,
|
|
23
25
|
children,
|
|
@@ -32,29 +34,44 @@ const Picker = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
32
34
|
accessibilityDescribedBy,
|
|
33
35
|
accessibilityInvalid
|
|
34
36
|
} = rest;
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
disabled:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
return (
|
|
38
|
+
/*#__PURE__*/
|
|
39
|
+
/**
|
|
40
|
+
* The onOpen and onClose methods are to call the new active variant that changes the icon of the select,
|
|
41
|
+
* onOpen when the select is open and onClose when the select is closed, onOpen is in the event onMousedown
|
|
42
|
+
* when is selected and oClose is in onMouseOut and onChange when the select is closed.
|
|
43
|
+
*/
|
|
44
|
+
(0, _jsxRuntime.jsxs)("select", {
|
|
45
|
+
ref: ref,
|
|
46
|
+
style: style,
|
|
47
|
+
onMouseOver: onMouseOver,
|
|
48
|
+
onMouseOut: () => {
|
|
49
|
+
onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut();
|
|
50
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
51
|
+
},
|
|
52
|
+
onFocus: onFocus,
|
|
53
|
+
onBlur: onBlur,
|
|
54
|
+
onMouseDown: onOpen,
|
|
55
|
+
disabled: inactive,
|
|
56
|
+
value: value || (placeholder !== undefined ? placeholder.value : undefined),
|
|
57
|
+
onChange: event => {
|
|
58
|
+
onClose();
|
|
59
|
+
onChange(event.target.value, event);
|
|
60
|
+
},
|
|
61
|
+
id: nativeID,
|
|
62
|
+
"aria-label": accessibilityLabel,
|
|
63
|
+
"aria-describedby": accessibilityDescribedBy,
|
|
64
|
+
"aria-invalid": accessibilityInvalid,
|
|
65
|
+
"data-testid": testID,
|
|
66
|
+
...selectedProps,
|
|
67
|
+
children: [placeholder !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
68
|
+
value: placeholder.value,
|
|
69
|
+
disabled: true,
|
|
70
|
+
hidden: true,
|
|
71
|
+
children: placeholder.label
|
|
72
|
+
}), children]
|
|
73
|
+
})
|
|
74
|
+
);
|
|
58
75
|
});
|
|
59
76
|
Picker.displayName = 'Picker';
|
|
60
77
|
var _default = Picker;
|
|
@@ -67,6 +84,14 @@ Picker.propTypes = {
|
|
|
67
84
|
onBlur: _propTypes.default.func,
|
|
68
85
|
onMouseOver: _propTypes.default.func,
|
|
69
86
|
onMouseOut: _propTypes.default.func,
|
|
87
|
+
/**
|
|
88
|
+
* It executes when the select choices are open
|
|
89
|
+
*/
|
|
90
|
+
onOpen: _propTypes.default.func,
|
|
91
|
+
/**
|
|
92
|
+
* It executes when the select choices are closed
|
|
93
|
+
*/
|
|
94
|
+
onClose: _propTypes.default.func,
|
|
70
95
|
style: _propTypes.default.object,
|
|
71
96
|
inactive: _propTypes.default.bool,
|
|
72
97
|
children: (0, _utils.componentPropType)(['Item', 'Group']),
|
package/lib/Select/Select.js
CHANGED
|
@@ -217,6 +217,7 @@ const Select = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
|
|
|
217
217
|
const [isHovered, setIsHovered] = _react.default.useState(false);
|
|
218
218
|
const handleMouseOver = () => setIsHovered(true);
|
|
219
219
|
const handleMouseOut = () => setIsHovered(false);
|
|
220
|
+
const [isOpen, setIsOpen] = _react.default.useState(false);
|
|
220
221
|
const {
|
|
221
222
|
supportsProps,
|
|
222
223
|
...selectedProps
|
|
@@ -225,6 +226,7 @@ const Select = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
|
|
|
225
226
|
focus: isFocused,
|
|
226
227
|
hover: isHovered,
|
|
227
228
|
inactive,
|
|
229
|
+
active: isOpen,
|
|
228
230
|
validation
|
|
229
231
|
});
|
|
230
232
|
const {
|
|
@@ -253,6 +255,8 @@ const Select = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
|
|
|
253
255
|
onBlur: handleBlur,
|
|
254
256
|
onMouseOver: handleMouseOver,
|
|
255
257
|
onMouseOut: handleMouseOut,
|
|
258
|
+
onOpen: () => setIsOpen(true),
|
|
259
|
+
onClose: () => setIsOpen(false),
|
|
256
260
|
onChange: e => setValue(e, null),
|
|
257
261
|
value: currentValue,
|
|
258
262
|
inactive: inactive,
|
|
@@ -19,7 +19,7 @@ var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
22
|
-
const selectInputStyles = (_ref, themeOptions, inactive, type)
|
|
22
|
+
const selectInputStyles = function (_ref, themeOptions, inactive, type) {
|
|
23
23
|
let {
|
|
24
24
|
backgroundColor,
|
|
25
25
|
color,
|
|
@@ -35,12 +35,15 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
35
35
|
fontWeight,
|
|
36
36
|
lineHeight,
|
|
37
37
|
icon,
|
|
38
|
-
iconSize = 0,
|
|
39
38
|
minLines,
|
|
40
39
|
maxLines,
|
|
41
40
|
width,
|
|
42
41
|
height
|
|
43
42
|
} = _ref;
|
|
43
|
+
let buttonCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
44
|
+
let buttonSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
45
|
+
let buttonsGapSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
46
|
+
let isPassword = arguments.length > 7 ? arguments[7] : undefined;
|
|
44
47
|
// Subtract border width from padding so overall input width/height doesn't
|
|
45
48
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
46
49
|
const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -67,7 +70,10 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
67
70
|
}
|
|
68
71
|
});
|
|
69
72
|
|
|
70
|
-
const
|
|
73
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize;
|
|
74
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing);
|
|
75
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight;
|
|
76
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight;
|
|
71
77
|
return {
|
|
72
78
|
backgroundColor,
|
|
73
79
|
color,
|
|
@@ -75,7 +81,7 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
75
81
|
borderColor,
|
|
76
82
|
borderRadius,
|
|
77
83
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
78
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
84
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
79
85
|
paddingTop: offsetBorder(paddingTop),
|
|
80
86
|
paddingBottom: offsetBorder(paddingBottom),
|
|
81
87
|
minHeight,
|
|
@@ -343,7 +349,7 @@ const TextInputBase = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
343
349
|
const nativeInputStyle = selectInputStyles({
|
|
344
350
|
...themeTokens,
|
|
345
351
|
height
|
|
346
|
-
}, themeOptions, inactive, type);
|
|
352
|
+
}, themeOptions, inactive, type, buttons === null || buttons === void 0 ? void 0 : buttons.length, themeTokens.buttonSize, buttonsGapSize, isPassword);
|
|
347
353
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
348
354
|
style: selectOuterBorderStyles(themeTokens),
|
|
349
355
|
children: [type === 'card' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -41,7 +41,9 @@ const CarouselTabsPanel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
41
41
|
direction: "row",
|
|
42
42
|
space: 3,
|
|
43
43
|
divider: {
|
|
44
|
-
variant: dividerVariant
|
|
44
|
+
variant: dividerVariant,
|
|
45
|
+
accessibilityRole: 'presentation',
|
|
46
|
+
accessibilityOrientation: null
|
|
45
47
|
},
|
|
46
48
|
ref: ref,
|
|
47
49
|
accessibilityRole: "tablist",
|
|
@@ -61,6 +61,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
61
61
|
onChange,
|
|
62
62
|
onConfirm = () => {},
|
|
63
63
|
onCancel = () => {},
|
|
64
|
+
onOpen = () => {},
|
|
64
65
|
copy = 'en',
|
|
65
66
|
readOnly = false,
|
|
66
67
|
inactive = false,
|
|
@@ -131,6 +132,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
131
132
|
}]);
|
|
132
133
|
const handleChange = event => {
|
|
133
134
|
if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
|
|
135
|
+
if (isOpen) onOpen();
|
|
134
136
|
setIsOpen(!isOpen);
|
|
135
137
|
};
|
|
136
138
|
const onApply = e => {
|
|
@@ -447,6 +449,10 @@ MultiSelectFilter.propTypes = {
|
|
|
447
449
|
* If provided, this function is called when the selection is confirmed.
|
|
448
450
|
*/
|
|
449
451
|
onConfirm: PropTypes.func,
|
|
452
|
+
/**
|
|
453
|
+
* If provided, this function is called when the modal with options is opened.
|
|
454
|
+
* */
|
|
455
|
+
onOpen: PropTypes.func,
|
|
450
456
|
/**
|
|
451
457
|
* If provided, this function is called when `MultiSelectFilter` is closed.
|
|
452
458
|
* */
|
|
@@ -15,13 +15,14 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
15
15
|
itemFontSize,
|
|
16
16
|
itemLineHeight,
|
|
17
17
|
itemFontName,
|
|
18
|
-
itemColor
|
|
18
|
+
itemColor,
|
|
19
|
+
itemTextColor
|
|
19
20
|
} = _ref;
|
|
20
21
|
return applyTextStyles({
|
|
21
22
|
fontWeight: itemFontHeight,
|
|
22
23
|
fontSize: itemFontSize,
|
|
23
24
|
fontName: itemFontName,
|
|
24
|
-
color: itemColor,
|
|
25
|
+
color: itemColor || itemTextColor,
|
|
25
26
|
themeOptions,
|
|
26
27
|
lineHeight: itemLineHeight
|
|
27
28
|
});
|
|
@@ -35,10 +36,11 @@ const selectItemCounterStyles = _ref2 => {
|
|
|
35
36
|
itemFontName,
|
|
36
37
|
itemLineHeight,
|
|
37
38
|
themeOptions,
|
|
38
|
-
itemColor
|
|
39
|
+
itemColor,
|
|
40
|
+
itemTextColor
|
|
39
41
|
} = _ref2;
|
|
40
42
|
return {
|
|
41
|
-
color: itemColor,
|
|
43
|
+
color: itemColor || itemTextColor,
|
|
42
44
|
width: itemBulletContainerWidth,
|
|
43
45
|
textAlign: itemBulletTextAlign,
|
|
44
46
|
...applyTextStyles({
|
|
@@ -76,7 +78,7 @@ const Item = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
76
78
|
const headingTokens = title && {
|
|
77
79
|
lineHeight: themeTokens.itemLineHeight,
|
|
78
80
|
fontSize: themeTokens.itemFontSize,
|
|
79
|
-
color: themeTokens.itemColor,
|
|
81
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
80
82
|
fontName: themeTokens.headerFontName,
|
|
81
83
|
fontWeight: themeTokens.headerFontWeight
|
|
82
84
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { htmlAttrs, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
3
|
+
import { htmlAttrs, selectSystemProps, variantProp, viewProps, getTokensPropType } from '../utils';
|
|
4
4
|
import OrderedListBase from './OrderedListBase';
|
|
5
5
|
import Item from './Item';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -10,29 +10,36 @@ const OrderedList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
10
10
|
children,
|
|
11
11
|
start = 1,
|
|
12
12
|
variant = {},
|
|
13
|
+
tokens = {},
|
|
13
14
|
...rest
|
|
14
15
|
} = _ref;
|
|
16
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
15
17
|
const childrenWithParentVariants = React.useMemo(() => {
|
|
16
|
-
const
|
|
17
|
-
var _child$props;
|
|
18
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
19
|
+
var _child$props, _child$props2;
|
|
18
20
|
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
21
|
+
const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
|
|
19
22
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
20
23
|
index: start + i,
|
|
21
24
|
isLastChild,
|
|
22
25
|
variant: {
|
|
23
26
|
...existingChildVariants,
|
|
24
27
|
...variant
|
|
28
|
+
},
|
|
29
|
+
tokens: {
|
|
30
|
+
...existingChildTokens,
|
|
31
|
+
...tokens
|
|
25
32
|
}
|
|
26
33
|
});
|
|
27
34
|
};
|
|
28
|
-
if (variant) {
|
|
35
|
+
if (variant || tokens) {
|
|
29
36
|
if (Array.isArray(children)) {
|
|
30
|
-
return children.map((child, i) =>
|
|
37
|
+
return children.map((child, i) => addVariantAndTokensToProps(child, i, i === children.length - 1));
|
|
31
38
|
}
|
|
32
|
-
return [
|
|
39
|
+
return [addVariantAndTokensToProps(children, 0, true)];
|
|
33
40
|
}
|
|
34
41
|
return children;
|
|
35
|
-
}, [children, variant, start]);
|
|
42
|
+
}, [children, variant, start, tokens]);
|
|
36
43
|
return /*#__PURE__*/_jsx(OrderedListBase, {
|
|
37
44
|
ref: ref,
|
|
38
45
|
...selectProps(rest),
|
|
@@ -49,7 +56,8 @@ OrderedList.propTypes = {
|
|
|
49
56
|
* The position to start the list with.
|
|
50
57
|
*/
|
|
51
58
|
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
-
variant: variantProp.propType
|
|
59
|
+
variant: variantProp.propType,
|
|
60
|
+
tokens: getTokensPropType('OrderedList')
|
|
53
61
|
};
|
|
54
62
|
OrderedList.displayName = 'OrderedList';
|
|
55
63
|
OrderedList.Item = Item;
|
|
@@ -12,6 +12,8 @@ const Picker = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
12
12
|
onBlur,
|
|
13
13
|
onMouseOver,
|
|
14
14
|
onMouseOut,
|
|
15
|
+
onOpen = () => {},
|
|
16
|
+
onClose = () => {},
|
|
15
17
|
style,
|
|
16
18
|
inactive,
|
|
17
19
|
children,
|
|
@@ -26,29 +28,44 @@ const Picker = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
26
28
|
accessibilityDescribedBy,
|
|
27
29
|
accessibilityInvalid
|
|
28
30
|
} = rest;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
disabled:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
return (
|
|
32
|
+
/*#__PURE__*/
|
|
33
|
+
/**
|
|
34
|
+
* The onOpen and onClose methods are to call the new active variant that changes the icon of the select,
|
|
35
|
+
* onOpen when the select is open and onClose when the select is closed, onOpen is in the event onMousedown
|
|
36
|
+
* when is selected and oClose is in onMouseOut and onChange when the select is closed.
|
|
37
|
+
*/
|
|
38
|
+
_jsxs("select", {
|
|
39
|
+
ref: ref,
|
|
40
|
+
style: style,
|
|
41
|
+
onMouseOver: onMouseOver,
|
|
42
|
+
onMouseOut: () => {
|
|
43
|
+
onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut();
|
|
44
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
45
|
+
},
|
|
46
|
+
onFocus: onFocus,
|
|
47
|
+
onBlur: onBlur,
|
|
48
|
+
onMouseDown: onOpen,
|
|
49
|
+
disabled: inactive,
|
|
50
|
+
value: value || (placeholder !== undefined ? placeholder.value : undefined),
|
|
51
|
+
onChange: event => {
|
|
52
|
+
onClose();
|
|
53
|
+
onChange(event.target.value, event);
|
|
54
|
+
},
|
|
55
|
+
id: nativeID,
|
|
56
|
+
"aria-label": accessibilityLabel,
|
|
57
|
+
"aria-describedby": accessibilityDescribedBy,
|
|
58
|
+
"aria-invalid": accessibilityInvalid,
|
|
59
|
+
"data-testid": testID,
|
|
60
|
+
...selectedProps,
|
|
61
|
+
children: [placeholder !== undefined && /*#__PURE__*/_jsx("option", {
|
|
62
|
+
value: placeholder.value,
|
|
63
|
+
disabled: true,
|
|
64
|
+
hidden: true,
|
|
65
|
+
children: placeholder.label
|
|
66
|
+
}), children]
|
|
67
|
+
})
|
|
68
|
+
);
|
|
52
69
|
});
|
|
53
70
|
Picker.displayName = 'Picker';
|
|
54
71
|
export default Picker;
|
|
@@ -60,6 +77,14 @@ Picker.propTypes = {
|
|
|
60
77
|
onBlur: PropTypes.func,
|
|
61
78
|
onMouseOver: PropTypes.func,
|
|
62
79
|
onMouseOut: PropTypes.func,
|
|
80
|
+
/**
|
|
81
|
+
* It executes when the select choices are open
|
|
82
|
+
*/
|
|
83
|
+
onOpen: PropTypes.func,
|
|
84
|
+
/**
|
|
85
|
+
* It executes when the select choices are closed
|
|
86
|
+
*/
|
|
87
|
+
onClose: PropTypes.func,
|
|
63
88
|
style: PropTypes.object,
|
|
64
89
|
inactive: PropTypes.bool,
|
|
65
90
|
children: componentPropType(['Item', 'Group']),
|
|
@@ -211,6 +211,7 @@ const Select = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
211
211
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
212
212
|
const handleMouseOver = () => setIsHovered(true);
|
|
213
213
|
const handleMouseOut = () => setIsHovered(false);
|
|
214
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
214
215
|
const {
|
|
215
216
|
supportsProps,
|
|
216
217
|
...selectedProps
|
|
@@ -219,6 +220,7 @@ const Select = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
219
220
|
focus: isFocused,
|
|
220
221
|
hover: isHovered,
|
|
221
222
|
inactive,
|
|
223
|
+
active: isOpen,
|
|
222
224
|
validation
|
|
223
225
|
});
|
|
224
226
|
const {
|
|
@@ -247,6 +249,8 @@ const Select = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
247
249
|
onBlur: handleBlur,
|
|
248
250
|
onMouseOver: handleMouseOver,
|
|
249
251
|
onMouseOut: handleMouseOut,
|
|
252
|
+
onOpen: () => setIsOpen(true),
|
|
253
|
+
onClose: () => setIsOpen(false),
|
|
250
254
|
onChange: e => setValue(e, null),
|
|
251
255
|
value: currentValue,
|
|
252
256
|
inactive: inactive,
|
|
@@ -13,7 +13,7 @@ import dictionary from './dictionary';
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
|
|
16
|
-
const selectInputStyles = (_ref, themeOptions, inactive, type)
|
|
16
|
+
const selectInputStyles = function (_ref, themeOptions, inactive, type) {
|
|
17
17
|
let {
|
|
18
18
|
backgroundColor,
|
|
19
19
|
color,
|
|
@@ -29,12 +29,15 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
29
29
|
fontWeight,
|
|
30
30
|
lineHeight,
|
|
31
31
|
icon,
|
|
32
|
-
iconSize = 0,
|
|
33
32
|
minLines,
|
|
34
33
|
maxLines,
|
|
35
34
|
width,
|
|
36
35
|
height
|
|
37
36
|
} = _ref;
|
|
37
|
+
let buttonCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
38
|
+
let buttonSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
39
|
+
let buttonsGapSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
40
|
+
let isPassword = arguments.length > 7 ? arguments[7] : undefined;
|
|
38
41
|
// Subtract border width from padding so overall input width/height doesn't
|
|
39
42
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
40
43
|
const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -61,7 +64,10 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
66
|
|
|
64
|
-
const
|
|
67
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize;
|
|
68
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing);
|
|
69
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight;
|
|
70
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight;
|
|
65
71
|
return {
|
|
66
72
|
backgroundColor,
|
|
67
73
|
color,
|
|
@@ -69,7 +75,7 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
69
75
|
borderColor,
|
|
70
76
|
borderRadius,
|
|
71
77
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
72
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
78
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
73
79
|
paddingTop: offsetBorder(paddingTop),
|
|
74
80
|
paddingBottom: offsetBorder(paddingBottom),
|
|
75
81
|
minHeight,
|
|
@@ -337,7 +343,7 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
337
343
|
const nativeInputStyle = selectInputStyles({
|
|
338
344
|
...themeTokens,
|
|
339
345
|
height
|
|
340
|
-
}, themeOptions, inactive, type);
|
|
346
|
+
}, themeOptions, inactive, type, buttons === null || buttons === void 0 ? void 0 : buttons.length, themeTokens.buttonSize, buttonsGapSize, isPassword);
|
|
341
347
|
return /*#__PURE__*/_jsxs(View, {
|
|
342
348
|
style: selectOuterBorderStyles(themeTokens),
|
|
343
349
|
children: [type === 'card' && /*#__PURE__*/_jsx(View, {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.3.0",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.62.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"css-mediaquery": "^0.1.2",
|
|
17
17
|
"expo-linear-gradient": "^12.5.0",
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"standard-engine": {
|
|
86
86
|
"skip": true
|
|
87
87
|
},
|
|
88
|
-
"version": "1.
|
|
88
|
+
"version": "1.92.0",
|
|
89
89
|
"types": "types/index.d.ts"
|
|
90
90
|
}
|
|
@@ -35,7 +35,11 @@ const CarouselTabsPanel = React.forwardRef(({ items }, ref) => {
|
|
|
35
35
|
<StackView
|
|
36
36
|
direction="row"
|
|
37
37
|
space={3}
|
|
38
|
-
divider={{
|
|
38
|
+
divider={{
|
|
39
|
+
variant: dividerVariant,
|
|
40
|
+
accessibilityRole: 'presentation',
|
|
41
|
+
accessibilityOrientation: null
|
|
42
|
+
}}
|
|
39
43
|
ref={ref}
|
|
40
44
|
accessibilityRole="tablist"
|
|
41
45
|
>
|
|
@@ -57,6 +57,7 @@ const MultiSelectFilter = React.forwardRef(
|
|
|
57
57
|
onChange,
|
|
58
58
|
onConfirm = () => {},
|
|
59
59
|
onCancel = () => {},
|
|
60
|
+
onOpen = () => {},
|
|
60
61
|
copy = 'en',
|
|
61
62
|
readOnly = false,
|
|
62
63
|
inactive = false,
|
|
@@ -124,6 +125,7 @@ const MultiSelectFilter = React.forwardRef(
|
|
|
124
125
|
|
|
125
126
|
const handleChange = (event) => {
|
|
126
127
|
if (pressHandlers.onPress) pressHandlers?.onPress(event)
|
|
128
|
+
if (isOpen) onOpen()
|
|
127
129
|
setIsOpen(!isOpen)
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -406,6 +408,10 @@ MultiSelectFilter.propTypes = {
|
|
|
406
408
|
* If provided, this function is called when the selection is confirmed.
|
|
407
409
|
*/
|
|
408
410
|
onConfirm: PropTypes.func,
|
|
411
|
+
/**
|
|
412
|
+
* If provided, this function is called when the modal with options is opened.
|
|
413
|
+
* */
|
|
414
|
+
onOpen: PropTypes.func,
|
|
409
415
|
/**
|
|
410
416
|
* If provided, this function is called when `MultiSelectFilter` is closed.
|
|
411
417
|
* */
|
package/src/OrderedList/Item.jsx
CHANGED
|
@@ -17,14 +17,14 @@ import ItemBase from './ItemBase'
|
|
|
17
17
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
18
18
|
|
|
19
19
|
const selectItemTextStyles = (
|
|
20
|
-
{ itemFontHeight, itemFontSize, itemLineHeight, itemFontName, itemColor },
|
|
20
|
+
{ itemFontHeight, itemFontSize, itemLineHeight, itemFontName, itemColor, itemTextColor },
|
|
21
21
|
themeOptions
|
|
22
22
|
) =>
|
|
23
23
|
applyTextStyles({
|
|
24
24
|
fontWeight: itemFontHeight,
|
|
25
25
|
fontSize: itemFontSize,
|
|
26
26
|
fontName: itemFontName,
|
|
27
|
-
color: itemColor,
|
|
27
|
+
color: itemColor || itemTextColor,
|
|
28
28
|
themeOptions,
|
|
29
29
|
lineHeight: itemLineHeight
|
|
30
30
|
})
|
|
@@ -37,9 +37,10 @@ const selectItemCounterStyles = ({
|
|
|
37
37
|
itemFontName,
|
|
38
38
|
itemLineHeight,
|
|
39
39
|
themeOptions,
|
|
40
|
-
itemColor
|
|
40
|
+
itemColor,
|
|
41
|
+
itemTextColor
|
|
41
42
|
}) => ({
|
|
42
|
-
color: itemColor,
|
|
43
|
+
color: itemColor || itemTextColor,
|
|
43
44
|
width: itemBulletContainerWidth,
|
|
44
45
|
textAlign: itemBulletTextAlign,
|
|
45
46
|
...applyTextStyles({
|
|
@@ -63,7 +64,7 @@ const Item = React.forwardRef(
|
|
|
63
64
|
const headingTokens = title && {
|
|
64
65
|
lineHeight: themeTokens.itemLineHeight,
|
|
65
66
|
fontSize: themeTokens.itemFontSize,
|
|
66
|
-
color: themeTokens.itemColor,
|
|
67
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
67
68
|
fontName: themeTokens.headerFontName,
|
|
68
69
|
fontWeight: themeTokens.headerFontWeight
|
|
69
70
|
}
|
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import { htmlAttrs, selectSystemProps, variantProp, viewProps } from '../utils'
|
|
4
|
+
import { htmlAttrs, selectSystemProps, variantProp, viewProps, getTokensPropType } from '../utils'
|
|
5
5
|
import OrderedListBase from './OrderedListBase'
|
|
6
6
|
import Item from './Item'
|
|
7
7
|
|
|
8
8
|
const [selectProps, selectedSystemPropsTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
9
9
|
|
|
10
|
-
const OrderedList = React.forwardRef(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const OrderedList = React.forwardRef(
|
|
11
|
+
({ children, start = 1, variant = {}, tokens = {}, ...rest }, ref) => {
|
|
12
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
13
|
+
const childrenWithParentVariants = React.useMemo(() => {
|
|
14
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
15
|
+
const existingChildVariants = child.props?.variant ?? {}
|
|
16
|
+
const existingChildTokens = child.props?.tokens ?? {}
|
|
17
|
+
|
|
18
|
+
return React.cloneElement(child, {
|
|
19
|
+
index: start + i,
|
|
20
|
+
isLastChild,
|
|
21
|
+
variant: { ...existingChildVariants, ...variant },
|
|
22
|
+
tokens: { ...existingChildTokens, ...tokens }
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (variant || tokens) {
|
|
27
|
+
if (Array.isArray(children)) {
|
|
28
|
+
return children.map((child, i) =>
|
|
29
|
+
addVariantAndTokensToProps(child, i, i === children.length - 1)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
return [addVariantAndTokensToProps(children, 0, true)]
|
|
24
33
|
}
|
|
25
|
-
return [addVariantToProps(children, 0, true)]
|
|
26
|
-
}
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
return children
|
|
36
|
+
}, [children, variant, start, tokens])
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
38
|
+
return (
|
|
39
|
+
<OrderedListBase ref={ref} {...selectProps(rest)}>
|
|
40
|
+
{childrenWithParentVariants}
|
|
41
|
+
</OrderedListBase>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
)
|
|
37
45
|
|
|
38
46
|
OrderedList.propTypes = {
|
|
39
47
|
...selectedSystemPropsTypes,
|
|
@@ -45,7 +53,8 @@ OrderedList.propTypes = {
|
|
|
45
53
|
* The position to start the list with.
|
|
46
54
|
*/
|
|
47
55
|
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
48
|
-
variant: variantProp.propType
|
|
56
|
+
variant: variantProp.propType,
|
|
57
|
+
tokens: getTokensPropType('OrderedList')
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
OrderedList.displayName = 'OrderedList'
|
package/src/Select/Picker.jsx
CHANGED
|
@@ -14,6 +14,8 @@ const Picker = React.forwardRef(
|
|
|
14
14
|
onBlur,
|
|
15
15
|
onMouseOver,
|
|
16
16
|
onMouseOut,
|
|
17
|
+
onOpen = () => {},
|
|
18
|
+
onClose = () => {},
|
|
17
19
|
style,
|
|
18
20
|
inactive,
|
|
19
21
|
children,
|
|
@@ -28,16 +30,28 @@ const Picker = React.forwardRef(
|
|
|
28
30
|
const { accessibilityLabel, accessibilityDescribedBy, accessibilityInvalid } = rest
|
|
29
31
|
|
|
30
32
|
return (
|
|
33
|
+
/**
|
|
34
|
+
* The onOpen and onClose methods are to call the new active variant that changes the icon of the select,
|
|
35
|
+
* onOpen when the select is open and onClose when the select is closed, onOpen is in the event onMousedown
|
|
36
|
+
* when is selected and oClose is in onMouseOut and onChange when the select is closed.
|
|
37
|
+
*/
|
|
31
38
|
<select
|
|
32
39
|
ref={ref}
|
|
33
40
|
style={style}
|
|
34
41
|
onMouseOver={onMouseOver}
|
|
35
|
-
onMouseOut={
|
|
42
|
+
onMouseOut={() => {
|
|
43
|
+
onMouseOut?.()
|
|
44
|
+
onClose?.()
|
|
45
|
+
}}
|
|
36
46
|
onFocus={onFocus}
|
|
37
47
|
onBlur={onBlur}
|
|
48
|
+
onMouseDown={onOpen}
|
|
38
49
|
disabled={inactive}
|
|
39
50
|
value={value || (placeholder !== undefined ? placeholder.value : undefined)}
|
|
40
|
-
onChange={(event) =>
|
|
51
|
+
onChange={(event) => {
|
|
52
|
+
onClose()
|
|
53
|
+
onChange(event.target.value, event)
|
|
54
|
+
}}
|
|
41
55
|
id={nativeID}
|
|
42
56
|
aria-label={accessibilityLabel}
|
|
43
57
|
aria-describedby={accessibilityDescribedBy}
|
|
@@ -67,6 +81,14 @@ Picker.propTypes = {
|
|
|
67
81
|
onBlur: PropTypes.func,
|
|
68
82
|
onMouseOver: PropTypes.func,
|
|
69
83
|
onMouseOut: PropTypes.func,
|
|
84
|
+
/**
|
|
85
|
+
* It executes when the select choices are open
|
|
86
|
+
*/
|
|
87
|
+
onOpen: PropTypes.func,
|
|
88
|
+
/**
|
|
89
|
+
* It executes when the select choices are closed
|
|
90
|
+
*/
|
|
91
|
+
onClose: PropTypes.func,
|
|
70
92
|
style: PropTypes.object,
|
|
71
93
|
inactive: PropTypes.bool,
|
|
72
94
|
children: componentPropType(['Item', 'Group']),
|
package/src/Select/Select.jsx
CHANGED
|
@@ -214,12 +214,15 @@ const Select = React.forwardRef(
|
|
|
214
214
|
const handleMouseOver = () => setIsHovered(true)
|
|
215
215
|
const handleMouseOut = () => setIsHovered(false)
|
|
216
216
|
|
|
217
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
218
|
+
|
|
217
219
|
const { supportsProps, ...selectedProps } = selectProps(rest)
|
|
218
220
|
|
|
219
221
|
const themeTokens = useThemeTokens('Select', tokens, variant, {
|
|
220
222
|
focus: isFocused,
|
|
221
223
|
hover: isHovered,
|
|
222
224
|
inactive,
|
|
225
|
+
active: isOpen,
|
|
223
226
|
validation
|
|
224
227
|
})
|
|
225
228
|
|
|
@@ -243,6 +246,8 @@ const Select = React.forwardRef(
|
|
|
243
246
|
onBlur={handleBlur}
|
|
244
247
|
onMouseOver={handleMouseOver}
|
|
245
248
|
onMouseOut={handleMouseOut}
|
|
249
|
+
onOpen={() => setIsOpen(true)}
|
|
250
|
+
onClose={() => setIsOpen(false)}
|
|
246
251
|
onChange={(e) => setValue(e, null)}
|
|
247
252
|
value={currentValue}
|
|
248
253
|
inactive={inactive}
|
|
@@ -42,7 +42,6 @@ const selectInputStyles = (
|
|
|
42
42
|
fontWeight,
|
|
43
43
|
lineHeight,
|
|
44
44
|
icon,
|
|
45
|
-
iconSize = 0,
|
|
46
45
|
minLines,
|
|
47
46
|
maxLines,
|
|
48
47
|
width,
|
|
@@ -50,7 +49,11 @@ const selectInputStyles = (
|
|
|
50
49
|
},
|
|
51
50
|
themeOptions,
|
|
52
51
|
inactive,
|
|
53
|
-
type
|
|
52
|
+
type,
|
|
53
|
+
buttonCount = 0,
|
|
54
|
+
buttonSize = 0,
|
|
55
|
+
buttonsGapSize = 0,
|
|
56
|
+
isPassword
|
|
54
57
|
) => {
|
|
55
58
|
// Subtract border width from padding so overall input width/height doesn't
|
|
56
59
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
@@ -82,7 +85,10 @@ const selectInputStyles = (
|
|
|
82
85
|
}
|
|
83
86
|
})
|
|
84
87
|
|
|
85
|
-
const
|
|
88
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize
|
|
89
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing)
|
|
90
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight
|
|
91
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight
|
|
86
92
|
|
|
87
93
|
return {
|
|
88
94
|
backgroundColor,
|
|
@@ -91,7 +97,7 @@ const selectInputStyles = (
|
|
|
91
97
|
borderColor,
|
|
92
98
|
borderRadius,
|
|
93
99
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
94
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
100
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
95
101
|
paddingTop: offsetBorder(paddingTop),
|
|
96
102
|
paddingBottom: offsetBorder(paddingBottom),
|
|
97
103
|
minHeight,
|
|
@@ -321,7 +327,11 @@ const TextInputBase = React.forwardRef(
|
|
|
321
327
|
{ ...themeTokens, height },
|
|
322
328
|
themeOptions,
|
|
323
329
|
inactive,
|
|
324
|
-
type
|
|
330
|
+
type,
|
|
331
|
+
buttons?.length,
|
|
332
|
+
themeTokens.buttonSize,
|
|
333
|
+
buttonsGapSize,
|
|
334
|
+
isPassword
|
|
325
335
|
)
|
|
326
336
|
|
|
327
337
|
return (
|