@telus-uds/components-base 1.9.0 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,12 +1,25 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Fri, 08 Jul 2022 22:41:05 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 20 Jul 2022 23:56:08 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.10.0
8
+
9
+ Wed, 20 Jul 2022 23:56:08 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add Carousel component 🎉 (shahzaibkhalidmalik@outlook.com)
14
+ - Bump @telus-uds/system-theme-tokens to v2.1.0
15
+
16
+ ### Patches
17
+
18
+ - Fix an issue where StepTracker might break where `stepLabel` and/or `stepTrackerLabel` are not read before reading their `dictionary` values (shahzaibkhalidmalik@outlook.com)
19
+
7
20
  ## 1.9.0
8
21
 
9
- Fri, 08 Jul 2022 22:41:05 GMT
22
+ Fri, 08 Jul 2022 22:41:55 GMT
10
23
 
11
24
  ### Minor changes
12
25
 
@@ -81,6 +81,14 @@
81
81
  "minWidth": "size",
82
82
  "shadow": "shadow"
83
83
  },
84
+ "Carousel": {
85
+ "nextIcon": "icon",
86
+ "previousIcon": "icon",
87
+ "showPreviousNextNavigation": "show",
88
+ "showPanelNavigation": "show",
89
+ "spaceBetweenSlideAndPreviousNextNavigation": "size",
90
+ "spaceBetweenSlideAndPanelNavigation": "size"
91
+ },
84
92
  "Checkbox": {
85
93
  "containerBackgroundColor": "color",
86
94
  "feedbackMarginBottom": "size",
@@ -8288,6 +8296,326 @@
8288
8296
  }
8289
8297
  }
8290
8298
  },
