@telus-uds/components-base 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/component-docs.json +346 -51
  3. package/lib/Carousel/Carousel.js +81 -28
  4. package/lib/Carousel/CarouselItem/CarouselItem.js +24 -9
  5. package/lib/Carousel/dictionary.js +23 -0
  6. package/lib/InputSupports/InputSupports.js +10 -3
  7. package/lib/InputSupports/useInputSupports.js +3 -2
  8. package/lib/Modal/Modal.js +4 -0
  9. package/lib/Skeleton/Skeleton.js +1 -0
  10. package/lib/StepTracker/StepTracker.js +10 -10
  11. package/lib/TextInput/TextInput.js +3 -1
  12. package/lib/index.js +9 -0
  13. package/lib/utils/props/clickProps.js +2 -2
  14. package/lib/utils/props/handlerProps.js +77 -31
  15. package/lib/utils/useScrollBlocking.js +66 -0
  16. package/lib/utils/useScrollBlocking.native.js +11 -0
  17. package/lib-module/Carousel/Carousel.js +76 -29
  18. package/lib-module/Carousel/CarouselItem/CarouselItem.js +25 -10
  19. package/lib-module/Carousel/dictionary.js +16 -0
  20. package/lib-module/InputSupports/InputSupports.js +10 -3
  21. package/lib-module/InputSupports/useInputSupports.js +3 -2
  22. package/lib-module/Modal/Modal.js +3 -0
  23. package/lib-module/Skeleton/Skeleton.js +1 -0
  24. package/lib-module/StepTracker/StepTracker.js +9 -10
  25. package/lib-module/TextInput/TextInput.js +3 -1
  26. package/lib-module/index.js +1 -0
  27. package/lib-module/utils/props/clickProps.js +2 -2
  28. package/lib-module/utils/props/handlerProps.js +78 -31
  29. package/lib-module/utils/useScrollBlocking.js +58 -0
  30. package/lib-module/utils/useScrollBlocking.native.js +2 -0
  31. package/package.json +3 -3
  32. package/src/Carousel/Carousel.jsx +93 -30
  33. package/src/Carousel/CarouselItem/CarouselItem.jsx +26 -8
  34. package/src/Carousel/dictionary.js +16 -0
  35. package/src/InputSupports/InputSupports.jsx +18 -3
  36. package/src/InputSupports/useInputSupports.js +2 -2
  37. package/src/Modal/Modal.jsx +3 -1
  38. package/src/Skeleton/Skeleton.jsx +1 -0
  39. package/src/StepTracker/StepTracker.jsx +9 -3
  40. package/src/TextInput/TextInput.jsx +1 -1
  41. package/src/index.js +1 -0
  42. package/src/utils/props/clickProps.js +2 -2
  43. package/src/utils/props/handlerProps.js +64 -16
  44. package/src/utils/useScrollBlocking.js +57 -0
  45. package/src/utils/useScrollBlocking.native.js +2 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Wed, 20 Jul 2022 23:56:08 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 25 Jul 2022 18:17:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.11.0
8
+
9
+ Mon, 25 Jul 2022 18:17:39 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - adding reference for html dom element (tiagohldb@gmail.com)
14
+ - adding useScrollBlocking hook to avoid modal background content from scrolling (tiagohldb@gmail.com)
15
+ - feat: add InputSupports to the base exports (ruslan.bredikhin@nearform.com)
16
+ - limiting skeleton width to be max to container width (tiagohldb@gmail.com)
17
+
18
+ ### Patches
19
+
20
+ - Fill in RN TextInput handlers (alan.slater@nearform.com)
21
+ - Make Carousel multi-lingual with nameable items (alan.slater@nearform.com)
22
+ - Carousel accessibility: unordered list with hidden siblings (alan.slater@nearform.com)
23
+ - fix: react native and web version updates (srikanthkhari@gmail.com)
24
+
7
25
  ## 1.10.0
8
26
 
9
- Wed, 20 Jul 2022 23:56:08 GMT
27
+ Wed, 20 Jul 2022 23:57:28 GMT
10
28
 
11
29
  ### Minor changes
12
30
 
@@ -15,7 +33,7 @@ Wed, 20 Jul 2022 23:56:08 GMT
15
33
 
16
34
  ### Patches
17
35
 
