@telus-uds/components-base 3.12.1 → 3.13.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/cjs/Button/ButtonDropdown.js +105 -12
- package/lib/cjs/Carousel/Carousel.js +26 -0
- package/lib/cjs/Carousel/CarouselContext.js +7 -4
- package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +13 -2
- package/lib/cjs/Carousel/Constants.js +2 -1
- package/lib/cjs/ExpandCollapse/ExpandCollapse.js +3 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMiniControl.js +30 -6
- package/lib/cjs/FlexGrid/FlexGrid.js +54 -5
- package/lib/cjs/Icon/Icon.js +3 -1
- package/lib/cjs/InputLabel/InputLabel.js +1 -1
- package/lib/cjs/InputSupports/InputSupports.js +1 -1
- package/lib/cjs/Notification/Notification.js +27 -8
- package/lib/cjs/utils/props/inputSupportsProps.js +1 -1
- package/lib/esm/Button/ButtonDropdown.js +107 -14
- package/lib/esm/Carousel/Carousel.js +27 -1
- package/lib/esm/Carousel/CarouselContext.js +7 -4
- package/lib/esm/Carousel/CarouselItem/CarouselItem.js +13 -2
- package/lib/esm/Carousel/Constants.js +1 -0
- package/lib/esm/ExpandCollapse/ExpandCollapse.js +4 -2
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +2 -2
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMiniControl.js +30 -6
- package/lib/esm/FlexGrid/FlexGrid.js +55 -6
- package/lib/esm/Icon/Icon.js +3 -1
- package/lib/esm/InputLabel/InputLabel.js +1 -1
- package/lib/esm/InputSupports/InputSupports.js +1 -1
- package/lib/esm/Notification/Notification.js +27 -8
- package/lib/esm/utils/props/inputSupportsProps.js +1 -1
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Button/ButtonDropdown.jsx +109 -16
- package/src/Carousel/Carousel.jsx +30 -0
- package/src/Carousel/CarouselContext.jsx +17 -4
- package/src/Carousel/CarouselItem/CarouselItem.jsx +17 -2
- package/src/Carousel/Constants.js +1 -0
- package/src/ExpandCollapse/ExpandCollapse.jsx +5 -2
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +2 -2
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +39 -9
- package/src/FlexGrid/FlexGrid.jsx +62 -6
- package/src/Icon/Icon.jsx +3 -1
- package/src/InputLabel/InputLabel.jsx +1 -1
- package/src/InputSupports/InputSupports.jsx +1 -1
- package/src/Notification/Notification.jsx +58 -9
- package/src/utils/props/inputSupportsProps.js +1 -1
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 Fri, 15 Aug 2025 00:45:23 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.13.0
|
|
8
|
+
|
|
9
|
+
Fri, 15 Aug 2025 00:45:23 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `Carousel`: add new stories & documentation (sergio.ramirez@telus.com)
|
|
14
|
+
- `Notification`: Add `contentMinWidth` prop for system variant (guillermo.peitzner@telus.com)
|
|
15
|
+
- `FlexGrid`: add min-content-width prop (guillermo.peitzner@telus.com)
|
|
16
|
+
- `Checkbox`: Update storybook to add description to the component (sergio.ramirez@telus.com)
|
|
17
|
+
- `ButtonDropdown`: add lead icon props and new variants (guillermo.peitzner@telus.com)
|
|
18
|
+
- Bump @telus-uds/system-theme-tokens to v4.12.0
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- `ExpandCollapseMini` fix design & animations (sergio.ramirez@telus.com)
|
|
23
|
+
- Invalid argument supplied to oneOfType issue fixed (35577399+JoshHC@users.noreply.github.com)
|
|
24
|
+
|
|
25
|
+
## 3.12.2
|
|
26
|
+
|
|
27
|
+
Fri, 25 Jul 2025 04:13:56 GMT
|
|
28
|
+
|
|
29
|
+
### Patches
|
|
30
|
+
|
|
31
|
+
- `Carousel`: fix tab navigation (guillermo.peitzner@telus.com)
|
|
32
|
+
- Bump @telus-uds/system-theme-tokens to v4.11.0
|
|
33
|
+
|
|
7
34
|
## 3.12.1
|
|
8
35
|
|
|
9
|
-
Wed, 16 Jul 2025 15:
|
|
36
|
+
Wed, 16 Jul 2025 15:18:31 GMT
|
|
10
37
|
|
|
11
38
|
### Patches
|
|
12
39
|
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
10
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
10
11
|
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
11
12
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
12
13
|
var _propTypes2 = _interopRequireWildcard(require("./propTypes"));
|
|
@@ -14,12 +15,12 @@ var _ButtonBase = _interopRequireDefault(require("./ButtonBase"));
|
|
|
14
15
|
var _ThemeProvider = require("../ThemeProvider");
|
|
15
16
|
var _utils = require("../utils");
|
|
16
17
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
17
|
-
var _StackView = require("../StackView");
|
|
18
18
|
var _pressability = require("../utils/pressability");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
const FULL_WIDTH_STYLE = 'full';
|
|
23
24
|
const selectIconTokens = _ref => {
|
|
24
25
|
let {
|
|
25
26
|
icon,
|
|
@@ -58,6 +59,44 @@ const selectIconTokens = _ref => {
|
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
};
|
|
62
|
+
const selectDescriptionTextStyles = tokens => ({
|
|
63
|
+
...(0, _ThemeProvider.applyTextStyles)({
|
|
64
|
+
fontName: tokens?.descriptionFontName,
|
|
65
|
+
fontSize: tokens?.descriptionFontSize,
|
|
66
|
+
fontWeight: tokens?.descriptionFontWeight,
|
|
67
|
+
fontColor: tokens?.color
|
|
68
|
+
}),
|
|
69
|
+
paddingBottom: tokens?.descriptionTextPaddingBottom
|
|
70
|
+
});
|
|
71
|
+
const selectLeadIconTokens = tokens => ({
|
|
72
|
+
color: tokens?.leadIconColor,
|
|
73
|
+
backgroundColor: tokens?.leadIconBackgroundColor,
|
|
74
|
+
size: tokens?.leadIconSize,
|
|
75
|
+
borderRadius: tokens?.leadIconBorderRadius,
|
|
76
|
+
padding: tokens?.leadIconPadding
|
|
77
|
+
});
|
|
78
|
+
const selectLeadIconContainerStyles = tokens => ({
|
|
79
|
+
paddingTop: tokens?.leadIconContainerPaddingTop,
|
|
80
|
+
paddingBottom: tokens?.leadIconContainerPaddingBottom,
|
|
81
|
+
paddingLeft: tokens?.leadIconContainerPaddingLeft,
|
|
82
|
+
paddingRight: tokens?.leadIconContainerPaddingRight
|
|
83
|
+
});
|
|
84
|
+
const selectTextContainerStyles = tokens => ({
|
|
85
|
+
paddingLeft: tokens?.textPaddingLeft,
|
|
86
|
+
paddingRight: tokens?.textPaddingRight
|
|
87
|
+
});
|
|
88
|
+
const selectStackedContentStyles = (tokens, iconPosition, isFullWidth) => ({
|
|
89
|
+
...staticStyles.stackedContent,
|
|
90
|
+
gap: tokens?.iconSpace,
|
|
91
|
+
flexDirection: iconPosition === 'left' ? 'row' : 'row-reverse',
|
|
92
|
+
...(_Platform.default.OS === 'web' && {
|
|
93
|
+
flex: 1
|
|
94
|
+
}),
|
|
95
|
+
...(isFullWidth && {
|
|
96
|
+
justifyContent: 'space-between',
|
|
97
|
+
flex: 1
|
|
98
|
+
})
|
|
99
|
+
});
|
|
61
100
|
const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
62
101
|
let {
|
|
63
102
|
value,
|
|
@@ -70,8 +109,11 @@ const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
70
109
|
readOnly = false,
|
|
71
110
|
children = null,
|
|
72
111
|
accessibilityRole = 'radio',
|
|
112
|
+
description,
|
|
113
|
+
singleOption,
|
|
73
114
|
...props
|
|
74
115
|
} = _ref2;
|
|
116
|
+
const isFullWidth = variant?.width === FULL_WIDTH_STYLE;
|
|
75
117
|
const {
|
|
76
118
|
currentValue: isOpen,
|
|
77
119
|
setValue: setIsOpen
|
|
@@ -87,7 +129,13 @@ const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
87
129
|
...variant
|
|
88
130
|
};
|
|
89
131
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ButtonDropdown', tokens, extraState);
|
|
90
|
-
const getButtonTokens = buttonState => (
|
|
132
|
+
const getButtonTokens = buttonState => ({
|
|
133
|
+
...(0, _utils.selectTokens)('Button', getTokens(buttonState)),
|
|
134
|
+
iconSpace: props?.icon ? getTokens(buttonState)?.iconSpace : 0,
|
|
135
|
+
...(isFullWidth && {
|
|
136
|
+
width: 'full'
|
|
137
|
+
})
|
|
138
|
+
});
|
|
91
139
|
|
|
92
140
|
// Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
93
141
|
const pressHandlers = (0, _pressability.getPressHandlersWithArgs)(props, [{
|
|
@@ -105,7 +153,7 @@ const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
105
153
|
...pressHandlers,
|
|
106
154
|
onPress: handlePress,
|
|
107
155
|
tokens: getButtonTokens,
|
|
108
|
-
inactive: inactive,
|
|
156
|
+
inactive: singleOption || inactive,
|
|
109
157
|
icon: () => null,
|
|
110
158
|
accessibilityRole: accessibilityRole,
|
|
111
159
|
...props,
|
|
@@ -121,14 +169,14 @@ const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
121
169
|
// - Token sets: https://github.com/telus/universal-design-system/issues/782
|
|
122
170
|
|
|
123
171
|
const itemTokens = getTokens(buttonState);
|
|
172
|
+
const leadIcon = itemTokens?.leadIcon;
|
|
124
173
|
const {
|
|
125
174
|
iconTokens,
|
|
126
175
|
iconPosition,
|
|
127
|
-
iconSpace,
|
|
128
176
|
iconWrapperStyle,
|
|
129
177
|
icon: IconComponent
|
|
130
178
|
} = selectIconTokens(itemTokens);
|
|
131
|
-
const iconContent = IconComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
179
|
+
const iconContent = IconComponent && !singleOption ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
132
180
|
style: iconWrapperStyle,
|
|
133
181
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
134
182
|
icon: IconComponent,
|
|
@@ -139,13 +187,28 @@ const ButtonDropdown = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
139
187
|
...(0, _utils.resolvePressableState)(buttonState, extraState),
|
|
140
188
|
textStyles
|
|
141
189
|
}) : children;
|
|
142
|
-
const content = children ? childrenContent() : /*#__PURE__*/(0, _jsxRuntime.
|
|
143
|
-
style:
|
|
144
|
-
children:
|
|
190
|
+
const content = children ? childrenContent() : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
191
|
+
style: staticStyles.contentContainer,
|
|
192
|
+
children: [leadIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
193
|
+
style: selectLeadIconContainerStyles(itemTokens),
|
|
194
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
195
|
+
icon: leadIcon,
|
|
196
|
+
tokens: selectLeadIconTokens(itemTokens)
|
|
197
|
+
})
|
|
198
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
199
|
+
style: [staticStyles.textContainer, selectTextContainerStyles(itemTokens)],
|
|
200
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
201
|
+
style: textStyles,
|
|
202
|
+
children: label
|
|
203
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
204
|
+
style: selectDescriptionTextStyles(itemTokens),
|
|
205
|
+
children: description
|
|
206
|
+
})]
|
|
207
|
+
})]
|
|
145
208
|
});
|
|
146
|
-
return (0,
|
|
147
|
-
|
|
148
|
-
|
|
209
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
210
|
+
style: selectStackedContentStyles(itemTokens, iconPosition, isFullWidth),
|
|
211
|
+
children: [iconContent, content]
|
|
149
212
|
});
|
|
150
213
|
}
|
|
151
214
|
});
|
|
@@ -177,6 +240,36 @@ ButtonDropdown.propTypes = {
|
|
|
177
240
|
/**
|
|
178
241
|
* By default, `ButtonDropdown` is treated by accessibility tools as a radio button.
|
|
179
242
|
*/
|
|
180
|
-
accessibilityRole: _propTypes.default.string
|
|
243
|
+
accessibilityRole: _propTypes.default.string,
|
|
244
|
+
/**
|
|
245
|
+
* The description of ButtonDropdown.
|
|
246
|
+
*/
|
|
247
|
+
description: _propTypes.default.string,
|
|
248
|
+
/**
|
|
249
|
+
* Use this prop to render the ButtonDropdown as display only without any interaction when there is only one option.
|
|
250
|
+
*/
|
|
251
|
+
singleOption: _propTypes.default.bool
|
|
181
252
|
};
|
|
253
|
+
const staticStyles = _StyleSheet.default.create({
|
|
254
|
+
textContainer: {
|
|
255
|
+
alignItems: 'flex-start',
|
|
256
|
+
flexShrink: 1,
|
|
257
|
+
...(_Platform.default.OS === 'web' && {
|
|
258
|
+
flex: 1
|
|
259
|
+
})
|
|
260
|
+
},
|
|
261
|
+
contentContainer: {
|
|
262
|
+
flexDirection: 'row',
|
|
263
|
+
alignContent: 'center',
|
|
264
|
+
alignItems: 'center',
|
|
265
|
+
...(_Platform.default.OS === 'web' && {
|
|
266
|
+
flex: 1
|
|
267
|
+
}),
|
|
268
|
+
flexShrink: 1
|
|
269
|
+
},
|
|
270
|
+
stackedContent: {
|
|
271
|
+
flexDirection: 'row',
|
|
272
|
+
alignItems: 'center'
|
|
273
|
+
}
|
|
274
|
+
});
|
|
182
275
|
var _default = exports.default = ButtonDropdown;
|
|
@@ -172,6 +172,31 @@ const getTotalItems = (enableDisplayMultipleItemsPerSlide, childrenArray, viewpo
|
|
|
172
172
|
}
|
|
173
173
|
return childrenArray.length;
|
|
174
174
|
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Determines the maximum number of items that can be displayed per slide based on viewport
|
|
178
|
+
*
|
|
179
|
+
* @param {boolean} enableDisplayMultipleItemsPerSlide - Flag indicating whether multiple items per slide is enabled
|
|
180
|
+
* @param {string} viewport - The current viewport size ('xs', 'sm', 'md', 'lg', 'xl')
|
|
181
|
+
* @returns {number} The maximum number of items that can be displayed per slide
|
|
182
|
+
*/
|
|
183
|
+
const getMaximumItemsForSlide = (enableDisplayMultipleItemsPerSlide, viewport) => {
|
|
184
|
+
if (enableDisplayMultipleItemsPerSlide) {
|
|
185
|
+
switch (viewport) {
|
|
186
|
+
case 'xs':
|
|
187
|
+
case 'sm':
|
|
188
|
+
return _Constants.ITEMS_PER_VIEWPORT_XS_SM;
|
|
189
|
+
case 'md':
|
|
190
|
+
return _Constants.ITEMS_PER_VIEWPORT_MD;
|
|
191
|
+
case 'lg':
|
|
192
|
+
case 'xl':
|
|
193
|
+
return _Constants.ITEMS_PER_VIEWPORT_LG_XL;
|
|
194
|
+
default:
|
|
195
|
+
return _Constants.ITEMS_PER_VIEWPORT_XS_SM;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return _Constants.ITEMS_PER_VIEWPORT_XS_SM;
|
|
199
|
+
};
|
|
175
200
|
const selectRootContainerStyles = (enableHero, viewport) => {
|
|
176
201
|
if (enableHero && viewport === 'xl' && _Platform.default.OS === 'web') {
|
|
177
202
|
return {
|
|
@@ -867,6 +892,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
867
892
|
firstFocusRef: firstFocusRef,
|
|
868
893
|
refocus: refocus,
|
|
869
894
|
width: containerLayout.width,
|
|
895
|
+
maximumItemsForSlide: getMaximumItemsForSlide(enableDisplayMultipleItemsPerSlide, viewport),
|
|
870
896
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
871
897
|
style: [staticStyles.root, {
|
|
872
898
|
...(_Platform.default.OS === 'web' ? {
|
|
@@ -21,7 +21,8 @@ const CarouselProvider = _ref => {
|
|
|
21
21
|
refocus = false,
|
|
22
22
|
themeTokens,
|
|
23
23
|
totalItems,
|
|
24
|
-
width
|
|
24
|
+
width,
|
|
25
|
+
maximumItemsForSlide
|
|
25
26
|
} = _ref;
|
|
26
27
|
const value = _react.default.useMemo(() => ({
|
|
27
28
|
activeIndex,
|
|
@@ -31,8 +32,9 @@ const CarouselProvider = _ref => {
|
|
|
31
32
|
refocus,
|
|
32
33
|
themeTokens,
|
|
33
34
|
totalItems,
|
|
34
|
-
width
|
|
35
|
-
|
|
35
|
+
width,
|
|
36
|
+
maximumItemsForSlide
|
|
37
|
+
}), [activeIndex, goTo, getCopyWithPlaceholders, itemLabel, refocus, totalItems, themeTokens, width, maximumItemsForSlide]);
|
|
36
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CarouselContext.Provider, {
|
|
37
39
|
value: value,
|
|
38
40
|
children: children
|
|
@@ -55,5 +57,6 @@ CarouselProvider.propTypes = {
|
|
|
55
57
|
refocus: _propTypes.default.bool,
|
|
56
58
|
themeTokens: (0, _utils.getTokensPropType)('Carousel'),
|
|
57
59
|
totalItems: _propTypes.default.number.isRequired,
|
|
58
|
-
width: _propTypes.default.number.isRequired
|
|
60
|
+
width: _propTypes.default.number.isRequired,
|
|
61
|
+
maximumItemsForSlide: _propTypes.default.number
|
|
59
62
|
};
|
|
@@ -94,13 +94,23 @@ const CarouselItem = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
94
94
|
} = _ref2;
|
|
95
95
|
const {
|
|
96
96
|
width,
|
|
97
|
-
activeIndex
|
|
97
|
+
activeIndex,
|
|
98
|
+
goTo,
|
|
99
|
+
maximumItemsForSlide
|
|
98
100
|
} = (0, _CarouselContext.useCarousel)();
|
|
99
101
|
const selectedProps = selectProps({
|
|
100
102
|
...rest,
|
|
101
103
|
...(0, _utils.getA11yPropsFromHtmlTag)(tag, rest.accessibilityRole)
|
|
102
104
|
});
|
|
103
|
-
const focusabilityProps = activeIndex === elementIndex ? {} : _utils.a11yProps.nonFocusableProps;
|
|
105
|
+
const focusabilityProps = activeIndex === elementIndex || enablePeeking ? {} : _utils.a11yProps.nonFocusableProps;
|
|
106
|
+
const handleFocus = _react.default.useCallback(event => {
|
|
107
|
+
if (_Platform.default.OS === 'web' && elementIndex >= maximumItemsForSlide * (activeIndex + 1)) {
|
|
108
|
+
goTo(activeIndex + 1);
|
|
109
|
+
}
|
|
110
|
+
if (rest.onFocus) {
|
|
111
|
+
rest.onFocus(event);
|
|
112
|
+
}
|
|
113
|
+
}, [elementIndex, activeIndex, goTo, maximumItemsForSlide, rest]);
|
|
104
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
105
115
|
style: selectContainerStyle({
|
|
106
116
|
width,
|
|
@@ -114,6 +124,7 @@ const CarouselItem = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
114
124
|
...selectedProps,
|
|
115
125
|
...focusabilityProps,
|
|
116
126
|
ref: ref,
|
|
127
|
+
onFocus: handleFocus,
|
|
117
128
|
children: children
|
|
118
129
|
});
|
|
119
130
|
});
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PEEKING_MULTIPLIER = exports.NEGATIVE_MULTIPLIER = exports.LARGE_VIEWPORT_MARGIN = exports.ITEMS_PER_VIEWPORT_MD = exports.ITEMS_PER_VIEWPORT_LG_XL = exports.HERO_POSITION_OFFSET = exports.GAP_BETWEEN_ITEMS = exports.DEFAULT_VIEWPORT_MARGIN = exports.DEFAULT_POSITION_OFFSET = exports.ACTIVE_INDEX_OFFSET_MULTIPLIER = void 0;
|
|
6
|
+
exports.PEEKING_MULTIPLIER = exports.NEGATIVE_MULTIPLIER = exports.LARGE_VIEWPORT_MARGIN = exports.ITEMS_PER_VIEWPORT_XS_SM = exports.ITEMS_PER_VIEWPORT_MD = exports.ITEMS_PER_VIEWPORT_LG_XL = exports.HERO_POSITION_OFFSET = exports.GAP_BETWEEN_ITEMS = exports.DEFAULT_VIEWPORT_MARGIN = exports.DEFAULT_POSITION_OFFSET = exports.ACTIVE_INDEX_OFFSET_MULTIPLIER = void 0;
|
|
7
|
+
const ITEMS_PER_VIEWPORT_XS_SM = exports.ITEMS_PER_VIEWPORT_XS_SM = 1;
|
|
7
8
|
const ITEMS_PER_VIEWPORT_MD = exports.ITEMS_PER_VIEWPORT_MD = 2;
|
|
8
9
|
const ITEMS_PER_VIEWPORT_LG_XL = exports.ITEMS_PER_VIEWPORT_LG_XL = 3;
|
|
9
10
|
const GAP_BETWEEN_ITEMS = exports.GAP_BETWEEN_ITEMS = 16;
|
|
@@ -40,6 +40,7 @@ const ExpandCollapse = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
40
40
|
dataSet,
|
|
41
41
|
...rest
|
|
42
42
|
} = _ref;
|
|
43
|
+
const instanceId = (0, _utils.useUniqueId)('ExpandCollapse');
|
|
43
44
|
const {
|
|
44
45
|
currentValues: openIds,
|
|
45
46
|
toggleOneValue: onToggle,
|
|
@@ -65,7 +66,8 @@ const ExpandCollapse = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
65
66
|
onToggle,
|
|
66
67
|
resetValues,
|
|
67
68
|
setValues,
|
|
68
|
-
unsetValues
|
|
69
|
+
unsetValues,
|
|
70
|
+
instanceId
|
|
69
71
|
}) : children
|
|
70
72
|
})
|
|
71
73
|
});
|
|
@@ -23,7 +23,7 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
23
23
|
dataSet,
|
|
24
24
|
...rest
|
|
25
25
|
} = _ref;
|
|
26
|
-
const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel';
|
|
26
|
+
const expandCollapeMiniPanelId = (0, _utils.useUniqueId)('ExpandCollapseMiniPanel');
|
|
27
27
|
const handleChange = (openPanels, event) => {
|
|
28
28
|
if (typeof onToggle === 'function') {
|
|
29
29
|
const isOpen = openPanels.length > 0;
|
|
@@ -52,7 +52,9 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref,
|
|
|
52
52
|
pressed
|
|
53
53
|
});
|
|
54
54
|
const {
|
|
55
|
-
|
|
55
|
+
fontSize,
|
|
56
|
+
lineHeight,
|
|
57
|
+
iconSize,
|
|
56
58
|
icon
|
|
57
59
|
} = (0, _ThemeProvider.useThemeTokens)('ExpandCollapseMiniControl', tokens, variant, {
|
|
58
60
|
expanded,
|
|
@@ -69,18 +71,38 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref,
|
|
|
69
71
|
hover: linkHover
|
|
70
72
|
} = linkState || {};
|
|
71
73
|
const isHovered = hover || linkHover;
|
|
74
|
+
const iconBaselineOffset = 0;
|
|
75
|
+
const hoverTranslateY = 4;
|
|
76
|
+
|
|
77
|
+
// Calculate baseline alignment to vertically center icon with text
|
|
78
|
+
// This combines font and icon metrics with adjustments for visual balance
|
|
79
|
+
const fontBaseline = fontSize / hoverTranslateY; // Quarter of font size - adjusts for text's visual center point
|
|
80
|
+
const iconBaseline = iconSize / hoverTranslateY; // Quarter of icon size - adjusts for icon's visual center point
|
|
81
|
+
const staticOffset = hoverTranslateY; // Fixed downward adjustment to fine-tune vertical alignment
|
|
82
|
+
const sizeCompensation = -Math.abs(iconSize - fontSize); // Compensates when icon and text sizes differ significantly
|
|
83
|
+
|
|
84
|
+
const baselineAlignment = fontBaseline + iconBaseline - staticOffset + sizeCompensation;
|
|
72
85
|
if (_Platform.default.OS !== 'web') {
|
|
86
|
+
// For native platforms, use baseline alignment with optional offset
|
|
73
87
|
return {
|
|
74
|
-
iconTranslateY:
|
|
88
|
+
iconTranslateY: baselineAlignment + iconBaselineOffset
|
|
75
89
|
};
|
|
76
90
|
}
|
|
77
91
|
if (isHovered) {
|
|
78
|
-
//
|
|
92
|
+
// Apply animation offset to the baseline-aligned position
|
|
93
|
+
// When expanded: move icon UP (1.3 the hover distance for clear movement)
|
|
94
|
+
// When collapsed: move icon DOWN (single hover distance)
|
|
95
|
+
const hoverMovementDistance = 1.3;
|
|
96
|
+
const animationOffset = expanded ? -(hoverTranslateY * hoverMovementDistance) : hoverTranslateY;
|
|
79
97
|
return {
|
|
80
|
-
iconTranslateY:
|
|
98
|
+
iconTranslateY: baselineAlignment + iconBaselineOffset + animationOffset
|
|
81
99
|
};
|
|
82
100
|
}
|
|
83
|
-
|
|
101
|
+
|
|
102
|
+
// Default state uses baseline alignment with optional offset
|
|
103
|
+
return {
|
|
104
|
+
iconTranslateY: baselineAlignment + iconBaselineOffset
|
|
105
|
+
};
|
|
84
106
|
};
|
|
85
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.Link, {
|
|
86
108
|
variant: appearance,
|
|
@@ -88,7 +110,9 @@ const ExpandCollapseMiniControl = /*#__PURE__*/_react.default.forwardRef((_ref,
|
|
|
88
110
|
iconPosition: iconPosition,
|
|
89
111
|
tokens: linkState => ({
|
|
90
112
|
...linkTokens,
|
|
91
|
-
...getTokens(linkState)
|
|
113
|
+
...getTokens(linkState),
|
|
114
|
+
iconSize,
|
|
115
|
+
blockLineHeight: lineHeight
|
|
92
116
|
}),
|
|
93
117
|
ref: ref,
|
|
94
118
|
...presentationOnly,
|
|
@@ -17,6 +17,32 @@ var _ViewportProvider = require("../ViewportProvider");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
20
|
+
const CONTENT_MAX_WIDTH = 'max';
|
|
21
|
+
const CONTENT_FULL_WIDTH = 'full';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the maximum width for content based on the provided value and responsive width.
|
|
25
|
+
*
|
|
26
|
+
* @param {number|string|null|undefined} contentMinWidthValue - The minimum width value for the content.
|
|
27
|
+
* Can be a number (pixels), a string constant (e.g., CONTENT_FULL_WIDTH, CONTENT_MAX_WIDTH), or null/undefined.
|
|
28
|
+
* @param {number|string} responsiveWidth - The responsive width to use when contentMinWidthValue is CONTENT_MAX_WIDTH.
|
|
29
|
+
* @returns {number|string|null} The resolved maximum width value, which can be a number, a string (e.g., '100%'), or null.
|
|
30
|
+
*/
|
|
31
|
+
const resolveContentMaxWidth = (contentMinWidthValue, responsiveWidth) => {
|
|
32
|
+
if (!contentMinWidthValue) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (contentMinWidthValue === CONTENT_FULL_WIDTH) {
|
|
36
|
+
return '100%';
|
|
37
|
+
}
|
|
38
|
+
if (Number.isFinite(contentMinWidthValue)) {
|
|
39
|
+
return contentMinWidthValue;
|
|
40
|
+
}
|
|
41
|
+
if (contentMinWidthValue === CONTENT_MAX_WIDTH) {
|
|
42
|
+
return responsiveWidth;
|
|
43
|
+
}
|
|
44
|
+
return contentMinWidthValue;
|
|
45
|
+
};
|
|
20
46
|
|
|
21
47
|
/**
|
|
22
48
|
* A mobile-first flexbox grid.
|
|
@@ -36,35 +62,41 @@ const FlexGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
36
62
|
accessibilityRole,
|
|
37
63
|
children,
|
|
38
64
|
dataSet,
|
|
65
|
+
contentMinWidth,
|
|
39
66
|
...rest
|
|
40
67
|
} = _ref;
|
|
41
68
|
const reverseLevel = (0, _helpers.default)([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
|
|
42
69
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
43
70
|
const {
|
|
71
|
+
themeOptions,
|
|
44
72
|
themeOptions: {
|
|
45
73
|
enableMediaQueryStyleSheet
|
|
46
74
|
}
|
|
47
75
|
} = (0, _ThemeProvider.useTheme)();
|
|
48
76
|
let flexgridStyles;
|
|
49
77
|
let mediaIds;
|
|
78
|
+
const contentMinWidthValue = (0, _utils.useResponsiveProp)(contentMinWidth);
|
|
79
|
+
const responsiveWidth = (0, _utils.useResponsiveProp)(themeOptions?.contentMaxWidth);
|
|
80
|
+
const maxWidth = resolveContentMaxWidth(contentMinWidthValue, responsiveWidth);
|
|
50
81
|
const stylesByViewport = {
|
|
51
82
|
xs: {
|
|
83
|
+
maxWidth: limitWidth ? _systemConstants.viewports.map.get('sm') : maxWidth,
|
|
52
84
|
flexDirection: reverseLevel[0] ? 'column-reverse' : 'column'
|
|
53
85
|
},
|
|
54
86
|
sm: {
|
|
55
|
-
maxWidth: limitWidth
|
|
87
|
+
maxWidth: limitWidth ? _systemConstants.viewports.map.get('sm') : maxWidth,
|
|
56
88
|
flexDirection: reverseLevel[1] ? 'column-reverse' : 'column'
|
|
57
89
|
},
|
|
58
90
|
md: {
|
|
59
|
-
maxWidth: limitWidth
|
|
91
|
+
maxWidth: limitWidth ? _systemConstants.viewports.map.get('md') : maxWidth,
|
|
60
92
|
flexDirection: reverseLevel[2] ? 'column-reverse' : 'column'
|
|
61
93
|
},
|
|
62
94
|
lg: {
|
|
63
|
-
maxWidth: limitWidth
|
|
95
|
+
maxWidth: limitWidth ? _systemConstants.viewports.map.get('lg') : maxWidth,
|
|
64
96
|
flexDirection: reverseLevel[3] ? 'column-reverse' : 'column'
|
|
65
97
|
},
|
|
66
98
|
xl: {
|
|
67
|
-
maxWidth: limitWidth
|
|
99
|
+
maxWidth: limitWidth ? _systemConstants.viewports.map.get('xl') : maxWidth,
|
|
68
100
|
flexDirection: reverseLevel[4] ? 'column-reverse' : 'column'
|
|
69
101
|
}
|
|
70
102
|
};
|
|
@@ -158,7 +190,24 @@ FlexGrid.propTypes = {
|
|
|
158
190
|
/**
|
|
159
191
|
* The rows and columns of the Grid. Will typically be `FlexGrid.Row` and `FlexGrid.Col` components.
|
|
160
192
|
*/
|
|
161
|
-
children: _propTypes.default.node.isRequired
|
|
193
|
+
children: _propTypes.default.node.isRequired,
|
|
194
|
+
/**
|
|
195
|
+
* The minimum width of the content in the FlexGrid.
|
|
196
|
+
* This prop accepts responsive values for different viewports. If a number is provided,
|
|
197
|
+
* it will be the max content width for the desired viewport.
|
|
198
|
+
* - `xs`: 'max' | 'full' | <number>
|
|
199
|
+
* - `sm`: 'max' | 'full' | <number>
|
|
200
|
+
* - `md`: 'max' | 'full' | <number>
|
|
201
|
+
* - `lg`: 'max' | 'full' | <number>
|
|
202
|
+
* - `xl`: 'max' | 'full' | <number>
|
|
203
|
+
*/
|
|
204
|
+
contentMinWidth: _propTypes.default.shape({
|
|
205
|
+
xl: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'full']), _propTypes.default.number]),
|
|
206
|
+
lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'full']), _propTypes.default.number]),
|
|
207
|
+
md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'full']), _propTypes.default.number]),
|
|
208
|
+
sm: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'full']), _propTypes.default.number]),
|
|
209
|
+
xs: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'full']), _propTypes.default.number])
|
|
210
|
+
})
|
|
162
211
|
};
|
|
163
212
|
FlexGrid.Row = _Row.default;
|
|
164
213
|
FlexGrid.Col = _Col.default;
|
package/lib/cjs/Icon/Icon.js
CHANGED
|
@@ -39,7 +39,9 @@ const Icon = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
39
39
|
width: themeTokens.size + themeTokens.width * 2,
|
|
40
40
|
// sets the diameter of the circle which is the size of the icon plus twice the general padding established to obtain a perfect circle
|
|
41
41
|
height: themeTokens.size + themeTokens.width * 2
|
|
42
|
-
} : {
|
|
42
|
+
} : {
|
|
43
|
+
padding: themeTokens.padding
|
|
44
|
+
};
|
|
43
45
|
const getIconContentForMobile = () => {
|
|
44
46
|
if (Object.keys(paddingStyles).length) {
|
|
45
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -149,7 +149,7 @@ InputLabel.propTypes = {
|
|
|
149
149
|
/**
|
|
150
150
|
* Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
|
|
151
151
|
*/
|
|
152
|
-
tooltip: _propTypes.default.oneOfType([_shared.default, _propTypes.default.string]),
|
|
152
|
+
tooltip: _propTypes.default.oneOfType([_propTypes.default.shape(_shared.default), _propTypes.default.string]),
|
|
153
153
|
/**
|
|
154
154
|
* Current number of characterts of an input text.
|
|
155
155
|
*/
|
|
@@ -123,7 +123,7 @@ InputSupports.propTypes = {
|
|
|
123
123
|
* 1. `tooltip` as a string - The content of the tooltip.
|
|
124
124
|
* 2. `tooltip` as an object - Tooltip component props to be passed.
|
|
125
125
|
*/
|
|
126
|
-
tooltip: _propTypes.default.oneOfType([_shared.default, _propTypes.default.string]),
|
|
126
|
+
tooltip: _propTypes.default.oneOfType([_propTypes.default.shape(_shared.default), _propTypes.default.string]),
|
|
127
127
|
/**
|
|
128
128
|
* Use to visually mark an input as valid or invalid.
|
|
129
129
|
*/
|