@kaizen/components 1.73.13 → 1.74.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.
Files changed (60) hide show
  1. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.cjs +18 -3
  2. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/ClearButton/ClearButton.cjs +11 -1
  3. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/SelectAllButton/SelectAllButton.cjs +7 -1
  4. package/dist/esm/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.mjs +18 -3
  5. package/dist/esm/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/ClearButton/ClearButton.mjs +11 -1
  6. package/dist/esm/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/SelectAllButton/SelectAllButton.mjs +7 -1
  7. package/dist/types/Badge/Badge.d.ts +3 -4
  8. package/locales/ar.json +12 -0
  9. package/locales/bg.json +12 -0
  10. package/locales/cs.json +12 -0
  11. package/locales/cy.json +12 -0
  12. package/locales/da.json +12 -0
  13. package/locales/de.json +12 -0
  14. package/locales/el.json +12 -0
  15. package/locales/en-GB.json +13 -1
  16. package/locales/en.json +12 -0
  17. package/locales/es-419.json +12 -0
  18. package/locales/es.json +12 -0
  19. package/locales/et.json +12 -0
  20. package/locales/fi.json +12 -0
  21. package/locales/fr-CA.json +12 -0
  22. package/locales/fr.json +12 -0
  23. package/locales/he.json +12 -0
  24. package/locales/hi.json +12 -0
  25. package/locales/ht.json +12 -0
  26. package/locales/hu.json +12 -0
  27. package/locales/id.json +12 -0
  28. package/locales/it.json +12 -0
  29. package/locales/ja.json +12 -0
  30. package/locales/km-KH.json +12 -0
  31. package/locales/ko.json +12 -0
  32. package/locales/lt.json +12 -0
  33. package/locales/lv.json +12 -0
  34. package/locales/mi.json +12 -0
  35. package/locales/ms.json +12 -0
  36. package/locales/nb.json +12 -0
  37. package/locales/nl.json +12 -0
  38. package/locales/pl.json +12 -0
  39. package/locales/pt-BR.json +12 -0
  40. package/locales/pt.json +12 -0
  41. package/locales/ro.json +12 -0
  42. package/locales/ru.json +12 -0
  43. package/locales/si-LK.json +12 -0
  44. package/locales/sk.json +12 -0
  45. package/locales/sr.json +12 -0
  46. package/locales/sv.json +12 -0
  47. package/locales/th.json +12 -0
  48. package/locales/tl.json +12 -0
  49. package/locales/tr.json +12 -0
  50. package/locales/uk.json +12 -0
  51. package/locales/vi.json +12 -0
  52. package/locales/zh-TW.json +12 -0
  53. package/locales/zh.json +12 -0
  54. package/package.json +1 -1
  55. package/src/Badge/Badge.tsx +9 -4
  56. package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.spec.tsx +3 -3
  57. package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.tsx +16 -2
  58. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/ClearButton/ClearButton.tsx +11 -1
  59. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/SelectAllButton/SelectAllButton.tsx +8 -1
  60. package/src/__next__/Tooltip/_docs/Tooltip.spec.stories.tsx +4 -1
package/locales/tl.json CHANGED
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "Petsa hanggang"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "I-clear ang<VisuallyHidden> mga pinili</VisuallyHidden>"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> ang available</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "I-filter ang mga opsyon ayon sa query sa paghahanap"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "Hanapin..."
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "Piliin lahat"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "I-clear ang paghahanap"
package/locales/tr.json CHANGED
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "Şu tarihe kadar"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "<VisuallyHidden>Seçimleri</VisuallyHidden> temizle"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> kullanılabilir</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "Seçenekleri arama sorgusuna göre filtrele"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "Ara..."
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "Tümünü seç"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "Aramayı temizle"
package/locales/uk.json CHANGED
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "Дата по"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "Очистити<VisuallyHidden> виділення</VisuallyHidden>"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> доступно</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "Параметри фільтрування за пошуковим запитом"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "Пошук…"
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "Вибрати все"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "Очистити пошук"
package/locales/vi.json CHANGED
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "Ngày đến"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "Xóa<VisuallyHidden> lựa chọn</VisuallyHidden>"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> có sẵn</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "Tùy chọn lọc theo truy vấn tìm kiếm"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "Tìm kiếm…"
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "Chọn tất cả"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "Tìm kiếm rõ ràng"
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "結束日期:"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "清除<VisuallyHidden>選取項目</VisuallyHidden>"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> available</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "依搜尋查詢篩選選項"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "搜尋..."
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "全選"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "清除搜尋"
package/locales/zh.json CHANGED
@@ -61,6 +61,14 @@
61
61
  "description" : "Label for the 'date to' field",
