@telus-uds/components-base 1.6.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +13 -13
  3. package/CHANGELOG.json +36 -1
  4. package/CHANGELOG.md +16 -2
  5. package/component-docs.json +14 -22
  6. package/lib/List/ListItem.js +22 -12
  7. package/lib/Search/Search.js +27 -19
  8. package/lib/TextInput/TextArea.js +1 -1
  9. package/lib/TextInput/TextInput.js +1 -1
  10. package/lib/TextInput/TextInputBase.js +1 -1
  11. package/lib/Typography/Typography.js +12 -10
  12. package/lib/index.js +22 -1
  13. package/lib/utils/input.js +5 -6
  14. package/lib/utils/props/index.js +18 -0
  15. package/lib/utils/props/textInputProps.js +206 -0
  16. package/lib/utils/props/textProps.js +72 -0
  17. package/lib-module/List/ListItem.js +22 -12
  18. package/lib-module/Search/Search.js +29 -21
  19. package/lib-module/TextInput/TextArea.js +2 -2
  20. package/lib-module/TextInput/TextInput.js +2 -2
  21. package/lib-module/TextInput/TextInputBase.js +2 -2
  22. package/lib-module/Typography/Typography.js +13 -11
  23. package/lib-module/index.js +1 -1
  24. package/lib-module/utils/input.js +6 -6
  25. package/lib-module/utils/props/index.js +2 -0
  26. package/lib-module/utils/props/textInputProps.js +193 -0
  27. package/lib-module/utils/props/textProps.js +59 -0
  28. package/package.json +1 -1
  29. package/src/List/ListItem.jsx +17 -9
  30. package/src/Search/Search.jsx +33 -21
  31. package/src/TextInput/TextArea.jsx +2 -0
  32. package/src/TextInput/TextInput.jsx +2 -0
  33. package/src/TextInput/TextInputBase.jsx +2 -0
  34. package/src/Typography/Typography.jsx +13 -9
  35. package/src/index.js +4 -1
  36. package/src/utils/input.js +5 -7
  37. package/src/utils/props/index.js +2 -0
  38. package/src/utils/props/textInputProps.js +177 -0
  39. package/src/utils/props/textProps.js +58 -0
  40. package/stories/Search/Search.stories.jsx +49 -2
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
+
12
+ var _getPropSelector = _interopRequireDefault(require("./getPropSelector"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // This file contains common props for components that render a React Native TextInput
17
+ // It excludes interaction handler functions which are in `./handlerProps.js`
18
+
19
+ /**
20
+ * TextInput (web and native) supports some common React Native props
21
+ * shared with React Native's Text component.
22
+ */
23
+ const textProps = {
24
+ maxFontSizeMultiplier: _propTypes.default.number,
25
+ nativeId: _propTypes.default.string,
26
+ onLayout: _propTypes.default.func
27
+ };
28
+ /**
29
+ * UDS text inputs accept props related to UDS's useInputValue hook
30
+ */
31
+
32
+ const inputValueProps = {
33
+ value: _propTypes.default.string,
34
+ initialValue: _propTypes.default.string,
35
+ readOnly: _propTypes.default.bool
36
+ };
37
+ /**
38
+ * This collection adds props that can be passed through to both React Native's
39
+ * and React Native Web's implementations of the React Native TextInput component.
40
+ */
41
+
42
+ const crossPlatform = { ...textProps,
43
+ ...inputValueProps,
44
+
45
+ /**
46
+ * Web and Android; 'off' disables device autocomplete, other strings are platform-specific.
47
+ * Valid values on Native: https://reactnative.dev/docs/textinput#autocomplete-android
48
+ * Valid values on Web: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
49
+ */
50
+ autoComplete: _propTypes.default.string,
51
+
52
+ /**
53
+ * On Native, default is `true`, passing `false` disables autoCorrect.
54
+ * On web, only supported by Safari and expects "on" or "off" strings.
55
+ */
56
+ autoCorrect: _propTypes.default.oneOf([true, false, 'on', 'off']),
57
+
58
+ /**
59
+ * Focuses the element on mount. On Web, only the first form element with autoFocus is focussed.
60
+ */
61
+ autoFocus: _propTypes.default.bool,
62
+
63
+ /**
64
+ * Default is `true` for single line, `false` for multi-line
65
+ */
66
+ blurOnSubmit: _propTypes.default.bool,
67
+
68
+ /**
69
+ * iOS and Web only, no effect on Android
70
+ */
71
+ clearTextOnFocus: _propTypes.default.bool,
72
+
73
+ /**
74
+ * Default is `true`. On web, this works by mapping to input's `readonly` attribute
75
+ */
76
+ editable: _propTypes.default.bool,
77
+
78
+ /**
79
+ * See documentation for allowed values (varies between Web, Android and iOS) and important notes:
80
+ * - Native: https://reactnative.dev/docs/textinput#keyboardtype
81
+ * - Web: equivalent to `inputmode` but see https://necolas.github.io/react-native-web/docs/text-input/
82
+ */
83
+ keyboardType: _propTypes.default.string,
84
+
85
+ /**
86
+ * Uses native tools (no flicker) to cap the maximum number of characters.
87
+ * On Web, works via `maxlength` attr.
88
+ */
89
+ maxLength: _propTypes.default.number,
90
+
91
+ /**
92
+ * If passed as true, the text input can be multiple lines.
93
+ *
94
+ * > It is important to note that this aligns the text to the top on iOS, and centers it on Android.
95
+ * > Use with textAlignVertical set to top for the same behavior in both platforms.
96
+ */
97
+ multiline: _propTypes.default.bool,
98
+
99
+ /**
100
+ * Web and Android only, requires `multiline` to be `true`.
101
+ */
102
+ numberOfLines: _propTypes.default.number,
103
+
104
+ /**
105
+ * Text to display when no value set.
106
+ * Accesibility guidelines recommend using labels to describe the input and using
107
+ * placeholders rarely and sparingly to prompt a particular format.
108
+ */
109
+ placeholder: _propTypes.default.string,
110
+
111
+ /**
112
+ * Sets placeholder colour. On Web, uses `::placeholder { color: ... }` selector.
113
+ */
114
+ placeholderTextColor: _propTypes.default.string,
115
+
116
+ /**
117
+ * One of a subset of platform-specific options that controls labelling and presentation
118
+ * in on-screen keyboards and accessibility tools. Uses `enterkeyhint` attr on Web.
119
+ *
120
+ * 'done', 'go', 'next', 'search', and 'send' are available for Web, Android and iOS.
121
+ */
122
+ returnKeyType: _propTypes.default.string,
123
+
124
+ /**
125
+ * Obscures passwords and similar. Equivalent to type="password" on Web.
126
+ * Does not work if multiline is true.
127
+ */
128
+ secureTextEntry: _propTypes.default.bool,
129
+
130
+ /**
131
+ * If true, all text will automatically be selected on focus.
132
+ */
133
+ selectTextOnFocus: _propTypes.default.bool,
134
+
135
+ /**
136
+ * Web and iOS. On iOS, default inherits from `autoCorrect`.
137
+ * On Web, equivalent to `spellcheck` attr.
138
+ */
139
+ spellCheck: _propTypes.default.bool
140
+ };
141
+ /**
142
+ * These web-only props all control HTML `input` attributes of the same name.
143
+ * Refer to general HTML documentation for more details.
144
+ */
145
+
146
+ const webOnly = {
147
+ disabled: _propTypes.default.bool,
148
+ dir: _propTypes.default.oneOf(['auto', 'ltr', 'rtl']),
149
+ lang: _propTypes.default.string
150
+ };
151
+ /**
152
+ * These props are supported in React Native but not React Native Web.
153
+ *
154
+ * React Native text inputs can be quirky, so a full set of props should be allowed to handle edge cases.
155
+ * Refer to React Native documentation for details, allowed values, and Android/iOS support and versions:
156
+ * https://reactnative.dev/docs/textinput
157
+ *
158
+ * Beware that many React Native text input props apply via complicated logic that chooses a built-in
159
+ * native component based on the values of multiple boolean flags, and may sometimes appear to pick an
160
+ * option that is inappropriate for one flag based on the values of one or more other other flags.
161
+ */
162
+
163
+ const nativeOnly = {
164
+ caretHidden: _propTypes.default.bool,
165
+ clearButtonMode: _propTypes.default.string,
166
+ contextMenuHidden: _propTypes.default.bool,
167
+ dataDetectorTypes: _propTypes.default.string,
168
+ disableFullscreenUI: _propTypes.default.bool,
169
+ enablesReturnKeyAutomatically: _propTypes.default.bool,
170
+ importantForAutofill: _propTypes.default.string,
171
+ inlineImageLeft: _propTypes.default.string,
172
+ keyboardAppearance: _propTypes.default.string,
173
+ returnKeyLabel: _propTypes.default.string,
174
+ rejectResponderTermination: _propTypes.default.bool,
175
+ scrollEnabled: _propTypes.default.bool,
176
+ selection: _propTypes.default.object,
177
+ selectionColor: _propTypes.default.string,
178
+ showSoftInputOnFocus: _propTypes.default.bool,
179
+ textAlign: _propTypes.default.string,
180
+ textContentType: _propTypes.default.string,
181
+ passwordRules: _propTypes.default.string,
182
+ textBreakStrategy: _propTypes.default.string,
183
+ underlineColorAndroid: _propTypes.default.string
184
+ };
185
+ var _default = {
186
+ /**
187
+ * Subset of proptypes that can be passed down to a React Native or React Native Web
188
+ * `TextInput` component. Allow regardless of platform, so cross-platform apps don't warn.
189
+ */
190
+ types: { ...crossPlatform,
191
+ ...webOnly,
192
+ ...nativeOnly
193
+ },
194
+
195
+ /**
196
+ * Filters a props object. Return only platform-appropriate TextInput props, native inputs
197
+ * may throw errors on receiving unknown props.
198
+ */
199
+ select: (0, _getPropSelector.default)({ ...crossPlatform,
200
+ ..._Platform.default.select({
201
+ web: webOnly,
202
+ default: nativeOnly
203
+ })
204
+ })
205
+ };
206
+ exports.default = _default;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
+
12
+ var _getPropSelector = _interopRequireDefault(require("./getPropSelector"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // These are the props accepted specifically on React Native (Web) `Text` elements.
17
+ // They are generally concerned with the behaviour of multiline text.
18
+ const crossPlatform = {
19
+ /**
20
+ * Truncates text after this many lines with an ellipsis at the end.
21
+ * On native, ellipsis behaviour may be changed with `ellipsizeMode` prop.
22
+ */
23
+ numberOfLines: _propTypes.default.number,
24
+
25
+ /**
26
+ * Default is true on web and false on native
27
+ */
28
+ selectable: _propTypes.default.bool
29
+ };
30
+ /**
31
+ * See React Native docs for latest details on these.
32
+ * https://reactnative.dev/docs/text
33
+ */
34
+
35
+ const nativeOnly = {
36
+ ellipsizeMode: _propTypes.default.string,
37
+ maxFontSizeMultiplier: _propTypes.default.number,
38
+ minimumFontScale: _propTypes.default.number,
39
+ onTextLayout: _propTypes.default.func,
40
+ suppressHighlighting: _propTypes.default.bool,
41
+ textBreakStrategy: _propTypes.default.string
42
+ };
43
+ /**
44
+ * These set HTML attributes of the same name.
45
+ */
46
+
47
+ const webOnly = {
48
+ dir: _propTypes.default.oneOf(['auto', 'ltr', 'rtl']),
49
+ lang: _propTypes.default.string
50
+ };
51
+ var _default = {
52
+ /**
53
+ * Set of prop types specific to React Native and React Native Web `Text`,
54
+ * which largely revolve around the behaviour of multiline non-pressable text.
55
+ */
56
+ types: { ...crossPlatform,
57
+ ...webOnly,
58
+ ...nativeOnly
59
+ },
60
+
61
+ /**
62
+ * Filters a props object, returning only props specific to `Text` elements
63
+ * on the current platform. Does not include props applicable to `Text` and `View`.
64
+ */
65
+ select: (0, _getPropSelector.default)({ ...crossPlatform,
66
+ ..._Platform.default.select({
67
+ web: webOnly,
68
+ default: nativeOnly
69
+ })
70
+ })
71
+ };
72
+ exports.default = _default;
@@ -26,8 +26,7 @@ const selectBulletContainerStyles = ({
26
26
  itemBulletContainerAlign
27
27
  }) => ({
28
28
  width: itemBulletContainerWidth,
29
- alignItems: itemBulletContainerAlign,
30
- justifyContent: itemBulletContainerAlign
29
+ alignItems: itemBulletContainerAlign
31
30
  });
32
31
 
33
32
  const selectItemIconTokens = ({
@@ -38,16 +37,20 @@ const selectItemIconTokens = ({
38
37
  color: itemIconColor
39
38
  });
40
39
 
41
- const selectCommonIconStyles = ({
40
+ const selectSideItemContainerStyles = ({
41
+ listGutter,
42
42
  iconMarginTop
43
43
  }) => ({
44
- marginTop: iconMarginTop
45
- });
44
+ marginTop: iconMarginTop,
45
+ marginRight: listGutter
46
+ }); // Align bullets with the top line of text the same way icons are aligned
46
47
 
47
- const selectSideItemContainerStyles = ({
48
- listGutter
48
+
49
+ const selectBulletPositioningStyles = ({
50
+ itemIconSize
49
51
  }) => ({
50
- marginRight: listGutter
52
+ width: itemIconSize,
53
+ height: itemIconSize
51
54
  });
52
55
 
53
56
  const selectItemStyles = ({
@@ -100,8 +103,8 @@ const ListItem = /*#__PURE__*/forwardRef(({
100
103
  const dividerStyles = selectDividerStyles(themeTokens);
101
104
  const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
102
105
  const itemBulletStyles = selectBulletStyles(themeTokens);
106
+ const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
103
107
  const iconTokens = selectItemIconTokens(themeTokens);
104
- const commonIconStyles = selectCommonIconStyles(themeTokens);
105
108
  const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
106
109
  const accessibilityRole = Platform.select({
107
110
  web: 'listitem',
@@ -144,7 +147,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
144
147
 
145
148
  if (icon) {
146
149
  return /*#__PURE__*/_jsx(View, {
147
- style: [sideItemContainerStyles, commonIconStyles],
150
+ style: sideItemContainerStyles,
148
151
  children: /*#__PURE__*/_jsx(IconComponent, {
149
152
  size: iconSize || iconTokens.size,
150
153
  color: iconColor || iconTokens.color
@@ -155,8 +158,11 @@ const ListItem = /*#__PURE__*/forwardRef(({
155
158
  return /*#__PURE__*/_jsx(View, {
156
159
  style: [sideItemContainerStyles, itemBulletContainerStyles],
157
160
  children: /*#__PURE__*/_jsx(View, {
158
- style: itemBulletStyles,
159
- testID: "unordered-item-bullet"
161
+ style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
162
+ children: /*#__PURE__*/_jsx(View, {
163
+ style: itemBulletStyles,
164
+ testID: "unordered-item-bullet"
165
+ })
160
166
  })
161
167
  });
162
168
  };
@@ -176,6 +182,10 @@ const staticStyles = StyleSheet.create({
176
182
  },
177
183
  wrap: {
178
184
  flex: 1
185
+ },
186
+ bulletPositioning: {
187
+ alignItems: 'center',
188
+ justifyContent: 'center'
179
189
  }
180
190
  });
181
191
  ListItem.propTypes = { ...selectedSystemPropTypes,
@@ -1,9 +1,9 @@
1
- import React, { forwardRef, useState } from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import View from "react-native-web/dist/exports/View";
3
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import PropTypes from 'prop-types';
5
5
  import { useThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
6
- import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, useSpacingScale, variantProp, viewProps } from '../utils';
6
+ import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useSpacingScale, textInputHandlerProps, textInputProps, variantProp, viewProps } from '../utils';
7
7
  import TextInputBase from '../TextInput/TextInputBase';
8
8
  import ButtonBase from '../Button/ButtonBase';
9
9
  import StackView from '../StackView';
@@ -11,7 +11,8 @@ import useCopy from '../utils/useCopy';
11
11
  import dictionary from './dictionary';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
+ const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
+ const [selectInputProps, selectedInputPropTypes] = selectSystemProps([textInputHandlerProps, textInputProps]);
15
16
 
16
17
  const selectInputTokens = ({
17
18
  searchTokens,
@@ -66,8 +67,9 @@ const selectIconTokens = ({
66
67
 
67
68
 
68
69
  const Search = /*#__PURE__*/forwardRef(({
69
- initialValue = '',
70
- placeholder = 'Search',
70
+ initialValue,
71
+ value,
72
+ placeholder,
71
73
  inactive,
72
74
  onChange,
73
75
  onSubmit,
@@ -78,7 +80,14 @@ const Search = /*#__PURE__*/forwardRef(({
78
80
  variant,
79
81
  ...rest
80
82
  }, ref) => {
81
- const [value, setValue] = useState(initialValue);
83
+ const {
84
+ currentValue = '',
85
+ setValue
86
+ } = useInputValue({
87
+ value,
88
+ initialValue,
89
+ onChange
90
+ });
82
91
  const themeTokens = useThemeTokens('Search', tokens, variant);
83
92
  const buttonTokens = useThemeTokens('SearchButton', tokens, variant);
84
93
  const getThemeTokens = useThemeTokensCallback('Search', tokens, variant);
@@ -99,26 +108,24 @@ const Search = /*#__PURE__*/forwardRef(({
99
108
 
100
109
  const handleSubmit = event => {
101
110
  if (onSubmit !== undefined) {
102
- onSubmit(value, event);
111
+ onSubmit(currentValue, event);
103
112
  }
104
113
  };
105
114
 
106
- const handleChange = (currentValue, event) => {
107
- setValue(currentValue, event);
108
- if (onChange !== undefined) onChange(currentValue, event);
109
- };
110
-
111
115
  const handleClear = event => {
112
116
  setValue('', event);
113
117
  if (onClear !== undefined) onClear('', event);
114
- if (onChange !== undefined) onChange('', event);
115
118
  };
116
119
 
117
- const isEmpty = value === '';
120
+ const isEmpty = currentValue === ''; // Accessibility label should always be present and correctly localised
121
+
122
+ const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
123
+
124
+ const placeholderText = placeholder ?? a11yLabelText;
118
125
  return /*#__PURE__*/_jsxs(View, {
119
126
  style: staticStyles.container,
120
- ...selectProps(rest),
121
- children: [/*#__PURE__*/_jsx(TextInputBase, {
127
+ ...selectContainerProps(rest),
128
+ children: [/*#__PURE__*/_jsx(TextInputBase, { ...selectInputProps(rest),
122
129
  ref: ref,
123
130
  tokens: appearances => selectInputTokens({
124
131
  searchTokens: getThemeTokens(appearances),
@@ -126,15 +133,15 @@ const Search = /*#__PURE__*/forwardRef(({
126
133
  buttonsGapSize,
127
134
  isEmpty
128
135
  }),
129
- placeholder: placeholder,
136
+ placeholder: placeholderText,
130
137
  placeholderTextColor: placeholderColor,
131
138
  inactive: inactive,
132
139
  enablesReturnKeyAutomatically: true,
133
140
  returnKeyType: "search",
134
- value: value,
135
- onChange: handleChange,
141
+ value: currentValue,
142
+ onChange: setValue,
136
143
  onSubmitEditing: handleSubmit,
137
- accessibilityLabel: accessibilityLabel || getCopy('accessibilityLabel')
144
+ accessibilityLabel: a11yLabelText
138
145
  }), /*#__PURE__*/_jsx(View, {
139
146
  style: [staticStyles.iconsContainer, selectIconsContainerStyle(themeTokens)],
140
147
  children: /*#__PURE__*/_jsxs(StackView, {
@@ -166,7 +173,8 @@ const Search = /*#__PURE__*/forwardRef(({
166
173
  });
167
174
  });
168
175
  Search.displayName = 'Search';
169
- Search.propTypes = { ...selectedSystemPropTypes,
176
+ Search.propTypes = { ...selectedContainerPropTypes,
177
+ ...selectedInputPropTypes,
170
178
 
171
179
  /**
172
180
  * Use this to set the initial value of the search input.
@@ -1,12 +1,12 @@
1
1
  import React, { forwardRef, useState } from 'react';
2
2
  import Platform from "react-native-web/dist/exports/Platform";
3
- import { a11yProps, focusHandlerProps, getTokensPropType, inputSupportsProps, selectSystemProps, textInputHandlerProps, variantProp, viewProps } from '../utils';
3
+ import { a11yProps, focusHandlerProps, getTokensPropType, inputSupportsProps, selectSystemProps, textInputHandlerProps, textInputProps, variantProp, viewProps } from '../utils';
4
4
  import InputSupports from '../InputSupports';
5
5
  import TextInputBase from './TextInputBase';
6
6
  import { useThemeTokens } from '../ThemeProvider';
7
7
  import textInputPropTypes from './propTypes';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, viewProps]);
9
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, textInputProps, viewProps]);
10
10
  /**
11
11
  * Use to collect long-form information such as product feedback or support queries.
12
12
  * Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
@@ -1,11 +1,11 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import Platform from "react-native-web/dist/exports/Platform";
3
- import { a11yProps, focusHandlerProps, getTokensPropType, inputSupportsProps, selectSystemProps, textInputHandlerProps, variantProp, viewProps } from '../utils';
3
+ import { a11yProps, focusHandlerProps, getTokensPropType, inputSupportsProps, selectSystemProps, textInputHandlerProps, textInputProps, variantProp, viewProps } from '../utils';
4
4
  import InputSupports from '../InputSupports';
5
5
  import TextInputBase from './TextInputBase';
6
6
  import textInputPropTypes from './propTypes';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, viewProps]);
8
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, textInputProps, viewProps]);
9
9
  /**
10
10
  * A basic text input component. Use in forms or individually to receive user's input.
11
11
  * Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
@@ -5,10 +5,10 @@ import NativeTextInput from "react-native-web/dist/exports/TextInput";
5
5
  import View from "react-native-web/dist/exports/View";
6
6
  import PropTypes from 'prop-types';
7
7
  import { applyTextStyles, useThemeTokens, applyOuterBorder } from '../ThemeProvider';
8
- import { a11yProps, getTokensPropType, selectSystemProps, textInputHandlerProps, useInputValue, variantProp, viewProps } from '../utils';
8
+ import { a11yProps, getTokensPropType, selectSystemProps, textInputHandlerProps, textInputProps, useInputValue, variantProp, viewProps } from '../utils';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, viewProps]);
11
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
12
12
 
13
13
  const selectInputStyles = ({
14
14
  backgroundColor,
@@ -5,13 +5,14 @@ import View from "react-native-web/dist/exports/View";
5
5
  import { useThemeTokens } from '../ThemeProvider';
6
6
  import { useViewport } from '../ViewportProvider';
7
7
  import { applyTextStyles } from '../ThemeProvider/utils';
8
- import { a11yProps, variantProp, getTokensPropType, getMaxFontMultiplier, headingTags, selectSystemProps, textTags, viewProps, getA11yPropsFromHtmlTag } from '../utils';
8
+ import { a11yProps, variantProp, getTokensPropType, getMaxFontMultiplier, headingTags, selectSystemProps, textTags, textProps, viewProps, getA11yPropsFromHtmlTag } from '../utils';
9
9
  /**
10
10
  * @typedef {import('../utils/a11y/semantics').TextTag} TextTag
11
11
  */
12
12
 
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
+ const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
+ const [selectTextProps, selectedTextPropTypes] = selectSystemProps([textProps]);
15
16
 
16
17
  const selectTextStyles = ({
17
18
  fontWeight,
@@ -50,31 +51,32 @@ const Typography = /*#__PURE__*/forwardRef(({
50
51
  const themeTokens = useThemeTokens('Typography', tokens, variant, {
51
52
  viewport
52
53
  });
53
- const textProps = {
54
+ const resolvedTextProps = { ...selectTextProps(rest),
54
55
  style: selectTextStyles(align ? { ...themeTokens,
55
56
  textAlign: align
56
57
  } : themeTokens),
57
58
  dataSet,
58
59
  maxFontSizeMultiplier: getMaxFontMultiplier(themeTokens)
59
60
  };
60
- const selectedProps = selectProps({ ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
61
- ...rest
62
- });
61
+ const containerProps = { ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
62
+ ...selectContainerProps(rest)
63
+ };
63
64
  return block ? /*#__PURE__*/_jsx(View, {
64
65
  ref: ref,
65
- ...selectedProps,
66
- children: /*#__PURE__*/_jsx(Text, { ...textProps,
66
+ ...containerProps,
67
+ children: /*#__PURE__*/_jsx(Text, { ...resolvedTextProps,
67
68
  children: children
68
69
  })
69
70
  }) : /*#__PURE__*/_jsx(Text, {
70
71
  ref: ref,
71
- ...textProps,
72
- ...selectedProps,
72
+ ...containerProps,
73
+ ...resolvedTextProps,
73
74
  children: children
74
75
  });
75
76
  });
76
77
  Typography.displayName = 'Typography';
77
- Typography.propTypes = { ...selectedSystemPropTypes,
78
+ Typography.propTypes = { ...selectedContainerPropTypes,
79
+ ...selectedTextPropTypes,
78
80
  tokens: getTokensPropType('Typography'),
79
81
  variant: variantProp.propType,
80
82
 
@@ -44,5 +44,5 @@ export { default as Typography } from './Typography';
44
44
  export { default as A11yInfoProvider, useA11yInfo } from './A11yInfoProvider';
45
45
  export { default as BaseProvider } from './BaseProvider';
46
46
  export { default as ViewportProvider, useViewport, ViewportContext } from './ViewportProvider';
47
- export { default as ThemeProvider, useTheme, useSetTheme, useThemeTokens, getThemeTokens } from './ThemeProvider';
47
+ export { default as ThemeProvider, useTheme, useSetTheme, useThemeTokens, getThemeTokens, applyOuterBorder, applyTextStyles, applyShadowToken } from './ThemeProvider';
48
48
  export * from './utils';
@@ -1,4 +1,8 @@
1
1
  import { useCallback, useRef, useState } from 'react';
2
+ /**
3
+ * @typedef {import('react').SyntheticEvent} Event
4
+ */
5
+
2
6
  const pluralHooks = ['useMultipleInputValues'];
3
7
 
4
8
  const validateProps = ({
@@ -56,11 +60,9 @@ Consumers of this hook must be one of:
56
60
  *
57
61
  * @param {string} hookName - optional, used for tailoring error messages
58
62
  *
59
- * @typedef {(oldValue: string|number|null) => string|number|null} UpdaterFunction - `setValue` takes a value or
60
- * a function returning a new value from the old value
61
63
  * @returns {{
62
64
  * currentValue: string|number|null
63
- * setValue: (newValue: string|number|null|UpdaterFunction) => void
65
+ * setValue: (newValue: string|number|null|(oldValue: string|number) => string|number, event: Event) => void
64
66
  * resetValue: () => void
65
67
  * isControlled: bool
66
68
  * }}
@@ -122,12 +124,10 @@ export const useInputValue = (props = {}, hookName = 'useInputValue') => {
122
124
  *
123
125
  * @param {string} componentName - optional, used in error messages
124
126
  *
125
- * @typedef {(oldValues: string[]|number[]) => string[]|number[]} UpdaterFunction - `setValues` takes values or
126
- * a function returning new values from old values
127
127
  * @returns {{
128
128
  * currentValues: any
129
129
  * resetValues: () => void
130
- * setValues: (newValues: string[]|number[]|UpdaterFunction) => void
130
+ * setValues: (newValues: string[]|number[]|(oldValues: string[]|number[]) => string[]|number[], event: Event) => void
131
131
  * toggleOneValue: (value: string|number) => void
132
132
  * unsetValues: () => void
133
133
  * }}
@@ -13,5 +13,7 @@ export { default as rectProp } from './rectProp';
13
13
  export { default as responsiveProps } from './responsiveProps';
14
14
  export { default as spacingProps } from './spacingProps';
15
15
  export { default as selectSystemProps } from './selectSystemProps';
16
+ export { default as textInputProps } from './textInputProps';
17
+ export { default as textProps } from './textProps';
16
18
  export { default as variantProp } from './variantProp';
17
19
  export { default as viewProps } from './viewProps';