@kaizen/components 1.68.4 → 1.68.6

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 (74) hide show
  1. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.cjs +23 -2
  2. package/dist/cjs/__actions__/Button/v3/Button.cjs +5 -3
  3. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.mjs +24 -3
  4. package/dist/esm/__actions__/Button/v3/Button.mjs +5 -3
  5. package/dist/styles.css +124 -312
  6. package/dist/types/__actions__/Button/v3/Button.d.ts +5 -0
  7. package/locales/ar.json +8 -0
  8. package/locales/bg.json +8 -0
  9. package/locales/cs.json +8 -0
  10. package/locales/cy.json +8 -0
  11. package/locales/da.json +8 -0
  12. package/locales/de.json +8 -0
  13. package/locales/el.json +8 -0
  14. package/locales/en-GB.json +8 -0
  15. package/locales/es-419.json +8 -0
  16. package/locales/es.json +8 -0
  17. package/locales/et.json +8 -0
  18. package/locales/fi.json +8 -0
  19. package/locales/fr-CA.json +8 -0
  20. package/locales/fr.json +8 -0
  21. package/locales/he.json +8 -0
  22. package/locales/hi.json +8 -0
  23. package/locales/ht.json +8 -0
  24. package/locales/hu.json +8 -0
  25. package/locales/id.json +8 -0
  26. package/locales/it.json +8 -0
  27. package/locales/ja.json +8 -0
  28. package/locales/km-KH.json +8 -0
  29. package/locales/ko.json +8 -0
  30. package/locales/lt.json +8 -0
  31. package/locales/lv.json +8 -0
  32. package/locales/mi.json +8 -0
  33. package/locales/ms.json +8 -0
  34. package/locales/nb.json +8 -0
  35. package/locales/nl.json +8 -0
  36. package/locales/pl.json +8 -0
  37. package/locales/pt-BR.json +8 -0
  38. package/locales/pt.json +8 -0
  39. package/locales/ro.json +8 -0
  40. package/locales/ru.json +8 -0
  41. package/locales/si-LK.json +8 -0
  42. package/locales/sk.json +8 -0
  43. package/locales/sr.json +8 -0
  44. package/locales/sv.json +8 -0
  45. package/locales/th.json +8 -0
  46. package/locales/tl.json +8 -0
  47. package/locales/tr.json +8 -0
  48. package/locales/uk.json +8 -0
  49. package/locales/vi.json +8 -0
  50. package/locales/zh-TW.json +8 -0
  51. package/locales/zh.json +8 -0
  52. package/package.json +1 -1
  53. package/src/AvatarGroup/AvatarGroup.module.scss +1 -4
  54. package/src/DateInput/DateInputWithIconButton/DateInputWithIconButton.module.scss +1 -5
  55. package/src/DateRangePicker/DateRangePicker.module.scss +5 -29
  56. package/src/Filter/FilterMultiSelect/subcomponents/MenuPopup/MenuPopup.module.scss +1 -5
  57. package/src/GuidanceBlock/GuidanceBlock.module.css +5 -42
  58. package/src/Input/Input/Input.module.scss +5 -40
  59. package/src/LikertScaleLegacy/LikertScaleLegacy.module.scss +11 -63
  60. package/src/Tag/_docs/Tag.mdx +7 -6
  61. package/src/TextField/_docs/TextField.mdx +1 -1
  62. package/src/Tile/TileGrid/_docs/TileGrid.stories.tsx +41 -8
  63. package/src/Tile/subcomponents/GenericTile/GenericTile.spec.stories.tsx +58 -0
  64. package/src/Tile/subcomponents/GenericTile/GenericTile.tsx +24 -1
  65. package/src/TitleBlockZen/subcomponents/NavigationTabs.module.scss +2 -14
  66. package/src/TitleBlockZen/subcomponents/TitleBlockMenuItem.module.scss +1 -5
  67. package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.module.scss +2 -14
  68. package/src/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +1 -7
  69. package/src/__actions__/Button/v3/Button.tsx +9 -2
  70. package/src/__actions__/Button/v3/_docs/Button--api-specification.mdx +2 -2
  71. package/src/__actions__/Menu/v1/subcomponents/MenuDropdown/MenuDropdown.module.scss +1 -5
  72. package/src/__actions__/Menu/v1/subcomponents/MenuItem/MenuItem.module.scss +1 -5
  73. package/src/__future__/Icon/Icon.module.css +7 -11
  74. package/src/__future__/Tag/Tag/_docs/Tag.mdx +1 -3
@@ -87,3 +87,61 @@ export const InfoButtonLabel: Story = {
87
87
  })
88
88
  },
