@telus-uds/components-base 1.0.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +4 -0
- package/.storybook/preview.js +37 -0
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/__fixtures__/Accessible.js +4 -2
- package/__fixtures__/Accessible.native.js +5 -2
- package/__fixtures__/testTheme.js +9 -0
- package/__tests__/FlexGrid/Col.test.jsx +6 -10
- package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +1 -0
- package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +10 -0
- package/__tests__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
- package/__tests__/utils/props.test.js +36 -0
- package/__tests__/utils/semantics.test.jsx +1 -10
- package/babel.config.js +9 -16
- package/component-docs.json +10142 -0
- package/generate-component-docs.js +59 -0
- package/lib/A11yText/index.js +2 -2
- package/lib/ActivityIndicator/index.js +3 -3
- package/lib/Box/Box.js +4 -4
- package/lib/Button/Button.js +2 -2
- package/lib/Button/ButtonBase.js +20 -6
- package/lib/Button/ButtonGroup.js +10 -12
- package/lib/Button/ButtonLink.js +4 -4
- package/lib/Button/propTypes.js +4 -2
- package/lib/Card/Card.js +2 -2
- package/lib/Card/CardBase.js +6 -9
- package/lib/Card/PressableCardBase.js +12 -6
- package/lib/Checkbox/Checkbox.js +3 -5
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/FlexGrid.js +4 -4
- package/lib/FlexGrid/helpers/index.js +1 -4
- package/lib/IconButton/IconButton.js +11 -6
- package/lib/Link/LinkBase.js +19 -12
- package/lib/List/List.js +4 -5
- package/lib/List/ListItem.js +14 -27
- package/lib/List/index.js +15 -0
- package/lib/Pagination/PageButton.js +4 -8
- package/lib/Pagination/Pagination.js +16 -4
- package/lib/Pagination/SideButton.js +3 -1
- package/lib/Progress/Progress.js +2 -2
- package/lib/Progress/ProgressBar.js +2 -2
- package/lib/Radio/Radio.js +3 -5
- package/lib/Spacer/Spacer.js +2 -2
- package/lib/StackView/StackWrap.js +9 -5
- package/lib/StackView/getStackedContent.js +1 -1
- package/lib/StepTracker/StepTracker.js +2 -2
- package/lib/Tabs/Tabs.js +12 -4
- package/lib/Tabs/TabsItem.js +12 -6
- package/lib/Tags/Tags.js +9 -9
- package/lib/ThemeProvider/useThemeTokens.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +3 -3
- package/lib/ToggleSwitch/ToggleSwitch.js +105 -43
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +230 -0
- package/lib/ToggleSwitch/index.js +14 -4
- package/lib/index.js +28 -9
- package/lib/utils/a11y/semantics.js +4 -3
- package/lib/utils/index.js +14 -5
- package/lib/utils/pressability.js +2 -2
- package/lib/utils/props/a11yProps.js +153 -0
- package/lib/utils/props/clickProps.js +36 -0
- package/lib/utils/props/componentPropType.js +70 -0
- package/lib/utils/props/copyPropTypes.js +14 -0
- package/lib/utils/props/getPropSelector.js +13 -0
- package/lib/utils/props/hrefAttrsProp.js +41 -0
- package/lib/utils/props/index.js +149 -0
- package/lib/utils/props/linkProps.js +64 -0
- package/lib/utils/props/paddingProp.js +20 -0
- package/lib/utils/props/pressProps.js +57 -0
- package/lib/utils/props/rectProp.js +20 -0
- package/lib/utils/props/responsiveProps.js +40 -0
- package/lib/utils/props/selectSystemProps.js +31 -0
- package/lib/utils/props/spacingProps.js +71 -0
- package/lib/utils/props/tokens.js +145 -0
- package/lib/utils/props/variantProp.js +28 -0
- package/lib/utils/props/viewProps.js +34 -0
- package/lib/utils/useResponsiveProp.js +1 -1
- package/lib/utils/useSpacingScale.js +4 -4
- package/lib/utils/withLinkRouter.js +98 -0
- package/package.json +9 -5
- package/release-context.json +4 -4
- package/src/A11yText/index.jsx +1 -1
- package/src/ActivityIndicator/index.jsx +1 -1
- package/src/Box/Box.jsx +5 -4
- package/src/Button/Button.jsx +1 -1
- package/src/Button/ButtonBase.jsx +11 -4
- package/src/Button/ButtonGroup.jsx +17 -8
- package/src/Button/ButtonLink.jsx +1 -1
- package/src/Button/propTypes.js +2 -1
- package/src/Card/Card.jsx +1 -1
- package/src/Card/CardBase.jsx +6 -5
- package/src/Card/PressableCardBase.jsx +7 -5
- package/src/Checkbox/Checkbox.jsx +1 -3
- package/src/Divider/Divider.jsx +2 -2
- package/src/FlexGrid/FlexGrid.jsx +11 -5
- package/src/FlexGrid/helpers/index.js +1 -3
- package/src/IconButton/IconButton.jsx +7 -5
- package/src/Link/LinkBase.jsx +7 -5
- package/src/List/List.jsx +2 -4
- package/src/List/ListItem.jsx +11 -26
- package/src/List/index.js +5 -0
- package/src/Pagination/PageButton.jsx +5 -8
- package/src/Pagination/Pagination.jsx +29 -2
- package/src/Pagination/SideButton.jsx +2 -2
- package/src/Progress/Progress.jsx +1 -1
- package/src/Progress/ProgressBar.jsx +1 -1
- package/src/Radio/Radio.jsx +1 -3
- package/src/Spacer/Spacer.jsx +2 -2
- package/src/StackView/StackWrap.jsx +7 -6
- package/src/StackView/getStackedContent.jsx +1 -1
- package/src/StepTracker/StepTracker.jsx +1 -1
- package/src/Tabs/Tabs.jsx +49 -22
- package/src/Tabs/TabsItem.jsx +11 -7
- package/src/Tags/Tags.jsx +1 -7
- package/src/ThemeProvider/useThemeTokens.js +3 -3
- package/src/ThemeProvider/utils/theme-tokens.js +3 -3
- package/src/ToggleSwitch/ToggleSwitch.jsx +93 -41
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +203 -0
- package/src/ToggleSwitch/index.js +2 -1
- package/src/index.js +2 -2
- package/src/utils/a11y/semantics.js +3 -2
- package/src/utils/index.js +2 -1
- package/src/utils/pressability.js +1 -1
- package/src/utils/props/a11yProps.js +151 -0
- package/src/utils/props/clickProps.js +31 -0
- package/src/utils/props/componentPropType.js +67 -0
- package/src/utils/props/copyPropTypes.js +3 -0
- package/src/utils/props/getPropSelector.js +14 -0
- package/src/utils/props/hrefAttrsProp.js +25 -0
- package/src/utils/props/index.js +15 -0
- package/src/utils/props/linkProps.js +43 -0
- package/src/utils/props/paddingProp.js +10 -0
- package/src/utils/props/pressProps.js +45 -0
- package/src/utils/props/rectProp.js +10 -0
- package/src/utils/props/responsiveProps.js +30 -0
- package/src/utils/props/selectSystemProps.js +25 -0
- package/src/utils/props/spacingProps.js +58 -0
- package/src/utils/props/tokens.js +150 -0
- package/src/utils/props/variantProp.js +20 -0
- package/src/utils/props/viewProps.js +23 -0
- package/src/utils/useResponsiveProp.js +1 -1
- package/src/utils/useSpacingScale.js +4 -4
- package/src/utils/withLinkRouter.jsx +68 -0
- package/stories/A11yText/A11yText.stories.jsx +1 -1
- package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +1 -1
- package/stories/Box/Box.stories.jsx +1 -1
- package/stories/Button/Button.stories.jsx +1 -1
- package/stories/Button/ButtonGroup.stories.jsx +1 -1
- package/stories/Button/ButtonLink.stories.jsx +1 -1
- package/stories/Card/Card.stories.jsx +1 -1
- package/stories/Checkbox/Checkbox.stories.jsx +1 -1
- package/stories/Divider/Divider.stories.jsx +1 -1
- package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +1 -1
- package/stories/Feedback/Feedback.stories.jsx +1 -1
- package/stories/FlexGrid/01 FlexGrid.stories.jsx +1 -1
- package/stories/FlexGrid/02 Row.stories.jsx +1 -1
- package/stories/FlexGrid/03 Col.stories.jsx +1 -1
- package/stories/Icon/Icon.stories.jsx +1 -1
- package/stories/IconButton/IconButton.stories.jsx +1 -1
- package/stories/InputLabel/InputLabel.stories.jsx +1 -1
- package/stories/Link/ChevronLink.stories.jsx +1 -1
- package/stories/Link/Link.stories.jsx +1 -1
- package/stories/Link/TextButton.stories.jsx +1 -1
- package/stories/List/List.stories.jsx +1 -1
- package/stories/Modal/Modal.stories.jsx +1 -1
- package/stories/Notification/Notification.stories.jsx +1 -1
- package/stories/Pagination/Pagination.stories.jsx +1 -1
- package/stories/Progress/Progress.stories.jsx +1 -1
- package/stories/Radio/Radio.stories.jsx +1 -1
- package/stories/RadioCard/RadioCard.stories.jsx +1 -1
- package/stories/Search/Search.stories.jsx +1 -1
- package/stories/Select/Select.stories.jsx +1 -1
- package/stories/SideNav/SideNav.stories.jsx +1 -1
- package/stories/SideNav/SideNavItem.stories.jsx +1 -1
- package/stories/SideNav/SideNavItemsGroup.stories.jsx +1 -1
- package/stories/Skeleton/Skeleton.stories.jsx +1 -1
- package/stories/Spacer/Spacer.stories.jsx +1 -1
- package/stories/StackView/StackView.stories.jsx +1 -1
- package/stories/StackView/StackWrap.stories.jsx +1 -1
- package/stories/StepTracker/StepTracker.stories.jsx +1 -1
- package/stories/Tabs/Tabs.stories.jsx +1 -1
- package/stories/Tags/Tags.stories.jsx +1 -1
- package/stories/TextInput/TextArea.stories.jsx +2 -1
- package/stories/TextInput/TextInput.stories.jsx +1 -1
- package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +6 -2
- package/stories/ToggleSwitch/ToggleSwitchGroup.stories.jsx +81 -0
- package/stories/Tooltip/Tooltip.stories.jsx +1 -1
- package/stories/TooltipButton/TooltipButton.stories.jsx +1 -1
- package/stories/Typography/Typography.stories.jsx +1 -1
- package/stories/supports.jsx +2 -3
- package/.ultra.cache.json +0 -1
- package/lib/utils/propTypes.js +0 -623
- package/src/utils/propTypes.js +0 -640
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const schema = require('@telus-uds/system-theme-tokens')
|
|
3
|
+
const allExports = require('./src')
|
|
4
|
+
|
|
5
|
+
const { a11yProps } = allExports
|
|
6
|
+
const a11yPropTypes = Object.keys(a11yProps.types)
|
|
7
|
+
|
|
8
|
+
const parseComponentDocs = (name, generated) => {
|
|
9
|
+
const { description } = generated // TODO parse markdown and split by heading
|
|
10
|
+
const props = {} // store derived prop data
|
|
11
|
+
const attributes = {
|
|
12
|
+
// any other computed attributes
|
|
13
|
+
acceptsRNA11yProps: a11yPropTypes.every((key) => key in generated.props)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Object.entries(generated.props).forEach(([propName, prop]) => {
|
|
17
|
+
if (prop.description?.includes('@ignore')) {
|
|
18
|
+
return // remove ignored props
|
|
19
|
+
}
|
|
20
|
+
if (attributes.acceptsRNA11yProps && a11yPropTypes.includes(propName)) {
|
|
21
|
+
return // remove a11y props if all supported (there are 30+, instead we have the above attribute to show this)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const out = { ...prop }
|
|
25
|
+
|
|
26
|
+
// check if this prop references the tokens schema
|
|
27
|
+
const tokensProp = out.type?.raw?.match(/getTokensPropType\('([A-z]+)'\)/)?.[1]
|
|
28
|
+
if (tokensProp) {
|
|
29
|
+
if (!schema.components[tokensProp]) {
|
|
30
|
+
throw new Error(`Unknown schema component reference: ${tokensProp} from component: ${name}`)
|
|
31
|
+
}
|
|
32
|
+
out.type = { ...out.type, raw: schema.components[tokensProp] }
|
|
33
|
+
}
|
|
34
|
+
props[propName] = out
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
return { docs: { description, props, attributes } }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const components = {}
|
|
41
|
+
|
|
42
|
+
Object.entries(allExports).forEach(([name, exp]) => {
|
|
43
|
+
// fail fast with meaningful error on typos, missing exports, etc
|
|
44
|
+
if (!exp) throw new Error(`components-base export "${name}" is ${exp} (typeof ${typeof exp})`)
|
|
45
|
+
|
|
46
|
+
if (exp.__docgenInfo) {
|
|
47
|
+
// populated by babel-plugin-react-docgen
|
|
48
|
+
components[name] = parseComponentDocs(name, exp.__docgenInfo)
|
|
49
|
+
|
|
50
|
+
// check for second-level components e.g List.Item (can only be on a component)
|
|
51
|
+
Object.entries(exp).forEach(([subComponentName, prop]) => {
|
|
52
|
+
if (prop.__docgenInfo) {
|
|
53
|
+
components[name][subComponentName] = parseComponentDocs(subComponentName, prop.__docgenInfo)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}, {})
|
|
58
|
+
|
|
59
|
+
fs.writeFileSync('./component-docs.json', JSON.stringify({ schema, components }, null, 2))
|
package/lib/A11yText/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
|
|
|
15
15
|
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _props = require("../utils/props");
|
|
19
19
|
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
@@ -36,7 +36,7 @@ const A11yText = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
36
36
|
heading,
|
|
37
37
|
...rest
|
|
38
38
|
}, ref) => {
|
|
39
|
-
const a11y =
|
|
39
|
+
const a11y = _props.a11yProps.select({
|
|
40
40
|
// On iOS, needs `accessible` to be true to be focusable without non-a11y content.
|
|
41
41
|
// On Web, `accessible` causes RNW to set attributes that may make the element be treated as a group.
|
|
42
42
|
// On Android, may cause this to be skipped when with `<Text>` siblings in an `accessible` View,
|
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _ThemeProvider = require("../ThemeProvider");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _props = require("../utils/props");
|
|
15
15
|
|
|
16
16
|
var _Spinner = _interopRequireDefault(require("./Spinner"));
|
|
17
17
|
|
|
@@ -42,8 +42,8 @@ const ActivityIndicator = ({
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
ActivityIndicator.propTypes = {
|
|
45
|
-
variant:
|
|
46
|
-
tokens: (0,
|
|
45
|
+
variant: _props.variantProp.propType,
|
|
46
|
+
tokens: (0, _props.getTokensPropType)('ActivityIndicator'),
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* A visually hidden accessible label describing the action taking place
|
package/lib/Box/Box.js
CHANGED
|
@@ -26,10 +26,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @typedef {import('../utils/
|
|
30
|
-
* @typedef {import('../utils/
|
|
31
|
-
* @typedef {import('../utils/
|
|
32
|
-
* @typedef {import('../utils/
|
|
29
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingValue} SpacingValue
|
|
30
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingIndex} SpacingIndex
|
|
31
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingObject} SpacingObject
|
|
32
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingOptions} SpacingOptions
|
|
33
33
|
*/
|
|
34
34
|
const selectBoxStyles = tokens => {
|
|
35
35
|
const styles = {
|
package/lib/Button/Button.js
CHANGED
|
@@ -13,7 +13,7 @@ var _propTypes = _interopRequireWildcard(require("./propTypes"));
|
|
|
13
13
|
|
|
14
14
|
var _ThemeProvider = require("../ThemeProvider");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _props = require("../utils/props");
|
|
17
17
|
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
|
|
@@ -37,7 +37,7 @@ const Button = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
Button.displayName = 'Button';
|
|
40
|
-
Button.propTypes = { ...
|
|
40
|
+
Button.propTypes = { ..._props.a11yProps.types,
|
|
41
41
|
..._propTypes.default,
|
|
42
42
|
children: _propTypes.textAndA11yText
|
|
43
43
|
};
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
10
12
|
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
11
13
|
|
|
12
14
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
@@ -17,7 +19,7 @@ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/export
|
|
|
17
19
|
|
|
18
20
|
var _utils = require("../ThemeProvider/utils");
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var _propTypes2 = _interopRequireDefault(require("./propTypes"));
|
|
21
23
|
|
|
22
24
|
var _utils2 = require("../utils");
|
|
23
25
|
|
|
@@ -170,18 +172,23 @@ const selectWebOnlyStyles = (inactive, themeTokens, {
|
|
|
170
172
|
};
|
|
171
173
|
|
|
172
174
|
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
175
|
+
id,
|
|
173
176
|
href,
|
|
174
177
|
hrefAttrs,
|
|
175
178
|
children,
|
|
176
|
-
onPress,
|
|
177
179
|
tokens = {},
|
|
178
180
|
disabled = false,
|
|
179
181
|
// alias for inactive
|
|
180
182
|
inactive = disabled,
|
|
181
183
|
selected = false,
|
|
182
184
|
dataSet,
|
|
183
|
-
...
|
|
185
|
+
...rawRest
|
|
184
186
|
}, ref) => {
|
|
187
|
+
const {
|
|
188
|
+
onPress,
|
|
189
|
+
...rest
|
|
190
|
+
} = _utils2.clickProps.toPressProps(rawRest);
|
|
191
|
+
|
|
185
192
|
const extraButtonState = {
|
|
186
193
|
inactive,
|
|
187
194
|
selected
|
|
@@ -217,6 +224,7 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
217
224
|
|
|
218
225
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|
|
219
226
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
227
|
+
id: id,
|
|
220
228
|
style: [containerStyles, borderStyles, stretchStyles, staticStyles.row, _Platform.default.select({
|
|
221
229
|
web: {
|
|
222
230
|
maxWidth: '100%',
|
|
@@ -235,10 +243,15 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
235
243
|
});
|
|
236
244
|
});
|
|
237
245
|
ButtonBase.displayName = 'ButtonBase';
|
|
238
|
-
ButtonBase.propTypes = {
|
|
239
|
-
|
|
246
|
+
ButtonBase.propTypes = {
|
|
247
|
+
id: _propTypes.default.string,
|
|
248
|
+
..._utils2.a11yProps.types,
|
|
249
|
+
..._propTypes2.default,
|
|
240
250
|
..._utils2.linkProps.types
|
|
241
251
|
};
|
|
252
|
+
ButtonBase.defaultProps = {
|
|
253
|
+
id: undefined
|
|
254
|
+
};
|
|
242
255
|
|
|
243
256
|
const staticStyles = _StyleSheet.default.create({
|
|
244
257
|
row: {
|
|
@@ -265,5 +278,6 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
265
278
|
}
|
|
266
279
|
});
|
|
267
280
|
|
|
268
|
-
var _default = ButtonBase;
|
|
281
|
+
var _default = (0, _utils2.withLinkRouter)(ButtonBase);
|
|
282
|
+
|
|
269
283
|
exports.default = _default;
|
|
@@ -21,7 +21,7 @@ var _ViewportProvider = require("../ViewportProvider");
|
|
|
21
21
|
|
|
22
22
|
var _ThemeProvider = require("../ThemeProvider");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _props = require("../utils/props");
|
|
25
25
|
|
|
26
26
|
var _input = require("../utils/input");
|
|
27
27
|
|
|
@@ -35,6 +35,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
35
35
|
|
|
36
36
|
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; }
|
|
37
37
|
|
|
38
|
+
const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.pressProps, _props.viewProps]);
|
|
38
39
|
const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
39
40
|
variant,
|
|
40
41
|
tokens,
|
|
@@ -56,7 +57,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
56
57
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('ButtonGroup', tokens, variant, {
|
|
57
58
|
viewport
|
|
58
59
|
});
|
|
59
|
-
const stackTokens = (0,
|
|
60
|
+
const stackTokens = (0, _props.selectTokens)('StackView', themeTokens);
|
|
60
61
|
const {
|
|
61
62
|
direction,
|
|
62
63
|
space
|
|
@@ -72,14 +73,12 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
72
73
|
onChange,
|
|
73
74
|
readOnly
|
|
74
75
|
});
|
|
75
|
-
|
|
76
|
-
const a11y = _propTypes2.a11yProps.select({
|
|
76
|
+
const systemProps = selectProps({
|
|
77
77
|
accessibilityRole,
|
|
78
78
|
...rest
|
|
79
79
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, { ...a11y,
|
|
80
|
+
const itemA11yRole = systemProps.accessibilityRole === 'radiogroup' ? 'radio' : 'checkbox';
|
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, { ...systemProps,
|
|
83
82
|
space: space,
|
|
84
83
|
direction: direction,
|
|
85
84
|
tokens: stackTokens,
|
|
@@ -109,7 +108,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
109
108
|
},
|
|
110
109
|
accessibilityRole: itemA11yRole,
|
|
111
110
|
accessibilityLabel,
|
|
112
|
-
...
|
|
111
|
+
..._props.a11yProps.getPositionInSet(items.length, index)
|
|
113
112
|
}; // Ensure button is direct child of group as MacOS voiceover only applies "X of Y" to
|
|
114
113
|
// "radio" if it's a direct child of "radiogroup", even if aria-posinset etc exists
|
|
115
114
|
|
|
@@ -127,10 +126,9 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
127
126
|
});
|
|
128
127
|
});
|
|
129
128
|
ButtonGroup.displayName = 'ButtonGroup';
|
|
130
|
-
ButtonGroup.propTypes = { ...
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
variant: _propTypes2.variantProp.propType,
|
|
129
|
+
ButtonGroup.propTypes = { ...selectedSystemPropTypes,
|
|
130
|
+
tokens: (0, _props.getTokensPropType)('ButtonGroup'),
|
|
131
|
+
variant: _props.variantProp.propType,
|
|
134
132
|
|
|
135
133
|
/**
|
|
136
134
|
* The maximum number of items a user may select at once. Defaults to 1 and behaves
|
package/lib/Button/ButtonLink.js
CHANGED
|
@@ -11,7 +11,7 @@ var _ButtonBase = _interopRequireDefault(require("./ButtonBase"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireWildcard(require("./propTypes"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _props = require("../utils/props");
|
|
15
15
|
|
|
16
16
|
var _ThemeProvider = require("../ThemeProvider");
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ const ButtonLink = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
37
37
|
const {
|
|
38
38
|
hrefAttrs,
|
|
39
39
|
rest
|
|
40
|
-
} =
|
|
40
|
+
} = _props.hrefAttrsProp.bundle(props);
|
|
41
41
|
|
|
42
42
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('Button', tokens, variant);
|
|
43
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
@@ -50,9 +50,9 @@ const ButtonLink = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
ButtonLink.displayName = 'ButtonLink';
|
|
53
|
-
ButtonLink.propTypes = { ...
|
|
53
|
+
ButtonLink.propTypes = { ..._props.a11yProps.types,
|
|
54
54
|
..._propTypes.default,
|
|
55
|
-
...
|
|
55
|
+
..._props.linkProps.types,
|
|
56
56
|
children: _propTypes.textAndA11yText
|
|
57
57
|
};
|
|
58
58
|
var _default = ButtonLink;
|
package/lib/Button/propTypes.js
CHANGED
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _airbnbPropTypes = _interopRequireDefault(require("airbnb-prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _props = require("../utils/props");
|
|
13
13
|
|
|
14
14
|
var _A11yText = _interopRequireDefault(require("../A11yText"));
|
|
15
15
|
|
|
@@ -19,6 +19,8 @@ const textAndA11yText = _airbnbPropTypes.default.childrenOf(_propTypes.default.o
|
|
|
19
19
|
|
|
20
20
|
exports.textAndA11yText = textAndA11yText;
|
|
21
21
|
const buttonPropTypes = {
|
|
22
|
+
tokens: (0, _props.getTokensPropType)('Button'),
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* If true, prevents the button from being pressed, changes the cursor (on web) and accessibility
|
|
24
26
|
* attributes to communicate this to the user, and applies `inactive: true` appearances from the theme
|
|
@@ -44,7 +46,7 @@ const buttonPropTypes = {
|
|
|
44
46
|
* Function called when the button is pressed. Required unless the button has a href.
|
|
45
47
|
*/
|
|
46
48
|
onPress: _propTypes.default.func,
|
|
47
|
-
variant:
|
|
49
|
+
variant: _props.variantProp.propType
|
|
48
50
|
};
|
|
49
51
|
var _default = buttonPropTypes;
|
|
50
52
|
exports.default = _default;
|
package/lib/Card/Card.js
CHANGED
|
@@ -15,7 +15,7 @@ var _utils = require("../utils");
|
|
|
15
15
|
|
|
16
16
|
var _ViewportProvider = require("../ViewportProvider");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _props = require("../utils/props");
|
|
19
19
|
|
|
20
20
|
var _CardBase = _interopRequireDefault(require("./CardBase"));
|
|
21
21
|
|
|
@@ -94,7 +94,7 @@ Card.propTypes = {
|
|
|
94
94
|
children: _propTypes.default.node,
|
|
95
95
|
tokens: (0, _utils.getTokensPropType)('Card'),
|
|
96
96
|
variant: _utils.variantProp.propType,
|
|
97
|
-
...
|
|
97
|
+
..._props.a11yProps.types
|
|
98
98
|
};
|
|
99
99
|
var _default = Card;
|
|
100
100
|
exports.default = _default;
|
package/lib/Card/CardBase.js
CHANGED
|
@@ -15,7 +15,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
15
15
|
|
|
16
16
|
var _utils = require("../utils");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _props = require("../utils/props");
|
|
19
19
|
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
@@ -25,7 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
28
|
-
// Ensure explicit selection of tokens
|
|
28
|
+
const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.viewProps]); // Ensure explicit selection of tokens
|
|
29
|
+
|
|
29
30
|
const selectStyles = ({
|
|
30
31
|
flex,
|
|
31
32
|
backgroundColor,
|
|
@@ -64,9 +65,7 @@ const CardBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
64
65
|
...rest
|
|
65
66
|
}, ref) => {
|
|
66
67
|
const cardStyle = selectStyles(typeof tokens === 'function' ? tokens() : tokens);
|
|
67
|
-
const props =
|
|
68
|
-
..._propTypes2.viewProps.select(rest)
|
|
69
|
-
};
|
|
68
|
+
const props = selectProps(rest);
|
|
70
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
71
70
|
style: cardStyle,
|
|
72
71
|
dataSet: dataSet,
|
|
@@ -76,11 +75,9 @@ const CardBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
76
75
|
});
|
|
77
76
|
});
|
|
78
77
|
CardBase.displayName = 'CardBase';
|
|
79
|
-
CardBase.propTypes = {
|
|
78
|
+
CardBase.propTypes = { ...selectedSystemPropTypes,
|
|
80
79
|
children: _propTypes.default.node,
|
|
81
|
-
tokens: (0, _utils.getTokensPropType)('Card')
|
|
82
|
-
..._propTypes2.viewProps.types,
|
|
83
|
-
..._propTypes2.a11yProps.types
|
|
80
|
+
tokens: (0, _utils.getTokensPropType)('Card')
|
|
84
81
|
};
|
|
85
82
|
var _default = CardBase;
|
|
86
83
|
exports.default = _default;
|
|
@@ -19,7 +19,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
19
19
|
|
|
20
20
|
var _utils = require("../utils");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _props = require("../utils/props");
|
|
23
23
|
|
|
24
24
|
var _CardBase = _interopRequireDefault(require("./CardBase"));
|
|
25
25
|
|
|
@@ -52,13 +52,17 @@ const PressableCardBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
52
52
|
inactive,
|
|
53
53
|
href,
|
|
54
54
|
hrefAttrs,
|
|
55
|
-
onPress,
|
|
56
55
|
accessibilityRole = href ? 'link' : undefined,
|
|
57
|
-
...
|
|
56
|
+
...rawRest
|
|
58
57
|
}, ref) => {
|
|
58
|
+
const {
|
|
59
|
+
onPress,
|
|
60
|
+
...rest
|
|
61
|
+
} = _utils.clickProps.toPressProps(rawRest);
|
|
62
|
+
|
|
59
63
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
60
64
|
|
|
61
|
-
const a11y =
|
|
65
|
+
const a11y = _props.a11yProps.select({ ...rest,
|
|
62
66
|
accessibilityRole
|
|
63
67
|
});
|
|
64
68
|
|
|
@@ -135,7 +139,9 @@ PressableCardBase.propTypes = {
|
|
|
135
139
|
allowFunction: true
|
|
136
140
|
}),
|
|
137
141
|
variant: _utils.variantProp.propType,
|
|
138
|
-
...
|
|
142
|
+
..._props.a11yProps.types
|
|
139
143
|
};
|
|
140
|
-
|
|
144
|
+
|
|
145
|
+
var _default = (0, _utils.withLinkRouter)(PressableCardBase);
|
|
146
|
+
|
|
141
147
|
exports.default = _default;
|
package/lib/Checkbox/Checkbox.js
CHANGED
|
@@ -31,7 +31,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
31
31
|
|
|
32
32
|
var _utils = require("../utils");
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _props = require("../utils/props");
|
|
35
35
|
|
|
36
36
|
var _useUniqueId = _interopRequireDefault(require("../utils/useUniqueId"));
|
|
37
37
|
|
|
@@ -43,8 +43,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
43
43
|
|
|
44
44
|
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; }
|
|
45
45
|
|
|
46
|
-
// @todo move `LabelContent` outside of the `InputLabel` and fix
|
|
47
|
-
// the issue with the cursor not being pointer on Web
|
|
48
46
|
const selectInputStyles = ({
|
|
49
47
|
iconBackgroundColor,
|
|
50
48
|
inputBorderColor,
|
|
@@ -202,7 +200,7 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
202
200
|
if ((event === null || event === void 0 ? void 0 : event.key) === ' ') handleChange(event);
|
|
203
201
|
};
|
|
204
202
|
|
|
205
|
-
const accessibilityProps =
|
|
203
|
+
const accessibilityProps = _props.a11yProps.select(rest);
|
|
206
204
|
|
|
207
205
|
const uniqueId = (0, _useUniqueId.default)('checkbox');
|
|
208
206
|
const inputId = id ?? uniqueId;
|
|
@@ -275,7 +273,7 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
275
273
|
});
|
|
276
274
|
});
|
|
277
275
|
Checkbox.displayName = 'Checkbox';
|
|
278
|
-
Checkbox.propTypes = { ...
|
|
276
|
+
Checkbox.propTypes = { ..._props.a11yProps.propTypes,
|
|
279
277
|
|
|
280
278
|
/**
|
|
281
279
|
* Use `checked` for controlled Checkbox. For uncontrolled Checkbox, use the `defaultChecked` prop.
|
package/lib/Divider/Divider.js
CHANGED
|
@@ -30,8 +30,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @typedef {import('../utils/
|
|
34
|
-
* @typedef {import('../utils/
|
|
33
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingIndex} SpacingIndex
|
|
34
|
+
* @typedef {import('../utils/props/spacingProps.js').SpacingObject} SpacingObject
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
/**
|
package/lib/FlexGrid/FlexGrid.js
CHANGED
|
@@ -35,9 +35,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
35
35
|
|
|
36
36
|
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; }
|
|
37
37
|
|
|
38
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
38
39
|
/**
|
|
39
40
|
* A mobile-first flexbox grid.
|
|
40
41
|
*/
|
|
42
|
+
|
|
41
43
|
const FlexGrid = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
42
44
|
limitWidth = true,
|
|
43
45
|
gutter = true,
|
|
@@ -86,8 +88,7 @@ const FlexGrid = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
const props = { ...(0, _utils.getA11yPropsFromHtmlTag)(tag, accessibilityRole),
|
|
89
|
-
...
|
|
90
|
-
..._utils.viewProps.select(rest)
|
|
91
|
+
...selectProps(rest)
|
|
91
92
|
};
|
|
92
93
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GutterContext.default.Provider, {
|
|
93
94
|
value: gutter,
|
|
@@ -113,8 +114,7 @@ const styles = _StyleSheet.default.create({
|
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
116
|
|
|
116
|
-
FlexGrid.propTypes = { ...
|
|
117
|
-
..._utils.viewProps.types,
|
|
117
|
+
FlexGrid.propTypes = { ...selectedSystemPropTypes,
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Whether or not to give the grid a fixed width. This also centres the grid horizontally.
|
|
@@ -21,7 +21,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../utils");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _props = require("../utils/props");
|
|
25
25
|
|
|
26
26
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
27
27
|
|
|
@@ -83,11 +83,15 @@ const IconButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
83
83
|
icon: IconComponent,
|
|
84
84
|
href,
|
|
85
85
|
hrefAttrs,
|
|
86
|
-
onPress,
|
|
87
86
|
accessibilityRole = href ? 'link' : 'button',
|
|
88
|
-
...
|
|
87
|
+
...rawRest
|
|
89
88
|
}, ref) => {
|
|
90
|
-
const
|
|
89
|
+
const {
|
|
90
|
+
onPress,
|
|
91
|
+
...rest
|
|
92
|
+
} = _utils.clickProps.toPressProps(rawRest);
|
|
93
|
+
|
|
94
|
+
const a11y = _props.a11yProps.select({ ...rest,
|
|
91
95
|
accessibilityRole
|
|
92
96
|
});
|
|
93
97
|
|
|
@@ -121,7 +125,7 @@ const IconButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
121
125
|
});
|
|
122
126
|
});
|
|
123
127
|
IconButton.displayName = 'IconButton';
|
|
124
|
-
IconButton.propTypes = { ...
|
|
128
|
+
IconButton.propTypes = { ..._props.a11yProps.types,
|
|
125
129
|
variant: _utils.variantProp.propType,
|
|
126
130
|
tokens: (0, _utils.getTokensPropType)('IconButton'),
|
|
127
131
|
icon: _propTypes.default.elementType.isRequired,
|
|
@@ -136,5 +140,6 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
136
140
|
}
|
|
137
141
|
});
|
|
138
142
|
|
|
139
|
-
var _default = IconButton;
|
|
143
|
+
var _default = (0, _utils.withLinkRouter)(IconButton);
|
|
144
|
+
|
|
140
145
|
exports.default = _default;
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -15,10 +15,12 @@ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/export
|
|
|
15
15
|
|
|
16
16
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _props = require("../utils/props");
|
|
19
19
|
|
|
20
20
|
var _pressability = require("../utils/pressability");
|
|
21
21
|
|
|
22
|
+
var _utils = require("../utils");
|
|
23
|
+
|
|
22
24
|
var _InlinePressable = _interopRequireDefault(require("./InlinePressable"));
|
|
23
25
|
|
|
24
26
|
var _ThemeProvider = require("../ThemeProvider");
|
|
@@ -120,7 +122,6 @@ const selectIconTokens = ({
|
|
|
120
122
|
|
|
121
123
|
const LinkBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
122
124
|
href,
|
|
123
|
-
onPress,
|
|
124
125
|
icon,
|
|
125
126
|
iconPosition = icon ? 'left' : undefined,
|
|
126
127
|
iconProps,
|
|
@@ -129,17 +130,22 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
129
130
|
children,
|
|
130
131
|
accessibilityRole = 'link',
|
|
131
132
|
dataSet,
|
|
132
|
-
...
|
|
133
|
+
...rawRest
|
|
133
134
|
}, ref) => {
|
|
135
|
+
const {
|
|
136
|
+
onPress,
|
|
137
|
+
...props
|
|
138
|
+
} = _props.clickProps.toPressProps(rawRest);
|
|
139
|
+
|
|
134
140
|
const {
|
|
135
141
|
hrefAttrs,
|
|
136
142
|
rest
|
|
137
|
-
} =
|
|
143
|
+
} = _props.hrefAttrsProp.bundle(props);
|
|
138
144
|
|
|
139
|
-
const linkPropSet =
|
|
145
|
+
const linkPropSet = _props.linkProps.select({
|
|
140
146
|
accessibilityRole,
|
|
141
147
|
href,
|
|
142
|
-
onPress:
|
|
148
|
+
onPress: _props.linkProps.handleHref({
|
|
143
149
|
href,
|
|
144
150
|
onPress
|
|
145
151
|
}),
|
|
@@ -189,10 +195,10 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
189
195
|
});
|
|
190
196
|
});
|
|
191
197
|
LinkBase.displayName = 'LinkBase';
|
|
192
|
-
LinkBase.propTypes = { ...
|
|
193
|
-
...
|
|
194
|
-
tokens: (0,
|
|
195
|
-
variant:
|
|
198
|
+
LinkBase.propTypes = { ..._props.a11yProps.types,
|
|
199
|
+
..._props.linkProps.types,
|
|
200
|
+
tokens: (0, _props.getTokensPropType)('Link'),
|
|
201
|
+
variant: _props.variantProp.propType,
|
|
196
202
|
|
|
197
203
|
/**
|
|
198
204
|
* Optional variant that may be passed down to the link's icon if there is one
|
|
@@ -214,7 +220,7 @@ LinkBase.propTypes = { ..._propTypes2.a11yProps.types,
|
|
|
214
220
|
* On Web if href is passed, React Native Web maps this object's props to
|
|
215
221
|
* `rel`, `target` and `download` attrs.
|
|
216
222
|
*/
|
|
217
|
-
hrefAttrs: _propTypes.default.shape(
|
|
223
|
+
hrefAttrs: _propTypes.default.shape(_props.hrefAttrsProp.types)
|
|
218
224
|
};
|
|
219
225
|
|
|
220
226
|
const staticStyles = _StyleSheet.default.create({
|
|
@@ -231,5 +237,6 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
231
237
|
}
|
|
232
238
|
});
|
|
233
239
|
|
|
234
|
-
var _default = LinkBase;
|
|
240
|
+
var _default = (0, _utils.withLinkRouter)(LinkBase);
|
|
241
|
+
|
|
235
242
|
exports.default = _default;
|