@telus-uds/components-base 4.0.0-alpha.1 → 4.0.0-beta.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 +43 -1
- package/lib/cjs/Autocomplete/Autocomplete.js +13 -1
- package/lib/cjs/Autocomplete/constants.js +1 -1
- package/lib/cjs/Footnote/FootnoteLink.js +18 -17
- package/lib/cjs/Listbox/ListboxOverlay.js +7 -1
- package/lib/cjs/MultiSelectFilter/ModalOverlay.js +7 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -28
- package/lib/cjs/Progress/Progress.js +30 -5
- package/lib/cjs/Scroll/Scroll.js +472 -0
- package/lib/cjs/Scroll/ScrollContext.js +55 -0
- package/lib/cjs/Scroll/ScrollItem.js +106 -0
- package/lib/cjs/Scroll/ScrollProgress.js +100 -0
- package/lib/cjs/Scroll/dictionary.js +18 -0
- package/lib/cjs/TextInput/TextInputBase.js +2 -1
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/utils/animation/useAnimatedValue.js +46 -0
- package/lib/cjs/utils/children.js +2 -1
- package/lib/cjs/utils/useOverlaidPosition.js +83 -42
- package/lib/esm/Autocomplete/Autocomplete.js +13 -1
- package/lib/esm/Autocomplete/constants.js +1 -1
- package/lib/esm/Footnote/FootnoteLink.js +18 -17
- package/lib/esm/Listbox/ListboxOverlay.js +7 -1
- package/lib/esm/MultiSelectFilter/ModalOverlay.js +8 -2
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -28
- package/lib/esm/Progress/Progress.js +30 -5
- package/lib/esm/Scroll/Scroll.js +465 -0
- package/lib/esm/Scroll/ScrollContext.js +46 -0
- package/lib/esm/Scroll/ScrollItem.js +100 -0
- package/lib/esm/Scroll/ScrollProgress.js +93 -0
- package/lib/esm/Scroll/dictionary.js +12 -0
- package/lib/esm/TextInput/TextInputBase.js +2 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/utils/animation/useAnimatedValue.js +38 -0
- package/lib/esm/utils/children.js +2 -1
- package/lib/esm/utils/useOverlaidPosition.js +83 -42
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Autocomplete/Autocomplete.jsx +11 -2
- package/src/Autocomplete/constants.js +1 -1
- package/src/Footnote/FootnoteLink.jsx +17 -12
- package/src/Listbox/ListboxOverlay.jsx +6 -2
- package/src/MultiSelectFilter/ModalOverlay.jsx +9 -3
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +1 -31
- package/src/Progress/Progress.jsx +22 -3
- package/src/Scroll/Scroll.jsx +483 -0
- package/src/Scroll/ScrollContext.jsx +39 -0
- package/src/Scroll/ScrollItem.jsx +87 -0
- package/src/Scroll/ScrollProgress.jsx +74 -0
- package/src/Scroll/dictionary.js +12 -0
- package/src/TextInput/TextInputBase.jsx +2 -1
- package/src/index.js +2 -0
- package/src/utils/animation/useAnimatedValue.js +35 -0
- package/src/utils/children.jsx +4 -1
- package/src/utils/useOverlaidPosition.js +84 -34
- package/types/A11yInfoProvider.d.ts +9 -0
- package/types/A11yText.d.ts +13 -0
- package/types/ActionCard.d.ts +19 -0
- package/types/ActivityIndicator.d.ts +13 -0
- package/types/Autocomplete.d.ts +27 -0
- package/types/Badge.d.ts +15 -4
- package/types/BaseProvider.d.ts +26 -0
- package/types/Box.d.ts +13 -3
- package/types/Button.d.ts +35 -0
- package/types/Card.d.ts +19 -0
- package/types/CardGroup.d.ts +23 -0
- package/types/Carousel.d.ts +25 -0
- package/types/Checkbox.d.ts +15 -2
- package/types/CheckboxCard.d.ts +20 -0
- package/types/CheckboxCardGroup.d.ts +10 -4
- package/types/ChevronLink.d.ts +9 -2
- package/types/ColourToggle.d.ts +16 -0
- package/types/Common.d.ts +7 -3
- package/types/Divider.d.ts +13 -1
- package/types/DownloadApp.d.ts +19 -0
- package/types/ExpandCollapse.d.ts +16 -9
- package/types/ExpandCollapseMini.d.ts +16 -0
- package/types/Feedback.d.ts +16 -0
- package/types/Fieldset.d.ts +17 -0
- package/types/FileUpload.d.ts +6 -0
- package/types/FlexGrid.d.ts +57 -0
- package/types/Footnote.d.ts +18 -0
- package/types/HorizontalScroll.d.ts +15 -0
- package/types/HorizontalScrollButton.d.ts +17 -1
- package/types/Icon.d.ts +13 -2
- package/types/IconButton.d.ts +19 -0
- package/types/InputLabel.d.ts +12 -0
- package/types/InputSupports.d.ts +19 -0
- package/types/Link.d.ts +20 -4
- package/types/List.d.ts +11 -4
- package/types/Listbox.d.ts +13 -3
- package/types/Modal.d.ts +25 -0
- package/types/MultiSelectFilter.d.ts +24 -0
- package/types/Notification.d.ts +19 -0
- package/types/OrderedList.d.ts +17 -0
- package/types/Pagination.d.ts +25 -0
- package/types/Portal.d.ts +5 -1
- package/types/PriceLockup.d.ts +28 -0
- package/types/ProductCard.d.ts +20 -0
- package/types/ProductCardGroup.d.ts +21 -0
- package/types/Progress.d.ts +22 -0
- package/types/QuickLinks.d.ts +27 -0
- package/types/QuickLinksFeature.d.ts +27 -0
- package/types/Radio.d.ts +22 -0
- package/types/RadioCard.d.ts +21 -0
- package/types/Responsive.d.ts +14 -0
- package/types/Scroll.d.ts +66 -0
- package/types/Search.d.ts +15 -2
- package/types/Select.d.ts +12 -4
- package/types/SideNav.d.ts +38 -0
- package/types/Skeleton.d.ts +17 -0
- package/types/SkipLink.d.ts +14 -0
- package/types/Spacer.d.ts +8 -1
- package/types/StackView.d.ts +8 -2
- package/types/Status.d.ts +2 -3
- package/types/StepTracker.d.ts +16 -0
- package/types/TabBar.d.ts +25 -0
- package/types/Tabs.d.ts +12 -3
- package/types/Tags.d.ts +24 -0
- package/types/TextButton.d.ts +11 -4
- package/types/TextInput.d.ts +38 -0
- package/types/ThemeProvider.d.ts +29 -0
- package/types/Timeline.d.ts +16 -0
- package/types/ToggleSwitch.d.ts +11 -2
- package/types/ToolTip.d.ts +7 -3
- package/types/TooltipButton.d.ts +20 -0
- package/types/Typography.d.ts +8 -2
- package/types/Validator.d.ts +16 -0
- package/types/ViewportProvider.d.ts +12 -0
- package/types/index.d.ts +205 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
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, 21 May 2026 03:01:22 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 4.0.0-beta.0
|
|
8
|
+
|
|
9
|
+
Thu, 21 May 2026 03:01:22 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `Autocomplete`: Add scroll to overlay in mobile (david.melara1@telus.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- `TextInput`: Fix `onChangeText` returning `undefined` instead of an empty string when `isNumeric` is set and no text is provided (david.melara1@telus.com)
|
|
18
|
+
- `Autocomplete`: inside modal story fixed to show the close button properly (josue.higueroscalderon@telus.com)
|
|
19
|
+
- `TypeScript`: fix types (guillermo.peitzner@telus.com)
|
|
20
|
+
- `MultiSelectFilter`: position issues fixed in MFE (josue.higueroscalderon@telus.com)
|
|
21
|
+
|
|
22
|
+
## 4.0.0-alpha.2
|
|
23
|
+
|
|
24
|
+
Fri, 17 Apr 2026 23:54:32 GMT
|
|
25
|
+
|
|
26
|
+
### Minor changes
|
|
27
|
+
|
|
28
|
+
- `Scroll`: add component (guillermo.peitzner@telus.com)
|
|
29
|
+
- Bump @telus-uds/system-theme-tokens to v5.0.0-alpha.2
|
|
30
|
+
|
|
31
|
+
### Patches
|
|
32
|
+
|
|
33
|
+
- `FootnoteLink`: fixed superscript text positioning on native to correctly align with surrounding text (josue.higueroscalderon@telus.com)
|
|
34
|
+
|
|
35
|
+
## 3.30.0
|
|
36
|
+
|
|
37
|
+
Thu, 16 Apr 2026 21:04:33 GMT
|
|
38
|
+
|
|
39
|
+
### Minor changes
|
|
40
|
+
|
|
41
|
+
- `Carousel`: Add `isVideo` prop to thumbnail navigation to display a play icon overlay on video thumbnails (josue.higueros@telus.com)
|
|
42
|
+
- `Scroll`: add component (guillermo.peitzner@telus.com)
|
|
43
|
+
- Bump @telus-uds/system-theme-tokens to v4.21.0
|
|
44
|
+
|
|
45
|
+
### Patches
|
|
46
|
+
|
|
47
|
+
- `FootnoteLink`: fixed superscript text positioning on native to correctly align with surrounding text (josue.higueroscalderon@telus.com)
|
|
48
|
+
|
|
7
49
|
## 4.0.0-alpha.1
|
|
8
50
|
|
|
9
51
|
Fri, 10 Apr 2026 17:20:02 GMT
|
|
@@ -134,6 +134,7 @@ const Autocomplete = exports.Autocomplete = /*#__PURE__*/_react.default.forwardR
|
|
|
134
134
|
value,
|
|
135
135
|
helpText = '',
|
|
136
136
|
loadingLabel,
|
|
137
|
+
dropdownPosition = 'bottom',
|
|
137
138
|
tokens,
|
|
138
139
|
...rest
|
|
139
140
|
} = _ref2;
|
|
@@ -189,6 +190,13 @@ const Autocomplete = exports.Autocomplete = /*#__PURE__*/_react.default.forwardR
|
|
|
189
190
|
isShown: isExpanded || hintExpansionEnabled,
|
|
190
191
|
offsets: {
|
|
191
192
|
vertical: _Platform.default.OS !== 'web' && (hint || inputLabel) ? 28 : 4
|
|
193
|
+
},
|
|
194
|
+
align: dropdownPosition === 'top' ? {
|
|
195
|
+
center: 'center',
|
|
196
|
+
bottom: 'top'
|
|
197
|
+
} : {
|
|
198
|
+
center: 'center',
|
|
199
|
+
top: 'bottom'
|
|
192
200
|
}
|
|
193
201
|
});
|
|
194
202
|
const targetRef = _react.default.useRef(null);
|
|
@@ -541,5 +549,9 @@ Autocomplete.propTypes = {
|
|
|
541
549
|
/**
|
|
542
550
|
* Input value for controlled usage
|
|
543
551
|
*/
|
|
544
|
-
value: _propTypes.default.string
|
|
552
|
+
value: _propTypes.default.string,
|
|
553
|
+
/**
|
|
554
|
+
* Controls whether the dropdown renders above or below the input. Defaults to 'bottom'.
|
|
555
|
+
*/
|
|
556
|
+
dropdownPosition: _propTypes.default.oneOf(['top', 'bottom'])
|
|
545
557
|
};
|
|
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.MIN_LISTBOX_WIDTH = exports.INPUT_LEFT_PADDING = exports.DEFAULT_MIN_TO_SUGGESTION = exports.DEFAULT_MAX_SUGGESTIONS = exports.DEFAULT_MAX_DROPDOWN_HEIGHT = void 0;
|
|
7
7
|
const DEFAULT_MIN_TO_SUGGESTION = exports.DEFAULT_MIN_TO_SUGGESTION = 1;
|
|
8
8
|
const DEFAULT_MAX_SUGGESTIONS = exports.DEFAULT_MAX_SUGGESTIONS = 5;
|
|
9
|
-
const DEFAULT_MAX_DROPDOWN_HEIGHT = exports.DEFAULT_MAX_DROPDOWN_HEIGHT =
|
|
9
|
+
const DEFAULT_MAX_DROPDOWN_HEIGHT = exports.DEFAULT_MAX_DROPDOWN_HEIGHT = 500;
|
|
10
10
|
const INPUT_LEFT_PADDING = exports.INPUT_LEFT_PADDING = 16;
|
|
11
11
|
const MIN_LISTBOX_WIDTH = exports.MIN_LISTBOX_WIDTH = 288;
|
|
@@ -22,28 +22,28 @@ var _useThemeTokens = require("../ThemeProvider/useThemeTokens");
|
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
24
|
const [selectProps, selectedSystemPropTypes] = (0, _selectSystemProps.selectSystemProps)([_htmlAttrs.htmlAttrs, _viewProps.viewProps]);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const HALF_FONT_SIZE = 2;
|
|
26
|
+
const QUARTER_FONT_SIZE = 4;
|
|
27
|
+
const DEFAULT_LINE_HEIGHT = 1;
|
|
28
|
+
const LINE_HEIGHT_MULTIPLIER = 2;
|
|
27
29
|
const selectTextStyle = _ref => {
|
|
28
30
|
let {
|
|
29
31
|
fontSize,
|
|
30
32
|
lineHeight
|
|
31
33
|
} = _ref;
|
|
32
|
-
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
};
|
|
34
|
+
return _Platform.default.select({
|
|
35
|
+
native: {
|
|
36
|
+
fontSize: fontSize / HALF_FONT_SIZE,
|
|
37
|
+
lineHeight: fontSize,
|
|
38
|
+
position: 'relative',
|
|
39
|
+
top: -(fontSize * lineHeight) / HALF_FONT_SIZE
|
|
40
|
+
},
|
|
41
|
+
web: {
|
|
42
|
+
fontSize,
|
|
43
|
+
lineHeight: lineHeight !== DEFAULT_LINE_HEIGHT ? lineHeight : fontSize * LINE_HEIGHT_MULTIPLIER,
|
|
44
|
+
top: -fontSize / QUARTER_FONT_SIZE
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
47
|
};
|
|
48
48
|
const FootnoteLink = exports.FootnoteLink = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
49
49
|
let {
|
|
@@ -87,6 +87,7 @@ const FootnoteLink = exports.FootnoteLink = /*#__PURE__*/_react.default.forwardR
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
FootnoteLink.displayName = 'FootnoteLink';
|
|
90
|
+
FootnoteLink.__UDS_COMPONENT_NAME__ = 'FootnoteLink';
|
|
90
91
|
const copyShape = _propTypes.default.shape({
|
|
91
92
|
a11yLabel: _propTypes.default.string.isRequired
|
|
92
93
|
});
|
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
11
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
12
|
+
var _ScrollView = _interopRequireDefault(require("react-native-web/dist/cjs/exports/ScrollView"));
|
|
12
13
|
var _Portal = require("../Portal/Portal");
|
|
13
14
|
var _useThemeTokens = require("../ThemeProvider/useThemeTokens");
|
|
14
15
|
var _Card = require("../Card/Card");
|
|
@@ -67,7 +68,12 @@ const DropdownOverlay = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
67
68
|
paddingLeft: paddingHorizontal,
|
|
68
69
|
paddingRight: paddingHorizontal
|
|
69
70
|
},
|
|
70
|
-
children:
|
|
71
|
+
children: _Platform.default.OS !== 'web' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScrollView.default, {
|
|
72
|
+
style: {
|
|
73
|
+
maxHeight
|
|
74
|
+
},
|
|
75
|
+
children: children
|
|
76
|
+
}) : children
|
|
71
77
|
})
|
|
72
78
|
});
|
|
73
79
|
});
|
|
@@ -10,6 +10,7 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
|
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
11
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
12
12
|
var _portal = require("@gorhom/portal");
|
|
13
|
+
var _Portal = require("../Portal/Portal");
|
|
13
14
|
var _useCopy = require("../utils/useCopy");
|
|
14
15
|
var _copyPropTypes = require("../utils/props/copyPropTypes");
|
|
15
16
|
var _tokens = require("../utils/props/tokens");
|
|
@@ -125,7 +126,12 @@ const ModalOverlay = exports.ModalOverlay = /*#__PURE__*/_react.default.forwardR
|
|
|
125
126
|
copy
|
|
126
127
|
});
|
|
127
128
|
const closeLabel = getCopy('closeButton');
|
|
128
|
-
|
|
129
|
+
|
|
130
|
+
// On web, use the local Portal (always appends to document.body) to ensure correct
|
|
131
|
+
// absolute positioning in MFE/iframe contexts. @gorhom/portal may render its host
|
|
132
|
+
// outside the iframe's document, causing coordinate mismatches when scrolled.
|
|
133
|
+
const PortalComponent = _Platform.default.OS === 'web' ? _Portal.Portal : _portal.Portal;
|
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PortalComponent, {
|
|
129
135
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
130
136
|
ref: containerRef,
|
|
131
137
|
onLayout: onLayout,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.MultiSelectFilter = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _portal = require("@gorhom/portal");
|
|
10
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
12
11
|
var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
|
|
@@ -225,20 +224,6 @@ const MultiSelectFilter = exports.MultiSelectFilter = /*#__PURE__*/_react.defaul
|
|
|
225
224
|
setIsOpen(false);
|
|
226
225
|
onCancel();
|
|
227
226
|
};
|
|
228
|
-
const appRootRef = _react.default.useRef(null);
|
|
229
|
-
const [rootOffsets, setRootOffsets] = _react.default.useState(null);
|
|
230
|
-
_react.default.useEffect(() => {
|
|
231
|
-
if (rootOffsets) return;
|
|
232
|
-
appRootRef.current?.measureInWindow((x, y) => {
|
|
233
|
-
// Only set offsets if they are positive
|
|
234
|
-
// this is because we want to avoid negative offsets that could cause
|
|
235
|
-
// the dropdown to be positioned incorrectly in some situations
|
|
236
|
-
if (y > 0) setRootOffsets({
|
|
237
|
-
horizontal: x,
|
|
238
|
-
vertical: y
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
}, [isOpen, rootOffsets]);
|
|
242
227
|
const {
|
|
243
228
|
align,
|
|
244
229
|
offsets
|
|
@@ -255,8 +240,7 @@ const MultiSelectFilter = exports.MultiSelectFilter = /*#__PURE__*/_react.defaul
|
|
|
255
240
|
left: 'left'
|
|
256
241
|
},
|
|
257
242
|
offsets: {
|
|
258
|
-
vertical: 4
|
|
259
|
-
horizontal: -rootOffsets?.horizontal || 0
|
|
243
|
+
vertical: 4
|
|
260
244
|
}
|
|
261
245
|
}
|
|
262
246
|
});
|
|
@@ -393,12 +377,7 @@ const MultiSelectFilter = exports.MultiSelectFilter = /*#__PURE__*/_react.defaul
|
|
|
393
377
|
})]
|
|
394
378
|
});
|
|
395
379
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
396
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
397
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
398
|
-
ref: appRootRef,
|
|
399
|
-
style: styles.appRootRef
|
|
400
|
-
})
|
|
401
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonDropdown.ButtonDropdown, {
|
|
380
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonDropdown.ButtonDropdown, {
|
|
402
381
|
ref: sourceRef,
|
|
403
382
|
...pressHandlers,
|
|
404
383
|
value: isOpen,
|
|
@@ -478,11 +457,6 @@ const styles = _StyleSheet.default.create({
|
|
|
478
457
|
},
|
|
479
458
|
scrollContainer: {
|
|
480
459
|
padding: 1
|
|
481
|
-
},
|
|
482
|
-
appRootRef: {
|
|
483
|
-
position: 'absolute',
|
|
484
|
-
top: 0,
|
|
485
|
-
left: 0
|
|
486
460
|
}
|
|
487
461
|
});
|
|
488
462
|
|
|
@@ -19,6 +19,8 @@ var _ProgressContext = require("./ProgressContext");
|
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
const [selectProps, selectedSystemPropTypes] = (0, _selectSystemProps.selectSystemProps)([_a11yProps.a11yProps, _viewProps.viewProps]);
|
|
22
|
+
const BORDER_SIDES = 2;
|
|
23
|
+
const CENTER_DIVISOR = 2;
|
|
22
24
|
const selectProgressStyles = _ref => {
|
|
23
25
|
let {
|
|
24
26
|
backgroundColor,
|
|
@@ -37,6 +39,21 @@ const selectProgressStyles = _ref => {
|
|
|
37
39
|
...(0, _styles.applyShadowToken)(shadow)
|
|
38
40
|
};
|
|
39
41
|
};
|
|
42
|
+
const selectBarWrapperStyles = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
barHeight,
|
|
45
|
+
borderRadius,
|
|
46
|
+
borderWidth,
|
|
47
|
+
height
|
|
48
|
+
} = _ref2;
|
|
49
|
+
return {
|
|
50
|
+
height: barHeight,
|
|
51
|
+
width: '100%',
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: (height - borderWidth * BORDER_SIDES - barHeight) / CENTER_DIVISOR,
|
|
54
|
+
borderRadius
|
|
55
|
+
};
|
|
56
|
+
};
|
|
40
57
|
|
|
41
58
|
/**
|
|
42
59
|
* The `Progress` is a container for displaying one or several `ProgressBar`s.
|
|
@@ -50,10 +67,11 @@ const selectProgressStyles = _ref => {
|
|
|
50
67
|
*
|
|
51
68
|
* - Use the following tokens to customize the appearance:
|
|
52
69
|
* - `backgroundColor` for the background color of the progress container,
|
|
70
|
+
* - `barHeight` to control the height of the progress bars displayed within the container,
|
|
53
71
|
* - `borderColor` to control the color of the border,
|
|
54
72
|
* - `borderRadius` for the rounded corners,
|
|
55
73
|
* - `borderWidth` to change the border width.
|
|
56
|
-
* - `height` to control the height of the progress
|
|
74
|
+
* - `height` to control the height of the progress bar container.
|
|
57
75
|
* - `shadow` to apply a box shadow to the progress bar container.
|
|
58
76
|
*
|
|
59
77
|
* ## Variants
|
|
@@ -74,16 +92,23 @@ const selectProgressStyles = _ref => {
|
|
|
74
92
|
* role.
|
|
75
93
|
*
|
|
76
94
|
*/
|
|
77
|
-
const Progress = exports.Progress = /*#__PURE__*/_react.default.forwardRef((
|
|
95
|
+
const Progress = exports.Progress = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
78
96
|
let {
|
|
79
97
|
children,
|
|
80
98
|
tokens,
|
|
81
99
|
variant,
|
|
82
100
|
...rest
|
|
83
|
-
} =
|
|
101
|
+
} = _ref3;
|
|
84
102
|
const themeTokens = (0, _useThemeTokens.useThemeTokens)('Progress', tokens, variant);
|
|
85
|
-
// Default to false (vertical layout) to preserve existing behavior and avoid breaking changes
|
|
86
103
|
const layers = variant?.layers ?? false;
|
|
104
|
+
const {
|
|
105
|
+
barHeight,
|
|
106
|
+
height
|
|
107
|
+
} = themeTokens;
|
|
108
|
+
const content = barHeight && barHeight !== height ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
109
|
+
style: selectBarWrapperStyles(themeTokens),
|
|
110
|
+
children: children
|
|
111
|
+
}) : children;
|
|
87
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressContext.ProgressContext.Provider, {
|
|
88
113
|
value: {
|
|
89
114
|
layers
|
|
@@ -92,7 +117,7 @@ const Progress = exports.Progress = /*#__PURE__*/_react.default.forwardRef((_ref
|
|
|
92
117
|
ref: ref,
|
|
93
118
|
style: [staticStyles.progressContainer, selectProgressStyles(themeTokens)],
|
|
94
119
|
...selectProps(rest),
|
|
95
|
-
children:
|
|
120
|
+
children: content
|
|
96
121
|
})
|
|
97
122
|
});
|
|
98
123
|
});
|