89
89
  }
90
+
91
+ export const DoesNotStealFocusOnInitialRender: Story = {
92
+ play: async ({ canvasElement, step }) => {
93
+ const canvas = within(canvasElement)
94
+
95
+ await step("initial render complete", async () => {
96
+ await waitFor(() => {
97
+ canvas.getByRole("button", {
98
+ name: "View more information: Title",
99
+ })
100
+ })
101
+ })
102
+
103
+ await step("Can focus to button", async () => {
104
+ await waitFor(() => {
105
+ const buttonWithInfoLabel = canvas.getByRole("button", {
106
+ name: "View more information: Title",
107
+ })
108
+ expect(buttonWithInfoLabel).not.toHaveFocus()
109
+ })
110
+ })
111
+ },
112
+ }
113
+
114
+ export const FocusOnFlip: Story = {
115
+ play: async ({ canvasElement, step }) => {
116
+ const canvas = within(canvasElement)
117
+ const buttonWithInfoLabel = await canvas.findByRole("button", {
118
+ name: "View more information: Title",
119
+ })
120
+
121
+ await step("initial render complete", async () => {
122
+ expect(buttonWithInfoLabel).toBeInTheDocument()
123
+ })
124
+
125
+ await step("Can focus to button", async () => {
126
+ await waitFor(() => {
127
+ buttonWithInfoLabel.click()
128
+ })
129
+ })
130
+
131
+ const returnButton = canvas.getByRole("button", {
132
+ name: "Hide information: Title",
133
+ })
134
+
135
+ await step("Can click on info button again", async () => {
136
+ await waitFor(() => {
137
+ returnButton.click()
138
+ })
139
+ })
140
+
141
+ await step("Info button has focus again", async () => {
142
+ await waitFor(() => {
143
+ expect(buttonWithInfoLabel).toHaveFocus()
144
+ })
145
+ })
146
+ },
147
+ }
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes, useState } from "react"
1
+ import React, { HTMLAttributes, useState, useRef, useEffect } from "react"
2
2
  import { useIntl } from "@cultureamp/i18n-react-intl"
3
3
  import classnames from "classnames"
4
4
  import { AllowedHeadingTags, Heading } from "~components/Heading"
