@telus-uds/components-base 3.3.0 → 3.5.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 (54) hide show
  1. package/CHANGELOG.md +28 -2
  2. package/lib/cjs/ActivityIndicator/Dots.js +165 -0
  3. package/lib/cjs/ActivityIndicator/Dots.native.js +221 -0
  4. package/lib/cjs/ActivityIndicator/Spinner.js +57 -50
  5. package/lib/cjs/ActivityIndicator/Spinner.native.js +90 -108
  6. package/lib/cjs/ActivityIndicator/index.js +12 -1
  7. package/lib/cjs/ActivityIndicator/shared.js +53 -6
  8. package/lib/cjs/Button/ButtonBase.js +1 -1
  9. package/lib/cjs/Button/ButtonLink.js +1 -0
  10. package/lib/cjs/Carousel/Carousel.js +18 -7
  11. package/lib/cjs/ExpandCollapse/ExpandCollapse.js +3 -1
  12. package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +10 -1
  13. package/lib/cjs/FileUpload/FileUpload.js +31 -2
  14. package/lib/cjs/Link/Link.js +8 -1
  15. package/lib/cjs/Link/LinkBase.js +2 -0
  16. package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +3 -2
  17. package/lib/cjs/utils/containUniqueFields.js +5 -5
  18. package/lib/cjs/utils/useUniqueId.js +2 -6
  19. package/lib/esm/ActivityIndicator/Dots.js +158 -0
  20. package/lib/esm/ActivityIndicator/Dots.native.js +212 -0
  21. package/lib/esm/ActivityIndicator/Spinner.js +58 -51
  22. package/lib/esm/ActivityIndicator/Spinner.native.js +90 -110
  23. package/lib/esm/ActivityIndicator/index.js +12 -1
  24. package/lib/esm/ActivityIndicator/shared.js +52 -5
  25. package/lib/esm/Button/ButtonBase.js +2 -2
  26. package/lib/esm/Button/ButtonLink.js +2 -1
  27. package/lib/esm/Carousel/Carousel.js +18 -7
  28. package/lib/esm/ExpandCollapse/ExpandCollapse.js +4 -2
  29. package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +11 -2
  30. package/lib/esm/FileUpload/FileUpload.js +31 -2
  31. package/lib/esm/Link/Link.js +8 -1
  32. package/lib/esm/Link/LinkBase.js +2 -0
  33. package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +3 -2
  34. package/lib/esm/utils/containUniqueFields.js +5 -5
  35. package/lib/esm/utils/useUniqueId.js +3 -7
  36. package/lib/package.json +4 -3
  37. package/package.json +4 -3
  38. package/src/ActivityIndicator/Dots.jsx +200 -0
  39. package/src/ActivityIndicator/Dots.native.jsx +213 -0
  40. package/src/ActivityIndicator/Spinner.jsx +95 -59
  41. package/src/ActivityIndicator/Spinner.native.jsx +125 -132
  42. package/src/ActivityIndicator/index.jsx +17 -2
  43. package/src/ActivityIndicator/shared.js +52 -5
  44. package/src/Button/ButtonBase.jsx +4 -2
  45. package/src/Button/ButtonLink.jsx +3 -1
  46. package/src/Carousel/Carousel.jsx +28 -7
  47. package/src/ExpandCollapse/ExpandCollapse.jsx +9 -4
  48. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +15 -3
  49. package/src/FileUpload/FileUpload.jsx +32 -2
  50. package/src/Link/Link.jsx +8 -1
  51. package/src/Link/LinkBase.jsx +2 -0
  52. package/src/MultiSelectFilter/MultiSelectFilter.jsx +2 -2
  53. package/src/utils/containUniqueFields.js +5 -5
  54. package/src/utils/useUniqueId.js +3 -8
@@ -104,6 +104,7 @@ const MultiSelectFilter = React.forwardRef(
104
104
  const [isOpen, setIsOpen] = React.useState(false)
105
105
  const [checkedIds, setCheckedIds] = React.useState(currentValues ?? [])
106
106
  const [maxWidth, setMaxWidth] = React.useState(false)
107
+ const isSelected = currentValues.length > 0
107
108
 
108
109
  const {
109
110
  headerFontColor,
@@ -137,7 +138,7 @@ const MultiSelectFilter = React.forwardRef(
137
138
  } = useThemeTokens(
138
139
  'MultiSelectFilter',
139
140
  tokens,
140
- { ...variant, maxHeight, maxWidth },
141
+ { ...variant, maxHeight, maxWidth, selected: isSelected },
141
142
  { viewport }
142
143
  )
143
144
  const dropdownTokens = {
@@ -166,7 +167,6 @@ const MultiSelectFilter = React.forwardRef(
166
167
  const colSizeNotMobile = items.length > rowLimit ? 2 : 1
167
168
  const colSize = viewport !== 'xs' ? colSizeNotMobile : 1
168
169
  const itemsLengthNotMobile = items.length > 24 ? items.length / 2 : rowLimit
169
- const isSelected = currentValues.length > 0
170
170
  const rowLength = viewport !== 'xs' ? itemsLengthNotMobile : items.length
171
171
 
172
172
  React.useEffect(() => {
@@ -4,12 +4,12 @@
4
4
  // Note that if a value of a field in an item is not set, it will be
5
5
  // excluded from comparison.
6
6
  const containUniqueFields = (items, fields) => {
7
- const map = []
7
+ const map = new Map()
8
8
 
9
9
  const itemsHaveDuplicateFields = items.some((item) =>
10
10
  fields.some((field) => {
11
- if (!map[field]) {
12
- map[field] = []
11
+ if (!map.has(field)) {
12
+ map.set(field, new Map())
13
13
  }
14
14
 
15
15
  if (!item[field]) {
@@ -18,9 +18,9 @@ const containUniqueFields = (items, fields) => {
18
18
  }
19
19
 
20
20
  // Duplicate found!
21
- if (map[field][item[field]]) return true
21
+ if (map.get(field).has(item[field])) return true
22
22
 
23
- map[field][item[field]] = true
23
+ map.get(field).set(item[field], true)
24
24
 
25
25
  return false
26
26
  })
@@ -1,14 +1,9 @@
1
- import { useState } from 'react'
2
-
3
- let id = 0
1
+ import { useId } from 'react'
4
2
 
5
3
  function useUniqueId(prefix = '') {
6
- const [uniqueId] = useState(() => {
7
- id += 1
8
- return `${prefix}-${id}`
9
- })
4
+ const id = useId()
10
5
 
11
- return uniqueId
6
+ return `${prefix ? `${prefix}-` : ''}${id}`
12
7
  }
13
8
 
14
9
  export default useUniqueId