@telus-uds/components-base 3.12.2 → 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 +20 -2
- package/lib/cjs/Button/ButtonDropdown.js +105 -12
- 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/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/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,30 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
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
|
+
|
|
7
25
|
## 3.12.2
|
|
8
26
|
|
|
9
|
-
Fri, 25 Jul 2025 04:
|
|
27
|
+
Fri, 25 Jul 2025 04:13:56 GMT
|
|
10
28
|
|
|
11
29
|
### Patches
|
|
12
30
|
|
|
@@ -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;
|
|
@@ -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
|
*/
|
|
@@ -16,6 +16,7 @@ var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
|
16
16
|
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
|
+
const CONTENT_MAX_WIDTH = 'max';
|
|
19
20
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
20
21
|
const selectContainerStyles = tokens => ({
|
|
21
22
|
...tokens
|
|
@@ -70,13 +71,13 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
70
71
|
placeContent: 'start'
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
|
-
const selectContentContainerStyle = (themeTokens, maxWidth, system, viewport) => ({
|
|
74
|
-
maxWidth: system && viewport === 'xl' ? maxWidth : '100%',
|
|
74
|
+
const selectContentContainerStyle = (themeTokens, maxWidth, system, viewport, useContentMaxWidth) => ({
|
|
75
|
+
maxWidth: system && (useContentMaxWidth || viewport === 'xl') ? maxWidth : '100%',
|
|
75
76
|
width: '100%',
|
|
76
77
|
paddingRight: themeTokens?.containerPaddingRight,
|
|
77
78
|
paddingLeft: themeTokens?.containerPaddingLeft
|
|
78
79
|
});
|
|
79
|
-
const getMediaQueryStyles = (themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, system) => {
|
|
80
|
+
const getMediaQueryStyles = (themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, system, useContentMaxWidth) => {
|
|
80
81
|
const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
|
|
81
82
|
let [vp, viewportTokens] = _ref5;
|
|
82
83
|
acc[vp] = {
|
|
@@ -99,7 +100,7 @@ const getMediaQueryStyles = (themeTokens, themeOptions, maxWidth, mediaIdsRef, d
|
|
|
99
100
|
const transformedSelectContentContainerStyles = Object.entries(themeTokens).reduce((acc, _ref6) => {
|
|
100
101
|
let [vp, viewportTokens] = _ref6;
|
|
101
102
|
acc[vp] = {
|
|
102
|
-
...selectContentContainerStyle(viewportTokens, maxWidth, system, vp),
|
|
103
|
+
...selectContentContainerStyle(viewportTokens, maxWidth, system, vp, useContentMaxWidth),
|
|
103
104
|
flexDirection: 'row',
|
|
104
105
|
flexShrink: 1,
|
|
105
106
|
justifyContent: 'space-between',
|
|
@@ -176,7 +177,7 @@ const getMediaQueryStyles = (themeTokens, themeOptions, maxWidth, mediaIdsRef, d
|
|
|
176
177
|
selectDismissIconPropsStyles
|
|
177
178
|
};
|
|
178
179
|
};
|
|
179
|
-
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system) => ({
|
|
180
|
+
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system, useContentMaxWidth) => ({
|
|
180
181
|
containerStyles: {
|
|
181
182
|
container: {
|
|
182
183
|
flexDirection: 'column',
|
|
@@ -188,7 +189,7 @@ const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, view
|
|
|
188
189
|
flexDirection: 'row',
|
|
189
190
|
flexShrink: 1,
|
|
190
191
|
justifyContent: 'space-between',
|
|
191
|
-
...selectContentContainerStyle(themeTokens, maxWidth, system, viewport),
|
|
192
|
+
...selectContentContainerStyle(themeTokens, maxWidth, system, viewport, useContentMaxWidth),
|
|
192
193
|
...(system && {
|
|
193
194
|
alignSelf: 'center'
|
|
194
195
|
})
|
|
@@ -287,6 +288,7 @@ const Notification = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
287
288
|
tokens,
|
|
288
289
|
variant,
|
|
289
290
|
onDismiss,
|
|
291
|
+
contentMinWidth,
|
|
290
292
|
...rest
|
|
291
293
|
} = _ref7;
|
|
292
294
|
const [isDismissed, setIsDismissed] = _react.default.useState(false);
|
|
@@ -309,6 +311,7 @@ const Notification = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
309
311
|
system: isSystemEnabled,
|
|
310
312
|
viewport
|
|
311
313
|
});
|
|
314
|
+
const useContentMaxWidth = (0, _utils.useResponsiveProp)(contentMinWidth) === CONTENT_MAX_WIDTH;
|
|
312
315
|
const maxWidth = (0, _utils.useResponsiveProp)(themeOptions?.contentMaxWidth, _systemConstants.viewports.map.get(_systemConstants.viewports.xl));
|
|
313
316
|
const notificationComponentRef = _react.default.useRef({
|
|
314
317
|
containerStyles: {},
|
|
@@ -331,9 +334,9 @@ const Notification = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
331
334
|
selectDismissIconPropsIds: {}
|
|
332
335
|
});
|
|
333
336
|
if (enableMediaQueryStyleSheet) {
|
|
334
|
-
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, isSystemEnabled);
|
|
337
|
+
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, isSystemEnabled, useContentMaxWidth);
|
|
335
338
|
} else {
|
|
336
|
-
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, isSystemEnabled);
|
|
339
|
+
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, isSystemEnabled, useContentMaxWidth);
|
|
337
340
|
}
|
|
338
341
|
if (isDismissed) {
|
|
339
342
|
return null;
|
|
@@ -430,6 +433,22 @@ Notification.propTypes = {
|
|
|
430
433
|
* Callback function called when the dismiss button is clicked
|
|
431
434
|
*/
|
|
432
435
|
onDismiss: _propTypes.default.func,
|
|
436
|
+
/**
|
|
437
|
+
* The minimum width of the content in the Notification when using the system variant.
|
|
438
|
+
* This prop accepts responsive values for different viewports.
|
|
439
|
+
* - `xs`: 'max' | 'full'
|
|
440
|
+
* - `sm`: 'max' | 'full'
|
|
441
|
+
* - `md`: 'max' | 'full'
|
|
442
|
+
* - `lg`: 'max' | 'full'
|
|
443
|
+
* - `xl`: 'max' | 'full'
|
|
444
|
+
*/
|
|
445
|
+
contentMinWidth: _propTypes.default.shape({
|
|
446
|
+
xl: _propTypes.default.oneOf(['max', 'full']),
|
|
447
|
+
lg: _propTypes.default.oneOf(['max', 'full']),
|
|
448
|
+
md: _propTypes.default.oneOf(['max', 'full']),
|
|
449
|
+
sm: _propTypes.default.oneOf(['max', 'full']),
|
|
450
|
+
xs: _propTypes.default.oneOf(['max', 'full'])
|
|
451
|
+
}),
|
|
433
452
|
tokens: (0, _utils.getTokensPropType)('Notification'),
|
|
434
453
|
variant: _utils.variantProp.propType
|
|
435
454
|
};
|
|
@@ -44,7 +44,7 @@ var _default = exports.default = {
|
|
|
44
44
|
* 1. `tooltip` as a string - The content of the tooltip.
|
|
45
45
|
* 2. `tooltip` as an object - Tooltip component props to be passed.
|
|
46
46
|
*/
|
|
47
|
-
tooltip: _propTypes.default.oneOfType([_shared.default, _propTypes.default.string]),
|
|
47
|
+
tooltip: _propTypes.default.oneOfType([_propTypes.default.shape(_shared.default), _propTypes.default.string]),
|
|
48
48
|
/**
|
|
49
49
|
* Use to visually mark an input as valid or invalid.
|
|
50
50
|
*/
|