@telus-uds/components-base 1.19.0 → 1.19.1

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 (134) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/lib/ActivityIndicator/Spinner.js +7 -7
  3. package/lib/ActivityIndicator/Spinner.native.js +2 -2
  4. package/lib/BaseProvider/HydrationContext.js +1 -1
  5. package/lib/BaseProvider/TamaguiProvider.js +30 -0
  6. package/lib/Button/ButtonBase.js +2 -2
  7. package/lib/Button/ButtonDropdown.js +207 -0
  8. package/lib/Button/ButtonGroup.js +1 -1
  9. package/lib/Carousel/Carousel.js +2 -4
  10. package/lib/Carousel/CarouselContext.js +1 -1
  11. package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
  12. package/lib/Carousel/CarouselThumbnail.js +2 -2
  13. package/lib/Checkbox/Checkbox.js +1 -1
  14. package/lib/Checkbox/CheckboxGroup.js +2 -2
  15. package/lib/Divider/Divider.js +2 -2
  16. package/lib/FlexGrid/Col/Col.js +1 -1
  17. package/lib/Icon/Icon.js +1 -1
  18. package/lib/MultiSelectFilter/ModalOverlay.js +136 -0
  19. package/lib/MultiSelectFilter/MultiSelectFilter.js +314 -0
  20. package/lib/MultiSelectFilter/dictionary.js +19 -0
  21. package/lib/MultiSelectFilter/index.js +13 -0
  22. package/lib/Pagination/PageButton.js +2 -2
  23. package/lib/Pagination/Pagination.js +3 -5
  24. package/lib/Pagination/usePagination.js +2 -2
  25. package/lib/Progress/ProgressBar.js +3 -3
  26. package/lib/Progress/ProgressBarBackground.js +3 -3
  27. package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
  28. package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
  29. package/lib/QuickLinksFeature/index.js +16 -0
  30. package/lib/Radio/Radio.js +2 -2
  31. package/lib/Radio/RadioGroup.js +2 -2
  32. package/lib/RadioCard/RadioCard.js +1 -1
  33. package/lib/RadioCard/RadioCardGroup.js +2 -2
  34. package/lib/Search/Search.js +1 -1
  35. package/lib/Select/constants.js +15 -0
  36. package/lib/SideNav/SideNav.js +2 -2
  37. package/lib/Skeleton/Skeleton.js +1 -1
  38. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  39. package/lib/StackView/StackWrap.js +1 -3
  40. package/lib/StackView/getStackedContent.js +2 -2
  41. package/lib/Tabs/Tabs.js +2 -4
  42. package/lib/Tags/Tags.js +1 -1
  43. package/lib/TextInput/dictionary.js +19 -0
  44. package/lib/ThemeProvider/utils/styles.js +3 -3
  45. package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
  46. package/lib/Timeline/Timeline.js +1 -1
  47. package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
  48. package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
  49. package/lib/Tooltip/Backdrop.js +10 -2
  50. package/lib/Tooltip/Tooltip.native.js +357 -0
  51. package/lib/Tooltip/shared.js +39 -0
  52. package/lib/Validator/Validator.js +271 -0
  53. package/lib/Validator/index.js +13 -0
  54. package/lib/utils/BaseView/BaseView.js +64 -0
  55. package/lib/utils/BaseView/BaseView.native.js +16 -0
  56. package/lib/utils/BaseView/index.js +13 -0
  57. package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
  58. package/lib/utils/children.js +2 -2
  59. package/lib/utils/floating-ui/index.js +43 -0
  60. package/lib/utils/floating-ui/index.native.js +43 -0
  61. package/lib/utils/input.js +12 -6
  62. package/lib/utils/props/componentPropType.js +3 -3
  63. package/lib/utils/props/selectSystemProps.js +2 -2
  64. package/lib/utils/props/tokens.js +2 -2
  65. package/lib/utils/useOverlaidPosition.js +243 -0
  66. package/lib/utils/useSpacingScale.js +1 -3
  67. package/lib/utils/useUniqueId.js +1 -1
  68. package/lib-module/ActivityIndicator/Spinner.js +7 -7
  69. package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
  70. package/lib-module/BaseProvider/HydrationContext.js +1 -1
  71. package/lib-module/BaseProvider/TamaguiProvider.js +22 -0
  72. package/lib-module/Button/ButtonBase.js +2 -2
  73. package/lib-module/Button/ButtonDropdown.js +181 -0
  74. package/lib-module/Button/ButtonGroup.js +1 -1
  75. package/lib-module/Carousel/Carousel.js +2 -4
  76. package/lib-module/Carousel/CarouselContext.js +1 -1
  77. package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
  78. package/lib-module/Carousel/CarouselThumbnail.js +2 -2
  79. package/lib-module/Checkbox/Checkbox.js +1 -1
  80. package/lib-module/Checkbox/CheckboxGroup.js +2 -2
  81. package/lib-module/Divider/Divider.js +2 -2
  82. package/lib-module/FlexGrid/Col/Col.js +1 -1
  83. package/lib-module/Icon/Icon.js +1 -1
  84. package/lib-module/MultiSelectFilter/ModalOverlay.js +112 -0
  85. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +286 -0
  86. package/lib-module/MultiSelectFilter/dictionary.js +12 -0
  87. package/lib-module/MultiSelectFilter/index.js +2 -0
  88. package/lib-module/Pagination/PageButton.js +2 -2
  89. package/lib-module/Pagination/Pagination.js +3 -5
  90. package/lib-module/Pagination/usePagination.js +2 -2
  91. package/lib-module/Progress/ProgressBar.js +3 -3
  92. package/lib-module/Progress/ProgressBarBackground.js +3 -3
  93. package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
  94. package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
  95. package/lib-module/QuickLinksFeature/index.js +4 -0
  96. package/lib-module/Radio/Radio.js +2 -2
  97. package/lib-module/Radio/RadioGroup.js +2 -2
  98. package/lib-module/RadioCard/RadioCard.js +1 -1
  99. package/lib-module/RadioCard/RadioCardGroup.js +2 -2
  100. package/lib-module/Search/Search.js +1 -1
  101. package/lib-module/Select/constants.js +5 -0
  102. package/lib-module/SideNav/SideNav.js +2 -2
  103. package/lib-module/Skeleton/Skeleton.js +1 -1
  104. package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
  105. package/lib-module/StackView/StackWrap.js +1 -3
  106. package/lib-module/StackView/getStackedContent.js +2 -2
  107. package/lib-module/Tabs/Tabs.js +2 -4
  108. package/lib-module/Tags/Tags.js +1 -1
  109. package/lib-module/TextInput/dictionary.js +12 -0
  110. package/lib-module/ThemeProvider/utils/styles.js +3 -3
  111. package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
  112. package/lib-module/Timeline/Timeline.js +1 -1
  113. package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
  114. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
  115. package/lib-module/Tooltip/Backdrop.js +10 -2
  116. package/lib-module/Tooltip/Tooltip.native.js +326 -0
  117. package/lib-module/Tooltip/shared.js +27 -0
  118. package/lib-module/Validator/Validator.js +245 -0
  119. package/lib-module/Validator/index.js +2 -0
  120. package/lib-module/utils/BaseView/BaseView.js +43 -0
  121. package/lib-module/utils/BaseView/BaseView.native.js +6 -0
  122. package/lib-module/utils/BaseView/index.js +2 -0
  123. package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
  124. package/lib-module/utils/children.js +2 -2
  125. package/lib-module/utils/floating-ui/index.js +1 -0
  126. package/lib-module/utils/floating-ui/index.native.js +1 -0
  127. package/lib-module/utils/input.js +12 -6
  128. package/lib-module/utils/props/componentPropType.js +3 -3
  129. package/lib-module/utils/props/selectSystemProps.js +2 -2
  130. package/lib-module/utils/props/tokens.js +2 -2
  131. package/lib-module/utils/useOverlaidPosition.js +232 -0
  132. package/lib-module/utils/useSpacingScale.js +1 -3
  133. package/lib-module/utils/useUniqueId.js +1 -1
  134. package/package.json +2 -2
