@kaizen/components 0.0.0-canary-test-select-aria-props-update-20250616233358 → 0.0.0-canary-fix-tab-20250626012516

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.
@@ -36,7 +36,8 @@ var LikertScaleLegacy = function (_a) {
36
36
  onSelect = _a.onSelect,
37
37
  validationMessage = _a.validationMessage,
38
38
  status = _a.status,
39
- labelId = _a.labelId;
39
+ labelId = _a.labelId,
40
+ isRequired = _a.isRequired;
40
41
  var _e = React.useState(null),
41
42
  hoveredItem = _e[0],
42
43
  setHoveredItem = _e[1];
@@ -83,11 +84,12 @@ var LikertScaleLegacy = function (_a) {
83
84
  var isRated = selectedItem && selectedItem.value > 0;
84
85
  return React__default.default.createElement("div", {
85
86
  className: classnames__default.default(LikertScaleLegacy_module.container, isRated && LikertScaleLegacy_module.rated, reversed && [LikertScaleLegacy_module.reversed], hoveredItem !== null && LikertScaleLegacy_module.hovered),
86
- "aria-labelledby": labelId,
87
+ "aria-labelledby": isRequired ? "".concat(labelId) : labelId,
87
88
  role: "radiogroup",
88
89
  tabIndex: -1,
89
90
  "aria-describedby": validationMessageId,
90
- "data-testid": dataTestId
91
+ "data-testid": dataTestId,
92
+ "aria-required": isRequired
91
93
  }, React__default.default.createElement("div", {
92
94
  className: LikertScaleLegacy_module.legend,
93
95
  "data-testid": dataTestId && "".concat(dataTestId, "-legend")
@@ -27,7 +27,8 @@ var LikertScaleLegacy = function (_a) {
27
27
  onSelect = _a.onSelect,
28
28
  validationMessage = _a.validationMessage,
29
29
  status = _a.status,
30
- labelId = _a.labelId;
30
+ labelId = _a.labelId,
31
+ isRequired = _a.isRequired;
31
32
  var _e = useState(null),
32
33
  hoveredItem = _e[0],
33
34
  setHoveredItem = _e[1];
@@ -74,11 +75,12 @@ var LikertScaleLegacy = function (_a) {
74
75
  var isRated = selectedItem && selectedItem.value > 0;
75
76
  return /*#__PURE__*/React.createElement("div", {
76
77
  className: classnames(styles.container, isRated && styles.rated, reversed && [styles.reversed], hoveredItem !== null && styles.hovered),
77
- "aria-labelledby": labelId,
78
+ "aria-labelledby": isRequired ? "".concat(labelId) : labelId,
78
79
  role: "radiogroup",
79
80
  tabIndex: -1,
80
81
  "aria-describedby": validationMessageId,
81
- "data-testid": dataTestId
82
+ "data-testid": dataTestId,
83
+ "aria-required": isRequired
82
84
  }, /*#__PURE__*/React.createElement("div", {
83
85
  className: styles.legend,
84
86
  "data-testid": dataTestId && "".concat(dataTestId, "-legend")
package/dist/styles.css CHANGED
@@ -5062,7 +5062,7 @@
5062
5062
  align-items: center;
5063
5063
  justify-content: center;
5064
5064
  position: absolute;
5065
- z-index: 10000;
5065
+ z-index: 1030;
5066
5066
  background: var(--color-white);
5067
5067
  inset-block: 0 1px;
5068
5068
  width: 48px;
@@ -12,10 +12,14 @@ export type LikertScaleProps = {
12
12
  'colorSchema'?: ColorSchema | 'classical';
13
13
  'validationMessage'?: string;
14
14
  'status'?: 'default' | 'error';
15
+ /**
16
+ * Sets aria-required value on radiogroup for assistive technologies. Validation must still be handled.
17
+ */
18
+ 'isRequired'?: boolean;
15
19
  'onSelect': (value: ScaleItem | null) => void;
16
20
  };
17
21
  /**
18
22
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060201/Likert+Scale Guidance} |
19
23
  * {@link https://cultureamp.design/?path=/docs/components-likertscalelegacy--docs Storybook}
20
24
  */
21
- export declare const LikertScaleLegacy: ({ scale, selectedItem, reversed, colorSchema, "data-testid": dataTestId, onSelect, validationMessage, status, labelId, }: LikertScaleProps) => JSX.Element;
25
+ export declare const LikertScaleLegacy: ({ scale, selectedItem, reversed, colorSchema, "data-testid": dataTestId, onSelect, validationMessage, status, labelId, isRequired, }: LikertScaleProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "0.0.0-canary-test-select-aria-props-update-20250616233358",
3
+ "version": "0.0.0-canary-fix-tab-20250626012516",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -36,6 +36,7 @@ const LikertScaleLegacyWrapper = (props: Partial<LikertScaleProps>): JSX.Element
36
36
  labelId="test__likert-scale"
37
37
  selectedItem={null}
38
38
  onSelect={(): void => undefined}
39
+ isRequired
39
40
  {...props}
40
41
  />
41
42
  )
@@ -25,6 +25,10 @@ export type LikertScaleProps = {
25
25
  'colorSchema'?: ColorSchema | 'classical'
26
26
  'validationMessage'?: string
27
27
  'status'?: 'default' | 'error'
28
+ /**
29
+ * Sets aria-required value on radiogroup for assistive technologies. Validation must still be handled.
30
+ */
31
+ 'isRequired'?: boolean
28
32
  'onSelect': (value: ScaleItem | null) => void
29
33
  }
30
34
 
@@ -46,6 +50,7 @@ export const LikertScaleLegacy = ({
46
50
  validationMessage,
47
51
  status,
48
52
  labelId,
53
+ isRequired,
49
54
  }: LikertScaleProps): JSX.Element => {
50
55
  const [hoveredItem, setHoveredItem] = useState<ScaleItem | null>(null)
51
56
  const itemRefs: ItemRefs = scale.map((s) => ({
@@ -104,11 +109,12 @@ export const LikertScaleLegacy = ({
104
109
  reversed && [styles.reversed],
105
110
  hoveredItem !== null && styles.hovered,
106
111
  )}
107
- aria-labelledby={labelId}
112
+ aria-labelledby={isRequired ? `${labelId}` : labelId}
108
113
  role="radiogroup"
109
114
  tabIndex={-1}
110
115
  aria-describedby={validationMessageId}
111
116
  data-testid={dataTestId}
117
+ aria-required={isRequired}
112
118
  >
113
119
  <div className={styles.legend} data-testid={dataTestId && `${dataTestId}-legend`}>
114
120
  <Text variant="small" color={reversed ? 'white' : 'dark'}>
@@ -21,3 +21,11 @@ Likert scale radio buttons let people select one option in a Likert scale rangin
21
21
 
22
22
  <Canvas of={LikertScaleLegacyStories.Playground} />
23
23
  <Controls of={LikertScaleLegacyStories.Playground} />
24
+
25
+ ## API
26
+
27
+ ### isRequired
28
+
29
+ Sets aria-required value on radiogroup for assistive technologies. An accessible label must be provided and validation must still be handled within implementations.
30
+
31
+ <Canvas of={LikertScaleLegacyStories.IsRequired} />
@@ -1,5 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { type Meta, type StoryObj } from '@storybook/react'
3
+ import { expect, within } from '@storybook/test'
4
+ import { VisuallyHidden } from '~components/VisuallyHidden'
3
5
  import { LikertScaleLegacy } from '../index'
4
6
  import { type Scale, type ScaleItem } from '../types'
5
7
 
@@ -57,7 +59,7 @@ export const Playground: Story = {
57
59
  code: `
58
60
  const SatisfactionExample = () => {
59
61
  const [selectedItem, setSelectedItem] = useState<ScaleItem | null>(null)
60
-
62
+
61
63
  return (
62
64
  <LikertScaleLegacy
63
65
  scale={[
@@ -82,3 +84,30 @@ export const Playground: Story = {
82
84
  },
83
85
  },
84
86
  }
87
+
88
+ export const IsRequired: Story = {
89
+ render: (args) => {
90
+ const [selectedItem, setSelectedItem] = useState<ScaleItem | null>(null)
91
+ const labelId = React.useId()
92
+ return (
93
+ <div>
94
+ <VisuallyHidden id={labelId}>Likert scale label</VisuallyHidden>
95
+ <LikertScaleLegacy
96
+ {...args}
97
+ labelId={labelId}
98
+ selectedItem={selectedItem}
99
+ onSelect={setSelectedItem}
100
+ />
101
+ </div>
102
+ )
103
+ },
104
+ args: {
105
+ isRequired: true,
106
+ },
107
+ play: async ({ canvasElement }) => {
108
+ const canvas = within(canvasElement.parentElement!)
109
+ const likertScale = canvas.getByRole('radiogroup', { name: 'Likert scale label' })
110
+
111
+ expect(likertScale).toHaveAttribute('aria-required', 'true')
112
+ },
113
+ }
@@ -0,0 +1,91 @@
1
+ import { Meta } from '@storybook/blocks'
2
+
3
+ <Meta title="Components/Menu/Migration guide" />
4
+
5
+ # Menu migration guide
6
+
7
+ ## Audience
8
+
9
+ This guide is relevant for Kaizen All-In-One (KAIO) v1 consumers.
10
+
11
+ ## Purpose
12
+
13
+ This guide provides instructions for migrating menu usage from the `deprecated` (`@kaizen/components`) `Menu` component to the `next` (`@kaizen/components/next`) `Menu` component.
14
+
15
+ This migration is a prerequisite for [migrating to KAIO v2](/docs/releases-upcoming-major-releases--docs).
16
+
17
+ ## Key API changes
18
+
19
+ `next/Menu` separates its functionality into the following components:
20
+
21
+ - `MenuTrigger` wraps the `MenuPopover` component and its trigger element.
22
+ - `MenuPopover` contains a `Menu` component, and controls the popover placement and open and close interactions.
23
+ - `Menu` contains one or more `MenuItem` and `MenuSection` components.
24
+ - `MenuSection` enables menu items to be grouped into sections.
25
+ - `MenuHeader` provides a section's header content.
26
+ - `MenuItem` provides a menu item's content, and handles item selection.
27
+
28
+ Other notable changes:
29
+
30
+ - `Menu.align` prop becomes MenuPopover.placement, and values are mapped as follows:
31
+ - `left` becomes `start`
32
+ - `right` becomes `end`
33
+ - `Menu.autoHide` prop is retired
34
+ - `Menu.button` prop becomes `MenuTrigger.children`
35
+ - The trigger element must be a `next/Button`
36
+ - `Menu.dropdownWidth` prop is retired
37
+ - `Menu.portalSelector` prop is retired
38
+ - Where needed, [PortalProvider](https://react-spectrum.adobe.com/react-aria/PortalProvider.html) can be used to control portalling behaviour
39
+ - `MenuItem.destructive` prop is retired
40
+ - This change aligns with a broader move towards more judicious use of colour
41
+ - `MenuItem.disabled` prop becomes `MenuItem.isDisabled`
42
+ - `MenuItem.label` prop becomes `MenuItem.children`
43
+ - `MenuItem.onClick` prop becomes `MenuItem.onAction`
44
+ - React Aria's `Menu` does not expose native click events, e.g. `MenuItem.onAction` cannot call `e.preventDefault()`
45
+ - See React Aria [Menu documentation](https://react-spectrum.adobe.com/react-aria/Menu.html) for more details on working with `Menu` and `MenuItem` events
46
+ - `MenuList.heading` prop becomes `MenuHeader` in a `MenuSection`
47
+
48
+ ## Migration example
49
+
50
+ ### Before
51
+
52
+ ```tsx
53
+ <Menu button={<Button>Trigger</Button>}>
54
+ <MenuList>
55
+ <MenuList heading={<MenuHeading>Section One</MenuHeading>}>
56
+ <MenuItem onClick={() => alert('1')} label="Item 1" />
57
+ <MenuItem onClick={() => alert('2')} label="Item 2" />
58
+ </MenuList>
59
+ <MenuList heading={<MenuHeading>Section Two</MenuHeading>}>
60
+ <MenuItem onClick={() => alert('3')} label="Item 3" />
61
+ <MenuItem onClick={() => alert('4')} label="Item 4" />
62
+ </MenuList>
63
+ </MenuList>
64
+ </Menu>
65
+ ```
66
+
67
+ ### After
68
+
69
+ ```tsx
70
+ <MenuTrigger>
71
+ <Button>Trigger</Button>
72
+ <MenuPopover>
73
+ <Menu>
74
+ <MenuSection>
75
+ <MenuHeader>Section One</MenuHeader>
76
+ <MenuItem onAction={() => alert('1')}>Item 1</MenuItem>
77
+ <MenuItem onAction={() => alert('2')}>Item 2</MenuItem>
78
+ </MenuSection>
79
+ <MenuSection>
80
+ <MenuHeader>Section Two</MenuHeader>
81
+ <MenuItem onAction={() => alert('3')}>Item 3</MenuItem>
82
+ <MenuItem onAction={() => alert('4')}>Item 4</MenuItem>
83
+ </MenuSection>
84
+ </Menu>
85
+ </MenuPopover>
86
+ </MenuTrigger>
87
+ ```
88
+
89
+ ## More information
90
+
91
+ More information about `next/Menu` can be found at [API Specification](/docs/components-menu-menu-next-api-specification--docs) and [Usage Guidelines](/docs/components-menu-menu-next-usage-guidelines--docs).
@@ -98,7 +98,7 @@ When using the `isRequired` property you can also specify the `validationBehavio
98
98
 
99
99
  <Canvas of={SelectStories.SelectNativeValidationBehavior} />
100
100
 
101
- While both use `aria-required` to announce whether the field has to have value to assistive technologies, the `native` will option will prevent form submissions if the `selectedKey` is `undefined`.
101
+ While both use `aria-required` to announce whether the field has to have a value to assistive technologies, the `native` will option will prevent form submissions if the `selectedKey` is `undefined`.
102
102
 
103
103
  ### Full width
104
104
 
@@ -26,7 +26,7 @@
26
26
  align-items: center;
27
27
  justify-content: center;
28
28
  position: absolute;
29
- z-index: 10000;
29
+ z-index: 1030;
30
30
  background: var(--color-white);
31
31
  inset-block: 0 1px;
32
32
  width: 48px;