62
62
  "message" : "结束日期"
63
63
  },
64
+ "filterMultiSelectClearButton.label" : {
65
+ "description" : "Clear button label for filter multi-select",
66
+ "message" : "清除<VisuallyHidden>选择</VisuallyHidden>"
67
+ },
68
+ "filterMultiSelectMultiSelectOption.available" : {
69
+ "description" : "Number of filter items available",
70
+ "message" : "<Badge>{count}</Badge><VisuallyHidden> 个可用</VisuallyHidden>"
71
+ },
64
72
  "filterMultiSelectSearchInput.label" : {
65
73
  "description" : "Label for the search input",
66
74
  "message" : "按搜索查询筛选选项"
@@ -69,6 +77,10 @@
69
77
  "description" : "Placeholder for the search input",
70
78
  "message" : "搜索…"
71
79
  },
80
+ "filterMultiSelectSelectAllButton.label" : {
81
+ "description" : "Select all button in filter multi select",
82
+ "message" : "全选"
83
+ },
72
84
  "inputSearch.clear" : {
73
85
  "description" : "Label for the clear search button",
74
86
  "message" : "清除搜索"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.73.13",
3
+ "version": "1.74.1",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -1,10 +1,14 @@
1
- import React, { useLayoutEffect, useState, type HTMLAttributes } from 'react'
1
+ import React, {
2
+ useLayoutEffect,
3
+ useState,
4
+ type HTMLAttributes,
5
+ type PropsWithChildren,
6
+ } from 'react'
2
7
  import classnames from 'classnames'
3
8
  import { type OverrideClassName } from '~components/types/OverrideClassName'
4
9
  import styles from './Badge.module.css'
5
10
 
6
- type BadgeCommonProps = {
7
- children?: string
11
+ type BadgeCommonProps = PropsWithChildren<{
8
12
  /**
9
13
  * The "dark" variant is no longer in the UI kit
10
14
  */
@@ -17,7 +21,8 @@ type BadgeCommonProps = {
17
21
  * Supports "small" and "large" sizes - defaults to "small"
18
22
  */
19
23
  size?: 'small' | 'large'
20
- } & OverrideClassName<HTMLAttributes<HTMLSpanElement>>
24
+ }> &
25
+ OverrideClassName<HTMLAttributes<HTMLSpanElement>>
21
26
 
22
27
  type DotProps = Omit<BadgeCommonProps, 'variant'> & {
23
28
  children?: never
@@ -82,20 +82,20 @@ describe('<MultiSelectOptionWrapper /> - Visual content', () => {
82
82
  <MultiSelectOptionWrapper
83
83
  item={{
84
84
  ...itemMock,
85
- value: { ...itemMock.value, count: 'count-mock' },
85
+ value: { ...itemMock.value, count: '14' },
86
86
  }}
87
87
  />,
88
88
  )
89
89
  })
90
90
 
91
91
  it('shows the count in the badge', () => {
92
- const badge = screen.getByText('count-mock')
92
+ const badge = screen.getByText('14')
93
93
  expect(badge).toBeInTheDocument()
94
94
  })
95
95
 
96
96
  it('has aria-description to describe the count are available for this option', () => {
97
97
  const option = screen.getByLabelText('label-mock')
98
- expect(option).toHaveAccessibleDescription('count-mock available')
98
+ expect(option).toHaveAccessibleDescription('14 available')
99
99
  })
100
100
  })
101
101
  })
@@ -1,4 +1,5 @@
1
1
  import React, { useId } from 'react'
2
+ import { FormattedMessage, useIntl } from '@cultureamp/i18n-react-intl'
2
3
  import { useFocusRing } from '@react-aria/focus'
3
4
  import { useOption } from '@react-aria/listbox'
4
5
  import { mergeProps } from '@react-aria/utils'
