@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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-lint.log +13 -13
- package/CHANGELOG.json +36 -1
- package/CHANGELOG.md +16 -2
- package/component-docs.json +14 -22
- package/lib/List/ListItem.js +22 -12
- package/lib/Search/Search.js +27 -19
- package/lib/TextInput/TextArea.js +1 -1
- package/lib/TextInput/TextInput.js +1 -1
- package/lib/TextInput/TextInputBase.js +1 -1
- package/lib/Typography/Typography.js +12 -10
- package/lib/index.js +22 -1
- package/lib/utils/input.js +5 -6
- package/lib/utils/props/index.js +18 -0
- package/lib/utils/props/textInputProps.js +206 -0
- package/lib/utils/props/textProps.js +72 -0
- package/lib-module/List/ListItem.js +22 -12
- package/lib-module/Search/Search.js +29 -21
- package/lib-module/TextInput/TextArea.js +2 -2
- package/lib-module/TextInput/TextInput.js +2 -2
- package/lib-module/TextInput/TextInputBase.js +2 -2
- package/lib-module/Typography/Typography.js +13 -11
- package/lib-module/index.js +1 -1
- package/lib-module/utils/input.js +6 -6
- package/lib-module/utils/props/index.js +2 -0
- package/lib-module/utils/props/textInputProps.js +193 -0
- package/lib-module/utils/props/textProps.js +59 -0
- package/package.json +1 -1
- package/src/List/ListItem.jsx +17 -9
- package/src/Search/Search.jsx +33 -21
- package/src/TextInput/TextArea.jsx +2 -0
- package/src/TextInput/TextInput.jsx +2 -0
- package/src/TextInput/TextInputBase.jsx +2 -0
- package/src/Typography/Typography.jsx +13 -9
- package/src/index.js +4 -1
- package/src/utils/input.js +5 -7
- package/src/utils/props/index.js +2 -0
- package/src/utils/props/textInputProps.js +177 -0
- package/src/utils/props/textProps.js +58 -0
- package/stories/Search/Search.stories.jsx +49 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
1
|
+
[35m@telus-uds/components-base:build: [0mcache hit, replaying output [2m1881992cce187510[0m
|
|
2
|
+
[35m@telus-uds/components-base:build: [0m[2K[1G[2m$ yarn build:code && yarn build:docs[22m
|
|
3
|
+
[35m@telus-uds/components-base:build: [0m[2K[1G[2m$ yarn build:main && yarn build:module[22m
|
|
4
|
+
[35m@telus-uds/components-base:build: [0m[2K[1G[2m$ babel src -d lib[22m
|
|
5
|
+
[35m@telus-uds/components-base:build: [0mSuccessfully compiled 219 files with Babel (6264ms).
|
|
6
|
+
[35m@telus-uds/components-base:build: [0m[2K[1G[2m$ babel src -d lib-module --env-name module[22m
|
|
7
|
+
[35m@telus-uds/components-base:build: [0mSuccessfully compiled 219 files with Babel (4314ms).
|
|
8
|
+
[35m@telus-uds/components-base:build: [0m[2K[1G[2m$ babel-node --plugins=@nearform/babel-plugin-react-docgen generate-component-docs.js[22m
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
1
|
+
[33m@telus-uds/components-base:lint: [0mcache hit, replaying output [2mb72941df2cdfe4ea[0m
|
|
2
|
+
[33m@telus-uds/components-base:lint: [0m[2K[1G[2m$ yarn --cwd ../.. lint:path --color packages/components-base[22m
|
|
3
|
+
[33m@telus-uds/components-base:lint: [0m[2K[1G[2m$ eslint --ignore-path .gitignore --ext .js,.jsx,.mjs,.cjs --color packages/components-base[22m
|
|
4
|
+
[33m@telus-uds/components-base:lint: [0m[0m[0m
|
|
5
|
+
[33m@telus-uds/components-base:lint: [0m[0m[4m/home/runner/work/universal-design-system/universal-design-system/packages/components-base/__tests__/FlexGrid/Col.test.jsx[24m[0m
|
|
6
|
+
[33m@telus-uds/components-base:lint: [0m[0m [2m51:71[22m [33mwarning[39m Expect must have a corresponding matcher call [2mjest/valid-expect[22m[0m
|
|
7
|
+
[33m@telus-uds/components-base:lint: [0m[0m [2m106:71[22m [33mwarning[39m Expect must have a corresponding matcher call [2mjest/valid-expect[22m[0m
|
|
8
|
+
[33m@telus-uds/components-base:lint: [0m[0m [2m155:63[22m [33mwarning[39m Expect must have a corresponding matcher call [2mjest/valid-expect[22m[0m
|
|
9
|
+
[33m@telus-uds/components-base:lint: [0m[0m [2m200:71[22m [33mwarning[39m Expect must have a corresponding matcher call [2mjest/valid-expect[22m[0m
|
|
10
|
+
[33m@telus-uds/components-base:lint: [0m[0m [2m248:71[22m [33mwarning[39m Expect must have a corresponding matcher call [2mjest/valid-expect[22m[0m
|
|
11
|
+
[33m@telus-uds/components-base:lint: [0m[0m[0m
|
|
12
|
+
[33m@telus-uds/components-base:lint: [0m[0m[33m[1m✖ 5 problems (0 errors, 5 warnings)[22m[39m[0m
|
|
13
|
+
[33m@telus-uds/components-base:lint: [0m[0m[33m[1m[22m[39m[0m
|
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,42 @@
|
|
|
2
2
|
"name": "@telus-uds/components-base",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 17 May 2022 15:04:41 GMT",
|
|
6
|
+
"tag": "@telus-uds/components-base_v1.7.0",
|
|
7
|
+
"version": "1.7.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "alan.slater@nearform.com",
|
|
12
|
+
"package": "@telus-uds/components-base",
|
|
13
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
14
|
+
"comment": "align List bullets like icons"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "alan.slater@nearform.com",
|
|
18
|
+
"package": "@telus-uds/components-base",
|
|
19
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
20
|
+
"comment": "Add text props to Typography"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "alan.slater@nearform.com",
|
|
24
|
+
"package": "@telus-uds/components-base",
|
|
25
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
26
|
+
"comment": "fix(components): support TextInput props"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"minor": [
|
|
30
|
+
{
|
|
31
|
+
"author": "alan.slater@nearform.com",
|
|
32
|
+
"package": "@telus-uds/components-base",
|
|
33
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
34
|
+
"comment": "Allow Search component to be controlled"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"date": "Fri, 06 May 2022 15:31:28 GMT",
|
|
6
41
|
"tag": "@telus-uds/components-base_v1.6.1",
|
|
7
42
|
"version": "1.6.1",
|
|
8
43
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 17 May 2022 15:04:41 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.7.0
|
|
8
|
+
|
|
9
|
+
Tue, 17 May 2022 15:04:41 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Allow Search component to be controlled (alan.slater@nearform.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- align List bullets like icons (alan.slater@nearform.com)
|
|
18
|
+
- Add text props to Typography (alan.slater@nearform.com)
|
|
19
|
+
- fix(components): support TextInput props (alan.slater@nearform.com)
|
|
20
|
+
|
|
7
21
|
## 1.6.1
|
|
8
22
|
|
|
9
|
-
Fri, 06 May 2022 15:31:
|
|
23
|
+
Fri, 06 May 2022 15:31:28 GMT
|
|
10
24
|
|
|
11
25
|
### Patches
|
|
12
26
|
|
package/component-docs.json
CHANGED
|
@@ -5701,28 +5701,6 @@
|
|
|
5701
5701
|
"docs": {
|
|
5702
5702
|
"description": "The `Search` component is a combination of a `TextInput` and 2 different kinds of custom buttons.\nUse `Search` to feature autocomplete interactions.\n\nThis component includes a clear button, which will appear as text is entered and pressing it will\ncause the input's internal state value to be set to an empty string.\n\nThis component may only be used as uncontrolled, as the search value is managed within an internal state.\nYou can use the `onChange` prop to react to value changes and the `onSubmit` prop to react on search submission.\n\nUse the following props to supply additional accessibility labels for the input - `accessibilityLabel`,\nclear button - `clearButtonAccessibilityLabel`, and submit button - `submitButtonAccessibilityLabel`.",
|
|
5703
5703
|
"props": {
|
|
5704
|
-
"initialValue": {
|
|
5705
|
-
"defaultValue": {
|
|
5706
|
-
"value": "''",
|
|
5707
|
-
"computed": false
|
|
5708
|
-
},
|
|
5709
|
-
"type": {
|
|
5710
|
-
"name": "string"
|
|
5711
|
-
},
|
|
5712
|
-
"required": false,
|
|
5713
|
-
"description": "Use this to set the initial value of the search input.\nUpdating `initialValue` will **not** update the actual value."
|
|
5714
|
-
},
|
|
5715
|
-
"placeholder": {
|
|
5716
|
-
"defaultValue": {
|
|
5717
|
-
"value": "'Search'",
|
|
5718
|
-
"computed": false
|
|
5719
|
-
},
|
|
5720
|
-
"type": {
|
|
5721
|
-
"name": "string"
|
|
5722
|
-
},
|
|
5723
|
-
"required": false,
|
|
5724
|
-
"description": "Label rendered in the search input when it has no value."
|
|
5725
|
-
},
|
|
5726
5704
|
"copy": {
|
|
5727
5705
|
"defaultValue": {
|
|
5728
5706
|
"value": "'en'",
|
|
@@ -5766,6 +5744,20 @@
|
|
|
5766
5744
|
"required": false,
|
|
5767
5745
|
"description": "Select english or french copy for the accessible labels.\nYou may also pass in a custom dictionary object."
|
|
5768
5746
|
},
|
|
5747
|
+
"initialValue": {
|
|
5748
|
+
"type": {
|
|
5749
|
+
"name": "string"
|
|
5750
|
+
},
|
|
5751
|
+
"required": false,
|
|
5752
|
+
"description": "Use this to set the initial value of the search input.\nUpdating `initialValue` will **not** update the actual value."
|
|
5753
|
+
},
|
|
5754
|
+
"placeholder": {
|
|
5755
|
+
"type": {
|
|
5756
|
+
"name": "string"
|
|
5757
|
+
},
|
|
5758
|
+
"required": false,
|
|
5759
|
+
"description": "Label rendered in the search input when it has no value."
|
|
5760
|
+
},
|
|
5769
5761
|
"inactive": {
|
|
5770
5762
|
"type": {
|
|
5771
5763
|
"name": "bool"
|
package/lib/List/ListItem.js
CHANGED
|
@@ -45,8 +45,7 @@ const selectBulletContainerStyles = ({
|
|
|
45
45
|
itemBulletContainerAlign
|
|
46
46
|
}) => ({
|
|
47
47
|
width: itemBulletContainerWidth,
|
|
48
|
-
alignItems: itemBulletContainerAlign
|
|
49
|
-
justifyContent: itemBulletContainerAlign
|
|
48
|
+
alignItems: itemBulletContainerAlign
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
const selectItemIconTokens = ({
|
|
@@ -57,16 +56,20 @@ const selectItemIconTokens = ({
|
|
|
57
56
|
color: itemIconColor
|
|
58
57
|
});
|
|
59
58
|
|
|
60
|
-
const
|
|
59
|
+
const selectSideItemContainerStyles = ({
|
|
60
|
+
listGutter,
|
|
61
61
|
iconMarginTop
|
|
62
62
|
}) => ({
|
|
63
|
-
marginTop: iconMarginTop
|
|
64
|
-
|
|
63
|
+
marginTop: iconMarginTop,
|
|
64
|
+
marginRight: listGutter
|
|
65
|
+
}); // Align bullets with the top line of text the same way icons are aligned
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
const selectBulletPositioningStyles = ({
|
|
69
|
+
itemIconSize
|
|
68
70
|
}) => ({
|
|
69
|
-
|
|
71
|
+
width: itemIconSize,
|
|
72
|
+
height: itemIconSize
|
|
70
73
|
});
|
|
71
74
|
|
|
72
75
|
const selectItemStyles = ({
|
|
@@ -119,8 +122,8 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
119
122
|
const dividerStyles = selectDividerStyles(themeTokens);
|
|
120
123
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
121
124
|
const itemBulletStyles = selectBulletStyles(themeTokens);
|
|
125
|
+
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
122
126
|
const iconTokens = selectItemIconTokens(themeTokens);
|
|
123
|
-
const commonIconStyles = selectCommonIconStyles(themeTokens);
|
|
124
127
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
125
128
|
|
|
126
129
|
const accessibilityRole = _Platform.default.select({
|
|
@@ -164,7 +167,7 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
164
167
|
|
|
165
168
|
if (icon) {
|
|
166
169
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
167
|
-
style:
|
|
170
|
+
style: sideItemContainerStyles,
|
|
168
171
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
169
172
|
size: iconSize || iconTokens.size,
|
|
170
173
|
color: iconColor || iconTokens.color
|
|
@@ -175,8 +178,11 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
175
178
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
176
179
|
style: [sideItemContainerStyles, itemBulletContainerStyles],
|
|
177
180
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
178
|
-
style:
|
|
179
|
-
|
|
181
|
+
style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
|
|
182
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
183
|
+
style: itemBulletStyles,
|
|
184
|
+
testID: "unordered-item-bullet"
|
|
185
|
+
})
|
|
180
186
|
})
|
|
181
187
|
});
|
|
182
188
|
};
|
|
@@ -197,6 +203,10 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
197
203
|
},
|
|
198
204
|
wrap: {
|
|
199
205
|
flex: 1
|
|
206
|
+
},
|
|
207
|
+
bulletPositioning: {
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
justifyContent: 'center'
|
|
200
210
|
}
|
|
201
211
|
});
|
|
202
212
|
|
package/lib/Search/Search.js
CHANGED
|
@@ -35,7 +35,8 @@ 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 [
|
|
38
|
+
const [selectContainerProps, selectedContainerPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
39
|
+
const [selectInputProps, selectedInputPropTypes] = (0, _utils.selectSystemProps)([_utils.textInputHandlerProps, _utils.textInputProps]);
|
|
39
40
|
|
|
40
41
|
const selectInputTokens = ({
|
|
41
42
|
searchTokens,
|
|
@@ -90,8 +91,9 @@ const selectIconTokens = ({
|
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
93
|
-
initialValue
|
|
94
|
-
|
|
94
|
+
initialValue,
|
|
95
|
+
value,
|
|
96
|
+
placeholder,
|
|
95
97
|
inactive,
|
|
96
98
|
onChange,
|
|
97
99
|
onSubmit,
|
|
@@ -102,7 +104,14 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
102
104
|
variant,
|
|
103
105
|
...rest
|
|
104
106
|
}, ref) => {
|
|
105
|
-
const
|
|
107
|
+
const {
|
|
108
|
+
currentValue = '',
|
|
109
|
+
setValue
|
|
110
|
+
} = (0, _utils.useInputValue)({
|
|
111
|
+
value,
|
|
112
|
+
initialValue,
|
|
113
|
+
onChange
|
|
114
|
+
});
|
|
106
115
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Search', tokens, variant);
|
|
107
116
|
const buttonTokens = (0, _ThemeProvider.useThemeTokens)('SearchButton', tokens, variant);
|
|
108
117
|
const getThemeTokens = (0, _ThemeProvider.useThemeTokensCallback)('Search', tokens, variant);
|
|
@@ -123,26 +132,24 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
123
132
|
|
|
124
133
|
const handleSubmit = event => {
|
|
125
134
|
if (onSubmit !== undefined) {
|
|
126
|
-
onSubmit(
|
|
135
|
+
onSubmit(currentValue, event);
|
|
127
136
|
}
|
|
128
137
|
};
|
|
129
138
|
|
|
130
|
-
const handleChange = (currentValue, event) => {
|
|
131
|
-
setValue(currentValue, event);
|
|
132
|
-
if (onChange !== undefined) onChange(currentValue, event);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
139
|
const handleClear = event => {
|
|
136
140
|
setValue('', event);
|
|
137
141
|
if (onClear !== undefined) onClear('', event);
|
|
138
|
-
if (onChange !== undefined) onChange('', event);
|
|
139
142
|
};
|
|
140
143
|
|
|
141
|
-
const isEmpty =
|
|
144
|
+
const isEmpty = currentValue === ''; // Accessibility label should always be present and correctly localised
|
|
145
|
+
|
|
146
|
+
const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
|
|
147
|
+
|
|
148
|
+
const placeholderText = placeholder ?? a11yLabelText;
|
|
142
149
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
143
150
|
style: staticStyles.container,
|
|
144
|
-
...
|
|
145
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
151
|
+
...selectContainerProps(rest),
|
|
152
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, { ...selectInputProps(rest),
|
|
146
153
|
ref: ref,
|
|
147
154
|
tokens: appearances => selectInputTokens({
|
|
148
155
|
searchTokens: getThemeTokens(appearances),
|
|
@@ -150,15 +157,15 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
150
157
|
buttonsGapSize,
|
|
151
158
|
isEmpty
|
|
152
159
|
}),
|
|
153
|
-
placeholder:
|
|
160
|
+
placeholder: placeholderText,
|
|
154
161
|
placeholderTextColor: placeholderColor,
|
|
155
162
|
inactive: inactive,
|
|
156
163
|
enablesReturnKeyAutomatically: true,
|
|
157
164
|
returnKeyType: "search",
|
|
158
|
-
value:
|
|
159
|
-
onChange:
|
|
165
|
+
value: currentValue,
|
|
166
|
+
onChange: setValue,
|
|
160
167
|
onSubmitEditing: handleSubmit,
|
|
161
|
-
accessibilityLabel:
|
|
168
|
+
accessibilityLabel: a11yLabelText
|
|
162
169
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
163
170
|
style: [staticStyles.iconsContainer, selectIconsContainerStyle(themeTokens)],
|
|
164
171
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
@@ -190,7 +197,8 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
190
197
|
});
|
|
191
198
|
});
|
|
192
199
|
Search.displayName = 'Search';
|
|
193
|
-
Search.propTypes = { ...
|
|
200
|
+
Search.propTypes = { ...selectedContainerPropTypes,
|
|
201
|
+
...selectedInputPropTypes,
|
|
194
202
|
|
|
195
203
|
/**
|
|
196
204
|
* Use this to set the initial value of the search input.
|
|
@@ -27,7 +27,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
29
|
|
|
30
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.inputSupportsProps, _utils.textInputHandlerProps, _utils.viewProps]);
|
|
30
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.inputSupportsProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
31
31
|
/**
|
|
32
32
|
* Use to collect long-form information such as product feedback or support queries.
|
|
33
33
|
* Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
|
|
@@ -25,7 +25,7 @@ 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
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.inputSupportsProps, _utils.textInputHandlerProps, _utils.viewProps]);
|
|
28
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.inputSupportsProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
29
29
|
/**
|
|
30
30
|
* A basic text input component. Use in forms or individually to receive user's input.
|
|
31
31
|
* Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
|
|
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
|
|
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
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.viewProps]);
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
33
33
|
|
|
34
34
|
const selectInputStyles = ({
|
|
35
35
|
backgroundColor,
|
|
@@ -32,7 +32,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
32
|
/**
|
|
33
33
|
* @typedef {import('../utils/a11y/semantics').TextTag} TextTag
|
|
34
34
|
*/
|
|
35
|
-
const [
|
|
35
|
+
const [selectContainerProps, selectedContainerPropTypes] = (0, _utils2.selectSystemProps)([_utils2.a11yProps, _utils2.viewProps]);
|
|
36
|
+
const [selectTextProps, selectedTextPropTypes] = (0, _utils2.selectSystemProps)([_utils2.textProps]);
|
|
36
37
|
|
|
37
38
|
const selectTextStyles = ({
|
|
38
39
|
fontWeight,
|
|
@@ -71,31 +72,32 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
71
72
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Typography', tokens, variant, {
|
|
72
73
|
viewport
|
|
73
74
|
});
|
|
74
|
-
const
|
|
75
|
+
const resolvedTextProps = { ...selectTextProps(rest),
|
|
75
76
|
style: selectTextStyles(align ? { ...themeTokens,
|
|
76
77
|
textAlign: align
|
|
77
78
|
} : themeTokens),
|
|
78
79
|
dataSet,
|
|
79
80
|
maxFontSizeMultiplier: (0, _utils2.getMaxFontMultiplier)(themeTokens)
|
|
80
81
|
};
|
|
81
|
-
const
|
|
82
|
-
...rest
|
|
83
|
-
}
|
|
82
|
+
const containerProps = { ...(0, _utils2.getA11yPropsFromHtmlTag)(tag, accessibilityRole),
|
|
83
|
+
...selectContainerProps(rest)
|
|
84
|
+
};
|
|
84
85
|
return block ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
85
86
|
ref: ref,
|
|
86
|
-
...
|
|
87
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, { ...
|
|
87
|
+
...containerProps,
|
|
88
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, { ...resolvedTextProps,
|
|
88
89
|
children: children
|
|
89
90
|
})
|
|
90
91
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
91
92
|
ref: ref,
|
|
92
|
-
...
|
|
93
|
-
...
|
|
93
|
+
...containerProps,
|
|
94
|
+
...resolvedTextProps,
|
|
94
95
|
children: children
|
|
95
96
|
});
|
|
96
97
|
});
|
|
97
98
|
Typography.displayName = 'Typography';
|
|
98
|
-
Typography.propTypes = { ...
|
|
99
|
+
Typography.propTypes = { ...selectedContainerPropTypes,
|
|
100
|
+
...selectedTextPropTypes,
|
|
99
101
|
tokens: (0, _utils2.getTokensPropType)('Typography'),
|
|
100
102
|
variant: _utils2.variantProp.propType,
|
|
101
103
|
|
package/lib/index.js
CHANGED
|
@@ -51,7 +51,10 @@ var _exportNames = {
|
|
|
51
51
|
useTheme: true,
|
|
52
52
|
useSetTheme: true,
|
|
53
53
|
useThemeTokens: true,
|
|
54
|
-
getThemeTokens: true
|
|
54
|
+
getThemeTokens: true,
|
|
55
|
+
applyOuterBorder: true,
|
|
56
|
+
applyTextStyles: true,
|
|
57
|
+
applyShadowToken: true
|
|
55
58
|
};
|
|
56
59
|
Object.defineProperty(exports, "A11yText", {
|
|
57
60
|
enumerable: true,
|
|
@@ -341,6 +344,24 @@ Object.defineProperty(exports, "getThemeTokens", {
|
|
|
341
344
|
return _ThemeProvider.getThemeTokens;
|
|
342
345
|
}
|
|
343
346
|
});
|
|
347
|
+
Object.defineProperty(exports, "applyOuterBorder", {
|
|
348
|
+
enumerable: true,
|
|
349
|
+
get: function () {
|
|
350
|
+
return _ThemeProvider.applyOuterBorder;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
Object.defineProperty(exports, "applyTextStyles", {
|
|
354
|
+
enumerable: true,
|
|
355
|
+
get: function () {
|
|
356
|
+
return _ThemeProvider.applyTextStyles;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
Object.defineProperty(exports, "applyShadowToken", {
|
|
360
|
+
enumerable: true,
|
|
361
|
+
get: function () {
|
|
362
|
+
return _ThemeProvider.applyShadowToken;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
344
365
|
|
|
345
366
|
var _A11yText = _interopRequireDefault(require("./A11yText"));
|
|
346
367
|
|
package/lib/utils/input.js
CHANGED
|
@@ -7,6 +7,9 @@ exports.useMultipleInputValues = exports.useInputValue = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {import('react').SyntheticEvent} Event
|
|
12
|
+
*/
|
|
10
13
|
const pluralHooks = ['useMultipleInputValues'];
|
|
11
14
|
|
|
12
15
|
const validateProps = ({
|
|
@@ -64,11 +67,9 @@ Consumers of this hook must be one of:
|
|
|
64
67
|
*
|
|
65
68
|
* @param {string} hookName - optional, used for tailoring error messages
|
|
66
69
|
*
|
|
67
|
-
* @typedef {(oldValue: string|number|null) => string|number|null} UpdaterFunction - `setValue` takes a value or
|
|
68
|
-
* a function returning a new value from the old value
|
|
69
70
|
* @returns {{
|
|
70
71
|
* currentValue: string|number|null
|
|
71
|
-
* setValue: (newValue: string|number|null|
|
|
72
|
+
* setValue: (newValue: string|number|null|(oldValue: string|number) => string|number, event: Event) => void
|
|
72
73
|
* resetValue: () => void
|
|
73
74
|
* isControlled: bool
|
|
74
75
|
* }}
|
|
@@ -130,12 +131,10 @@ const useInputValue = (props = {}, hookName = 'useInputValue') => {
|
|
|
130
131
|
*
|
|
131
132
|
* @param {string} componentName - optional, used in error messages
|
|
132
133
|
*
|
|
133
|
-
* @typedef {(oldValues: string[]|number[]) => string[]|number[]} UpdaterFunction - `setValues` takes values or
|
|
134
|
-
* a function returning new values from old values
|
|
135
134
|
* @returns {{
|
|
136
135
|
* currentValues: any
|
|
137
136
|
* resetValues: () => void
|
|
138
|
-
* setValues: (newValues: string[]|number[]|
|
|
137
|
+
* setValues: (newValues: string[]|number[]|(oldValues: string[]|number[]) => string[]|number[], event: Event) => void
|
|
139
138
|
* toggleOneValue: (value: string|number) => void
|
|
140
139
|
* unsetValues: () => void
|
|
141
140
|
* }}
|
package/lib/utils/props/index.js
CHANGED
|
@@ -17,6 +17,8 @@ var _exportNames = {
|
|
|
17
17
|
responsiveProps: true,
|
|
18
18
|
spacingProps: true,
|
|
19
19
|
selectSystemProps: true,
|
|
20
|
+
textInputProps: true,
|
|
21
|
+
textProps: true,
|
|
20
22
|
variantProp: true,
|
|
21
23
|
viewProps: true
|
|
22
24
|
};
|
|
@@ -98,6 +100,18 @@ Object.defineProperty(exports, "selectSystemProps", {
|
|
|
98
100
|
return _selectSystemProps.default;
|
|
99
101
|
}
|
|
100
102
|
});
|
|
103
|
+
Object.defineProperty(exports, "textInputProps", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _textInputProps.default;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "textProps", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _textProps.default;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
101
115
|
Object.defineProperty(exports, "variantProp", {
|
|
102
116
|
enumerable: true,
|
|
103
117
|
get: function () {
|
|
@@ -165,6 +179,10 @@ var _spacingProps = _interopRequireDefault(require("./spacingProps"));
|
|
|
165
179
|
|
|
166
180
|
var _selectSystemProps = _interopRequireDefault(require("./selectSystemProps"));
|
|
167
181
|
|
|
182
|
+
var _textInputProps = _interopRequireDefault(require("./textInputProps"));
|
|
183
|
+
|
|
184
|
+
var _textProps = _interopRequireDefault(require("./textProps"));
|
|
185
|
+
|
|
168
186
|
var _variantProp = _interopRequireDefault(require("./variantProp"));
|
|
169
187
|
|
|
170
188
|
var _viewProps = _interopRequireDefault(require("./viewProps"));
|