@telus-uds/components-base 1.94.0 → 1.96.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 +41 -2
- package/lib/Autocomplete/Autocomplete.js +38 -3
- package/lib/Card/CardBase.js +4 -0
- package/lib/DownloadApp/DownloadApp.js +168 -0
- package/lib/DownloadApp/dictionary.js +17 -0
- package/lib/DownloadApp/index.js +10 -0
- package/lib/Icon/IconText.js +19 -2
- package/lib/Link/LinkBase.js +2 -2
- package/lib/List/ListItemBase.js +2 -1
- package/lib/Modal/Modal.js +34 -13
- package/lib/Modal/ModalContent.js +1 -1
- package/lib/Modal/WebModal.js +1 -0
- package/lib/Notification/Notification.js +5 -5
- package/lib/PriceLockup/PriceLockup.js +11 -3
- package/lib/Progress/Progress.js +5 -2
- package/lib/Progress/ProgressBar.js +4 -1
- package/lib/TabBar/TabBar.js +133 -0
- package/lib/TabBar/TabBarItem.js +184 -0
- package/lib/TabBar/index.js +10 -0
- package/lib/TextInput/TextInputBase.js +2 -1
- package/lib/Tooltip/getTooltipPosition.js +8 -9
- package/lib/Typography/Typography.js +42 -19
- package/lib/index.js +23 -0
- package/lib-module/Autocomplete/Autocomplete.js +38 -3
- package/lib-module/Card/CardBase.js +4 -0
- package/lib-module/DownloadApp/DownloadApp.js +160 -0
- package/lib-module/DownloadApp/dictionary.js +10 -0
- package/lib-module/DownloadApp/index.js +2 -0
- package/lib-module/Icon/IconText.js +19 -2
- package/lib-module/Link/LinkBase.js +2 -2
- package/lib-module/List/ListItemBase.js +2 -1
- package/lib-module/Modal/Modal.js +34 -13
- package/lib-module/Modal/ModalContent.js +1 -1
- package/lib-module/Modal/WebModal.js +1 -0
- package/lib-module/Notification/Notification.js +5 -5
- package/lib-module/PriceLockup/PriceLockup.js +11 -3
- package/lib-module/Progress/Progress.js +6 -3
- package/lib-module/Progress/ProgressBar.js +5 -2
- package/lib-module/TabBar/TabBar.js +125 -0
- package/lib-module/TabBar/TabBarItem.js +177 -0
- package/lib-module/TabBar/index.js +2 -0
- package/lib-module/TextInput/TextInputBase.js +2 -1
- package/lib-module/Tooltip/getTooltipPosition.js +8 -9
- package/lib-module/Typography/Typography.js +42 -19
- package/lib-module/index.js +3 -1
- package/package.json +2 -2
- package/src/Autocomplete/Autocomplete.jsx +43 -3
- package/src/Card/CardBase.jsx +6 -0
- package/src/DownloadApp/DownloadApp.jsx +165 -0
- package/src/DownloadApp/dictionary.js +10 -0
- package/src/DownloadApp/index.js +3 -0
- package/src/Icon/IconText.jsx +21 -4
- package/src/Link/LinkBase.jsx +2 -2
- package/src/List/ListItemBase.jsx +1 -1
- package/src/Modal/Modal.jsx +40 -14
- package/src/Modal/ModalContent.jsx +1 -1
- package/src/Modal/WebModal.jsx +1 -1
- package/src/Notification/Notification.jsx +5 -5
- package/src/PriceLockup/PriceLockup.jsx +9 -1
- package/src/Progress/Progress.jsx +6 -3
- package/src/Progress/ProgressBar.jsx +4 -2
- package/src/TabBar/TabBar.jsx +123 -0
- package/src/TabBar/TabBarItem.jsx +149 -0
- package/src/TabBar/index.js +3 -0
- package/src/TextInput/TextInputBase.jsx +1 -1
- package/src/Tooltip/getTooltipPosition.js +11 -12
- package/src/Typography/Typography.jsx +37 -13
- package/src/index.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +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 Sat, 12 Oct 2024 00:31:05 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.96.0
|
|
8
|
+
|
|
9
|
+
Sat, 12 Oct 2024 00:31:05 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `TermsAndConditions`: export use-responsive-theme-tokens hook (guillermo.peitzner@telus.com)
|
|
14
|
+
- `Progress`: add shadow tokens to Progress and ProgressBar (jacqui.koroll@telus.com)
|
|
15
|
+
- `PriceLockup`: alignItemsText token added to the component to align right (flex-end), left (flex-start) or center the content (35577399+JoshHC@users.noreply.github.com)
|
|
16
|
+
- `Modal`: updated the alignment of the cancel/secondary buttons (sam.obisesan@telus.com)
|
|
17
|
+
- `Card`: new token backgroundGradient added to be able to use the gradient as background (35577399+JoshHC@users.noreply.github.com)
|
|
18
|
+
- Bump @telus-uds/system-theme-tokens to v2.65.0
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- `Modal`: Fix focus trap to ensure focus is contained within the modal and initial focus is set on modal upon open (Mauricio.BatresMontejo@telus.com)
|
|
23
|
+
- `Typography`: fix sub and sup render on mobile devices (guillermo.peitzner@telus.com)
|
|
24
|
+
- `Autocomplete`: fix suggestion list displacement (guillermo.peitzner@telus.com)
|
|
25
|
+
- `List`: Enable `CircleBullet` icon to visualize order of nested lists. (jaime.tuyuc@telus.com)
|
|
26
|
+
- `Notification`: use maxWidth to avoid overflow in media queries (kristina.kirpichnikova@telus.com)
|
|
27
|
+
|
|
28
|
+
## 1.95.0
|
|
29
|
+
|
|
30
|
+
Wed, 25 Sep 2024 17:07:47 GMT
|
|
31
|
+
|
|
32
|
+
### Minor changes
|
|
33
|
+
|
|
34
|
+
- `DownloadApp`: add component (Mauricio.BatresMontejo@telus.com)
|
|
35
|
+
- `TabBar`: new component added (35577399+JoshHC@users.noreply.github.com)
|
|
36
|
+
- `Link`: add `inline` variant to `iconPosition` (evander.owusu@telus.com)
|
|
37
|
+
- Bump @telus-uds/system-theme-tokens to v2.64.0
|
|
38
|
+
|
|
39
|
+
### Patches
|
|
40
|
+
|
|
41
|
+
- `Modal`: fix focusing on undefined ref for close button (kristina.kirpichnikova@telus.com)
|
|
42
|
+
- `TextInput`: masked characters issue in password fixed (35577399+JoshHC@users.noreply.github.com)
|
|
43
|
+
- `Tooltip`: fix positioning (guillermo.peitzner@telus.com)
|
|
44
|
+
- `Autocomplete`: add missing loading-label functionality (guillermo.peitzner@telus.com)
|
|
45
|
+
|
|
7
46
|
## 1.94.0
|
|
8
47
|
|
|
9
|
-
Mon, 16 Sep 2024 12:
|
|
48
|
+
Mon, 16 Sep 2024 12:35:38 GMT
|
|
10
49
|
|
|
11
50
|
### Minor changes
|
|
12
51
|
|
|
@@ -111,6 +111,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
111
111
|
validation,
|
|
112
112
|
value,
|
|
113
113
|
helpText = '',
|
|
114
|
+
loadingLabel,
|
|
114
115
|
...rest
|
|
115
116
|
} = _ref2;
|
|
116
117
|
const {
|
|
@@ -143,6 +144,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
143
144
|
|
|
144
145
|
// When it's nested, selected value
|
|
145
146
|
const [nestedSelectedValue, setNestedSelectedValue] = _react.default.useState(null);
|
|
147
|
+
const [isInputVisible, setIsInputVisible] = _react.default.useState(true);
|
|
146
148
|
const {
|
|
147
149
|
supportsProps,
|
|
148
150
|
...selectedProps
|
|
@@ -268,6 +270,27 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
268
270
|
}));
|
|
269
271
|
}
|
|
270
272
|
}, [nestedSelectedValue, items]);
|
|
273
|
+
_react.default.useEffect(() => {
|
|
274
|
+
if (_Platform.default.OS === 'ios' || _Platform.default.OS === 'android') {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
const observer = new IntersectionObserver(entries => {
|
|
278
|
+
const [entry] = entries;
|
|
279
|
+
setIsInputVisible(entry.isIntersecting);
|
|
280
|
+
if (!entry.isIntersecting) {
|
|
281
|
+
setIsExpanded(false);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
const currentInputRef = inputRef.current;
|
|
285
|
+
if (currentInputRef) {
|
|
286
|
+
observer.observe(currentInputRef);
|
|
287
|
+
}
|
|
288
|
+
return () => {
|
|
289
|
+
if (currentInputRef) {
|
|
290
|
+
observer.unobserve(currentInputRef);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}, [inputRef]);
|
|
271
294
|
const handleClose = event => {
|
|
272
295
|
var _openOverlayRef$curre, _openOverlayRef$curre2;
|
|
273
296
|
if (event.type === 'keydown' && (event.key === 'Escape' || event.key === '27') || event.type === 'click' && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre = openOverlayRef.current) !== null && _openOverlayRef$curre !== void 0 && _openOverlayRef$curre.contains(event.target)) || event.type === 'touchstart' && openOverlayRef !== null && openOverlayRef !== void 0 && openOverlayRef.current && event.touches[0].target && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre2 = openOverlayRef.current) !== null && _openOverlayRef$curre2 !== void 0 && _openOverlayRef$curre2.contains(event.touches[0].target))) {
|
|
@@ -324,7 +347,19 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
324
347
|
readOnly: readOnly,
|
|
325
348
|
ref: inputRef,
|
|
326
349
|
...(_Platform.default.OS !== 'web' ? {
|
|
327
|
-
onLayout: event =>
|
|
350
|
+
onLayout: event => {
|
|
351
|
+
setSourceLayout(event.nativeEvent.layout);
|
|
352
|
+
const {
|
|
353
|
+
y,
|
|
354
|
+
height
|
|
355
|
+
} = event.nativeEvent.layout;
|
|
356
|
+
if (y >= 0 && height > 0) {
|
|
357
|
+
setIsInputVisible(true);
|
|
358
|
+
} else {
|
|
359
|
+
setIsInputVisible(false);
|
|
360
|
+
setIsExpanded(false);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
328
363
|
} : {}),
|
|
329
364
|
tokens: inputTokens,
|
|
330
365
|
validation: validation,
|
|
@@ -337,7 +372,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
337
372
|
})
|
|
338
373
|
});
|
|
339
374
|
}
|
|
340
|
-
}), (isExpanded || hintExpansionEnabled) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
375
|
+
}), (isExpanded || hintExpansionEnabled) && isInputVisible && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
341
376
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Listbox.default.Overlay, {
|
|
342
377
|
overlaidPosition: overlaidPosition,
|
|
343
378
|
isReady: isReady,
|
|
@@ -346,7 +381,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
346
381
|
onLayout: handleMeasure,
|
|
347
382
|
ref: openOverlayRef,
|
|
348
383
|
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.default, {
|
|
349
|
-
label: getCopy('loading')
|
|
384
|
+
label: loadingLabel ?? getCopy('loading')
|
|
350
385
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Suggestions.default, {
|
|
351
386
|
hasResults: getCopy('hasResults'),
|
|
352
387
|
id: "autocomplete",
|
package/lib/Card/CardBase.js
CHANGED
|
@@ -31,6 +31,7 @@ const selectStyles = _ref => {
|
|
|
31
31
|
paddingTop,
|
|
32
32
|
minWidth,
|
|
33
33
|
shadow,
|
|
34
|
+
backgroundGradient,
|
|
34
35
|
gradient
|
|
35
36
|
} = _ref;
|
|
36
37
|
return {
|
|
@@ -50,6 +51,9 @@ const selectStyles = _ref => {
|
|
|
50
51
|
backgroundOrigin: `border-box`,
|
|
51
52
|
boxShadow: `inset 0 1000px white`,
|
|
52
53
|
border: `${borderWidth}px solid transparent`
|
|
54
|
+
} : {}),
|
|
55
|
+
...(backgroundGradient && _Platform.default.OS === 'web' ? {
|
|
56
|
+
backgroundImage: `linear-gradient(${backgroundGradient.angle}deg, ${backgroundGradient.stops[0].color}, ${backgroundGradient.stops[1].color})`
|
|
53
57
|
} : {})
|
|
54
58
|
};
|
|
55
59
|
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
14
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps, _utils.viewProps]);
|
|
18
|
+
const selectOuterStyles = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
borderColor,
|
|
21
|
+
borderWidth,
|
|
22
|
+
borderGap,
|
|
23
|
+
borderRadius,
|
|
24
|
+
padding
|
|
25
|
+
} = _ref;
|
|
26
|
+
return {
|
|
27
|
+
outline: 'none',
|
|
28
|
+
borderColor,
|
|
29
|
+
borderWidth,
|
|
30
|
+
borderGap,
|
|
31
|
+
borderRadius,
|
|
32
|
+
padding
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const DownloadApp = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
36
|
+
let {
|
|
37
|
+
copy = 'en',
|
|
38
|
+
dictionary = _dictionary.default,
|
|
39
|
+
type = 'ios',
|
|
40
|
+
href,
|
|
41
|
+
onPress,
|
|
42
|
+
tokens = {},
|
|
43
|
+
variant = {},
|
|
44
|
+
...props
|
|
45
|
+
} = _ref2;
|
|
46
|
+
const getCopy = (0, _utils.useCopy)({
|
|
47
|
+
dictionary,
|
|
48
|
+
copy
|
|
49
|
+
});
|
|
50
|
+
const {
|
|
51
|
+
hrefAttrs,
|
|
52
|
+
rest
|
|
53
|
+
} = _utils.hrefAttrsProp.bundle(props);
|
|
54
|
+
const selectedProps = selectProps({
|
|
55
|
+
accessibilityRole: href ? 'link' : 'button',
|
|
56
|
+
href,
|
|
57
|
+
onPress: _utils.linkProps.handleHref({
|
|
58
|
+
href,
|
|
59
|
+
onPress
|
|
60
|
+
}),
|
|
61
|
+
hrefAttrs,
|
|
62
|
+
...rest
|
|
63
|
+
});
|
|
64
|
+
const getDownloadAppTokens = (0, _ThemeProvider.useThemeTokensCallback)('DownloadApp', tokens, variant);
|
|
65
|
+
const resolveDownloadAppTokens = pressableState => {
|
|
66
|
+
const themeTokens = (0, _utils.resolvePressableTokens)(getDownloadAppTokens, pressableState, {});
|
|
67
|
+
return selectOuterStyles(themeTokens);
|
|
68
|
+
};
|
|
69
|
+
const {
|
|
70
|
+
androidENIcon,
|
|
71
|
+
androidFRIcon,
|
|
72
|
+
iosENIcon,
|
|
73
|
+
iosFRIcon
|
|
74
|
+
} = getDownloadAppTokens();
|
|
75
|
+
const imageResources = {
|
|
76
|
+
en: {
|
|
77
|
+
android: androidENIcon,
|
|
78
|
+
ios: iosENIcon
|
|
79
|
+
},
|
|
80
|
+
fr: {
|
|
81
|
+
android: androidFRIcon,
|
|
82
|
+
ios: iosFRIcon
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const IconComponent = imageResources[copy][type];
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
87
|
+
ref: ref,
|
|
88
|
+
style: pressState => [resolveDownloadAppTokens(pressState), staticStyles.row],
|
|
89
|
+
...selectedProps,
|
|
90
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
91
|
+
style: staticImageSizes[type][copy],
|
|
92
|
+
alt: type === 'ios' ? getCopy('altTextIos') : getCopy('altTextAndroid')
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
DownloadApp.displayName = 'DownloadApp';
|
|
97
|
+
const dictionaryContentShape = _propTypes.default.shape({
|
|
98
|
+
altTextAndroid: _propTypes.default.string.isRequired,
|
|
99
|
+
altTextIos: _propTypes.default.string.isRequired
|
|
100
|
+
});
|
|
101
|
+
DownloadApp.propTypes = {
|
|
102
|
+
...selectedSystemPropTypes,
|
|
103
|
+
copy: _utils.copyPropTypes,
|
|
104
|
+
/**
|
|
105
|
+
* Override the default dictionary, by passing the complete dictionary object for `en` and `fr`
|
|
106
|
+
*/
|
|
107
|
+
dictionary: _propTypes.default.shape({
|
|
108
|
+
en: dictionaryContentShape,
|
|
109
|
+
fr: dictionaryContentShape
|
|
110
|
+
}),
|
|
111
|
+
/**
|
|
112
|
+
* Select the type of image to show.
|
|
113
|
+
*/
|
|
114
|
+
type: _propTypes.default.oneOf(['android', 'ios']),
|
|
115
|
+
/**
|
|
116
|
+
* It's a simple link that opens the Download Button instead of the onPress function.
|
|
117
|
+
*/
|
|
118
|
+
href: _propTypes.default.string,
|
|
119
|
+
/**
|
|
120
|
+
* Function called when the button is pressed. Required unless the button has a href.
|
|
121
|
+
*/
|
|
122
|
+
onPress: _propTypes.default.func,
|
|
123
|
+
/**
|
|
124
|
+
* DownloadApp tokens.
|
|
125
|
+
*/
|
|
126
|
+
tokens: (0, _utils.getTokensPropType)('DownloadApp'),
|
|
127
|
+
/**
|
|
128
|
+
* DownloadApp variant.
|
|
129
|
+
*/
|
|
130
|
+
variant: _utils.variantProp.propType
|
|
131
|
+
};
|
|
132
|
+
const staticStyles = _StyleSheet.default.create({
|
|
133
|
+
row: {
|
|
134
|
+
..._Platform.default.select({
|
|
135
|
+
web: {
|
|
136
|
+
display: 'inline-flex',
|
|
137
|
+
width: 'fit-content'
|
|
138
|
+
},
|
|
139
|
+
default: {
|
|
140
|
+
alignSelf: 'flex-start'
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const staticImageSizes = {
|
|
146
|
+
android: {
|
|
147
|
+
en: {
|
|
148
|
+
width: 162,
|
|
149
|
+
height: 48
|
|
150
|
+
},
|
|
151
|
+
fr: {
|
|
152
|
+
width: 162,
|
|
153
|
+
height: 48
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
ios: {
|
|
157
|
+
en: {
|
|
158
|
+
width: 144,
|
|
159
|
+
height: 48
|
|
160
|
+
},
|
|
161
|
+
fr: {
|
|
162
|
+
width: 152,
|
|
163
|
+
height: 48
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var _default = DownloadApp;
|
|
168
|
+
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
en: {
|
|
9
|
+
altTextAndroid: 'Get it on Google Play',
|
|
10
|
+
altTextIos: 'Download on the App Store'
|
|
11
|
+
},
|
|
12
|
+
fr: {
|
|
13
|
+
altTextAndroid: 'Disponible sur Google Play',
|
|
14
|
+
altTextIos: 'Télécharger dans l’App Store'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _DownloadApp = _interopRequireDefault(require("./DownloadApp"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _DownloadApp.default;
|
|
10
|
+
exports.default = _default;
|
package/lib/Icon/IconText.js
CHANGED
|
@@ -8,6 +8,8 @@ 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
10
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
12
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
13
|
var _Icon = _interopRequireWildcard(require("./Icon"));
|
|
12
14
|
var _StackView = require("../StackView");
|
|
13
15
|
var _utils = require("../utils");
|
|
@@ -66,6 +68,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
66
68
|
});
|
|
67
69
|
const mobile = _Platform.default.OS === 'android' ? iconAdjustedAndroid : iconAdjustedIOS;
|
|
68
70
|
const adjustedContainer = _Platform.default.OS === 'web' ? iconContent : mobile;
|
|
71
|
+
const adjustedContainerWithPosition = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
72
|
+
style: staticStyles.adjustedContainer,
|
|
73
|
+
children: adjustedContainer
|
|
74
|
+
});
|
|
75
|
+
if (iconPosition === 'inline') {
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Text.default, {
|
|
77
|
+
children: [children, " ", adjustedContainerWithPosition]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
69
80
|
return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer], {
|
|
70
81
|
space,
|
|
71
82
|
direction: 'row'
|
|
@@ -80,9 +91,9 @@ IconText.propTypes = {
|
|
|
80
91
|
*/
|
|
81
92
|
space: _utils.spacingProps.types.spacingValue,
|
|
82
93
|
/**
|
|
83
|
-
* Whether the icon should be to the left of the content
|
|
94
|
+
* Whether the icon should be to the left of the content, the right of the content or inline with the content.
|
|
84
95
|
*/
|
|
85
|
-
iconPosition: _propTypes.default.oneOf(['left', 'right']),
|
|
96
|
+
iconPosition: _propTypes.default.oneOf(['left', 'right', 'inline']),
|
|
86
97
|
/**
|
|
87
98
|
* A valid UDS icon component imported from a UDS palette.
|
|
88
99
|
*/
|
|
@@ -100,5 +111,11 @@ IconText.propTypes = {
|
|
|
100
111
|
children: _propTypes.default.node
|
|
101
112
|
/* eslint-enable react/no-unused-prop-types */
|
|
102
113
|
};
|
|
114
|
+
|
|
115
|
+
const staticStyles = _StyleSheet.default.create({
|
|
116
|
+
adjustedContainer: {
|
|
117
|
+
position: 'absolute'
|
|
118
|
+
}
|
|
119
|
+
});
|
|
103
120
|
var _default = IconText;
|
|
104
121
|
exports.default = _default;
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -245,9 +245,9 @@ LinkBase.propTypes = {
|
|
|
245
245
|
*/
|
|
246
246
|
icon: _propTypes.default.elementType,
|
|
247
247
|
/**
|
|
248
|
-
* When `icon` is provided, use `iconPosition` to place the Icon to the left or
|
|
248
|
+
* When `icon` is provided, use `iconPosition` to place the Icon to the left, right or inline with Link.
|
|
249
249
|
*/
|
|
250
|
-
iconPosition: _propTypes.default.oneOf(['left', 'right']),
|
|
250
|
+
iconPosition: _propTypes.default.oneOf(['left', 'right', 'inline']),
|
|
251
251
|
/**
|
|
252
252
|
* On Web if href is passed, React Native Web maps this object's props to
|
|
253
253
|
* `rel`, `target` and `download` attrs.
|
package/lib/List/ListItemBase.js
CHANGED
package/lib/Modal/Modal.js
CHANGED
|
@@ -104,6 +104,7 @@ const selectScrollViewStyles = () => ({
|
|
|
104
104
|
* - Don’t use modals consecutively
|
|
105
105
|
*/
|
|
106
106
|
const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
107
|
+
var _modalContentRef$curr2;
|
|
107
108
|
let {
|
|
108
109
|
children,
|
|
109
110
|
isOpen,
|
|
@@ -132,6 +133,8 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
132
133
|
maxWidth
|
|
133
134
|
});
|
|
134
135
|
const modalRef = (0, _useScrollBlocking.default)(isOpen);
|
|
136
|
+
const modalBodyRef = _react.default.useRef(ref);
|
|
137
|
+
const modalContentRef = _react.default.useRef(null);
|
|
135
138
|
const {
|
|
136
139
|
closeIcon: CloseIconComponent
|
|
137
140
|
} = themeTokens;
|
|
@@ -146,6 +149,25 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
146
149
|
const handleKeyUp = event => {
|
|
147
150
|
if (event.key === 'Escape') onClose();
|
|
148
151
|
};
|
|
152
|
+
const manageFocus = _react.default.useCallback(event => {
|
|
153
|
+
if (event.key === 'Tab') {
|
|
154
|
+
var _modalBodyRef$current;
|
|
155
|
+
const focusableElements = Array.from(modalBodyRef === null || modalBodyRef === void 0 ? void 0 : (_modalBodyRef$current = modalBodyRef.current) === null || _modalBodyRef$current === void 0 ? void 0 : _modalBodyRef$current.querySelectorAll(`
|
|
156
|
+
a[href], button, textarea, input, select,
|
|
157
|
+
[tabindex]:not([tabindex="-1"]),
|
|
158
|
+
[contenteditable="true"]
|
|
159
|
+
`));
|
|
160
|
+
const firstElement = focusableElements[0];
|
|
161
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
162
|
+
if (event.shiftKey && document.activeElement === firstElement) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
lastElement.focus();
|
|
165
|
+
} else if (!event.shiftKey && document.activeElement === lastElement) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
firstElement.focus();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, [modalBodyRef]);
|
|
149
171
|
|
|
150
172
|
// Show the custom react node passed to `closedButton` or the default close button if `closeButton` is `undefined`.
|
|
151
173
|
// Hide the close button if `closeButton` is `null`.
|
|
@@ -156,22 +178,20 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
156
178
|
const closeButtonRef = _react.default.useRef(null);
|
|
157
179
|
_react.default.useEffect(() => {
|
|
158
180
|
if (_Platform.default.OS === 'web') {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (document.activeElement === focusTrapRef.current) {
|
|
162
|
-
closeButtonRef.current.focus();
|
|
163
|
-
}
|
|
164
|
-
return undefined;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// Add an event listener to manage focus in the web modal container
|
|
168
|
-
document.addEventListener('focusin', handleFocus);
|
|
181
|
+
// Add an event listener to manage keydown and focus in the web modal container
|
|
182
|
+
document.addEventListener('keydown', manageFocus);
|
|
169
183
|
|
|
170
184
|
// Clean up the event listener
|
|
171
|
-
return () => document.removeEventListener('
|
|
185
|
+
return () => document.removeEventListener('keydown', manageFocus);
|
|
172
186
|
}
|
|
173
187
|
return undefined;
|
|
174
|
-
}, []);
|
|
188
|
+
}, [manageFocus]);
|
|
189
|
+
_react.default.useEffect(() => {
|
|
190
|
+
if (isOpen) {
|
|
191
|
+
var _modalContentRef$curr;
|
|
192
|
+
modalContentRef === null || modalContentRef === void 0 ? void 0 : (_modalContentRef$curr = modalContentRef.current) === null || _modalContentRef$curr === void 0 ? void 0 : _modalContentRef$curr.focus();
|
|
193
|
+
}
|
|
194
|
+
}, [isOpen, modalContentRef === null || modalContentRef === void 0 ? void 0 : (_modalContentRef$curr2 = modalContentRef.current) === null || _modalContentRef$curr2 === void 0 ? void 0 : _modalContentRef$curr2.focus]);
|
|
175
195
|
if (!isOpen) {
|
|
176
196
|
return null;
|
|
177
197
|
}
|
|
@@ -184,7 +204,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
184
204
|
pointerEvents: "box-none" // don't capture backdrop press events
|
|
185
205
|
,
|
|
186
206
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
187
|
-
ref:
|
|
207
|
+
ref: modalBodyRef,
|
|
188
208
|
style: [staticStyles.modal, selectModalStyles(themeTokens)],
|
|
189
209
|
onKeyUp: handleKeyUp,
|
|
190
210
|
children: [showCloseButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -229,6 +249,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
229
249
|
if (_Platform.default.OS === 'web') {
|
|
230
250
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_WebModal.default, {
|
|
231
251
|
...selectProps(rest),
|
|
252
|
+
ref: modalContentRef,
|
|
232
253
|
children: [content, /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
233
254
|
accessibilityRole: "button",
|
|
234
255
|
ref: focusTrapRef
|
package/lib/Modal/WebModal.js
CHANGED
|
@@ -31,6 +31,7 @@ const WebModal = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
31
31
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
32
32
|
style: staticStyles.container,
|
|
33
33
|
...selectProps(rest),
|
|
34
|
+
focusable: true,
|
|
34
35
|
ref: ref,
|
|
35
36
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
36
37
|
style: staticStyles.content,
|
|
@@ -105,19 +105,19 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
|
|
|
105
105
|
justifyContent: 'space-between',
|
|
106
106
|
...(0, _utils.createMediaQueryStyles)({
|
|
107
107
|
xs: {
|
|
108
|
-
|
|
108
|
+
maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content = themeOptions.contentMaxWidth) === null || _themeOptions$content === void 0 ? void 0 : _themeOptions$content.xs) || '100%'
|
|
109
109
|
},
|
|
110
110
|
md: {
|
|
111
|
-
|
|
111
|
+
maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content2 = themeOptions.contentMaxWidth) === null || _themeOptions$content2 === void 0 ? void 0 : _themeOptions$content2.md) || '100%'
|
|
112
112
|
},
|
|
113
113
|
lg: {
|
|
114
|
-
|
|
114
|
+
maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content3 = themeOptions.contentMaxWidth) === null || _themeOptions$content3 === void 0 ? void 0 : _themeOptions$content3.lg) || '100%'
|
|
115
115
|
},
|
|
116
116
|
sm: {
|
|
117
|
-
|
|
117
|
+
maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content4 = themeOptions.contentMaxWidth) === null || _themeOptions$content4 === void 0 ? void 0 : _themeOptions$content4.sm) || '100%'
|
|
118
118
|
},
|
|
119
119
|
xl: {
|
|
120
|
-
|
|
120
|
+
maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content5 = themeOptions.contentMaxWidth) === null || _themeOptions$content5 === void 0 ? void 0 : _themeOptions$content5.xl) || '100%'
|
|
121
121
|
}
|
|
122
122
|
})
|
|
123
123
|
}
|
|
@@ -92,7 +92,15 @@ const selectBottomTextTypographyTokens = _ref6 => {
|
|
|
92
92
|
lineHeight: bottomTextLineHeight
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
|
-
const
|
|
95
|
+
const selectContainertokens = _ref7 => {
|
|
96
|
+
let {
|
|
97
|
+
alignItemsText
|
|
98
|
+
} = _ref7;
|
|
99
|
+
return {
|
|
100
|
+
alignItems: alignItemsText
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
|
|
96
104
|
let {
|
|
97
105
|
size = 'medium',
|
|
98
106
|
signDirection = 'left',
|
|
@@ -109,7 +117,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
109
117
|
tokens: priceLockupTokens,
|
|
110
118
|
variant = {},
|
|
111
119
|
...rest
|
|
112
|
-
} =
|
|
120
|
+
} = _ref8;
|
|
113
121
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
114
122
|
const {
|
|
115
123
|
footnoteMarginTop,
|
|
@@ -134,7 +142,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
134
142
|
const topTextTypographyTokens = selectTopTextTypographyTokens(themeTokens);
|
|
135
143
|
const bottomTextTypographyTokens = selectBottomTextTypographyTokens(themeTokens);
|
|
136
144
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
137
|
-
style: [staticStyles.priceLockupContainer],
|
|
145
|
+
style: [staticStyles.priceLockupContainer, selectContainertokens(themeTokens)],
|
|
138
146
|
ref: ref,
|
|
139
147
|
...selectProps(rest),
|
|
140
148
|
children: [topText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
package/lib/Progress/Progress.js
CHANGED
|
@@ -18,14 +18,16 @@ const selectProgressStyles = _ref => {
|
|
|
18
18
|
borderWidth,
|
|
19
19
|
borderColor,
|
|
20
20
|
borderRadius,
|
|
21
|
-
height
|
|
21
|
+
height,
|
|
22
|
+
shadow
|
|
22
23
|
} = _ref;
|
|
23
24
|
return {
|
|
24
25
|
backgroundColor,
|
|
25
26
|
borderWidth,
|
|
26
27
|
borderColor,
|
|
27
28
|
borderRadius,
|
|
28
|
-
height
|
|
29
|
+
height,
|
|
30
|
+
...(0, _ThemeProvider.applyShadowToken)(shadow)
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -45,6 +47,7 @@ const selectProgressStyles = _ref => {
|
|
|
45
47
|
* - `borderRadius` for the rounded corners,
|
|
46
48
|
* - `borderWidth` to change the border width.
|
|
47
49
|
* - `height` to control the height of the progress bars displayed within the progress bar container.
|
|
50
|
+
* - `shadow` to apply a box shadow to the progress bar container.
|
|
48
51
|
*
|
|
49
52
|
* ## Variants
|
|
50
53
|
*
|
|
@@ -20,13 +20,15 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
20
20
|
backgroundColor,
|
|
21
21
|
borderRadius,
|
|
22
22
|
outlineWidth,
|
|
23
|
-
outlineColor
|
|
23
|
+
outlineColor,
|
|
24
|
+
shadow
|
|
24
25
|
} = _ref;
|
|
25
26
|
return {
|
|
26
27
|
backgroundColor,
|
|
27
28
|
borderRadius,
|
|
28
29
|
outlineWidth,
|
|
29
30
|
outlineColor,
|
|
31
|
+
...(0, _ThemeProvider.applyShadowToken)(shadow),
|
|
30
32
|
width: `${percentage}%`
|
|
31
33
|
};
|
|
32
34
|
};
|
|
@@ -46,6 +48,7 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
46
48
|
* - `borderRadius` for the rounded corners,
|
|
47
49
|
* - `outlineColor` to control the color of the border (outline),
|
|
48
50
|
* - `outlineWidth` to change the outline width.
|
|
51
|
+
* - `shadow` to apply a box shadow to the progress bar.
|
|
49
52
|
*
|
|
50
53
|
* ## Variants
|
|
51
54
|
*
|