@vector-im/compound-web 8.3.4 → 8.3.5

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.
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const destructive = "_destructive_1pz9o_95";
3
+ const destructive = "_destructive_1215g_95";
4
4
  const styles = {
5
- "icon-button": "_icon-button_1pz9o_8",
6
- "no-background": "_no-background_1pz9o_42",
5
+ "icon-button": "_icon-button_1215g_8",
6
+ "no-background": "_no-background_1215g_42",
7
7
  destructive
8
8
  };
9
9
  exports.default = styles;
@@ -1,7 +1,7 @@
1
- const destructive = "_destructive_1pz9o_95";
1
+ const destructive = "_destructive_1215g_95";
2
2
  const styles = {
3
- "icon-button": "_icon-button_1pz9o_8",
4
- "no-background": "_no-background_1pz9o_42",
3
+ "icon-button": "_icon-button_1215g_8",
4
+ "no-background": "_no-background_1215g_42",
5
5
  destructive
6
6
  };
7
7
  export {
@@ -12,11 +12,12 @@ const CheckboxMenuItem = React.forwardRef(
12
12
  return /* @__PURE__ */ jsxRuntime.jsx(
13
13
  MenuItem.MenuItem,
14
14
  {
15
- as: "div",
15
+ as: "button",
16
16
  role: "menuitemcheckbox",
17
17
  "aria-checked": checked,
18
18
  className,
19
19
  label,
20
+ hideChevron: true,
20
21
  onSelect,
21
22
  disabled,
22
23
  Icon: /* @__PURE__ */ jsxRuntime.jsx(
@@ -25,6 +26,7 @@ const CheckboxMenuItem = React.forwardRef(
25
26
  id: toggleId,
26
27
  ref,
27
28
  "aria-hidden": true,
29
+ tabIndex: -1,
28
30
  checked,
29
31
  disabled,
30
32
  onChange
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxMenuItem.cjs","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { CheckboxInput } from \"../Form\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"label\" | \"onSelect\" | \"disabled\"\n> & {\n /**\n * Whether the checkbox is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a checkbox control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(\n function CheckboxMenuItem(\n { className, label, onSelect, checked, disabled },\n ref,\n ) {\n const toggleId = useId();\n // The checkbox is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"div\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n label={label}\n onSelect={onSelect}\n disabled={disabled}\n Icon={\n <CheckboxInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n }\n />\n );\n },\n);\n"],"names":["forwardRef","CheckboxMenuItem","useId","useCallback","jsx","MenuItem","CheckboxInput"],"mappings":";;;;;;AA8BO,MAAM,mBAAmBA,MAAAA;AAAAA,EAC9B,SAASC,kBACP,EAAE,WAAW,OAAO,UAAU,SAAS,SAAA,GACvC,KACA;AACA,UAAM,WAAWC,MAAAA,MAAA;AAGjB,UAAM,WAAWC,MAAAA,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACEC,2BAAAA;AAAAA,MAACC,SAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MACED,2BAAAA;AAAAA,UAACE,SAAAA;AAAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAIR;AACF;;"}
1
+ {"version":3,"file":"CheckboxMenuItem.cjs","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { CheckboxInput } from \"../Form\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"label\" | \"onSelect\" | \"disabled\"\n> & {\n /**\n * Whether the checkbox is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a checkbox control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(\n function CheckboxMenuItem(\n { className, label, onSelect, checked, disabled },\n ref,\n ) {\n const toggleId = useId();\n // The checkbox is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a <button> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"button\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n label={label}\n hideChevron\n onSelect={onSelect}\n disabled={disabled}\n Icon={\n <CheckboxInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n tabIndex={-1}\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n }\n />\n );\n },\n);\n"],"names":["forwardRef","CheckboxMenuItem","useId","useCallback","jsx","MenuItem","CheckboxInput"],"mappings":";;;;;;AA8BO,MAAM,mBAAmBA,MAAAA;AAAAA,EAC9B,SAASC,kBACP,EAAE,WAAW,OAAO,UAAU,SAAS,SAAA,GACvC,KACA;AACA,UAAM,WAAWC,MAAAA,MAAA;AAGjB,UAAM,WAAWC,MAAAA,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACEC,2BAAAA;AAAAA,MAACC,SAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,MACED,2BAAAA;AAAAA,UAACE,SAAAA;AAAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAIR;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxMenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAKN,MAAM,OAAO,CAAC;AAcf;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;IAV3B;;OAEG;aACM,OAAO;0CA2CjB,CAAC"}
1
+ {"version":3,"file":"CheckboxMenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAKN,MAAM,OAAO,CAAC;AAcf;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;IAV3B;;OAEG;aACM,OAAO;0CA6CjB,CAAC"}
@@ -10,11 +10,12 @@ const CheckboxMenuItem = forwardRef(
10
10
  return /* @__PURE__ */ jsx(
11
11
  MenuItem,
12
12
  {
13
- as: "div",
13
+ as: "button",
14
14
  role: "menuitemcheckbox",
15
15
  "aria-checked": checked,
16
16
  className,
17
17
  label,
18
+ hideChevron: true,
18
19
  onSelect,
19
20
  disabled,
20
21
  Icon: /* @__PURE__ */ jsx(
@@ -23,6 +24,7 @@ const CheckboxMenuItem = forwardRef(
23
24
  id: toggleId,
24
25
  ref,
25
26
  "aria-hidden": true,
27
+ tabIndex: -1,
26
28
  checked,
27
29
  disabled,
28
30
  onChange
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxMenuItem.js","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { CheckboxInput } from \"../Form\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"label\" | \"onSelect\" | \"disabled\"\n> & {\n /**\n * Whether the checkbox is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a checkbox control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(\n function CheckboxMenuItem(\n { className, label, onSelect, checked, disabled },\n ref,\n ) {\n const toggleId = useId();\n // The checkbox is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"div\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n label={label}\n onSelect={onSelect}\n disabled={disabled}\n Icon={\n <CheckboxInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n }\n />\n );\n },\n);\n"],"names":["CheckboxMenuItem"],"mappings":";;;;AA8BO,MAAM,mBAAmB;AAAA,EAC9B,SAASA,kBACP,EAAE,WAAW,OAAO,UAAU,SAAS,SAAA,GACvC,KACA;AACA,UAAM,WAAW,MAAA;AAGjB,UAAM,WAAW,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MACE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAIR;AACF;"}
1
+ {"version":3,"file":"CheckboxMenuItem.js","sources":["../../../src/components/Menu/CheckboxMenuItem.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { CheckboxInput } from \"../Form\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"label\" | \"onSelect\" | \"disabled\"\n> & {\n /**\n * Whether the checkbox is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a checkbox control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(\n function CheckboxMenuItem(\n { className, label, onSelect, checked, disabled },\n ref,\n ) {\n const toggleId = useId();\n // The checkbox is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a <button> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"button\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n label={label}\n hideChevron\n onSelect={onSelect}\n disabled={disabled}\n Icon={\n <CheckboxInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n tabIndex={-1}\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n }\n />\n );\n },\n);\n"],"names":["CheckboxMenuItem"],"mappings":";;;;AA8BO,MAAM,mBAAmB;AAAA,EAC9B,SAASA,kBACP,EAAE,WAAW,OAAO,UAAU,SAAS,SAAA,GACvC,KACA;AACA,UAAM,WAAW,MAAA;AAGjB,UAAM,WAAW,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,MACE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAIR;AACF;"}
@@ -12,12 +12,13 @@ const ToggleMenuItem = React.forwardRef(
12
12
  return /* @__PURE__ */ jsxRuntime.jsx(
13
13
  MenuItem.MenuItem,
14
14
  {
15
- as: "div",
15
+ as: "button",
16
16
  role: "menuitemcheckbox",
17
17
  "aria-checked": checked,
18
18
  className,
19
19
  Icon,
20
20
  label,
21
+ hideChevron: true,
21
22
  onSelect,
22
23
  disabled,
23
24
  onClick,
@@ -27,6 +28,7 @@ const ToggleMenuItem = React.forwardRef(
27
28
  id: toggleId,
28
29
  ref,
29
30
  "aria-hidden": true,
31
+ tabIndex: -1,
30
32
  checked,
31
33
  disabled,
32
34
  onChange
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleMenuItem.cjs","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { ToggleInput } from \"../Form/Controls/Toggle\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"Icon\" | \"label\" | \"onSelect\" | \"disabled\" | \"onClick\"\n> & {\n /**\n * Whether the toggle is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a toggle control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(\n function ToggleMenuItem(\n { className, Icon, label, onSelect, checked, disabled, onClick },\n ref,\n ) {\n const toggleId = useId();\n // The toggle is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"div\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n Icon={Icon}\n label={label}\n onSelect={onSelect}\n disabled={disabled}\n onClick={onClick}\n >\n <ToggleInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n </MenuItem>\n );\n },\n);\n"],"names":["forwardRef","ToggleMenuItem","useId","useCallback","jsx","MenuItem","ToggleInput"],"mappings":";;;;;;AA8BO,MAAM,iBAAiBA,MAAAA;AAAAA,EAC5B,SAASC,gBACP,EAAE,WAAW,MAAM,OAAO,UAAU,SAAS,UAAU,QAAA,GACvD,KACA;AACA,UAAM,WAAWC,MAAAA,MAAA;AAGjB,UAAM,WAAWC,MAAAA,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACEC,2BAAAA;AAAAA,MAACC,SAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,UAAAD,2BAAAA;AAAAA,UAACE,OAAAA;AAAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;;"}
1
+ {"version":3,"file":"ToggleMenuItem.cjs","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { ToggleInput } from \"../Form/Controls/Toggle\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"Icon\" | \"label\" | \"onSelect\" | \"disabled\" | \"onClick\"\n> & {\n /**\n * Whether the toggle is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a toggle control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(\n function ToggleMenuItem(\n { className, Icon, label, onSelect, checked, disabled, onClick },\n ref,\n ) {\n const toggleId = useId();\n // The toggle is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"button\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n Icon={Icon}\n label={label}\n hideChevron\n onSelect={onSelect}\n disabled={disabled}\n onClick={onClick}\n >\n <ToggleInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n tabIndex={-1}\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n </MenuItem>\n );\n },\n);\n"],"names":["forwardRef","ToggleMenuItem","useId","useCallback","jsx","MenuItem","ToggleInput"],"mappings":";;;;;;AA8BO,MAAM,iBAAiBA,MAAAA;AAAAA,EAC5B,SAASC,gBACP,EAAE,WAAW,MAAM,OAAO,UAAU,SAAS,UAAU,QAAA,GACvD,KACA;AACA,UAAM,WAAWC,MAAAA,MAAA;AAGjB,UAAM,WAAWC,MAAAA,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACEC,2BAAAA;AAAAA,MAACC,SAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QAEA,UAAAD,2BAAAA;AAAAA,UAACE,OAAAA;AAAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleMenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAKN,MAAM,OAAO,CAAC;AAcf;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;IAVzB;;OAEG;aACM,OAAO;0CA4CjB,CAAC"}
1
+ {"version":3,"file":"ToggleMenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAKN,MAAM,OAAO,CAAC;AAcf;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;IAVzB;;OAEG;aACM,OAAO;0CA8CjB,CAAC"}
@@ -10,12 +10,13 @@ const ToggleMenuItem = forwardRef(
10
10
  return /* @__PURE__ */ jsx(
11
11
  MenuItem,
12
12
  {
13
- as: "div",
13
+ as: "button",
14
14
  role: "menuitemcheckbox",
15
15
  "aria-checked": checked,
16
16
  className,
17
17
  Icon,
18
18
  label,
19
+ hideChevron: true,
19
20
  onSelect,
20
21
  disabled,
21
22
  onClick,
@@ -25,6 +26,7 @@ const ToggleMenuItem = forwardRef(
25
26
  id: toggleId,
26
27
  ref,
27
28
  "aria-hidden": true,
29
+ tabIndex: -1,
28
30
  checked,
29
31
  disabled,
30
32
  onChange
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleMenuItem.js","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { ToggleInput } from \"../Form/Controls/Toggle\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"Icon\" | \"label\" | \"onSelect\" | \"disabled\" | \"onClick\"\n> & {\n /**\n * Whether the toggle is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a toggle control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(\n function ToggleMenuItem(\n { className, Icon, label, onSelect, checked, disabled, onClick },\n ref,\n ) {\n const toggleId = useId();\n // The toggle is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"div\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n Icon={Icon}\n label={label}\n onSelect={onSelect}\n disabled={disabled}\n onClick={onClick}\n >\n <ToggleInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n </MenuItem>\n );\n },\n);\n"],"names":["ToggleMenuItem"],"mappings":";;;;AA8BO,MAAM,iBAAiB;AAAA,EAC5B,SAASA,gBACP,EAAE,WAAW,MAAM,OAAO,UAAU,SAAS,UAAU,QAAA,GACvD,KACA;AACA,UAAM,WAAW,MAAA;AAGjB,UAAM,WAAW,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"ToggleMenuItem.js","sources":["../../../src/components/Menu/ToggleMenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, {\n type ComponentProps,\n forwardRef,\n useCallback,\n useId,\n} from \"react\";\nimport { MenuItem } from \"./MenuItem\";\nimport { ToggleInput } from \"../Form/Controls/Toggle\";\n\ntype Props = Pick<\n ComponentProps<typeof MenuItem>,\n \"className\" | \"Icon\" | \"label\" | \"onSelect\" | \"disabled\" | \"onClick\"\n> & {\n /**\n * Whether the toggle is checked.\n */\n checked: boolean;\n};\n\n/**\n * A menu item with a toggle control.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(\n function ToggleMenuItem(\n { className, Icon, label, onSelect, checked, disabled, onClick },\n ref,\n ) {\n const toggleId = useId();\n // The toggle is controlled and we intend to ignore its events. We do need\n // to at least set onChange though to make React happy.\n const onChange = useCallback(() => {}, []);\n\n // <label> elements are not allowed to have a role like menuitemcheckbox, so\n // we must instead use a plain <div> for the menu item and use aria-checked\n // etc. to communicate its state.\n return (\n <MenuItem\n as=\"button\"\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n className={className}\n Icon={Icon}\n label={label}\n hideChevron\n onSelect={onSelect}\n disabled={disabled}\n onClick={onClick}\n >\n <ToggleInput\n id={toggleId}\n ref={ref}\n // This is purely cosmetic; really the whole MenuItem is the toggle.\n aria-hidden\n tabIndex={-1}\n checked={checked}\n disabled={disabled}\n onChange={onChange}\n />\n </MenuItem>\n );\n },\n);\n"],"names":["ToggleMenuItem"],"mappings":";;;;AA8BO,MAAM,iBAAiB;AAAA,EAC5B,SAASA,gBACP,EAAE,WAAW,MAAM,OAAO,UAAU,SAAS,UAAU,QAAA,GACvD,KACA;AACA,UAAM,WAAW,MAAA;AAGjB,UAAM,WAAW,YAAY,MAAM;AAAA,IAAC,GAAG,CAAA,CAAE;AAKzC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,gBAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QACA,aAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QAEA,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ;AAAA,YAEA,eAAW;AAAA,YACX,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;"}
package/dist/style.css CHANGED
@@ -247,7 +247,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
247
247
  Please see LICENSE files in the repository root for full details.
248
248
  */
249
249
 
250
- ._icon-button_1pz9o_8 {
250
+ ._icon-button_1215g_8 {
251
251
  --cpd-icon-button-indicator-border-size: calc(
252
252
  var(--cpd-icon-button-size) * 0.0625
253
253
  );
@@ -267,13 +267,13 @@ Please see LICENSE files in the repository root for full details.
267
267
  line-height: 0px;
268
268
  }
269
269
 
270
- ._icon-button_1pz9o_8[data-kind="primary"] {
270
+ ._icon-button_1215g_8[data-kind="primary"] {
271
271
  * {
272
- color: var(--cpd-color-icon-tertiary);
272
+ color: var(--cpd-color-icon-secondary);
273
273
  }
274
274
  }
275
275
 
276
- ._icon-button_1pz9o_8[data-kind="secondary"] {
276
+ ._icon-button_1215g_8[data-kind="secondary"] {
277
277
  background: var(--cpd-color-bg-subtle-secondary);
278
278
 
279
279
  * {
@@ -281,11 +281,11 @@ Please see LICENSE files in the repository root for full details.
281
281
  }
282
282
  }
283
283
 
284
- ._no-background_1pz9o_42[data-kind="secondary"] {
284
+ ._no-background_1215g_42[data-kind="secondary"] {
285
285
  background: transparent;
286
286
  }
287
287
 
288
- ._icon-button_1pz9o_8[aria-disabled="true"] {
288
+ ._icon-button_1215g_8[aria-disabled="true"] {
289
289
  cursor: not-allowed;
290
290
 
291
291
  * {
@@ -298,7 +298,7 @@ Please see LICENSE files in the repository root for full details.
298
298
  */
299
299
 
300
300
  @media (hover) {
301
- ._icon-button_1pz9o_8:not([aria-disabled="true"]):hover {
301
+ ._icon-button_1215g_8:not([aria-disabled="true"]):hover {
302
302
  background: var(--cpd-color-bg-subtle-primary);
303
303
 
304
304
  * {
@@ -307,7 +307,7 @@ Please see LICENSE files in the repository root for full details.
307
307
  }
308
308
  }
309
309
 
310
- ._icon-button_1pz9o_8:not([aria-disabled="true"]):active {
310
+ ._icon-button_1215g_8:not([aria-disabled="true"]):active {
311
311
  background: var(--cpd-color-bg-subtle-primary);
312
312
 
313
313
  * {
@@ -316,7 +316,7 @@ Please see LICENSE files in the repository root for full details.
316
316
  }
317
317
 
318
318
  @media (hover) {
319
- ._icon-button_1pz9o_8:not([aria-disabled="true"])[data-indicator]:is(:hover)::before {
319
+ ._icon-button_1215g_8:not([aria-disabled="true"])[data-indicator]:is(:hover)::before {
320
320
  /* Same colour as the background */
321
321
  border: var(--cpd-icon-button-indicator-border-size) solid
322
322
  var(--cpd-color-bg-subtle-primary);
@@ -325,7 +325,7 @@ Please see LICENSE files in the repository root for full details.
325
325
  }
326
326
  }
327
327
 
328
- ._icon-button_1pz9o_8:not([aria-disabled="true"])[data-indicator]:is(:active)::before {
328
+ ._icon-button_1215g_8:not([aria-disabled="true"])[data-indicator]:is(:active)::before {
329
329
  /* Same colour as the background */
330
330
  border: var(--cpd-icon-button-indicator-border-size) solid
331
331
  var(--cpd-color-bg-subtle-primary);
@@ -334,13 +334,13 @@ Please see LICENSE files in the repository root for full details.
334
334
  }
335
335
 
336
336
  @media (hover) {
337
- ._icon-button_1pz9o_8:not([aria-disabled="true"])._destructive_1pz9o_95:hover {
337
+ ._icon-button_1215g_8:not([aria-disabled="true"])._destructive_1215g_95:hover {
338
338
  background: var(--cpd-color-bg-critical-subtle-hovered);
339
339
  outline: 1px solid var(--cpd-color-border-critical-subtle);
340
340
  }
341
341
  }
342
342
 
343
- ._icon-button_1pz9o_8:not([aria-disabled="true"])._destructive_1pz9o_95 {
343
+ ._icon-button_1215g_8:not([aria-disabled="true"])._destructive_1215g_95 {
344
344
  * {
345
345
  color: var(--cpd-color-icon-critical-primary);
346
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vector-im/compound-web",
3
- "version": "8.3.4",
3
+ "version": "8.3.5",
4
4
  "description": "Compound components for the Web",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -56,7 +56,7 @@
56
56
  "@fontsource/inter": "^5.0.8",
57
57
  "@playwright/test": "^1.41.1",
58
58
  "@storybook/addon-a11y": "^10.0.0",
59
- "@storybook/addon-designs": "11.1.0",
59
+ "@storybook/addon-designs": "11.1.1",
60
60
  "@storybook/addon-docs": "^10.0.0",
61
61
  "@storybook/addon-links": "^10.0.0",
62
62
  "@storybook/addon-themes": "^10.0.0",
@@ -65,7 +65,7 @@
65
65
  "@testing-library/jest-dom": "^6.1.3",
66
66
  "@testing-library/react": "^16.0.0",
67
67
  "@testing-library/user-event": "^14.5.1",
68
- "@tsconfig/node20": "^20.1.4",
68
+ "@tsconfig/node22": "^22.0.0",
69
69
  "@tsconfig/vite-react": "^7.0.0",
70
70
  "@types/eslint": "^9.0.0",
71
71
  "@types/node": "^24.0.0",
@@ -27,7 +27,7 @@ Please see LICENSE files in the repository root for full details.
27
27
 
28
28
  .icon-button[data-kind="primary"] {
29
29
  * {
30
- color: var(--cpd-color-icon-tertiary);
30
+ color: var(--cpd-color-icon-secondary);
31
31
  }
32
32
  }
33
33
 
@@ -39,15 +39,16 @@ export const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(
39
39
  const onChange = useCallback(() => {}, []);
40
40
 
41
41
  // <label> elements are not allowed to have a role like menuitemcheckbox, so
42
- // we must instead use a plain <div> for the menu item and use aria-checked
42
+ // we must instead use a <button> for the menu item and use aria-checked
43
43
  // etc. to communicate its state.
44
44
  return (
45
45
  <MenuItem
46
- as="div"
46
+ as="button"
47
47
  role="menuitemcheckbox"
48
48
  aria-checked={checked}
49
49
  className={className}
50
50
  label={label}
51
+ hideChevron
51
52
  onSelect={onSelect}
52
53
  disabled={disabled}
53
54
  Icon={
@@ -56,6 +57,7 @@ export const CheckboxMenuItem = forwardRef<HTMLInputElement, Props>(
56
57
  ref={ref}
57
58
  // This is purely cosmetic; really the whole MenuItem is the toggle.
58
59
  aria-hidden
60
+ tabIndex={-1}
59
61
  checked={checked}
60
62
  disabled={disabled}
61
63
  onChange={onChange}
@@ -43,12 +43,13 @@ export const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(
43
43
  // etc. to communicate its state.
44
44
  return (
45
45
  <MenuItem
46
- as="div"
46
+ as="button"
47
47
  role="menuitemcheckbox"
48
48
  aria-checked={checked}
49
49
  className={className}
50
50
  Icon={Icon}
51
51
  label={label}
52
+ hideChevron
52
53
  onSelect={onSelect}
53
54
  disabled={disabled}
54
55
  onClick={onClick}
@@ -58,6 +59,7 @@ export const ToggleMenuItem = forwardRef<HTMLInputElement, Props>(
58
59
  ref={ref}
59
60
  // This is purely cosmetic; really the whole MenuItem is the toggle.
60
61
  aria-hidden
62
+ tabIndex={-1}
61
63
  checked={checked}
62
64
  disabled={disabled}
63
65
  onChange={onChange}