18
- - Fix an issue where StepTracker might break where `stepLabel` and/or `stepTrackerLabel` are not read before reading their `dictionary` values (shahzaibkhalidmalik@outlook.com)
36
+ - Fix an issue where StepTracker might break where `stepLabel` and/or `stepTrackerLabel` are not read before reading their `dictionary` values (shahzaibkhalidmalik@outlook.com)
19
37
 
20
38
  ## 1.9.0
21
39
 
@@ -4334,6 +4334,125 @@
4334
4334
  }
4335
4335
  }
4336
4336
  },
4337
+ "InputSupports": {
4338
+ "docs": {
4339
+ "description": "",
4340
+ "props": {
4341
+ "copy": {
4342
+ "defaultValue": {
4343
+ "value": "'en'",
4344
+ "computed": false
4345
+ },
4346
+ "type": {
4347
+ "name": "enum",
4348
+ "value": [
4349
+ {
4350
+ "value": "'en'",
4351
+ "computed": false
4352
+ },
4353
+ {
4354
+ "value": "'fr'",
4355
+ "computed": false
4356
+ }
4357
+ ]
4358
+ },
4359
+ "required": false,
4360
+ "description": "Whether the English or French copy will be used (e.g. for accessibility labels)."
4361
+ },
4362
+ "hintPosition": {
4363
+ "defaultValue": {
4364
+ "value": "'inline'",
4365
+ "computed": false
4366
+ },
4367
+ "type": {
4368
+ "name": "enum",
4369
+ "value": [
4370
+ {
4371
+ "value": "'inline'",
4372
+ "computed": false
4373
+ },
4374
+ {
4375
+ "value": "'below'",
4376
+ "computed": false
4377
+ }
4378
+ ]
4379
+ },
4380
+ "required": false,
4381
+ "description": "Position of the hint relative to label."
4382
+ },
4383
+ "children": {
4384
+ "type": {
4385
+ "name": "union",
4386
+ "value": [
4387
+ {
4388
+ "name": "func"
4389
+ },
4390
+ {
4391
+ "name": "node"
4392
+ }
4393
+ ]
4394
+ },
4395
+ "required": false,
4396
+ "description": ""
4397
+ },
4398
+ "label": {
4399
+ "type": {
4400
+ "name": "string"
4401
+ },
4402
+ "required": false,
4403
+ "description": "The input label."
4404
+ },
4405
+ "hint": {
4406
+ "type": {
4407
+ "name": "string"
4408
+ },
4409
+ "required": false,
4410
+ "description": "A short description of the expected input."
4411
+ },
4412
+ "feedback": {
4413
+ "type": {
4414
+ "name": "string"
4415
+ },
4416
+ "required": false,
4417
+ "description": "A detailed description of validation error/success or additional instructions.\nVisual variant is determined based on the `validation` prop."
4418
+ },
4419
+ "tooltip": {
4420
+ "type": {
4421
+ "name": "string"
4422
+ },
4423
+ "required": false,
4424
+ "description": "Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label."
4425
+ },
4426
+ "validation": {
4427
+ "type": {
4428
+ "name": "enum",
4429
+ "value": [
4430
+ {
4431
+ "value": "'error'",
4432
+ "computed": false
4433
+ },
4434
+ {
4435
+ "value": "'success'",
4436
+ "computed": false
4437
+ }
4438
+ ]
4439
+ },
4440
+ "required": false,
4441
+ "description": "Use to visually mark an input as valid or invalid."
4442
+ },
4443
+ "nativeID": {
4444
+ "type": {
4445
+ "name": "string"
4446
+ },
4447
+ "required": false,
4448
+ "description": "ID for DOM element on web"
4449
+ }
4450
+ },
4451
+ "attributes": {
4452
+ "acceptsRNA11yProps": false
4453
+ }
4454
+ }
4455
+ },
4337
4456
  "List": {
4338
4457
  "docs": {
4339
4458
  "description": "An unordered List component has a child a ListItem that\nallows icon, dividers and customized typography",
@@ -6916,15 +7035,24 @@
6916
7035
  "computed": false
6917
7036
  },
6918
7037
  "type": {
6919
- "name": "enum",
7038
+ "name": "union",
6920
7039
  "value": [
6921
7040
  {
6922
- "value": "'en'",
6923
- "computed": false
7041
+ "name": "enum",
7042
+ "value": [
7043
+ {
7044
+ "value": "'en'",
7045
+ "computed": false
7046
+ },
7047
+ {
7048
+ "value": "'fr'",
7049
+ "computed": false
7050
+ }
7051
+ ]
6924
7052
  },
6925
7053
  {
6926
- "value": "'fr'",
6927
- "computed": false
7054
+ "name": "custom",
7055
+ "raw": "dictionaryContentShape"
6928
7056
  }
6929
7057
  ]
6930
7058
  },
@@ -6940,31 +7068,13 @@
6940
7068
  "name": "shape",
6941
7069
  "value": {
6942
7070
  "en": {
6943
- "name": "shape",
6944
- "value": {
6945
- "stepLabel": {
6946
- "name": "string",
6947
- "required": false
6948
- },
6949
- "stepTrackerLabel": {
6950
- "name": "string",
6951
- "required": false
6952
- }
6953
- },
7071
+ "name": "custom",
7072
+ "raw": "dictionaryContentShape",
6954
7073
  "required": false
6955
7074
  },
6956
7075
  "fr": {
6957
- "name": "shape",
6958
- "value": {
6959
- "stepLabel": {
6960
- "name": "string",
6961
- "required": false
6962
- },
6963
- "stepTrackerLabel": {
6964
- "name": "string",
6965
- "required": false
6966
- }
6967
- },
7076
+ "name": "custom",
7077
+ "raw": "dictionaryContentShape",
6968
7078
  "required": false
6969
7079
  }
6970
7080
  }
@@ -8300,6 +8410,17 @@
8300
8410
  "docs": {
8301
8411
  "description": "Carousel is a general-purpose content slider that can be used to render content in terms of slides.\n\n ## Usage\n - `Carousel` is a top-level export from `@telus-uds/components-base` which is used to render a Carousel\n - Immediately within `Carousel`, individual slides are wrapped in `Carousel.Item` for the top-level `Carousel` to know how to identify an individual slide\n - You can use any UDS component or other platform-specific component, (based on the platform you're rendering) to achieve any desired layout\n - By default, Carousel takea all the `width` available to it and the `height` is determined based on the content in the slide with more content\n - You may want to wrap Carousel in other layout components like `Box`, `FlexGrid` etc, to achieve a responsive layout of your need\n\n ## `useCarousel` custom hook\n\n ```jsx\n import { useCarousel } from '@telus-uds/components-base'\n\n const SomeComponentWithinCarouselItem = () => {\n const {\n activeIndex,\n totalItems,\n width,\n goTo\n } = useCarousel()\n return <Text>Hi!</Text>\n }\n ```\n\n You can use `useCarousel` to hook into internal state of the Carousel component like:\n - `activeIndex`: Index of the current slide\n - `totalItems`: Total number of items/slides passed to the Carousel\n - `width`: Width of the individual carousel slide\n - `goTo`: A function to go to a particular slide by passing the index of that slide, e.g: goTo(0) where `0` is the index of the first slide\n\n ## Accessibility\n\n - Top-level `Carousel` and `Carousel.Item` can take all possible React Native's `View` and `a11y` props\n - If your slide contains input elements like buttons, you may want to configure them to be only focusable when `activeIndex` is equal to the current slide index in order to avoid tabbing going between slides\n\n ## Platform considerations\n The component is available on both native platforms and web.\n\n ## Other considerations\n - You may want to use the same kind of layout in all your slides to avoid visual and height differences\n - `previous` and `next` navigation buttons are automatically removed in `sm` and `xs` viewports, as these smaller viewports offers swipe functionality\n\n ## Tokens\n\n You can override the following tokens in exceptional circumstances:\n - `previousIcon` - Icon of the previous button\n - `nextIcon` - Icon of the next button\n - `showPreviousNextNavigation` - If you want to show/hide the previous/next navigation\n - `showPanelNavigation` - If you want to show/hide the panel navigation\n - `spaceBetweenSlideAndPreviousNextNavigation` - Horizontal space between slide and previous/next navigational buttons\n - `spaceBetweenSlideAndPanelNavigation` - Vertical space between slide area and panel navigation area",
8302
8412
  "props": {
8413
+ "itemLabel": {
8414
+ "defaultValue": {
8415
+ "value": "'item'",
8416
+ "computed": false
8417
+ },
8418
+ "type": {
8419
+ "name": "string"
8420
+ },
8421
+ "required": false,
8422
+ "description": "Lowercase language-appropriate user-facing description of what each Carousel slide represents.\nThis is used when generating item labels. For example, if a carousel contains offers,\npass itemLabel=\"summer offer\" (or copy=\"fr\" and an appropriate French translation) to genereate\naccessible labels such as \"Summer offer 1 of 3\" and \"Show summer offer 2 of 3\"."
8423
+ },
8303
8424
  "previousNextNavigationPosition": {
8304
8425
  "defaultValue": {
8305
8426
  "value": "'inside'",
@@ -8383,38 +8504,94 @@
8383
8504
  "required": false,
8384
8505
  "description": "Carousel uses `Animated.spring` to animate slide changes, use this option to pass custom animation configuration"
8385
8506
  },
8386
- "panelNavigationTextDictionary": {
8507
+ "tag": {
8387
8508
  "defaultValue": {
8388
- "value": "{\n en: {\n stepTrackerLabel: 'Showing %{stepNumber} of %{stepCount}'\n },\n fr: {\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n }\n}",
8509
+ "value": "'ul'",
8389
8510
  "computed": false
8390
8511
  },
8391
8512
  "type": {
8392
- "name": "shape",
8393
- "value": {
8394
- "en": {
8395
- "name": "shape",
8396
- "value": {
8397
- "stepTrackerLabel": {
8398
- "name": "string",
8399
- "required": true
8400
- }
8401
- },
8402
- "required": false
8513
+ "name": "enum",
8514
+ "value": [
8515
+ {
8516
+ "value": "'h1'",
8517
+ "computed": false
8403
8518
  },
8404
- "fr": {
8405
- "name": "shape",
8406
- "value": {
8407
- "stepTrackerLabel": {
8408
- "name": "string",
8409
- "required": true
8410
- }
8411
- },
8412
- "required": false
8519
+ {
8520
+ "value": "'h2'",
8521
+ "computed": false
8522
+ },
8523
+ {
8524
+ "value": "'h3'",
8525
+ "computed": false
8526
+ },
8527
+ {
8528
+ "value": "'h4'",
8529
+ "computed": false
8530
+ },
8531
+ {
8532
+ "value": "'h5'",
8533
+ "computed": false
8534
+ },
8535
+ {
8536
+ "value": "'h6'",
8537
+ "computed": false
8538
+ },
8539
+ {
8540
+ "value": "'article'",
8541
+ "computed": false
8542
+ },
8543
+ {
8544
+ "value": "'aside'",
8545
+ "computed": false
8546
+ },
8547
+ {
8548
+ "value": "'blockquote'",
8549
+ "computed": false
8550
+ },
8551
+ {
8552
+ "value": "'footer'",
8553
+ "computed": false
8554
+ },
8555
+ {
8556
+ "value": "'figure'",
8557
+ "computed": false
8558
+ },
8559
+ {
8560
+ "value": "'form'",
8561
+ "computed": false
8562
+ },
8563
+ {
8564
+ "value": "'header'",
8565
+ "computed": false
8566
+ },
8567
+ {
8568
+ "value": "'ul'",
8569
+ "computed": false
8570
+ },
8571
+ {
8572
+ "value": "'li'",
8573
+ "computed": false
8574
+ },
8575
+ {
8576
+ "value": "'main'",
8577
+ "computed": false
8578
+ },
8579
+ {
8580
+ "value": "'nav'",
8581
+ "computed": false
8582
+ },
8583
+ {
8584
+ "value": "'section'",
8585
+ "computed": false
8586
+ },
8587
+ {
8588
+ "value": "'label'",
8589
+ "computed": false
8413
8590
  }
8414
- }
8591
+ ]
8415
8592
  },
8416
8593
  "required": false,
8417
- "description": "Use this to override the default text for panel navigation"
8594
+ "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'."
8418
8595
  },
8419
8596
  "accessibilityRole": {
8420
8597
  "defaultValue": {
@@ -8519,6 +8696,35 @@
8519
8696
  },
8520
8697
  "required": false,
8521
8698
  "description": "When slide animation end with parameter of current index (after animation ends)\nThis function is also provided with a parameter indicating the updated slide index after animation ends\nUse it as follows:\n```js\n const onAnimationEndCallback = React.useCallback((changedIndex) => {\n console.log(changedIndex)\n }, []) // pass local dependencies as per your component\n <Carousel\n onAnimationEnd={onAnimationEndCallback}\n >\n <Carousel.Item>First Slide</Carousel.Item>\n </Carousel>\n```\nCaution: Always consider wrapping your callback for `onAnimationEnd` in `useCallback` in order to avoid bugs and performance issues"
8699
+ },
8700
+ "panelNavigationTextDictionary": {
8701
+ "type": {
8702
+ "name": "shape",
8703
+ "value": {
8704
+ "en": {
8705
+ "name": "shape",
8706
+ "value": {
8707
+ "stepTrackerLabel": {
8708
+ "name": "string",
8709
+ "required": true
8710
+ }
8711
+ },
8712
+ "required": false
8713
+ },
8714
+ "fr": {
8715
+ "name": "shape",
8716
+ "value": {
8717
+ "stepTrackerLabel": {
8718
+ "name": "string",
8719
+ "required": true
8720
+ }
8721
+ },
8722
+ "required": false
8723
+ }
8724
+ }
8725
+ },
8726
+ "required": false,
8727
+ "description": "Use this to override the default text for panel navigation"
8522
8728
  }
8523
8729
  },
8524
8730
  "attributes": {
@@ -8529,6 +8735,95 @@
8529
8735
  "docs": {
8530
8736
  "description": "`Carousel.Item` is used to wrap the content of an individual slide and is suppsoed to be the\nonly top-level component passed to the `Carousel`",
8531
8737
  "props": {
8738
+ "tag": {
8739
+ "defaultValue": {
8740
+ "value": "'li'",
8741
+ "computed": false
8742
+ },
8743
+ "type": {
8744
+ "name": "enum",
8745
+ "value": [
8746
+ {
8747
+ "value": "'h1'",
8748
+ "computed": false
8749
+ },
8750
+ {
8751
+ "value": "'h2'",
8752
+ "computed": false
8753
+ },
8754
+ {
8755
+ "value": "'h3'",
8756
+ "computed": false
8757
+ },
8758
+ {
8759
+ "value": "'h4'",
8760
+ "computed": false
8761
+ },
8762
+ {
8763
+ "value": "'h5'",
8764
+ "computed": false
8765
+ },
8766
+ {
8767
+ "value": "'h6'",
8768
+ "computed": false
8769
+ },
8770
+ {
8771
+ "value": "'article'",
8772
+ "computed": false
8773
+ },
8774
+ {
8775
+ "value": "'aside'",
8776
+ "computed": false
8777
+ },
8778
+ {
8779
+ "value": "'blockquote'",
8780
+ "computed": false
8781
+ },
8782
+ {
8783
+ "value": "'footer'",
8784
+ "computed": false
8785
+ },
8786
+ {
8787
+ "value": "'figure'",
8788
+ "computed": false
8789
+ },
8790
+ {
8791
+ "value": "'form'",
8792
+ "computed": false
8793
+ },
8794
+ {
8795
+ "value": "'header'",
8796
+ "computed": false
8797
+ },
8798
+ {
8799
+ "value": "'ul'",
8800
+ "computed": false
8801
+ },
8802
+ {
8803
+ "value": "'li'",
8804
+ "computed": false
8805
+ },
8806
+ {
8807
+ "value": "'main'",
8808
+ "computed": false
8809
+ },
8810
+ {
8811
+ "value": "'nav'",
8812
+ "computed": false
8813
+ },
8814
+ {
8815
+ "value": "'section'",
8816
+ "computed": false
8817
+ },
8818
+ {
8819
+ "value": "'label'",
8820
+ "computed": false
8821
+ }
8822
+ ]
8823
+ },
8824
+ "required": false,
8825
+ "description": "Sets the HTML tag of the outer container. By default `'li'` so that assistive technology sees\nthe Carousel as a list of items.\n\nCarousel's innermost container defaults to `'ul'` which can be overridden. If the tag of either\n`Carousel` or `Carousel.Item` is overriden, the other should be too, to avoid producing invalid HTML."
8826
+ },
8532
8827
  "elementIndex": {
8533
8828
  "type": {
8534
8829
  "name": "number"