@vector-im/compound-web 8.1.1 → 8.2.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.
@@ -8,14 +8,16 @@ const InlineField = require("../../InlineField.cjs");
8
8
  const reactForm = require("@radix-ui/react-form");
9
9
  const Toggle = require("../Toggle/Toggle.cjs");
10
10
  const SettingsToggleInput = React.forwardRef(function Toggle$1({ className, label, helpMessage, disabledMessage, name, ...props }, ref) {
11
+ const generatedId = React.useId();
12
+ const id = props.id ?? generatedId;
11
13
  const content = /* @__PURE__ */ jsxRuntime.jsxs(
12
14
  InlineField.InlineField,
13
15
  {
14
16
  className,
15
17
  name,
16
- control: /* @__PURE__ */ jsxRuntime.jsx(Toggle.ToggleInput, { ref, ...props }),
18
+ control: /* @__PURE__ */ jsxRuntime.jsx(Toggle.ToggleInput, { id, ref, ...props }),
17
19
  children: [
18
- /* @__PURE__ */ jsxRuntime.jsx(Label.Label, { children: label }),
20
+ /* @__PURE__ */ jsxRuntime.jsx(Label.Label, { htmlFor: id, children: label }),
19
21
  helpMessage && /* @__PURE__ */ jsxRuntime.jsx(Message.HelpMessage, { children: helpMessage }),
20
22
  disabledMessage && props.disabled && /* @__PURE__ */ jsxRuntime.jsx(Message.HelpMessage, { children: disabledMessage })
21
23
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsToggle.cjs","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"sourcesContent":["/*\nCopyright 2025 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 {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport { ToggleInput } from \"../Toggle\";\nimport { Label } from \"../../Label\";\nimport { HelpMessage } from \"../../Message\";\nimport { InlineField } from \"../../InlineField\";\nimport React from \"react\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype SettingsToggleProps = {\n /**\n * The CSS class name for the containing field.\n */\n className?: string;\n /**\n * The field name.\n */\n name: string;\n label: string;\n /**\n * Optional help text to display below the setting.\n */\n helpMessage?: string;\n /**\n * Optional help text to display below the setting.\n */\n disabledMessage?: string;\n} & Omit<ComponentProps<typeof ToggleInput>, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const SettingsToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<SettingsToggleProps>\n>(function Toggle(\n { className, label, helpMessage, disabledMessage, name, ...props },\n ref,\n) {\n const content = (\n <InlineField\n className={className}\n name={name}\n control={<ToggleInput ref={ref} {...props} />}\n >\n <Label>{label}</Label>\n {helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}\n {disabledMessage && props.disabled && (\n <HelpMessage>{disabledMessage}</HelpMessage>\n )}\n </InlineField>\n );\n return content;\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const SettingsToggleControl = forwardRef<\n ComponentRef<typeof SettingsToggleInput>,\n ComponentProps<typeof SettingsToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <SettingsToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["forwardRef","Toggle","jsxs","InlineField","jsx","ToggleInput","Label","HelpMessage","Control"],"mappings":";;;;;;;;;AA2CO,MAAM,sBAAsBA,MAAA,WAGjC,SAASC,SACT,EAAE,WAAW,OAAO,aAAa,iBAAiB,MAAM,GAAG,MAAA,GAC3D,KACA;AACA,QAAM,UACJC,2BAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAASC,2BAAA,IAACC,OAAY,aAAA,EAAA,KAAW,GAAG,MAAO,CAAA;AAAA,MAE3C,UAAA;AAAA,QAAAD,2BAAAA,IAACE,eAAO,UAAM,MAAA,CAAA;AAAA,QACb,eAAgBF,2BAAAA,IAAAG,QAAAA,aAAA,EAAa,UAAY,YAAA,CAAA;AAAA,QACzC,mBAAmB,MAAM,YACxBH,2BAAAA,IAACG,QAAAA,eAAa,UAAgB,gBAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAElC;AAEK,SAAA;AACT,CAAC;AAKM,MAAM,wBAAwBP,MAAAA,WAGnC,SAAS,cAAc,OAAO,KAAK;AAEjC,SAAAI,2BAAA,IAACI,qBAAQ,SAAO,MACd,yCAAC,qBAAoB,EAAA,KAAW,GAAG,MAAA,CAAO,EAC5C,CAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"SettingsToggle.cjs","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"sourcesContent":["/*\nCopyright 2025 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 {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n useId,\n} from \"react\";\nimport { ToggleInput } from \"../Toggle\";\nimport { Label } from \"../../Label\";\nimport { HelpMessage } from \"../../Message\";\nimport { InlineField } from \"../../InlineField\";\nimport React from \"react\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype SettingsToggleProps = {\n /**\n * The CSS class name for the containing field.\n */\n className?: string;\n /**\n * The field name.\n */\n name: string;\n label: string;\n /**\n * Optional help text to display below the setting.\n */\n helpMessage?: string;\n /**\n * Optional help text to display below the setting.\n */\n disabledMessage?: string;\n} & Omit<ComponentProps<typeof ToggleInput>, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const SettingsToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<SettingsToggleProps>\n>(function Toggle(\n { className, label, helpMessage, disabledMessage, name, ...props },\n ref,\n) {\n const generatedId = useId();\n const id = props.id ?? generatedId;\n const content = (\n <InlineField\n className={className}\n name={name}\n control={<ToggleInput id={id} ref={ref} {...props} />}\n >\n <Label htmlFor={id}>{label}</Label>\n {helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}\n {disabledMessage && props.disabled && (\n <HelpMessage>{disabledMessage}</HelpMessage>\n )}\n </InlineField>\n );\n return content;\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const SettingsToggleControl = forwardRef<\n ComponentRef<typeof SettingsToggleInput>,\n ComponentProps<typeof SettingsToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <SettingsToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["forwardRef","Toggle","useId","jsxs","InlineField","jsx","ToggleInput","Label","HelpMessage","Control"],"mappings":";;;;;;;;;AA4CO,MAAM,sBAAsBA,MAAA,WAGjC,SAASC,SACT,EAAE,WAAW,OAAO,aAAa,iBAAiB,MAAM,GAAG,MAAA,GAC3D,KACA;AACA,QAAM,cAAcC,MAAAA,MAAM;AACpB,QAAA,KAAK,MAAM,MAAM;AACvB,QAAM,UACJC,2BAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAUC,2BAAA,IAAAC,oBAAA,EAAY,IAAQ,KAAW,GAAG,OAAO;AAAA,MAEnD,UAAA;AAAA,QAACD,2BAAA,IAAAE,MAAA,OAAA,EAAM,SAAS,IAAK,UAAM,OAAA;AAAA,QAC1B,eAAgBF,2BAAAA,IAAAG,QAAAA,aAAA,EAAa,UAAY,YAAA,CAAA;AAAA,QACzC,mBAAmB,MAAM,YACxBH,2BAAAA,IAACG,QAAAA,eAAa,UAAgB,gBAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAElC;AAEK,SAAA;AACT,CAAC;AAKM,MAAM,wBAAwBR,MAAAA,WAGnC,SAAS,cAAc,OAAO,KAAK;AAEjC,SAAAK,2BAAA,IAACI,qBAAQ,SAAO,MACd,yCAAC,qBAAoB,EAAA,KAAW,GAAG,MAAA,CAAO,EAC5C,CAAA;AAEJ,CAAC;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,cAAc,EAGd,iBAAiB,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,mBAAmB,8HAqB9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,mLAShC,CAAC"}
1
+ {"version":3,"file":"SettingsToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,cAAc,EAGd,iBAAiB,EAElB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,mBAAmB,8HAuB9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,mLAShC,CAAC"}
@@ -1,19 +1,21 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
2
+ import { forwardRef, useId } from "react";
3
3
  import { Label } from "../../Label.js";
4
4
  import { HelpMessage } from "../../Message.js";
5
5
  import { InlineField } from "../../InlineField.js";
6
6
  import { Control } from "@radix-ui/react-form";
7
7
  import { ToggleInput } from "../Toggle/Toggle.js";
8
8
  const SettingsToggleInput = forwardRef(function Toggle({ className, label, helpMessage, disabledMessage, name, ...props }, ref) {
9
+ const generatedId = useId();
10
+ const id = props.id ?? generatedId;
9
11
  const content = /* @__PURE__ */ jsxs(
10
12
  InlineField,
11
13
  {
12
14
  className,
13
15
  name,
14
- control: /* @__PURE__ */ jsx(ToggleInput, { ref, ...props }),
16
+ control: /* @__PURE__ */ jsx(ToggleInput, { id, ref, ...props }),
15
17
  children: [
16
- /* @__PURE__ */ jsx(Label, { children: label }),
18
+ /* @__PURE__ */ jsx(Label, { htmlFor: id, children: label }),
17
19
  helpMessage && /* @__PURE__ */ jsx(HelpMessage, { children: helpMessage }),
18
20
  disabledMessage && props.disabled && /* @__PURE__ */ jsx(HelpMessage, { children: disabledMessage })
19
21
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsToggle.js","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"sourcesContent":["/*\nCopyright 2025 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 {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport { ToggleInput } from \"../Toggle\";\nimport { Label } from \"../../Label\";\nimport { HelpMessage } from \"../../Message\";\nimport { InlineField } from \"../../InlineField\";\nimport React from \"react\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype SettingsToggleProps = {\n /**\n * The CSS class name for the containing field.\n */\n className?: string;\n /**\n * The field name.\n */\n name: string;\n label: string;\n /**\n * Optional help text to display below the setting.\n */\n helpMessage?: string;\n /**\n * Optional help text to display below the setting.\n */\n disabledMessage?: string;\n} & Omit<ComponentProps<typeof ToggleInput>, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const SettingsToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<SettingsToggleProps>\n>(function Toggle(\n { className, label, helpMessage, disabledMessage, name, ...props },\n ref,\n) {\n const content = (\n <InlineField\n className={className}\n name={name}\n control={<ToggleInput ref={ref} {...props} />}\n >\n <Label>{label}</Label>\n {helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}\n {disabledMessage && props.disabled && (\n <HelpMessage>{disabledMessage}</HelpMessage>\n )}\n </InlineField>\n );\n return content;\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const SettingsToggleControl = forwardRef<\n ComponentRef<typeof SettingsToggleInput>,\n ComponentProps<typeof SettingsToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <SettingsToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":[],"mappings":";;;;;;;AA2CO,MAAM,sBAAsB,WAGjC,SAAS,OACT,EAAE,WAAW,OAAO,aAAa,iBAAiB,MAAM,GAAG,MAAA,GAC3D,KACA;AACA,QAAM,UACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS,oBAAC,aAAY,EAAA,KAAW,GAAG,MAAO,CAAA;AAAA,MAE3C,UAAA;AAAA,QAAA,oBAAC,SAAO,UAAM,MAAA,CAAA;AAAA,QACb,eAAgB,oBAAA,aAAA,EAAa,UAAY,YAAA,CAAA;AAAA,QACzC,mBAAmB,MAAM,YACxB,oBAAC,eAAa,UAAgB,gBAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAElC;AAEK,SAAA;AACT,CAAC;AAKM,MAAM,wBAAwB,WAGnC,SAAS,cAAc,OAAO,KAAK;AAEjC,SAAA,oBAAC,WAAQ,SAAO,MACd,8BAAC,qBAAoB,EAAA,KAAW,GAAG,MAAA,CAAO,EAC5C,CAAA;AAEJ,CAAC;"}
1
+ {"version":3,"file":"SettingsToggle.js","sources":["../../../../../src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx"],"sourcesContent":["/*\nCopyright 2025 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 {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n useId,\n} from \"react\";\nimport { ToggleInput } from \"../Toggle\";\nimport { Label } from \"../../Label\";\nimport { HelpMessage } from \"../../Message\";\nimport { InlineField } from \"../../InlineField\";\nimport React from \"react\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype SettingsToggleProps = {\n /**\n * The CSS class name for the containing field.\n */\n className?: string;\n /**\n * The field name.\n */\n name: string;\n label: string;\n /**\n * Optional help text to display below the setting.\n */\n helpMessage?: string;\n /**\n * Optional help text to display below the setting.\n */\n disabledMessage?: string;\n} & Omit<ComponentProps<typeof ToggleInput>, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const SettingsToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<SettingsToggleProps>\n>(function Toggle(\n { className, label, helpMessage, disabledMessage, name, ...props },\n ref,\n) {\n const generatedId = useId();\n const id = props.id ?? generatedId;\n const content = (\n <InlineField\n className={className}\n name={name}\n control={<ToggleInput id={id} ref={ref} {...props} />}\n >\n <Label htmlFor={id}>{label}</Label>\n {helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}\n {disabledMessage && props.disabled && (\n <HelpMessage>{disabledMessage}</HelpMessage>\n )}\n </InlineField>\n );\n return content;\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const SettingsToggleControl = forwardRef<\n ComponentRef<typeof SettingsToggleInput>,\n ComponentProps<typeof SettingsToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <SettingsToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":[],"mappings":";;;;;;;AA4CO,MAAM,sBAAsB,WAGjC,SAAS,OACT,EAAE,WAAW,OAAO,aAAa,iBAAiB,MAAM,GAAG,MAAA,GAC3D,KACA;AACA,QAAM,cAAc,MAAM;AACpB,QAAA,KAAK,MAAM,MAAM;AACvB,QAAM,UACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAU,oBAAA,aAAA,EAAY,IAAQ,KAAW,GAAG,OAAO;AAAA,MAEnD,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,SAAS,IAAK,UAAM,OAAA;AAAA,QAC1B,eAAgB,oBAAA,aAAA,EAAa,UAAY,YAAA,CAAA;AAAA,QACzC,mBAAmB,MAAM,YACxB,oBAAC,eAAa,UAAgB,gBAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAElC;AAEK,SAAA;AACT,CAAC;AAKM,MAAM,wBAAwB,WAGnC,SAAS,cAAc,OAAO,KAAK;AAEjC,SAAA,oBAAC,WAAQ,SAAO,MACd,8BAAC,qBAAoB,EAAA,KAAW,GAAG,MAAA,CAAO,EAC5C,CAAA;AAEJ,CAAC;"}
@@ -8,7 +8,16 @@ const reactForm = require("@radix-ui/react-form");
8
8
  const ToggleInput = React.forwardRef(function Toggle({ className, ...props }, ref) {
9
9
  const classes = classNames(Toggle_module.default.container, className);
10
10
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
11
- /* @__PURE__ */ jsxRuntime.jsx("input", { ref, className: Toggle_module.default.input, ...props, type: "checkbox" }),
11
+ /* @__PURE__ */ jsxRuntime.jsx(
12
+ "input",
13
+ {
14
+ role: "switch",
15
+ ref,
16
+ className: Toggle_module.default.input,
17
+ ...props,
18
+ type: "checkbox"
19
+ }
20
+ ),
12
21
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: Toggle_module.default.ui })
13
22
  ] });
14
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.cjs","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd.\nCopyright 2023 The Matrix.org Foundation C.I.C.\nCopyright 2023 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 classnames from \"classnames\";\nimport React, {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport styles from \"./Toggle.module.css\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype ToggleProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n} & Omit<ComponentProps<\"input\">, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const ToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<ToggleProps>\n>(function Toggle({ className, ...props }, ref) {\n const classes = classnames(styles.container, className);\n return (\n <div className={classes}>\n <input ref={ref} className={styles.input} {...props} type=\"checkbox\" />\n <div className={styles.ui} />\n </div>\n );\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const ToggleControl = forwardRef<\n ComponentRef<typeof ToggleInput>,\n ComponentProps<typeof ToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <ToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["forwardRef","classnames","styles","jsxs","jsx","ToggleControl","Control"],"mappings":";;;;;;;AA6Ba,MAAA,cAAcA,iBAGzB,SAAS,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK;AAC9C,QAAM,UAAUC,WAAWC,sBAAO,WAAW,SAAS;AAEpD,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAW,SACd,UAAA;AAAA,IAACC,2BAAAA,IAAA,SAAA,EAAM,KAAU,WAAWF,cAAAA,QAAO,OAAQ,GAAG,OAAO,MAAK,YAAW;AAAA,IACpEE,2BAAAA,IAAA,OAAA,EAAI,WAAWF,cAAAA,QAAO,GAAI,CAAA;AAAA,EAAA,GAC7B;AAEJ,CAAC;AAKM,MAAM,gBAAgBF,MAAAA,WAG3B,SAASK,eAAc,OAAO,KAAK;AAEjC,SAAAD,2BAAA,IAACE,qBAAQ,SAAO,MACd,yCAAC,aAAY,EAAA,KAAW,GAAG,MAAA,CAAO,EACpC,CAAA;AAEJ,CAAC;;;"}
1
+ {"version":3,"file":"Toggle.cjs","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd.\nCopyright 2023 The Matrix.org Foundation C.I.C.\nCopyright 2023 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 classnames from \"classnames\";\nimport React, {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport styles from \"./Toggle.module.css\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype ToggleProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n} & Omit<ComponentProps<\"input\">, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const ToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<ToggleProps>\n>(function Toggle({ className, ...props }, ref) {\n const classes = classnames(styles.container, className);\n return (\n <div className={classes}>\n <input\n role=\"switch\"\n ref={ref}\n className={styles.input}\n {...props}\n type=\"checkbox\"\n />\n <div className={styles.ui} />\n </div>\n );\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const ToggleControl = forwardRef<\n ComponentRef<typeof ToggleInput>,\n ComponentProps<typeof ToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <ToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["forwardRef","classnames","styles","jsxs","jsx","ToggleControl","Control"],"mappings":";;;;;;;AA6Ba,MAAA,cAAcA,iBAGzB,SAAS,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK;AAC9C,QAAM,UAAUC,WAAWC,sBAAO,WAAW,SAAS;AAEpD,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAW,SACd,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,WAAWF,cAAO,QAAA;AAAA,QACjB,GAAG;AAAA,QACJ,MAAK;AAAA,MAAA;AAAA,IACP;AAAA,IACCE,2BAAAA,IAAA,OAAA,EAAI,WAAWF,cAAAA,QAAO,GAAI,CAAA;AAAA,EAAA,GAC7B;AAEJ,CAAC;AAKM,MAAM,gBAAgBF,MAAAA,WAG3B,SAASK,eAAc,OAAO,KAAK;AAEjC,SAAAD,2BAAA,IAACE,qBAAQ,SAAO,MACd,yCAAC,aAAY,EAAA,KAAW,GAAG,MAAA,CAAO,EACpC,CAAA;AAEJ,CAAC;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EACZ,cAAc,EAIf,MAAM,OAAO,CAAC;AAIf,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,4HAWtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,iLASxB,CAAC"}
1
+ {"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EACZ,cAAc,EAIf,MAAM,OAAO,CAAC;AAIf,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,4HAiBtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,iLASxB,CAAC"}
@@ -6,7 +6,16 @@ import { Control } from "@radix-ui/react-form";
6
6
  const ToggleInput = forwardRef(function Toggle({ className, ...props }, ref) {
7
7
  const classes = classNames(styles.container, className);
8
8
  return /* @__PURE__ */ jsxs("div", { className: classes, children: [
9
- /* @__PURE__ */ jsx("input", { ref, className: styles.input, ...props, type: "checkbox" }),
9
+ /* @__PURE__ */ jsx(
10
+ "input",
11
+ {
12
+ role: "switch",
13
+ ref,
14
+ className: styles.input,
15
+ ...props,
16
+ type: "checkbox"
17
+ }
18
+ ),
10
19
  /* @__PURE__ */ jsx("div", { className: styles.ui })
11
20
  ] });
12
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.js","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd.\nCopyright 2023 The Matrix.org Foundation C.I.C.\nCopyright 2023 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 classnames from \"classnames\";\nimport React, {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport styles from \"./Toggle.module.css\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype ToggleProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n} & Omit<ComponentProps<\"input\">, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const ToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<ToggleProps>\n>(function Toggle({ className, ...props }, ref) {\n const classes = classnames(styles.container, className);\n return (\n <div className={classes}>\n <input ref={ref} className={styles.input} {...props} type=\"checkbox\" />\n <div className={styles.ui} />\n </div>\n );\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const ToggleControl = forwardRef<\n ComponentRef<typeof ToggleInput>,\n ComponentProps<typeof ToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <ToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["classnames","ToggleControl"],"mappings":";;;;;AA6Ba,MAAA,cAAc,WAGzB,SAAS,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK;AAC9C,QAAM,UAAUA,WAAW,OAAO,WAAW,SAAS;AAEpD,SAAA,qBAAC,OAAI,EAAA,WAAW,SACd,UAAA;AAAA,IAAC,oBAAA,SAAA,EAAM,KAAU,WAAW,OAAO,OAAQ,GAAG,OAAO,MAAK,YAAW;AAAA,IACpE,oBAAA,OAAA,EAAI,WAAW,OAAO,GAAI,CAAA;AAAA,EAAA,GAC7B;AAEJ,CAAC;AAKM,MAAM,gBAAgB,WAG3B,SAASC,eAAc,OAAO,KAAK;AAEjC,SAAA,oBAAC,WAAQ,SAAO,MACd,8BAAC,aAAY,EAAA,KAAW,GAAG,MAAA,CAAO,EACpC,CAAA;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Toggle.js","sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd.\nCopyright 2023 The Matrix.org Foundation C.I.C.\nCopyright 2023 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 classnames from \"classnames\";\nimport React, {\n ComponentProps,\n ComponentRef,\n forwardRef,\n PropsWithChildren,\n} from \"react\";\nimport styles from \"./Toggle.module.css\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype ToggleProps = {\n /**\n * The CSS class name.\n */\n className?: string;\n} & Omit<ComponentProps<\"input\">, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const ToggleInput = forwardRef<\n HTMLInputElement,\n PropsWithChildren<ToggleProps>\n>(function Toggle({ className, ...props }, ref) {\n const classes = classnames(styles.container, className);\n return (\n <div className={classes}>\n <input\n role=\"switch\"\n ref={ref}\n className={styles.input}\n {...props}\n type=\"checkbox\"\n />\n <div className={styles.ui} />\n </div>\n );\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const ToggleControl = forwardRef<\n ComponentRef<typeof ToggleInput>,\n ComponentProps<typeof ToggleInput>\n>(function ToggleControl(props, ref) {\n return (\n <Control asChild>\n <ToggleInput ref={ref} {...props} />\n </Control>\n );\n});\n"],"names":["classnames","ToggleControl"],"mappings":";;;;;AA6Ba,MAAA,cAAc,WAGzB,SAAS,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK;AAC9C,QAAM,UAAUA,WAAW,OAAO,WAAW,SAAS;AAEpD,SAAA,qBAAC,OAAI,EAAA,WAAW,SACd,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,WAAW,OAAO;AAAA,QACjB,GAAG;AAAA,QACJ,MAAK;AAAA,MAAA;AAAA,IACP;AAAA,IACC,oBAAA,OAAA,EAAI,WAAW,OAAO,GAAI,CAAA;AAAA,EAAA,GAC7B;AAEJ,CAAC;AAKM,MAAM,gBAAgB,WAG3B,SAASC,eAAc,OAAO,KAAK;AAEjC,SAAA,oBAAC,WAAQ,SAAO,MACd,8BAAC,aAAY,EAAA,KAAW,GAAG,MAAA,CAAO,EACpC,CAAA;AAEJ,CAAC;"}
@@ -42,19 +42,7 @@ const Menu = ({
42
42
  ] })
43
43
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(reactDropdownMenu.Root, { open, onOpenChange, children: [
44
44
  /* @__PURE__ */ jsxRuntime.jsx(reactDropdownMenu.Trigger, { asChild: true, children: trigger }),
45
- /* @__PURE__ */ jsxRuntime.jsx(reactDropdownMenu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
46
- reactDropdownMenu.Content,
47
- {
48
- asChild: true,
49
- side,
50
- align,
51
- sideOffset: 8,
52
- onCloseAutoFocus: (event) => {
53
- event.preventDefault();
54
- },
55
- children: /* @__PURE__ */ jsxRuntime.jsx(FloatingMenu.FloatingMenu, { title, showTitle, children })
56
- }
57
- ) })
45
+ /* @__PURE__ */ jsxRuntime.jsx(reactDropdownMenu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(reactDropdownMenu.Content, { asChild: true, side, align, sideOffset: 8, children: /* @__PURE__ */ jsxRuntime.jsx(FloatingMenu.FloatingMenu, { title, showTitle, children }) }) })
58
46
  ] });
59
47
  };
60
48
  exports.Menu = Menu;
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.cjs","sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["/*\nCopyright 2023 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, { FC, ReactNode, useMemo } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n DropdownMenuItem,\n} from \"@radix-ui/react-dropdown-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerMenu from \"./DrawerMenu.module.css\";\nimport { MenuContext, MenuData, MenuItemWrapperProps } from \"./MenuContext\";\nimport { DrawerMenu } from \"./DrawerMenu\";\nimport { getPlatform } from \"../../utils/platform\";\n\ninterface Props {\n /**\n * The menu title. This can be hidden with `showTitle={false}` in which case it will only\n * be a label for screen readers.\n */\n title: string;\n /**\n * Controls whether the title is displayed (see `title` prop). Titles are only displayed on\n * web: on mobile, this parameter is ignored.\n */\n showTitle?: boolean;\n /**\n * Whether the menu is open.\n */\n open: boolean;\n /**\n * Event handler called when the open state of the menu changes. This includes\n * anything like clicking the trigger, selecting a menu item, or dismissing\n * the menu with the mouse or keyboard.\n */\n onOpenChange: (open: boolean) => void;\n /**\n * The button that opens the menu. This must be a component that accepts a ref\n * and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * The menu contents.\n */\n children: ReactNode;\n /**\n * The side of the trigger on which to place the menu. Note that the menu may\n * still end up on a different side than the one you request if there isn't\n * enough space.\n * @default bottom\n */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /**\n * The edge along which the menu and trigger will be aligned.\n * @default center\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst DropdownMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <DropdownMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </DropdownMenuItem>\n);\n\n/**\n * A menu opened by pressing a button.\n */\nexport const Menu: FC<Props> = ({\n title,\n showTitle = true,\n open,\n onOpenChange,\n trigger,\n children: childrenProp,\n side = \"bottom\",\n align = \"center\",\n}) => {\n // Normally, the menu takes the form of a floating box. But on Android and\n // iOS, the menu should morph into a drawer\n const platform = getPlatform();\n const drawer = platform === \"android\" || platform === \"ios\";\n const context: MenuData = useMemo(\n () => ({\n MenuItemWrapper: drawer ? null : DropdownMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n return drawer ? (\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Trigger asChild>{trigger}</Drawer.Trigger>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerMenu.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n ) : (\n <Root open={open} onOpenChange={onOpenChange}>\n <Trigger asChild>{trigger}</Trigger>\n <Portal>\n <Content\n asChild\n side={side}\n align={align}\n sideOffset={8}\n onCloseAutoFocus={(event) => {\n // https://www.radix-ui.com/primitives/docs/components/dropdown-menu#content => onCloseAutoFocus\n // Prevent the default behavior of focusing the trigger when the menu closes\n event.preventDefault();\n }}\n >\n <FloatingMenu title={title} showTitle={showTitle}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["DropdownMenuItem","platform","getPlatform","useMemo","jsx","MenuContext","jsxs","Drawer","classnames","drawerMenu","DrawerMenu","Root","Trigger","Portal","Content","FloatingMenu"],"mappings":";;;;;;;;;;;;AAoEA,MAAM,0BAAoD,CAAC;AAAA,EACzD;AAAA,EACA;AACF,qCACGA,oCAAiB,EAAA,UAAU,YAAY,QAAW,SAAO,MACvD,UACH;AAMK,MAAM,OAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AACV,MAAM;AAGJ,QAAMC,aAAWC,SAAAA,YAAY;AACvB,QAAA,SAASD,eAAa,aAAaA,eAAa;AACtD,QAAM,UAAoBE,MAAA;AAAA,IACxB,OAAO;AAAA,MACL,iBAAiB,SAAS,OAAO;AAAA,MACjC;AAAA,IAAA;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AACA,QAAM,WACHC,+BAAAC,YAAAA,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAa,cAAA;AAGtD,SAAO,SACJC,2BAAAA,KAAAC,KAAA,OAAO,MAAP,EAAY,MAAY,cACvB,UAAA;AAAA,IAAAH,2BAAA,IAACG,KAAO,OAAA,SAAP,EAAe,SAAO,MAAE,UAAQ,SAAA;AAAA,IACjCD,2BAAAA,KAACC,KAAO,OAAA,QAAP,EACC,UAAA;AAAA,MAAAH,+BAACG,KAAAA,OAAO,SAAP,EAAe,WAAWC,WAAWC,kBAAA,QAAW,EAAE,GAAG;AAAA,MACtDL,2BAAAA,IAACG,KAAO,OAAA,SAAP,EAAe,SAAO,MACrB,UAACH,2BAAAA,IAAAM,WAAAA,YAAA,EAAW,OAAe,SAAS,CAAA,EACtC,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,IAEAJ,2BAAAA,KAACK,kBAAAA,MAAK,EAAA,MAAY,cAChB,UAAA;AAAA,IAACP,2BAAA,IAAAQ,kBAAA,SAAA,EAAQ,SAAO,MAAE,UAAQ,SAAA;AAAA,mCACzBC,kBAAAA,QACC,EAAA,UAAAT,2BAAA;AAAA,MAACU,kBAAA;AAAA,MAAA;AAAA,QACC,SAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,kBAAkB,CAAC,UAAU;AAG3B,gBAAM,eAAe;AAAA,QACvB;AAAA,QAEA,UAACV,2BAAA,IAAAW,aAAA,cAAA,EAAa,OAAc,WACzB,SACH,CAAA;AAAA,MAAA;AAAA,IAAA,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
1
+ {"version":3,"file":"Menu.cjs","sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["/*\nCopyright 2023 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, { FC, ReactNode, useMemo } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n DropdownMenuItem,\n} from \"@radix-ui/react-dropdown-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerMenu from \"./DrawerMenu.module.css\";\nimport { MenuContext, MenuData, MenuItemWrapperProps } from \"./MenuContext\";\nimport { DrawerMenu } from \"./DrawerMenu\";\nimport { getPlatform } from \"../../utils/platform\";\n\ninterface Props {\n /**\n * The menu title. This can be hidden with `showTitle={false}` in which case it will only\n * be a label for screen readers.\n */\n title: string;\n /**\n * Controls whether the title is displayed (see `title` prop). Titles are only displayed on\n * web: on mobile, this parameter is ignored.\n */\n showTitle?: boolean;\n /**\n * Whether the menu is open.\n */\n open: boolean;\n /**\n * Event handler called when the open state of the menu changes. This includes\n * anything like clicking the trigger, selecting a menu item, or dismissing\n * the menu with the mouse or keyboard.\n */\n onOpenChange: (open: boolean) => void;\n /**\n * The button that opens the menu. This must be a component that accepts a ref\n * and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * The menu contents.\n */\n children: ReactNode;\n /**\n * The side of the trigger on which to place the menu. Note that the menu may\n * still end up on a different side than the one you request if there isn't\n * enough space.\n * @default bottom\n */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /**\n * The edge along which the menu and trigger will be aligned.\n * @default center\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst DropdownMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <DropdownMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </DropdownMenuItem>\n);\n\n/**\n * A menu opened by pressing a button.\n */\nexport const Menu: FC<Props> = ({\n title,\n showTitle = true,\n open,\n onOpenChange,\n trigger,\n children: childrenProp,\n side = \"bottom\",\n align = \"center\",\n}) => {\n // Normally, the menu takes the form of a floating box. But on Android and\n // iOS, the menu should morph into a drawer\n const platform = getPlatform();\n const drawer = platform === \"android\" || platform === \"ios\";\n const context: MenuData = useMemo(\n () => ({\n MenuItemWrapper: drawer ? null : DropdownMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n return drawer ? (\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Trigger asChild>{trigger}</Drawer.Trigger>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerMenu.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n ) : (\n <Root open={open} onOpenChange={onOpenChange}>\n <Trigger asChild>{trigger}</Trigger>\n <Portal>\n <Content asChild side={side} align={align} sideOffset={8}>\n <FloatingMenu title={title} showTitle={showTitle}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["DropdownMenuItem","platform","getPlatform","useMemo","jsx","MenuContext","jsxs","Drawer","classnames","drawerMenu","DrawerMenu","Root","Trigger","Portal","Content","FloatingMenu"],"mappings":";;;;;;;;;;;;AAoEA,MAAM,0BAAoD,CAAC;AAAA,EACzD;AAAA,EACA;AACF,qCACGA,oCAAiB,EAAA,UAAU,YAAY,QAAW,SAAO,MACvD,UACH;AAMK,MAAM,OAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AACV,MAAM;AAGJ,QAAMC,aAAWC,SAAAA,YAAY;AACvB,QAAA,SAASD,eAAa,aAAaA,eAAa;AACtD,QAAM,UAAoBE,MAAA;AAAA,IACxB,OAAO;AAAA,MACL,iBAAiB,SAAS,OAAO;AAAA,MACjC;AAAA,IAAA;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AACA,QAAM,WACHC,+BAAAC,YAAAA,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAa,cAAA;AAGtD,SAAO,SACJC,2BAAAA,KAAAC,KAAA,OAAO,MAAP,EAAY,MAAY,cACvB,UAAA;AAAA,IAAAH,2BAAA,IAACG,KAAO,OAAA,SAAP,EAAe,SAAO,MAAE,UAAQ,SAAA;AAAA,IACjCD,2BAAAA,KAACC,KAAO,OAAA,QAAP,EACC,UAAA;AAAA,MAAAH,+BAACG,KAAAA,OAAO,SAAP,EAAe,WAAWC,WAAWC,kBAAA,QAAW,EAAE,GAAG;AAAA,MACtDL,2BAAAA,IAACG,KAAO,OAAA,SAAP,EAAe,SAAO,MACrB,UAACH,2BAAAA,IAAAM,WAAAA,YAAA,EAAW,OAAe,SAAS,CAAA,EACtC,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,IAEAJ,2BAAAA,KAACK,kBAAAA,MAAK,EAAA,MAAY,cAChB,UAAA;AAAA,IAACP,2BAAA,IAAAQ,kBAAA,SAAA,EAAQ,SAAO,MAAE,UAAQ,SAAA;AAAA,mCACzBC,kBAAAA,QACC,EAAA,UAAAT,2BAAA,IAACU,kBAAQ,SAAA,EAAA,SAAO,MAAC,MAAY,OAAc,YAAY,GACrD,yCAACC,2BAAa,EAAA,OAAc,WACzB,UACH,GACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAgBtD,UAAU,KAAK;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CACpC;AAWD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,KAAK,CAyD1B,CAAC"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAgBtD,UAAU,KAAK;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CACpC;AAWD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,KAAK,CA+C1B,CAAC"}
@@ -40,19 +40,7 @@ const Menu = ({
40
40
  ] })
41
41
  ] }) : /* @__PURE__ */ jsxs(Root, { open, onOpenChange, children: [
42
42
  /* @__PURE__ */ jsx(Trigger, { asChild: true, children: trigger }),
43
- /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
44
- Content,
45
- {
46
- asChild: true,
47
- side,
48
- align,
49
- sideOffset: 8,
50
- onCloseAutoFocus: (event) => {
51
- event.preventDefault();
52
- },
53
- children: /* @__PURE__ */ jsx(FloatingMenu, { title, showTitle, children })
54
- }
55
- ) })
43
+ /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { asChild: true, side, align, sideOffset: 8, children: /* @__PURE__ */ jsx(FloatingMenu, { title, showTitle, children }) }) })
56
44
  ] });