@@ -57,7 +57,28 @@ export const GenericTile = ({
57
57
  ...restProps
58
58
  }: GenericTileProps): JSX.Element => {
59
59
  const [isFlipped, setIsFlipped] = useState<boolean>(false)
60
+ const [isDocumentReady, setIsDocumentReady] = useState<boolean>(false)
61
+
60
62
  const { formatMessage } = useIntl()
63
+ const infoButtonRef = useRef<HTMLButtonElement>(null)
64
+ const infoButtonReturnRef = useRef<HTMLButtonElement>(null)
65
+
66
+ useEffect(() => {
67
+ setIsDocumentReady(true)
68
+ }, [])
69
+
70
+ useEffect(() => {
71
+ if (!isDocumentReady) {
72
+ setIsDocumentReady(true)
73
+ return
74
+ }
75
+
76
+ if (isFlipped) {
77
+ infoButtonReturnRef.current!.focus()
78
+ } else {
79
+ infoButtonRef.current!.focus()
80
+ }
81
+ }, [isFlipped])
61
82
 
62
83
  const translatedInfoLabel = formatMessage({
63
84
  id: "kzGenericTile.infoButtonLabel",
@@ -97,6 +118,7 @@ export const GenericTile = ({
97
118
  onClick={(): void => setIsFlipped(true)}
98
119
  disabled={isFlipped}
99
120
  aria-hidden={isFlipped}
121
+ ref={infoButtonRef}
100
122
  />
101
123
  </div>
102
124
  )}
@@ -162,6 +184,7 @@ export const GenericTile = ({
162
184
  onClick={(): void => setIsFlipped(false)}
163
185
  disabled={!isFlipped}
164
186
  aria-hidden={!isFlipped}
187
+ ref={infoButtonReturnRef}
165
188
  />
166
189
  </div>
167
190
  <div className={styles.information}>
@@ -24,13 +24,7 @@
24
24
  letter-spacing: $typography-heading-4-letter-spacing;
25
25
  text-decoration: none;
26
26
  white-space: nowrap;
27
- margin-right: $spacing-md;
28
-
29
- &[dir="rtl"],
30
- [dir="rtl"] & {
31
- margin-left: $spacing-md;
32
- margin-right: 0;
33
- }
27
+ margin-inline-end: $spacing-md;
34
28
 
35
29
  &:hover {
36
30
  color: $color-white;
@@ -46,13 +40,7 @@
46
40
  }
47
41
 
48
42
  @include title-block-under-1440 {
49
- margin-right: $spacing-xs;
50
-
51
- &[dir="rtl"],
52
- [dir="rtl"] & {
53
- margin-left: $spacing-xs;
54
- margin-right: 0;
55
- }
43
+ margin-inline-end: $spacing-xs;
56
44
  }
57
45
 
58
46
  @media (max-width: 1189px) {
@@ -16,7 +16,7 @@
16
16
  box-sizing: border-box;
17
17
  background: none;
18
18
  border: 2px transparent solid;
19
- text-align: left;
19
+ text-align: start;
20
20
  padding: 6px calc(#{$spacing-sm} - 2px);
21
21
  margin: 0 $spacing-xs;
22
22
  min-height: calc(1.75 * #{$spacing-md});
@@ -59,10 +59,6 @@
59
59
  &:focus-visible {
60
60
  border-color: $color-blue-500;
61
61
  }
62
-
63
- [dir="rtl"] & {
64
- text-align: right;
65
- }
66
62
  }
67
63
 
68
64
  .menuItem--disabled {
@@ -78,13 +78,7 @@ $focus-ring-offset: 1px;
78
78
  .thumb {
79
79
  position: relative;
80
80
  right: auto;
81
- left: calc(#{$spacing-md} * 1.1);
82
-
83
- &[dir="rtl"],
84
- [dir="rtl"] & {
85
- right: calc(#{$spacing-md} * 1.1);
86
- left: auto;
87
- }
81
+ inset-inline-start: calc(#{$spacing-md} * 1.1);
88
82
  }
89
83
 
90
84
  .checkIcon {
@@ -103,13 +97,7 @@ $focus-ring-offset: 1px;
103
97
  .thumb {
104
98
  position: relative;
105
99
  right: auto;
106
- left: calc(#{$spacing-md} * -0.05);
107
-
108
- &[dir="rtl"],
109
- [dir="rtl"] & {
110
- right: calc(#{$spacing-md} * -0.05);
111
- left: auto;
112
- }
100
+ inset-inline-start: calc(#{$spacing-md} * -0.05);
113
101
  }
114
102
  }
115
103
 
@@ -79,17 +79,11 @@
79
79
  border: solid var(--spacing-1) var(--color-gray-300);
80
80
  margin: 0;
81
81
  border-radius: var(--border-solid-border-radius);
82
- left: 100%;
82
+ inset-inline-start: 100%;
83
83
 
84
84
  /* sets fron the bottom to the centre of the dot */
85
85
  top: calc(100% - calc(var(--progress-stepper-indicator-size) / 2));
86
86
  transform: translateX(-50%);
87
-
88
- [dir="rtl"] & {
89
- left: unset;
90
- right: 100%;
91
- transform: translateX(50%);
92
- }
93
87
  }
94
88
 
95
89
  .stepperDescription {
@@ -26,6 +26,11 @@ type ButtonBaseProps = Omit<RACButtonProps, "children"> & {
26
26
  iconPosition?: "start" | "end"
27
27
  /** Controls if the button inherits width from its parent. @default "false" */
28
28
  isFullWidth?: boolean
29
+ /**
30
+ * Controls the reversed style of Button
31
+ * @deprecated Use the ReversedColors Provider instead. This is here to support gradual migration to the ReversedColors Provider and will take precedence if a value is provided. {@link https://cultureamp.design/?path=/docs/actions-button-button-v3-api-specification--docs#variants}
32
+ */
33
+ isReversed?: boolean
29
34
  }
30
35
 
31
36
  export type ButtonProps = ButtonBaseProps & PendingButtonProps
@@ -45,11 +50,13 @@ export const Button = forwardRef(
45
50
  isPending,
46
51
  hasHiddenPendingLabel: propsHasHiddenPendingLabel = false,
47
52
  pendingLabel,
53
+ isReversed,
48
54
  ...restProps
49
55
  }: ButtonProps,
50
56
  ref: React.ForwardedRef<HTMLButtonElement>
51
57
  ) => {
52
- const isReversed = useReversedColors()
58
+ const shouldUseReverse = useReversedColors()
59
+ const isReversedVariant = isReversed ?? shouldUseReverse
53
60
  const pendingProps: PendingButtonProps = isPending
54
61
  ? {
55
62
  isPending,
@@ -71,7 +78,7 @@ export const Button = forwardRef(
71
78
  styles[size],
72
79
  hasHiddenLabel && styles[`${size}IconButton`],
73
80
  isDisabled && styles.isDisabled,
74
- isReversed ? styles[`${variant}Reversed`] : styles[variant],
81
+ isReversedVariant ? styles[`${variant}Reversed`] : styles[variant],
75
82
  isFullWidth && styles.fullWidth,
76
83
  className
77
84
  )}
@@ -25,7 +25,7 @@ The following example and table showcases the essential props that enable the co
25
25
 
26
26
  <Canvas of={exampleStories.Playground} />
27
27
 
28
- <Controls of={exampleStories.Playground} className="mb-64" include={["children", "hasHiddenLabel", "className", "size", "variant", "onPress", "icon", "iconPosition", "isFullWidth", "isDisabled", "isPending","pendingLabel", "hasHiddenPendingLabel" ]} />
28
+ <Controls of={exampleStories.Playground} className="mb-64" include={["children", "hasHiddenLabel", "className", "size", "variant", "isReversed", "onPress", "icon", "iconPosition", "isFullWidth", "isDisabled", "isPending","pendingLabel", "hasHiddenPendingLabel" ]} />
29
29
 
30
30
  ## Buttons and links
31
31
 
@@ -43,7 +43,7 @@ This is built on top of [React Aria's Button component](https://react-spectrum.a
43
43
 
44
44
  <Canvas of={exampleStories.ButtonVariants} />
45
45
 
46
- Reversed variants are handled via the `ReversedColors` Provider - read more on this in the [reversed colors section](#reversed-colors).
46
+ Reversed variants are handled via the `ReversedColors` Provider.
47
47
 
48
48
  <DocsStory of={exampleStories.ButtonVariantsReversed} expanded={false} />
49
49
 
@@ -16,11 +16,7 @@ $dropdown-index: 1000;
16
16
  max-height: 22rem;
17
17
  overflow: auto;
18
18
  padding: $spacing-xs 0;
19
- text-align: left;
20
-
21
- [dir="rtl"] & {
22
- text-align: right;
23
- }
19
+ text-align: start;
24
20
  }
25
21
 
26
22
  .defaultWidth {
@@ -14,7 +14,7 @@
14
14
  box-sizing: border-box;
15
15
  background: none;
16
16
  border: 2px transparent solid;
17
- text-align: left;
17
+ text-align: start;
18
18
  padding: 6px calc(#{$spacing-sm} - 2px);
19
19
  margin: 0 $spacing-xs;
20
20
  min-height: calc(1.75 * #{$spacing-md});
@@ -57,10 +57,6 @@
57
57
  &:focus-visible {
58
58
  border-color: $color-blue-500;
59
59
  }
60
-
61
- [dir="rtl"] & {
62
- text-align: right;
63
- }
64
60
  }
65
61
 
66
62
  .menuItem--disabled {
@@ -32,22 +32,18 @@
32
32
  --icon-fill: 1;
33
33
  }
34
34
 
35
- .shouldMirrorInRTL {
36
- [dir="rtl"] & {
37
- transform: scale(-1, 1);
38
- }
35
+ [dir="rtl"] .shouldMirrorInRTL {
36
+ transform: scale(-1, 1);
39
37
  }
40
38
 
41
- .iconLTR {
42
- [dir="rtl"] & {
43
- display: none;
44
- }
39
+ [dir="rtl"] .iconLTR {
40
+ display: none;
45
41
  }
46
42
 
47
43
  .iconRTL {
48
44
  display: none;
45
+ }
49
46
 
50
- [dir="rtl"] & {
51
- display: inherit;
52
- }
47
+ [dir="rtl"] .iconRTL {
48
+ display: inherit;
53
49
  }
@@ -9,7 +9,6 @@ import * as TagStories from "./Tag.stories"
9
9
  <ResourceLinks
10
10
  sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__future__/Tag"
11
11
  designGuidelines="https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3293283155/Tag"
12
-
13
12
  />
14
13
 
15
14
  <KAIOInstallation exportNames="Tag" isFuture />
@@ -45,7 +44,7 @@ Determines the color of the background, text, and icon. This can be used to conv
45
44
  An optional icon can be passed via this prop. The icon will be rendered on the left of `children`
46
45
  in LTR, and on the right of `children` in RTL. For a list of icons, see [Icons](?path=/story/components-icons--sticker-sheet-default)
47
46
 
48
- <Canvas of={TagStories.Icon} />
47
+ <Canvas of={TagStories.IconStory} />
49
48
 
50
49
  ### `classNameOverride`
51
50
 
@@ -60,4 +59,3 @@ Allows classnames to be attached to the outermost element of Tag.
60
59
  ### Migrating to future Tag
61
60
 
62
61
  See our [full guide](?path=/docs/components-tag-future-tag-migration-guide--docs) here to migrate to the future release of `Tag`.
63
-