@telus-uds/components-base 1.16.0 → 1.18.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/component-docs.json +708 -120
  3. package/lib/BaseProvider/HydrationContext.js +74 -0
  4. package/lib/BaseProvider/index.js +14 -6
  5. package/lib/Button/ButtonBase.js +2 -1
  6. package/lib/List/List.js +11 -8
  7. package/lib/List/PressableListItemBase.js +5 -9
  8. package/lib/QuickLinks/QuickLinks.js +91 -0
  9. package/lib/QuickLinks/QuickLinksCard.js +47 -0
  10. package/lib/QuickLinks/QuickLinksItem.js +73 -0
  11. package/lib/QuickLinks/index.js +16 -0
  12. package/lib/StackView/StackWrap.js +16 -12
  13. package/lib/Timeline/Timeline.js +193 -0
  14. package/lib/Timeline/index.js +13 -0
  15. package/lib/ViewportProvider/useViewportListener.js +5 -18
  16. package/lib/index.js +28 -1
  17. package/lib/utils/animation/useVerticalExpandAnimation.js +3 -1
  18. package/lib/utils/index.js +9 -0
  19. package/lib/utils/useSafeLayoutEffect.js +40 -0
  20. package/lib-module/BaseProvider/HydrationContext.js +51 -0
  21. package/lib-module/BaseProvider/index.js +12 -6
  22. package/lib-module/Button/ButtonBase.js +2 -1
  23. package/lib-module/List/List.js +12 -8
  24. package/lib-module/List/PressableListItemBase.js +6 -10
  25. package/lib-module/QuickLinks/QuickLinks.js +71 -0
  26. package/lib-module/QuickLinks/QuickLinksCard.js +33 -0
  27. package/lib-module/QuickLinks/QuickLinksItem.js +50 -0
  28. package/lib-module/QuickLinks/index.js +4 -0
  29. package/lib-module/StackView/StackWrap.js +16 -13
  30. package/lib-module/Timeline/Timeline.js +174 -0
  31. package/lib-module/Timeline/index.js +2 -0
  32. package/lib-module/ViewportProvider/useViewportListener.js +5 -18
  33. package/lib-module/index.js +4 -1
  34. package/lib-module/utils/animation/useVerticalExpandAnimation.js +4 -3
  35. package/lib-module/utils/index.js +1 -0
  36. package/lib-module/utils/useSafeLayoutEffect.js +30 -0
  37. package/package.json +6 -5
  38. package/src/BaseProvider/HydrationContext.jsx +44 -0
  39. package/src/BaseProvider/index.jsx +11 -7
  40. package/src/Button/ButtonBase.jsx +2 -2
  41. package/src/List/List.jsx +9 -13
  42. package/src/List/PressableListItemBase.jsx +7 -9
  43. package/src/QuickLinks/QuickLinks.jsx +61 -0
  44. package/src/QuickLinks/QuickLinksCard.jsx +26 -0
  45. package/src/QuickLinks/QuickLinksItem.jsx +46 -0
  46. package/src/QuickLinks/index.js +6 -0
  47. package/src/StackView/StackWrap.jsx +20 -13
  48. package/src/Timeline/Timeline.jsx +148 -0
  49. package/src/Timeline/index.js +3 -0
  50. package/src/ViewportProvider/useViewportListener.js +4 -16
  51. package/src/index.js +3 -0
  52. package/src/utils/animation/useVerticalExpandAnimation.js +4 -2
  53. package/src/utils/index.js +1 -0
  54. package/src/utils/useSafeLayoutEffect.js +31 -0
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
13
+
14
+ var _ThemeProvider = require("../ThemeProvider");
15
+
16
+ var _utils = require("../utils");
17
+
18
+ var _ViewportProvider = require("../ViewportProvider");
19
+
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ const selectDotStyles = _ref => {
29
+ let {
30
+ dotWidth,
31
+ timelineColor,
32
+ dotBorderWidth,
33
+ dotColor
34
+ } = _ref;
35
+ return {
36
+ width: dotWidth,
37
+ height: dotWidth,
38
+ borderRadius: dotWidth / 2,
39
+ backgroundColor: dotColor,
40
+ borderWidth: dotBorderWidth,
41
+ borderColor: timelineColor
42
+ };
43
+ };
44
+
45
+ const selectConnectorStyles = _ref2 => {
46
+ let {
47
+ timelineColor,
48
+ connectorHeight,
49
+ connectorWidth
50
+ } = _ref2;
51
+ return {
52
+ width: connectorWidth,
53
+ height: connectorHeight,
54
+ backgroundColor: timelineColor
55
+ };
56
+ };
57
+
58
+ const selectTimelineContainerStyle = _ref3 => {
59
+ let {
60
+ timelineContainerDirection
61
+ } = _ref3;
62
+ return {
63
+ flexDirection: timelineContainerDirection
64
+ };
65
+ };
66
+
67
+ const selectLineItemStyles = _ref4 => {
68
+ let {
69
+ lineItemAlign,
70
+ lineItemDirection,
71
+ lineItemMarginBottom,
72
+ lineItemMarginRight
73
+ } = _ref4;
74
+ return {
75
+ alignItems: lineItemAlign,
76
+ flexDirection: lineItemDirection,
77
+ marginBottom: lineItemMarginBottom,
78
+ marginRight: lineItemMarginRight,
79
+ overflow: 'hidden'
80
+ };
81
+ };
82
+
83
+ const selectLineItemContainer = _ref5 => {
84
+ let {
85
+ lineItemContainerDirection,
86
+ lineContainerFlexSize
87
+ } = _ref5;
88
+ return {
89
+ flexDirection: lineItemContainerDirection,
90
+ flex: lineContainerFlexSize
91
+ };
92
+ };
93
+
94
+ const selectItemContentStyles = (_ref6, isLastChild) => {
95
+ let {
96
+ itemContentFlexSize,
97
+ itemContentMarginBottom,
98
+ itemContentMarginRight
99
+ } = _ref6;
100
+ return {
101
+ flex: itemContentFlexSize,
102
+ marginBottom: !isLastChild && itemContentMarginBottom,
103
+ marginRight: !isLastChild && itemContentMarginRight
104
+ };
105
+ };
106
+
107
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
108
+ /**
109
+ * Timeline is a component that displays either a horizontal or vertical list of the
110
+ * children components passed by props
111
+ *
112
+ * ## Component API
113
+ *
114
+ * - `horizontal` In order to display the Component list horizontally
115
+ *
116
+ *
117
+ * ## A11y guidelines
118
+ * Timeline link supports all the common a11y props.
119
+ */
120
+
121
+ const Timeline = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
122
+ let {
123
+ tokens,
124
+ variant = {},
125
+ children,
126
+ accessibilityLabel,
127
+ tag = 'ul',
128
+ childrenTag = 'li',
129
+ ...rest
130
+ } = _ref7;
131
+ const viewport = (0, _ViewportProvider.useViewport)();
132
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('Timeline', tokens, variant, {
133
+ viewport
134
+ });
135
+ const containerProps = { ...selectProps(rest),
136
+ ...(0, _utils.getA11yPropsFromHtmlTag)(tag, rest.accessibilityRole || 'list'),
137
+ accessibilityLabel
138
+ };
139
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, { ...containerProps,
140
+ ref: ref,
141
+ style: selectTimelineContainerStyle(themeTokens),
142
+ children: children.map((child, index) => {
143
+ var _child$props;
144
+
145
+ const childrenProps = { ...(0, _utils.getA11yPropsFromHtmlTag)(childrenTag, (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.accessibilityRole) || 'listitem')
146
+ };
147
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
148
+ style: selectLineItemContainer(themeTokens) // eslint-disable-next-line react/no-array-index-key
149
+ ,
150
+ ...childrenProps,
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
152
+ style: selectLineItemStyles(themeTokens),
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
154
+ style: selectDotStyles(themeTokens)
155
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
156
+ style: selectConnectorStyles(themeTokens)
157
+ })]
158
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
159
+ style: selectItemContentStyles(themeTokens, index + 1 === children.length),
160
+ children: child
161
+ })]
162
+ }, "timeline-".concat(index, "-").concat(child.displayName));
163
+ })
164
+ });
165
+ });
166
+ Timeline.displayName = 'Timeline';
167
+ Timeline.propTypes = { ...selectedSystemPropTypes,
168
+ tokens: (0, _utils.getTokensPropType)('Timeline'),
169
+ variant: _utils.variantProp.propType,
170
+
171
+ /**
172
+ * A list of components that will be rendered either horizontally or vertically
173
+ */
174
+ children: _propTypes.default.arrayOf(_propTypes.default.node).isRequired,
175
+
176
+ /**
177
+ * A required accessibility label that needs to be passed to be used on List
178
+ * which is applied as normal for a React Native accessibilityLabel prop.
179
+ */
180
+ accessibilityLabel: _propTypes.default.string.isRequired,
181
+
182
+ /**
183
+ * Sets the HTML tag of the outer container and the children. By default `'li'` for the children
184
+ * and `'ul'` for the container
185
+ *
186
+ * If either `tag` or `childrenTag` is overridden, the other should be too, to avoid producing invalid HTML.
187
+ *
188
+ */
189
+ tag: _propTypes.default.oneOf(_utils.layoutTags),
190
+ childrenTag: _propTypes.default.oneOf(_utils.layoutTags)
191
+ };
192
+ var _default = Timeline;
193
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Timeline = _interopRequireDefault(require("./Timeline"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _Timeline.default;
13
+ exports.default = _default;
@@ -5,28 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _react = require("react");
9
-
10
8
  var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
11
9
 
12
10
  var _systemConstants = require("@telus-uds/system-constants");
13
11
 
12
+ var _useSafeLayoutEffect = _interopRequireDefault(require("../utils/useSafeLayoutEffect"));
13
+
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  // Use Dimensions instead of useWindowDimensions because useWindowDimensions forces context
17
17
  // to update on every pixel change during window resize; but we only want rerenders to occur
18
18
  // when a viewport threshold has been crossed.
19
19
  const lookupViewport = () => _systemConstants.viewports.select(_Dimensions.default.get('window').width);
20
- /**
21
- * In SSR, React gets spooked if it sees `useLayoutEffect` and fires warnings assuming the
22
- * developer doesn't realise the effect won't run: https://reactjs.org/link/uselayouteffect-ssr
23
- *
24
- * To avoid these warnings while still conforming to the rules of hooks, always use this
25
- * explicitly no-op hook, instead of the useLayoutEffect that is implicitly no-op on SSR.
26
- */
27
-
28
-
29
- const useViewportListenerSSR = () => {};
30
20
  /**
31
21
  * When client-side rendering, immediately set the viewport to the correct value as a layout effect so
32
22
  * if the viewport isn't the smallest, any SSR-rendered components rerender correctly before anything
@@ -34,8 +24,8 @@ const useViewportListenerSSR = () => {};
34
24
  */
35
25
 
36
26
 
37
- const useViewportListenerCSR = setViewport => {
38
- (0, _react.useLayoutEffect)(() => {
27
+ const useViewportListener = setViewport => {
28
+ (0, _useSafeLayoutEffect.default)(() => {
39
29
  setViewport(lookupViewport());
40
30
 
41
31
  const onChange = _ref => {
@@ -57,10 +47,7 @@ const useViewportListenerCSR = setViewport => {
57
47
  }
58
48
  };
59
49
  }, [setViewport]);
60
- }; // Window is a defined global object in both Web and Native client-side, and undefined in SSR
61
-
50
+ };
62
51
 
63
- const isSSR = typeof window === 'undefined';
64
- const useViewportListener = isSSR ? useViewportListenerSSR : useViewportListenerCSR;
65
52
  var _default = useViewportListener;
66
53
  exports.default = _default;
package/lib/index.js CHANGED
@@ -28,6 +28,7 @@ var _exportNames = {
28
28
  Notification: true,
29
29
  Pagination: true,
30
30
  Progress: true,
31
+ QuickLinks: true,
31
32
  Radio: true,
32
33
  RadioCard: true,
33
34
  Search: true,
@@ -40,6 +41,7 @@ var _exportNames = {
40
41
  StepTracker: true,
41
42
  Tabs: true,
42
43
  Tags: true,
44
+ Timeline: true,
43
45
  Tooltip: true,
44
46
  TooltipButton: true,
45
47
  Typography: true,
@@ -56,7 +58,8 @@ var _exportNames = {
56
58
  getThemeTokens: true,
57
59
  applyOuterBorder: true,
58
60
  applyTextStyles: true,
59
- applyShadowToken: true
61
+ applyShadowToken: true,
62
+ Portal: true
60
63
  };
61
64
  Object.defineProperty(exports, "A11yInfoProvider", {
62
65
  enumerable: true,
@@ -202,6 +205,12 @@ Object.defineProperty(exports, "Pagination", {
202
205
  return _Pagination.default;
203
206
  }
204
207
  });
208
+ Object.defineProperty(exports, "Portal", {
209
+ enumerable: true,
210
+ get: function () {
211
+ return _portal.Portal;
212
+ }
213
+ });
205
214
  Object.defineProperty(exports, "PressableCardBase", {
206
215
  enumerable: true,
207
216
  get: function () {
@@ -214,6 +223,12 @@ Object.defineProperty(exports, "Progress", {
214
223
  return _Progress.default;
215
224
  }
216
225
  });
226
+ Object.defineProperty(exports, "QuickLinks", {
227
+ enumerable: true,
228
+ get: function () {
229
+ return _QuickLinks.default;
230
+ }
231
+ });
217
232
  Object.defineProperty(exports, "Radio", {
218
233
  enumerable: true,
219
234
  get: function () {
@@ -292,6 +307,12 @@ Object.defineProperty(exports, "ThemeProvider", {
292
307
  return _ThemeProvider.default;
293
308
  }
294
309
  });
310
+ Object.defineProperty(exports, "Timeline", {
311
+ enumerable: true,
312
+ get: function () {
313
+ return _Timeline.default;
314
+ }
315
+ });
295
316
  Object.defineProperty(exports, "Tooltip", {
296
317
  enumerable: true,
297
318
  get: function () {
@@ -495,6 +516,8 @@ var _Pagination = _interopRequireDefault(require("./Pagination"));
495
516
 
496
517
  var _Progress = _interopRequireDefault(require("./Progress"));
497
518
 
519
+ var _QuickLinks = _interopRequireDefault(require("./QuickLinks"));
520
+
498
521
  var _Radio = _interopRequireWildcard(require("./Radio"));
499
522
 
500
523
  Object.keys(_Radio).forEach(function (key) {
@@ -569,6 +592,8 @@ Object.keys(_TextInput).forEach(function (key) {
569
592
  });
570
593
  });
571
594
 
595
+ var _Timeline = _interopRequireDefault(require("./Timeline"));
596
+
572
597
  var _ToggleSwitch = require("./ToggleSwitch");
573
598
 
574
599
  Object.keys(_ToggleSwitch).forEach(function (key) {
@@ -611,6 +636,8 @@ Object.keys(_utils).forEach(function (key) {
611
636
  });
612
637
  });
613
638
 
639
+ var _portal = require("@gorhom/portal");
640
+
614
641
  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); }
615
642
 
616
643
  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; }
@@ -13,6 +13,8 @@ var _Easing = _interopRequireDefault(require("react-native-web/dist/cjs/exports/
13
13
 
14
14
  var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
15
15
 
16
+ var _useSafeLayoutEffect = _interopRequireDefault(require("../useSafeLayoutEffect"));
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  // TODO: systematise animations
@@ -32,7 +34,7 @@ function useVerticalExpandAnimation(_ref) {
32
34
  expandDuration,
33
35
  collapseDuration
34
36
  } = tokens;
35
- (0, _react.useLayoutEffect)(() => {
37
+ (0, _useSafeLayoutEffect.default)(() => {
36
38
  if (expandStateChanged) {
37
39
  setIsAnimating(true);
38
40
  setWasExpanded(isExpanded);
@@ -9,6 +9,7 @@ var _exportNames = {
9
9
  useHash: true,
10
10
  useSpacingScale: true,
11
11
  useResponsiveProp: true,
12
+ useSafeLayoutEffect: true,
12
13
  useScrollBlocking: true,
13
14
  useUniqueId: true,
14
15
  withLinkRouter: true,
@@ -44,6 +45,12 @@ Object.defineProperty(exports, "useResponsiveProp", {
44
45
  return _useResponsiveProp.default;
45
46
  }
46
47
  });
48
+ Object.defineProperty(exports, "useSafeLayoutEffect", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _useSafeLayoutEffect.default;
52
+ }
53
+ });
47
54
  Object.defineProperty(exports, "useScrollBlocking", {
48
55
  enumerable: true,
49
56
  get: function () {
@@ -175,6 +182,8 @@ Object.keys(_useResponsiveProp).forEach(function (key) {
175
182
  });
176
183
  });
177
184
 
185
+ var _useSafeLayoutEffect = _interopRequireDefault(require("./useSafeLayoutEffect"));
186
+
178
187
  var _useScrollBlocking = _interopRequireDefault(require("./useScrollBlocking"));
179
188
 
180
189
  var _useUniqueId = _interopRequireDefault(require("./useUniqueId"));
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _HydrationContext = require("../BaseProvider/HydrationContext");
11
+
12
+ const isSSR = typeof window === 'undefined';
13
+
14
+ const noop = () => {};
15
+ /**
16
+ * useSafeLayoutEffect is a alternative to useLayoutEffect that avoids SSR hydration problems:
17
+ * - In a client-side render, it uses useLayoutEffect to avoid flashing the pre-render UI to the user.
18
+ * - During hydration from SSR, the provided function is skipped to avoid mismatches from server content.
19
+ * - In SSR, it is a no-op function to avoid warnings about using useLayoutEffect in SSR
20
+ */
21
+
22
+
23
+ const useSafeLayoutEffect = isSSR ? noop // avoid React's fussy warnings by ensuring to never call useLayoutEffect on server
24
+ : function (fn) {
25
+ let deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
26
+ const isHydrating = (0, _HydrationContext.useHydrationContext)(); // Callback updates and effect re-runs when deps array content changes, like useEffect.
27
+
28
+ /* eslint-disable-next-line react-hooks/exhaustive-deps */
29
+
30
+ const callback = (0, _react.useCallback)(fn, deps);
31
+ (0, _react.useLayoutEffect)(() => {
32
+ // Do nothing before hydrating server-generated content, like useEffect. When hydration completes,
33
+ // useHydrationContext provides false, re-rendering this hook and re-running the effect.
34
+ if (isHydrating) return noop; // If there's no hydration in progress, behave like useLayoutEffect.
35
+
36
+ return callback();
37
+ }, [isHydrating, callback]);
38
+ };
39
+ var _default = useSafeLayoutEffect;
40
+ exports.default = _default;
@@ -0,0 +1,51 @@
1
+ import React, { createContext, useContext, useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Platform from "react-native-web/dist/exports/Platform";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const HydrationContext = /*#__PURE__*/createContext();
6
+ const isSSR = typeof window === 'undefined';
7
+
8
+ const hasWebStyleTag = () => {
9
+ var _document;
10
+
11
+ if (isSSR || Platform.OS !== 'web' || typeof document !== 'object') {
12
+ return false;
13
+ }
14
+
15
+ return Boolean((_document = document) === null || _document === void 0 ? void 0 : _document.getElementById('react-native-stylesheet'));
16
+ };
17
+ /**
18
+ * Returns true if this render cycle is the hydration of existing SSR content.
19
+ *
20
+ * Use this when changing how content renders based on data that is instantly available
21
+ * during the very first client-side render or hydration, but not available on the server,
22
+ * to ensure no changes happen until the original SSR DOM has been hydrated.
23
+ */
24
+
25
+
26
+ export const useHydrationContext = () => useContext(HydrationContext);
27
+ /**
28
+ * Allows components and hooks to observe if SSR hydration is currently in progress
29
+ * and if so, to re-render with content that differs to the server when it is complete.
30
+ */
31
+
32
+ export const HydrationProvider = _ref => {
33
+ let {
34
+ children
35
+ } = _ref;
36
+ const [hasMounted, setHasMounted] = useState(false);
37
+ useEffect(() => {
38
+ setHasMounted(true);
39
+ }, []); // If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
40
+
41
+ const valueFromAncestor = useHydrationContext();
42
+ const isHydrating = valueFromAncestor !== null && valueFromAncestor !== void 0 ? valueFromAncestor : Boolean(!hasMounted && hasWebStyleTag());
43
+ return /*#__PURE__*/_jsx(HydrationContext.Provider, {
44
+ value: isHydrating,
45
+ children: children
46
+ });
47
+ };
48
+ HydrationProvider.propTypes = {
49
+ children: PropTypes.node
50
+ };
51
+ export default HydrationProvider;
@@ -2,9 +2,11 @@ var _ThemeProvider$propTy;
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
+ import { PortalProvider } from '@gorhom/portal';
5
6
  import A11yInfoProvider from '../A11yInfoProvider';
6
7
  import ViewportProvider from '../ViewportProvider';
7
8
  import ThemeProvider from '../ThemeProvider';
9
+ import { HydrationProvider } from './HydrationContext';
8
10
  import { jsx as _jsx } from "react/jsx-runtime";
9
11
 
10
12
  const BaseProvider = _ref => {
@@ -13,12 +15,16 @@ const BaseProvider = _ref => {
13
15
  children,
14
16
  themeOptions
15
17
  } = _ref;
16
- return /*#__PURE__*/_jsx(A11yInfoProvider, {
17
- children: /*#__PURE__*/_jsx(ViewportProvider, {
18
- children: /*#__PURE__*/_jsx(ThemeProvider, {
19
- defaultTheme: defaultTheme,
20
- themeOptions: themeOptions,
21
- children: children
18
+ return /*#__PURE__*/_jsx(HydrationProvider, {
19
+ children: /*#__PURE__*/_jsx(A11yInfoProvider, {
20
+ children: /*#__PURE__*/_jsx(ViewportProvider, {
21
+ children: /*#__PURE__*/_jsx(ThemeProvider, {
22
+ defaultTheme: defaultTheme,
23
+ themeOptions: themeOptions,
24
+ children: /*#__PURE__*/_jsx(PortalProvider, {
25
+ children: children
26
+ })
27
+ })
22
28
  })
23
29
  })
24
30
  });
@@ -171,11 +171,12 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
171
171
  const selectItemIconTokens = _ref8 => {
172
172
  let {
173
173
  color,
174
+ iconColor,
174
175
  iconSize
175
176
  } = _ref8;
176
177
  return {
177
178
  size: iconSize,
178
- color
179
+ color: iconColor || color
179
180
  };
180
181
  };
181
182
 
@@ -2,15 +2,23 @@ import React, { cloneElement, forwardRef, Children } from 'react';
2
2
  import View from "react-native-web/dist/exports/View";
3
3
  import Platform from "react-native-web/dist/exports/Platform";
4
4
  import PropTypes from 'prop-types';
5
- import { a11yProps, componentPropType, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
6
- import ListItem from './ListItem';
5
+ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
8
+
9
+ const isListItem = element => {
10
+ var _element$type, _element$type2;
11
+
12
+ const elementName = (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.displayName) || (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.name); // Match our own ListItem, and also, custom list items
13
+
14
+ return Boolean(elementName.match(/Item/));
15
+ };
9
16
  /**
10
17
  * An unordered List component has a child a ListItem that
11
18
  * allows icon, dividers and customized typography
12
19
  */
13
20
 
21
+
14
22
  const List = /*#__PURE__*/forwardRef((_ref, ref) => {
15
23
  let {
16
24
  children,
@@ -24,12 +32,8 @@ const List = /*#__PURE__*/forwardRef((_ref, ref) => {
24
32
  ...rest
25
33
  } = _ref;
26
34
  const items = Children.map(children, (child, index) => {
27
- var _child$type, _child$type2;
28
-
29
35
  // Pass ListItem-specific props to children (by name so teams can add their own ListItems)
30
- const isListItem = componentName => Boolean(componentName === ListItem.displayName);
31
-
32
- if (isListItem(child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) || isListItem(child === null || child === void 0 ? void 0 : (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.name)) {
36
+ if (isListItem(child)) {
33
37
  return /*#__PURE__*/cloneElement(child, {
34
38
  showDivider,
35
39
  isLastItem: index + 1 === Children.count(children),
@@ -52,7 +56,7 @@ List.displayName = 'List';
52
56
  List.propTypes = { ...selectedSystemPropTypes,
53
57
  tokens: getTokensPropType('List'),
54
58
  variant: variantProp.propType,
55
- children: componentPropType('ListItem'),
59
+ children: PropTypes.node,
56
60
 
57
61
  /**
58
62
  * In case it is not the last item allow display divider
@@ -4,10 +4,10 @@ import ABBPropTypes from 'airbnb-prop-types';
4
4
  import Pressable from "react-native-web/dist/exports/Pressable";
5
5
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
6
  import Platform from "react-native-web/dist/exports/Platform";
7
- import { resolvePressableTokens, clickProps, linkProps, hrefAttrsProp, withLinkRouter } from '../utils';
7
+ import { resolvePressableTokens, clickProps, linkProps, hrefAttrsProp, selectTokens, withLinkRouter } from '../utils';
8
8
  import ListItemBase from './ListItemBase';
9
- import ListItemContent, { tokenTypes as contentTokenTypes } from './ListItemContent';
10
- import ListItemMark, { tokenTypes as markTokenTypes } from './ListItemMark';
9
+ import ListItemContent from './ListItemContent';
10
+ import ListItemMark from './ListItemMark';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -57,9 +57,10 @@ const PressableListItemBase = /*#__PURE__*/forwardRef((_ref2, ref) => {
57
57
  href,
58
58
  onPress
59
59
  });
60
+ const listItemTokens = selectTokens('List', typeof tokens === 'function' ? tokens() : tokens);
60
61
  return /*#__PURE__*/_jsx(ListItemBase, {
61
62
  ref: listItemRef,
62
- tokens: tokens(),
63
+ tokens: listItemTokens,
63
64
  ...listItemProps,
64
65
  children: _ref3 => {
65
66
  let {
@@ -99,16 +100,11 @@ const staticStyles = StyleSheet.create({
99
100
  itemContainer: {
100
101
  flexDirection: 'row',
101
102
  flex: 1
102
- },
103
- tokens: { ...contentTokenTypes,
104
- ...markTokenTypes
105
103
  }
106
104
  });
107
- PressableListItemBase.propTypes = {
105
+ PressableListItemBase.propTypes = { ...withLinkRouter.propTypes,
108
106
  href: PropTypes.string,
109
107
  onPress: PropTypes.func,
110
- // TODO - type this better, maybe import the subcomponent token types and run it through util
111
- // eslint-disable-next-line react/forbid-prop-types
112
108
  tokens: PropTypes.any,
113
109
  icon: PropTypes.elementType,
114
110
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),