@telus-uds/components-base 1.74.0 → 1.76.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 +26 -2
- package/lib/Carousel/CarouselThumbnail.js +10 -4
- package/lib/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib/Footnote/Footnote.js +9 -13
- package/lib/Link/ChevronLink.js +2 -0
- package/lib/Link/InlinePressable.js +15 -2
- package/lib/Link/LinkBase.js +1 -0
- package/lib/Notification/Notification.js +213 -35
- package/lib/OrderedList/OrderedList.js +21 -20
- package/lib/PriceLockup/PriceLockup.js +220 -0
- package/lib/PriceLockup/index.js +10 -0
- package/lib/PriceLockup/utils/renderFootnoteContent.js +93 -0
- package/lib/PriceLockup/utils/renderFootnoteLinks.js +36 -0
- package/lib/PriceLockup/utils/renderPrice.js +147 -0
- package/lib/PriceLockup/utils/renderTypography.js +31 -0
- package/lib/index.js +8 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.js +1 -2
- package/lib-module/Carousel/CarouselThumbnail.js +10 -4
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib-module/Footnote/Footnote.js +9 -13
- package/lib-module/Link/ChevronLink.js +2 -0
- package/lib-module/Link/InlinePressable.js +16 -2
- package/lib-module/Link/LinkBase.js +1 -0
- package/lib-module/Notification/Notification.js +216 -38
- package/lib-module/OrderedList/OrderedList.js +21 -20
- package/lib-module/PriceLockup/PriceLockup.js +214 -0
- package/lib-module/PriceLockup/index.js +2 -0
- package/lib-module/PriceLockup/utils/renderFootnoteContent.js +87 -0
- package/lib-module/PriceLockup/utils/renderFootnoteLinks.js +28 -0
- package/lib-module/PriceLockup/utils/renderPrice.js +141 -0
- package/lib-module/PriceLockup/utils/renderTypography.js +23 -0
- package/lib-module/index.js +1 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.js +1 -2
- package/package.json +2 -2
- package/src/Carousel/CarouselThumbnail.jsx +8 -6
- package/src/Carousel/CarouselThumbnailNavigation.jsx +3 -4
- package/src/Footnote/Footnote.jsx +3 -6
- package/src/Link/ChevronLink.jsx +5 -1
- package/src/Link/InlinePressable.jsx +36 -15
- package/src/Link/LinkBase.jsx +1 -0
- package/src/Notification/Notification.jsx +213 -34
- package/src/OrderedList/OrderedList.jsx +17 -20
- package/src/PriceLockup/PriceLockup.jsx +218 -0
- package/src/PriceLockup/index.js +3 -0
- package/src/PriceLockup/utils/renderFootnoteContent.jsx +77 -0
- package/src/PriceLockup/utils/renderFootnoteLinks.jsx +38 -0
- package/src/PriceLockup/utils/renderPrice.jsx +201 -0
- package/src/PriceLockup/utils/renderTypography.jsx +13 -0
- package/src/index.js +1 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 07 Feb 2024 19:09:40 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.76.0
|
|
8
|
+
|
|
9
|
+
Wed, 07 Feb 2024 19:09:40 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Changes to enable the key recogniztion in the press state (35577399+JoshHC@users.noreply.github.com)
|
|
14
|
+
- carouselThumbnail component modified to match design intention (35577399+JoshHC@users.noreply.github.com)
|
|
15
|
+
- refactor(PriceLockup): started the migration to component-base (chris.tafts@telus.com)
|
|
16
|
+
- refactor(PriceLuckup): started the migration to component-base (chris.tafts@telus.com)
|
|
17
|
+
|
|
18
|
+
### Patches
|
|
19
|
+
|
|
20
|
+
- fix ordered-list component single child render (guillermo.peitzner@telus.com)
|
|
21
|
+
|
|
22
|
+
## 1.75.0
|
|
23
|
+
|
|
24
|
+
Mon, 29 Jan 2024 18:41:50 GMT
|
|
25
|
+
|
|
26
|
+
### Minor changes
|
|
27
|
+
|
|
28
|
+
- Styles changed in notification component to be SSR (35577399+JoshHC@users.noreply.github.com)
|
|
29
|
+
- Bump @telus-uds/system-theme-tokens to v2.50.1
|
|
30
|
+
|
|
7
31
|
## 1.74.0
|
|
8
32
|
|
|
9
|
-
Thu, 18 Jan 2024 22:
|
|
33
|
+
Thu, 18 Jan 2024 22:55:53 GMT
|
|
10
34
|
|
|
11
35
|
### Minor changes
|
|
12
36
|
|
|
@@ -61,7 +61,8 @@ const CarouselThumbnail = _ref2 => {
|
|
|
61
61
|
padding,
|
|
62
62
|
selectedBorderColor,
|
|
63
63
|
selectedBorderWidth,
|
|
64
|
-
size
|
|
64
|
+
size,
|
|
65
|
+
margin
|
|
65
66
|
} = getThumbnailTokens({
|
|
66
67
|
viewport
|
|
67
68
|
});
|
|
@@ -73,7 +74,12 @@ const CarouselThumbnail = _ref2 => {
|
|
|
73
74
|
selected: {
|
|
74
75
|
borderColor: selectedBorderColor,
|
|
75
76
|
borderWidth: selectedBorderWidth,
|
|
76
|
-
padding: padding - selectedBorderWidth
|
|
77
|
+
padding: padding - selectedBorderWidth,
|
|
78
|
+
marginBottom: margin + selectedBorderWidth
|
|
79
|
+
},
|
|
80
|
+
nonSelected: {
|
|
81
|
+
padding: padding - borderWidth,
|
|
82
|
+
marginBottom: margin + selectedBorderWidth
|
|
77
83
|
}
|
|
78
84
|
};
|
|
79
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
@@ -90,9 +96,9 @@ const CarouselThumbnail = _ref2 => {
|
|
|
90
96
|
pressed,
|
|
91
97
|
focus: focused
|
|
92
98
|
}));
|
|
93
|
-
return [pressableStyles, index === activeIndex
|
|
99
|
+
return [pressableStyles, index === activeIndex ? [styles.selected, {
|
|
94
100
|
outline: 'none'
|
|
95
|
-
}];
|
|
101
|
+
}] : styles.nonSelected];
|
|
96
102
|
},
|
|
97
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
98
104
|
accessibilityIgnoresInvertColors: true,
|
|
@@ -33,8 +33,7 @@ const CarouselThumbnailNavigation = /*#__PURE__*/(0, _react.forwardRef)((_ref, r
|
|
|
33
33
|
throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
|
|
34
34
|
}
|
|
35
35
|
const {
|
|
36
|
-
containerPaddingTop: thumbnailContainerPaddingTop
|
|
37
|
-
margin: thumbnailMargin
|
|
36
|
+
containerPaddingTop: thumbnailContainerPaddingTop
|
|
38
37
|
} = (0, _ThemeProvider.useThemeTokens)('CarouselThumbnail');
|
|
39
38
|
const stackWrapTokens = {
|
|
40
39
|
justifyContent: 'flex-start'
|
|
@@ -42,13 +41,14 @@ const CarouselThumbnailNavigation = /*#__PURE__*/(0, _react.forwardRef)((_ref, r
|
|
|
42
41
|
const containerStyles = {
|
|
43
42
|
justifyContent: 'center',
|
|
44
43
|
alignItems,
|
|
45
|
-
paddingTop: thumbnailContainerPaddingTop
|
|
44
|
+
paddingTop: thumbnailContainerPaddingTop
|
|
46
45
|
};
|
|
47
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
48
47
|
style: containerStyles,
|
|
49
48
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
50
49
|
direction: "row",
|
|
51
50
|
tokens: stackWrapTokens,
|
|
51
|
+
space: 2,
|
|
52
52
|
ref: ref,
|
|
53
53
|
children: thumbnails.map((_ref2, index) => {
|
|
54
54
|
let {
|
package/lib/Footnote/Footnote.js
CHANGED
|
@@ -173,19 +173,15 @@ const Footnote = _ref6 => {
|
|
|
173
173
|
children: content
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
return (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
})
|
|
186
|
-
}, number)]
|
|
187
|
-
})
|
|
188
|
-
);
|
|
176
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default, {
|
|
177
|
+
start: number,
|
|
178
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default.Item, {
|
|
179
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
180
|
+
style: selectCustomContentFontStyle(themeTokens),
|
|
181
|
+
children: content
|
|
182
|
+
})
|
|
183
|
+
}, number)
|
|
184
|
+
});
|
|
189
185
|
}, [content, number, themeTokens]);
|
|
190
186
|
(0, _react.useEffect)(() => {
|
|
191
187
|
if (isOpen) {
|
package/lib/Link/ChevronLink.js
CHANGED
|
@@ -25,6 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
25
25
|
tokens = {},
|
|
26
26
|
variant,
|
|
27
27
|
dataSet,
|
|
28
|
+
onPress,
|
|
28
29
|
...otherlinkProps
|
|
29
30
|
} = _ref;
|
|
30
31
|
const getChevronTokens = (0, _ThemeProvider.useThemeTokensCallback)('ChevronLink', tokens, variant);
|
|
@@ -53,6 +54,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
53
54
|
tokens: getTokens,
|
|
54
55
|
dataSet: dataSet,
|
|
55
56
|
ref: ref,
|
|
57
|
+
onPress: onPress,
|
|
56
58
|
children: children
|
|
57
59
|
});
|
|
58
60
|
});
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
9
9
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -24,17 +25,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
24
25
|
* @param {PressableProps} PressableProps
|
|
25
26
|
*/
|
|
26
27
|
// React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
|
|
27
|
-
|
|
28
|
-
const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
28
|
+
/* eslint-disable react/prop-types */const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
29
29
|
let {
|
|
30
30
|
children,
|
|
31
31
|
inlineFlex = true,
|
|
32
32
|
style,
|
|
33
|
+
onPress,
|
|
33
34
|
...props
|
|
34
35
|
} = _ref;
|
|
36
|
+
const handlePress = (0, _react.useCallback)(() => {
|
|
37
|
+
if (onPress) {
|
|
38
|
+
onPress();
|
|
39
|
+
}
|
|
40
|
+
}, [onPress]);
|
|
41
|
+
const handleKeyPress = (0, _react.useCallback)(e => {
|
|
42
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
43
|
+
handlePress();
|
|
44
|
+
}
|
|
45
|
+
}, [handlePress]);
|
|
35
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
36
47
|
ref: ref,
|
|
37
48
|
style: pressState => [typeof style === 'function' ? style(pressState) : style, staticStyles[inlineFlex ? 'inlineFlex' : 'inline']],
|
|
49
|
+
onPress: handlePress,
|
|
50
|
+
onKeyDown: _Platform.default.OS === 'web' ? handleKeyPress : undefined,
|
|
38
51
|
...props,
|
|
39
52
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
40
53
|
});
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -187,6 +187,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
187
187
|
// assuming links without icons should be inline (even if they are long)
|
|
188
188
|
,
|
|
189
189
|
ref: ref,
|
|
190
|
+
keyboardShouldPersistTaps: "handled",
|
|
190
191
|
style: linkState => {
|
|
191
192
|
const themeTokens = resolveLinkTokens(linkState);
|
|
192
193
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
9
8
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _ThemeProvider = require("../ThemeProvider");
|
|
@@ -75,6 +74,156 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
75
74
|
const selectContentContainerStyle = maxWidth => ({
|
|
76
75
|
width: maxWidth || '100%'
|
|
77
76
|
});
|
|
77
|
+
const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, dismissible) => {
|
|
78
|
+
const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
|
|
79
|
+
let [vp, viewportTokens] = _ref5;
|
|
80
|
+
acc[vp] = selectContainerStyles({
|
|
81
|
+
...viewportTokens
|
|
82
|
+
});
|
|
83
|
+
return acc;
|
|
84
|
+
}, {});
|
|
85
|
+
const selectContainerMediaQueryStyles = (0, _utils.createMediaQueryStyles)(transformedSelectContainerStyles);
|
|
86
|
+
const {
|
|
87
|
+
ids: containerIds,
|
|
88
|
+
styles: containerStyles
|
|
89
|
+
} = _utils.StyleSheet.create({
|
|
90
|
+
container: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
...selectContainerMediaQueryStyles
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const {
|
|
96
|
+
ids: contentContainerIds,
|
|
97
|
+
styles: contentContainerStyles
|
|
98
|
+
} = _utils.StyleSheet.create({
|
|
99
|
+
contentContainer: {
|
|
100
|
+
flexDirection: 'row',
|
|
101
|
+
flexShrink: 1,
|
|
102
|
+
justifyContent: 'space-between',
|
|
103
|
+
...(0, _utils.createMediaQueryStyles)({
|
|
104
|
+
xs: {
|
|
105
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.xs) || '100%'
|
|
106
|
+
},
|
|
107
|
+
md: {
|
|
108
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.md) || '100%'
|
|
109
|
+
},
|
|
110
|
+
lg: {
|
|
111
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.lg) || '100%'
|
|
112
|
+
},
|
|
113
|
+
sm: {
|
|
114
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.sm) || '100%'
|
|
115
|
+
},
|
|
116
|
+
xl: {
|
|
117
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.xl) || '100%'
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const {
|
|
123
|
+
ids: staticContentContainerIds,
|
|
124
|
+
styles: staticContentContainerStyles
|
|
125
|
+
} = _utils.StyleSheet.create({
|
|
126
|
+
staticContentContainer: {
|
|
127
|
+
flexDirection: 'row',
|
|
128
|
+
flexShrink: 1
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const {
|
|
132
|
+
ids: iconContainerIds,
|
|
133
|
+
styles: iconContainerStyles
|
|
134
|
+
} = _utils.StyleSheet.create({
|
|
135
|
+
iconContainer: selectIconContainerStyles(themeTokens[viewport])
|
|
136
|
+
});
|
|
137
|
+
const {
|
|
138
|
+
ids: dismissButtonContainerIds,
|
|
139
|
+
styles: dismissButtonContainerStyles
|
|
140
|
+
} = _utils.StyleSheet.create({
|
|
141
|
+
dismissButtonContainer: selectDismissButtonContainerStyles(themeTokens[viewport])
|
|
142
|
+
});
|
|
143
|
+
const {
|
|
144
|
+
ids: textIds,
|
|
145
|
+
styles: textStyles
|
|
146
|
+
} = _utils.StyleSheet.create({
|
|
147
|
+
text: selectTextStyles(themeTokens[viewport], themeOptions, dismissible)
|
|
148
|
+
});
|
|
149
|
+
const {
|
|
150
|
+
styles: selectIconPropsStyles
|
|
151
|
+
} = _utils.StyleSheet.create({
|
|
152
|
+
selectIconProps: selectIconProps(themeTokens[viewport])
|
|
153
|
+
});
|
|
154
|
+
const {
|
|
155
|
+
styles: selectDismissIconPropsStyles
|
|
156
|
+
} = _utils.StyleSheet.create({
|
|
157
|
+
selectDismissIconProps: selectDismissIconProps(themeTokens[viewport])
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// eslint-disable-next-line no-param-reassign
|
|
161
|
+
mediaIdsRef.current = {
|
|
162
|
+
containerIds,
|
|
163
|
+
contentContainerIds,
|
|
164
|
+
staticContentContainerIds,
|
|
165
|
+
iconContainerIds,
|
|
166
|
+
dismissButtonContainerIds,
|
|
167
|
+
textIds
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
containerStyles,
|
|
171
|
+
contentContainerStyles,
|
|
172
|
+
staticContentContainerStyles,
|
|
173
|
+
iconContainerStyles,
|
|
174
|
+
dismissButtonContainerStyles,
|
|
175
|
+
textStyles,
|
|
176
|
+
selectIconPropsStyles,
|
|
177
|
+
selectDismissIconPropsStyles
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible) => ({
|
|
181
|
+
containerStyles: {
|
|
182
|
+
container: {
|
|
183
|
+
flexDirection: 'row',
|
|
184
|
+
...selectContainerStyles(themeTokens)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
contentContainerStyles: {
|
|
188
|
+
contentContainer: {
|
|
189
|
+
flexDirection: 'row',
|
|
190
|
+
flexShrink: 1,
|
|
191
|
+
justifyContent: 'space-between',
|
|
192
|
+
...selectContentContainerStyle(maxWidth)
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
staticContentContainerStyles: {
|
|
196
|
+
staticContentContainer: {
|
|
197
|
+
flexDirection: 'row',
|
|
198
|
+
flexShrink: 1
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
iconContainerStyles: {
|
|
202
|
+
iconContainer: {
|
|
203
|
+
...selectIconContainerStyles(themeTokens)
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
dismissButtonContainerStyles: {
|
|
207
|
+
dismissButtonContainer: {
|
|
208
|
+
...selectDismissButtonContainerStyles(themeTokens)
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
textStyles: {
|
|
212
|
+
text: {
|
|
213
|
+
...selectTextStyles(themeTokens, themeOptions, dismissible)
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
selectIconPropsStyles: {
|
|
217
|
+
selectIconProps: {
|
|
218
|
+
...selectIconProps(themeTokens)
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
selectDismissIconPropsStyles: {
|
|
222
|
+
selectDismissIconProps: {
|
|
223
|
+
...selectDismissIconProps(themeTokens)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
78
227
|
|
|
79
228
|
/**
|
|
80
229
|
* A banner that highlights important messages:
|
|
@@ -127,7 +276,7 @@ const selectContentContainerStyle = maxWidth => ({
|
|
|
127
276
|
* Use full-width `Notifications` to show system-based messages coming from the application, not in response to user action.
|
|
128
277
|
* Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
|
|
129
278
|
*/
|
|
130
|
-
const Notification = /*#__PURE__*/(0, _react.forwardRef)((
|
|
279
|
+
const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
131
280
|
let {
|
|
132
281
|
children,
|
|
133
282
|
system,
|
|
@@ -136,13 +285,9 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
136
285
|
tokens,
|
|
137
286
|
variant,
|
|
138
287
|
...rest
|
|
139
|
-
} =
|
|
288
|
+
} = _ref6;
|
|
140
289
|
const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
|
|
141
290
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
142
|
-
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Notification', tokens, variant, {
|
|
143
|
-
system,
|
|
144
|
-
viewport
|
|
145
|
-
});
|
|
146
291
|
const getCopy = (0, _useCopy.default)({
|
|
147
292
|
dictionary: _dictionary.default,
|
|
148
293
|
copy
|
|
@@ -150,42 +295,89 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
150
295
|
const {
|
|
151
296
|
themeOptions
|
|
152
297
|
} = (0, _ThemeProvider.useTheme)();
|
|
153
|
-
const
|
|
298
|
+
const {
|
|
299
|
+
enableMediaQueryStyleSheet
|
|
300
|
+
} = themeOptions;
|
|
301
|
+
const useTokens = enableMediaQueryStyleSheet ? _ThemeProvider.useResponsiveThemeTokens : _ThemeProvider.useThemeTokens;
|
|
302
|
+
const themeTokens = useTokens('Notification', tokens, variant, {
|
|
303
|
+
system,
|
|
304
|
+
viewport
|
|
305
|
+
});
|
|
306
|
+
const maxWidth = (0, _utils.useResponsiveProp)(themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth);
|
|
307
|
+
const notificationComponentRef = (0, _react.useRef)({
|
|
308
|
+
containerStyles: {},
|
|
309
|
+
contentContainerStyles: {},
|
|
310
|
+
staticContentContainerStyles: {},
|
|
311
|
+
iconContainerStyles: {},
|
|
312
|
+
dismissButtonContainerStyles: {},
|
|
313
|
+
textStyles: {},
|
|
314
|
+
selectIconPropsStyles: {},
|
|
315
|
+
selectDismissIconPropsStyles: {}
|
|
316
|
+
});
|
|
317
|
+
const mediaIdsRef = (0, _react.useRef)({
|
|
318
|
+
containerIds: {},
|
|
319
|
+
contentContainerIds: {},
|
|
320
|
+
staticContentContainerIds: {},
|
|
321
|
+
iconContainerIds: {},
|
|
322
|
+
dismissButtonContainerIds: {},
|
|
323
|
+
textIds: {},
|
|
324
|
+
selectIconPropsIds: {},
|
|
325
|
+
selectDismissIconPropsIds: {}
|
|
326
|
+
});
|
|
327
|
+
if (enableMediaQueryStyleSheet) {
|
|
328
|
+
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, viewport, mediaIdsRef, dismissible);
|
|
329
|
+
} else {
|
|
330
|
+
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible);
|
|
331
|
+
}
|
|
154
332
|
if (isDismissed) {
|
|
155
333
|
return null;
|
|
156
334
|
}
|
|
157
|
-
const textStyles = selectTextStyles(themeTokens, themeOptions, dismissible);
|
|
158
335
|
const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
|
|
159
|
-
textStyles,
|
|
336
|
+
textStyles: notificationComponentRef.current.textStyles.text,
|
|
160
337
|
variant
|
|
161
338
|
}) : children, {
|
|
162
|
-
style: textStyles
|
|
339
|
+
style: notificationComponentRef.current.textStyles.text
|
|
163
340
|
});
|
|
164
341
|
const {
|
|
165
342
|
icon: IconComponent,
|
|
166
343
|
dismissIcon: DismissIconComponent,
|
|
167
344
|
dismissIconColor
|
|
168
|
-
} = themeTokens;
|
|
345
|
+
} = enableMediaQueryStyleSheet === false ? themeTokens : themeTokens[viewport];
|
|
169
346
|
const onDismissPress = () => setIsDismissed(true);
|
|
170
347
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
171
348
|
ref: ref,
|
|
172
|
-
style:
|
|
349
|
+
style: notificationComponentRef.current.containerStyles.container,
|
|
350
|
+
dataSet: mediaIdsRef && {
|
|
351
|
+
media: mediaIdsRef.current.containerIds.container
|
|
352
|
+
},
|
|
173
353
|
...selectProps(rest),
|
|
174
354
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
175
|
-
style:
|
|
355
|
+
style: notificationComponentRef.current.contentContainerStyles.contentContainer,
|
|
356
|
+
dataSet: mediaIdsRef && {
|
|
357
|
+
media: mediaIdsRef.current.contentContainerIds.contentContainer
|
|
358
|
+
},
|
|
176
359
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
177
|
-
style:
|
|
360
|
+
style: notificationComponentRef.current.staticContentContainerStyles.staticContentContainer,
|
|
361
|
+
dataSet: mediaIdsRef && {
|
|
362
|
+
media: mediaIdsRef.current.staticContentContainerIds.staticContentContainer
|
|
363
|
+
},
|
|
178
364
|
children: [IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
179
|
-
style:
|
|
365
|
+
style: notificationComponentRef.current.iconContainerStyles.iconContainer,
|
|
366
|
+
dataSet: mediaIdsRef && {
|
|
367
|
+
media: mediaIdsRef.current.iconContainerIds.iconContainer
|
|
368
|
+
},
|
|
180
369
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
181
|
-
...selectIconProps
|
|
370
|
+
...notificationComponentRef.current.selectIconPropsStyles.selectIconProps
|
|
182
371
|
})
|
|
183
372
|
}), content && typeof content === 'function' ? content({
|
|
184
|
-
textStyles,
|
|
373
|
+
textStyles: notificationComponentRef.current.textStyles.text,
|
|
185
374
|
variant
|
|
186
375
|
}) : content]
|
|
187
376
|
}), dismissible && DismissIconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
188
|
-
style:
|
|
377
|
+
style: notificationComponentRef.current.dismissButtonContainerStyles.dismissButtonContainer,
|
|
378
|
+
dataSet: mediaIdsRef && {
|
|
379
|
+
media: mediaIdsRef.current.dismissButtonContainerIds.dismissButtonContainer
|
|
380
|
+
},
|
|
189
381
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
190
382
|
action: "close",
|
|
191
383
|
onPress: onDismissPress,
|
|
@@ -197,7 +389,7 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
197
389
|
size: 'small'
|
|
198
390
|
},
|
|
199
391
|
children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(DismissIconComponent, {
|
|
200
|
-
...selectDismissIconProps
|
|
392
|
+
...notificationComponentRef.current.selectDismissIconPropsStyles.selectDismissIconProps
|
|
201
393
|
})
|
|
202
394
|
})
|
|
203
395
|
})]
|
|
@@ -229,18 +421,4 @@ Notification.propTypes = {
|
|
|
229
421
|
variant: _utils.variantProp.propType
|
|
230
422
|
};
|
|
231
423
|
var _default = Notification;
|
|
232
|
-
exports.default = _default;
|
|
233
|
-
const staticStyles = _StyleSheet.default.create({
|
|
234
|
-
container: {
|
|
235
|
-
flexDirection: 'row'
|
|
236
|
-
},
|
|
237
|
-
contentContainer: {
|
|
238
|
-
flexDirection: 'row',
|
|
239
|
-
flexShrink: 1
|
|
240
|
-
},
|
|
241
|
-
content: {
|
|
242
|
-
flexDirection: 'row',
|
|
243
|
-
flexShrink: 1,
|
|
244
|
-
justifyContent: 'space-between'
|
|
245
|
-
}
|
|
246
|
-
});
|
|
424
|
+
exports.default = _default;
|
|
@@ -14,25 +14,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
16
|
const [selectProps, selectedSystemPropsTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
|
|
17
|
-
const getChildrenWithParentVariants = (variant, children, start) => {
|
|
18
|
-
if (variant) return children.map((child, i) => {
|
|
19
|
-
var _child$props;
|
|
20
|
-
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
21
|
-
return {
|
|
22
|
-
...child,
|
|
23
|
-
props: {
|
|
24
|
-
...child.props,
|
|
25
|
-
index: start + i,
|
|
26
|
-
isLastChild: i === children.length - 1,
|
|
27
|
-
variant: {
|
|
28
|
-
...existingChildVariants,
|
|
29
|
-
...variant
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
return children;
|
|
35
|
-
};
|
|
36
17
|
const OrderedList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
37
18
|
let {
|
|
38
19
|
children,
|
|
@@ -40,7 +21,27 @@ const OrderedList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
21
|
variant,
|
|
41
22
|
...rest
|
|
42
23
|
} = _ref;
|
|
43
|
-
const childrenWithParentVariants = (0, _react.useMemo)(() =>
|
|
24
|
+
const childrenWithParentVariants = (0, _react.useMemo)(() => {
|
|
25
|
+
const addVariantToProps = (child, i, isLastChild) => {
|
|
26
|
+
var _child$props;
|
|
27
|
+
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
28
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
29
|
+
index: start + i,
|
|
30
|
+
isLastChild,
|
|
31
|
+
variant: {
|
|
32
|
+
...existingChildVariants,
|
|
33
|
+
...variant
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
if (variant) {
|
|
38
|
+
if (Array.isArray(children)) {
|
|
39
|
+
return children.map((child, i) => addVariantToProps(child, i, i === children.length - 1));
|
|
40
|
+
}
|
|
41
|
+
return [addVariantToProps(children, 0, true)];
|
|
42
|
+
}
|
|
43
|
+
return children;
|
|
44
|
+
}, [children, variant, start]);
|
|
44
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedListBase.default, {
|
|
45
46
|
ref: ref,
|
|
46
47
|
...selectProps(rest),
|