@vector-im/compound-web 7.12.0 → 8.1.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.
- package/dist/components/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/IconButton/IconButton.cjs +4 -2
- package/dist/components/Button/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/Button/IconButton/IconButton.d.ts +10 -1
- package/dist/components/Button/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/Button/IconButton/IconButton.js +4 -2
- package/dist/components/Button/IconButton/IconButton.js.map +1 -1
- package/dist/components/Button/IconButton/IconButton.module.css.cjs +3 -3
- package/dist/components/Button/IconButton/IconButton.module.css.js +3 -3
- 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/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 +39 -16
- package/package.json +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
- package/src/components/Button/IconButton/IconButton.module.css +32 -9
- package/src/components/Button/IconButton/IconButton.tsx +14 -3
- 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/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.cjs","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { HTMLProps, JSX, MouseEventHandler, KeyboardEvent } from \"react\";\nimport { IconButton } from \"../Button\";\nimport Chevron from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-left\";\nimport styles from \"./Breadcrumb.module.css\";\nimport { Link } from \"../Link/Link.tsx\";\nimport classNames from \"classnames\";\n\ninterface BreadcrumbProps extends HTMLProps<HTMLElement> {\n /**\n * The label for the back button.\n */\n backLabel: string;\n /**\n * The click handler for the back button.\n */\n onBackClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * The pages to display in the breadcrumb.\n * All the pages except the last one are displayed as links.\n */\n pages: string[];\n /**\n * The click handler for a page.\n * @param page - The page that was clicked.\n * @param index - The index of the page that was clicked.\n */\n onPageClick: (page: string, index: number) => void;\n}\n\n/**\n * A breadcrumb component.\n */\nexport function Breadcrumb({\n backLabel,\n onBackClick,\n pages,\n onPageClick,\n className,\n ...props\n}: BreadcrumbProps): JSX.Element {\n return (\n <nav className={classNames(styles.breadcrumb, className)} {...props}>\n <IconButton\n
|
|
1
|
+
{"version":3,"file":"Breadcrumb.cjs","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { HTMLProps, JSX, MouseEventHandler, KeyboardEvent } from \"react\";\nimport { IconButton } from \"../Button\";\nimport Chevron from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-left\";\nimport styles from \"./Breadcrumb.module.css\";\nimport { Link } from \"../Link/Link.tsx\";\nimport classNames from \"classnames\";\n\ninterface BreadcrumbProps extends HTMLProps<HTMLElement> {\n /**\n * The label for the back button.\n */\n backLabel: string;\n /**\n * The click handler for the back button.\n */\n onBackClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * The pages to display in the breadcrumb.\n * All the pages except the last one are displayed as links.\n */\n pages: string[];\n /**\n * The click handler for a page.\n * @param page - The page that was clicked.\n * @param index - The index of the page that was clicked.\n */\n onPageClick: (page: string, index: number) => void;\n}\n\n/**\n * A breadcrumb component.\n */\nexport function Breadcrumb({\n backLabel,\n onBackClick,\n pages,\n onPageClick,\n className,\n ...props\n}: BreadcrumbProps): JSX.Element {\n return (\n <nav className={classNames(styles.breadcrumb, className)} {...props}>\n <IconButton\n kind=\"secondary\"\n size=\"28px\"\n aria-label={backLabel}\n onClick={onBackClick}\n >\n <Chevron />\n </IconButton>\n <ol className={styles.pages}>\n {pages.map((page, index) => (\n <Page\n key={index}\n page={page}\n isLastPage={index === pages.length - 1}\n onClick={() => onPageClick(page, index)}\n />\n ))}\n </ol>\n </nav>\n );\n}\n\ninterface PageProps {\n /**\n * The page to display.\n */\n page: string;\n /**\n * Whether this is the last page in the breadcrumb.\n */\n isLastPage: boolean;\n /**\n * The click handler for the page, ignore for last page.\n */\n onClick: () => void;\n}\n\n/**\n * A breadcrumb page.\n * If not the last page, the page is displayed in a link.\n */\nfunction Page({ page, isLastPage, onClick }: PageProps): JSX.Element {\n const onKeyDown = (event: KeyboardEvent<HTMLAnchorElement>) => {\n if (event.key === \" \") {\n onClick();\n }\n };\n\n return (\n <li>\n {isLastPage ? (\n <span className={styles[\"last-page\"]} aria-current=\"page\">\n {page}\n </span>\n ) : (\n <Link\n size=\"small\"\n role=\"button\"\n onClick={onClick}\n onKeyDown={onKeyDown}\n tabIndex={0}\n >\n {page}\n </Link>\n )}\n </li>\n );\n}\n"],"names":["jsxs","styles","jsx","IconButton","Link"],"mappings":";;;;;;;;AAuCO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAE7B,SAAAA,gCAAC,SAAI,WAAW,WAAWC,0BAAO,YAAY,SAAS,GAAI,GAAG,OAC5D,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAACC,WAAA;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,SAAS;AAAA,QAET,yCAAC,SAAQ,CAAA,CAAA;AAAA,MAAA;AAAA,IACX;AAAA,IACAD,2BAAAA,IAAC,QAAG,WAAWD,kBAAA,QAAO,OACnB,UAAM,MAAA,IAAI,CAAC,MAAM,UAChBC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC;AAAA,QACA,YAAY,UAAU,MAAM,SAAS;AAAA,QACrC,SAAS,MAAM,YAAY,MAAM,KAAK;AAAA,MAAA;AAAA,MAHjC;AAAA,IAAA,CAKR,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;AAqBA,SAAS,KAAK,EAAE,MAAM,YAAY,WAAmC;AAC7D,QAAA,YAAY,CAAC,UAA4C;AACzD,QAAA,MAAM,QAAQ,KAAK;AACb,cAAA;AAAA,IAAA;AAAA,EAEZ;AAEA,SACGA,2BAAAA,IAAA,MAAA,EACE,UACC,aAAAA,2BAAAA,IAAC,QAAK,EAAA,WAAWD,kBAAAA,QAAO,WAAW,GAAG,gBAAa,QAChD,UAAA,KACH,CAAA,IAEAC,2BAAA;AAAA,IAACE,KAAA;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MAET,UAAA;AAAA,IAAA;AAAA,EAAA,GAGP;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { HTMLProps, JSX, MouseEventHandler, KeyboardEvent } from \"react\";\nimport { IconButton } from \"../Button\";\nimport Chevron from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-left\";\nimport styles from \"./Breadcrumb.module.css\";\nimport { Link } from \"../Link/Link.tsx\";\nimport classNames from \"classnames\";\n\ninterface BreadcrumbProps extends HTMLProps<HTMLElement> {\n /**\n * The label for the back button.\n */\n backLabel: string;\n /**\n * The click handler for the back button.\n */\n onBackClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * The pages to display in the breadcrumb.\n * All the pages except the last one are displayed as links.\n */\n pages: string[];\n /**\n * The click handler for a page.\n * @param page - The page that was clicked.\n * @param index - The index of the page that was clicked.\n */\n onPageClick: (page: string, index: number) => void;\n}\n\n/**\n * A breadcrumb component.\n */\nexport function Breadcrumb({\n backLabel,\n onBackClick,\n pages,\n onPageClick,\n className,\n ...props\n}: BreadcrumbProps): JSX.Element {\n return (\n <nav className={classNames(styles.breadcrumb, className)} {...props}>\n <IconButton\n
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport React, { HTMLProps, JSX, MouseEventHandler, KeyboardEvent } from \"react\";\nimport { IconButton } from \"../Button\";\nimport Chevron from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-left\";\nimport styles from \"./Breadcrumb.module.css\";\nimport { Link } from \"../Link/Link.tsx\";\nimport classNames from \"classnames\";\n\ninterface BreadcrumbProps extends HTMLProps<HTMLElement> {\n /**\n * The label for the back button.\n */\n backLabel: string;\n /**\n * The click handler for the back button.\n */\n onBackClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * The pages to display in the breadcrumb.\n * All the pages except the last one are displayed as links.\n */\n pages: string[];\n /**\n * The click handler for a page.\n * @param page - The page that was clicked.\n * @param index - The index of the page that was clicked.\n */\n onPageClick: (page: string, index: number) => void;\n}\n\n/**\n * A breadcrumb component.\n */\nexport function Breadcrumb({\n backLabel,\n onBackClick,\n pages,\n onPageClick,\n className,\n ...props\n}: BreadcrumbProps): JSX.Element {\n return (\n <nav className={classNames(styles.breadcrumb, className)} {...props}>\n <IconButton\n kind=\"secondary\"\n size=\"28px\"\n aria-label={backLabel}\n onClick={onBackClick}\n >\n <Chevron />\n </IconButton>\n <ol className={styles.pages}>\n {pages.map((page, index) => (\n <Page\n key={index}\n page={page}\n isLastPage={index === pages.length - 1}\n onClick={() => onPageClick(page, index)}\n />\n ))}\n </ol>\n </nav>\n );\n}\n\ninterface PageProps {\n /**\n * The page to display.\n */\n page: string;\n /**\n * Whether this is the last page in the breadcrumb.\n */\n isLastPage: boolean;\n /**\n * The click handler for the page, ignore for last page.\n */\n onClick: () => void;\n}\n\n/**\n * A breadcrumb page.\n * If not the last page, the page is displayed in a link.\n */\nfunction Page({ page, isLastPage, onClick }: PageProps): JSX.Element {\n const onKeyDown = (event: KeyboardEvent<HTMLAnchorElement>) => {\n if (event.key === \" \") {\n onClick();\n }\n };\n\n return (\n <li>\n {isLastPage ? (\n <span className={styles[\"last-page\"]} aria-current=\"page\">\n {page}\n </span>\n ) : (\n <Link\n size=\"small\"\n role=\"button\"\n onClick={onClick}\n onKeyDown={onKeyDown}\n tabIndex={0}\n >\n {page}\n </Link>\n )}\n </li>\n );\n}\n"],"names":[],"mappings":";;;;;;AAuCO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAE7B,SAAA,qBAAC,SAAI,WAAW,WAAW,OAAO,YAAY,SAAS,GAAI,GAAG,OAC5D,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,SAAS;AAAA,QAET,8BAAC,SAAQ,CAAA,CAAA;AAAA,MAAA;AAAA,IACX;AAAA,IACA,oBAAC,QAAG,WAAW,OAAO,OACnB,UAAM,MAAA,IAAI,CAAC,MAAM,UAChB;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC;AAAA,QACA,YAAY,UAAU,MAAM,SAAS;AAAA,QACrC,SAAS,MAAM,YAAY,MAAM,KAAK;AAAA,MAAA;AAAA,MAHjC;AAAA,IAAA,CAKR,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;AAqBA,SAAS,KAAK,EAAE,MAAM,YAAY,WAAmC;AAC7D,QAAA,YAAY,CAAC,UAA4C;AACzD,QAAA,MAAM,QAAQ,KAAK;AACb,cAAA;AAAA,IAAA;AAAA,EAEZ;AAEA,SACG,oBAAA,MAAA,EACE,UACC,aAAA,oBAAC,QAAK,EAAA,WAAW,OAAO,WAAW,GAAG,gBAAa,QAChD,UAAA,KACH,CAAA,IAEA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MAET,UAAA;AAAA,IAAA;AAAA,EAAA,GAGP;AAEJ;"}
|
|
@@ -8,6 +8,7 @@ const UnstyledButton = require("../UnstyledButton.cjs");
|
|
|
8
8
|
const IndicatorIcon = require("../../Icon/IndicatorIcon/IndicatorIcon.cjs");
|
|
9
9
|
const Tooltip = require("../../Tooltip/Tooltip.cjs");
|
|
10
10
|
const IconButton = React.forwardRef(function IconButton2({
|
|
11
|
+
kind = "primary",
|
|
11
12
|
children,
|
|
12
13
|
className,
|
|
13
14
|
indicator,
|
|
@@ -16,12 +17,12 @@ const IconButton = React.forwardRef(function IconButton2({
|
|
|
16
17
|
disabled,
|
|
17
18
|
destructive,
|
|
18
19
|
tooltip,
|
|
19
|
-
|
|
20
|
+
noBackground = false,
|
|
20
21
|
...props
|
|
21
22
|
}, ref) {
|
|
22
23
|
const classes = classNames(IconButton_module.default["icon-button"], className, {
|
|
23
24
|
[IconButton_module.default.destructive]: destructive,
|
|
24
|
-
[IconButton_module.default["
|
|
25
|
+
[IconButton_module.default["no-background"]]: noBackground
|
|
25
26
|
});
|
|
26
27
|
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
28
|
UnstyledButton.UnstyledButton,
|
|
@@ -36,6 +37,7 @@ const IconButton = React.forwardRef(function IconButton2({
|
|
|
36
37
|
disabled,
|
|
37
38
|
...props,
|
|
38
39
|
"data-indicator": indicator,
|
|
40
|
+
"data-kind": kind,
|
|
39
41
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
42
|
IndicatorIcon.IndicatorIcon,
|
|
41
43
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.cjs","sources":["../../../../src/components/Button/IconButton/IconButton.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, { PropsWithChildren, forwardRef } from \"react\";\nimport classnames from \"classnames\";\n\nimport styles from \"./IconButton.module.css\";\nimport { UnstyledButton, UnstyledButtonPropsFor } from \"../UnstyledButton\";\nimport { IndicatorIcon } from \"../../Icon/IndicatorIcon/IndicatorIcon\";\nimport { Tooltip } from \"../../Tooltip/Tooltip\";\n\ntype IconButtonProps = UnstyledButtonPropsFor<\"button\"> & {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The size of the button in CSS units, e.g. `\"24px\"`.\n * Note that this is the size of the *button* itself: the icon will be 0.75 * this size\n * @default 32px\n */\n size?: CSSStyleDeclaration[\"height\"];\n /**\n * The icon button indicator dot displayed on the top right\n * As in IndicatorIcon\n */\n indicator?: \"default\" | \"success\" | \"critical\";\n /**\n * Whether the button is interactable\n */\n disabled?: boolean;\n /**\n * Whether this button triggers a destructive action.\n * @default false\n */\n destructive?: boolean;\n /**\n * Optional tooltip for the button\n */\n tooltip?: string;\n
|
|
1
|
+
{"version":3,"file":"IconButton.cjs","sources":["../../../../src/components/Button/IconButton/IconButton.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, { PropsWithChildren, forwardRef } from \"react\";\nimport classnames from \"classnames\";\n\nimport styles from \"./IconButton.module.css\";\nimport { UnstyledButton, UnstyledButtonPropsFor } from \"../UnstyledButton\";\nimport { IndicatorIcon } from \"../../Icon/IndicatorIcon/IndicatorIcon\";\nimport { Tooltip } from \"../../Tooltip/Tooltip\";\n\ntype IconButtonProps = UnstyledButtonPropsFor<\"button\"> & {\n /**\n * The type of button.\n * @default \"primary\"\n */\n kind?: \"primary\" | \"secondary\";\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The size of the button in CSS units, e.g. `\"24px\"`.\n * Note that this is the size of the *button* itself: the icon will be 0.75 * this size\n * @default 32px\n */\n size?: CSSStyleDeclaration[\"height\"];\n /**\n * The icon button indicator dot displayed on the top right\n * As in IndicatorIcon\n */\n indicator?: \"default\" | \"success\" | \"critical\";\n /**\n * Whether the button is interactable\n */\n disabled?: boolean;\n /**\n * Whether this button triggers a destructive action.\n * @default false\n */\n destructive?: boolean;\n /**\n * Optional tooltip for the button\n */\n tooltip?: string;\n /**\n * Hide the background when the button is not active or hovered.\n * @default false\n */\n noBackground?: boolean;\n};\n\n/**\n * Display an icon as a button. Can render an indicator\n */\nexport const IconButton = forwardRef<\n HTMLButtonElement,\n PropsWithChildren<IconButtonProps>\n>(function IconButton(\n {\n kind = \"primary\",\n children,\n className,\n indicator,\n size = \"32px\",\n style,\n disabled,\n destructive,\n tooltip,\n noBackground = false,\n ...props\n },\n ref,\n) {\n const classes = classnames(styles[\"icon-button\"], className, {\n [styles.destructive]: destructive,\n [styles[\"no-background\"]]: noBackground,\n });\n\n const button = (\n <UnstyledButton\n as=\"button\"\n ref={ref}\n className={classes}\n style={\n {\n \"--cpd-icon-button-size\": size,\n ...style,\n } as React.CSSProperties\n }\n disabled={disabled}\n {...props}\n data-indicator={indicator}\n data-kind={kind}\n >\n <IndicatorIcon\n indicator={indicator}\n colour={disabled ? \"var(--cpd-color-icon-disabled)\" : undefined}\n >\n {React.Children.only(children)}\n </IndicatorIcon>\n </UnstyledButton>\n );\n\n return tooltip ? <Tooltip label={tooltip}>{button}</Tooltip> : button;\n});\n"],"names":["forwardRef","IconButton","classnames","styles","jsx","UnstyledButton","IndicatorIcon","Tooltip"],"mappings":";;;;;;;;;AA2Da,MAAA,aAAaA,MAAAA,WAGxB,SAASC,YACT;AAAA,EACE,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAWC,kBAAO,QAAA,aAAa,GAAG,WAAW;AAAA,IAC3D,CAACA,kBAAAA,QAAO,WAAW,GAAG;AAAA,IACtB,CAACA,kBAAAA,QAAO,eAAe,CAAC,GAAG;AAAA,EAAA,CAC5B;AAED,QAAM,SACJC,2BAAA;AAAA,IAACC,eAAA;AAAA,IAAA;AAAA,MACC,IAAG;AAAA,MACH;AAAA,MACA,WAAW;AAAA,MACX,OACE;AAAA,QACE,0BAA0B;AAAA,QAC1B,GAAG;AAAA,MACL;AAAA,MAEF;AAAA,MACC,GAAG;AAAA,MACJ,kBAAgB;AAAA,MAChB,aAAW;AAAA,MAEX,UAAAD,2BAAA;AAAA,QAACE,cAAA;AAAA,QAAA;AAAA,UACC;AAAA,UACA,QAAQ,WAAW,mCAAmC;AAAA,UAErD,UAAA,MAAM,SAAS,KAAK,QAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IAC/B;AAAA,EACF;AAGF,SAAO,UAAWF,+BAAAG,QAAAA,SAAA,EAAQ,OAAO,SAAU,iBAAO,CAAA,IAAa;AACjE,CAAC;;"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { UnstyledButtonPropsFor } from '../UnstyledButton';
|
|
3
3
|
type IconButtonProps = UnstyledButtonPropsFor<"button"> & {
|
|
4
|
+
/**
|
|
5
|
+
* The type of button.
|
|
6
|
+
* @default "primary"
|
|
7
|
+
*/
|
|
8
|
+
kind?: "primary" | "secondary";
|
|
4
9
|
/**
|
|
5
10
|
* The CSS class name.
|
|
6
11
|
*/
|
|
@@ -29,7 +34,11 @@ type IconButtonProps = UnstyledButtonPropsFor<"button"> & {
|
|
|
29
34
|
* Optional tooltip for the button
|
|
30
35
|
*/
|
|
31
36
|
tooltip?: string;
|
|
32
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Hide the background when the button is not active or hovered.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
noBackground?: boolean;
|
|
33
42
|
};
|
|
34
43
|
/**
|
|
35
44
|
* Display an icon as a button. Can render an indicator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/IconButton/IconButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAkB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAI3E,KAAK,eAAe,GAAG,sBAAsB,CAAC,QAAQ,CAAC,GAAG;IACxD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/IconButton/IconButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAkB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAI3E,KAAK,eAAe,GAAG,sBAAsB,CAAC,QAAQ,CAAC,GAAG;IACxD;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,iIAkDrB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { UnstyledButton } from "../UnstyledButton.js";
|
|
|
6
6
|
import { IndicatorIcon } from "../../Icon/IndicatorIcon/IndicatorIcon.js";
|
|
7
7
|
import { Tooltip } from "../../Tooltip/Tooltip.js";
|
|
8
8
|
const IconButton = forwardRef(function IconButton2({
|
|
9
|
+
kind = "primary",
|
|
9
10
|
children,
|
|
10
11
|
className,
|
|
11
12
|
indicator,
|
|
@@ -14,12 +15,12 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
14
15
|
disabled,
|
|
15
16
|
destructive,
|
|
16
17
|
tooltip,
|
|
17
|
-
|
|
18
|
+
noBackground = false,
|
|
18
19
|
...props
|
|
19
20
|
}, ref) {
|
|
20
21
|
const classes = classNames(styles["icon-button"], className, {
|
|
21
22
|
[styles.destructive]: destructive,
|
|
22
|
-
[styles["
|
|
23
|
+
[styles["no-background"]]: noBackground
|
|
23
24
|
});
|
|
24
25
|
const button = /* @__PURE__ */ jsx(
|
|
25
26
|
UnstyledButton,
|
|
@@ -34,6 +35,7 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
34
35
|
disabled,
|
|
35
36
|
...props,
|
|
36
37
|
"data-indicator": indicator,
|
|
38
|
+
"data-kind": kind,
|
|
37
39
|
children: /* @__PURE__ */ jsx(
|
|
38
40
|
IndicatorIcon,
|
|
39
41
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/Button/IconButton/IconButton.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, { PropsWithChildren, forwardRef } from \"react\";\nimport classnames from \"classnames\";\n\nimport styles from \"./IconButton.module.css\";\nimport { UnstyledButton, UnstyledButtonPropsFor } from \"../UnstyledButton\";\nimport { IndicatorIcon } from \"../../Icon/IndicatorIcon/IndicatorIcon\";\nimport { Tooltip } from \"../../Tooltip/Tooltip\";\n\ntype IconButtonProps = UnstyledButtonPropsFor<\"button\"> & {\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The size of the button in CSS units, e.g. `\"24px\"`.\n * Note that this is the size of the *button* itself: the icon will be 0.75 * this size\n * @default 32px\n */\n size?: CSSStyleDeclaration[\"height\"];\n /**\n * The icon button indicator dot displayed on the top right\n * As in IndicatorIcon\n */\n indicator?: \"default\" | \"success\" | \"critical\";\n /**\n * Whether the button is interactable\n */\n disabled?: boolean;\n /**\n * Whether this button triggers a destructive action.\n * @default false\n */\n destructive?: boolean;\n /**\n * Optional tooltip for the button\n */\n tooltip?: string;\n
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/Button/IconButton/IconButton.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, { PropsWithChildren, forwardRef } from \"react\";\nimport classnames from \"classnames\";\n\nimport styles from \"./IconButton.module.css\";\nimport { UnstyledButton, UnstyledButtonPropsFor } from \"../UnstyledButton\";\nimport { IndicatorIcon } from \"../../Icon/IndicatorIcon/IndicatorIcon\";\nimport { Tooltip } from \"../../Tooltip/Tooltip\";\n\ntype IconButtonProps = UnstyledButtonPropsFor<\"button\"> & {\n /**\n * The type of button.\n * @default \"primary\"\n */\n kind?: \"primary\" | \"secondary\";\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The size of the button in CSS units, e.g. `\"24px\"`.\n * Note that this is the size of the *button* itself: the icon will be 0.75 * this size\n * @default 32px\n */\n size?: CSSStyleDeclaration[\"height\"];\n /**\n * The icon button indicator dot displayed on the top right\n * As in IndicatorIcon\n */\n indicator?: \"default\" | \"success\" | \"critical\";\n /**\n * Whether the button is interactable\n */\n disabled?: boolean;\n /**\n * Whether this button triggers a destructive action.\n * @default false\n */\n destructive?: boolean;\n /**\n * Optional tooltip for the button\n */\n tooltip?: string;\n /**\n * Hide the background when the button is not active or hovered.\n * @default false\n */\n noBackground?: boolean;\n};\n\n/**\n * Display an icon as a button. Can render an indicator\n */\nexport const IconButton = forwardRef<\n HTMLButtonElement,\n PropsWithChildren<IconButtonProps>\n>(function IconButton(\n {\n kind = \"primary\",\n children,\n className,\n indicator,\n size = \"32px\",\n style,\n disabled,\n destructive,\n tooltip,\n noBackground = false,\n ...props\n },\n ref,\n) {\n const classes = classnames(styles[\"icon-button\"], className, {\n [styles.destructive]: destructive,\n [styles[\"no-background\"]]: noBackground,\n });\n\n const button = (\n <UnstyledButton\n as=\"button\"\n ref={ref}\n className={classes}\n style={\n {\n \"--cpd-icon-button-size\": size,\n ...style,\n } as React.CSSProperties\n }\n disabled={disabled}\n {...props}\n data-indicator={indicator}\n data-kind={kind}\n >\n <IndicatorIcon\n indicator={indicator}\n colour={disabled ? \"var(--cpd-color-icon-disabled)\" : undefined}\n >\n {React.Children.only(children)}\n </IndicatorIcon>\n </UnstyledButton>\n );\n\n return tooltip ? <Tooltip label={tooltip}>{button}</Tooltip> : button;\n});\n"],"names":["IconButton","classnames"],"mappings":";;;;;;;AA2Da,MAAA,aAAa,WAGxB,SAASA,YACT;AAAA,EACE,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,GACA,KACA;AACA,QAAM,UAAUC,WAAW,OAAO,aAAa,GAAG,WAAW;AAAA,IAC3D,CAAC,OAAO,WAAW,GAAG;AAAA,IACtB,CAAC,OAAO,eAAe,CAAC,GAAG;AAAA,EAAA,CAC5B;AAED,QAAM,SACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAG;AAAA,MACH;AAAA,MACA,WAAW;AAAA,MACX,OACE;AAAA,QACE,0BAA0B;AAAA,QAC1B,GAAG;AAAA,MACL;AAAA,MAEF;AAAA,MACC,GAAG;AAAA,MACJ,kBAAgB;AAAA,MAChB,aAAW;AAAA,MAEX,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,QAAQ,WAAW,mCAAmC;AAAA,UAErD,UAAA,MAAM,SAAS,KAAK,QAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IAC/B;AAAA,EACF;AAGF,SAAO,UAAW,oBAAA,SAAA,EAAQ,OAAO,SAAU,iBAAO,CAAA,IAAa;AACjE,CAAC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const destructive = "
|
|
3
|
+
const destructive = "_destructive_1pz9o_95";
|
|
4
4
|
const styles = {
|
|
5
|
-
"icon-button": "_icon-
|
|
6
|
-
"
|
|
5
|
+
"icon-button": "_icon-button_1pz9o_8",
|
|
6
|
+
"no-background": "_no-background_1pz9o_42",
|
|
7
7
|
destructive
|
|
8
8
|
};
|
|
9
9
|
exports.default = styles;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const destructive = "
|
|
1
|
+
const destructive = "_destructive_1pz9o_95";
|
|
2
2
|
const styles = {
|
|
3
|
-
"icon-button": "_icon-
|
|
4
|
-
"
|
|
3
|
+
"icon-button": "_icon-button_1pz9o_8",
|
|
4
|
+
"no-background": "_no-background_1pz9o_42",
|
|
5
5
|
destructive
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
@@ -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":";;;;;;;;;;;;;;;;"}
|
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,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EACL,WAAW,EAEX,WAAW,IAAI,OAAO,EACtB,SAAS,EACT,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EAEb,aAAa,IAAI,QAAQ,EACzB,YAAY,EACZ,UAAU,EAEV,UAAU,IAAI,KAAK,EACnB,aAAa,EACb,WAAW,EAEX,WAAW,IAAI,MAAM,EACrB,IAAI,EACJ,MAAM,EACN,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,EACb,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,
|
|
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,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EACL,WAAW,EAEX,WAAW,IAAI,OAAO,EACtB,SAAS,EACT,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EAEb,aAAa,IAAI,QAAQ,EACzB,YAAY,EACZ,UAAU,EAEV,UAAU,IAAI,KAAK,EACnB,aAAa,EACb,WAAW,EAEX,WAAW,IAAI,MAAM,EACrB,IAAI,EACJ,MAAM,EACN,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,EACb,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,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
|
@@ -247,7 +247,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
247
247
|
Please see LICENSE files in the repository root for full details.
|
|
248
248
|
*/
|
|
249
249
|
|
|
250
|
-
._icon-
|
|
250
|
+
._icon-button_1pz9o_8 {
|
|
251
251
|
--cpd-icon-button-indicator-border-size: calc(
|
|
252
252
|
var(--cpd-icon-button-size) * 0.0625
|
|
253
253
|
);
|
|
@@ -258,7 +258,6 @@ Please see LICENSE files in the repository root for full details.
|
|
|
258
258
|
/* the icon is 0.75 the size of the button, so add padding to put it in the middle */
|
|
259
259
|
padding: calc(var(--cpd-icon-button-size) * 0.125);
|
|
260
260
|
aspect-ratio: 1 / 1;
|
|
261
|
-
color: var(--cpd-color-icon-tertiary);
|
|
262
261
|
border: 0;
|
|
263
262
|
appearance: none;
|
|
264
263
|
cursor: pointer;
|
|
@@ -268,14 +267,30 @@ Please see LICENSE files in the repository root for full details.
|
|
|
268
267
|
line-height: 0px;
|
|
269
268
|
}
|
|
270
269
|
|
|
271
|
-
.
|
|
272
|
-
|
|
270
|
+
._icon-button_1pz9o_8[data-kind="primary"] {
|
|
271
|
+
* {
|
|
272
|
+
color: var(--cpd-color-icon-tertiary);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
._icon-button_1pz9o_8[data-kind="secondary"] {
|
|
273
277
|
background: var(--cpd-color-bg-subtle-secondary);
|
|
278
|
+
|
|
279
|
+
* {
|
|
280
|
+
color: var(--cpd-color-icon-secondary);
|
|
281
|
+
}
|
|
274
282
|
}
|
|
275
283
|
|
|
276
|
-
.
|
|
277
|
-
|
|
284
|
+
._no-background_1pz9o_42[data-kind="secondary"] {
|
|
285
|
+
background: transparent;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
._icon-button_1pz9o_8[aria-disabled="true"] {
|
|
278
289
|
cursor: not-allowed;
|
|
290
|
+
|
|
291
|
+
* {
|
|
292
|
+
color: var(--cpd-color-icon-disabled);
|
|
293
|
+
}
|
|
279
294
|
}
|
|
280
295
|
|
|
281
296
|
/**
|
|
@@ -283,19 +298,25 @@ Please see LICENSE files in the repository root for full details.
|
|
|
283
298
|
*/
|
|
284
299
|
|
|
285
300
|
@media (hover) {
|
|
286
|
-
._icon-
|
|
287
|
-
color: var(--cpd-color-icon-primary);
|
|
301
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"]):hover {
|
|
288
302
|
background: var(--cpd-color-bg-subtle-primary);
|
|
303
|
+
|
|
304
|
+
* {
|
|
305
|
+
color: var(--cpd-color-icon-primary);
|
|
306
|
+
}
|
|
289
307
|
}
|
|
290
308
|
}
|
|
291
309
|
|
|
292
|
-
._icon-
|
|
293
|
-
color: var(--cpd-color-icon-primary);
|
|
310
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"]):active {
|
|
294
311
|
background: var(--cpd-color-bg-subtle-primary);
|
|
312
|
+
|
|
313
|
+
* {
|
|
314
|
+
color: var(--cpd-color-icon-primary);
|
|
315
|
+
}
|
|
295
316
|
}
|
|
296
317
|
|
|
297
318
|
@media (hover) {
|
|
298
|
-
._icon-
|
|
319
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"])[data-indicator]:is(:hover)::before {
|
|
299
320
|
/* Same colour as the background */
|
|
300
321
|
border: var(--cpd-icon-button-indicator-border-size) solid
|
|
301
322
|
var(--cpd-color-bg-subtle-primary);
|
|
@@ -304,7 +325,7 @@ Please see LICENSE files in the repository root for full details.
|
|
|
304
325
|
}
|
|
305
326
|
}
|
|
306
327
|
|
|
307
|
-
._icon-
|
|
328
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"])[data-indicator]:is(:active)::before {
|
|
308
329
|
/* Same colour as the background */
|
|
309
330
|
border: var(--cpd-icon-button-indicator-border-size) solid
|
|
310
331
|
var(--cpd-color-bg-subtle-primary);
|
|
@@ -313,14 +334,16 @@ Please see LICENSE files in the repository root for full details.
|
|
|
313
334
|
}
|
|
314
335
|
|
|
315
336
|
@media (hover) {
|
|
316
|
-
._icon-
|
|
317
|
-
background: var(--cpd-color-bg-critical-subtle);
|
|
337
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"])._destructive_1pz9o_95:hover {
|
|
338
|
+
background: var(--cpd-color-bg-critical-subtle-hovered);
|
|
318
339
|
outline: 1px solid var(--cpd-color-border-critical-subtle);
|
|
319
340
|
}
|
|
320
341
|
}
|
|
321
342
|
|
|
322
|
-
._icon-
|
|
323
|
-
|
|
343
|
+
._icon-button_1pz9o_8:not([aria-disabled="true"])._destructive_1pz9o_95 {
|
|
344
|
+
* {
|
|
345
|
+
color: var(--cpd-color-icon-critical-primary);
|
|
346
|
+
}
|
|
324
347
|
}
|
|
325
348
|
/*
|
|
326
349
|
Copyright 2024 New Vector Ltd.
|
package/package.json
CHANGED
|
@@ -16,7 +16,6 @@ Please see LICENSE files in the repository root for full details.
|
|
|
16
16
|
/* the icon is 0.75 the size of the button, so add padding to put it in the middle */
|
|
17
17
|
padding: calc(var(--cpd-icon-button-size) * 0.125);
|
|
18
18
|
aspect-ratio: 1 / 1;
|
|
19
|
-
color: var(--cpd-color-icon-tertiary);
|
|
20
19
|
border: 0;
|
|
21
20
|
appearance: none;
|
|
22
21
|
cursor: pointer;
|
|
@@ -26,14 +25,30 @@ Please see LICENSE files in the repository root for full details.
|
|
|
26
25
|
line-height: 0px;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
.
|
|
30
|
-
|
|
28
|
+
.icon-button[data-kind="primary"] {
|
|
29
|
+
* {
|
|
30
|
+
color: var(--cpd-color-icon-tertiary);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon-button[data-kind="secondary"] {
|
|
31
35
|
background: var(--cpd-color-bg-subtle-secondary);
|
|
36
|
+
|
|
37
|
+
* {
|
|
38
|
+
color: var(--cpd-color-icon-secondary);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.no-background[data-kind="secondary"] {
|
|
43
|
+
background: transparent;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
.icon-button[aria-disabled="true"] {
|
|
35
|
-
color: var(--cpd-color-icon-disabled);
|
|
36
47
|
cursor: not-allowed;
|
|
48
|
+
|
|
49
|
+
* {
|
|
50
|
+
color: var(--cpd-color-icon-disabled);
|
|
51
|
+
}
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
/**
|
|
@@ -42,14 +57,20 @@ Please see LICENSE files in the repository root for full details.
|
|
|
42
57
|
|
|
43
58
|
@media (hover) {
|
|
44
59
|
.icon-button:not([aria-disabled="true"]):hover {
|
|
45
|
-
color: var(--cpd-color-icon-primary);
|
|
46
60
|
background: var(--cpd-color-bg-subtle-primary);
|
|
61
|
+
|
|
62
|
+
* {
|
|
63
|
+
color: var(--cpd-color-icon-primary);
|
|
64
|
+
}
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
|
|
50
68
|
.icon-button:not([aria-disabled="true"]):active {
|
|
51
|
-
color: var(--cpd-color-icon-primary);
|
|
52
69
|
background: var(--cpd-color-bg-subtle-primary);
|
|
70
|
+
|
|
71
|
+
* {
|
|
72
|
+
color: var(--cpd-color-icon-primary);
|
|
73
|
+
}
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
@media (hover) {
|
|
@@ -72,11 +93,13 @@ Please see LICENSE files in the repository root for full details.
|
|
|
72
93
|
|
|
73
94
|
@media (hover) {
|
|
74
95
|
.icon-button:not([aria-disabled="true"]).destructive:hover {
|
|
75
|
-
background: var(--cpd-color-bg-critical-subtle);
|
|
96
|
+
background: var(--cpd-color-bg-critical-subtle-hovered);
|
|
76
97
|
outline: 1px solid var(--cpd-color-border-critical-subtle);
|
|
77
98
|
}
|
|
78
99
|
}
|
|
79
100
|
|
|
80
|
-
.icon-button:not([aria-disabled="true"]).destructive
|
|
81
|
-
|
|
101
|
+
.icon-button:not([aria-disabled="true"]).destructive {
|
|
102
|
+
* {
|
|
103
|
+
color: var(--cpd-color-icon-critical-primary);
|
|
104
|
+
}
|
|
82
105
|
}
|
|
@@ -14,6 +14,11 @@ import { IndicatorIcon } from "../../Icon/IndicatorIcon/IndicatorIcon";
|
|
|
14
14
|
import { Tooltip } from "../../Tooltip/Tooltip";
|
|
15
15
|
|
|
16
16
|
type IconButtonProps = UnstyledButtonPropsFor<"button"> & {
|
|
17
|
+
/**
|
|
18
|
+
* The type of button.
|
|
19
|
+
* @default "primary"
|
|
20
|
+
*/
|
|
21
|
+
kind?: "primary" | "secondary";
|
|
17
22
|
/**
|
|
18
23
|
* The CSS class name.
|
|
19
24
|
*/
|
|
@@ -42,7 +47,11 @@ type IconButtonProps = UnstyledButtonPropsFor<"button"> & {
|
|
|
42
47
|
* Optional tooltip for the button
|
|
43
48
|
*/
|
|
44
49
|
tooltip?: string;
|
|
45
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Hide the background when the button is not active or hovered.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
noBackground?: boolean;
|
|
46
55
|
};
|
|
47
56
|
|
|
48
57
|
/**
|
|
@@ -53,6 +62,7 @@ export const IconButton = forwardRef<
|
|
|
53
62
|
PropsWithChildren<IconButtonProps>
|
|
54
63
|
>(function IconButton(
|
|
55
64
|
{
|
|
65
|
+
kind = "primary",
|
|
56
66
|
children,
|
|
57
67
|
className,
|
|
58
68
|
indicator,
|
|
@@ -61,14 +71,14 @@ export const IconButton = forwardRef<
|
|
|
61
71
|
disabled,
|
|
62
72
|
destructive,
|
|
63
73
|
tooltip,
|
|
64
|
-
|
|
74
|
+
noBackground = false,
|
|
65
75
|
...props
|
|
66
76
|
},
|
|
67
77
|
ref,
|
|
68
78
|
) {
|
|
69
79
|
const classes = classnames(styles["icon-button"], className, {
|
|
70
80
|
[styles.destructive]: destructive,
|
|
71
|
-
[styles["
|
|
81
|
+
[styles["no-background"]]: noBackground,
|
|
72
82
|
});
|
|
73
83
|
|
|
74
84
|
const button = (
|
|
@@ -85,6 +95,7 @@ export const IconButton = forwardRef<
|
|
|
85
95
|
disabled={disabled}
|
|
86
96
|
{...props}
|
|
87
97
|
data-indicator={indicator}
|
|
98
|
+
data-kind={kind}
|
|
88
99
|
>
|
|
89
100
|
<IndicatorIcon
|
|
90
101
|
indicator={indicator}
|
|
@@ -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";
|