@planningcenter/tapestry 2.9.0 → 2.9.1-rc.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/checkbox/Checkbox.d.ts +26 -4
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.js +9 -2
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/radio/Radio.d.ts +12 -2
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +5 -1
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/toggle-switch/ToggleSwitch.d.ts +21 -4
- package/dist/components/toggle-switch/ToggleSwitch.d.ts.map +1 -1
- package/dist/components/toggle-switch/ToggleSwitch.js +5 -1
- package/dist/components/toggle-switch/ToggleSwitch.js.map +1 -1
- package/dist/reactRender.css +153 -159
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +153 -159
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +6 -12
- package/dist/unstable.css.map +1 -1
- package/package.json +2 -2
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
2
|
import React, { InputHTMLAttributes } from "react";
|
|
3
3
|
export type CheckboxSize = "md" | "sm";
|
|
4
|
-
|
|
4
|
+
interface CheckboxBaseProps {
|
|
5
5
|
description?: string;
|
|
6
6
|
indeterminate?: boolean;
|
|
7
7
|
invalid?: boolean;
|
|
8
|
-
label: string;
|
|
9
8
|
size?: CheckboxSize;
|
|
10
9
|
}
|
|
10
|
+
interface CheckboxWithLabel extends CheckboxBaseProps {
|
|
11
|
+
"aria-labelledby"?: never;
|
|
12
|
+
/**
|
|
13
|
+
* Label content for the checkbox. When using non-string content
|
|
14
|
+
* (e.g. JSX), it must not contain interactive elements. This
|
|
15
|
+
* includes native HTML elements such as `<a>` and `<button>`, as
|
|
16
|
+
* well as Tapestry or Tapestry-React interactive components.
|
|
17
|
+
*/
|
|
18
|
+
label: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
interface CheckboxWithAriaLabelledBy extends CheckboxBaseProps {
|
|
21
|
+
"aria-labelledby": string;
|
|
22
|
+
label?: never;
|
|
23
|
+
}
|
|
24
|
+
export type CheckboxProps = CheckboxWithLabel | CheckboxWithAriaLabelledBy;
|
|
11
25
|
export type CheckboxElementProps = Omit<InputHTMLAttributes<HTMLInputElement>, keyof CheckboxProps | "type"> & CheckboxProps;
|
|
12
26
|
/**
|
|
13
27
|
* A checkbox component that renders as a checkbox input with label.
|
|
14
28
|
* Supports various sizes, error states, and disabled states.
|
|
15
|
-
*
|
|
29
|
+
*
|
|
30
|
+
* **Required:** You must provide either:
|
|
31
|
+
* - `label` - Label content for the checkbox
|
|
32
|
+
* - `aria-labelledby` - ID of an external element that provides the label
|
|
33
|
+
*
|
|
34
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
35
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
36
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
16
37
|
*
|
|
17
38
|
* @component
|
|
18
39
|
*/
|
|
19
|
-
export declare const Checkbox: React.ForwardRefExoticComponent<
|
|
40
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxElementProps & React.RefAttributes<HTMLInputElement>>;
|
|
41
|
+
export {};
|
|
20
42
|
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAe,MAAM,OAAO,CAAA;AAI3E,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAe,MAAM,OAAO,CAAA;AAI3E,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,iBAAiB,CAAC,EAAE,KAAK,CAAA;IACzB;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,UAAU,0BAA2B,SAAQ,iBAAiB;IAC5D,iBAAiB,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,0BAA0B,CAAA;AAE1E,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,aAAa,GAAG,MAAM,CAC7B,GACC,aAAa,CAAA;AAEf;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,+FAqEpB,CAAA"}
|
|
@@ -6,7 +6,14 @@ import { useId } from '../../utilities/useId.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* A checkbox component that renders as a checkbox input with label.
|
|
8
8
|
* Supports various sizes, error states, and disabled states.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* **Required:** You must provide either:
|
|
11
|
+
* - `label` - Label content for the checkbox
|
|
12
|
+
* - `aria-labelledby` - ID of an external element that provides the label
|
|
13
|
+
*
|
|
14
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
15
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
16
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
10
17
|
*
|
|
11
18
|
* @component
|
|
12
19
|
*/
|
|
@@ -28,7 +35,7 @@ const Checkbox = forwardRef(({ className, description, id, indeterminate = false
|
|
|
28
35
|
const checkboxId = id || `tds-checkbox-${stableId}`;
|
|
29
36
|
return (React.createElement("div", { className: combinedClassName },
|
|
30
37
|
React.createElement("input", { ...restProps, "aria-describedby": description ? `${checkboxId}-description` : undefined, "aria-invalid": invalid, id: checkboxId, ref: callbackRef, type: "checkbox" }),
|
|
31
|
-
React.createElement("label", { htmlFor: checkboxId }, label),
|
|
38
|
+
label && React.createElement("label", { htmlFor: checkboxId }, label),
|
|
32
39
|
description && (React.createElement("p", { id: `${checkboxId}-description`, className: "tds-checkbox-description" },
|
|
33
40
|
React.createElement(Icon, { className: "tds-checkbox-description-invalid-icon", symbol: "general#exclamation-triangle", "aria-hidden": true }),
|
|
34
41
|
description))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes, useCallback } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type CheckboxSize = \"md\" | \"sm\"\n\
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes, useCallback } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type CheckboxSize = \"md\" | \"sm\"\n\ninterface CheckboxBaseProps {\n description?: string\n indeterminate?: boolean\n invalid?: boolean\n size?: CheckboxSize\n}\n\ninterface CheckboxWithLabel extends CheckboxBaseProps {\n \"aria-labelledby\"?: never\n /**\n * Label content for the checkbox. When using non-string content\n * (e.g. JSX), it must not contain interactive elements. This\n * includes native HTML elements such as `<a>` and `<button>`, as\n * well as Tapestry or Tapestry-React interactive components.\n */\n label: React.ReactNode\n}\n\ninterface CheckboxWithAriaLabelledBy extends CheckboxBaseProps {\n \"aria-labelledby\": string\n label?: never\n}\n\nexport type CheckboxProps = CheckboxWithLabel | CheckboxWithAriaLabelledBy\n\nexport type CheckboxElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof CheckboxProps | \"type\"\n> &\n CheckboxProps\n\n/**\n * A checkbox component that renders as a checkbox input with label.\n * Supports various sizes, error states, and disabled states.\n *\n * **Required:** You must provide either:\n * - `label` - Label content for the checkbox\n * - `aria-labelledby` - ID of an external element that provides the label\n *\n * When using non-string content for `label` (e.g. JSX), it must not contain\n * interactive elements. This includes native HTML elements such as `<a>` and\n * `<button>`, as well as Tapestry or Tapestry-React interactive components.\n *\n * @component\n */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxElementProps>(\n (\n {\n className,\n description,\n id,\n indeterminate = false,\n invalid,\n label,\n size = \"md\",\n ...restProps\n }: CheckboxElementProps,\n ref\n ) => {\n const callbackRef = useCallback(\n (element: HTMLInputElement | null) => {\n if (element) {\n element.indeterminate = indeterminate\n }\n\n // Handle the forwarded ref\n if (typeof ref === \"function\") {\n ref(element)\n } else if (ref && typeof ref === \"object\") {\n ref.current = element\n }\n },\n [ref, indeterminate]\n )\n\n const combinedClassName = classNames(\n \"tds-checkbox\",\n size && size === \"sm\" && `tds-checkbox--sm`,\n invalid && \"tds-checkbox--invalid\",\n className\n )\n\n const stableId = useId()\n const checkboxId = id || `tds-checkbox-${stableId}`\n\n return (\n <div className={combinedClassName}>\n <input\n {...restProps}\n aria-describedby={\n description ? `${checkboxId}-description` : undefined\n }\n aria-invalid={invalid}\n id={checkboxId}\n ref={callbackRef}\n type=\"checkbox\"\n />\n {label && <label htmlFor={checkboxId}>{label}</label>}\n {description && (\n <p\n id={`${checkboxId}-description`}\n className=\"tds-checkbox-description\"\n >\n <Icon\n className=\"tds-checkbox-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n aria-hidden\n />\n {description}\n </p>\n )}\n </div>\n )\n }\n)\n\nCheckbox.displayName = \"Checkbox\"\n"],"names":[],"mappings":";;;;;AAyCA;;;;;;;;;;;;;AAaG;AACI,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,SAAS,EACT,WAAW,EACX,EAAE,EACF,aAAa,GAAG,KAAK,EACrB,OAAO,EACP,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACS,EACvB,GAAG,KACD;AACF,IAAA,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,OAAgC,KAAI;QACnC,IAAI,OAAO,EAAE;AACX,YAAA,OAAO,CAAC,aAAa,GAAG,aAAa;QACvC;;AAGA,QAAA,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;YAC7B,GAAG,CAAC,OAAO,CAAC;QACd;AAAO,aAAA,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AACzC,YAAA,GAAG,CAAC,OAAO,GAAG,OAAO;QACvB;AACF,IAAA,CAAC,EACD,CAAC,GAAG,EAAE,aAAa,CAAC,CACrB;IAED,MAAM,iBAAiB,GAAG,UAAU,CAClC,cAAc,EACd,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAA,gBAAA,CAAkB,EAC3C,OAAO,IAAI,uBAAuB,EAClC,SAAS,CACV;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,UAAU,GAAG,EAAE,IAAI,CAAA,aAAA,EAAgB,QAAQ,EAAE;AAEnD,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA;QAC/B,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GACM,SAAS,EAAA,kBAAA,EAEX,WAAW,GAAG,CAAA,EAAG,UAAU,CAAA,YAAA,CAAc,GAAG,SAAS,EAAA,cAAA,EAEzC,OAAO,EACrB,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,UAAU,EAAA,CACf;AACD,QAAA,KAAK,IAAI,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,UAAU,EAAA,EAAG,KAAK,CAAS;QACpD,WAAW,KACV,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,EAAE,EAAE,CAAA,EAAG,UAAU,CAAA,YAAA,CAAc,EAC/B,SAAS,EAAC,0BAA0B,EAAA;YAEpC,KAAA,CAAA,aAAA,CAAC,IAAI,IACH,SAAS,EAAC,uCAAuC,EACjD,MAAM,EAAC,8BAA8B,EAAA,aAAA,EAAA,IAAA,EAAA,CAErC;AACD,YAAA,WAAW,CACV,CACL,CACG;AAEV,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -2,7 +2,13 @@ import React, { InputHTMLAttributes } from "react";
|
|
|
2
2
|
export type RadioSize = "md" | "sm";
|
|
3
3
|
export interface RadioProps {
|
|
4
4
|
description?: string;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Label content for the radio. When using non-string content
|
|
7
|
+
* (e.g. JSX), it must not contain interactive elements. This
|
|
8
|
+
* includes native HTML elements such as `<a>` and `<button>`, as
|
|
9
|
+
* well as Tapestry or Tapestry-React interactive components.
|
|
10
|
+
*/
|
|
11
|
+
label: React.ReactNode;
|
|
6
12
|
name: string;
|
|
7
13
|
size?: RadioSize;
|
|
8
14
|
}
|
|
@@ -10,7 +16,11 @@ export type RadioElementProps = Omit<InputHTMLAttributes<HTMLInputElement>, keyo
|
|
|
10
16
|
/**
|
|
11
17
|
* A radio component that renders as a radio input with label.
|
|
12
18
|
* Supports various sizes.
|
|
13
|
-
*
|
|
19
|
+
* Must have a name attribute.
|
|
20
|
+
*
|
|
21
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
22
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
23
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
14
24
|
*
|
|
15
25
|
* @component
|
|
16
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAI9D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAEnC,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAI9D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAEnC,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,UAAU,GAAG,MAAM,CAC1B,GACC,UAAU,CAAA;AAEZ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,oKAuCjB,CAAA"}
|
|
@@ -5,7 +5,11 @@ import { useId } from '../../utilities/useId.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* A radio component that renders as a radio input with label.
|
|
7
7
|
* Supports various sizes.
|
|
8
|
-
*
|
|
8
|
+
* Must have a name attribute.
|
|
9
|
+
*
|
|
10
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
11
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
12
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
9
13
|
*
|
|
10
14
|
* @component
|
|
11
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../src/components/radio/Radio.tsx"],"sourcesContent":["import classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type RadioSize = \"md\" | \"sm\"\n\nexport interface RadioProps {\n description?: string\n label:
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../src/components/radio/Radio.tsx"],"sourcesContent":["import classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type RadioSize = \"md\" | \"sm\"\n\nexport interface RadioProps {\n description?: string\n /**\n * Label content for the radio. When using non-string content\n * (e.g. JSX), it must not contain interactive elements. This\n * includes native HTML elements such as `<a>` and `<button>`, as\n * well as Tapestry or Tapestry-React interactive components.\n */\n label: React.ReactNode\n name: string\n size?: RadioSize\n}\n\nexport type RadioElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof RadioProps | \"type\"\n> &\n RadioProps\n\n/**\n * A radio component that renders as a radio input with label.\n * Supports various sizes.\n * Must have a name attribute.\n *\n * When using non-string content for `label` (e.g. JSX), it must not contain\n * interactive elements. This includes native HTML elements such as `<a>` and\n * `<button>`, as well as Tapestry or Tapestry-React interactive components.\n *\n * @component\n */\nexport const Radio = forwardRef<HTMLInputElement, RadioElementProps>(\n (\n {\n className,\n description,\n id,\n label,\n size = \"md\",\n ...restProps\n }: RadioElementProps,\n ref\n ) => {\n const combinedClassName = classNames(\n \"tds-radio\",\n size && size === \"sm\" && `tds-radio--sm`,\n className\n )\n\n const stableId = useId()\n const radioId = id || `tds-radio-${stableId}`\n\n return (\n <div className={combinedClassName}>\n <input\n {...restProps}\n aria-describedby={description ? `${radioId}-description` : undefined}\n id={radioId}\n ref={ref}\n type=\"radio\"\n />\n <label htmlFor={radioId}>{label}</label>\n {description && (\n <p id={`${radioId}-description`} className=\"tds-radio-description\">\n {description}\n </p>\n )}\n </div>\n )\n }\n)\n\nRadio.displayName = \"Radio\"\n"],"names":[],"mappings":";;;;AA0BA;;;;;;;;;;AAUG;AACI,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,SAAS,EACT,WAAW,EACX,EAAE,EACF,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACM,EACpB,GAAG,KACD;AACF,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,WAAW,EACX,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAA,aAAA,CAAe,EACxC,SAAS,CACV;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,OAAO,GAAG,EAAE,IAAI,CAAA,UAAA,EAAa,QAAQ,EAAE;AAE7C,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA;QAC/B,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GACM,SAAS,EAAA,kBAAA,EACK,WAAW,GAAG,CAAA,EAAG,OAAO,CAAA,YAAA,CAAc,GAAG,SAAS,EACpE,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,EAAA,CACZ;AACF,QAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,OAAO,EAAA,EAAG,KAAK,CAAS;AACvC,QAAA,WAAW,KACV,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,CAAA,EAAG,OAAO,CAAA,YAAA,CAAc,EAAE,SAAS,EAAC,uBAAuB,EAAA,EAC/D,WAAW,CACV,CACL,CACG;AAEV,CAAC;AAGH,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
|
|
@@ -9,24 +9,41 @@ interface ToggleSwitchBaseProps {
|
|
|
9
9
|
required?: never;
|
|
10
10
|
size?: ToggleSwitchSize;
|
|
11
11
|
}
|
|
12
|
-
interface
|
|
12
|
+
interface ToggleSwitchWithVisibleLabel extends ToggleSwitchBaseProps {
|
|
13
13
|
"aria-labelledby"?: never;
|
|
14
|
-
hideLabel?:
|
|
14
|
+
hideLabel?: false;
|
|
15
|
+
/**
|
|
16
|
+
* Label content for the toggle switch. When using non-string content
|
|
17
|
+
* (e.g. JSX), it must not contain interactive elements. This
|
|
18
|
+
* includes native HTML elements such as `<a>` and `<button>`, as
|
|
19
|
+
* well as Tapestry or Tapestry-React interactive components.
|
|
20
|
+
*/
|
|
21
|
+
label: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
interface ToggleSwitchWithHiddenLabel extends ToggleSwitchBaseProps {
|
|
24
|
+
"aria-labelledby"?: never;
|
|
25
|
+
hideLabel: true;
|
|
26
|
+
/** Label text for the toggle switch, used as an accessible `aria-label`. */
|
|
15
27
|
label: string;
|
|
16
28
|
}
|
|
17
29
|
interface ToggleSwitchWithAriaLabelledBy extends ToggleSwitchBaseProps {
|
|
18
30
|
"aria-labelledby": string;
|
|
19
31
|
hideLabel?: never;
|
|
32
|
+
/** Not available when `aria-labelledby` is provided. */
|
|
20
33
|
label?: never;
|
|
21
34
|
}
|
|
22
|
-
export type ToggleSwitchProps =
|
|
35
|
+
export type ToggleSwitchProps = ToggleSwitchWithVisibleLabel | ToggleSwitchWithHiddenLabel | ToggleSwitchWithAriaLabelledBy;
|
|
23
36
|
export type ToggleSwitchElementProps = Omit<InputHTMLAttributes<HTMLInputElement>, keyof ToggleSwitchProps | "type" | "required" | "aria-required"> & ToggleSwitchProps;
|
|
24
37
|
/**
|
|
25
38
|
* A toggle switch component that renders as a checkbox input styled as a switch.
|
|
26
39
|
*
|
|
27
40
|
* **Required:** You must provide either:
|
|
28
|
-
* - `label` - Label
|
|
41
|
+
* - `label` - Label content for the switch (must be a string when `hideLabel` is true)
|
|
29
42
|
* - `aria-labelledby` - ID of an external element that provides the label
|
|
43
|
+
*
|
|
44
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
45
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
46
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
30
47
|
*/
|
|
31
48
|
export declare const ToggleSwitch: React.ForwardRefExoticComponent<ToggleSwitchElementProps & React.RefAttributes<HTMLInputElement>>;
|
|
32
49
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAI9D,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE1C,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACxB;AAED,UAAU,
|
|
1
|
+
{"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAI9D,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE1C,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACxB;AAED,UAAU,4BAA6B,SAAQ,qBAAqB;IAClE,iBAAiB,CAAC,EAAE,KAAK,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,UAAU,2BAA4B,SAAQ,qBAAqB;IACjE,iBAAiB,CAAC,EAAE,KAAK,CAAA;IACzB,SAAS,EAAE,IAAI,CAAA;IACf,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,8BAA+B,SAAQ,qBAAqB;IACpE,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,wDAAwD;IACxD,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,MAAM,iBAAiB,GACzB,4BAA4B,GAC5B,2BAA2B,GAC3B,8BAA8B,CAAA;AAElC,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,CAChE,GACC,iBAAiB,CAAA;AAEnB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,mGA0DxB,CAAA"}
|
|
@@ -6,8 +6,12 @@ import { useId } from '../../utilities/useId.js';
|
|
|
6
6
|
* A toggle switch component that renders as a checkbox input styled as a switch.
|
|
7
7
|
*
|
|
8
8
|
* **Required:** You must provide either:
|
|
9
|
-
* - `label` - Label
|
|
9
|
+
* - `label` - Label content for the switch (must be a string when `hideLabel` is true)
|
|
10
10
|
* - `aria-labelledby` - ID of an external element that provides the label
|
|
11
|
+
*
|
|
12
|
+
* When using non-string content for `label` (e.g. JSX), it must not contain
|
|
13
|
+
* interactive elements. This includes native HTML elements such as `<a>` and
|
|
14
|
+
* `<button>`, as well as Tapestry or Tapestry-React interactive components.
|
|
11
15
|
*/
|
|
12
16
|
const ToggleSwitch = forwardRef(({ "aria-describedby": ariaDescribedby, checked, className, description, hideLabel = false, id, label, size = "md", ...restProps }, ref) => {
|
|
13
17
|
const combinedClassName = classNames("tds-toggle-switch", size && size === "sm" && `tds-toggle-switch--sm`, hideLabel && `tds-toggle-switch--hide-label`, className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitch.js","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type ToggleSwitchSize = \"md\" | \"sm\"\n\ninterface ToggleSwitchBaseProps {\n \"aria-invalid\"?: never\n \"aria-label\"?: never\n \"aria-required\"?: never\n description?: string\n required?: never\n size?: ToggleSwitchSize\n}\n\ninterface
|
|
1
|
+
{"version":3,"file":"ToggleSwitch.js","sources":["../../../src/components/toggle-switch/ToggleSwitch.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport classNames from \"classnames\"\nimport React, { forwardRef, InputHTMLAttributes } from \"react\"\n\nimport { useId } from \"../../utilities/useId\"\n\nexport type ToggleSwitchSize = \"md\" | \"sm\"\n\ninterface ToggleSwitchBaseProps {\n \"aria-invalid\"?: never\n \"aria-label\"?: never\n \"aria-required\"?: never\n description?: string\n required?: never\n size?: ToggleSwitchSize\n}\n\ninterface ToggleSwitchWithVisibleLabel extends ToggleSwitchBaseProps {\n \"aria-labelledby\"?: never\n hideLabel?: false\n /**\n * Label content for the toggle switch. When using non-string content\n * (e.g. JSX), it must not contain interactive elements. This\n * includes native HTML elements such as `<a>` and `<button>`, as\n * well as Tapestry or Tapestry-React interactive components.\n */\n label: React.ReactNode\n}\n\ninterface ToggleSwitchWithHiddenLabel extends ToggleSwitchBaseProps {\n \"aria-labelledby\"?: never\n hideLabel: true\n /** Label text for the toggle switch, used as an accessible `aria-label`. */\n label: string\n}\n\ninterface ToggleSwitchWithAriaLabelledBy extends ToggleSwitchBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n /** Not available when `aria-labelledby` is provided. */\n label?: never\n}\n\nexport type ToggleSwitchProps =\n | ToggleSwitchWithVisibleLabel\n | ToggleSwitchWithHiddenLabel\n | ToggleSwitchWithAriaLabelledBy\n\nexport type ToggleSwitchElementProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n keyof ToggleSwitchProps | \"type\" | \"required\" | \"aria-required\"\n> &\n ToggleSwitchProps\n\n/**\n * A toggle switch component that renders as a checkbox input styled as a switch.\n *\n * **Required:** You must provide either:\n * - `label` - Label content for the switch (must be a string when `hideLabel` is true)\n * - `aria-labelledby` - ID of an external element that provides the label\n *\n * When using non-string content for `label` (e.g. JSX), it must not contain\n * interactive elements. This includes native HTML elements such as `<a>` and\n * `<button>`, as well as Tapestry or Tapestry-React interactive components.\n */\nexport const ToggleSwitch = forwardRef<\n HTMLInputElement,\n ToggleSwitchElementProps\n>(\n (\n {\n \"aria-describedby\": ariaDescribedby,\n checked,\n className,\n description,\n hideLabel = false,\n id,\n label,\n size = \"md\",\n ...restProps\n }: ToggleSwitchElementProps,\n ref\n ) => {\n const combinedClassName = classNames(\n \"tds-toggle-switch\",\n size && size === \"sm\" && `tds-toggle-switch--sm`,\n hideLabel && `tds-toggle-switch--hide-label`,\n className\n )\n\n const stableId = useId()\n const toggleSwitchId = id || `tds-toggle-switch-${stableId}`\n\n return (\n <div className={combinedClassName}>\n <div className=\"tds-toggle-switch-track\" aria-hidden=\"true\"></div>\n <input\n {...restProps}\n id={toggleSwitchId}\n type=\"checkbox\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={hideLabel ? (label as string) : undefined}\n aria-describedby={\n description && !hideLabel\n ? `${toggleSwitchId}-description`\n : ariaDescribedby\n }\n checked={checked}\n ref={ref}\n />\n {label && !hideLabel && <label htmlFor={toggleSwitchId}>{label}</label>}\n {description && !hideLabel && (\n <p\n id={`${toggleSwitchId}-description`}\n className=\"tds-toggle-switch-description\"\n >\n {description}\n </p>\n )}\n </div>\n )\n }\n)\n\nToggleSwitch.displayName = \"ToggleSwitch\"\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;AAUG;AACI,MAAM,YAAY,GAAG,UAAU,CAIpC,CACE,EACE,kBAAkB,EAAE,eAAe,EACnC,OAAO,EACP,SAAS,EACT,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,EAAE,EACF,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACa,EAC3B,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAClC,mBAAmB,EACnB,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAA,qBAAA,CAAuB,EAChD,SAAS,IAAI,+BAA+B,EAC5C,SAAS,CACV;AAED,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AACxB,IAAA,MAAM,cAAc,GAAG,EAAE,IAAI,CAAA,kBAAA,EAAqB,QAAQ,EAAE;AAE5D,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA;AAC/B,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yBAAyB,EAAA,aAAA,EAAa,MAAM,EAAA,CAAO;AAClE,QAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GACM,SAAS,EACb,EAAE,EAAE,cAAc,EAClB,IAAI,EAAC,UAAU,EACf,IAAI,EAAC,QAAQ,EAAA,cAAA,EACC,OAAO,EAAA,YAAA,EACT,SAAS,GAAI,KAAgB,GAAG,SAAS,EAAA,kBAAA,EAEnD,WAAW,IAAI,CAAC;kBACZ,CAAA,EAAG,cAAc,CAAA,YAAA;kBACjB,eAAe,EAErB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EAAA,CACR;QACD,KAAK,IAAI,CAAC,SAAS,IAAI,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,cAAc,EAAA,EAAG,KAAK,CAAS;QACtE,WAAW,IAAI,CAAC,SAAS,KACxB,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,EAAE,EAAE,CAAA,EAAG,cAAc,cAAc,EACnC,SAAS,EAAC,+BAA+B,EAAA,EAExC,WAAW,CACV,CACL,CACG;AAEV,CAAC;AAGH,YAAY,CAAC,WAAW,GAAG,cAAc;;;;"}
|
package/dist/reactRender.css
CHANGED
|
@@ -2072,6 +2072,153 @@ a[class="tds-btn"]{
|
|
|
2072
2072
|
@media (prefers-color-scheme: dark){
|
|
2073
2073
|
}
|
|
2074
2074
|
|
|
2075
|
+
.tds-toggle-switch{
|
|
2076
|
+
--tds-toggle-switch-font-size:var(--t-font-size-md);
|
|
2077
|
+
--tds-toggle-switch-column-gap:var(--t-spacing-2);
|
|
2078
|
+
--tds-toggle-switch-cursor:pointer;
|
|
2079
|
+
--tds-toggle-switch-display:inline-grid;
|
|
2080
|
+
--tds-toggle-switch-line-height:1.4;
|
|
2081
|
+
|
|
2082
|
+
--tds-toggle-switch-label-color:var(--t-text-color);
|
|
2083
|
+
|
|
2084
|
+
--tds-toggle-switch-track-width:var(--t-container-size-md);
|
|
2085
|
+
--tds-toggle-switch-track-outline:none;
|
|
2086
|
+
--tds-toggle-switch-track-height:var(--t-container-size-xs);
|
|
2087
|
+
--tds-toggle-switch-track-background-color:var(--t-fill-color-control-neutral-off);
|
|
2088
|
+
--tds-toggle-switch-track-transition:background-color 180ms ease-in-out;
|
|
2089
|
+
|
|
2090
|
+
--tds-toggle-switch-thumb-size:var(--t-element-size-md);
|
|
2091
|
+
--tds-toggle-switch-thumb-transform:translateX(0);
|
|
2092
|
+
--tds-toggle-switch-thumb-transition:transform 180ms ease-in-out;
|
|
2093
|
+
|
|
2094
|
+
--tds-toggle-switch-description-font-size:var(--t-font-size-sm);
|
|
2095
|
+
--tds-toggle-switch-description-line-height:1.35;
|
|
2096
|
+
--tds-toggle-switch-description-color:var(--t-text-color-secondary);
|
|
2097
|
+
|
|
2098
|
+
display:var(--tds-toggle-switch-display);
|
|
2099
|
+
grid-template-areas:"input label" ". description";
|
|
2100
|
+
grid-template-columns:var(--tds-toggle-switch-track-width) auto;
|
|
2101
|
+
-moz-column-gap:var(--tds-toggle-switch-column-gap);
|
|
2102
|
+
column-gap:var(--tds-toggle-switch-column-gap);
|
|
2103
|
+
-webkit-user-select:none;
|
|
2104
|
+
-moz-user-select:none;
|
|
2105
|
+
user-select:none;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
.tds-toggle-switch input[type="checkbox"]{
|
|
2109
|
+
position:absolute;
|
|
2110
|
+
grid-area:input;
|
|
2111
|
+
width:var(--tds-toggle-switch-track-width);
|
|
2112
|
+
height:var(--tds-toggle-switch-track-height);
|
|
2113
|
+
margin:0;
|
|
2114
|
+
-webkit-appearance:none;
|
|
2115
|
+
-moz-appearance:none;
|
|
2116
|
+
appearance:none;
|
|
2117
|
+
cursor:var(--tds-toggle-switch-cursor);
|
|
2118
|
+
background-color:transparent;
|
|
2119
|
+
border:0;
|
|
2120
|
+
border-radius:var(--t-border-radius-round);
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
.tds-toggle-switch label{
|
|
2124
|
+
display:inline-flex;
|
|
2125
|
+
grid-area:label;
|
|
2126
|
+
-moz-column-gap:var(--tds-toggle-switch-column-gap);
|
|
2127
|
+
column-gap:var(--tds-toggle-switch-column-gap);
|
|
2128
|
+
margin-top:-.09375em;
|
|
2129
|
+
font-size:var(--tds-toggle-switch-font-size);
|
|
2130
|
+
font-weight:var(--t-font-weight-normal);
|
|
2131
|
+
line-height:var(--tds-toggle-switch-line-height);
|
|
2132
|
+
color:var(--tds-toggle-switch-label-color);
|
|
2133
|
+
cursor:var(--tds-toggle-switch-cursor);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
.tds-toggle-switch:has(.tds-toggle-switch-description){
|
|
2137
|
+
row-gap:var(--t-spacing-fourth);
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
.tds-toggle-switch:not(:has(input:disabled)):has(input:hover){
|
|
2141
|
+
--tds-toggle-switch-track-background-color:var(--t-fill-color-neutral-025);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
.tds-toggle-switch:has(input:focus-visible){
|
|
2145
|
+
--tds-toggle-switch-track-outline:solid var(--t-spacing-fourth) var(--t-border-color-status-info);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
.tds-toggle-switch:has(input:checked){
|
|
2149
|
+
--tds-toggle-switch-track-background-color:var(--t-fill-color-control);
|
|
2150
|
+
--tds-toggle-switch-thumb-transform:translateX(calc(var(--tds-toggle-switch-track-width) - var(--tds-toggle-switch-thumb-size) - var(--t-spacing-half)));
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
.tds-toggle-switch:has(input:checked):not(:has(input:disabled)):has(input:hover){
|
|
2154
|
+
--tds-toggle-switch-track-background-color:var(--t-fill-color-interaction-hover);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
.tds-toggle-switch:has(input:disabled){
|
|
2158
|
+
--tds-toggle-switch-track-background-color:var(--t-fill-color-control-disabled);
|
|
2159
|
+
--tds-toggle-switch-label-color:var(--t-text-color-disabled);
|
|
2160
|
+
--tds-toggle-switch-description-color:var(--t-text-color-disabled);
|
|
2161
|
+
--tds-toggle-switch-cursor:not-allowed;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
.tds-toggle-switch-track{
|
|
2165
|
+
position:relative;
|
|
2166
|
+
flex-shrink:0;
|
|
2167
|
+
grid-area:input;
|
|
2168
|
+
width:var(--tds-toggle-switch-track-width);
|
|
2169
|
+
height:var(--tds-toggle-switch-track-height);
|
|
2170
|
+
outline:var(--tds-toggle-switch-track-outline);
|
|
2171
|
+
outline-offset:var(--t-spacing-fourth);
|
|
2172
|
+
background-color:var(--tds-toggle-switch-track-background-color);
|
|
2173
|
+
border-radius:var(--t-border-radius-round);
|
|
2174
|
+
transition:var(--tds-toggle-switch-track-transition);
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
.tds-toggle-switch-track::before{
|
|
2178
|
+
position:absolute;
|
|
2179
|
+
top:var(--t-spacing-fourth);
|
|
2180
|
+
left:var(--t-spacing-fourth);
|
|
2181
|
+
width:var(--tds-toggle-switch-thumb-size);
|
|
2182
|
+
height:var(--tds-toggle-switch-thumb-size);
|
|
2183
|
+
content:"";
|
|
2184
|
+
background-color:#fff;
|
|
2185
|
+
border-radius:var(--t-border-radius-round);
|
|
2186
|
+
transform:var(--tds-toggle-switch-thumb-transform);
|
|
2187
|
+
transition:var(--tds-toggle-switch-thumb-transition);
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
@media (prefers-reduced-motion: reduce){
|
|
2191
|
+
|
|
2192
|
+
.tds-toggle-switch-track{
|
|
2193
|
+
--tds-toggle-switch-track-transition:none;
|
|
2194
|
+
--tds-toggle-switch-thumb-transition:none;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
.tds-toggle-switch-description{
|
|
2199
|
+
display:flex;
|
|
2200
|
+
grid-area:description;
|
|
2201
|
+
align-items:flex-start;
|
|
2202
|
+
margin:0;
|
|
2203
|
+
font-size:var(--tds-toggle-switch-description-font-size);
|
|
2204
|
+
line-height:var(--tds-toggle-switch-description-line-height);
|
|
2205
|
+
color:var(--tds-toggle-switch-description-color);
|
|
2206
|
+
cursor:text;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
.tds-toggle-switch--sm{
|
|
2210
|
+
--tds-toggle-switch-font-size:var(--t-font-size-sm);
|
|
2211
|
+
--tds-toggle-switch-line-height:1.35;
|
|
2212
|
+
--tds-toggle-switch-track-height:var(--t-element-size-lg);
|
|
2213
|
+
--tds-toggle-switch-thumb-size:var(--t-element-size-sm);
|
|
2214
|
+
--tds-toggle-switch-description-font-size:var(--t-font-size-xs);
|
|
2215
|
+
--tds-toggle-switch-description-line-height:1.3;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
.tds-toggle-switch--hide-label{
|
|
2219
|
+
--tds-toggle-switch-display:inline-flex;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2075
2222
|
.tds-checkbox{
|
|
2076
2223
|
--tds-checkbox-font-size:var(--t-font-size-md);
|
|
2077
2224
|
--tds-checkbox-cursor:pointer;
|
|
@@ -2097,10 +2244,9 @@ a[class="tds-btn"]{
|
|
|
2097
2244
|
|
|
2098
2245
|
position:relative;
|
|
2099
2246
|
display:inline-grid;
|
|
2100
|
-
grid-template-
|
|
2101
|
-
grid-
|
|
2102
|
-
|
|
2103
|
-
column-gap:var(--t-spacing-1);
|
|
2247
|
+
grid-template-columns:auto;
|
|
2248
|
+
grid-auto-columns:1fr;
|
|
2249
|
+
gap:var(--t-spacing-fourth) var(--t-spacing-1);
|
|
2104
2250
|
line-height:var(--tds-checkbox-line-height);
|
|
2105
2251
|
cursor:var(--tds-checkbox-cursor);
|
|
2106
2252
|
-webkit-user-select:none;
|
|
@@ -2109,20 +2255,15 @@ a[class="tds-btn"]{
|
|
|
2109
2255
|
}
|
|
2110
2256
|
|
|
2111
2257
|
.tds-checkbox label{
|
|
2112
|
-
grid-area:
|
|
2258
|
+
grid-area:1 / 2;
|
|
2113
2259
|
font-size:var(--tds-checkbox-font-size);
|
|
2114
2260
|
font-weight:var(--t-font-weight-normal);
|
|
2115
2261
|
color:var(--tds-checkbox-label-color);
|
|
2116
2262
|
cursor:var(--tds-checkbox-cursor);
|
|
2117
2263
|
}
|
|
2118
2264
|
|
|
2119
|
-
.tds-checkbox:has(.tds-checkbox-description){
|
|
2120
|
-
row-gap:var(--t-spacing-fourth);
|
|
2121
|
-
}
|
|
2122
|
-
|
|
2123
2265
|
.tds-checkbox input[type="checkbox"]{
|
|
2124
2266
|
position:relative;
|
|
2125
|
-
grid-area:input;
|
|
2126
2267
|
width:1em;
|
|
2127
2268
|
height:1em;
|
|
2128
2269
|
margin:calc((1lh - 1em) / 2) 0 0;
|
|
@@ -2194,7 +2335,7 @@ a[class="tds-btn"]{
|
|
|
2194
2335
|
}
|
|
2195
2336
|
|
|
2196
2337
|
.tds-checkbox:has(input:checked){
|
|
2197
|
-
--tds-checkbox-input-icon:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02LjUwMjAxIDExLjQyOTNMMy42NzM3NCA4LjM5MkMzLjUxNjE2IDguMjI0ODkgMy41MTYxNiA3Ljk1Mjg5IDMuNjczNzQgNy43ODRMNC4yNDUwNSA3LjE3Njg5QzQuNDAyNjIgNy4wMDk3OCA0LjY1ODc4IDcuMDA5NzggNC44MTYzNiA3LjE3Njg5TDYuNzg4MDcgOS4zMDMxMUwxMS4xODMyIDQuNTY5NzhDMTEuMzQwOCA0LjQwMjY2IDExLjU5NjkgNC40MDI2NiAxMS43NTQ1IDQuNTY5NzhMMTIuMzI1OCA1LjE3Nzc4QzEyLjQ4MzQgNS4zNDQ4OSAxMi40ODM0IDUuNjE3NzggMTIuMzI1OCA1Ljc4NEw3LjA3MzMyIDExLjQyOTNDNi45MTU3NCAxMS41OTY0IDYuNjU5NTggMTEuNTk2NCA2LjUwMjAxIDExLjQyOTNaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K")
|
|
2338
|
+
--tds-checkbox-input-icon:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02LjUwMjAxIDExLjQyOTNMMy42NzM3NCA4LjM5MkMzLjUxNjE2IDguMjI0ODkgMy41MTYxNiA3Ljk1Mjg5IDMuNjczNzQgNy43ODRMNC4yNDUwNSA3LjE3Njg5QzQuNDAyNjIgNy4wMDk3OCA0LjY1ODc4IDcuMDA5NzggNC44MTYzNiA3LjE3Njg5TDYuNzg4MDcgOS4zMDMxMUwxMS4xODMyIDQuNTY5NzhDMTEuMzQwOCA0LjQwMjY2IDExLjU5NjkgNC40MDI2NiAxMS43NTQ1IDQuNTY5NzhMMTIuMzI1OCA1LjE3Nzc4QzEyLjQ4MzQgNS4zNDQ4OSAxMi40ODM0IDUuNjE3NzggMTIuMzI1OCA1Ljc4NEw3LjA3MzMyIDExLjQyOTNDNi45MTU3NCAxMS41OTY0IDYuNjU5NTggMTEuNTk2NCA2LjUwMjAxIDExLjQyOTNaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K");
|
|
2198
2339
|
}
|
|
2199
2340
|
|
|
2200
2341
|
.tds-checkbox:has(input:indeterminate){
|
|
@@ -2243,7 +2384,7 @@ a[class="tds-btn"]{
|
|
|
2243
2384
|
|
|
2244
2385
|
.tds-checkbox-description{
|
|
2245
2386
|
display:flex;
|
|
2246
|
-
grid-area:
|
|
2387
|
+
grid-area:2 / 2;
|
|
2247
2388
|
gap:4px;
|
|
2248
2389
|
align-items:flex-start;
|
|
2249
2390
|
margin:0;
|
|
@@ -2268,153 +2409,6 @@ a[class="tds-btn"]{
|
|
|
2268
2409
|
--tds-checkbox-description-line-height:1.3;
|
|
2269
2410
|
}
|
|
2270
2411
|
|
|
2271
|
-
.tds-toggle-switch{
|
|
2272
|
-
--tds-toggle-switch-font-size:var(--t-font-size-md);
|
|
2273
|
-
--tds-toggle-switch-column-gap:var(--t-spacing-2);
|
|
2274
|
-
--tds-toggle-switch-cursor:pointer;
|
|
2275
|
-
--tds-toggle-switch-display:inline-grid;
|
|
2276
|
-
--tds-toggle-switch-line-height:1.4;
|
|
2277
|
-
|
|
2278
|
-
--tds-toggle-switch-label-color:var(--t-text-color);
|
|
2279
|
-
|
|
2280
|
-
--tds-toggle-switch-track-width:var(--t-container-size-md);
|
|
2281
|
-
--tds-toggle-switch-track-outline:none;
|
|
2282
|
-
--tds-toggle-switch-track-height:var(--t-container-size-xs);
|
|
2283
|
-
--tds-toggle-switch-track-background-color:var(--t-fill-color-control-neutral-off);
|
|
2284
|
-
--tds-toggle-switch-track-transition:background-color 180ms ease-in-out;
|
|
2285
|
-
|
|
2286
|
-
--tds-toggle-switch-thumb-size:var(--t-element-size-md);
|
|
2287
|
-
--tds-toggle-switch-thumb-transform:translateX(0);
|
|
2288
|
-
--tds-toggle-switch-thumb-transition:transform 180ms ease-in-out;
|
|
2289
|
-
|
|
2290
|
-
--tds-toggle-switch-description-font-size:var(--t-font-size-sm);
|
|
2291
|
-
--tds-toggle-switch-description-line-height:1.35;
|
|
2292
|
-
--tds-toggle-switch-description-color:var(--t-text-color-secondary);
|
|
2293
|
-
|
|
2294
|
-
display:var(--tds-toggle-switch-display);
|
|
2295
|
-
grid-template-areas:"input label" ". description";
|
|
2296
|
-
grid-template-columns:var(--tds-toggle-switch-track-width) auto;
|
|
2297
|
-
-moz-column-gap:var(--tds-toggle-switch-column-gap);
|
|
2298
|
-
column-gap:var(--tds-toggle-switch-column-gap);
|
|
2299
|
-
-webkit-user-select:none;
|
|
2300
|
-
-moz-user-select:none;
|
|
2301
|
-
user-select:none;
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
.tds-toggle-switch input[type="checkbox"]{
|
|
2305
|
-
position:absolute;
|
|
2306
|
-
grid-area:input;
|
|
2307
|
-
width:var(--tds-toggle-switch-track-width);
|
|
2308
|
-
height:var(--tds-toggle-switch-track-height);
|
|
2309
|
-
margin:0;
|
|
2310
|
-
-webkit-appearance:none;
|
|
2311
|
-
-moz-appearance:none;
|
|
2312
|
-
appearance:none;
|
|
2313
|
-
cursor:var(--tds-toggle-switch-cursor);
|
|
2314
|
-
background-color:transparent;
|
|
2315
|
-
border:0;
|
|
2316
|
-
border-radius:var(--t-border-radius-round);
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
.tds-toggle-switch label{
|
|
2320
|
-
display:inline-flex;
|
|
2321
|
-
grid-area:label;
|
|
2322
|
-
-moz-column-gap:var(--tds-toggle-switch-column-gap);
|
|
2323
|
-
column-gap:var(--tds-toggle-switch-column-gap);
|
|
2324
|
-
margin-top:-.09375em;
|
|
2325
|
-
font-size:var(--tds-toggle-switch-font-size);
|
|
2326
|
-
font-weight:var(--t-font-weight-normal);
|
|
2327
|
-
line-height:var(--tds-toggle-switch-line-height);
|
|
2328
|
-
color:var(--tds-toggle-switch-label-color);
|
|
2329
|
-
cursor:var(--tds-toggle-switch-cursor);
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
.tds-toggle-switch:has(.tds-toggle-switch-description){
|
|
2333
|
-
row-gap:var(--t-spacing-fourth);
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
.tds-toggle-switch:not(:has(input:disabled)):has(input:hover){
|
|
2337
|
-
--tds-toggle-switch-track-background-color:var(--t-fill-color-neutral-025);
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
.tds-toggle-switch:has(input:focus-visible){
|
|
2341
|
-
--tds-toggle-switch-track-outline:solid var(--t-spacing-fourth) var(--t-border-color-status-info);
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
.tds-toggle-switch:has(input:checked){
|
|
2345
|
-
--tds-toggle-switch-track-background-color:var(--t-fill-color-control);
|
|
2346
|
-
--tds-toggle-switch-thumb-transform:translateX(calc(var(--tds-toggle-switch-track-width) - var(--tds-toggle-switch-thumb-size) - var(--t-spacing-half)));
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
.tds-toggle-switch:has(input:checked):not(:has(input:disabled)):has(input:hover){
|
|
2350
|
-
--tds-toggle-switch-track-background-color:var(--t-fill-color-interaction-hover);
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
.tds-toggle-switch:has(input:disabled){
|
|
2354
|
-
--tds-toggle-switch-track-background-color:var(--t-fill-color-control-disabled);
|
|
2355
|
-
--tds-toggle-switch-label-color:var(--t-text-color-disabled);
|
|
2356
|
-
--tds-toggle-switch-description-color:var(--t-text-color-disabled);
|
|
2357
|
-
--tds-toggle-switch-cursor:not-allowed;
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
.tds-toggle-switch-track{
|
|
2361
|
-
position:relative;
|
|
2362
|
-
flex-shrink:0;
|
|
2363
|
-
grid-area:input;
|
|
2364
|
-
width:var(--tds-toggle-switch-track-width);
|
|
2365
|
-
height:var(--tds-toggle-switch-track-height);
|
|
2366
|
-
outline:var(--tds-toggle-switch-track-outline);
|
|
2367
|
-
outline-offset:var(--t-spacing-fourth);
|
|
2368
|
-
background-color:var(--tds-toggle-switch-track-background-color);
|
|
2369
|
-
border-radius:var(--t-border-radius-round);
|
|
2370
|
-
transition:var(--tds-toggle-switch-track-transition);
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
.tds-toggle-switch-track::before{
|
|
2374
|
-
position:absolute;
|
|
2375
|
-
top:var(--t-spacing-fourth);
|
|
2376
|
-
left:var(--t-spacing-fourth);
|
|
2377
|
-
width:var(--tds-toggle-switch-thumb-size);
|
|
2378
|
-
height:var(--tds-toggle-switch-thumb-size);
|
|
2379
|
-
content:"";
|
|
2380
|
-
background-color:#fff;
|
|
2381
|
-
border-radius:var(--t-border-radius-round);
|
|
2382
|
-
transform:var(--tds-toggle-switch-thumb-transform);
|
|
2383
|
-
transition:var(--tds-toggle-switch-thumb-transition);
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
@media (prefers-reduced-motion: reduce){
|
|
2387
|
-
|
|
2388
|
-
.tds-toggle-switch-track{
|
|
2389
|
-
--tds-toggle-switch-track-transition:none;
|
|
2390
|
-
--tds-toggle-switch-thumb-transition:none;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
|
-
.tds-toggle-switch-description{
|
|
2395
|
-
display:flex;
|
|
2396
|
-
grid-area:description;
|
|
2397
|
-
align-items:flex-start;
|
|
2398
|
-
margin:0;
|
|
2399
|
-
font-size:var(--tds-toggle-switch-description-font-size);
|
|
2400
|
-
line-height:var(--tds-toggle-switch-description-line-height);
|
|
2401
|
-
color:var(--tds-toggle-switch-description-color);
|
|
2402
|
-
cursor:text;
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
.tds-toggle-switch--sm{
|
|
2406
|
-
--tds-toggle-switch-font-size:var(--t-font-size-sm);
|
|
2407
|
-
--tds-toggle-switch-line-height:1.35;
|
|
2408
|
-
--tds-toggle-switch-track-height:var(--t-element-size-lg);
|
|
2409
|
-
--tds-toggle-switch-thumb-size:var(--t-element-size-sm);
|
|
2410
|
-
--tds-toggle-switch-description-font-size:var(--t-font-size-xs);
|
|
2411
|
-
--tds-toggle-switch-description-line-height:1.3;
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
.tds-toggle-switch--hide-label{
|
|
2415
|
-
--tds-toggle-switch-display:inline-flex;
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
2412
|
.t-banner{
|
|
2419
2413
|
--t-banner-font-size:var(--t-font-size-md);
|
|
2420
2414
|
--t-banner-font-color:var(--t-text-color);
|