@@ -28,6 +29,7 @@ export const MultiSelectOption = ({
28
29
  // focus ring for accessibility
29
30
  const { isFocusVisible, focusProps } = useFocusRing()
30
31
  const countElementId = useId()
32
+ const { formatNumber } = useIntl()
31
33
 
32
34
  return (
33
35
  <li
@@ -50,8 +52,20 @@ export const MultiSelectOption = ({
50
52
  {item.rendered}
51
53
  {item.value?.count && (
52
54
  <span id={countElementId} className={styles.badgeContainer}>
53
- <Badge classNameOverride={styles.badge}>{item.value.count}</Badge>
54
- <VisuallyHidden> available</VisuallyHidden>
55
+ <FormattedMessage
56
+ defaultMessage="<Badge>{count}</Badge><VisuallyHidden> available</VisuallyHidden>"
57
+ id="filterMultiSelectMultiSelectOption.available"
58
+ description="Number of filter items available"
59
+ values={{
60
+ count: formatNumber(parseInt(item.value.count)),
61
+ Badge: (children: React.ReactNode) => (
62
+ <Badge classNameOverride={styles.badge}>{children}</Badge>
63
+ ),
64
+ VisuallyHidden: (children: React.ReactNode) => (
65
+ <VisuallyHidden>{children}</VisuallyHidden>
66
+ ),
67
+ }}
68
+ />
55
69
  </span>
56
70
  )}
57
71
  </li>
@@ -1,4 +1,5 @@
1
1
  import React from 'react'
2
+ import { FormattedMessage } from '@cultureamp/i18n-react-intl'
2
3
  import classnames from 'classnames'
3
4
  import { VisuallyHidden } from '~components/VisuallyHidden'
4
5
  import { useSelectionContext } from '../../../context'
@@ -28,7 +29,16 @@ export const ClearButton = (): JSX.Element => {
28
29
  // TODO: add announcement here to inform selection cleared
29
30
  }
30
31
  >
31
- Clear<VisuallyHidden> selections</VisuallyHidden>
32
+ <FormattedMessage
33
+ defaultMessage="Clear<VisuallyHidden> selections</VisuallyHidden>"
34
+ id="filterMultiSelectClearButton.label"
35
+ description="Clear button label for filter multi-select"
36
+ values={{
37
+ VisuallyHidden: (children: React.ReactNode) => (
38
+ <VisuallyHidden>{children}</VisuallyHidden>
39
+ ),
40
+ }}
41
+ />
32
42
  </button>
33
43
  )
34
44
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react'
2
+ import { useIntl } from '@cultureamp/i18n-react-intl'
2
3
  import classnames from 'classnames'
3
4
  import { useSelectionContext } from '../../../context'
4
5
  import styles from '../SelectionControlButton.module.scss'
@@ -11,6 +12,8 @@ export const SelectAllButton = (): JSX.Element => {
11
12
  (key) => !disabledOptions.includes(key),
12
13
  )
13
14
 
15
+ const { formatMessage } = useIntl()
16
+
14
17
  return (
15
18
  <button
16
19
  type="button"
@@ -26,7 +29,11 @@ export const SelectAllButton = (): JSX.Element => {
26
29
  // TODO: add announcement here to inform all selected
27
30
  }
28
31
  >
29
- Select all
32
+ {formatMessage({
33
+ defaultMessage: 'Select all',
34
+ id: 'filterMultiSelectSelectAllButton.label',
35
+ description: 'Select all button in filter multi select',
36
+ })}
30
37
  </button>
31
38
  )
32
39
  }
@@ -62,8 +62,11 @@ export const OnButton: Story = {
62
62
 
63
63
  await step('Escape closes', async () => {
64
64
  await userEvent.tab() // focus
65
+ await waitFor(() => expect(canvas.getByRole('tooltip')).toBeVisible())
65
66
  await userEvent.keyboard('{Escape}')
66
- await waitFor(() => expect(canvas.queryByRole('tooltip')).toBeNull())
67
+ await waitFor(() => expect(canvas.queryByRole('tooltip')).toBeNull(), {
68
+ timeout: 5000,
69
+ })
67
70
  await userEvent.tab() // unfocus
68
71
  })
69
72
  },