@telus-uds/components-base 1.18.1 → 1.19.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/CHANGELOG.md +22 -2
- package/component-docs.json +111 -16
- package/jest.config-android.js +17 -0
- package/jest.config-ios.js +18 -0
- package/jest.config-web.js +31 -0
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/BaseProvider/HydrationContext.js +1 -1
- package/lib/BaseProvider/TamaguiProvider.js +30 -0
- package/lib/Button/ButtonBase.js +8 -4
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +31 -5
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- package/lib/Carousel/CarouselThumbnail.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/MultiSelectFilter/ModalOverlay.js +136 -0
- package/lib/MultiSelectFilter/MultiSelectFilter.js +314 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +3 -5
- package/lib/Pagination/SideButton.js +6 -4
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
- package/lib/QuickLinksFeature/index.js +16 -0
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Responsive/Responsive.js +58 -0
- package/lib/Responsive/index.js +13 -0
- package/lib/Search/Search.js +30 -63
- package/lib/Select/constants.js +15 -0
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +1 -3
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +2 -4
- package/lib/Tags/Tags.js +11 -5
- package/lib/TextInput/TextInputBase.js +53 -19
- package/lib/TextInput/dictionary.js +19 -0
- package/lib/ThemeProvider/utils/styles.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib/Timeline/Timeline.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.native.js +357 -0
- package/lib/Tooltip/shared.js +39 -0
- package/lib/Validator/Validator.js +271 -0
- package/lib/Validator/index.js +13 -0
- package/lib/index.js +9 -0
- package/lib/utils/BaseView/BaseView.js +64 -0
- package/lib/utils/BaseView/BaseView.native.js +16 -0
- package/lib/utils/BaseView/index.js +13 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +2 -2
- package/lib/utils/floating-ui/index.js +43 -0
- package/lib/utils/floating-ui/index.native.js +43 -0
- package/lib/utils/input.js +12 -6
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useOverlaidPosition.js +243 -0
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +7 -7
- package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
- package/lib-module/BaseProvider/HydrationContext.js +1 -1
- package/lib-module/BaseProvider/TamaguiProvider.js +22 -0
- package/lib-module/Button/ButtonBase.js +8 -4
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +31 -5
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- package/lib-module/Carousel/CarouselThumbnail.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +1 -1
- package/lib-module/Checkbox/CheckboxGroup.js +2 -2
- package/lib-module/Divider/Divider.js +2 -2
- package/lib-module/FlexGrid/Col/Col.js +1 -1
- package/lib-module/Icon/Icon.js +1 -1
- package/lib-module/MultiSelectFilter/ModalOverlay.js +112 -0
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +286 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +2 -2
- package/lib-module/Pagination/Pagination.js +3 -5
- package/lib-module/Pagination/SideButton.js +6 -4
- package/lib-module/Pagination/usePagination.js +2 -2
- package/lib-module/Progress/ProgressBar.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +3 -3
- package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
- package/lib-module/QuickLinksFeature/index.js +4 -0
- package/lib-module/Radio/Radio.js +2 -2
- package/lib-module/Radio/RadioGroup.js +2 -2
- package/lib-module/RadioCard/RadioCard.js +1 -1
- package/lib-module/RadioCard/RadioCardGroup.js +2 -2
- package/lib-module/Responsive/Responsive.js +45 -0
- package/lib-module/Responsive/index.js +2 -0
- package/lib-module/Search/Search.js +30 -61
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/SideNav/SideNav.js +2 -2
- package/lib-module/Skeleton/Skeleton.js +1 -1
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/StackView/StackWrap.js +1 -3
- package/lib-module/StackView/getStackedContent.js +2 -2
- package/lib-module/Tabs/Tabs.js +2 -4
- package/lib-module/Tags/Tags.js +11 -5
- package/lib-module/TextInput/TextInputBase.js +52 -19
- package/lib-module/TextInput/dictionary.js +12 -0
- package/lib-module/ThemeProvider/utils/styles.js +3 -3
- package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib-module/Timeline/Timeline.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib-module/Tooltip/Backdrop.js +10 -2
- package/lib-module/Tooltip/Tooltip.native.js +326 -0
- package/lib-module/Tooltip/shared.js +27 -0
- package/lib-module/Validator/Validator.js +245 -0
- package/lib-module/Validator/index.js +2 -0
- package/lib-module/index.js +1 -0
- package/lib-module/utils/BaseView/BaseView.js +43 -0
- package/lib-module/utils/BaseView/BaseView.native.js +6 -0
- package/lib-module/utils/BaseView/index.js +2 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib-module/utils/children.js +2 -2
- package/lib-module/utils/floating-ui/index.js +1 -0
- package/lib-module/utils/floating-ui/index.native.js +1 -0
- package/lib-module/utils/input.js +12 -6
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +2 -2
- package/lib-module/utils/useOverlaidPosition.js +232 -0
- package/lib-module/utils/useSpacingScale.js +1 -3
- package/lib-module/utils/useUniqueId.js +1 -1
- package/package.json +7 -4
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Carousel/Carousel.jsx +42 -10
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +0 -10
- package/src/Pagination/SideButton.jsx +5 -5
- package/src/Responsive/Responsive.jsx +33 -0
- package/src/Responsive/index.js +3 -0
- package/src/Search/Search.jsx +17 -32
- package/src/Tags/Tags.jsx +46 -33
- package/src/TextInput/TextInputBase.jsx +46 -16
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 14 Oct 2022 19:30:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.19.0
|
|
8
|
+
|
|
9
|
+
Fri, 14 Oct 2022 19:30:03 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Responsive component implementation and tests (srikanthkhari@gmail.com)
|
|
14
|
+
- Add snapshot tests for base components (evander.owusu@telus.com)
|
|
15
|
+
- feat: add right-side buttons to the TextInputBase (ruslan.bredikhin@nearform.com)
|
|
16
|
+
- Add a `text` variant for `Button` (shahzaibkhalidmalik@outlook.com)
|
|
17
|
+
- Show/Hide Previous and Next on Pagination for larger screens (tiagohldb@gmail.com)
|
|
18
|
+
- Bump @telus-uds/system-constants to v1.1.0
|
|
19
|
+
- Bump @telus-uds/system-theme-tokens to v2.7.0
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- Fix double-icon bug in Tags (alan.slater@nearform.com)
|
|
24
|
+
- Make initial focus of a Carousel more intuitive when refocus is on (alan.slater@nearform.com)
|
|
25
|
+
- Don't jump focus to next carousel tab on focusing first item in tabs (alan.slater@nearform.com)
|
|
26
|
+
|
|
7
27
|
## 1.18.1
|
|
8
28
|
|
|
9
|
-
Wed, 05 Oct 2022 21:
|
|
29
|
+
Wed, 05 Oct 2022 21:32:07 GMT
|
|
10
30
|
|
|
11
31
|
### Patches
|
|
12
32
|
|
package/component-docs.json
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"outerBorderColor": "color",
|
|
36
36
|
"outerBorderWidth": "border",
|
|
37
37
|
"outerBorderGap": "size",
|
|
38
|
-
"outerBackgroundColor": "color"
|
|
38
|
+
"outerBackgroundColor": "color",
|
|
39
|
+
"textLine": "textLine",
|
|
40
|
+
"textLineStyle": "textLineStyle"
|
|
39
41
|
},
|
|
40
42
|
"ButtonGroup": {
|
|
41
43
|
"space": "integer",
|
|
@@ -403,7 +405,8 @@
|
|
|
403
405
|
"iconSize": "size",
|
|
404
406
|
"iconDisplace": "size",
|
|
405
407
|
"width": "size",
|
|
406
|
-
"textAlign": "flexJustifyContent"
|
|
408
|
+
"textAlign": "flexJustifyContent",
|
|
409
|
+
"displayLabel": "show"
|
|
407
410
|
},
|
|
408
411
|
"Progress": {
|
|
409
412
|
"backgroundColor": "color",
|
|
@@ -821,6 +824,9 @@
|
|
|
821
824
|
"borderWidth": "border",
|
|
822
825
|
"borderColor": "color",
|
|
823
826
|
"borderRadius": "radius",
|
|
827
|
+
"buttonSize": "size",
|
|
828
|
+
"buttonsGap": "size",
|
|
829
|
+
"buttonsPaddingRight": "size",
|
|
824
830
|
"paddingTop": "size",
|
|
825
831
|
"paddingBottom": "size",
|
|
826
832
|
"paddingLeft": "size",
|
|
@@ -1344,6 +1350,13 @@
|
|
|
1344
1350
|
],
|
|
1345
1351
|
"description": "Determines which way does the button navigate in Pagination's context",
|
|
1346
1352
|
"type": "state"
|
|
1353
|
+
},
|
|
1354
|
+
"compact": {
|
|
1355
|
+
"values": [
|
|
1356
|
+
true
|
|
1357
|
+
],
|
|
1358
|
+
"description": "Determines if the \"Next\" and \"Previous\" labels should be omitted",
|
|
1359
|
+
"type": "state"
|
|
1347
1360
|
}
|
|
1348
1361
|
},
|
|
1349
1362
|
"ProgressBar": {
|
|
@@ -5496,7 +5509,8 @@
|
|
|
5496
5509
|
"iconSize": "size",
|
|
5497
5510
|
"iconDisplace": "size",
|
|
5498
5511
|
"width": "size",
|
|
5499
|
-
"textAlign": "flexJustifyContent"
|
|
5512
|
+
"textAlign": "flexJustifyContent",
|
|
5513
|
+
"displayLabel": "show"
|
|
5500
5514
|
}
|
|
5501
5515
|
},
|
|
5502
5516
|
"required": false,
|
|
@@ -6409,6 +6423,81 @@
|
|
|
6409
6423
|
}
|
|
6410
6424
|
}
|
|
6411
6425
|
},
|
|
6426
|
+
"Responsive": {
|
|
6427
|
+
"docs": {
|
|
6428
|
+
"description": "Responsive conditionally renders children based on whether the viewport matches the provided\nmin and max viewports.\n\nIn SSR, like other viewport utilities, it treats the viewport as `xs` both in SSR itself and\nduring first hydration on the client side; then if the viewport is not `xs`, it re-renders\nafter hydration. This may cause a layout shift on devices other than the narrowest.",
|
|
6429
|
+
"props": {
|
|
6430
|
+
"min": {
|
|
6431
|
+
"defaultValue": {
|
|
6432
|
+
"value": "'xs'",
|
|
6433
|
+
"computed": false
|
|
6434
|
+
},
|
|
6435
|
+
"type": {
|
|
6436
|
+
"name": "enum",
|
|
6437
|
+
"value": [
|
|
6438
|
+
{
|
|
6439
|
+
"value": "'xs'",
|
|
6440
|
+
"computed": false
|
|
6441
|
+
},
|
|
6442
|
+
{
|
|
6443
|
+
"value": "'sm'",
|
|
6444
|
+
"computed": false
|
|
6445
|
+
},
|
|
6446
|
+
{
|
|
6447
|
+
"value": "'md'",
|
|
6448
|
+
"computed": false
|
|
6449
|
+
},
|
|
6450
|
+
{
|
|
6451
|
+
"value": "'lg'",
|
|
6452
|
+
"computed": false
|
|
6453
|
+
},
|
|
6454
|
+
{
|
|
6455
|
+
"value": "'xl'",
|
|
6456
|
+
"computed": false
|
|
6457
|
+
}
|
|
6458
|
+
]
|
|
6459
|
+
},
|
|
6460
|
+
"required": false,
|
|
6461
|
+
"description": ""
|
|
6462
|
+
},
|
|
6463
|
+
"max": {
|
|
6464
|
+
"type": {
|
|
6465
|
+
"name": "enum",
|
|
6466
|
+
"value": [
|
|
6467
|
+
{
|
|
6468
|
+
"value": "'sm'",
|
|
6469
|
+
"computed": false
|
|
6470
|
+
},
|
|
6471
|
+
{
|
|
6472
|
+
"value": "'md'",
|
|
6473
|
+
"computed": false
|
|
6474
|
+
},
|
|
6475
|
+
{
|
|
6476
|
+
"value": "'lg'",
|
|
6477
|
+
"computed": false
|
|
6478
|
+
},
|
|
6479
|
+
{
|
|
6480
|
+
"value": "'xl'",
|
|
6481
|
+
"computed": false
|
|
6482
|
+
}
|
|
6483
|
+
]
|
|
6484
|
+
},
|
|
6485
|
+
"required": false,
|
|
6486
|
+
"description": ""
|
|
6487
|
+
},
|
|
6488
|
+
"children": {
|
|
6489
|
+
"type": {
|
|
6490
|
+
"name": "node"
|
|
6491
|
+
},
|
|
6492
|
+
"required": true,
|
|
6493
|
+
"description": ""
|
|
6494
|
+
}
|
|
6495
|
+
},
|
|
6496
|
+
"attributes": {
|
|
6497
|
+
"acceptsRNA11yProps": false
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
},
|
|
6412
6501
|
"Search": {
|
|
6413
6502
|
"docs": {
|
|
6414
6503
|
"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`.",
|
|
@@ -8763,7 +8852,9 @@
|
|
|
8763
8852
|
"outerBorderColor": "color",
|
|
8764
8853
|
"outerBorderWidth": "border",
|
|
8765
8854
|
"outerBorderGap": "size",
|
|
8766
|
-
"outerBackgroundColor": "color"
|
|
8855
|
+
"outerBackgroundColor": "color",
|
|
8856
|
+
"textLine": "textLine",
|
|
8857
|
+
"textLineStyle": "textLineStyle"
|
|
8767
8858
|
}
|
|
8768
8859
|
},
|
|
8769
8860
|
"required": false,
|
|
@@ -9152,7 +9243,9 @@
|
|
|
9152
9243
|
"outerBorderColor": "color",
|
|
9153
9244
|
"outerBorderWidth": "border",
|
|
9154
9245
|
"outerBorderGap": "size",
|
|
9155
|
-
"outerBackgroundColor": "color"
|
|
9246
|
+
"outerBackgroundColor": "color",
|
|
9247
|
+
"textLine": "textLine",
|
|
9248
|
+
"textLineStyle": "textLineStyle"
|
|
9156
9249
|
}
|
|
9157
9250
|
},
|
|
9158
9251
|
"required": false,
|
|
@@ -9571,17 +9664,6 @@
|
|
|
9571
9664
|
"required": false,
|
|
9572
9665
|
"description": "HTML tag to use for the Carousel item's immediate parent. Defaults to `'ul'` so that\nassistive technology tools know to intepret the carousel as a list.\n\nNote that if the immediate Carousel children do not all render as `'li'` elements,\nthis should be changed (e.g. pass tag=\"div\") because only 'li' is a valid child of 'ul'."
|
|
9573
9666
|
},
|
|
9574
|
-
"accessibilityLabel": {
|
|
9575
|
-
"defaultValue": {
|
|
9576
|
-
"value": "title",
|
|
9577
|
-
"computed": true
|
|
9578
|
-
},
|
|
9579
|
-
"type": {
|
|
9580
|
-
"name": "string"
|
|
9581
|
-
},
|
|
9582
|
-
"required": false,
|
|
9583
|
-
"description": "Provide custom accessibilityLabel for Carousel container"
|
|
9584
|
-
},
|
|
9585
9667
|
"accessibilityLiveRegion": {
|
|
9586
9668
|
"defaultValue": {
|
|
9587
9669
|
"value": "'polite'",
|
|
@@ -9728,6 +9810,13 @@
|
|
|
9728
9810
|
},
|
|
9729
9811
|
"required": false,
|
|
9730
9812
|
"description": "Provide custom accessibilityRole for Carousel container"
|
|
9813
|
+
},
|
|
9814
|
+
"accessibilityLabel": {
|
|
9815
|
+
"type": {
|
|
9816
|
+
"name": "string"
|
|
9817
|
+
},
|
|
9818
|
+
"required": false,
|
|
9819
|
+
"description": "Provide custom accessibilityLabel for Carousel container"
|
|
9731
9820
|
}
|
|
9732
9821
|
},
|
|
9733
9822
|
"attributes": {
|
|
@@ -11757,6 +11846,9 @@
|
|
|
11757
11846
|
"borderWidth": "border",
|
|
11758
11847
|
"borderColor": "color",
|
|
11759
11848
|
"borderRadius": "radius",
|
|
11849
|
+
"buttonSize": "size",
|
|
11850
|
+
"buttonsGap": "size",
|
|
11851
|
+
"buttonsPaddingRight": "size",
|
|
11760
11852
|
"paddingTop": "size",
|
|
11761
11853
|
"paddingBottom": "size",
|
|
11762
11854
|
"paddingLeft": "size",
|
|
@@ -11855,6 +11947,9 @@
|
|
|
11855
11947
|
"borderWidth": "border",
|
|
11856
11948
|
"borderColor": "color",
|
|
11857
11949
|
"borderRadius": "radius",
|
|
11950
|
+
"buttonSize": "size",
|
|
11951
|
+
"buttonsGap": "size",
|
|
11952
|
+
"buttonsPaddingRight": "size",
|
|
11858
11953
|
"paddingTop": "size",
|
|
11859
11954
|
"paddingBottom": "size",
|
|
11860
11955
|
"paddingLeft": "size",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const defaultConfig = require('./jest.config')
|
|
2
|
+
|
|
3
|
+
const config = { ...defaultConfig }
|
|
4
|
+
|
|
5
|
+
// Run tests so React Native sees Platform as 'android'
|
|
6
|
+
config.haste.defaultPlatform = 'android'
|
|
7
|
+
// Save snapshots with `.android` in filename
|
|
8
|
+
config.snapshotResolver = './jest-snapshots/resolver-android.js'
|
|
9
|
+
|
|
10
|
+
// Ignore non-applicable test files
|
|
11
|
+
config.testPathIgnorePatterns = [
|
|
12
|
+
...(config.testPathIgnorePatterns || []),
|
|
13
|
+
'\\.web\\.test\\.',
|
|
14
|
+
'\\.ios\\.test\\.'
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
module.exports = config
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const defaultConfig = require('./jest.config')
|
|
2
|
+
|
|
3
|
+
const config = { ...defaultConfig }
|
|
4
|
+
|
|
5
|
+
// ios is the React Native Jest default, but let's make it explicit:
|
|
6
|
+
// Run tests so React Native sees Platform as 'ios'
|
|
7
|
+
config.haste.defaultPlatform = 'ios'
|
|
8
|
+
// Save snapshots with `.ios` in filename
|
|
9
|
+
config.snapshotResolver = './jest-snapshots/resolver-ios.js'
|
|
10
|
+
|
|
11
|
+
// Ignore non-applicable test files
|
|
12
|
+
config.testPathIgnorePatterns = [
|
|
13
|
+
...(config.testPathIgnorePatterns || []),
|
|
14
|
+
'\\.web\\.test\\.',
|
|
15
|
+
'\\.android\\.test\\.'
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
module.exports = config
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const defaultConfig = require('./jest.config')
|
|
2
|
+
|
|
3
|
+
const config = { ...defaultConfig }
|
|
4
|
+
|
|
5
|
+
// Run tests so React Native sees Platform as 'web'
|
|
6
|
+
config.haste.defaultPlatform = 'web'
|
|
7
|
+
config.haste.platforms = [...config.haste.platforms, 'web']
|
|
8
|
+
|
|
9
|
+
// Save snapshots with `.web` in filename
|
|
10
|
+
config.snapshotResolver = './jest-snapshots/resolver-web.js'
|
|
11
|
+
// Alias react-native to react-native-web
|
|
12
|
+
config.moduleNameMapper = {
|
|
13
|
+
'^react-native$': 'react-native-web',
|
|
14
|
+
...config.moduleNameMapper
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Don't include the original react native setup file as it doesn't work with web
|
|
18
|
+
// React-native-web no longer has a matching file so it gets lost looking for `..\Libraries\...` etc
|
|
19
|
+
config.setupFiles = config.setupFiles.filter(
|
|
20
|
+
(file) => !file.match(/[\\/]react-native[\\/]jest[\\/]/)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
// Ignore non-applicable test files
|
|
24
|
+
config.testPathIgnorePatterns = [
|
|
25
|
+
...(config.testPathIgnorePatterns || []),
|
|
26
|
+
'\\.native\\.test\\.',
|
|
27
|
+
'\\.android\\.test\\.',
|
|
28
|
+
'\\.ios\\.test\\.'
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
module.exports = config
|
|
@@ -23,14 +23,14 @@ const MIN_SVG_LENGTH = _shared.MIN_STROKE_ANGLE / 360 * SVG_CIRCUMFERENCE;
|
|
|
23
23
|
const MAX_SVG_LENGTH = (1 - _shared.MIN_EMPTY_ANGLE / 360) * SVG_CIRCUMFERENCE;
|
|
24
24
|
const animationProps = {
|
|
25
25
|
begin: '0s',
|
|
26
|
-
dur:
|
|
26
|
+
dur: `${_shared.DURATION}ms`,
|
|
27
27
|
fill: 'freeze',
|
|
28
28
|
repeatCount: 'indefinite'
|
|
29
29
|
};
|
|
30
30
|
const bezierProps = {
|
|
31
31
|
calcMode: 'spline',
|
|
32
32
|
keyTimes: '0; 0.5; 1',
|
|
33
|
-
keySplines:
|
|
33
|
+
keySplines: `${_shared.BEZIER.join(', ')} ; ${_shared.BEZIER.join(', ')}`
|
|
34
34
|
}; // We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
35
35
|
// It's possible to replicate this functionality with RNW animations, but it snags on chrome at least, see https://github.com/telus/universal-design-system/pull/477 for details.
|
|
36
36
|
|
|
@@ -46,8 +46,8 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
46
46
|
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
48
48
|
ref: ref,
|
|
49
|
-
width:
|
|
50
|
-
height:
|
|
49
|
+
width: `${size}px`,
|
|
50
|
+
height: `${size}px`,
|
|
51
51
|
viewBox: "0 0 48 48",
|
|
52
52
|
"aria-valuetext": label,
|
|
53
53
|
role: "progressbar",
|
|
@@ -56,7 +56,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
56
56
|
children: [reduceMotionEnabled ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("animateTransform", {
|
|
57
57
|
attributeName: "transform",
|
|
58
58
|
type: "rotate",
|
|
59
|
-
values:
|
|
59
|
+
values: `-180 24 24;${360 + _shared.MIN_STROKE_ANGLE - 180} 24 24`,
|
|
60
60
|
...animationProps
|
|
61
61
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
62
62
|
fill: "none",
|
|
@@ -71,12 +71,12 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
71
71
|
children: reduceMotionEnabled ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
72
72
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
73
73
|
attributeName: "stroke-dashoffset",
|
|
74
|
-
values:
|
|
74
|
+
values: `0;-10;${MIN_SVG_LENGTH - SVG_CIRCUMFERENCE}`,
|
|
75
75
|
...animationProps,
|
|
76
76
|
...bezierProps
|
|
77
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
78
78
|
attributeName: "stroke-dasharray",
|
|
79
|
-
values:
|
|
79
|
+
values: `${MIN_SVG_LENGTH}, 200;${MAX_SVG_LENGTH}, 200;${MIN_SVG_LENGTH}, 200`,
|
|
80
80
|
...animationProps,
|
|
81
81
|
...bezierProps
|
|
82
82
|
})]
|
|
@@ -95,7 +95,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
const direction = index ? -1 : +1;
|
|
98
|
-
return
|
|
98
|
+
return `${direction * (180 - (sa + ea)) * easing(progress) + rotation}deg`;
|
|
99
99
|
});
|
|
100
100
|
const layerStyle = {
|
|
101
101
|
width: size,
|
|
@@ -110,7 +110,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
layerStyle.transform = [{
|
|
111
111
|
rotate: timer.interpolate({
|
|
112
112
|
inputRange: [0, 1],
|
|
113
|
-
outputRange: [
|
|
113
|
+
outputRange: [`${0 + ea + sa}deg`, `${2 * 360 + ea + sa}deg`]
|
|
114
114
|
})
|
|
115
115
|
}];
|
|
116
116
|
viewportStyle.transform = [{
|
|
@@ -59,7 +59,7 @@ const HydrationProvider = _ref => {
|
|
|
59
59
|
}, []); // If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
|
|
60
60
|
|
|
61
61
|
const valueFromAncestor = useHydrationContext();
|
|
62
|
-
const isHydrating = valueFromAncestor
|
|
62
|
+
const isHydrating = valueFromAncestor ?? Boolean(!hasMounted && hasWebStyleTag());
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HydrationContext.Provider, {
|
|
64
64
|
value: isHydrating,
|
|
65
65
|
children: children
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _componentsMultiPlatform = require("@telus-uds/components-multi-platform");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const TamaguiWrapper = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
extended,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
console.log('extended', extended);
|
|
18
|
+
return extended ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsMultiPlatform.TamaguiProvider, {
|
|
19
|
+
config: _componentsMultiPlatform.config,
|
|
20
|
+
disableInjectCSS: true,
|
|
21
|
+
defaultTheme: "light",
|
|
22
|
+
children: children
|
|
23
|
+
}) : children;
|
|
24
|
+
};
|
|
25
|
+
TamaguiWrapper.propTypes = {
|
|
26
|
+
children: _propTypes.default.node.isRequired,
|
|
27
|
+
extended: _propTypes.default.bool
|
|
28
|
+
};
|
|
29
|
+
var _default = TamaguiWrapper;
|
|
30
|
+
exports.default = _default;
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -100,7 +100,7 @@ const selectOuterWidthStyles = _ref3 => {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
if (_Platform.default.OS === 'web') {
|
|
103
|
-
widthStyles.width =
|
|
103
|
+
widthStyles.width = `calc(${width} + ${outerBorderOffset * 2}px)`;
|
|
104
104
|
return widthStyles;
|
|
105
105
|
} // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
|
|
106
106
|
|
|
@@ -163,7 +163,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
163
163
|
lineHeight,
|
|
164
164
|
fontName,
|
|
165
165
|
fontWeight,
|
|
166
|
-
textAlign
|
|
166
|
+
textAlign,
|
|
167
|
+
textLine,
|
|
168
|
+
textLineStyle
|
|
167
169
|
} = _ref6;
|
|
168
170
|
return (0, _ThemeProvider.applyTextStyles)({
|
|
169
171
|
fontSize,
|
|
@@ -172,7 +174,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
172
174
|
fontName,
|
|
173
175
|
fontWeight,
|
|
174
176
|
themeOptions,
|
|
175
|
-
textAlign
|
|
177
|
+
textAlign,
|
|
178
|
+
textDecorationLine: textLine,
|
|
179
|
+
textDecorationStyle: textLineStyle
|
|
176
180
|
});
|
|
177
181
|
};
|
|
178
182
|
|
|
@@ -183,7 +187,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
|
183
187
|
return _Platform.default.select({
|
|
184
188
|
web: {
|
|
185
189
|
// if it would overflow the container, wraps instead
|
|
186
|
-
maxWidth:
|
|
190
|
+
maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
|
|
187
191
|
outline: 'none',
|
|
188
192
|
// removes the default browser :focus outline
|
|
189
193
|
...(0, _utils.getCursorStyle)(inactive, accessibilityRole)
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
14
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
15
|
+
|
|
16
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
|
+
|
|
18
|
+
var _propTypes2 = _interopRequireWildcard(require("./propTypes"));
|
|
19
|
+
|
|
20
|
+
var _ButtonBase = _interopRequireDefault(require("./ButtonBase"));
|
|
21
|
+
|
|
22
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
23
|
+
|
|
24
|
+
var _utils = require("../utils");
|
|
25
|
+
|
|
26
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
27
|
+
|
|
28
|
+
var _StackView = require("../StackView");
|
|
29
|
+
|
|
30
|
+
var _pressability = require("../utils/pressability");
|
|
31
|
+
|
|
32
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
+
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
const selectIconTokens = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
icon,
|
|
43
|
+
iconPosition,
|
|
44
|
+
iconSpace,
|
|
45
|
+
iconSize,
|
|
46
|
+
iconColor,
|
|
47
|
+
iconBackground,
|
|
48
|
+
iconBorderRadius,
|
|
49
|
+
iconAlignSelf,
|
|
50
|
+
iconPadding,
|
|
51
|
+
iconTranslateX,
|
|
52
|
+
iconTranslateY
|
|
53
|
+
} = _ref;
|
|
54
|
+
return {
|
|
55
|
+
icon,
|
|
56
|
+
iconPosition,
|
|
57
|
+
iconSpace,
|
|
58
|
+
iconWrapperStyle: {
|
|
59
|
+
backgroundColor: iconBackground,
|
|
60
|
+
borderRadius: iconBorderRadius,
|
|
61
|
+
alignSelf: iconAlignSelf,
|
|
62
|
+
padding: iconPadding,
|
|
63
|
+
..._Platform.default.select({
|
|
64
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
65
|
+
web: {
|
|
66
|
+
transition: 'color 200ms, background 200ms'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
iconTokens: {
|
|
71
|
+
size: iconSize,
|
|
72
|
+
color: iconColor,
|
|
73
|
+
translateX: iconTranslateX,
|
|
74
|
+
translateY: iconTranslateY
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const ButtonDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
80
|
+
let {
|
|
81
|
+
value,
|
|
82
|
+
initialValue,
|
|
83
|
+
onChange,
|
|
84
|
+
label,
|
|
85
|
+
tokens,
|
|
86
|
+
variant,
|
|
87
|
+
inactive = false,
|
|
88
|
+
readOnly = false,
|
|
89
|
+
children = null,
|
|
90
|
+
accessibilityRole = 'radio',
|
|
91
|
+
...props
|
|
92
|
+
} = _ref2;
|
|
93
|
+
const {
|
|
94
|
+
currentValue: isOpen,
|
|
95
|
+
setValue: setIsOpen
|
|
96
|
+
} = (0, _utils.useInputValue)({
|
|
97
|
+
value,
|
|
98
|
+
initialValue,
|
|
99
|
+
onChange,
|
|
100
|
+
readOnly
|
|
101
|
+
}, 'useButtonDropdownValues');
|
|
102
|
+
const extraState = {
|
|
103
|
+
open: isOpen,
|
|
104
|
+
inactive,
|
|
105
|
+
...variant
|
|
106
|
+
};
|
|
107
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ButtonDropdown', tokens, extraState);
|
|
108
|
+
|
|
109
|
+
const getButtonTokens = buttonState => (0, _utils.selectTokens)('Button', getTokens(buttonState)); // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const pressHandlers = (0, _pressability.getPressHandlersWithArgs)(props, [{
|
|
113
|
+
label,
|
|
114
|
+
open: isOpen
|
|
115
|
+
}]);
|
|
116
|
+
|
|
117
|
+
const handlePress = event => {
|
|
118
|
+
if (!inactive) {
|
|
119
|
+
if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
|
|
120
|
+
setIsOpen(!isOpen, event);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
125
|
+
ref: ref,
|
|
126
|
+
...pressHandlers,
|
|
127
|
+
onPress: handlePress,
|
|
128
|
+
tokens: getButtonTokens,
|
|
129
|
+
inactive: inactive,
|
|
130
|
+
icon: () => null,
|
|
131
|
+
accessibilityRole: accessibilityRole,
|
|
132
|
+
...props,
|
|
133
|
+
children: _ref3 => {
|
|
134
|
+
let {
|
|
135
|
+
textStyles,
|
|
136
|
+
...buttonState
|
|
137
|
+
} = _ref3;
|
|
138
|
+
// TODO: once Icon/IconButton designs are stable, see if this sort of styling around
|
|
139
|
+
// an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
|
|
140
|
+
// - Icon: https://github.com/telus/universal-design-system/issues/327
|
|
141
|
+
// - IconButton: https://github.com/telus/universal-design-system/issues/281
|
|
142
|
+
// - Token sets: https://github.com/telus/universal-design-system/issues/782
|
|
143
|
+
const itemTokens = getTokens(buttonState);
|
|
144
|
+
const {
|
|
145
|
+
iconTokens,
|
|
146
|
+
iconPosition,
|
|
147
|
+
iconSpace,
|
|
148
|
+
iconWrapperStyle,
|
|
149
|
+
icon: IconComponent
|
|
150
|
+
} = selectIconTokens(itemTokens);
|
|
151
|
+
const iconContent = IconComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
152
|
+
style: iconWrapperStyle,
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
154
|
+
icon: IconComponent,
|
|
155
|
+
tokens: iconTokens
|
|
156
|
+
})
|
|
157
|
+
}) : null;
|
|
158
|
+
|
|
159
|
+
const childrenContent = () => typeof children === 'function' ? children({ ...(0, _utils.resolvePressableState)(buttonState, extraState),
|
|
160
|
+
textStyles
|
|
161
|
+
}) : children;
|
|
162
|
+
|
|
163
|
+
const content = children ? childrenContent() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
164
|
+
style: textStyles,
|
|
165
|
+
children: label
|
|
166
|
+
});
|
|
167
|
+
return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [iconContent, content] : [content, iconContent], {
|
|
168
|
+
space: iconSpace,
|
|
169
|
+
direction: 'row'
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
ButtonDropdown.displayName = 'ButtonDropdown';
|
|
175
|
+
ButtonDropdown.propTypes = { ..._utils.a11yProps.types,
|
|
176
|
+
..._utils.focusHandlerProps.types,
|
|
177
|
+
..._propTypes2.default,
|
|
178
|
+
children: _propTypes2.textAndA11yText,
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Callback called when a controlled ButtonDropdown gets interacted with.
|
|
182
|
+
*/
|
|
183
|
+
onChange: _propTypes.default.func,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* `value` prop is being used to set the 'open' state of ButtonDropdown. Use it for
|
|
187
|
+
* controlled ButtonDropdown. For uncontrolled ButtonDropdown, use `initialValue`.
|
|
188
|
+
*/
|
|
189
|
+
value: _propTypes.default.bool,
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Use `initialValue` to provide the initial value for an uncontrolled version.
|
|
193
|
+
*/
|
|
194
|
+
initialValue: _propTypes.default.bool,
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The label of ButtonDropdown.
|
|
198
|
+
*/
|
|
199
|
+
label: _propTypes.default.string,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* By default, `ButtonDropdown` is treated by accessibility tools as a radio button.
|
|
203
|
+
*/
|
|
204
|
+
accessibilityRole: _propTypes.default.string
|
|
205
|
+
};
|
|
206
|
+
var _default = ButtonDropdown;
|
|
207
|
+
exports.default = _default;
|