@protonradio/proton-ui 0.12.0 → 0.12.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/ButtonGroup/ButtonGroup.cjs.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.cjs.js.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.es.js +30 -16
- package/dist/components/ButtonGroup/ButtonGroup.es.js.map +1 -1
- package/dist/components/Checkbox/CheckboxInput/CheckboxInput.cjs.js +1 -1
- package/dist/components/Checkbox/CheckboxInput/CheckboxInput.cjs.js.map +1 -1
- package/dist/components/Checkbox/CheckboxInput/CheckboxInput.es.js +48 -48
- package/dist/components/Checkbox/CheckboxInput/CheckboxInput.es.js.map +1 -1
- package/dist/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.cjs.js +1 -1
- package/dist/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.cjs.js.map +1 -1
- package/dist/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.es.js +43 -43
- package/dist/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.es.js.map +1 -1
- package/dist/components/Input/BaseInput/Input.cjs.js +1 -1
- package/dist/components/Input/BaseInput/Input.cjs.js.map +1 -1
- package/dist/components/Input/BaseInput/Input.es.js +62 -62
- package/dist/components/Input/BaseInput/Input.es.js.map +1 -1
- package/dist/components/Popover/Popover.cjs.js.map +1 -1
- package/dist/components/Popover/Popover.es.js.map +1 -1
- package/dist/components/Select/Select.cjs.js +1 -1
- package/dist/components/Select/Select.cjs.js.map +1 -1
- package/dist/components/Select/Select.es.js +40 -29
- package/dist/components/Select/Select.es.js.map +1 -1
- package/dist/components/Switch/Switch.cjs.js +1 -1
- package/dist/components/Switch/Switch.cjs.js.map +1 -1
- package/dist/components/Switch/Switch.es.js +27 -26
- package/dist/components/Switch/Switch.es.js.map +1 -1
- package/dist/components/Table/DataTable/DataTable.cjs.js +1 -1
- package/dist/components/Table/DataTable/DataTable.cjs.js.map +1 -1
- package/dist/components/Table/DataTable/DataTable.es.js +6 -6
- package/dist/components/Table/DataTable/DataTable.es.js.map +1 -1
- package/dist/components/Tooltip/ResponsiveTooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/ResponsiveTooltip.es.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/design/darkTheme/colors.cjs.js +1 -1
- package/dist/design/darkTheme/colors.cjs.js.map +1 -1
- package/dist/design/darkTheme/colors.es.js +14 -14
- package/dist/design/darkTheme/colors.es.js.map +1 -1
- package/dist/index.d.ts +20 -14
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../node_modules/react/jsx-runtime.cjs.js"),x=require("react"),d=require("radix-ui");;/* empty css */function a({name:i="ButtonGroup",value:t,defaultValue:o,onChange:e,children:u,"data-testid":l}){const r=t!==void 0,[p,c]=x.useState(()=>o||""),G=r?t||"":p;return s.jsxRuntimeExports.jsx(d.RadioGroup.Root,{name:i,value:r?t:void 0,defaultValue:r?void 0:o,onValueChange:n=>{r||c(n),e==null||e(n)},orientation:"horizontal",className:"proton-ButtonGroup","data-value":G||void 0,"data-testid":l||void 0,"aria-label":i,children:u})}a.displayName="ProtonUIButtonGroup";a.Option=function({value:t,children:o,"data-testid":e}){const u=typeof o=="string"?o:t;return s.jsxRuntimeExports.jsx(d.RadioGroup.Item,{value:t,className:"proton-ButtonGroup__option","data-testid":e||void 0,"aria-label":u,children:o})};exports.ButtonGroup=a;
|
|
2
2
|
//# sourceMappingURL=ButtonGroup.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.cjs.js","sources":["../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"ButtonGroup.cjs.js","sources":["../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { RadioGroup as RadixRadioGroup } from \"radix-ui\";\n\nimport \"./ButtonGroup.css\";\n\nexport interface ButtonGroupProps {\n /**\n * The name of the ButtonGroup.\n */\n name?: string;\n /**\n * The value of the currently selected option in the ButtonGroup. Providing\n * this prop causes the component to become controlled.\n */\n value?: string;\n /**\n * The initially selected value of the ButtonGroup.\n */\n defaultValue?: string;\n /**\n * Called when the ButtonGroup's selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The ButtonGroup.Option elements to be rendered as the selectable values.\n */\n children?: ReactNode;\n /** The test ID for the component. */\n \"data-testid\"?: string;\n}\n\n/**\n * A radio button group component that allows selection of a single option from multiple choices.\n *\n * API:\n * - {@link ButtonGroupProps}\n */\nexport function ButtonGroup({\n name = \"ButtonGroup\",\n value,\n defaultValue,\n onChange,\n children,\n \"data-testid\": testId,\n}: ButtonGroupProps) {\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n () => defaultValue || \"\"\n );\n const dataValue = isControlled ? (value || \"\") : uncontrolledValue;\n\n return (\n <RadixRadioGroup.Root\n name={name}\n value={isControlled ? value : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n onValueChange={(v) => {\n if (!isControlled) setUncontrolledValue(v);\n onChange?.(v);\n }}\n orientation=\"horizontal\"\n className=\"proton-ButtonGroup\"\n data-value={dataValue || undefined}\n data-testid={testId || undefined}\n aria-label={name}\n >\n {children}\n </RadixRadioGroup.Root>\n );\n}\n\nButtonGroup.displayName = \"ProtonUIButtonGroup\";\n\nexport interface ButtonGroupOptionProps {\n /**\n * The value of this option. When this option is selected, this value will\n * become the ButtonGroup's new `value`.\n */\n value: string;\n /**\n * The text or component to be rendered as this option's content.\n */\n children: ReactNode;\n /** The test ID for this option. */\n \"data-testid\"?: string;\n}\n\n/**\n * A radio button option for the ButtonGroup.\n *\n * API:\n * - {@link ButtonGroupOptionProps}\n */\nButtonGroup.Option = function ButtonGroupOption({\n value,\n children,\n \"data-testid\": testId,\n}: ButtonGroupOptionProps) {\n const accessibleLabel = typeof children === \"string\" ? children : value;\n\n return (\n <RadixRadioGroup.Item\n value={value}\n className=\"proton-ButtonGroup__option\"\n data-testid={testId || undefined}\n aria-label={accessibleLabel}\n >\n {children}\n </RadixRadioGroup.Item>\n );\n};\n"],"names":["ButtonGroup","name","value","defaultValue","onChange","children","testId","isControlled","uncontrolledValue","setUncontrolledValue","useState","dataValue","jsx","RadixRadioGroup","v","accessibleLabel"],"mappings":"4NAuCO,SAASA,EAAY,CAC1B,KAAAC,EAAO,cACP,MAAAC,EACA,aAAAC,EACA,SAAAC,EACA,SAAAC,EACA,cAAeC,CACjB,EAAqB,CACnB,MAAMC,EAAeL,IAAU,OACzB,CAACM,EAAmBC,CAAoB,EAAIC,EAAAA,SAChD,IAAMP,GAAgB,EAAA,EAElBQ,EAAYJ,EAAgBL,GAAS,GAAMM,EAEjD,OACEI,EAAAA,kBAAAA,IAACC,EAAAA,WAAgB,KAAhB,CACC,KAAAZ,EACA,MAAOM,EAAeL,EAAQ,OAC9B,aAAcK,EAAe,OAAYJ,EACzC,cAAgBW,GAAM,CACfP,GAAcE,EAAqBK,CAAC,EACzCV,GAAA,MAAAA,EAAWU,EACb,EACA,YAAY,aACZ,UAAU,qBACV,aAAYH,GAAa,OACzB,cAAaL,GAAU,OACvB,aAAYL,EAEX,SAAAI,CAAA,CAAA,CAGP,CAEAL,EAAY,YAAc,sBAsB1BA,EAAY,OAAS,SAA2B,CAC9C,MAAAE,EACA,SAAAG,EACA,cAAeC,CACjB,EAA2B,CACzB,MAAMS,EAAkB,OAAOV,GAAa,SAAWA,EAAWH,EAElE,OACEU,EAAAA,kBAAAA,IAACC,EAAAA,WAAgB,KAAhB,CACC,MAAAX,EACA,UAAU,6BACV,cAAaI,GAAU,OACvB,aAAYS,EAEX,SAAAV,CAAA,CAAA,CAGP"}
|
|
@@ -1,41 +1,55 @@
|
|
|
1
1
|
import { j as u } from "../../node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { RadioGroup as
|
|
2
|
+
import { useState as f } from "react";
|
|
3
|
+
import { RadioGroup as e } from "radix-ui";
|
|
4
4
|
/* empty css */
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function p({
|
|
6
|
+
name: r = "ButtonGroup",
|
|
7
|
+
value: t,
|
|
8
|
+
defaultValue: o,
|
|
9
|
+
onChange: a,
|
|
10
|
+
children: s,
|
|
11
|
+
"data-testid": d
|
|
12
|
+
}) {
|
|
13
|
+
const i = t !== void 0, [l, m] = f(
|
|
14
|
+
() => o || ""
|
|
8
15
|
), c = i ? t || "" : l;
|
|
9
16
|
return /* @__PURE__ */ u.jsx(
|
|
10
|
-
|
|
17
|
+
e.Root,
|
|
11
18
|
{
|
|
12
|
-
name:
|
|
19
|
+
name: r,
|
|
13
20
|
value: i ? t : void 0,
|
|
14
|
-
defaultValue: i ? void 0 :
|
|
21
|
+
defaultValue: i ? void 0 : o,
|
|
15
22
|
onValueChange: (n) => {
|
|
16
|
-
i || m(n),
|
|
23
|
+
i || m(n), a == null || a(n);
|
|
17
24
|
},
|
|
18
25
|
orientation: "horizontal",
|
|
19
26
|
className: "proton-ButtonGroup",
|
|
20
27
|
"data-value": c || void 0,
|
|
21
|
-
"data-testid":
|
|
28
|
+
"data-testid": d || void 0,
|
|
29
|
+
"aria-label": r,
|
|
22
30
|
children: s
|
|
23
31
|
}
|
|
24
32
|
);
|
|
25
33
|
}
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
p.displayName = "ProtonUIButtonGroup";
|
|
35
|
+
p.Option = function({
|
|
36
|
+
value: t,
|
|
37
|
+
children: o,
|
|
38
|
+
"data-testid": a
|
|
39
|
+
}) {
|
|
40
|
+
const s = typeof o == "string" ? o : t;
|
|
28
41
|
return /* @__PURE__ */ u.jsx(
|
|
29
|
-
|
|
42
|
+
e.Item,
|
|
30
43
|
{
|
|
31
44
|
value: t,
|
|
32
45
|
className: "proton-ButtonGroup__option",
|
|
33
|
-
"data-testid":
|
|
34
|
-
|
|
46
|
+
"data-testid": a || void 0,
|
|
47
|
+
"aria-label": s,
|
|
48
|
+
children: o
|
|
35
49
|
}
|
|
36
50
|
);
|
|
37
51
|
};
|
|
38
52
|
export {
|
|
39
|
-
|
|
53
|
+
p as ButtonGroup
|
|
40
54
|
};
|
|
41
55
|
//# sourceMappingURL=ButtonGroup.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.es.js","sources":["../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"ButtonGroup.es.js","sources":["../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { RadioGroup as RadixRadioGroup } from \"radix-ui\";\n\nimport \"./ButtonGroup.css\";\n\nexport interface ButtonGroupProps {\n /**\n * The name of the ButtonGroup.\n */\n name?: string;\n /**\n * The value of the currently selected option in the ButtonGroup. Providing\n * this prop causes the component to become controlled.\n */\n value?: string;\n /**\n * The initially selected value of the ButtonGroup.\n */\n defaultValue?: string;\n /**\n * Called when the ButtonGroup's selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The ButtonGroup.Option elements to be rendered as the selectable values.\n */\n children?: ReactNode;\n /** The test ID for the component. */\n \"data-testid\"?: string;\n}\n\n/**\n * A radio button group component that allows selection of a single option from multiple choices.\n *\n * API:\n * - {@link ButtonGroupProps}\n */\nexport function ButtonGroup({\n name = \"ButtonGroup\",\n value,\n defaultValue,\n onChange,\n children,\n \"data-testid\": testId,\n}: ButtonGroupProps) {\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n () => defaultValue || \"\"\n );\n const dataValue = isControlled ? (value || \"\") : uncontrolledValue;\n\n return (\n <RadixRadioGroup.Root\n name={name}\n value={isControlled ? value : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n onValueChange={(v) => {\n if (!isControlled) setUncontrolledValue(v);\n onChange?.(v);\n }}\n orientation=\"horizontal\"\n className=\"proton-ButtonGroup\"\n data-value={dataValue || undefined}\n data-testid={testId || undefined}\n aria-label={name}\n >\n {children}\n </RadixRadioGroup.Root>\n );\n}\n\nButtonGroup.displayName = \"ProtonUIButtonGroup\";\n\nexport interface ButtonGroupOptionProps {\n /**\n * The value of this option. When this option is selected, this value will\n * become the ButtonGroup's new `value`.\n */\n value: string;\n /**\n * The text or component to be rendered as this option's content.\n */\n children: ReactNode;\n /** The test ID for this option. */\n \"data-testid\"?: string;\n}\n\n/**\n * A radio button option for the ButtonGroup.\n *\n * API:\n * - {@link ButtonGroupOptionProps}\n */\nButtonGroup.Option = function ButtonGroupOption({\n value,\n children,\n \"data-testid\": testId,\n}: ButtonGroupOptionProps) {\n const accessibleLabel = typeof children === \"string\" ? children : value;\n\n return (\n <RadixRadioGroup.Item\n value={value}\n className=\"proton-ButtonGroup__option\"\n data-testid={testId || undefined}\n aria-label={accessibleLabel}\n >\n {children}\n </RadixRadioGroup.Item>\n );\n};\n"],"names":["ButtonGroup","name","value","defaultValue","onChange","children","testId","isControlled","uncontrolledValue","setUncontrolledValue","useState","dataValue","jsx","RadixRadioGroup","v","accessibleLabel"],"mappings":";;;;AAuCO,SAASA,EAAY;AAAA,EAC1B,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAeC;AACjB,GAAqB;AACnB,QAAMC,IAAeL,MAAU,QACzB,CAACM,GAAmBC,CAAoB,IAAIC;AAAA,IAChD,MAAMP,KAAgB;AAAA,EAAA,GAElBQ,IAAYJ,IAAgBL,KAAS,KAAMM;AAEjD,SACEI,gBAAAA,EAAAA;AAAAA,IAACC,EAAgB;AAAA,IAAhB;AAAA,MACC,MAAAZ;AAAA,MACA,OAAOM,IAAeL,IAAQ;AAAA,MAC9B,cAAcK,IAAe,SAAYJ;AAAA,MACzC,eAAe,CAACW,MAAM;AACpB,QAAKP,KAAcE,EAAqBK,CAAC,GACzCV,KAAA,QAAAA,EAAWU;AAAA,MACb;AAAA,MACA,aAAY;AAAA,MACZ,WAAU;AAAA,MACV,cAAYH,KAAa;AAAA,MACzB,eAAaL,KAAU;AAAA,MACvB,cAAYL;AAAA,MAEX,UAAAI;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAL,EAAY,cAAc;AAsB1BA,EAAY,SAAS,SAA2B;AAAA,EAC9C,OAAAE;AAAA,EACA,UAAAG;AAAA,EACA,eAAeC;AACjB,GAA2B;AACzB,QAAMS,IAAkB,OAAOV,KAAa,WAAWA,IAAWH;AAElE,SACEU,gBAAAA,EAAAA;AAAAA,IAACC,EAAgB;AAAA,IAAhB;AAAA,MACC,OAAAX;AAAA,MACA,WAAU;AAAA,MACV,eAAaI,KAAU;AAAA,MACvB,cAAYS;AAAA,MAEX,UAAAV;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../node_modules/react/jsx-runtime.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../node_modules/react/jsx-runtime.cjs.js"),r=require("react"),N=require("../../../hooks/useMergedRef.cjs.js"),$=require("../CheckboxIndicator.cjs.js");;/* empty css */const n=require("../../../utils/string.cjs.js"),k=r.forwardRef(({checked:u,defaultChecked:m,onChange:i,name:p,value:I,isDisabled:l=!1,isRequired:h=!1,id:R,"data-testid":_,label:s,description:o,error:t,indeterminate:b=!1,round:c=!1},v)=>{const x=r.useRef(null),C=N.useMergedRef(x,v),y=u!==void 0,a=r.useId();r.useEffect(()=>{x.current&&(x.current.indeterminate=b)},[b]);const E=q=>{i==null||i(q.target.checked)},j=R||`${a}-checkbox`,d=typeof t=="string"?`${a}-error`:void 0,f=typeof o=="string"?`${a}-description`:void 0,g=[d,f].filter(Boolean).join(" ")||void 0;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:n.csx(l&&"proton-CheckboxInput--disabled"),children:e.jsxRuntimeExports.jsxs("div",{className:n.csx("proton-CheckboxInput__container",c&&"proton-CheckboxInput__container--round"),children:[typeof s=="string"?e.jsxRuntimeExports.jsx("label",{htmlFor:j,className:"proton-CheckboxInput__label",children:s}):s,e.jsxRuntimeExports.jsxs("span",{className:"proton-CheckboxInput__box",children:[e.jsxRuntimeExports.jsx("input",{ref:C,id:j,name:p,type:"checkbox",...y?{checked:u}:{defaultChecked:m},value:I,disabled:l,required:h,onChange:E,className:n.csx("proton-CheckboxInput__input",t&&"proton-CheckboxInput__input--error",c&&"proton-CheckboxInput__input--round"),"aria-label":s?void 0:p,"aria-invalid":!!t,"aria-errormessage":d,"aria-describedby":g,"data-testid":_}),e.jsxRuntimeExports.jsx($.CheckboxIndicator,{round:c})]}),typeof o=="string"?e.jsxRuntimeExports.jsxs("div",{id:f,"aria-live":"polite",children:[o,h&&e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",children:" *"})]}):o]})}),typeof t=="string"?e.jsxRuntimeExports.jsx("div",{role:"alert",className:n.csx("proton-CheckboxInput__error"),id:d,children:t}):t]})});k.displayName="ProtonUICheckboxInput";exports.CheckboxInput=k;
|
|
2
2
|
//# sourceMappingURL=CheckboxInput.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.cjs.js","sources":["../../../../src/components/Checkbox/CheckboxInput/CheckboxInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect, useRef, type ForwardedRef, type ReactNode, type ChangeEvent } from \"react\";\n\nimport { useMergedRef } from \"../../../hooks/useMergedRef\";\nimport { csx } from \"../../../utils\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\nimport \"./CheckboxInput.css\";\n\nexport interface CheckboxInputProps {\n /**\n * Whether the checkbox is checked (controlled mode).\n */\n checked?: boolean;\n\n /**\n * Whether the checkbox is checked by default (uncontrolled mode).\n */\n defaultChecked?: boolean;\n\n /** The error attribute of the checkbox input. */\n error?: ReactNode | string;\n\n /** The description attribute of the checkbox input. */\n description?: ReactNode | string;\n\n /** The test id attribute of the checkbox input. */\n \"data-testid\"?: string;\n\n /**\n * Callback fired when the checkbox state changes.\n */\n onChange?: (checked: boolean) => void;\n\n /**\n * Whether the checkbox is in an indeterminate state. Used for checkboxes that are neither checked nor unchecked.\n * @default false\n * @external https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate\n * @reference @external https://medium.com/indigoag-eng/indeterminate-checkboxes-are-weird-704b246c0f19\n */\n indeterminate?: boolean;\n\n /** The id attribute of the checkbox input. */\n id?: string;\n\n /** Whether the checkbox is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /** Whether the checkbox is required.\n * @default false\n */\n isRequired?: boolean;\n\n /** The name attribute of the checkbox input. */\n name: string;\n\n /** The label attribute of the checkbox input. */\n label?: string | ReactNode;\n\n /**\n * The value attribute of the checkbox input (for form submission).\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value\n */\n value?: string;\n\n /**\n * Whether the checkbox should be rendered as a round control (with a dot indicator when checked).\n * @default false\n */\n round?: boolean;\n}\n\n/**\n * A checkbox input component with support for labels, descriptions, error states, and controlled/uncontrolled modes.\n *\n * API:\n * - {@link CheckboxInputProps}\n */\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n (\n {\n checked: controlledChecked,\n defaultChecked,\n onChange,\n name,\n value,\n isDisabled = false,\n isRequired = false,\n id,\n \"data-testid\": testId,\n label,\n description,\n error,\n indeterminate = false,\n round = false,\n },\n forwardedRef: ForwardedRef<HTMLInputElement>,\n ) => {\n const checkboxRef = useRef<HTMLInputElement>(null);\n const setRefs = useMergedRef(checkboxRef, forwardedRef);\n const isControlled = controlledChecked !== undefined;\n\n // indeterminate state can only be set via JS\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked);\n };\n\n const checkboxId = id || `${
|
|
1
|
+
{"version":3,"file":"CheckboxInput.cjs.js","sources":["../../../../src/components/Checkbox/CheckboxInput/CheckboxInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect, useId, useRef, type ForwardedRef, type ReactNode, type ChangeEvent } from \"react\";\n\nimport { useMergedRef } from \"../../../hooks/useMergedRef\";\nimport { csx } from \"../../../utils\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\nimport \"./CheckboxInput.css\";\n\nexport interface CheckboxInputProps {\n /**\n * Whether the checkbox is checked (controlled mode).\n */\n checked?: boolean;\n\n /**\n * Whether the checkbox is checked by default (uncontrolled mode).\n */\n defaultChecked?: boolean;\n\n /** The error attribute of the checkbox input. */\n error?: ReactNode | string;\n\n /** The description attribute of the checkbox input. */\n description?: ReactNode | string;\n\n /** The test id attribute of the checkbox input. */\n \"data-testid\"?: string;\n\n /**\n * Callback fired when the checkbox state changes.\n */\n onChange?: (checked: boolean) => void;\n\n /**\n * Whether the checkbox is in an indeterminate state. Used for checkboxes that are neither checked nor unchecked.\n * @default false\n * @external https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate\n * @reference @external https://medium.com/indigoag-eng/indeterminate-checkboxes-are-weird-704b246c0f19\n */\n indeterminate?: boolean;\n\n /** The id attribute of the checkbox input. */\n id?: string;\n\n /** Whether the checkbox is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /** Whether the checkbox is required.\n * @default false\n */\n isRequired?: boolean;\n\n /** The name attribute of the checkbox input. */\n name: string;\n\n /** The label attribute of the checkbox input. */\n label?: string | ReactNode;\n\n /**\n * The value attribute of the checkbox input (for form submission).\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value\n */\n value?: string;\n\n /**\n * Whether the checkbox should be rendered as a round control (with a dot indicator when checked).\n * @default false\n */\n round?: boolean;\n}\n\n/**\n * A checkbox input component with support for labels, descriptions, error states, and controlled/uncontrolled modes.\n *\n * API:\n * - {@link CheckboxInputProps}\n */\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n (\n {\n checked: controlledChecked,\n defaultChecked,\n onChange,\n name,\n value,\n isDisabled = false,\n isRequired = false,\n id,\n \"data-testid\": testId,\n label,\n description,\n error,\n indeterminate = false,\n round = false,\n },\n forwardedRef: ForwardedRef<HTMLInputElement>,\n ) => {\n const checkboxRef = useRef<HTMLInputElement>(null);\n const setRefs = useMergedRef(checkboxRef, forwardedRef);\n const isControlled = controlledChecked !== undefined;\n const idBase = useId();\n\n // indeterminate state can only be set via JS\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked);\n };\n\n const checkboxId = id || `${idBase}-checkbox`;\n const errorId = typeof error === \"string\" ? `${idBase}-error` : undefined;\n const descriptionId =\n typeof description === \"string\" ? `${idBase}-description` : undefined;\n const ariaDescribedBy =\n [errorId, descriptionId].filter(Boolean).join(\" \") || undefined;\n\n return (\n <div>\n <div className={csx(isDisabled && \"proton-CheckboxInput--disabled\")}>\n <div\n className={csx(\n \"proton-CheckboxInput__container\",\n round && \"proton-CheckboxInput__container--round\",\n )}\n >\n {typeof label === \"string\" ? (\n <label\n htmlFor={checkboxId}\n className=\"proton-CheckboxInput__label\"\n >\n {label}\n </label>\n ) : (\n label\n )}\n\n <span className=\"proton-CheckboxInput__box\">\n <input\n ref={setRefs}\n id={checkboxId}\n name={name}\n type=\"checkbox\"\n {...(isControlled\n ? { checked: controlledChecked }\n : { defaultChecked })}\n value={value}\n disabled={isDisabled}\n required={isRequired}\n onChange={handleChange}\n className={csx(\n \"proton-CheckboxInput__input\",\n error && \"proton-CheckboxInput__input--error\",\n round && \"proton-CheckboxInput__input--round\",\n )}\n aria-label={!label ? name : undefined}\n aria-invalid={Boolean(error)}\n aria-errormessage={errorId}\n aria-describedby={ariaDescribedBy}\n data-testid={testId}\n />\n <CheckboxIndicator round={round} />\n </span>\n\n {typeof description === \"string\" ? (\n <div id={descriptionId} aria-live=\"polite\">\n {description}\n {isRequired && <span aria-hidden=\"true\"> *</span>}\n </div>\n ) : (\n description\n )}\n </div>\n </div>\n\n {typeof error === \"string\" ? (\n <div\n role=\"alert\"\n className={csx(\"proton-CheckboxInput__error\")}\n id={errorId}\n >\n {error}\n </div>\n ) : (\n error\n )}\n </div>\n );\n },\n);\n\nCheckboxInput.displayName = \"ProtonUICheckboxInput\";\n"],"names":["CheckboxInput","forwardRef","controlledChecked","defaultChecked","onChange","name","value","isDisabled","isRequired","id","testId","label","description","error","indeterminate","round","forwardedRef","checkboxRef","useRef","setRefs","useMergedRef","isControlled","idBase","useId","useEffect","handleChange","e","checkboxId","errorId","descriptionId","ariaDescribedBy","jsx","csx","jsxs","CheckboxIndicator"],"mappings":"oVAgFaA,EAAgBC,EAAAA,WAC3B,CACE,CACE,QAASC,EACT,eAAAC,EACA,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,GAAAC,EACA,cAAeC,EACf,MAAAC,EACA,YAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,GAChB,MAAAC,EAAQ,EAAA,EAEVC,IACG,CACH,MAAMC,EAAcC,EAAAA,OAAyB,IAAI,EAC3CC,EAAUC,EAAAA,aAAaH,EAAaD,CAAY,EAChDK,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AAOH,GAAgB,SACtBqB,EAAAA,kBAAAA,KAAC,OAAI,GAAIJ,EAAe,YAAU,SAC/B,SAAA,CAAAjB,EACAJ,GAAcuB,EAAAA,kBAAAA,IAAC,OAAA,CAAK,cAAY,OAAO,SAAA,IAAA,CAAO,CAAA,CAAA,CACjD,EAEAnB,CAAA,CAAA,CAAA,EAGN,EAEC,OAAOC,GAAU,SAChBkB,EAAAA,kBAAAA,IAAC,MAAA,CACC,KAAK,QACL,UAAWC,EAAAA,IAAI,6BAA6B,EAC5C,GAAIJ,EAEH,SAAAf,CAAA,CAAA,EAGHA,CAAA,EAEJ,CAEJ,CACF,EAEAb,EAAc,YAAc"}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
import { j as e } from "../../../node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useMergedRef as
|
|
4
|
-
import { CheckboxIndicator as
|
|
2
|
+
import { forwardRef as R, useRef as B, useId as $, useEffect as E } from "react";
|
|
3
|
+
import { useMergedRef as w } from "../../../hooks/useMergedRef.es.js";
|
|
4
|
+
import { CheckboxIndicator as F } from "../CheckboxIndicator.es.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { csx as
|
|
7
|
-
const
|
|
6
|
+
import { csx as s } from "../../../utils/string.es.js";
|
|
7
|
+
const M = R(
|
|
8
8
|
({
|
|
9
9
|
checked: p,
|
|
10
|
-
defaultChecked:
|
|
11
|
-
onChange:
|
|
12
|
-
name:
|
|
10
|
+
defaultChecked: m,
|
|
11
|
+
onChange: i,
|
|
12
|
+
name: l,
|
|
13
13
|
value: k,
|
|
14
|
-
isDisabled:
|
|
15
|
-
isRequired:
|
|
16
|
-
id:
|
|
17
|
-
"data-testid":
|
|
18
|
-
label:
|
|
19
|
-
description:
|
|
14
|
+
isDisabled: x = !1,
|
|
15
|
+
isRequired: h = !1,
|
|
16
|
+
id: I,
|
|
17
|
+
"data-testid": _,
|
|
18
|
+
label: t,
|
|
19
|
+
description: r,
|
|
20
20
|
error: o,
|
|
21
|
-
indeterminate:
|
|
21
|
+
indeterminate: f = !1,
|
|
22
22
|
round: n = !1
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
},
|
|
23
|
+
}, j) => {
|
|
24
|
+
const c = B(null), v = w(c, j), C = p !== void 0, a = $();
|
|
25
|
+
E(() => {
|
|
26
|
+
c.current && (c.current.indeterminate = f);
|
|
27
|
+
}, [f]);
|
|
28
|
+
const y = (g) => {
|
|
29
|
+
i == null || i(g.target.checked);
|
|
30
|
+
}, u = I || `${a}-checkbox`, d = typeof o == "string" ? `${a}-error` : void 0, b = typeof r == "string" ? `${a}-description` : void 0, N = [d, b].filter(Boolean).join(" ") || void 0;
|
|
31
31
|
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
32
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
32
|
+
/* @__PURE__ */ e.jsx("div", { className: s(x && "proton-CheckboxInput--disabled"), children: /* @__PURE__ */ e.jsxs(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
35
|
+
className: s(
|
|
36
36
|
"proton-CheckboxInput__container",
|
|
37
37
|
n && "proton-CheckboxInput__container--round"
|
|
38
38
|
),
|
|
39
39
|
children: [
|
|
40
|
-
typeof
|
|
40
|
+
typeof t == "string" ? /* @__PURE__ */ e.jsx(
|
|
41
41
|
"label",
|
|
42
42
|
{
|
|
43
|
-
htmlFor:
|
|
43
|
+
htmlFor: u,
|
|
44
44
|
className: "proton-CheckboxInput__label",
|
|
45
|
-
children:
|
|
45
|
+
children: t
|
|
46
46
|
}
|
|
47
|
-
) :
|
|
47
|
+
) : t,
|
|
48
48
|
/* @__PURE__ */ e.jsxs("span", { className: "proton-CheckboxInput__box", children: [
|
|
49
49
|
/* @__PURE__ */ e.jsx(
|
|
50
50
|
"input",
|
|
51
51
|
{
|
|
52
|
-
ref:
|
|
53
|
-
id:
|
|
54
|
-
name:
|
|
52
|
+
ref: v,
|
|
53
|
+
id: u,
|
|
54
|
+
name: l,
|
|
55
55
|
type: "checkbox",
|
|
56
|
-
...
|
|
56
|
+
...C ? { checked: p } : { defaultChecked: m },
|
|
57
57
|
value: k,
|
|
58
|
-
disabled:
|
|
59
|
-
required:
|
|
60
|
-
onChange:
|
|
61
|
-
className:
|
|
58
|
+
disabled: x,
|
|
59
|
+
required: h,
|
|
60
|
+
onChange: y,
|
|
61
|
+
className: s(
|
|
62
62
|
"proton-CheckboxInput__input",
|
|
63
63
|
o && "proton-CheckboxInput__input--error",
|
|
64
64
|
n && "proton-CheckboxInput__input--round"
|
|
65
65
|
),
|
|
66
|
-
"aria-label":
|
|
66
|
+
"aria-label": t ? void 0 : l,
|
|
67
67
|
"aria-invalid": !!o,
|
|
68
68
|
"aria-errormessage": d,
|
|
69
|
-
"aria-describedby":
|
|
70
|
-
"data-testid":
|
|
69
|
+
"aria-describedby": N,
|
|
70
|
+
"data-testid": _
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
+
/* @__PURE__ */ e.jsx(F, { round: n })
|
|
74
74
|
] }),
|
|
75
|
-
typeof
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
] }) :
|
|
75
|
+
typeof r == "string" ? /* @__PURE__ */ e.jsxs("div", { id: b, "aria-live": "polite", children: [
|
|
76
|
+
r,
|
|
77
|
+
h && /* @__PURE__ */ e.jsx("span", { "aria-hidden": "true", children: " *" })
|
|
78
|
+
] }) : r
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
) }),
|
|
@@ -83,7 +83,7 @@ const w = g(
|
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
role: "alert",
|
|
86
|
-
className:
|
|
86
|
+
className: s("proton-CheckboxInput__error"),
|
|
87
87
|
id: d,
|
|
88
88
|
children: o
|
|
89
89
|
}
|
|
@@ -91,8 +91,8 @@ const w = g(
|
|
|
91
91
|
] });
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
|
|
94
|
+
M.displayName = "ProtonUICheckboxInput";
|
|
95
95
|
export {
|
|
96
|
-
|
|
96
|
+
M as CheckboxInput
|
|
97
97
|
};
|
|
98
98
|
//# sourceMappingURL=CheckboxInput.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.es.js","sources":["../../../../src/components/Checkbox/CheckboxInput/CheckboxInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect, useRef, type ForwardedRef, type ReactNode, type ChangeEvent } from \"react\";\n\nimport { useMergedRef } from \"../../../hooks/useMergedRef\";\nimport { csx } from \"../../../utils\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\nimport \"./CheckboxInput.css\";\n\nexport interface CheckboxInputProps {\n /**\n * Whether the checkbox is checked (controlled mode).\n */\n checked?: boolean;\n\n /**\n * Whether the checkbox is checked by default (uncontrolled mode).\n */\n defaultChecked?: boolean;\n\n /** The error attribute of the checkbox input. */\n error?: ReactNode | string;\n\n /** The description attribute of the checkbox input. */\n description?: ReactNode | string;\n\n /** The test id attribute of the checkbox input. */\n \"data-testid\"?: string;\n\n /**\n * Callback fired when the checkbox state changes.\n */\n onChange?: (checked: boolean) => void;\n\n /**\n * Whether the checkbox is in an indeterminate state. Used for checkboxes that are neither checked nor unchecked.\n * @default false\n * @external https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate\n * @reference @external https://medium.com/indigoag-eng/indeterminate-checkboxes-are-weird-704b246c0f19\n */\n indeterminate?: boolean;\n\n /** The id attribute of the checkbox input. */\n id?: string;\n\n /** Whether the checkbox is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /** Whether the checkbox is required.\n * @default false\n */\n isRequired?: boolean;\n\n /** The name attribute of the checkbox input. */\n name: string;\n\n /** The label attribute of the checkbox input. */\n label?: string | ReactNode;\n\n /**\n * The value attribute of the checkbox input (for form submission).\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value\n */\n value?: string;\n\n /**\n * Whether the checkbox should be rendered as a round control (with a dot indicator when checked).\n * @default false\n */\n round?: boolean;\n}\n\n/**\n * A checkbox input component with support for labels, descriptions, error states, and controlled/uncontrolled modes.\n *\n * API:\n * - {@link CheckboxInputProps}\n */\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n (\n {\n checked: controlledChecked,\n defaultChecked,\n onChange,\n name,\n value,\n isDisabled = false,\n isRequired = false,\n id,\n \"data-testid\": testId,\n label,\n description,\n error,\n indeterminate = false,\n round = false,\n },\n forwardedRef: ForwardedRef<HTMLInputElement>,\n ) => {\n const checkboxRef = useRef<HTMLInputElement>(null);\n const setRefs = useMergedRef(checkboxRef, forwardedRef);\n const isControlled = controlledChecked !== undefined;\n\n // indeterminate state can only be set via JS\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked);\n };\n\n const checkboxId = id || `${
|
|
1
|
+
{"version":3,"file":"CheckboxInput.es.js","sources":["../../../../src/components/Checkbox/CheckboxInput/CheckboxInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect, useId, useRef, type ForwardedRef, type ReactNode, type ChangeEvent } from \"react\";\n\nimport { useMergedRef } from \"../../../hooks/useMergedRef\";\nimport { csx } from \"../../../utils\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\nimport \"./CheckboxInput.css\";\n\nexport interface CheckboxInputProps {\n /**\n * Whether the checkbox is checked (controlled mode).\n */\n checked?: boolean;\n\n /**\n * Whether the checkbox is checked by default (uncontrolled mode).\n */\n defaultChecked?: boolean;\n\n /** The error attribute of the checkbox input. */\n error?: ReactNode | string;\n\n /** The description attribute of the checkbox input. */\n description?: ReactNode | string;\n\n /** The test id attribute of the checkbox input. */\n \"data-testid\"?: string;\n\n /**\n * Callback fired when the checkbox state changes.\n */\n onChange?: (checked: boolean) => void;\n\n /**\n * Whether the checkbox is in an indeterminate state. Used for checkboxes that are neither checked nor unchecked.\n * @default false\n * @external https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate\n * @reference @external https://medium.com/indigoag-eng/indeterminate-checkboxes-are-weird-704b246c0f19\n */\n indeterminate?: boolean;\n\n /** The id attribute of the checkbox input. */\n id?: string;\n\n /** Whether the checkbox is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /** Whether the checkbox is required.\n * @default false\n */\n isRequired?: boolean;\n\n /** The name attribute of the checkbox input. */\n name: string;\n\n /** The label attribute of the checkbox input. */\n label?: string | ReactNode;\n\n /**\n * The value attribute of the checkbox input (for form submission).\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value\n */\n value?: string;\n\n /**\n * Whether the checkbox should be rendered as a round control (with a dot indicator when checked).\n * @default false\n */\n round?: boolean;\n}\n\n/**\n * A checkbox input component with support for labels, descriptions, error states, and controlled/uncontrolled modes.\n *\n * API:\n * - {@link CheckboxInputProps}\n */\nexport const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n (\n {\n checked: controlledChecked,\n defaultChecked,\n onChange,\n name,\n value,\n isDisabled = false,\n isRequired = false,\n id,\n \"data-testid\": testId,\n label,\n description,\n error,\n indeterminate = false,\n round = false,\n },\n forwardedRef: ForwardedRef<HTMLInputElement>,\n ) => {\n const checkboxRef = useRef<HTMLInputElement>(null);\n const setRefs = useMergedRef(checkboxRef, forwardedRef);\n const isControlled = controlledChecked !== undefined;\n const idBase = useId();\n\n // indeterminate state can only be set via JS\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked);\n };\n\n const checkboxId = id || `${idBase}-checkbox`;\n const errorId = typeof error === \"string\" ? `${idBase}-error` : undefined;\n const descriptionId =\n typeof description === \"string\" ? `${idBase}-description` : undefined;\n const ariaDescribedBy =\n [errorId, descriptionId].filter(Boolean).join(\" \") || undefined;\n\n return (\n <div>\n <div className={csx(isDisabled && \"proton-CheckboxInput--disabled\")}>\n <div\n className={csx(\n \"proton-CheckboxInput__container\",\n round && \"proton-CheckboxInput__container--round\",\n )}\n >\n {typeof label === \"string\" ? (\n <label\n htmlFor={checkboxId}\n className=\"proton-CheckboxInput__label\"\n >\n {label}\n </label>\n ) : (\n label\n )}\n\n <span className=\"proton-CheckboxInput__box\">\n <input\n ref={setRefs}\n id={checkboxId}\n name={name}\n type=\"checkbox\"\n {...(isControlled\n ? { checked: controlledChecked }\n : { defaultChecked })}\n value={value}\n disabled={isDisabled}\n required={isRequired}\n onChange={handleChange}\n className={csx(\n \"proton-CheckboxInput__input\",\n error && \"proton-CheckboxInput__input--error\",\n round && \"proton-CheckboxInput__input--round\",\n )}\n aria-label={!label ? name : undefined}\n aria-invalid={Boolean(error)}\n aria-errormessage={errorId}\n aria-describedby={ariaDescribedBy}\n data-testid={testId}\n />\n <CheckboxIndicator round={round} />\n </span>\n\n {typeof description === \"string\" ? (\n <div id={descriptionId} aria-live=\"polite\">\n {description}\n {isRequired && <span aria-hidden=\"true\"> *</span>}\n </div>\n ) : (\n description\n )}\n </div>\n </div>\n\n {typeof error === \"string\" ? (\n <div\n role=\"alert\"\n className={csx(\"proton-CheckboxInput__error\")}\n id={errorId}\n >\n {error}\n </div>\n ) : (\n error\n )}\n </div>\n );\n },\n);\n\nCheckboxInput.displayName = \"ProtonUICheckboxInput\";\n"],"names":["CheckboxInput","forwardRef","controlledChecked","defaultChecked","onChange","name","value","isDisabled","isRequired","id","testId","label","description","error","indeterminate","round","forwardedRef","checkboxRef","useRef","setRefs","useMergedRef","isControlled","idBase","useId","useEffect","handleChange","e","checkboxId","errorId","descriptionId","ariaDescribedBy","jsx","csx","jsx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J;AACF;AAEAb,EAAc,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../node_modules/react/jsx-runtime.cjs.js"),u=require("react"),n=require("radix-ui"),f=require("../CheckboxIndicator.cjs.js");;/* empty css */;/* empty css */const s=require("../../../utils/string.cjs.js"),l=u.forwardRef(({name:b,items:h,value:R,defaultValue:j,onChange:k,isDisabled:a=!1,isRequired:m=!1,orientation:c="vertical",round:t=!1,error:r,"data-testid":C},_)=>{const d=u.useId(),p=typeof r=="string"?`${d}-error`:void 0;return o.jsxRuntimeExports.jsxs("div",{children:[o.jsxRuntimeExports.jsx(n.RadioGroup.Root,{ref:_,name:b,value:R,defaultValue:j,onValueChange:k,disabled:a,required:m,orientation:c,className:s.csx("proton-CheckboxRadioGroup",`proton-CheckboxRadioGroup--${c}`),"aria-invalid":!!r,"aria-errormessage":p,"data-testid":C,children:h.map((e,I)=>{const i=`${d}-item-${I}`,v=a||e.isDisabled,x=typeof e.description=="string"?`${i}-description`:void 0;return o.jsxRuntimeExports.jsxs("div",{className:s.csx(v&&"proton-CheckboxInput--disabled"),children:[o.jsxRuntimeExports.jsxs("div",{className:s.csx("proton-CheckboxInput__container",t&&"proton-CheckboxInput__container--round"),children:[o.jsxRuntimeExports.jsx(n.RadioGroup.Item,{id:i,value:e.value,disabled:e.isDisabled,className:s.csx("proton-CheckboxInput__input",t&&"proton-CheckboxInput__input--round",r&&"proton-CheckboxInput__input--error"),"aria-describedby":x,children:o.jsxRuntimeExports.jsx(n.RadioGroup.Indicator,{className:s.csx(!t&&"proton-CheckboxRadioGroup__checkmark"),forceMount:!0,children:o.jsxRuntimeExports.jsx(f.CheckboxIndicator,{round:t})})}),typeof e.label=="string"?o.jsxRuntimeExports.jsx("label",{htmlFor:i,className:"proton-CheckboxInput__label",children:e.label}):e.label]}),typeof e.description=="string"?o.jsxRuntimeExports.jsx("div",{id:x,className:"proton-CheckboxRadioGroup__description",children:e.description}):e.description]},e.value)})}),typeof r=="string"?o.jsxRuntimeExports.jsx("div",{role:"alert",className:"proton-CheckboxInput__error",id:p,children:r}):r]})});l.displayName="ProtonUICheckboxRadioGroup";exports.CheckboxRadioGroup=l;
|
|
2
2
|
//# sourceMappingURL=CheckboxRadioGroup.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxRadioGroup.cjs.js","sources":["../../../../src/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, ReactNode } from \"react\";\nimport { RadioGroup as RadixRadioGroup } from \"radix-ui\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\n\nimport { csx } from \"../../../utils\";\nimport \"../CheckboxInput/CheckboxInput.css\";\nimport \"./CheckboxRadioGroup.css\";\n\nexport interface CheckboxRadioGroupItem {\n /**\n * Unique value for the radio option.\n */\n value: string;\n\n /**\n * Label displayed next to the radio button.\n */\n label: string | ReactNode;\n\n /**\n * Optional description text below the label.\n */\n description?: string | ReactNode;\n\n /**\n * Whether this specific option is disabled.\n * @default false\n */\n isDisabled?: boolean;\n}\n\nexport interface CheckboxRadioGroupProps {\n /**\n * The name attribute for the radio group (for form submission).\n */\n name: string;\n\n /**\n * Array of radio options.\n */\n items: CheckboxRadioGroupItem[];\n\n /**\n * Currently selected value (controlled mode).\n */\n value?: string;\n\n /**\n * Default selected value (uncontrolled mode).\n */\n defaultValue?: string;\n\n /**\n * Callback when selection changes.\n */\n onChange?: (value: string) => void;\n\n /**\n * Whether the entire group is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * Whether selection is required.\n * @default false\n */\n isRequired?: boolean;\n\n /**\n * Error message or element.\n */\n error?: ReactNode | string;\n\n /**\n * Layout orientation.\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n\n /**\n * Whether radio buttons are round or square.\n * @default false\n */\n round?: boolean;\n\n /**\n * Test ID for the group.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A declaritive radio group for single-select lists.\n *\n * API:\n * - {@link CheckboxRadioGroupProps}\n * - {@link CheckboxRadioGroupItem}\n */\nexport const CheckboxRadioGroup = forwardRef<\n HTMLDivElement,\n CheckboxRadioGroupProps\n>(\n (\n {\n name,\n items,\n value,\n defaultValue,\n onChange,\n isDisabled = false,\n isRequired = false,\n orientation = \"vertical\",\n round = false,\n error,\n \"data-testid\": testId,\n },\n ref,\n ) => {\n const errorId = typeof error === \"string\" ? `${
|
|
1
|
+
{"version":3,"file":"CheckboxRadioGroup.cjs.js","sources":["../../../../src/components/Checkbox/CheckboxRadioGroup/CheckboxRadioGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ReactNode, useId } from \"react\";\nimport { RadioGroup as RadixRadioGroup } from \"radix-ui\";\nimport { CheckboxIndicator } from \"../CheckboxIndicator\";\n\nimport { csx } from \"../../../utils\";\nimport \"../CheckboxInput/CheckboxInput.css\";\nimport \"./CheckboxRadioGroup.css\";\n\nexport interface CheckboxRadioGroupItem {\n /**\n * Unique value for the radio option.\n */\n value: string;\n\n /**\n * Label displayed next to the radio button.\n */\n label: string | ReactNode;\n\n /**\n * Optional description text below the label.\n */\n description?: string | ReactNode;\n\n /**\n * Whether this specific option is disabled.\n * @default false\n */\n isDisabled?: boolean;\n}\n\nexport interface CheckboxRadioGroupProps {\n /**\n * The name attribute for the radio group (for form submission).\n */\n name: string;\n\n /**\n * Array of radio options.\n */\n items: CheckboxRadioGroupItem[];\n\n /**\n * Currently selected value (controlled mode).\n */\n value?: string;\n\n /**\n * Default selected value (uncontrolled mode).\n */\n defaultValue?: string;\n\n /**\n * Callback when selection changes.\n */\n onChange?: (value: string) => void;\n\n /**\n * Whether the entire group is disabled.\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * Whether selection is required.\n * @default false\n */\n isRequired?: boolean;\n\n /**\n * Error message or element.\n */\n error?: ReactNode | string;\n\n /**\n * Layout orientation.\n * @default \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\";\n\n /**\n * Whether radio buttons are round or square.\n * @default false\n */\n round?: boolean;\n\n /**\n * Test ID for the group.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A declaritive radio group for single-select lists.\n *\n * API:\n * - {@link CheckboxRadioGroupProps}\n * - {@link CheckboxRadioGroupItem}\n */\nexport const CheckboxRadioGroup = forwardRef<\n HTMLDivElement,\n CheckboxRadioGroupProps\n>(\n (\n {\n name,\n items,\n value,\n defaultValue,\n onChange,\n isDisabled = false,\n isRequired = false,\n orientation = \"vertical\",\n round = false,\n error,\n \"data-testid\": testId,\n },\n ref,\n ) => {\n const idBase = useId();\n const errorId = typeof error === \"string\" ? `${idBase}-error` : undefined;\n\n return (\n <div>\n <RadixRadioGroup.Root\n ref={ref}\n name={name}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onChange}\n disabled={isDisabled}\n required={isRequired}\n orientation={orientation}\n className={csx(\n \"proton-CheckboxRadioGroup\",\n `proton-CheckboxRadioGroup--${orientation}`,\n )}\n aria-invalid={Boolean(error)}\n aria-errormessage={errorId}\n data-testid={testId}\n >\n {items.map((item, index) => {\n const itemId = `${idBase}-item-${index}`;\n const itemDisabled = isDisabled || item.isDisabled;\n const descriptionId =\n typeof item.description === \"string\"\n ? `${itemId}-description`\n : undefined;\n\n return (\n <div\n key={item.value}\n className={csx(\n itemDisabled && \"proton-CheckboxInput--disabled\",\n )}\n >\n <div\n className={csx(\n \"proton-CheckboxInput__container\",\n round && \"proton-CheckboxInput__container--round\",\n )}\n >\n <RadixRadioGroup.Item\n id={itemId}\n value={item.value}\n disabled={item.isDisabled}\n className={csx(\n \"proton-CheckboxInput__input\",\n round && \"proton-CheckboxInput__input--round\",\n error && \"proton-CheckboxInput__input--error\",\n )}\n aria-describedby={descriptionId}\n >\n <RadixRadioGroup.Indicator\n className={csx(\n !round && \"proton-CheckboxRadioGroup__checkmark\",\n )}\n forceMount\n >\n <CheckboxIndicator round={round} />\n </RadixRadioGroup.Indicator>\n </RadixRadioGroup.Item>\n\n {typeof item.label === \"string\" ? (\n <label\n htmlFor={itemId}\n className=\"proton-CheckboxInput__label\"\n >\n {item.label}\n </label>\n ) : (\n item.label\n )}\n </div>\n\n {typeof item.description === \"string\" ? (\n <div\n id={descriptionId}\n className=\"proton-CheckboxRadioGroup__description\"\n >\n {item.description}\n </div>\n ) : (\n item.description\n )}\n </div>\n );\n })}\n </RadixRadioGroup.Root>\n\n {typeof error === \"string\" ? (\n <div\n role=\"alert\"\n className=\"proton-CheckboxInput__error\"\n id={errorId}\n >\n {error}\n </div>\n ) : (\n error\n )}\n </div>\n );\n },\n);\n\nCheckboxRadioGroup.displayName = \"ProtonUICheckboxRadioGroup\";\n"],"names":["CheckboxRadioGroup","forwardRef","name","items","value","defaultValue","onChange","isDisabled","isRequired","orientation","round","error","testId","ref","idBase","useId","errorId","jsx","RadixRadioGroup","csx","item","index","itemId","itemDisabled","descriptionId","jsxs","CheckboxIndicator"],"mappings":"oXAqGaA,EAAqBC,EAAAA,WAIhC,CACE,CACE,KAAAC,EACA,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,SAAAC,EACA,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,YAAAC,EAAc,WACd,MAAAC,EAAQ,GACR,MAAAC,EACA,cAAeC,CAAA,EAEjBC,IACG,CACH,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAU,OAAOL,GAAU,SAAW,GAAGG,CAAM,SAAW,OAEhE,gCACG,MAAA,CACC,SAAA,CAAAG,EAAAA,kBAAAA,IAACC,EAAAA,WAAgB,KAAhB,CACC,IAAAL,EACA,KAAAX,EACA,MAAAE,EACA,aAAAC,EACA,cAAeC,EACf,SAAUC,EACV,SAAUC,EACV,YAAAC,EACA,UAAWU,EAAAA,IACT,4BACA,8BAA8BV,CAAW,EAAA,EAE3C,eAAc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AAA,EAEJ,CAEJ,CACF,EAEAX,EAAmB,YAAc"}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { RadioGroup as
|
|
4
|
-
import { CheckboxIndicator as
|
|
1
|
+
import { j as e } from "../../../node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { forwardRef as j, useId as v } from "react";
|
|
3
|
+
import { RadioGroup as a } from "radix-ui";
|
|
4
|
+
import { CheckboxIndicator as R } from "../CheckboxIndicator.es.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { csx as i } from "../../../utils/string.es.js";
|
|
8
|
-
const
|
|
8
|
+
const N = j(
|
|
9
9
|
({
|
|
10
|
-
name:
|
|
11
|
-
items:
|
|
12
|
-
value:
|
|
13
|
-
defaultValue:
|
|
14
|
-
onChange:
|
|
15
|
-
isDisabled:
|
|
10
|
+
name: x,
|
|
11
|
+
items: u,
|
|
12
|
+
value: b,
|
|
13
|
+
defaultValue: h,
|
|
14
|
+
onChange: m,
|
|
15
|
+
isDisabled: n = !1,
|
|
16
16
|
isRequired: _ = !1,
|
|
17
|
-
orientation:
|
|
17
|
+
orientation: d = "vertical",
|
|
18
18
|
round: s = !1,
|
|
19
|
-
error:
|
|
19
|
+
error: r,
|
|
20
20
|
"data-testid": k
|
|
21
21
|
}, f) => {
|
|
22
|
-
const p = typeof
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
22
|
+
const c = v(), p = typeof r == "string" ? `${c}-error` : void 0;
|
|
23
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
24
|
+
/* @__PURE__ */ e.jsx(
|
|
25
|
+
a.Root,
|
|
26
26
|
{
|
|
27
27
|
ref: f,
|
|
28
|
-
name:
|
|
29
|
-
value:
|
|
30
|
-
defaultValue:
|
|
31
|
-
onValueChange:
|
|
32
|
-
disabled:
|
|
28
|
+
name: x,
|
|
29
|
+
value: b,
|
|
30
|
+
defaultValue: h,
|
|
31
|
+
onValueChange: m,
|
|
32
|
+
disabled: n,
|
|
33
33
|
required: _,
|
|
34
|
-
orientation:
|
|
34
|
+
orientation: d,
|
|
35
35
|
className: i(
|
|
36
36
|
"proton-CheckboxRadioGroup",
|
|
37
|
-
`proton-CheckboxRadioGroup--${
|
|
37
|
+
`proton-CheckboxRadioGroup--${d}`
|
|
38
38
|
),
|
|
39
|
-
"aria-invalid": !!
|
|
39
|
+
"aria-invalid": !!r,
|
|
40
40
|
"aria-errormessage": p,
|
|
41
41
|
"data-testid": k,
|
|
42
|
-
children:
|
|
43
|
-
const t = `${
|
|
44
|
-
return /* @__PURE__ */
|
|
42
|
+
children: u.map((o, C) => {
|
|
43
|
+
const t = `${c}-item-${C}`, I = n || o.isDisabled, l = typeof o.description == "string" ? `${t}-description` : void 0;
|
|
44
|
+
return /* @__PURE__ */ e.jsxs(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
47
47
|
className: i(
|
|
48
|
-
|
|
48
|
+
I && "proton-CheckboxInput--disabled"
|
|
49
49
|
),
|
|
50
50
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ e.jsxs(
|
|
52
52
|
"div",
|
|
53
53
|
{
|
|
54
54
|
className: i(
|
|
@@ -56,8 +56,8 @@ const v = C(
|
|
|
56
56
|
s && "proton-CheckboxInput__container--round"
|
|
57
57
|
),
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
59
|
+
/* @__PURE__ */ e.jsx(
|
|
60
|
+
a.Item,
|
|
61
61
|
{
|
|
62
62
|
id: t,
|
|
63
63
|
value: o.value,
|
|
@@ -65,22 +65,22 @@ const v = C(
|
|
|
65
65
|
className: i(
|
|
66
66
|
"proton-CheckboxInput__input",
|
|
67
67
|
s && "proton-CheckboxInput__input--round",
|
|
68
|
-
|
|
68
|
+
r && "proton-CheckboxInput__input--error"
|
|
69
69
|
),
|
|
70
70
|
"aria-describedby": l,
|
|
71
|
-
children: /* @__PURE__ */
|
|
72
|
-
|
|
71
|
+
children: /* @__PURE__ */ e.jsx(
|
|
72
|
+
a.Indicator,
|
|
73
73
|
{
|
|
74
74
|
className: i(
|
|
75
75
|
!s && "proton-CheckboxRadioGroup__checkmark"
|
|
76
76
|
),
|
|
77
77
|
forceMount: !0,
|
|
78
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ e.jsx(R, { round: s })
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
|
-
typeof o.label == "string" ? /* @__PURE__ */
|
|
83
|
+
typeof o.label == "string" ? /* @__PURE__ */ e.jsx(
|
|
84
84
|
"label",
|
|
85
85
|
{
|
|
86
86
|
htmlFor: t,
|
|
@@ -91,7 +91,7 @@ const v = C(
|
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
typeof o.description == "string" ? /* @__PURE__ */
|
|
94
|
+
typeof o.description == "string" ? /* @__PURE__ */ e.jsx(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
id: l,
|
|
@@ -106,20 +106,20 @@ const v = C(
|
|
|
106
106
|
})
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
|
-
typeof
|
|
109
|
+
typeof r == "string" ? /* @__PURE__ */ e.jsx(
|
|
110
110
|
"div",
|
|
111
111
|
{
|
|
112
112
|
role: "alert",
|
|
113
113
|
className: "proton-CheckboxInput__error",
|
|
114
114
|
id: p,
|
|
115
|
-
children:
|
|
115
|
+
children: r
|
|
116
116
|
}
|
|
117
|
-
) :
|
|
117
|
+
) : r
|
|
118
118
|
] });
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
|
|
121
|
+
N.displayName = "ProtonUICheckboxRadioGroup";
|
|
122
122
|
export {
|
|
123
|
-
|
|
123
|
+
N as CheckboxRadioGroup
|
|
124
124
|
};
|
|
125
125
|
//# sourceMappingURL=CheckboxRadioGroup.es.js.map
|