@telus-uds/components-base 1.6.0 → 1.7.1
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 +72 -1
- package/CHANGELOG.md +33 -2
- package/component-docs.json +60 -24
- package/generate-component-docs.js +20 -7
- package/lib/Link/TextButton.js +1 -10
- 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/linkProps.js +3 -7
- package/lib/utils/props/textInputProps.js +207 -0
- package/lib/utils/props/textProps.js +72 -0
- package/lib-module/Link/TextButton.js +1 -10
- 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/linkProps.js +3 -7
- package/lib-module/utils/props/textInputProps.js +194 -0
- package/lib-module/utils/props/textProps.js +59 -0
- package/package.json +1 -1
- package/src/Link/TextButton.jsx +1 -19
- 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/linkProps.js +3 -6
- package/src/utils/props/textInputProps.js +178 -0
- package/src/utils/props/textProps.js +58 -0
- package/stories/Search/Search.stories.jsx +49 -2
- package/__tests__/Link/LinkBase.test.jsx +0 -22
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
1
|
+
[32m@telus-uds/components-base:build: [0mcache hit, replaying output [2m2723a575209dd005[0m
|
|
2
|
+
[32m@telus-uds/components-base:build: [0m[2K[1G[2m$ yarn build:code && yarn build:docs[22m
|
|
3
|
+
[32m@telus-uds/components-base:build: [0m[2K[1G[2m$ yarn build:main && yarn build:module[22m
|
|
4
|
+
[32m@telus-uds/components-base:build: [0m[2K[1G[2m$ babel src -d lib[22m
|
|
5
|
+
[32m@telus-uds/components-base:build: [0mSuccessfully compiled 219 files with Babel (5370ms).
|
|
6
|
+
[32m@telus-uds/components-base:build: [0m[2K[1G[2m$ babel src -d lib-module --env-name module[22m
|
|
7
|
+
[32m@telus-uds/components-base:build: [0mSuccessfully compiled 219 files with Babel (3473ms).
|
|
8
|
+
[32m@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 [2m89b2f7c5fe1ddf01[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,78 @@
|
|
|
2
2
|
"name": "@telus-uds/components-base",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 17 May 2022 19:56:01 GMT",
|
|
6
|
+
"tag": "@telus-uds/components-base_v1.7.1",
|
|
7
|
+
"version": "1.7.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "alan.slater@nearform.com",
|
|
12
|
+
"package": "@telus-uds/components-base",
|
|
13
|
+
"commit": "135b7393e08bc5078bc73da4740da2b1f9e990fd",
|
|
14
|
+
"comment": "fix(components): fix inactive TextInput prop"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 17 May 2022 15:04:46 GMT",
|
|
21
|
+
"tag": "@telus-uds/components-base_v1.7.0",
|
|
22
|
+
"version": "1.7.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "alan.slater@nearform.com",
|
|
27
|
+
"package": "@telus-uds/components-base",
|
|
28
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
29
|
+
"comment": "align List bullets like icons"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "alan.slater@nearform.com",
|
|
33
|
+
"package": "@telus-uds/components-base",
|
|
34
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
35
|
+
"comment": "Add text props to Typography"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "alan.slater@nearform.com",
|
|
39
|
+
"package": "@telus-uds/components-base",
|
|
40
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
41
|
+
"comment": "fix(components): support TextInput props"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"minor": [
|
|
45
|
+
{
|
|
46
|
+
"author": "alan.slater@nearform.com",
|
|
47
|
+
"package": "@telus-uds/components-base",
|
|
48
|
+
"commit": "70105ac8b165247e3cd29a78e3247f7a475b287a",
|
|
49
|
+
"comment": "Allow Search component to be controlled"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"date": "Fri, 06 May 2022 15:31:28 GMT",
|
|
56
|
+
"tag": "@telus-uds/components-base_v1.6.1",
|
|
57
|
+
"version": "1.6.1",
|
|
58
|
+
"comments": {
|
|
59
|
+
"patch": [
|
|
60
|
+
{
|
|
61
|
+
"author": "alan.slater@nearform.com",
|
|
62
|
+
"package": "@telus-uds/components-base",
|
|
63
|
+
"commit": "d0967886e4328b789fd5490f068c74fa24379b87",
|
|
64
|
+
"comment": "don't throw if no href/onPress in link/button"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"author": "ruslan.bredikhin@nearform.com",
|
|
68
|
+
"package": "@telus-uds/components-base",
|
|
69
|
+
"commit": "d0967886e4328b789fd5490f068c74fa24379b87",
|
|
70
|
+
"comment": "fix: allow parsing tokens inherited from multiple components"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"date": "Thu, 28 Apr 2022 15:40:29 GMT",
|
|
6
77
|
"tag": "@telus-uds/components-base_v1.6.0",
|
|
7
78
|
"version": "1.6.0",
|
|
8
79
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,43 @@
|
|
|
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 19:56:01 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.7.1
|
|
8
|
+
|
|
9
|
+
Tue, 17 May 2022 19:56:01 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fix(components): fix inactive TextInput prop (alan.slater@nearform.com)
|
|
14
|
+
|
|
15
|
+
## 1.7.0
|
|
16
|
+
|
|
17
|
+
Tue, 17 May 2022 15:04:46 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- Allow Search component to be controlled (alan.slater@nearform.com)
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- align List bullets like icons (alan.slater@nearform.com)
|
|
26
|
+
- Add text props to Typography (alan.slater@nearform.com)
|
|
27
|
+
- fix(components): support TextInput props (alan.slater@nearform.com)
|
|
28
|
+
|
|
29
|
+
## 1.6.1
|
|
30
|
+
|
|
31
|
+
Fri, 06 May 2022 15:31:28 GMT
|
|
32
|
+
|
|
33
|
+
### Patches
|
|
34
|
+
|
|
35
|
+
- don't throw if no href/onPress in link/button (alan.slater@nearform.com)
|
|
36
|
+
- fix: allow parsing tokens inherited from multiple components (ruslan.bredikhin@nearform.com)
|
|
37
|
+
|
|
7
38
|
## 1.6.0
|
|
8
39
|
|
|
9
|
-
Thu, 28 Apr 2022 15:40:
|
|
40
|
+
Thu, 28 Apr 2022 15:40:29 GMT
|
|
10
41
|
|
|
11
42
|
### Minor changes
|
|
12
43
|
|
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"
|
|
@@ -8509,7 +8501,29 @@
|
|
|
8509
8501
|
"tokens": {
|
|
8510
8502
|
"type": {
|
|
8511
8503
|
"name": "custom",
|
|
8512
|
-
"raw":
|
|
8504
|
+
"raw": {
|
|
8505
|
+
"leftIcon": "icon",
|
|
8506
|
+
"rightIcon": "icon",
|
|
8507
|
+
"iconDisplace": "size",
|
|
8508
|
+
"iconSize": "size",
|
|
8509
|
+
"iconSpace": "integer",
|
|
8510
|
+
"textLine": "textLine",
|
|
8511
|
+
"color": "color",
|
|
8512
|
+
"textLineStyle": "textLineStyle",
|
|
8513
|
+
"outerBorderColor": "color",
|
|
8514
|
+
"outerBorderWidth": "border",
|
|
8515
|
+
"outerBorderGap": "size",
|
|
8516
|
+
"outerBorderOutline": "borderStyle",
|
|
8517
|
+
"borderRadius": "radius",
|
|
8518
|
+
"blockFontName": "fontName",
|
|
8519
|
+
"blockFontWeight": "fontWeight",
|
|
8520
|
+
"blockFontSize": "fontSize",
|
|
8521
|
+
"blockLineHeight": "lineHeight",
|
|
8522
|
+
"icon": "icon",
|
|
8523
|
+
"iconTranslateX": "size",
|
|
8524
|
+
"iconTranslateY": "size",
|
|
8525
|
+
"alignSelf": "flexAlign"
|
|
8526
|
+
}
|
|
8513
8527
|
},
|
|
8514
8528
|
"required": false,
|
|
8515
8529
|
"description": ""
|
|
@@ -9459,7 +9473,29 @@
|
|
|
9459
9473
|
"tokens": {
|
|
9460
9474
|
"type": {
|
|
9461
9475
|
"name": "custom",
|
|
9462
|
-
"raw":
|
|
9476
|
+
"raw": {
|
|
9477
|
+
"minLines": "integer",
|
|
9478
|
+
"maxLines": "integer",
|
|
9479
|
+
"backgroundColor": "color",
|
|
9480
|
+
"color": "color",
|
|
9481
|
+
"borderWidth": "border",
|
|
9482
|
+
"borderColor": "color",
|
|
9483
|
+
"borderRadius": "radius",
|
|
9484
|
+
"paddingTop": "size",
|
|
9485
|
+
"paddingBottom": "size",
|
|
9486
|
+
"paddingLeft": "size",
|
|
9487
|
+
"paddingRight": "size",
|
|
9488
|
+
"outerBackgroundColor": "color",
|
|
9489
|
+
"outerBorderWidth": "border",
|
|
9490
|
+
"outerBorderColor": "color",
|
|
9491
|
+
"fontName": "fontName",
|
|
9492
|
+
"fontWeight": "fontWeight",
|
|
9493
|
+
"fontSize": "fontSize",
|
|
9494
|
+
"lineHeight": "lineHeight",
|
|
9495
|
+
"icon": "icon",
|
|
9496
|
+
"iconSize": "size",
|
|
9497
|
+
"iconColor": "color"
|
|
9498
|
+
}
|
|
9463
9499
|
},
|
|
9464
9500
|
"required": false,
|
|
9465
9501
|
"description": ""
|
|
@@ -23,13 +23,26 @@ const parseComponentDocs = (name, generated) => {
|
|
|
23
23
|
|
|
24
24
|
const out = { ...prop }
|
|
25
25
|
|
|
26
|
-
// check if this prop references the tokens schema
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
// check if this prop references the tokens schema;
|
|
27
|
+
// this regex extracts unquoted parameter strings from function
|
|
28
|
+
// calls like `getTokensPropType('ChevronLink', 'Link')` with the result
|
|
29
|
+
// being an array: `['ChevronLink', 'Link']`
|
|
30
|
+
const tokensProp = out.type?.raw?.match(/(?<=getTokensPropType\(.*)(\w+)+(?=.*\))/gs)
|
|
31
|
+
|
|
32
|
+
// if so, try and read the schema from the base components
|
|
33
|
+
if (tokensProp && tokensProp.length > 0) {
|
|
34
|
+
let raw = {}
|
|
35
|
+
|
|
36
|
+
tokensProp.forEach((componentName) => {
|
|
37
|
+
if (!schema.components[componentName]) {
|
|
38
|
+
// this would be a run-time error in the base components
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Unknown schema component reference: ${componentName} from component: ${name}`
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
raw = { ...raw, ...schema.components[componentName] }
|
|
44
|
+
})
|
|
45
|
+
out.type = { ...out.type, raw }
|
|
33
46
|
}
|
|
34
47
|
props[propName] = out
|
|
35
48
|
})
|
package/lib/Link/TextButton.js
CHANGED
|
@@ -15,8 +15,6 @@ var _LinkBase = _interopRequireDefault(require("./LinkBase"));
|
|
|
15
15
|
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
|
|
18
|
-
var _TextButton$propTypes;
|
|
19
|
-
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
19
|
|
|
22
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -33,8 +31,6 @@ const TextButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
33
31
|
children,
|
|
34
32
|
variant,
|
|
35
33
|
tokens,
|
|
36
|
-
// TODO: this may need to use `link` role on Web in the case of being passed both `href` and
|
|
37
|
-
// `onPress` in an omniplatform app that uses React Navigation's useLinkProps for internal nav.
|
|
38
34
|
accessibilityRole = 'button',
|
|
39
35
|
...linkProps
|
|
40
36
|
}, ref) => {
|
|
@@ -51,11 +47,6 @@ const TextButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
51
47
|
TextButton.displayName = 'TextButton';
|
|
52
48
|
TextButton.propTypes = { ..._LinkBase.default.propTypes,
|
|
53
49
|
onPress: _propTypes.default.func.isRequired
|
|
54
|
-
};
|
|
55
|
-
// TODO: test if this works with web navigation in omniplatform React Navigation
|
|
56
|
-
// https://github.com/telus/universal-design-system/issues/665
|
|
57
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
58
|
-
|
|
59
|
-
if ((_TextButton$propTypes = TextButton.propTypes) !== null && _TextButton$propTypes !== void 0 && _TextButton$propTypes.href) delete TextButton.propTypes.href;
|
|
50
|
+
};
|
|
60
51
|
var _default = TextButton;
|
|
61
52
|
exports.default = _default;
|
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
|
|