57
45
  };
58
46
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["/*\nCopyright 2023 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, { FC, ReactNode, useMemo } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n DropdownMenuItem,\n} from \"@radix-ui/react-dropdown-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerMenu from \"./DrawerMenu.module.css\";\nimport { MenuContext, MenuData, MenuItemWrapperProps } from \"./MenuContext\";\nimport { DrawerMenu } from \"./DrawerMenu\";\nimport { getPlatform } from \"../../utils/platform\";\n\ninterface Props {\n /**\n * The menu title. This can be hidden with `showTitle={false}` in which case it will only\n * be a label for screen readers.\n */\n title: string;\n /**\n * Controls whether the title is displayed (see `title` prop). Titles are only displayed on\n * web: on mobile, this parameter is ignored.\n */\n showTitle?: boolean;\n /**\n * Whether the menu is open.\n */\n open: boolean;\n /**\n * Event handler called when the open state of the menu changes. This includes\n * anything like clicking the trigger, selecting a menu item, or dismissing\n * the menu with the mouse or keyboard.\n */\n onOpenChange: (open: boolean) => void;\n /**\n * The button that opens the menu. This must be a component that accepts a ref\n * and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * The menu contents.\n */\n children: ReactNode;\n /**\n * The side of the trigger on which to place the menu. Note that the menu may\n * still end up on a different side than the one you request if there isn't\n * enough space.\n * @default bottom\n */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /**\n * The edge along which the menu and trigger will be aligned.\n * @default center\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst DropdownMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <DropdownMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </DropdownMenuItem>\n);\n\n/**\n * A menu opened by pressing a button.\n */\nexport const Menu: FC<Props> = ({\n title,\n showTitle = true,\n open,\n onOpenChange,\n trigger,\n children: childrenProp,\n side = \"bottom\",\n align = \"center\",\n}) => {\n // Normally, the menu takes the form of a floating box. But on Android and\n // iOS, the menu should morph into a drawer\n const platform = getPlatform();\n const drawer = platform === \"android\" || platform === \"ios\";\n const context: MenuData = useMemo(\n () => ({\n MenuItemWrapper: drawer ? null : DropdownMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n return drawer ? (\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Trigger asChild>{trigger}</Drawer.Trigger>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerMenu.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n ) : (\n <Root open={open} onOpenChange={onOpenChange}>\n <Trigger asChild>{trigger}</Trigger>\n <Portal>\n <Content\n asChild\n side={side}\n align={align}\n sideOffset={8}\n onCloseAutoFocus={(event) => {\n // https://www.radix-ui.com/primitives/docs/components/dropdown-menu#content => onCloseAutoFocus\n // Prevent the default behavior of focusing the trigger when the menu closes\n event.preventDefault();\n }}\n >\n <FloatingMenu title={title} showTitle={showTitle}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["classnames"],"mappings":";;;;;;;;;;AAoEA,MAAM,0BAAoD,CAAC;AAAA,EACzD;AAAA,EACA;AACF,0BACG,kBAAiB,EAAA,UAAU,YAAY,QAAW,SAAO,MACvD,UACH;AAMK,MAAM,OAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AACV,MAAM;AAGJ,QAAM,WAAW,YAAY;AACvB,QAAA,SAAS,aAAa,aAAa,aAAa;AACtD,QAAM,UAAoB;AAAA,IACxB,OAAO;AAAA,MACL,iBAAiB,SAAS,OAAO;AAAA,MACjC;AAAA,IAAA;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AACA,QAAM,WACH,oBAAA,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAa,cAAA;AAGtD,SAAO,SACJ,qBAAA,OAAO,MAAP,EAAY,MAAY,cACvB,UAAA;AAAA,IAAA,oBAAC,OAAO,SAAP,EAAe,SAAO,MAAE,UAAQ,SAAA;AAAA,IACjC,qBAAC,OAAO,QAAP,EACC,UAAA;AAAA,MAAA,oBAAC,OAAO,SAAP,EAAe,WAAWA,WAAW,WAAW,EAAE,GAAG;AAAA,MACtD,oBAAC,OAAO,SAAP,EAAe,SAAO,MACrB,UAAC,oBAAA,YAAA,EAAW,OAAe,SAAS,CAAA,EACtC,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,IAEA,qBAAC,MAAK,EAAA,MAAY,cAChB,UAAA;AAAA,IAAC,oBAAA,SAAA,EAAQ,SAAO,MAAE,UAAQ,SAAA;AAAA,wBACzB,QACC,EAAA,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,kBAAkB,CAAC,UAAU;AAG3B,gBAAM,eAAe;AAAA,QACvB;AAAA,QAEA,UAAC,oBAAA,cAAA,EAAa,OAAc,WACzB,SACH,CAAA;AAAA,MAAA;AAAA,IAAA,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["/*\nCopyright 2023 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, { FC, ReactNode, useMemo } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n DropdownMenuItem,\n} from \"@radix-ui/react-dropdown-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerMenu from \"./DrawerMenu.module.css\";\nimport { MenuContext, MenuData, MenuItemWrapperProps } from \"./MenuContext\";\nimport { DrawerMenu } from \"./DrawerMenu\";\nimport { getPlatform } from \"../../utils/platform\";\n\ninterface Props {\n /**\n * The menu title. This can be hidden with `showTitle={false}` in which case it will only\n * be a label for screen readers.\n */\n title: string;\n /**\n * Controls whether the title is displayed (see `title` prop). Titles are only displayed on\n * web: on mobile, this parameter is ignored.\n */\n showTitle?: boolean;\n /**\n * Whether the menu is open.\n */\n open: boolean;\n /**\n * Event handler called when the open state of the menu changes. This includes\n * anything like clicking the trigger, selecting a menu item, or dismissing\n * the menu with the mouse or keyboard.\n */\n onOpenChange: (open: boolean) => void;\n /**\n * The button that opens the menu. This must be a component that accepts a ref\n * and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * The menu contents.\n */\n children: ReactNode;\n /**\n * The side of the trigger on which to place the menu. Note that the menu may\n * still end up on a different side than the one you request if there isn't\n * enough space.\n * @default bottom\n */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /**\n * The edge along which the menu and trigger will be aligned.\n * @default center\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst DropdownMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <DropdownMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </DropdownMenuItem>\n);\n\n/**\n * A menu opened by pressing a button.\n */\nexport const Menu: FC<Props> = ({\n title,\n showTitle = true,\n open,\n onOpenChange,\n trigger,\n children: childrenProp,\n side = \"bottom\",\n align = \"center\",\n}) => {\n // Normally, the menu takes the form of a floating box. But on Android and\n // iOS, the menu should morph into a drawer\n const platform = getPlatform();\n const drawer = platform === \"android\" || platform === \"ios\";\n const context: MenuData = useMemo(\n () => ({\n MenuItemWrapper: drawer ? null : DropdownMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n return drawer ? (\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Trigger asChild>{trigger}</Drawer.Trigger>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerMenu.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n ) : (\n <Root open={open} onOpenChange={onOpenChange}>\n <Trigger asChild>{trigger}</Trigger>\n <Portal>\n <Content asChild side={side} align={align} sideOffset={8}>\n <FloatingMenu title={title} showTitle={showTitle}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["classnames"],"mappings":";;;;;;;;;;AAoEA,MAAM,0BAAoD,CAAC;AAAA,EACzD;AAAA,EACA;AACF,0BACG,kBAAiB,EAAA,UAAU,YAAY,QAAW,SAAO,MACvD,UACH;AAMK,MAAM,OAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AACV,MAAM;AAGJ,QAAM,WAAW,YAAY;AACvB,QAAA,SAAS,aAAa,aAAa,aAAa;AACtD,QAAM,UAAoB;AAAA,IACxB,OAAO;AAAA,MACL,iBAAiB,SAAS,OAAO;AAAA,MACjC;AAAA,IAAA;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AACA,QAAM,WACH,oBAAA,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAa,cAAA;AAGtD,SAAO,SACJ,qBAAA,OAAO,MAAP,EAAY,MAAY,cACvB,UAAA;AAAA,IAAA,oBAAC,OAAO,SAAP,EAAe,SAAO,MAAE,UAAQ,SAAA;AAAA,IACjC,qBAAC,OAAO,QAAP,EACC,UAAA;AAAA,MAAA,oBAAC,OAAO,SAAP,EAAe,WAAWA,WAAW,WAAW,EAAE,GAAG;AAAA,MACtD,oBAAC,OAAO,SAAP,EAAe,SAAO,MACrB,UAAC,oBAAA,YAAA,EAAW,OAAe,SAAS,CAAA,EACtC,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,IAEA,qBAAC,MAAK,EAAA,MAAY,cAChB,UAAA;AAAA,IAAC,oBAAA,SAAA,EAAQ,SAAO,MAAE,UAAQ,SAAA;AAAA,wBACzB,QACC,EAAA,UAAA,oBAAC,SAAQ,EAAA,SAAO,MAAC,MAAY,OAAc,YAAY,GACrD,8BAAC,cAAa,EAAA,OAAc,WACzB,UACH,GACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vector-im/compound-web",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "Compound components for the Web",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,6 +50,7 @@
50
50
  },
51
51
  "homepage": "https://github.com/vector-im/compound-web#readme",
52
52
  "devDependencies": {
53
+ "@element-hq/element-web-playwright-common": "^1.4.2",
53
54
  "@fontsource/inconsolata": "^5.0.8",
54
55
  "@fontsource/inter": "^5.0.8",
55
56
  "@playwright/test": "^1.41.1",
@@ -74,7 +75,7 @@
74
75
  "@types/react": "^19.0.0",
75
76
  "@typescript-eslint/eslint-plugin": "^8.0.0",
76
77
  "@typescript-eslint/parser": "^8.0.0",
77
- "@vector-im/compound-design-tokens": "^4.0.0",
78
+ "@vector-im/compound-design-tokens": "^5.0.0",
78
79
  "@vitejs/plugin-react": "^4.0.4",
79
80
  "@vitest/coverage-v8": "^3.0.0",
80
81
  "browserslist-to-esbuild": "^2.0.0",
@@ -117,7 +118,7 @@
117
118
  "@fontsource/inconsolata": "^5",
118
119
  "@fontsource/inter": "^5",
119
120
  "@types/react": "*",
120
- "@vector-im/compound-design-tokens": ">=1.6.1 <5.0.0",
121
+ "@vector-im/compound-design-tokens": ">=1.6.1 <6.0.0",
121
122
  "react": "^18 || ^19.0.0"
122
123
  },
123
124
  "peerDependenciesMeta": {
@@ -10,6 +10,7 @@ import {
10
10
  ComponentRef,
11
11
  forwardRef,
12
12
  PropsWithChildren,
13
+ useId,
13
14
  } from "react";
14
15
  import { ToggleInput } from "../Toggle";
15
16
  import { Label } from "../../Label";
@@ -48,13 +49,15 @@ export const SettingsToggleInput = forwardRef<
48
49
  { className, label, helpMessage, disabledMessage, name, ...props },
49
50
  ref,
50
51
  ) {
52
+ const generatedId = useId();
53
+ const id = props.id ?? generatedId;
51
54
  const content = (
52
55
  <InlineField
53
56
  className={className}
54
57
  name={name}
55
- control={<ToggleInput ref={ref} {...props} />}
58
+ control={<ToggleInput id={id} ref={ref} {...props} />}
56
59
  >
57
- <Label>{label}</Label>
60
+ <Label htmlFor={id}>{label}</Label>
58
61
  {helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}
59
62
  {disabledMessage && props.disabled && (
60
63
  <HelpMessage>{disabledMessage}</HelpMessage>
@@ -34,7 +34,13 @@ export const ToggleInput = forwardRef<
34
34
  const classes = classnames(styles.container, className);
35
35
  return (
36
36
  <div className={classes}>
37
- <input ref={ref} className={styles.input} {...props} type="checkbox" />
37
+ <input
38
+ role="switch"
39
+ ref={ref}
40
+ className={styles.input}
41
+ {...props}
42
+ type="checkbox"
43
+ />
38
44
  <div className={styles.ui} />
39
45
  </div>
40
46
  );
@@ -117,17 +117,7 @@ export const Menu: FC<Props> = ({
117
117
  <Root open={open} onOpenChange={onOpenChange}>
118
118
  <Trigger asChild>{trigger}</Trigger>
119
119
  <Portal>
120
- <Content
121
- asChild
122
- side={side}
123
- align={align}
124
- sideOffset={8}
125
- onCloseAutoFocus={(event) => {
126
- // https://www.radix-ui.com/primitives/docs/components/dropdown-menu#content => onCloseAutoFocus
127
- // Prevent the default behavior of focusing the trigger when the menu closes
128
- event.preventDefault();
129
- }}
130
- >
120
+ <Content asChild side={side} align={align} sideOffset={8}>
131
121
  <FloatingMenu title={title} showTitle={showTitle}>
132
122
  {children}
133
123
  </FloatingMenu>