@telus-uds/components-base 1.8.2 → 1.8.5
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 +33 -2
- package/component-docs.json +36 -1
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Checkbox/Checkbox.js +5 -3
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/ExpandCollapse/Panel.js +2 -17
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/Link/InlinePressable.js +5 -1
- package/lib/Link/LinkBase.js +5 -2
- package/lib/List/List.js +12 -7
- package/lib/List/ListItem.js +4 -5
- package/lib/Modal/Modal.js +2 -1
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +5 -3
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Search/Search.js +1 -1
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +3 -1
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +28 -3
- package/lib/Tabs/TabsItem.js +5 -6
- package/lib/Tags/Tags.js +1 -1
- package/lib/ThemeProvider/utils/styles.js +2 -2
- package/lib/ThemeProvider/utils/theme-tokens.js +7 -9
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +2 -10
- package/lib/utils/animation/useVerticalExpandAnimation.js +40 -14
- package/lib/utils/children.js +2 -2
- package/lib/utils/input.js +6 -12
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useSpacingScale.js +3 -1
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/A11yInfoProvider/index.js +63 -0
- package/lib-module/A11yText/index.js +56 -0
- package/lib-module/ActivityIndicator/Spinner.js +77 -0
- package/lib-module/ActivityIndicator/Spinner.native.js +144 -0
- package/lib-module/ActivityIndicator/index.js +41 -0
- package/lib-module/ActivityIndicator/shared.js +12 -0
- package/lib-module/BaseProvider/index.js +29 -0
- package/lib-module/Box/Box.js +244 -0
- package/lib-module/Box/index.js +2 -0
- package/lib-module/Button/Button.js +26 -0
- package/lib-module/Button/ButtonBase.js +271 -0
- package/lib-module/Button/ButtonGroup.js +247 -0
- package/lib-module/Button/ButtonLink.js +40 -0
- package/lib-module/Button/index.js +4 -0
- package/lib-module/Button/propTypes.js +36 -0
- package/lib-module/Card/Card.js +84 -0
- package/lib-module/Card/CardBase.js +66 -0
- package/lib-module/Card/PressableCardBase.js +114 -0
- package/lib-module/Card/index.js +4 -0
- package/lib-module/Checkbox/Checkbox.js +348 -0
- package/lib-module/Checkbox/CheckboxGroup.js +233 -0
- package/lib-module/Checkbox/CheckboxInput.js +60 -0
- package/lib-module/Checkbox/CheckboxInput.native.js +6 -0
- package/lib-module/Checkbox/index.js +3 -0
- package/lib-module/Divider/Divider.js +124 -0
- package/lib-module/Divider/index.js +2 -0
- package/lib-module/ExpandCollapse/Accordion.js +15 -0
- package/lib-module/ExpandCollapse/Control.js +136 -0
- package/lib-module/ExpandCollapse/ExpandCollapse.js +95 -0
- package/lib-module/ExpandCollapse/Panel.js +151 -0
- package/lib-module/ExpandCollapse/index.js +7 -0
- package/lib-module/Feedback/Feedback.js +157 -0
- package/lib-module/Feedback/index.js +2 -0
- package/lib-module/Fieldset/Fieldset.js +153 -0
- package/lib-module/Fieldset/FieldsetContainer.js +32 -0
- package/lib-module/Fieldset/FieldsetContainer.native.js +23 -0
- package/lib-module/Fieldset/Legend.js +24 -0
- package/lib-module/Fieldset/Legend.native.js +31 -0
- package/lib-module/Fieldset/cssReset.js +14 -0
- package/lib-module/Fieldset/index.js +2 -0
- package/lib-module/FlexGrid/Col/Col.js +276 -0
- package/lib-module/FlexGrid/Col/index.js +2 -0
- package/lib-module/FlexGrid/FlexGrid.js +148 -0
- package/lib-module/FlexGrid/Row/Row.js +184 -0
- package/lib-module/FlexGrid/Row/index.js +2 -0
- package/lib-module/FlexGrid/helpers/index.js +18 -0
- package/lib-module/FlexGrid/index.js +2 -0
- package/lib-module/FlexGrid/providers/GutterContext.js +3 -0
- package/lib-module/HorizontalScroll/HorizontalScroll.js +175 -0
- package/lib-module/HorizontalScroll/HorizontalScrollButton.js +81 -0
- package/lib-module/HorizontalScroll/ScrollViewEnd.js +48 -0
- package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +27 -0
- package/lib-module/HorizontalScroll/dictionary.js +11 -0
- package/lib-module/HorizontalScroll/index.js +11 -0
- package/lib-module/HorizontalScroll/itemPositions.js +112 -0
- package/lib-module/Icon/Icon.js +62 -0
- package/lib-module/Icon/IconText.js +83 -0
- package/lib-module/Icon/index.js +4 -0
- package/lib-module/IconButton/IconButton.js +122 -0
- package/lib-module/IconButton/index.js +2 -0
- package/lib-module/InputLabel/InputLabel.js +148 -0
- package/lib-module/InputLabel/LabelContent.js +27 -0
- package/lib-module/InputLabel/LabelContent.native.js +19 -0
- package/lib-module/InputLabel/index.js +2 -0
- package/lib-module/InputSupports/InputSupports.js +96 -0
- package/lib-module/InputSupports/index.js +2 -0
- package/lib-module/InputSupports/useInputSupports.js +32 -0
- package/lib-module/Link/ChevronLink.js +52 -0
- package/lib-module/Link/InlinePressable.js +44 -0
- package/lib-module/Link/InlinePressable.native.js +89 -0
- package/lib-module/Link/Link.js +28 -0
- package/lib-module/Link/LinkBase.js +243 -0
- package/lib-module/Link/TextButton.js +35 -0
- package/lib-module/Link/index.js +5 -0
- package/lib-module/List/List.js +62 -0
- package/lib-module/List/ListItem.js +248 -0
- package/lib-module/List/index.js +5 -0
- package/lib-module/Modal/Modal.js +222 -0
- package/lib-module/Modal/dictionary.js +9 -0
- package/lib-module/Modal/index.js +2 -0
- package/lib-module/Notification/Notification.js +209 -0
- package/lib-module/Notification/dictionary.js +8 -0
- package/lib-module/Notification/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +66 -0
- package/lib-module/Pagination/Pagination.js +153 -0
- package/lib-module/Pagination/SideButton.js +106 -0
- package/lib-module/Pagination/dictionary.js +18 -0
- package/lib-module/Pagination/index.js +2 -0
- package/lib-module/Pagination/usePagination.js +73 -0
- package/lib-module/Progress/Progress.js +89 -0
- package/lib-module/Progress/ProgressBar.js +138 -0
- package/lib-module/Progress/ProgressBarBackground.js +42 -0
- package/lib-module/Progress/index.js +4 -0
- package/lib-module/Radio/Radio.js +285 -0
- package/lib-module/Radio/RadioButton.js +138 -0
- package/lib-module/Radio/RadioGroup.js +243 -0
- package/lib-module/Radio/RadioInput.js +62 -0
- package/lib-module/Radio/RadioInput.native.js +6 -0
- package/lib-module/Radio/index.js +3 -0
- package/lib-module/RadioCard/RadioCard.js +219 -0
- package/lib-module/RadioCard/RadioCardGroup.js +250 -0
- package/lib-module/RadioCard/index.js +3 -0
- package/lib-module/Search/Search.js +261 -0
- package/lib-module/Search/dictionary.js +12 -0
- package/lib-module/Search/index.js +2 -0
- package/lib-module/Select/Group.js +21 -0
- package/lib-module/Select/Group.native.js +15 -0
- package/lib-module/Select/Item.js +20 -0
- package/lib-module/Select/Item.native.js +3 -0
- package/lib-module/Select/Picker.js +68 -0
- package/lib-module/Select/Picker.native.js +120 -0
- package/lib-module/Select/Select.js +337 -0
- package/lib-module/Select/index.js +6 -0
- package/lib-module/SideNav/Item.js +145 -0
- package/lib-module/SideNav/ItemContent.js +48 -0
- package/lib-module/SideNav/ItemsGroup.js +117 -0
- package/lib-module/SideNav/SideNav.js +136 -0
- package/lib-module/SideNav/index.js +1 -0
- package/lib-module/Skeleton/Skeleton.js +179 -0
- package/lib-module/Skeleton/index.js +2 -0
- package/lib-module/Skeleton/skeleton.constant.js +3 -0
- package/lib-module/Skeleton/skeletonWebAnimation.js +18 -0
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +24 -0
- package/lib-module/Spacer/Spacer.js +98 -0
- package/lib-module/Spacer/index.js +2 -0
- package/lib-module/StackView/StackView.js +125 -0
- package/lib-module/StackView/StackWrap.js +50 -0
- package/lib-module/StackView/StackWrap.native.js +3 -0
- package/lib-module/StackView/StackWrapBox.js +115 -0
- package/lib-module/StackView/StackWrapGap.js +59 -0
- package/lib-module/StackView/common.js +35 -0
- package/lib-module/StackView/getStackedContent.js +124 -0
- package/lib-module/StackView/index.js +5 -0
- package/lib-module/StepTracker/Step.js +248 -0
- package/lib-module/StepTracker/StepTracker.js +185 -0
- package/lib-module/StepTracker/dictionary.js +10 -0
- package/lib-module/StepTracker/index.js +2 -0
- package/lib-module/Tabs/Tabs.js +143 -0
- package/lib-module/Tabs/TabsItem.js +224 -0
- package/lib-module/Tabs/index.js +2 -0
- package/lib-module/Tags/Tags.js +251 -0
- package/lib-module/Tags/index.js +2 -0
- package/lib-module/TextInput/TextArea.js +94 -0
- package/lib-module/TextInput/TextInput.js +72 -0
- package/lib-module/TextInput/TextInputBase.js +245 -0
- package/lib-module/TextInput/index.js +3 -0
- package/lib-module/TextInput/propTypes.js +37 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +36 -0
- package/lib-module/ThemeProvider/index.js +6 -0
- package/lib-module/ThemeProvider/useSetTheme.js +25 -0
- package/lib-module/ThemeProvider/useTheme.js +14 -0
- package/lib-module/ThemeProvider/useThemeTokens.js +110 -0
- package/lib-module/ThemeProvider/utils/index.js +2 -0
- package/lib-module/ThemeProvider/utils/styles.js +181 -0
- package/lib-module/ThemeProvider/utils/theme-tokens.js +163 -0
- package/lib-module/ToggleSwitch/ToggleSwitch.js +250 -0
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +220 -0
- package/lib-module/ToggleSwitch/index.js +3 -0
- package/lib-module/Tooltip/Backdrop.js +45 -0
- package/lib-module/Tooltip/Backdrop.native.js +44 -0
- package/lib-module/Tooltip/Tooltip.js +348 -0
- package/lib-module/Tooltip/dictionary.js +8 -0
- package/lib-module/Tooltip/getTooltipPosition.js +175 -0
- package/lib-module/Tooltip/index.js +2 -0
- package/lib-module/TooltipButton/TooltipButton.js +78 -0
- package/lib-module/TooltipButton/index.js +2 -0
- package/lib-module/Typography/Typography.js +124 -0
- package/lib-module/Typography/index.js +2 -0
- package/lib-module/ViewportProvider/ViewportProvider.js +29 -0
- package/lib-module/ViewportProvider/index.js +3 -0
- package/lib-module/ViewportProvider/useViewport.js +3 -0
- package/lib-module/ViewportProvider/useViewportListener.js +46 -0
- package/lib-module/index.js +48 -0
- package/lib-module/utils/a11y/index.js +2 -0
- package/lib-module/utils/a11y/semantics.js +157 -0
- package/lib-module/utils/a11y/textSize.js +36 -0
- package/lib-module/utils/animation/index.js +2 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +88 -0
- package/lib-module/utils/children.js +119 -0
- package/lib-module/utils/containUniqueFields.js +26 -0
- package/lib-module/utils/index.js +16 -0
- package/lib-module/utils/info/index.js +7 -0
- package/lib-module/utils/info/platform/index.js +11 -0
- package/lib-module/utils/info/platform/platform.android.js +1 -0
- package/lib-module/utils/info/platform/platform.ios.js +1 -0
- package/lib-module/utils/info/platform/platform.js +1 -0
- package/lib-module/utils/info/platform/platform.native.js +4 -0
- package/lib-module/utils/info/versions.js +5 -0
- package/lib-module/utils/input.js +179 -0
- package/lib-module/utils/pressability.js +111 -0
- package/lib-module/utils/props/a11yProps.js +140 -0
- package/lib-module/utils/props/clickProps.js +26 -0
- package/lib-module/utils/props/componentPropType.js +63 -0
- package/lib-module/utils/props/copyPropTypes.js +2 -0
- package/lib-module/utils/props/getPropSelector.js +9 -0
- package/lib-module/utils/props/handlerProps.js +65 -0
- package/lib-module/utils/props/hrefAttrsProp.js +33 -0
- package/lib-module/utils/props/index.js +19 -0
- package/lib-module/utils/props/inputSupportsProps.js +62 -0
- package/lib-module/utils/props/linkProps.js +44 -0
- package/lib-module/utils/props/paddingProp.js +9 -0
- package/lib-module/utils/props/pressProps.js +42 -0
- package/lib-module/utils/props/rectProp.js +9 -0
- package/lib-module/utils/props/responsiveProps.js +30 -0
- package/lib-module/utils/props/selectSystemProps.js +24 -0
- package/lib-module/utils/props/spacingProps.js +56 -0
- package/lib-module/utils/props/textInputProps.js +194 -0
- package/lib-module/utils/props/textProps.js +59 -0
- package/lib-module/utils/props/tokens.js +133 -0
- package/lib-module/utils/props/variantProp.js +18 -0
- package/lib-module/utils/props/viewProps.js +22 -0
- package/lib-module/utils/ssr.js +38 -0
- package/lib-module/utils/useCopy.js +44 -0
- package/lib-module/utils/useHash.js +45 -0
- package/lib-module/utils/useHash.native.js +7 -0
- package/lib-module/utils/useResponsiveProp.js +47 -0
- package/lib-module/utils/useSpacingScale.js +125 -0
- package/lib-module/utils/useUniqueId.js +13 -0
- package/lib-module/utils/withLinkRouter.js +83 -0
- package/package.json +3 -2
- package/src/Checkbox/Checkbox.jsx +3 -1
- package/src/ExpandCollapse/Panel.jsx +2 -19
- package/src/Link/InlinePressable.jsx +5 -2
- package/src/Link/LinkBase.jsx +4 -1
- package/src/List/List.jsx +34 -19
- package/src/List/ListItem.jsx +12 -2
- package/src/Modal/Modal.jsx +2 -1
- package/src/Tabs/Tabs.jsx +24 -2
- package/src/Tabs/TabsItem.jsx +6 -5
- package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
|
+
import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWithoutFeedback";
|
|
4
|
+
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import NativeModal from "react-native-web/dist/exports/Modal";
|
|
6
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { applyShadowToken, useThemeTokens } from '../ThemeProvider';
|
|
9
|
+
import { a11yProps, copyPropTypes, getTokensPropType, selectSystemProps, useCopy, variantProp, viewProps, selectTokens } from '../utils';
|
|
10
|
+
import { useViewport } from '../ViewportProvider';
|
|
11
|
+
import IconButton from '../IconButton';
|
|
12
|
+
import dictionary from './dictionary';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
16
|
+
|
|
17
|
+
const selectContainerStyles = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
containerPaddingLeft,
|
|
20
|
+
containerPaddingRight,
|
|
21
|
+
containerPaddingTop,
|
|
22
|
+
containerPaddingBottom,
|
|
23
|
+
maxWidth,
|
|
24
|
+
height
|
|
25
|
+
} = _ref;
|
|
26
|
+
return {
|
|
27
|
+
height,
|
|
28
|
+
maxWidth,
|
|
29
|
+
paddingLeft: containerPaddingLeft,
|
|
30
|
+
paddingRight: containerPaddingRight,
|
|
31
|
+
paddingTop: containerPaddingTop,
|
|
32
|
+
paddingBottom: containerPaddingBottom
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const selectModalStyles = _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
backgroundColor,
|
|
39
|
+
borderRadius,
|
|
40
|
+
height,
|
|
41
|
+
paddingLeft,
|
|
42
|
+
paddingRight,
|
|
43
|
+
paddingTop,
|
|
44
|
+
paddingBottom,
|
|
45
|
+
shadow
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return {
|
|
48
|
+
backgroundColor,
|
|
49
|
+
borderRadius,
|
|
50
|
+
height,
|
|
51
|
+
paddingLeft,
|
|
52
|
+
paddingRight,
|
|
53
|
+
paddingTop,
|
|
54
|
+
paddingBottom,
|
|
55
|
+
...applyShadowToken(shadow)
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const selectBackdropStyles = _ref3 => {
|
|
60
|
+
let {
|
|
61
|
+
backdropColor,
|
|
62
|
+
backdropOpacity
|
|
63
|
+
} = _ref3;
|
|
64
|
+
return {
|
|
65
|
+
backgroundColor: backdropColor,
|
|
66
|
+
opacity: backdropOpacity
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const selectCloseButtonContainerStyles = _ref4 => {
|
|
71
|
+
let {
|
|
72
|
+
paddingRight,
|
|
73
|
+
paddingTop
|
|
74
|
+
} = _ref4;
|
|
75
|
+
return {
|
|
76
|
+
paddingRight,
|
|
77
|
+
paddingTop
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A modal window is a secondary window that opens on top of the main one.
|
|
82
|
+
* Users have to interact with it before they can carry out their task and return to the main window.
|
|
83
|
+
* Use to reveal additional information to a user after they have performed an explicit interaction.
|
|
84
|
+
* They are a strongly discouraged pattern; it's preferred to have all relevant information within a page,
|
|
85
|
+
* and irrelevant information either linked externally or omitted.
|
|
86
|
+
*
|
|
87
|
+
* - Must only appear after a customer interaction, not on page load or any other circumstance
|
|
88
|
+
* - Open a modal based on explicit customer action e.g. clicking on a button/link/form field
|
|
89
|
+
* - Only one modal should be "current" at any time
|
|
90
|
+
* - Read [WebAIM's documentation](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) to create accessible modals
|
|
91
|
+
* - Don’t use modals to reinforce or repeat information already available in the parent page or view
|
|
92
|
+
* - Don’t use modals consecutively
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
const Modal = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
97
|
+
let {
|
|
98
|
+
children,
|
|
99
|
+
isOpen,
|
|
100
|
+
onClose,
|
|
101
|
+
maxWidth,
|
|
102
|
+
tokens,
|
|
103
|
+
variant,
|
|
104
|
+
copy,
|
|
105
|
+
closeButton,
|
|
106
|
+
...rest
|
|
107
|
+
} = _ref5;
|
|
108
|
+
const viewport = useViewport();
|
|
109
|
+
const themeTokens = useThemeTokens('Modal', tokens, variant, {
|
|
110
|
+
viewport,
|
|
111
|
+
maxWidth
|
|
112
|
+
});
|
|
113
|
+
const {
|
|
114
|
+
closeIcon: CloseIconComponent
|
|
115
|
+
} = themeTokens;
|
|
116
|
+
const getCopy = useCopy({
|
|
117
|
+
dictionary,
|
|
118
|
+
copy
|
|
119
|
+
});
|
|
120
|
+
const closeLabel = getCopy('closeButton');
|
|
121
|
+
|
|
122
|
+
const handleClose = () => {
|
|
123
|
+
if (typeof onClose === 'function') onClose();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const handleKeyUp = event => {
|
|
127
|
+
if (event.key === 'Escape') onClose();
|
|
128
|
+
}; // Show the custom react node passed to `closedButton` or the default close button if `closeButton` is `undefined`.
|
|
129
|
+
// Hide the close button if `closeButton` is `null`.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
const showCloseButton = closeButton !== null;
|
|
133
|
+
|
|
134
|
+
if (!isOpen) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return /*#__PURE__*/_jsx(NativeModal, {
|
|
139
|
+
transparent: true,
|
|
140
|
+
...selectProps(rest),
|
|
141
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
142
|
+
style: [staticStyles.positioningContainer],
|
|
143
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
144
|
+
style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
|
|
145
|
+
pointerEvents: "box-none" // don't capture backdrop press events
|
|
146
|
+
,
|
|
147
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
148
|
+
ref: ref,
|
|
149
|
+
style: [staticStyles.modal, selectModalStyles(themeTokens)],
|
|
150
|
+
onKeyUp: handleKeyUp,
|
|
151
|
+
children: [showCloseButton && /*#__PURE__*/_jsx(View, {
|
|
152
|
+
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
153
|
+
children: closeButton || /*#__PURE__*/_jsx(IconButton, {
|
|
154
|
+
onPress: handleClose,
|
|
155
|
+
icon: CloseIconComponent,
|
|
156
|
+
accessibilityRole: "button",
|
|
157
|
+
accessibilityLabel: closeLabel,
|
|
158
|
+
tokens: selectTokens('IconButton', themeTokens, 'close')
|
|
159
|
+
})
|
|
160
|
+
}), children]
|
|
161
|
+
})
|
|
162
|
+
}), /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
163
|
+
onPress: handleClose,
|
|
164
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
165
|
+
style: [staticStyles.backdrop, selectBackdropStyles(themeTokens)]
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
Modal.displayName = 'Modal';
|
|
172
|
+
Modal.propTypes = { ...selectedSystemPropTypes,
|
|
173
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
174
|
+
copy: copyPropTypes,
|
|
175
|
+
isOpen: PropTypes.bool,
|
|
176
|
+
onClose: PropTypes.func,
|
|
177
|
+
maxWidth: PropTypes.bool,
|
|
178
|
+
tokens: getTokensPropType('Modal'),
|
|
179
|
+
variant: variantProp.propType,
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Pass a react node to override the default close button or pass `null` to hide the close button.
|
|
183
|
+
*/
|
|
184
|
+
closeButton: PropTypes.node
|
|
185
|
+
};
|
|
186
|
+
export default Modal;
|
|
187
|
+
const staticStyles = StyleSheet.create({
|
|
188
|
+
backdrop: {
|
|
189
|
+
position: 'absolute',
|
|
190
|
+
top: 0,
|
|
191
|
+
left: 0,
|
|
192
|
+
right: 0,
|
|
193
|
+
bottom: 0,
|
|
194
|
+
zIndex: -1,
|
|
195
|
+
...Platform.select({
|
|
196
|
+
web: {
|
|
197
|
+
cursor: 'pointer'
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
},
|
|
201
|
+
positioningContainer: {
|
|
202
|
+
flexBasis: '100%',
|
|
203
|
+
alignItems: 'center',
|
|
204
|
+
justifyContent: 'center'
|
|
205
|
+
},
|
|
206
|
+
sizingContainer: {
|
|
207
|
+
maxHeight: '100%',
|
|
208
|
+
// so that the container can expand up to the full viewport height
|
|
209
|
+
width: '100%' // ensure that the modal actually expands to the set maxWidth
|
|
210
|
+
|
|
211
|
+
},
|
|
212
|
+
modal: {
|
|
213
|
+
maxHeight: '100%' // so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
|
|
214
|
+
|
|
215
|
+
},
|
|
216
|
+
closeButtonContainer: {
|
|
217
|
+
position: 'absolute',
|
|
218
|
+
top: 0,
|
|
219
|
+
right: 0,
|
|
220
|
+
zIndex: 1
|
|
221
|
+
}
|
|
222
|
+
});
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
6
|
+
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText } from '../utils';
|
|
7
|
+
import ButtonBase from '../Button/ButtonBase';
|
|
8
|
+
import useCopy from '../utils/useCopy';
|
|
9
|
+
import dictionary from './dictionary';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
13
|
+
|
|
14
|
+
const selectContainerStyles = tokens => ({ ...tokens
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const selectTextStyles = tokens => applyTextStyles(selectTokens('Typography', tokens));
|
|
18
|
+
|
|
19
|
+
const selectIconProps = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
iconSize,
|
|
22
|
+
iconColor
|
|
23
|
+
} = _ref;
|
|
24
|
+
return {
|
|
25
|
+
size: iconSize,
|
|
26
|
+
color: iconColor
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const selectIconContainerStyles = _ref2 => {
|
|
31
|
+
let {
|
|
32
|
+
iconGap
|
|
33
|
+
} = _ref2;
|
|
34
|
+
return {
|
|
35
|
+
paddingRight: iconGap
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const selectDismissIconProps = _ref3 => {
|
|
40
|
+
let {
|
|
41
|
+
dismissIconSize,
|
|
42
|
+
dismissIconColor
|
|
43
|
+
} = _ref3;
|
|
44
|
+
return {
|
|
45
|
+
size: dismissIconSize,
|
|
46
|
+
color: dismissIconColor
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const selectDismissButtonContainerStyles = _ref4 => {
|
|
51
|
+
let {
|
|
52
|
+
dismissButtonGap
|
|
53
|
+
} = _ref4;
|
|
54
|
+
return {
|
|
55
|
+
paddingLeft: dismissButtonGap
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A banner that highlights important messages:
|
|
60
|
+
* - Status message to show there is an error or outage of services
|
|
61
|
+
* - Confirmation message in response to user action
|
|
62
|
+
* - Account information letting the user know they have almost used all their data
|
|
63
|
+
*
|
|
64
|
+
* ## Usage criteria
|
|
65
|
+
* - Use simple text content only, such as bold test or links. Don’t use other complex components or paragraphs
|
|
66
|
+
* - Show notifications before the content that the message is related to, otherwise show at the top of the main content
|
|
67
|
+
* - Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
|
|
68
|
+
* - When showing multiple notifications, show them in order of importance from top to bottom
|
|
69
|
+
* - Use variants to visually show the type of message contained within the Notification.
|
|
70
|
+
* - The icon and colour will indicate meaning and importance
|
|
71
|
+
*
|
|
72
|
+
* ### Variants
|
|
73
|
+
* - Use `variant.style` to set the visual style of the notification
|
|
74
|
+
* - Use `dismissible` prop to enable dismissible functionality
|
|
75
|
+
* - Use `system` prop to set the visual style of the notification and denote an announcement from the system or application
|
|
76
|
+
*
|
|
77
|
+
* ### When to use the system prop?
|
|
78
|
+
* - Use `system` to show system-based messages coming from the application
|
|
79
|
+
* - Don’t use `system` when the message is in response to user action
|
|
80
|
+
*
|
|
81
|
+
* ## Variants
|
|
82
|
+
*
|
|
83
|
+
* #### Success
|
|
84
|
+
* Use the success variant to provide feedback of a successful operation. The message will include an icon to indicate meaning and importance.
|
|
85
|
+
*
|
|
86
|
+
* #### Warning
|
|
87
|
+
* Use the warning variant to provide feedback of a warning; users would still be able to proceed forward.
|
|
88
|
+
* The message will include an icon to indicate meaning and importance.
|
|
89
|
+
*
|
|
90
|
+
* #### Error
|
|
91
|
+
* Use the error variant to provide feedback of a failed operation. The message will include an icon to indicate meaning and importance.
|
|
92
|
+
*
|
|
93
|
+
* #### Dismissible
|
|
94
|
+
* Dismissible notifications should only be used for default or success notifications where there is no action needed from the user.
|
|
95
|
+
* If the information is passive then it should be dismissible as indicated by an interactive close button on the far right.
|
|
96
|
+
* If the notification requires an action then make the option(s) clear with a `ChevronLink` or `Link`.
|
|
97
|
+
*
|
|
98
|
+
* Use the `dismissible` prop to allow users to dismiss the Notification at any time. Once dismissed, the Notification is removed from the DOM.
|
|
99
|
+
*
|
|
100
|
+
* Please note:
|
|
101
|
+
*
|
|
102
|
+
* - Default and Success variants are dismissible
|
|
103
|
+
* - Error and Warning variants are not dismissible
|
|
104
|
+
*
|
|
105
|
+
* #### System message
|
|
106
|
+
* Use full-width `Notifications` to show system-based messages coming from the application, not in response to user action.
|
|
107
|
+
* Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
112
|
+
let {
|
|
113
|
+
children,
|
|
114
|
+
system,
|
|
115
|
+
dismissible,
|
|
116
|
+
copy = 'en',
|
|
117
|
+
tokens,
|
|
118
|
+
variant,
|
|
119
|
+
...rest
|
|
120
|
+
} = _ref5;
|
|
121
|
+
const [isDismissed, setIsDismissed] = useState(false);
|
|
122
|
+
const themeTokens = useThemeTokens('Notification', tokens, variant, {
|
|
123
|
+
system
|
|
124
|
+
});
|
|
125
|
+
const getCopy = useCopy({
|
|
126
|
+
dictionary,
|
|
127
|
+
copy
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (isDismissed) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const textStyles = selectTextStyles(themeTokens);
|
|
135
|
+
const content = wrapStringsInText(typeof children === 'function' ? children({
|
|
136
|
+
textStyles
|
|
137
|
+
}) : children, {
|
|
138
|
+
style: textStyles
|
|
139
|
+
});
|
|
140
|
+
const {
|
|
141
|
+
icon: IconComponent,
|
|
142
|
+
dismissIcon: DismissIconComponent
|
|
143
|
+
} = themeTokens;
|
|
144
|
+
|
|
145
|
+
const onDismissPress = () => setIsDismissed(true); // TODO: replace the dismiss button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
149
|
+
ref: ref,
|
|
150
|
+
style: [staticStyles.container, selectContainerStyles(themeTokens)],
|
|
151
|
+
...selectProps(rest),
|
|
152
|
+
children: [IconComponent && /*#__PURE__*/_jsx(View, {
|
|
153
|
+
style: selectIconContainerStyles(themeTokens),
|
|
154
|
+
children: /*#__PURE__*/_jsx(IconComponent, { ...selectIconProps(themeTokens)
|
|
155
|
+
})
|
|
156
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
157
|
+
style: staticStyles.contentContainer,
|
|
158
|
+
children: content && typeof content === 'function' ? content({
|
|
159
|
+
textStyles,
|
|
160
|
+
variant
|
|
161
|
+
}) : content
|
|
162
|
+
}), dismissible && DismissIconComponent && /*#__PURE__*/_jsx(View, {
|
|
163
|
+
style: selectDismissButtonContainerStyles(themeTokens),
|
|
164
|
+
children: /*#__PURE__*/_jsx(ButtonBase, {
|
|
165
|
+
onPress: onDismissPress,
|
|
166
|
+
accessibilityRole: "button",
|
|
167
|
+
accessibilityLabel: getCopy('dismiss'),
|
|
168
|
+
children: () => /*#__PURE__*/_jsx(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
Notification.displayName = 'Notification';
|
|
175
|
+
Notification.propTypes = { ...selectedSystemPropTypes,
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Content of the `Notification`.
|
|
179
|
+
*/
|
|
180
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func]),
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Use `system` prop to set the visual style of the notification and denote an announcement from the system or application
|
|
184
|
+
*/
|
|
185
|
+
system: PropTypes.bool,
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Use the `dismissible` prop to allow users to dismiss the Notification at any time.
|
|
189
|
+
*/
|
|
190
|
+
dismissible: PropTypes.bool,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Select English or French copy for the accessible label of the dismiss button.
|
|
194
|
+
*/
|
|
195
|
+
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), PropTypes.shape({
|
|
196
|
+
dismiss: PropTypes.string
|
|
197
|
+
})]),
|
|
198
|
+
tokens: getTokensPropType('Notification'),
|
|
199
|
+
variant: variantProp.propType
|
|
200
|
+
};
|
|
201
|
+
export default Notification;
|
|
202
|
+
const staticStyles = StyleSheet.create({
|
|
203
|
+
container: {
|
|
204
|
+
flexDirection: 'row'
|
|
205
|
+
},
|
|
206
|
+
contentContainer: {
|
|
207
|
+
flex: 1
|
|
208
|
+
}
|
|
209
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ButtonBase from '../Button/ButtonBase';
|
|
4
|
+
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
5
|
+
import { a11yProps, copyPropTypes, getTokensPropType, hrefAttrsProp, linkProps, selectTokens, variantProp, withLinkRouter } from '../utils';
|
|
6
|
+
import useCopy from '../utils/useCopy';
|
|
7
|
+
import dictionary from './dictionary';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const PageButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
label,
|
|
12
|
+
onPress,
|
|
13
|
+
href,
|
|
14
|
+
isActive,
|
|
15
|
+
copy,
|
|
16
|
+
variant,
|
|
17
|
+
tokens,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
const getTokens = useThemeTokensCallback('PaginationPageButton', tokens, variant);
|
|
21
|
+
const getCopy = useCopy({
|
|
22
|
+
dictionary,
|
|
23
|
+
copy
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const getButtonTokens = buttonState => selectTokens('Button', getTokens(buttonState));
|
|
27
|
+
|
|
28
|
+
const activeProps = isActive ? {
|
|
29
|
+
selected: true,
|
|
30
|
+
...a11yProps.nonFocusableProps,
|
|
31
|
+
// a brute fix for the focus state being stuck on an active item since it becomes non-focusable
|
|
32
|
+
// (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
|
|
33
|
+
key: 'active-item'
|
|
34
|
+
} : {};
|
|
35
|
+
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
36
|
+
const activeLabel = isActive ? " ".concat(getCopy('currentLabel')) : '';
|
|
37
|
+
const accessibilityLabel = "".concat(getCopy('goToLabel'), " ").concat(label).concat(activeLabel);
|
|
38
|
+
const {
|
|
39
|
+
hrefAttrs,
|
|
40
|
+
rest
|
|
41
|
+
} = hrefAttrsProp.bundle(props);
|
|
42
|
+
const buttonProps = {
|
|
43
|
+
accessibilityRole,
|
|
44
|
+
accessibilityLabel,
|
|
45
|
+
onPress,
|
|
46
|
+
href,
|
|
47
|
+
hrefAttrs,
|
|
48
|
+
...rest
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
51
|
+
ref: ref,
|
|
52
|
+
...buttonProps,
|
|
53
|
+
tokens: getButtonTokens,
|
|
54
|
+
...activeProps,
|
|
55
|
+
children: label
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
PageButton.displayName = 'PageButton';
|
|
59
|
+
PageButton.propTypes = { ...linkProps.types,
|
|
60
|
+
label: PropTypes.string,
|
|
61
|
+
isActive: PropTypes.bool,
|
|
62
|
+
copy: copyPropTypes,
|
|
63
|
+
variant: variantProp.propType,
|
|
64
|
+
tokens: getTokensPropType('PaginationPageButton')
|
|
65
|
+
};
|
|
66
|
+
export default withLinkRouter(PageButton);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import View from "react-native-web/dist/exports/View";
|
|
3
|
+
import Text from "react-native-web/dist/exports/Text";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import { a11yProps, componentPropType, copyPropTypes, getTokensPropType, selectSystemProps, variantProp, viewProps, withLinkRouter } from '../utils';
|
|
6
|
+
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
7
|
+
import { useViewport } from '../ViewportProvider';
|
|
8
|
+
import Box from '../Box';
|
|
9
|
+
import usePagination from './usePagination';
|
|
10
|
+
import PageButton from './PageButton';
|
|
11
|
+
import SideButton from './SideButton';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
14
|
+
|
|
15
|
+
const selectTextStyles = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
color,
|
|
18
|
+
fontName,
|
|
19
|
+
fontSize,
|
|
20
|
+
fontWeight,
|
|
21
|
+
lineHeight
|
|
22
|
+
} = _ref;
|
|
23
|
+
return applyTextStyles({
|
|
24
|
+
color,
|
|
25
|
+
fontName,
|
|
26
|
+
fontSize,
|
|
27
|
+
fontWeight,
|
|
28
|
+
lineHeight
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
33
|
+
let {
|
|
34
|
+
children,
|
|
35
|
+
copy = 'en',
|
|
36
|
+
variant,
|
|
37
|
+
tokens,
|
|
38
|
+
sideButtonVariant,
|
|
39
|
+
sideButtonTokens,
|
|
40
|
+
LinkRouter,
|
|
41
|
+
linkRouterProps,
|
|
42
|
+
...rest
|
|
43
|
+
} = _ref2;
|
|
44
|
+
const viewport = useViewport();
|
|
45
|
+
const {
|
|
46
|
+
truncateAbove,
|
|
47
|
+
gap,
|
|
48
|
+
...themeTokens
|
|
49
|
+
} = useThemeTokens('Pagination', tokens, variant, {
|
|
50
|
+
viewport
|
|
51
|
+
});
|
|
52
|
+
const items = React.Children.toArray(children);
|
|
53
|
+
const {
|
|
54
|
+
isItemActive,
|
|
55
|
+
getItemProps,
|
|
56
|
+
showPrevious,
|
|
57
|
+
showNext,
|
|
58
|
+
nextItemProps,
|
|
59
|
+
previousItemProps,
|
|
60
|
+
shouldRenderButton,
|
|
61
|
+
shouldRenderEllipsis
|
|
62
|
+
} = usePagination({
|
|
63
|
+
items,
|
|
64
|
+
truncateAbove
|
|
65
|
+
});
|
|
66
|
+
const ellipsisTextStyles = selectTextStyles(themeTokens);
|
|
67
|
+
|
|
68
|
+
if (items.length === 0) {
|
|
69
|
+
return null;
|
|
70
|
+
} // TODO: replace with a spacing component when https://github.com/telus/universal-design-system/pull/531 is implemented
|
|
71
|
+
// concatenate all items to easily wrap them in identical spacing components
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const buttons = [showPrevious && /*#__PURE__*/_jsx(SideButton, { ...previousItemProps,
|
|
75
|
+
direction: "previous",
|
|
76
|
+
copy: copy,
|
|
77
|
+
variant: sideButtonVariant,
|
|
78
|
+
tokens: sideButtonTokens,
|
|
79
|
+
LinkRouter: LinkRouter,
|
|
80
|
+
linkRouterProps: linkRouterProps
|
|
81
|
+
}), ...items.map((_child, itemIndex) => {
|
|
82
|
+
var _itemProps$LinkRouter;
|
|
83
|
+
|
|
84
|
+
const buttonLabel = "".concat(itemIndex + 1);
|
|
85
|
+
const itemProps = getItemProps(itemIndex);
|
|
86
|
+
const ItemLinkRouter = (_itemProps$LinkRouter = itemProps.LinkRouter) !== null && _itemProps$LinkRouter !== void 0 ? _itemProps$LinkRouter : LinkRouter;
|
|
87
|
+
const itemLinkRouterProps = { ...linkRouterProps,
|
|
88
|
+
...itemProps.linkRouterProps
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (shouldRenderButton(itemIndex)) {
|
|
92
|
+
return /*#__PURE__*/_jsx(PageButton, { ...itemProps,
|
|
93
|
+
LinkRouter: ItemLinkRouter,
|
|
94
|
+
linkRouterProps: itemLinkRouterProps,
|
|
95
|
+
label: buttonLabel,
|
|
96
|
+
copy: copy,
|
|
97
|
+
isActive: isItemActive(itemIndex)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (shouldRenderEllipsis(itemIndex)) {
|
|
102
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
103
|
+
style: ellipsisTextStyles,
|
|
104
|
+
children: "..."
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return null;
|
|
109
|
+
}), showNext && /*#__PURE__*/_jsx(SideButton, { ...nextItemProps,
|
|
110
|
+
direction: "next",
|
|
111
|
+
copy: copy,
|
|
112
|
+
variant: sideButtonVariant,
|
|
113
|
+
tokens: sideButtonTokens,
|
|
114
|
+
LinkRouter: LinkRouter,
|
|
115
|
+
linkRouterProps: linkRouterProps
|
|
116
|
+
})];
|
|
117
|
+
return /*#__PURE__*/_jsx(View, {
|
|
118
|
+
style: staticStyles.container,
|
|
119
|
+
ref: ref,
|
|
120
|
+
...selectProps(rest),
|
|
121
|
+
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
122
|
+
.map((element, index) => [element, "page-".concat(index + 1)]).filter(_ref3 => {
|
|
123
|
+
let [element] = _ref3;
|
|
124
|
+
return element !== null;
|
|
125
|
+
}).map(_ref4 => {
|
|
126
|
+
let [element, key] = _ref4;
|
|
127
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
128
|
+
right: gap,
|
|
129
|
+
children: element
|
|
130
|
+
}, key);
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
Pagination.displayName = 'Pagination';
|
|
135
|
+
PageButton.displayName = 'PageButton';
|
|
136
|
+
Pagination.PageButton = PageButton;
|
|
137
|
+
Pagination.propTypes = { ...selectedSystemPropTypes,
|
|
138
|
+
...withLinkRouter.propTypes,
|
|
139
|
+
children: componentPropType('PageButton'),
|
|
140
|
+
copy: copyPropTypes,
|
|
141
|
+
variant: variantProp.propType,
|
|
142
|
+
tokens: getTokensPropType('Pagination'),
|
|
143
|
+
sideButtonVariant: variantProp.propType,
|
|
144
|
+
sideButtonTokens: getTokensPropType('PaginationSideButton')
|
|
145
|
+
};
|
|
146
|
+
const staticStyles = StyleSheet.create({
|
|
147
|
+
container: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
flexWrap: 'wrap',
|
|
150
|
+
alignItems: 'center'
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
export default Pagination;
|