@@ -39,7 +39,7 @@ export const HydrationProvider = _ref => {
39
39
  }, []); // If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
40
40
 
41
41
  const valueFromAncestor = useHydrationContext();
42
- const isHydrating = valueFromAncestor !== null && valueFromAncestor !== void 0 ? valueFromAncestor : Boolean(!hasMounted && hasWebStyleTag());
42
+ const isHydrating = valueFromAncestor ?? Boolean(!hasMounted && hasWebStyleTag());
43
43
  return /*#__PURE__*/_jsx(HydrationContext.Provider, {
44
44
  value: isHydrating,
45
45
  children: children
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { TamaguiProvider, config } from '@telus-uds/components-multi-platform';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const TamaguiWrapper = _ref => {
6
+ let {
7
+ extended,
8
+ children
9
+ } = _ref;
10
+ console.log('extended', extended);
11
+ return extended ? /*#__PURE__*/_jsx(TamaguiProvider, {
12
+ config: config,
13
+ disableInjectCSS: true,
14
+ defaultTheme: "light",
15
+ children: children
16
+ }) : children;
17
+ };
18
+ TamaguiWrapper.propTypes = {
19
+ children: PropTypes.node.isRequired,
20
+ extended: PropTypes.bool
21
+ };
22
+ export default TamaguiWrapper;
@@ -76,7 +76,7 @@ const selectOuterWidthStyles = _ref3 => {
76
76
 
77
77
 
78
78
  if (Platform.OS === 'web') {
79
- widthStyles.width = "calc(".concat(width, " + ").concat(outerBorderOffset * 2, "px)");
79
+ widthStyles.width = `calc(${width} + ${outerBorderOffset * 2}px)`;
80
80
  return widthStyles;
81
81
  } // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
82
82
 
@@ -163,7 +163,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
163
163
  return Platform.select({
164
164
  web: {
165
165
  // if it would overflow the container, wraps instead
166
- maxWidth: "calc(100% + ".concat(getOuterBorderOffset(themeTokens) * 2, "px)"),
166
+ maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
167
167
  outline: 'none',
168
168
  // removes the default browser :focus outline
169
169
  ...getCursorStyle(inactive, accessibilityRole)
@@ -0,0 +1,181 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Platform from "react-native-web/dist/exports/Platform";
4
+ import Text from "react-native-web/dist/exports/Text";
5
+ import View from "react-native-web/dist/exports/View";
6
+ import buttonPropTypes, { textAndA11yText } from './propTypes';
7
+ import ButtonBase from './ButtonBase';
8
+ import { useThemeTokensCallback } from '../ThemeProvider';
9
+ import { a11yProps, focusHandlerProps, resolvePressableState, selectTokens, useInputValue } from '../utils';
10
+ import Icon from '../Icon';
11
+ import { getStackedContent } from '../StackView';
12
+ import { getPressHandlersWithArgs } from '../utils/pressability';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+
15
+ const selectIconTokens = _ref => {
16
+ let {
17
+ icon,
18
+ iconPosition,
19
+ iconSpace,
20
+ iconSize,
21
+ iconColor,
22
+ iconBackground,
23
+ iconBorderRadius,
24
+ iconAlignSelf,
25
+ iconPadding,
26
+ iconTranslateX,
27
+ iconTranslateY
28
+ } = _ref;
29
+ return {
30
+ icon,
31
+ iconPosition,
32
+ iconSpace,
33
+ iconWrapperStyle: {
34
+ backgroundColor: iconBackground,
35
+ borderRadius: iconBorderRadius,
36
+ alignSelf: iconAlignSelf,
37
+ padding: iconPadding,
38
+ ...Platform.select({
39
+ // TODO: https://github.com/telus/universal-design-system/issues/487
40
+ web: {
41
+ transition: 'color 200ms, background 200ms'
42
+ }
43
+ })
44
+ },
45
+ iconTokens: {
46
+ size: iconSize,
47
+ color: iconColor,
48
+ translateX: iconTranslateX,
49
+ translateY: iconTranslateY
50
+ }
51
+ };
52
+ };
53
+
54
+ const ButtonDropdown = /*#__PURE__*/forwardRef((_ref2, ref) => {
55
+ let {
56
+ value,
57
+ initialValue,
58
+ onChange,
59
+ label,
60
+ tokens,
61
+ variant,
62
+ inactive = false,
63
+ readOnly = false,
64
+ children = null,
65
+ accessibilityRole = 'radio',
66
+ ...props
67
+ } = _ref2;
68
+ const {
69
+ currentValue: isOpen,
70
+ setValue: setIsOpen
71
+ } = useInputValue({
72
+ value,
73
+ initialValue,
74
+ onChange,
75
+ readOnly
76
+ }, 'useButtonDropdownValues');
77
+ const extraState = {
78
+ open: isOpen,
79
+ inactive,
80
+ ...variant
81
+ };
82
+ const getTokens = useThemeTokensCallback('ButtonDropdown', tokens, extraState);
83
+
84
+ const getButtonTokens = buttonState => selectTokens('Button', getTokens(buttonState)); // Pass an object of relevant component state as first argument for any passed-in press handlers
85
+
86
+
87
+ const pressHandlers = getPressHandlersWithArgs(props, [{
88
+ label,
89
+ open: isOpen
90
+ }]);
91
+
92
+ const handlePress = event => {
93
+ if (!inactive) {
94
+ if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
95
+ setIsOpen(!isOpen, event);
96
+ }
97
+ };
98
+
99
+ return /*#__PURE__*/_jsx(ButtonBase, {
100
+ ref: ref,
101
+ ...pressHandlers,
102
+ onPress: handlePress,
103
+ tokens: getButtonTokens,
104
+ inactive: inactive,
105
+ icon: () => null,
106
+ accessibilityRole: accessibilityRole,
107
+ ...props,
108
+ children: _ref3 => {
109
+ let {
110
+ textStyles,
111
+ ...buttonState
112
+ } = _ref3;
113
+ // TODO: once Icon/IconButton designs are stable, see if this sort of styling around
114
+ // an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
115
+ // - Icon: https://github.com/telus/universal-design-system/issues/327
116
+ // - IconButton: https://github.com/telus/universal-design-system/issues/281
117
+ // - Token sets: https://github.com/telus/universal-design-system/issues/782
118
+ const itemTokens = getTokens(buttonState);
119
+ const {
120
+ iconTokens,
121
+ iconPosition,
122
+ iconSpace,
123
+ iconWrapperStyle,
124
+ icon: IconComponent
125
+ } = selectIconTokens(itemTokens);
126
+ const iconContent = IconComponent ? /*#__PURE__*/_jsx(View, {
127
+ style: iconWrapperStyle,
128
+ children: /*#__PURE__*/_jsx(Icon, {
129
+ icon: IconComponent,
130
+ tokens: iconTokens
131
+ })
132
+ }) : null;
133
+
134
+ const childrenContent = () => typeof children === 'function' ? children({ ...resolvePressableState(buttonState, extraState),
135
+ textStyles
136
+ }) : children;
137
+
138
+ const content = children ? childrenContent() : /*#__PURE__*/_jsx(Text, {
139
+ style: textStyles,
140
+ children: label
141
+ });
142
+ return getStackedContent(iconPosition === 'left' ? [iconContent, content] : [content, iconContent], {
143
+ space: iconSpace,
144
+ direction: 'row'
145
+ });
146
+ }
147
+ });
148
+ });
149
+ ButtonDropdown.displayName = 'ButtonDropdown';
150
+ ButtonDropdown.propTypes = { ...a11yProps.types,
151
+ ...focusHandlerProps.types,
152
+ ...buttonPropTypes,
153
+ children: textAndA11yText,
154
+
155
+ /**
156
+ * Callback called when a controlled ButtonDropdown gets interacted with.
157
+ */
158
+ onChange: PropTypes.func,
159
+
160
+ /**
161
+ * `value` prop is being used to set the 'open' state of ButtonDropdown. Use it for
162
+ * controlled ButtonDropdown. For uncontrolled ButtonDropdown, use `initialValue`.
163
+ */
164
+ value: PropTypes.bool,
165
+
166
+ /**
167
+ * Use `initialValue` to provide the initial value for an uncontrolled version.
168
+ */
169
+ initialValue: PropTypes.bool,
170
+
171
+ /**
172
+ * The label of ButtonDropdown.
173
+ */
174
+ label: PropTypes.string,
175
+
176
+ /**
177
+ * By default, `ButtonDropdown` is treated by accessibility tools as a radio button.
178
+ */
179
+ accessibilityRole: PropTypes.string
180
+ };
181
+ export default ButtonDropdown;
@@ -67,7 +67,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
67
67
  const uniqueFields = ['id', 'label'];
68
68
 
69
69
  if (!containUniqueFields(items, uniqueFields)) {
70
- throw new Error("ButtonGroup items must have unique ".concat(uniqueFields.join(', ')));
70
+ throw new Error(`ButtonGroup items must have unique ${uniqueFields.join(', ')}`);
71
71
  } // Some web screenreaders e.g. MacOS Voiceover don't handle radiogroups properly unless radio is direct child of radiogroup
72
72
 
73
73
 
@@ -127,8 +127,6 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
127
127
  */
128
128
 
129
129
  const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
130
- var _systemProps$accessib;
131
-
132
130
  let {
133
131
  tokens,
134
132
  variant,
@@ -393,7 +391,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
393
391
  const getCopyWithPlaceholders = React.useCallback(copyKey => {
394
392
  const copyText = getCopy(copyKey).replace(/%\{title\}/g, title).replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, activeIndex + 1).replace(/%\{stepCount\}/g, childrenArray.length); // First word might be a lowercase placeholder: capitalize the first letter
395
393
 
396
- return "".concat(copyText[0].toUpperCase()).concat(copyText.slice(1));
394
+ return `${copyText[0].toUpperCase()}${copyText.slice(1)}`;
397
395
  }, [activeIndex, childrenArray.length, itemLabel, getCopy, title]);
398
396
  const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/_jsx(CarouselTabsPanel, {
399
397
  items: tabs
@@ -416,7 +414,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
416
414
  // otherwise read the current position on focus
417
415
 
418
416
 
419
- const containerAccessibilityLabel = ((_systemProps$accessib = systemProps.accessibilityLabel) !== null && _systemProps$accessib !== void 0 ? _systemProps$accessib : isFirstFocusContainer) ? "".concat(title ? "".concat(title, " ") : '').concat(getCopyWithPlaceholders('stepTrackerLabel')) : title;
417
+ const containerAccessibilityLabel = systemProps.accessibilityLabel ?? isFirstFocusContainer ? `${title ? `${title} ` : ''}${getCopyWithPlaceholders('stepTrackerLabel')}` : title;
420
418
  const containerProps = {
421
419
  accessibilityLabel: containerAccessibilityLabel,
422
420
  // If used for focus, attach the ref and draw a focus box around the whole carousel
@@ -36,7 +36,7 @@ function useCarousel() {
36
36
  const context = React.useContext(CarouselContext);
37
37
 
38
38
  if (context === undefined) {
39
- throw new Error("'useCarousel' must be used within a 'CarouselProvider'");
39
+ throw new Error(`'useCarousel' must be used within a 'CarouselProvider'`);
40
40
  }
41
41
 
42
42
  return context;
@@ -21,7 +21,7 @@ const CarouselFirstFocus = /*#__PURE__*/forwardRef((_ref, ref) => {
21
21
  } = useCarousel(); // TODO: integrate skip link description if behaving as skip link.
22
22
  // Consider moving this content to aria-live area while only the skip link is focused.
23
23
 
24
- const accessibilityLabel = "".concat(title, ", ").concat(getCopyWithPlaceholders('stepTrackerLabel'));
24
+ const accessibilityLabel = `${title}, ${getCopyWithPlaceholders('stepTrackerLabel')}`;
25
25
  const accessibilityRole = Platform.select({
26
26
  web: 'link',
27
27
  // The focused item will ultimately be a skip link.
@@ -25,7 +25,7 @@ const CarouselThumbnail = _ref => {
25
25
  goTo,
26
26
  themeTokens
27
27
  } = useCarousel();
28
- const thumbnailTitle = alt !== null && alt !== void 0 ? alt : getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
28
+ const thumbnailTitle = alt ?? getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
29
29
 
30
30
  const handlePress = () => goTo(index);
31
31
 
@@ -68,7 +68,7 @@ const CarouselThumbnail = _ref => {
68
68
  style: [styles.pressable, index === activeIndex && styles.selected],
69
69
  children: /*#__PURE__*/_jsx(Image, {
70
70
  accessibilityIgnoresInvertColors: true,
71
- accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : alt,
71
+ accessibilityLabel: accessibilityLabel ?? alt,
72
72
  source: src,
73
73
  style: styles.image,
74
74
  title: thumbnailTitle
@@ -187,7 +187,7 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
187
187
  };
188
188
 
189
189
  const uniqueId = useUniqueId('checkbox');
190
- const inputId = id !== null && id !== void 0 ? id : uniqueId;
190
+ const inputId = id ?? uniqueId;
191
191
  const {
192
192
  themeOptions
193
193
  } = useTheme();
@@ -97,7 +97,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
97
97
  const uniqueFields = ['id', 'label'];
98
98
 
99
99
  if (!containUniqueFields(items, uniqueFields)) {
100
- throw new Error("CheckboxGroup items must have unique ".concat(uniqueFields.join(', ')));
100
+ throw new Error(`CheckboxGroup items must have unique ${uniqueFields.join(', ')}`);
101
101
  }
102
102
 
103
103
  const checkboxes = items.map((_ref2, index) => {
@@ -108,7 +108,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
108
108
  ref: itemRef,
109
109
  ...itemRest
110
110
  } = _ref2;
111
- const checkboxId = id || "Checkbox[".concat(index, "]");
111
+ const checkboxId = id || `Checkbox[${index}]`;
112
112
 
113
113
  const handleChange = (newCheckedState, event) => {
114
114
  if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
@@ -98,9 +98,9 @@ const Divider = /*#__PURE__*/forwardRef((_ref, ref) => {
98
98
  };
99
99
  return /*#__PURE__*/_jsxs(_Fragment, {
100
100
  children: [/*#__PURE__*/_jsx(Spacer, { ...spacerProps,
101
- testID: testID ? "".concat(testID, "-Spacer-before") : undefined
101
+ testID: testID ? `${testID}-Spacer-before` : undefined
102
102
  }), divider, /*#__PURE__*/_jsx(Spacer, { ...spacerProps,
103
- testID: testID ? "".concat(testID, "-Spacer-after") : undefined
103
+ testID: testID ? `${testID}-Spacer-after` : undefined
104
104
  })]
105
105
  });
106
106
  });
@@ -45,7 +45,7 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
45
45
  const horizontalAlignLevel = getHorizontalAlignLevel();
46
46
 
47
47
  const toPercent = num => {
48
- return "".concat(num / 12 * 100, "%");
48
+ return `${num / 12 * 100}%`;
49
49
  };
50
50
 
51
51
  const calculateWidth = value => {
@@ -30,7 +30,7 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
30
30
  // TODO: systematise animations.
31
31
  // https://github.com/telus/universal-design-system/issues/487
32
32
  transition: 'transform 200ms, color 200ms',
33
- transform: [themeTokens.scale ? "scale(".concat(themeTokens.scale, ")") : '', themeTokens.translateX ? "translateX(".concat(themeTokens.translateX, "px)") : '', themeTokens.translateY ? "translateY(".concat(themeTokens.translateY, "px)") : ''].filter(exists => exists).join(' ')
33
+ transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
34
34
  },
35
35
  dataSet: dataSet,
36
36
  children: iconContent
@@ -0,0 +1,112 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import View from "react-native-web/dist/exports/View";
4
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
+ import { Portal } from '@gorhom/portal';
6
+ import { copyPropTypes, getTokensPropType, selectTokens, useCopy, variantProp } from '../utils';
7
+ import { useViewport } from '../ViewportProvider';
8
+ import { useThemeTokens } from '../ThemeProvider';
9
+ import dictionary from './dictionary';
10
+ import Card from '../Card';
11
+ import IconButton from '../IconButton';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Fragment as _Fragment } from "react/jsx-runtime";
15
+ const staticStyles = StyleSheet.create({
16
+ positioner: {
17
+ flex: 1,
18
+ // Grow to maxWidth when possible, shrink when not possible
19
+ position: 'absolute',
20
+ height: 330,
21
+ paddingTop: 5,
22
+ zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
23
+
24
+ },
25
+ closeButtonContainer: {
26
+ position: 'absolute',
27
+ top: 0,
28
+ right: 0,
29
+ zIndex: 1
30
+ }
31
+ });
32
+
33
+ const selectCloseButtonContainerStyles = _ref => {
34
+ let {
35
+ paddingRight,
36
+ paddingTop
37
+ } = _ref;
38
+ return {
39
+ paddingRight,
40
+ paddingTop
41
+ };
42
+ };
43
+
44
+ const selectPaddingContainerStyles = _ref2 => {
45
+ let {
46
+ paddingTop,
47
+ paddingLeft,
48
+ paddingRight
49
+ } = _ref2;
50
+ return {
51
+ paddingBottom: 35,
52
+ paddingTop,
53
+ paddingLeft,
54
+ paddingRight
55
+ };
56
+ };
57
+
58
+ const ModalOverlay = /*#__PURE__*/forwardRef((_ref3, ref) => {
59
+ let {
60
+ children,
61
+ tokens,
62
+ variant,
63
+ copy,
64
+ onClose
65
+ } = _ref3;
66
+ const viewport = useViewport();
67
+ const themeTokens = useThemeTokens('Modal', tokens, variant, {
68
+ viewport,
69
+ maxWidth: false
70
+ });
71
+ const {
72
+ closeIcon: CloseIconComponent,
73
+ maxWidth
74
+ } = themeTokens;
75
+ const getCopy = useCopy({
76
+ dictionary,
77
+ copy
78
+ });
79
+ const closeLabel = getCopy('closeButton');
80
+ return /*#__PURE__*/_jsx(_Fragment, {
81
+ children: /*#__PURE__*/_jsx(Portal, {
82
+ ref: ref,
83
+ children: /*#__PURE__*/_jsx(View, {
84
+ style: [{
85
+ minWidth: maxWidth
86
+ }, staticStyles.positioner],
87
+ children: /*#__PURE__*/_jsxs(Card, {
88
+ tokens: selectPaddingContainerStyles(themeTokens),
89
+ children: [/*#__PURE__*/_jsx(View, {
90
+ style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
91
+ children: /*#__PURE__*/_jsx(IconButton, {
92
+ onPress: onClose,
93
+ icon: CloseIconComponent,
94
+ accessibilityRole: "button",
95
+ accessibilityLabel: closeLabel,
96
+ tokens: selectTokens('IconButton', themeTokens, 'close')
97
+ })
98
+ }), children]
99
+ })
100
+ })
101
+ })
102
+ });
103
+ });
104
+ ModalOverlay.displayName = 'ModalOverlay';
105
+ ModalOverlay.propTypes = {
106
+ children: PropTypes.node.isRequired,
107
+ variant: variantProp.propType,
108
+ tokens: getTokensPropType('Modal'),
109
+ copy: copyPropTypes,
110
+ onClose: PropTypes.func
111
+ };
112
+ export default ModalOverlay;