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