8299
+ "Carousel": {
8300
+ "docs": {
8301
+ "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
+ "props": {
8303
+ "previousNextNavigationPosition": {
8304
+ "defaultValue": {
8305
+ "value": "'inside'",
8306
+ "computed": false
8307
+ },
8308
+ "type": {
8309
+ "name": "enum",
8310
+ "value": [
8311
+ {
8312
+ "value": "'inside'",
8313
+ "computed": false
8314
+ },
8315
+ {
8316
+ "value": "'outside'",
8317
+ "computed": false
8318
+ },
8319
+ {
8320
+ "value": "'edge'",
8321
+ "computed": false
8322
+ }
8323
+ ]
8324
+ },
8325
+ "required": false,
8326
+ "description": "`inside` renders the previous and next buttons inside the slide\n`outside` renders the previous and next buttons outside the slide\n`edge` renders the previous and next buttons at the edge of the slide"
8327
+ },
8328
+ "previousNextIconSize": {
8329
+ "defaultValue": {
8330
+ "value": "'default'",
8331
+ "computed": false
8332
+ },
8333
+ "type": {
8334
+ "name": "enum",
8335
+ "value": [
8336
+ {
8337
+ "value": "'default'",
8338
+ "computed": false
8339
+ },
8340
+ {
8341
+ "value": "'small'",
8342
+ "computed": false
8343
+ },
8344
+ {
8345
+ "value": "'large'",
8346
+ "computed": false
8347
+ }
8348
+ ]
8349
+ },
8350
+ "required": false,
8351
+ "description": "Defines the size of the `IconButton` which is being used to render next and previous buttons"
8352
+ },
8353
+ "minDistanceToCapture": {
8354
+ "defaultValue": {
8355
+ "value": "5",
8356
+ "computed": false
8357
+ },
8358
+ "type": {
8359
+ "name": "number"
8360
+ },
8361
+ "required": false,
8362
+ "description": "Initiate animation after swipe this distance."
8363
+ },
8364
+ "minDistanceForAction": {
8365
+ "defaultValue": {
8366
+ "value": "0.2",
8367
+ "computed": false
8368
+ },
8369
+ "type": {
8370
+ "name": "number"
8371
+ },
8372
+ "required": false,
8373
+ "description": "Minimal part of slide width must be swiped for changing index.\nOtherwise animation restore current slide. Default value 0.2 means that 20% must be swiped for change index"
8374
+ },
8375
+ "springConfig": {
8376
+ "defaultValue": {
8377
+ "value": "undefined",
8378
+ "computed": true
8379
+ },
8380
+ "type": {
8381
+ "name": "object"
8382
+ },
8383
+ "required": false,
8384
+ "description": "Carousel uses `Animated.spring` to animate slide changes, use this option to pass custom animation configuration"
8385
+ },
8386
+ "panelNavigationTextDictionary": {
8387
+ "defaultValue": {
8388
+ "value": "{\n en: {\n stepTrackerLabel: 'Showing %{stepNumber} of %{stepCount}'\n },\n fr: {\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n }\n}",
8389
+ "computed": false
8390
+ },
8391
+ "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
8403
+ },
8404
+ "fr": {
8405
+ "name": "shape",
8406
+ "value": {
8407
+ "stepTrackerLabel": {
8408
+ "name": "string",
8409
+ "required": true
8410
+ }
8411
+ },
8412
+ "required": false
8413
+ }
8414
+ }
8415
+ },
8416
+ "required": false,
8417
+ "description": "Use this to override the default text for panel navigation"
8418
+ },
8419
+ "accessibilityRole": {
8420
+ "defaultValue": {
8421
+ "value": "'adjustable'",
8422
+ "computed": false
8423
+ },
8424
+ "type": {
8425
+ "name": "string"
8426
+ },
8427
+ "required": false,
8428
+ "description": "Provide custom accessibilityRole for Carousel container"
8429
+ },
8430
+ "accessibilityLabel": {
8431
+ "defaultValue": {
8432
+ "value": "'carousel'",
8433
+ "computed": false
8434
+ },
8435
+ "type": {
8436
+ "name": "string"
8437
+ },
8438
+ "required": false,
8439
+ "description": "Provide custom accessibilityLabel for Carousel container"
8440
+ },
8441
+ "tokens": {
8442
+ "type": {
8443
+ "name": "custom",
8444
+ "raw": {
8445
+ "nextIcon": "icon",
8446
+ "previousIcon": "icon",
8447
+ "showPreviousNextNavigation": "show",
8448
+ "showPanelNavigation": "show",
8449
+ "spaceBetweenSlideAndPreviousNextNavigation": "size",
8450
+ "spaceBetweenSlideAndPanelNavigation": "size"
8451
+ }
8452
+ },
8453
+ "required": false,
8454
+ "description": ""
8455
+ },
8456
+ "variant": {
8457
+ "type": {
8458
+ "name": "objectOf",
8459
+ "value": {
8460
+ "name": "union",
8461
+ "value": [
8462
+ {
8463
+ "name": "string"
8464
+ },
8465
+ {
8466
+ "name": "number"
8467
+ },
8468
+ {
8469
+ "name": "bool"
8470
+ }
8471
+ ]
8472
+ }
8473
+ },
8474
+ "required": false,
8475
+ "description": ""
8476
+ },
8477
+ "children": {
8478
+ "type": {
8479
+ "name": "union",
8480
+ "value": [
8481
+ {
8482
+ "name": "arrayOf",
8483
+ "value": {
8484
+ "name": "node"
8485
+ }
8486
+ },
8487
+ {
8488
+ "name": "node"
8489
+ }
8490
+ ]
8491
+ },
8492
+ "required": true,
8493
+ "description": "Slides to render in Carousel. Wrap individual slides in `Carousel.Item`"
8494
+ },
8495
+ "onIndexChanged": {
8496
+ "type": {
8497
+ "name": "func"
8498
+ },
8499
+ "required": false,
8500
+ "description": "Called when active index changed\nThis function is also provided with a parameter indicating changed index (either 1, or -1)\nUse it as follows:\n```js\n const onIndexChangedCallback = React.useCallback((changedIndex) => {\n console.log(changedIndex)\n }, []) // pass local dependencies as per your component\n <Carousel\n onIndexChanged={onIndexChangedCallback}\n >\n <Carousel.Item>First Slide</Carousel.Item>\n </Carousel>\n```\nCaution: Always consider wrapping your callback for `onIndexChanged` in `useCallback` in order to avoid bugs and performance issues"
8501
+ },
8502
+ "onRenderPanelNavigation": {
8503
+ "type": {
8504
+ "name": "func"
8505
+ },
8506
+ "required": false,
8507
+ "description": "Use this to render a custom panel navigation element instead of dots navigation\nThis function is also provided with an object with the following properties\nactiveIndex: index of current slide\ntotalItems: total number of slides\nUse it as follows:\n```js\n <Carousel\n onRenderPanelNavigation={({ totalItems, activeIndex }) => <Text>Showing {activeIndex + 1}</Text>}\n >\n <Carousel.Item>First Slide</Carousel.Item>\n </Carousel>\n```"
8508
+ },
8509
+ "onAnimationStart": {
8510
+ "type": {
8511
+ "name": "func"
8512
+ },
8513
+ "required": false,
8514
+ "description": "When slide animation start\nThis function is also provided with a parameter indicating the current slide index before animation starts\nUse it as follows:\n```js\n const onAnimationStartCallback = React.useCallback((currentIndex) => {\n console.log(currentIndex)\n }, []) // pass local dependencies as per your component\n <Carousel\n onAnimationStart={onAnimationStartCallback}\n >\n <Carousel.Item>First Slide</Carousel.Item>\n </Carousel>\n```\nCaution: Always consider wrapping your callback for `onAnimationStart` in `useCallback` in order to avoid bugs and performance issues"
8515
+ },
8516
+ "onAnimationEnd": {
8517
+ "type": {
8518
+ "name": "func"
8519
+ },
8520
+ "required": false,
8521
+ "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"
8522
+ }
8523
+ },
8524
+ "attributes": {
8525
+ "acceptsRNA11yProps": false
8526
+ }
8527
+ },
8528
+ "Item": {
8529
+ "docs": {
8530
+ "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
+ "props": {
8532
+ "elementIndex": {
8533
+ "type": {
8534
+ "name": "number"
8535
+ },
8536
+ "required": false,
8537
+ "description": "Index of the current slide\nDon't pass this prop when using `Carousel.Item` as it is already being passed by `Carousel` top-level component"
8538
+ },
8539
+ "accessibilityLabelledBy": {
8540
+ "type": {
8541
+ "name": "string"
8542
+ },
8543
+ "required": false,
8544
+ "description": "Provide custom accessibilityLabelledBy for Carousel slide"
8545
+ },
8546
+ "children": {
8547
+ "type": {
8548
+ "name": "union",
8549
+ "value": [
8550
+ {
8551
+ "name": "arrayOf",
8552
+ "value": {
8553
+ "name": "node"
8554
+ }
8555
+ },
8556
+ {
8557
+ "name": "node"
8558
+ }
8559
+ ]
8560
+ },
8561
+ "required": true,
8562
+ "description": "Content of the slide"
8563
+ }
8564
+ },
8565
+ "attributes": {
8566
+ "acceptsRNA11yProps": false
8567
+ }
8568
+ }
8569
+ }
8570
+ },
8571
+ "CarouselProvider": {
8572
+ "docs": {
8573
+ "description": "",
8574
+ "props": {
8575
+ "children": {
8576
+ "type": {
8577
+ "name": "arrayOf",
8578
+ "value": {
8579
+ "name": "element"
8580
+ }
8581
+ },
8582
+ "required": true,
8583
+ "description": ""
8584
+ },
8585
+ "activeIndex": {
8586
+ "type": {
8587
+ "name": "number"
8588
+ },
8589
+ "required": true,
8590
+ "description": ""
8591
+ },
8592
+ "totalItems": {
8593
+ "type": {
8594
+ "name": "number"
8595
+ },
8596
+ "required": true,
8597
+ "description": ""
8598
+ },
8599
+ "width": {
8600
+ "type": {
8601
+ "name": "number"
8602
+ },
8603
+ "required": true,
8604
+ "description": ""
8605
+ },
8606
+ "goTo": {
8607
+ "type": {
8608
+ "name": "func"
8609
+ },
8610
+ "required": true,
8611
+ "description": ""
8612
+ }
8613
+ },
8614
+ "attributes": {
8615
+ "acceptsRNA11yProps": false
8616
+ }
8617
+ }
8618
+ },
8291
8619
  "CheckboxGroup": {
8292
8620
  "docs": {
8293
8621
  "description": "A group of Checkboxs that behave as a fieldset. Use when users select any number of choices from options.\n\n## Component API\n\nUse the `items` prop to pass an array of objects describing each Checkbox in the group:\n\n - `label`: main text passed to CheckboxGroup's `label` prop\n - `id`: identifier used to store which CheckboxGroup is selected (uses `label` if undefinded)\n - `onChange`: optional function called on selection, in addition to updating the group's selection state\n\n### Controlled version\n\nIf the selection state is controlled from outside, it needs to receive `checkedId` and `onChange` props.\n\n### Uncontrolled version\n\nIf the CheckboxGroup manages its own state, you can use `initialCheckedId` prop to provide the initial value.\nWhenever the radio card gets toggled, it calls the `onChange` callback with the new value (string).\n\n### Use in forms\n\nFor web forms, the `name` prop may be used to define the name of the group's `fieldset` and input elements.\n\n### Validation\n\nValidation state may be set by passing 'error' or 'success' to the `validation` prop.\n\n## A11y guidelines\n\nCheckboxGroup accepts all the common accessibility props, and controls the accessibility state\nof children like Checkbox and Feedback based on current state.\n\n@example\n```jsx\n<CheckboxGroup\n initialCheckedId=\"check1\"\n items={[\n { label: 'Checkbox 1', id: 'check1' },\n { label: 'Checkbox 2', id: 'check2' },\n { label: 'Checkbox 3', id: 'check3' }\n ]}\n legend=\"Checkboxes\"\n hint=\"Choose from these options\"\n/>\n```",