@vector-im/compound-web 8.0.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.cjs +31 -0
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.cjs.map +1 -0
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.d.ts +31 -0
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.d.ts.map +1 -0
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.js +31 -0
- package/dist/components/Form/Controls/SettingsToggle/SettingsToggle.js.map +1 -0
- package/dist/components/Form/Controls/SettingsToggle/index.d.ts +2 -0
- package/dist/components/Form/Controls/SettingsToggle/index.d.ts.map +1 -0
- package/dist/components/Form/Controls/index.d.ts +1 -0
- package/dist/components/Form/Controls/index.d.ts.map +1 -1
- package/dist/components/Form/index.cjs +3 -0
- package/dist/components/Form/index.cjs.map +1 -1
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/index.js +3 -0
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Menu/ContextMenu.cjs +2 -1
- package/dist/components/Menu/ContextMenu.cjs.map +1 -1
- package/dist/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/components/Menu/ContextMenu.js +2 -1
- package/dist/components/Menu/ContextMenu.js.map +1 -1
- package/dist/components/Menu/ContextMenu.module.css.cjs +9 -0
- package/dist/components/Menu/ContextMenu.module.css.cjs.map +1 -0
- package/dist/components/Menu/ContextMenu.module.css.js +9 -0
- package/dist/components/Menu/ContextMenu.module.css.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/style.css.css +10 -0
- package/package.json +1 -1
- package/src/components/Form/Controls/SettingsToggle/SettingsToggle.tsx +79 -0
- package/src/components/Form/Controls/SettingsToggle/index.ts +10 -0
- package/src/components/Form/Controls/index.ts +1 -0
- package/src/components/Form/index.ts +3 -1
- package/src/components/Menu/ContextMenu.module.css +10 -0
- package/src/components/Menu/ContextMenu.tsx +2 -1
- package/src/index.ts +2 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const Label = require("../../Label.cjs");
|
|
6
|
+
const Message = require("../../Message.cjs");
|
|
7
|
+
const InlineField = require("../../InlineField.cjs");
|
|
8
|
+
const reactForm = require("@radix-ui/react-form");
|
|
9
|
+
const Toggle = require("../Toggle/Toggle.cjs");
|
|
10
|
+
const SettingsToggleInput = React.forwardRef(function Toggle$1({ className, label, helpMessage, disabledMessage, name, ...props }, ref) {
|
|
11
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12
|
+
InlineField.InlineField,
|
|
13
|
+
{
|
|
14
|
+
className,
|
|
15
|
+
name,
|
|
16
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(Toggle.ToggleInput, { ref, ...props }),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label.Label, { children: label }),
|
|
19
|
+
helpMessage && /* @__PURE__ */ jsxRuntime.jsx(Message.HelpMessage, { children: helpMessage }),
|
|
20
|
+
disabledMessage && props.disabled && /* @__PURE__ */ jsxRuntime.jsx(Message.HelpMessage, { children: disabledMessage })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
return content;
|
|
25
|
+
});
|
|
26
|
+
const SettingsToggleControl = React.forwardRef(function ToggleControl(props, ref) {
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactForm.Control, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsToggleInput, { ref, ...props }) });
|
|
28
|
+
});
|
|
29
|
+
exports.SettingsToggleControl = SettingsToggleControl;
|
|
30
|
+
exports.SettingsToggleInput = SettingsToggleInput;
|
|
31
|
+
//# sourceMappingURL=SettingsToggle.cjs.map
|
|
@@ -0,0 +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;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentProps, PropsWithChildren, default as React } from 'react';
|
|
2
|
+
import { ToggleInput } from '../Toggle';
|
|
3
|
+
type SettingsToggleProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The CSS class name for the containing field.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The field name.
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional help text to display below the setting.
|
|
15
|
+
*/
|
|
16
|
+
helpMessage?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional help text to display below the setting.
|
|
19
|
+
*/
|
|
20
|
+
disabledMessage?: string;
|
|
21
|
+
} & Omit<ComponentProps<typeof ToggleInput>, "type">;
|
|
22
|
+
/**
|
|
23
|
+
* A toggle component.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SettingsToggleInput: React.ForwardRefExoticComponent<Omit<PropsWithChildren<SettingsToggleProps>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
26
|
+
/**
|
|
27
|
+
* A styled checkbox input wrapped in a `Control` component, for use in Radix forms.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SettingsToggleControl: React.ForwardRefExoticComponent<Omit<Omit<PropsWithChildren<SettingsToggleProps>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=SettingsToggle.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Label } from "../../Label.js";
|
|
4
|
+
import { HelpMessage } from "../../Message.js";
|
|
5
|
+
import { InlineField } from "../../InlineField.js";
|
|
6
|
+
import { Control } from "@radix-ui/react-form";
|
|
7
|
+
import { ToggleInput } from "../Toggle/Toggle.js";
|
|
8
|
+
const SettingsToggleInput = forwardRef(function Toggle({ className, label, helpMessage, disabledMessage, name, ...props }, ref) {
|
|
9
|
+
const content = /* @__PURE__ */ jsxs(
|
|
10
|
+
InlineField,
|
|
11
|
+
{
|
|
12
|
+
className,
|
|
13
|
+
name,
|
|
14
|
+
control: /* @__PURE__ */ jsx(ToggleInput, { ref, ...props }),
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
17
|
+
helpMessage && /* @__PURE__ */ jsx(HelpMessage, { children: helpMessage }),
|
|
18
|
+
disabledMessage && props.disabled && /* @__PURE__ */ jsx(HelpMessage, { children: disabledMessage })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
return content;
|
|
23
|
+
});
|
|
24
|
+
const SettingsToggleControl = forwardRef(function ToggleControl(props, ref) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Control, { asChild: true, children: /* @__PURE__ */ jsx(SettingsToggleInput, { ref, ...props }) });
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
SettingsToggleControl,
|
|
29
|
+
SettingsToggleInput
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=SettingsToggle.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Controls/SettingsToggle/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -6,4 +6,5 @@ export { CheckboxControl, CheckboxInput } from './Checkbox';
|
|
|
6
6
|
export { RadioControl, RadioInput } from './Radio';
|
|
7
7
|
export { ToggleControl, ToggleInput } from './Toggle';
|
|
8
8
|
export { EditInPlace } from './EditInPlace';
|
|
9
|
+
export { SettingsToggleInput, SettingsToggleControl } from './SettingsToggle';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Controls/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Controls/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -15,6 +15,7 @@ const Checkbox = require("./Controls/Checkbox/Checkbox.cjs");
|
|
|
15
15
|
const Radio = require("./Controls/Radio/Radio.cjs");
|
|
16
16
|
const Toggle = require("./Controls/Toggle/Toggle.cjs");
|
|
17
17
|
const EditInPlace = require("./Controls/EditInPlace/EditInPlace.cjs");
|
|
18
|
+
const SettingsToggle = require("./Controls/SettingsToggle/SettingsToggle.cjs");
|
|
18
19
|
exports.Root = Root.Root;
|
|
19
20
|
exports.Field = Field.Field;
|
|
20
21
|
exports.InlineField = InlineField.InlineField;
|
|
@@ -47,4 +48,6 @@ exports.RadioInput = Radio.RadioInput;
|
|
|
47
48
|
exports.ToggleControl = Toggle.ToggleControl;
|
|
48
49
|
exports.ToggleInput = Toggle.ToggleInput;
|
|
49
50
|
exports.EditInPlace = EditInPlace.EditInPlace;
|
|
51
|
+
exports.SettingsToggleControl = SettingsToggle.SettingsToggleControl;
|
|
52
|
+
exports.SettingsToggleInput = SettingsToggle.SettingsToggleInput;
|
|
50
53
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ActionControl, ActionInput, PasswordControl, PasswordInput, TextControl, TextInput, MFAControl, MFAInput, CheckboxControl, CheckboxInput, RadioControl, RadioInput, ToggleControl, ToggleInput, EditInPlace, } from './Controls';
|
|
1
|
+
export { ActionControl, ActionInput, PasswordControl, PasswordInput, TextControl, TextInput, MFAControl, MFAInput, CheckboxControl, CheckboxInput, RadioControl, RadioInput, ToggleControl, ToggleInput, EditInPlace, SettingsToggleInput, SettingsToggleControl, } from './Controls';
|
|
2
2
|
export { Root } from './Root';
|
|
3
3
|
export { Field } from './Field';
|
|
4
4
|
export { InlineField } from './InlineField';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -13,6 +13,7 @@ import { CheckboxControl, CheckboxInput } from "./Controls/Checkbox/Checkbox.js"
|
|
|
13
13
|
import { RadioControl, RadioInput } from "./Controls/Radio/Radio.js";
|
|
14
14
|
import { ToggleControl, ToggleInput } from "./Controls/Toggle/Toggle.js";
|
|
15
15
|
import { EditInPlace } from "./Controls/EditInPlace/EditInPlace.js";
|
|
16
|
+
import { SettingsToggleControl, SettingsToggleInput } from "./Controls/SettingsToggle/SettingsToggle.js";
|
|
16
17
|
export {
|
|
17
18
|
ActionControl,
|
|
18
19
|
ActionInput,
|
|
@@ -33,6 +34,8 @@ export {
|
|
|
33
34
|
RadioControl,
|
|
34
35
|
RadioInput,
|
|
35
36
|
Root,
|
|
37
|
+
SettingsToggleControl,
|
|
38
|
+
SettingsToggleInput,
|
|
36
39
|
Submit,
|
|
37
40
|
SuccessMessage,
|
|
38
41
|
TextControl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -7,6 +7,7 @@ const FloatingMenu = require("./FloatingMenu.cjs");
|
|
|
7
7
|
const vaul = require("vaul");
|
|
8
8
|
const classNames = require("classnames");
|
|
9
9
|
const DrawerMenu_module = require("./DrawerMenu.module.css.cjs");
|
|
10
|
+
const ContextMenu_module = require("./ContextMenu.module.css.cjs");
|
|
10
11
|
const MenuContext = require("./MenuContext.cjs");
|
|
11
12
|
const DrawerMenu = require("./DrawerMenu.cjs");
|
|
12
13
|
const platform = require("../../utils/platform.cjs");
|
|
@@ -57,7 +58,7 @@ const ContextMenu = ({
|
|
|
57
58
|
] }) })
|
|
58
59
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(reactContextMenu.Root, { onOpenChange, children: [
|
|
59
60
|
trigger,
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactContextMenu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(reactContextMenu.Content, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(FloatingMenu.FloatingMenu, { showTitle, title, children }) }) })
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactContextMenu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(reactContextMenu.Content, { asChild: true, className: classNames(ContextMenu_module.default.content), children: /* @__PURE__ */ jsxRuntime.jsx(FloatingMenu.FloatingMenu, { showTitle, title, children }) }) })
|
|
61
62
|
] });
|
|
62
63
|
};
|
|
63
64
|
exports.ContextMenu = ContextMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.cjs","sources":["../../../src/components/Menu/ContextMenu.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, useCallback, useMemo, useState } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n ContextMenuItem,\n} from \"@radix-ui/react-context-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerStyles 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.\n */\n title: string;\n /**\n * Wether the title is displayed.\n * @default true\n */\n showTitle?: boolean;\n /**\n * Event handler called when the open state of the menu changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger that can be right-clicked or long-pressed to open the menu.\n * This must be a component that accepts a ref and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * Whether the functionality of this menu is available through some other\n * keyboard-accessible means. Preferably this should be true, because context\n * menus are potentially difficult to discover, but if false the trigger will\n * become focusable so that it can be opened via keyboard navigation.\n */\n hasAccessibleAlternative: boolean;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\nconst ContextMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <ContextMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </ContextMenuItem>\n);\n\n/**\n * A menu opened by right-clicking or long-pressing another UI element.\n */\nexport const ContextMenu: FC<Props> = ({\n title,\n showTitle = true,\n onOpenChange: onOpenChangeProp,\n trigger: triggerProp,\n hasAccessibleAlternative,\n children: childrenProp,\n}) => {\n const [open, setOpen] = useState(false);\n const onOpenChange = useCallback(\n (value: boolean) => {\n setOpen(value);\n onOpenChangeProp?.(value);\n },\n [setOpen, onOpenChangeProp],\n );\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 : ContextMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n const trigger = (\n <Trigger\n aria-haspopup=\"menu\"\n tabIndex={hasAccessibleAlternative ? undefined : 0}\n asChild\n >\n {triggerProp}\n </Trigger>\n );\n\n // This is a small hack: Vaul drawers only support buttons as triggers, so\n // we end up mounting an empty Radix context menu tree alongside the\n // drawer tree, purely so we can use its Trigger component (which supports\n // touch for free). The resulting behavior and DOM tree looks exactly the\n // same as if Vaul provided a long-press trigger of its own, so I think\n // this is fine.\n return drawer ? (\n <>\n <Root onOpenChange={onOpenChange}>{trigger}</Root>\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerStyles.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n </>\n ) : (\n <Root onOpenChange={onOpenChange}>\n {trigger}\n <Portal>\n <Content asChild>\n <FloatingMenu showTitle={showTitle} title={title}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["ContextMenuItem","useState","useCallback","platform","getPlatform","useMemo","jsx","MenuContext","Trigger","jsxs","Fragment","Root","Drawer","classnames","drawerStyles","DrawerMenu","Portal","Content","FloatingMenu"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenu.cjs","sources":["../../../src/components/Menu/ContextMenu.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, useCallback, useMemo, useState } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n ContextMenuItem,\n} from \"@radix-ui/react-context-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerStyles from \"./DrawerMenu.module.css\";\nimport contextStyles from \"./ContextMenu.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.\n */\n title: string;\n /**\n * Wether the title is displayed.\n * @default true\n */\n showTitle?: boolean;\n /**\n * Event handler called when the open state of the menu changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger that can be right-clicked or long-pressed to open the menu.\n * This must be a component that accepts a ref and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * Whether the functionality of this menu is available through some other\n * keyboard-accessible means. Preferably this should be true, because context\n * menus are potentially difficult to discover, but if false the trigger will\n * become focusable so that it can be opened via keyboard navigation.\n */\n hasAccessibleAlternative: boolean;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\nconst ContextMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <ContextMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </ContextMenuItem>\n);\n\n/**\n * A menu opened by right-clicking or long-pressing another UI element.\n */\nexport const ContextMenu: FC<Props> = ({\n title,\n showTitle = true,\n onOpenChange: onOpenChangeProp,\n trigger: triggerProp,\n hasAccessibleAlternative,\n children: childrenProp,\n}) => {\n const [open, setOpen] = useState(false);\n const onOpenChange = useCallback(\n (value: boolean) => {\n setOpen(value);\n onOpenChangeProp?.(value);\n },\n [setOpen, onOpenChangeProp],\n );\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 : ContextMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n const trigger = (\n <Trigger\n aria-haspopup=\"menu\"\n tabIndex={hasAccessibleAlternative ? undefined : 0}\n asChild\n >\n {triggerProp}\n </Trigger>\n );\n\n // This is a small hack: Vaul drawers only support buttons as triggers, so\n // we end up mounting an empty Radix context menu tree alongside the\n // drawer tree, purely so we can use its Trigger component (which supports\n // touch for free). The resulting behavior and DOM tree looks exactly the\n // same as if Vaul provided a long-press trigger of its own, so I think\n // this is fine.\n return drawer ? (\n <>\n <Root onOpenChange={onOpenChange}>{trigger}</Root>\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerStyles.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n </>\n ) : (\n <Root onOpenChange={onOpenChange}>\n {trigger}\n <Portal>\n <Content asChild className={classnames(contextStyles.content)}>\n <FloatingMenu showTitle={showTitle} title={title}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["ContextMenuItem","useState","useCallback","platform","getPlatform","useMemo","jsx","MenuContext","Trigger","jsxs","Fragment","Root","Drawer","classnames","drawerStyles","DrawerMenu","Portal","Content","contextStyles","FloatingMenu"],"mappings":";;;;;;;;;;;;;AAyDA,MAAM,yBAAmD,CAAC;AAAA,EACxD;AAAA,EACA;AACF,qCACGA,kCAAgB,EAAA,UAAU,YAAY,QAAW,SAAO,MACtD,UACH;AAMK,MAAM,cAAyB,CAAC;AAAA,EACrC;AAAA,EACA,YAAY;AAAA,EACZ,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N,2BAAA,KAAAE,iBAAA,MAAA,EAAK,cACH,UAAA;AAAA,IAAA;AAAA,mCACAK,iBAAAA,QACC,EAAA,UAAAV,2BAAA,IAACW,iBAAQ,SAAA,EAAA,SAAO,MAAC,WAAWJ,WAAWK,mBAAc,QAAA,OAAO,GAC1D,UAACZ,2BAAAA,IAAAa,aAAA,cAAA,EAAa,WAAsB,OACjC,UACH,GACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/ContextMenu.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/ContextMenu.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAiB7E,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAWD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,KAAK,CAwEjC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { FloatingMenu } from "./FloatingMenu.js";
|
|
|
5
5
|
import { Drawer } from "vaul";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import drawerMenu from "./DrawerMenu.module.css.js";
|
|
8
|
+
import contextStyles from "./ContextMenu.module.css.js";
|
|
8
9
|
import { MenuContext } from "./MenuContext.js";
|
|
9
10
|
import { DrawerMenu } from "./DrawerMenu.js";
|
|
10
11
|
import { getPlatform } from "../../utils/platform.js";
|
|
@@ -55,7 +56,7 @@ const ContextMenu = ({
|
|
|
55
56
|
] }) })
|
|
56
57
|
] }) : /* @__PURE__ */ jsxs(Root, { onOpenChange, children: [
|
|
57
58
|
trigger,
|
|
58
|
-
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { asChild: true, children: /* @__PURE__ */ jsx(FloatingMenu, { showTitle, title, children }) }) })
|
|
59
|
+
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { asChild: true, className: classNames(contextStyles.content), children: /* @__PURE__ */ jsx(FloatingMenu, { showTitle, title, children }) }) })
|
|
59
60
|
] });
|
|
60
61
|
};
|
|
61
62
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sources":["../../../src/components/Menu/ContextMenu.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, useCallback, useMemo, useState } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n ContextMenuItem,\n} from \"@radix-ui/react-context-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerStyles 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.\n */\n title: string;\n /**\n * Wether the title is displayed.\n * @default true\n */\n showTitle?: boolean;\n /**\n * Event handler called when the open state of the menu changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger that can be right-clicked or long-pressed to open the menu.\n * This must be a component that accepts a ref and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * Whether the functionality of this menu is available through some other\n * keyboard-accessible means. Preferably this should be true, because context\n * menus are potentially difficult to discover, but if false the trigger will\n * become focusable so that it can be opened via keyboard navigation.\n */\n hasAccessibleAlternative: boolean;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\nconst ContextMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <ContextMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </ContextMenuItem>\n);\n\n/**\n * A menu opened by right-clicking or long-pressing another UI element.\n */\nexport const ContextMenu: FC<Props> = ({\n title,\n showTitle = true,\n onOpenChange: onOpenChangeProp,\n trigger: triggerProp,\n hasAccessibleAlternative,\n children: childrenProp,\n}) => {\n const [open, setOpen] = useState(false);\n const onOpenChange = useCallback(\n (value: boolean) => {\n setOpen(value);\n onOpenChangeProp?.(value);\n },\n [setOpen, onOpenChangeProp],\n );\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 : ContextMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n const trigger = (\n <Trigger\n aria-haspopup=\"menu\"\n tabIndex={hasAccessibleAlternative ? undefined : 0}\n asChild\n >\n {triggerProp}\n </Trigger>\n );\n\n // This is a small hack: Vaul drawers only support buttons as triggers, so\n // we end up mounting an empty Radix context menu tree alongside the\n // drawer tree, purely so we can use its Trigger component (which supports\n // touch for free). The resulting behavior and DOM tree looks exactly the\n // same as if Vaul provided a long-press trigger of its own, so I think\n // this is fine.\n return drawer ? (\n <>\n <Root onOpenChange={onOpenChange}>{trigger}</Root>\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerStyles.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n </>\n ) : (\n <Root onOpenChange={onOpenChange}>\n {trigger}\n <Portal>\n <Content asChild>\n <FloatingMenu showTitle={showTitle} title={title}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["classnames","drawerStyles"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","sources":["../../../src/components/Menu/ContextMenu.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, useCallback, useMemo, useState } from \"react\";\nimport {\n Root,\n Trigger,\n Portal,\n Content,\n ContextMenuItem,\n} from \"@radix-ui/react-context-menu\";\nimport { FloatingMenu } from \"./FloatingMenu\";\nimport { Drawer } from \"vaul\";\nimport classnames from \"classnames\";\nimport drawerStyles from \"./DrawerMenu.module.css\";\nimport contextStyles from \"./ContextMenu.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.\n */\n title: string;\n /**\n * Wether the title is displayed.\n * @default true\n */\n showTitle?: boolean;\n /**\n * Event handler called when the open state of the menu changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger that can be right-clicked or long-pressed to open the menu.\n * This must be a component that accepts a ref and spreads props.\n * https://www.radix-ui.com/primitives/docs/guides/composition\n */\n trigger: ReactNode;\n /**\n * Whether the functionality of this menu is available through some other\n * keyboard-accessible means. Preferably this should be true, because context\n * menus are potentially difficult to discover, but if false the trigger will\n * become focusable so that it can be opened via keyboard navigation.\n */\n hasAccessibleAlternative: boolean;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\nconst ContextMenuItemWrapper: FC<MenuItemWrapperProps> = ({\n onSelect,\n children,\n}) => (\n <ContextMenuItem onSelect={onSelect ?? undefined} asChild>\n {children}\n </ContextMenuItem>\n);\n\n/**\n * A menu opened by right-clicking or long-pressing another UI element.\n */\nexport const ContextMenu: FC<Props> = ({\n title,\n showTitle = true,\n onOpenChange: onOpenChangeProp,\n trigger: triggerProp,\n hasAccessibleAlternative,\n children: childrenProp,\n}) => {\n const [open, setOpen] = useState(false);\n const onOpenChange = useCallback(\n (value: boolean) => {\n setOpen(value);\n onOpenChangeProp?.(value);\n },\n [setOpen, onOpenChangeProp],\n );\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 : ContextMenuItemWrapper,\n onOpenChange,\n }),\n [onOpenChange],\n );\n const children = (\n <MenuContext.Provider value={context}>{childrenProp}</MenuContext.Provider>\n );\n\n const trigger = (\n <Trigger\n aria-haspopup=\"menu\"\n tabIndex={hasAccessibleAlternative ? undefined : 0}\n asChild\n >\n {triggerProp}\n </Trigger>\n );\n\n // This is a small hack: Vaul drawers only support buttons as triggers, so\n // we end up mounting an empty Radix context menu tree alongside the\n // drawer tree, purely so we can use its Trigger component (which supports\n // touch for free). The resulting behavior and DOM tree looks exactly the\n // same as if Vaul provided a long-press trigger of its own, so I think\n // this is fine.\n return drawer ? (\n <>\n <Root onOpenChange={onOpenChange}>{trigger}</Root>\n <Drawer.Root open={open} onOpenChange={onOpenChange}>\n <Drawer.Portal>\n <Drawer.Overlay className={classnames(drawerStyles.bg)} />\n <Drawer.Content asChild>\n <DrawerMenu title={title}>{children}</DrawerMenu>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n </>\n ) : (\n <Root onOpenChange={onOpenChange}>\n {trigger}\n <Portal>\n <Content asChild className={classnames(contextStyles.content)}>\n <FloatingMenu showTitle={showTitle} title={title}>\n {children}\n </FloatingMenu>\n </Content>\n </Portal>\n </Root>\n );\n};\n"],"names":["classnames","drawerStyles"],"mappings":";;;;;;;;;;;AAyDA,MAAM,yBAAmD,CAAC;AAAA,EACxD;AAAA,EACA;AACF,0BACG,iBAAgB,EAAA,UAAU,YAAY,QAAW,SAAO,MACtD,UACH;AAMK,MAAM,cAAyB,CAAC;AAAA,EACrC;AAAA,EACA,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,SAAS;AAAA,EACT;AAAA,EACA,UAAU;AACZ,MAAM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,eAAe;AAAA,IACnB,CAAC,UAAmB;AAClB,cAAQ,KAAK;AACb,yBAAmB,KAAK;AAAA,IAC1B;AAAA,IACA,CAAC,SAAS,gBAAgB;AAAA,EAC5B;AAIA,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,QAAM,UACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,iBAAc;AAAA,MACd,UAAU,2BAA2B,SAAY;AAAA,MACjD,SAAO;AAAA,MAEN,UAAA;AAAA,IAAA;AAAA,EACH;AASF,SAAO,SAEH,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,oBAAA,MAAA,EAAK,cAA6B,UAAQ,QAAA,CAAA;AAAA,IAC3C,oBAAC,OAAO,MAAP,EAAY,MAAY,cACvB,UAAA,qBAAC,OAAO,QAAP,EACC,UAAA;AAAA,MAAA,oBAAC,OAAO,SAAP,EAAe,WAAWA,WAAWC,WAAa,EAAE,GAAG;AAAA,MACxD,oBAAC,OAAO,SAAP,EAAe,SAAO,MACrB,UAAC,oBAAA,YAAA,EAAW,OAAe,SAAS,CAAA,EACtC,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EACF,EAAA,CAAA,IAEC,qBAAA,MAAA,EAAK,cACH,UAAA;AAAA,IAAA;AAAA,wBACA,QACC,EAAA,UAAA,oBAAC,SAAQ,EAAA,SAAO,MAAC,WAAWD,WAAW,cAAc,OAAO,GAC1D,UAAC,oBAAA,cAAA,EAAa,WAAsB,OACjC,UACH,GACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const content = "_content_vnv5k_8";
|
|
4
|
+
const contextStyles = {
|
|
5
|
+
content
|
|
6
|
+
};
|
|
7
|
+
exports.content = content;
|
|
8
|
+
exports.default = contextStyles;
|
|
9
|
+
//# sourceMappingURL=ContextMenu.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ const Field = require("./components/Form/Field.cjs");
|
|
|
57
57
|
const InlineField = require("./components/Form/InlineField.cjs");
|
|
58
58
|
const Label = require("./components/Form/Label.cjs");
|
|
59
59
|
const EditInPlace = require("./components/Form/Controls/EditInPlace/EditInPlace.cjs");
|
|
60
|
+
const SettingsToggle = require("./components/Form/Controls/SettingsToggle/SettingsToggle.cjs");
|
|
60
61
|
exports.Alert = Alert.Alert;
|
|
61
62
|
exports.Avatar = Avatar.Avatar;
|
|
62
63
|
exports.AvatarStack = AvatarStack.AvatarStack;
|
|
@@ -138,4 +139,6 @@ exports.Field = Field.Field;
|
|
|
138
139
|
exports.InlineField = InlineField.InlineField;
|
|
139
140
|
exports.Label = Label.Label;
|
|
140
141
|
exports.EditInPlace = EditInPlace.EditInPlace;
|
|
142
|
+
exports.SettingsToggleControl = SettingsToggle.SettingsToggleControl;
|
|
143
|
+
exports.SettingsToggleInput = SettingsToggle.SettingsToggleInput;
|
|
141
144
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export { Breadcrumb } from './components/Breadcrumb';
|
|
|
34
34
|
export { VisualList, VisualListItem } from './components/VisualList';
|
|
35
35
|
export { ChatFilter } from './components/ChatFilter';
|
|
36
36
|
export { UnreadCounter, Pill, Unread } from './components/ActivityMarker';
|
|
37
|
-
export { TextControl, TextControl as Control, TextInput, ActionControl, ActionInput, PasswordControl, PasswordInput, MFAControl, MFAInput, CheckboxControl, CheckboxInput, CheckboxInput as Checkbox, RadioControl, RadioInput, RadioInput as Radio, ToggleControl, ToggleInput, ToggleInput as Toggle, Root, Submit, Message, ErrorMessage, HelpMessage, ValidityState, Field, InlineField, Label, EditInPlace, } from './components/Form';
|
|
37
|
+
export { TextControl, TextControl as Control, TextInput, ActionControl, ActionInput, PasswordControl, PasswordInput, MFAControl, MFAInput, CheckboxControl, CheckboxInput, CheckboxInput as Checkbox, RadioControl, RadioInput, RadioInput as Radio, ToggleControl, ToggleInput, ToggleInput as Toggle, Root, Submit, Message, ErrorMessage, HelpMessage, ValidityState, Field, InlineField, Label, EditInPlace, SettingsToggleInput, SettingsToggleControl, } from './components/Form';
|
|
38
38
|
export * as Form from './components/Form';
|
|
39
39
|
/**
|
|
40
40
|
* Export utility functions
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EACL,OAAO,EACP,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,GACH,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,wBA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K,IAAI,MAAM,mBAAmB,CAAC;AAE1C;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ import { Field } from "./components/Form/Field.js";
|
|
|
55
55
|
import { InlineField } from "./components/Form/InlineField.js";
|
|
56
56
|
import { Label } from "./components/Form/Label.js";
|
|
57
57
|
import { EditInPlace } from "./components/Form/Controls/EditInPlace/EditInPlace.js";
|
|
58
|
+
import { SettingsToggleControl, SettingsToggleInput } from "./components/Form/Controls/SettingsToggle/SettingsToggle.js";
|
|
58
59
|
export {
|
|
59
60
|
ActionControl,
|
|
60
61
|
ActionInput,
|
|
@@ -113,6 +114,8 @@ export {
|
|
|
113
114
|
Root,
|
|
114
115
|
Search,
|
|
115
116
|
Separator,
|
|
117
|
+
SettingsToggleControl,
|
|
118
|
+
SettingsToggleInput,
|
|
116
119
|
Submit,
|
|
117
120
|
Text,
|
|
118
121
|
TextControl2 as TextControl,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/style.css.css
CHANGED
|
@@ -779,6 +779,16 @@ Please see LICENSE files in the repository root for full details.
|
|
|
779
779
|
background: var(--cpd-color-icon-secondary);
|
|
780
780
|
border-radius: var(--cpd-radius-pill-effect);
|
|
781
781
|
}
|
|
782
|
+
/*
|
|
783
|
+
* Copyright 2025 New Vector Ltd
|
|
784
|
+
*
|
|
785
|
+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
786
|
+
* Please see LICENSE files in the repository root for full details.
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
._content_vnv5k_8[data-state="closed"] {
|
|
790
|
+
animation: none;
|
|
791
|
+
}
|
|
782
792
|
/*
|
|
783
793
|
Copyright 2023 New Vector Ltd.
|
|
784
794
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 New Vector Ltd.
|
|
3
|
+
|
|
4
|
+
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
5
|
+
Please see LICENSE files in the repository root for full details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ComponentProps,
|
|
10
|
+
ComponentRef,
|
|
11
|
+
forwardRef,
|
|
12
|
+
PropsWithChildren,
|
|
13
|
+
} from "react";
|
|
14
|
+
import { ToggleInput } from "../Toggle";
|
|
15
|
+
import { Label } from "../../Label";
|
|
16
|
+
import { HelpMessage } from "../../Message";
|
|
17
|
+
import { InlineField } from "../../InlineField";
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { Control } from "@radix-ui/react-form";
|
|
20
|
+
|
|
21
|
+
type SettingsToggleProps = {
|
|
22
|
+
/**
|
|
23
|
+
* The CSS class name for the containing field.
|
|
24
|
+
*/
|
|
25
|
+
className?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The field name.
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional help text to display below the setting.
|
|
33
|
+
*/
|
|
34
|
+
helpMessage?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional help text to display below the setting.
|
|
37
|
+
*/
|
|
38
|
+
disabledMessage?: string;
|
|
39
|
+
} & Omit<ComponentProps<typeof ToggleInput>, "type">;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A toggle component.
|
|
43
|
+
*/
|
|
44
|
+
export const SettingsToggleInput = forwardRef<
|
|
45
|
+
HTMLInputElement,
|
|
46
|
+
PropsWithChildren<SettingsToggleProps>
|
|
47
|
+
>(function Toggle(
|
|
48
|
+
{ className, label, helpMessage, disabledMessage, name, ...props },
|
|
49
|
+
ref,
|
|
50
|
+
) {
|
|
51
|
+
const content = (
|
|
52
|
+
<InlineField
|
|
53
|
+
className={className}
|
|
54
|
+
name={name}
|
|
55
|
+
control={<ToggleInput ref={ref} {...props} />}
|
|
56
|
+
>
|
|
57
|
+
<Label>{label}</Label>
|
|
58
|
+
{helpMessage && <HelpMessage>{helpMessage}</HelpMessage>}
|
|
59
|
+
{disabledMessage && props.disabled && (
|
|
60
|
+
<HelpMessage>{disabledMessage}</HelpMessage>
|
|
61
|
+
)}
|
|
62
|
+
</InlineField>
|
|
63
|
+
);
|
|
64
|
+
return content;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A styled checkbox input wrapped in a `Control` component, for use in Radix forms.
|
|
69
|
+
*/
|
|
70
|
+
export const SettingsToggleControl = forwardRef<
|
|
71
|
+
ComponentRef<typeof SettingsToggleInput>,
|
|
72
|
+
ComponentProps<typeof SettingsToggleInput>
|
|
73
|
+
>(function ToggleControl(props, ref) {
|
|
74
|
+
return (
|
|
75
|
+
<Control asChild>
|
|
76
|
+
<SettingsToggleInput ref={ref} {...props} />
|
|
77
|
+
</Control>
|
|
78
|
+
);
|
|
79
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 New Vector Ltd.
|
|
3
|
+
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
4
|
+
Copyright 2023 New Vector Ltd
|
|
5
|
+
|
|
6
|
+
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
7
|
+
Please see LICENSE files in the repository root for full details.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { SettingsToggleControl, SettingsToggleInput } from "./SettingsToggle";
|
|
@@ -15,3 +15,4 @@ export { CheckboxControl, CheckboxInput } from "./Checkbox";
|
|
|
15
15
|
export { RadioControl, RadioInput } from "./Radio";
|
|
16
16
|
export { ToggleControl, ToggleInput } from "./Toggle";
|
|
17
17
|
export { EditInPlace } from "./EditInPlace";
|
|
18
|
+
export { SettingsToggleInput, SettingsToggleControl } from "./SettingsToggle";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2023 New Vector Ltd.
|
|
2
|
+
Copyright 2023-2025 New Vector Ltd.
|
|
3
3
|
|
|
4
4
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
@@ -21,6 +21,8 @@ export {
|
|
|
21
21
|
ToggleControl,
|
|
22
22
|
ToggleInput,
|
|
23
23
|
EditInPlace,
|
|
24
|
+
SettingsToggleInput,
|
|
25
|
+
SettingsToggleControl,
|
|
24
26
|
} from "./Controls";
|
|
25
27
|
|
|
26
28
|
export { Root } from "./Root";
|
|
@@ -17,6 +17,7 @@ import { FloatingMenu } from "./FloatingMenu";
|
|
|
17
17
|
import { Drawer } from "vaul";
|
|
18
18
|
import classnames from "classnames";
|
|
19
19
|
import drawerStyles from "./DrawerMenu.module.css";
|
|
20
|
+
import contextStyles from "./ContextMenu.module.css";
|
|
20
21
|
import { MenuContext, MenuData, MenuItemWrapperProps } from "./MenuContext";
|
|
21
22
|
import { DrawerMenu } from "./DrawerMenu";
|
|
22
23
|
import { getPlatform } from "../../utils/platform";
|
|
@@ -130,7 +131,7 @@ export const ContextMenu: FC<Props> = ({
|
|
|
130
131
|
<Root onOpenChange={onOpenChange}>
|
|
131
132
|
{trigger}
|
|
132
133
|
<Portal>
|
|
133
|
-
<Content asChild>
|
|
134
|
+
<Content asChild className={classnames(contextStyles.content)}>
|
|
134
135
|
<FloatingMenu showTitle={showTitle} title={title}>
|
|
135
136
|
{children}
|
|
136
137
|
</FloatingMenu>
|