@bonprix-ds/react-checkbox-group 1.0.8 → 1.0.10
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/src/CheckboxGroup.js.map +1 -1
- package/dist/src/CheckboxGroupContext.js.map +1 -1
- package/dist/src/CheckboxGroupItem/CheckboxGroupItem.js.map +1 -1
- package/dist/src/CheckboxGroupItem/index.js.map +1 -1
- package/dist/src/CheckboxGroupRoot.js +1 -1
- package/dist/src/CheckboxGroupRoot.js.map +1 -1
- package/package.json +7 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","names":[],"sources":["../../src/CheckboxGroup.tsx"],"sourcesContent":["import React from \"react\";\n\nimport CheckboxGroupItem from \"./CheckboxGroupItem\";\nimport CheckboxGroupRoot, { type Props } from \"./CheckboxGroupRoot\";\n\nexport type { Props };\n\nconst CheckboxGroup = (props: Props) => <CheckboxGroupRoot {...props} />;\n\nCheckboxGroup.displayName = \"CheckboxGroup\";\n\nCheckboxGroup.Item = CheckboxGroupItem;\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;AAOA,
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","names":["CheckboxGroupItem","CheckboxGroupItem_default","CheckboxGroupRoot","CheckboxGroup","props"],"sources":["../../src/CheckboxGroup.tsx"],"sourcesContent":["import React from \"react\";\n\nimport CheckboxGroupItem from \"./CheckboxGroupItem\";\nimport CheckboxGroupRoot, { type Props } from \"./CheckboxGroupRoot\";\n\nexport type { Props };\n\nconst CheckboxGroup = (props: Props) => <CheckboxGroupRoot {...props} />;\n\nCheckboxGroup.displayName = \"CheckboxGroup\";\n\nCheckboxGroup.Item = CheckboxGroupItem;\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;AAOA,IAAMG,KAAiB,MAAiB,kBAACD,GAAD,EAAmB,GAAIE,EAAQ,CAAA;AAEvE,EAAc,cAAc,iBAE5B,EAAc,OAAOJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroupContext.js","names":[],"sources":["../../src/CheckboxGroupContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\ninterface CheckboxGroupContextProps {\n values: string[];\n name: string;\n onChange?: (value: string[]) => void;\n disabled: boolean;\n error: boolean;\n required: boolean;\n helperTextId: string;\n errorTextId: string;\n}\n\nconst CheckboxGroupContext = createContext<CheckboxGroupContextProps>({\n values: [],\n name: \"\",\n onChange: () => null,\n disabled: false,\n error: false,\n required: false,\n helperTextId: \"\",\n errorTextId: \"\",\n});\n\nexport default CheckboxGroupContext;\n"],"mappings":";;;AAeA,
|
|
1
|
+
{"version":3,"file":"CheckboxGroupContext.js","names":["CheckboxGroupContext","createContext"],"sources":["../../src/CheckboxGroupContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\ninterface CheckboxGroupContextProps {\n values: string[];\n name: string;\n onChange?: (value: string[]) => void;\n disabled: boolean;\n error: boolean;\n required: boolean;\n helperTextId: string;\n errorTextId: string;\n}\n\nconst CheckboxGroupContext = createContext<CheckboxGroupContextProps>({\n values: [],\n name: \"\",\n onChange: () => null,\n disabled: false,\n error: false,\n required: false,\n helperTextId: \"\",\n errorTextId: \"\",\n});\n\nexport default CheckboxGroupContext;\n"],"mappings":";;;AAeA,IAAMA,IAAuBC,EAAyC;CACpE,QAAQ,CAAC;CACT,MAAM;CACN,gBAAgB;CAChB,UAAU;CACV,OAAO;CACP,UAAU;CACV,cAAc;CACd,aAAa;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroupItem.js","names":[],"sources":["../../../src/CheckboxGroupItem/CheckboxGroupItem.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useContext } from \"react\";\n\nimport { CheckboxBase } from \"@bonprix-ds/internal-components\";\n\nimport CheckboxGroupContext from \"../CheckboxGroupContext\";\n\nexport interface CheckboxGroupItemProps {\n /** Value of the checkbox group item, which will be submitted. */\n value?: string;\n /** The label for the checkbox group item. */\n label: string;\n}\n\nconst CheckboxGroupItem = ({ label, value = label }: CheckboxGroupItemProps) => {\n const { values, onChange, ...rest } = useContext(CheckboxGroupContext);\n const checked = values.includes(value);\n\n const handleChange = () => {\n const newValues = checked ? values.filter((v) => v !== value) : [...values, value];\n onChange?.(newValues);\n };\n\n return <CheckboxBase {...rest} checked={checked} onChange={handleChange} label={label} value={value} />;\n};\n\nCheckboxGroupItem.displayName = \"CheckboxGroup.Item\";\n\nexport default CheckboxGroupItem;\n"],"mappings":";;;;;;AAeA,
|
|
1
|
+
{"version":3,"file":"CheckboxGroupItem.js","names":["CheckboxGroupContext","CheckboxGroupItem","label","rest","useContext","checked","values","value","handleChange","newValues","v","CheckboxBase"],"sources":["../../../src/CheckboxGroupItem/CheckboxGroupItem.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useContext } from \"react\";\n\nimport { CheckboxBase } from \"@bonprix-ds/internal-components\";\n\nimport CheckboxGroupContext from \"../CheckboxGroupContext\";\n\nexport interface CheckboxGroupItemProps {\n /** Value of the checkbox group item, which will be submitted. */\n value?: string;\n /** The label for the checkbox group item. */\n label: string;\n}\n\nconst CheckboxGroupItem = ({ label, value = label }: CheckboxGroupItemProps) => {\n const { values, onChange, ...rest } = useContext(CheckboxGroupContext);\n const checked = values.includes(value);\n\n const handleChange = () => {\n const newValues = checked ? values.filter((v) => v !== value) : [...values, value];\n onChange?.(newValues);\n };\n\n return <CheckboxBase {...rest} checked={checked} onChange={handleChange} label={label} value={value} />;\n};\n\nCheckboxGroupItem.displayName = \"CheckboxGroup.Item\";\n\nexport default CheckboxGroupItem;\n"],"mappings":";;;;;;AAeA,IAAMC,KAAqB,EAAE,UAAO,WAAQC,QAAoC;CAC9E,IAAM,EAAE,WAAQ,aAAU,GAAGC,MAASC,EAAWJ,CAAoB,GAC/DK,IAAUC,EAAO,SAASC,CAAK,GAE/BC,UAAqB;EACzB,IAAMC,IAAYJ,IAAUC,EAAO,QAAQ,MAAMI,MAAMH,CAAK,IAAI,CAAC,GAAGD,GAAQC,CAAK;EACjF,IAAWE,CAAS;CACtB;CAEA,OAAO,kBAACE,GAAD;EAAc,GAAIR;EAAe;EAAS,UAAUK;EAAqB;EAAc;CAAQ,CAAA;AACxG;AAEA,EAAkB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/CheckboxGroupItem/index.ts"],"sourcesContent":["import CheckboxGroupItem from \"./CheckboxGroupItem\";\n\nexport default CheckboxGroupItem;\n"],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["CheckboxGroupItem","CheckboxGroupItem_default"],"sources":["../../../src/CheckboxGroupItem/index.ts"],"sourcesContent":["import CheckboxGroupItem from \"./CheckboxGroupItem\";\n\nexport default CheckboxGroupItem;\n"],"mappings":";;AAEA,IAAAC,IAAeD"}
|
|
@@ -24,7 +24,7 @@ var i = ({ label: i, name: a, values: o, defaultValues: s, children: c, onChange
|
|
|
24
24
|
required: m,
|
|
25
25
|
componentName: "checkbox-group",
|
|
26
26
|
children: /* @__PURE__ */ r("div", {
|
|
27
|
-
className: "preflight flex flex-
|
|
27
|
+
className: "preflight flex flex-col flex-wrap",
|
|
28
28
|
children: /* @__PURE__ */ r(e.Provider, {
|
|
29
29
|
value: h,
|
|
30
30
|
children: c
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroupRoot.js","names":[],"sources":["../../src/CheckboxGroupRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useId } from \"react\";\n\nimport { SelectionControlGroup, SelectionControlGroupProps } from \"@bonprix-ds/internal-components\";\n\nimport CheckboxGroupContext from \"./CheckboxGroupContext\";\n\ninterface CheckboxGroupBaseProps extends Omit<SelectionControlGroupProps, \"componentName\" | \"divider\" | \"horizontalPadding\"> {\n /** The caption for the checkbox group. */\n label: string;\n /** The name of the checkbox group. Will be used as the `name` attribute for every item. */\n name: string;\n}\n\ninterface ControlledCheckboxGroupProps extends CheckboxGroupBaseProps {\n /** The current values of the checkbox group. Should be used in conjunction with `onChange`, when controlling the values. Should be `undefined` otherwise. */\n values: string[];\n /** The default values of the checkbox group. Should be used when the checkbox group is uncontrolled. */\n defaultValues?: never;\n /** Callback function that is called when the checkbox group state changes. `values` should be adjusted appropriately. */\n onChange: (value: string[]) => void;\n}\n\ninterface UncontrolledCheckboxGroupProps extends CheckboxGroupBaseProps {\n values?: never;\n defaultValues: string[];\n onChange?: (value: string[]) => void;\n}\n\nexport type Props = ControlledCheckboxGroupProps | UncontrolledCheckboxGroupProps;\n\nconst CheckboxGroupRoot = ({\n label,\n name,\n values: controlledValues,\n defaultValues,\n children,\n onChange,\n error = false,\n errorText,\n disabled = false,\n helperText,\n required = false,\n}: Props) => {\n const isControlled = controlledValues !== undefined;\n const values = isControlled ? controlledValues : defaultValues;\n const helperTextId = useId();\n const errorTextId = useId();\n const contextProps = { values, name, onChange, disabled, error, required, helperTextId, errorTextId };\n\n return (\n <SelectionControlGroup\n label={label}\n error={error}\n errorText={errorText}\n disabled={disabled}\n helperText={helperText}\n required={required}\n componentName=\"checkbox-group\"\n >\n <div className=\"preflight flex flex-
|
|
1
|
+
{"version":3,"file":"CheckboxGroupRoot.js","names":["CheckboxGroupContext","CheckboxGroupRoot","controlledValues","contextProps","defaultValues","useId","SelectionControlGroup"],"sources":["../../src/CheckboxGroupRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useId } from \"react\";\n\nimport { SelectionControlGroup, SelectionControlGroupProps } from \"@bonprix-ds/internal-components\";\n\nimport CheckboxGroupContext from \"./CheckboxGroupContext\";\n\ninterface CheckboxGroupBaseProps extends Omit<SelectionControlGroupProps, \"componentName\" | \"divider\" | \"horizontalPadding\"> {\n /** The caption for the checkbox group. */\n label: string;\n /** The name of the checkbox group. Will be used as the `name` attribute for every item. */\n name: string;\n}\n\ninterface ControlledCheckboxGroupProps extends CheckboxGroupBaseProps {\n /** The current values of the checkbox group. Should be used in conjunction with `onChange`, when controlling the values. Should be `undefined` otherwise. */\n values: string[];\n /** The default values of the checkbox group. Should be used when the checkbox group is uncontrolled. */\n defaultValues?: never;\n /** Callback function that is called when the checkbox group state changes. `values` should be adjusted appropriately. */\n onChange: (value: string[]) => void;\n}\n\ninterface UncontrolledCheckboxGroupProps extends CheckboxGroupBaseProps {\n values?: never;\n defaultValues: string[];\n onChange?: (value: string[]) => void;\n}\n\nexport type Props = ControlledCheckboxGroupProps | UncontrolledCheckboxGroupProps;\n\nconst CheckboxGroupRoot = ({\n label,\n name,\n values: controlledValues,\n defaultValues,\n children,\n onChange,\n error = false,\n errorText,\n disabled = false,\n helperText,\n required = false,\n}: Props) => {\n const isControlled = controlledValues !== undefined;\n const values = isControlled ? controlledValues : defaultValues;\n const helperTextId = useId();\n const errorTextId = useId();\n const contextProps = { values, name, onChange, disabled, error, required, helperTextId, errorTextId };\n\n return (\n <SelectionControlGroup\n label={label}\n error={error}\n errorText={errorText}\n disabled={disabled}\n helperText={helperText}\n required={required}\n componentName=\"checkbox-group\"\n >\n <div className=\"preflight flex flex-col flex-wrap\">\n <CheckboxGroupContext.Provider value={contextProps}>{children}</CheckboxGroupContext.Provider>\n </div>\n </SelectionControlGroup>\n );\n};\n\nCheckboxGroupRoot.displayName = \"CheckboxGroup\";\n\nexport default CheckboxGroupRoot;\n"],"mappings":";;;;;;AAgCA,IAAMC,KAAqB,EACzB,UACA,SACA,QAAQC,GACR,kBACA,aACA,aACA,WAAQ,IACR,cACA,cAAW,IACX,eACA,cAAW,SACA;CAKX,IAAMC,IAAe;EAAE,QAJFD,MAAqB,KAAA,IACOE,IAAnBF;EAGC;EAAM;EAAU;EAAU;EAAO;EAAU,cAFrDG,EAEqD;EAAc,aADpEA,EACoE;CAAY;CAEpG,OACE,kBAACC,GAAD;EACS;EACA;EACI;EACD;EACE;EACF;EACV,eAAc;EAEd,UAAA,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACN,EAAqB,UAAtB;IAA+B,OAAOG;IAAe;GAAwC,CAAA;EAC1F,CAAA;CACgB,CAAA;AAE3B;AAEA,EAAkB,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-checkbox-group",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "CheckboxGroup component, implemented in React, for the Bonprix Design System.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,18 +32,17 @@
|
|
|
32
32
|
"provenance": true
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@bonprix-ds/internal-components": "0.2.
|
|
36
|
-
"@bonprix-ds/utils": "0.
|
|
35
|
+
"@bonprix-ds/internal-components": "0.2.3",
|
|
36
|
+
"@bonprix-ds/utils": "0.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/react": "19.3.0",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"vite": "8.3.0"
|
|
40
|
+
"vite": "8.3.2",
|
|
41
|
+
"@bonprix-ds/vite-config": "0.0.0"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"react": "^19
|
|
46
|
-
"react-dom": "^19
|
|
44
|
+
"react": "^19",
|
|
45
|
+
"react-dom": "^19",
|
|
47
46
|
"tailwind-variants": "0.3.1"
|
|
48
47
|
},
|
|
49
48
|
"scripts": {
|