@bonprix-ds/react-checkbox-group 1.0.6 → 1.0.8

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/index.d.ts CHANGED
@@ -1,45 +1,3 @@
1
- import { default as default_2 } from 'react';
2
- import { SelectionControlGroupProps } from '@bonprix-ds/internal-components';
3
-
4
- declare const CheckboxGroup: {
5
- (props: CheckboxGroupProps): default_2.JSX.Element;
6
- displayName: string;
7
- Item: {
8
- ({ label, value }: CheckboxGroupItemProps): default_2.JSX.Element;
9
- displayName: string;
10
- };
11
- };
12
- export default CheckboxGroup;
13
-
14
- declare interface CheckboxGroupBaseProps extends Omit<SelectionControlGroupProps, "componentName" | "divider" | "horizontalPadding"> {
15
- /** The caption for the checkbox group. */
16
- label: string;
17
- /** The name of the checkbox group. Will be used as the `name` attribute for every item. */
18
- name: string;
19
- }
20
-
21
- declare interface CheckboxGroupItemProps {
22
- /** Value of the checkbox group item, which will be submitted. Defaults to the label if not provided. */
23
- value?: string;
24
- /** The label for the checkbox group item. */
25
- label: string;
26
- }
27
-
28
- export declare type CheckboxGroupProps = ControlledCheckboxGroupProps | UncontrolledCheckboxGroupProps;
29
-
30
- declare interface ControlledCheckboxGroupProps extends CheckboxGroupBaseProps {
31
- /** The current values of the checkbox group. Should be used in conjunction with `onChange`, when controlling the values. Should be `undefined` otherwise. */
32
- values: string[];
33
- /** The default values of the checkbox group. Should be used when the checkbox group is uncontrolled. */
34
- defaultValues?: never;
35
- /** Callback function that is called when the checkbox group state changes. `values` should be adjusted appropriately. */
36
- onChange: (value: string[]) => void;
37
- }
38
-
39
- declare interface UncontrolledCheckboxGroupProps extends CheckboxGroupBaseProps {
40
- values?: never;
41
- defaultValues: string[];
42
- onChange?: (value: string[]) => void;
43
- }
44
-
45
- export { }
1
+ export { default } from "./src/CheckboxGroup";
2
+ export type { Props as CheckboxGroupProps } from "./src/CheckboxGroup";
3
+ export type { CheckboxGroupItemProps } from "./src/CheckboxGroupItem/CheckboxGroupItem";
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { type Props } from "./CheckboxGroupRoot";
3
+ export type { Props };
4
+ declare const CheckboxGroup: {
5
+ (props: Props): React.JSX.Element;
6
+ displayName: string;
7
+ Item: {
8
+ ({ label, value }: import("..").CheckboxGroupItemProps): React.JSX.Element;
9
+ displayName: string;
10
+ };
11
+ };
12
+ export default CheckboxGroup;
@@ -0,0 +1,12 @@
1
+ interface CheckboxGroupContextProps {
2
+ values: string[];
3
+ name: string;
4
+ onChange?: (value: string[]) => void;
5
+ disabled: boolean;
6
+ error: boolean;
7
+ required: boolean;
8
+ helperTextId: string;
9
+ errorTextId: string;
10
+ }
11
+ declare const CheckboxGroupContext: import("react").Context<CheckboxGroupContextProps>;
12
+ export default CheckboxGroupContext;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export interface CheckboxGroupItemProps {
3
+ /** Value of the checkbox group item, which will be submitted. */
4
+ value?: string;
5
+ /** The label for the checkbox group item. */
6
+ label: string;
7
+ }
8
+ declare const CheckboxGroupItem: {
9
+ ({ label, value }: CheckboxGroupItemProps): React.JSX.Element;
10
+ displayName: string;
11
+ };
12
+ export default CheckboxGroupItem;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroupItem.js","names":[],"sources":["../../../src/CheckboxGroupItem/CheckboxGroupItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { CheckboxBase } from \"@bonprix-ds/internal-components\";\nimport React, { useContext } from \"react\";\n\nimport CheckboxGroupContext from \"../CheckboxGroupContext\";\n\nexport interface CheckboxGroupItemProps {\n /** Value of the checkbox group item, which will be submitted. Defaults to the label if not provided. */\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":";;;;;;AAcA,IAAM,KAAqB,EAAE,UAAO,WAAQ,QAAoC;CAC9E,IAAM,EAAE,WAAQ,aAAU,GAAG,MAAS,EAAW,CAAoB,GAC/D,IAAU,EAAO,SAAS,CAAK,GAE/B,UAAqB;EACzB,IAAM,IAAY,IAAU,EAAO,QAAQ,MAAM,MAAM,CAAK,IAAI,CAAC,GAAG,GAAQ,CAAK;EACjF,IAAW,CAAS;CACtB;CAEA,OAAO,kBAAC,GAAD;EAAc,GAAI;EAAe;EAAS,UAAU;EAAqB;EAAc;CAAQ,CAAA;AACxG;AAEA,EAAkB,cAAc"}
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,IAAM,KAAqB,EAAE,UAAO,WAAQ,QAAoC;CAC9E,IAAM,EAAE,WAAQ,aAAU,GAAG,MAAS,EAAW,CAAoB,GAC/D,IAAU,EAAO,SAAS,CAAK,GAE/B,UAAqB;EACzB,IAAM,IAAY,IAAU,EAAO,QAAQ,MAAM,MAAM,CAAK,IAAI,CAAC,GAAG,GAAQ,CAAK;EACjF,IAAW,CAAS;CACtB;CAEA,OAAO,kBAAC,GAAD;EAAc,GAAI;EAAe;EAAS,UAAU;EAAqB;EAAc;CAAQ,CAAA;AACxG;AAEA,EAAkB,cAAc"}
@@ -0,0 +1,2 @@
1
+ import CheckboxGroupItem from "./CheckboxGroupItem";
2
+ export default CheckboxGroupItem;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { SelectionControlGroupProps } from "@bonprix-ds/internal-components";
3
+ interface CheckboxGroupBaseProps extends Omit<SelectionControlGroupProps, "componentName" | "divider" | "horizontalPadding"> {
4
+ /** The caption for the checkbox group. */
5
+ label: string;
6
+ /** The name of the checkbox group. Will be used as the `name` attribute for every item. */
7
+ name: string;
8
+ }
9
+ interface ControlledCheckboxGroupProps extends CheckboxGroupBaseProps {
10
+ /** The current values of the checkbox group. Should be used in conjunction with `onChange`, when controlling the values. Should be `undefined` otherwise. */
11
+ values: string[];
12
+ /** The default values of the checkbox group. Should be used when the checkbox group is uncontrolled. */
13
+ defaultValues?: never;
14
+ /** Callback function that is called when the checkbox group state changes. `values` should be adjusted appropriately. */
15
+ onChange: (value: string[]) => void;
16
+ }
17
+ interface UncontrolledCheckboxGroupProps extends CheckboxGroupBaseProps {
18
+ values?: never;
19
+ defaultValues: string[];
20
+ onChange?: (value: string[]) => void;
21
+ }
22
+ export type Props = ControlledCheckboxGroupProps | UncontrolledCheckboxGroupProps;
23
+ declare const CheckboxGroupRoot: {
24
+ ({ label, name, values: controlledValues, defaultValues, children, onChange, error, errorText, disabled, helperText, required, }: Props): React.JSX.Element;
25
+ displayName: string;
26
+ };
27
+ export default CheckboxGroupRoot;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroupRoot.js","names":[],"sources":["../../src/CheckboxGroupRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { SelectionControlGroup, SelectionControlGroupProps } from \"@bonprix-ds/internal-components\";\nimport React, { useId } from \"react\";\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-wrap flex-col\">\n <CheckboxGroupContext.Provider value={contextProps}>{children}</CheckboxGroupContext.Provider>\n </div>\n </SelectionControlGroup>\n );\n};\n\nCheckboxGroupRoot.displayName = \"CheckboxGroup\";\n\nexport default CheckboxGroupRoot;\n"],"mappings":";;;;;;AA+BA,IAAM,KAAqB,EACzB,UACA,SACA,QAAQ,GACR,kBACA,aACA,aACA,WAAQ,IACR,cACA,cAAW,IACX,eACA,cAAW,SACA;CAKX,IAAM,IAAe;EAAE,QAJF,MAAqB,KAAA,IACO,IAAnB;EAGC;EAAM;EAAU;EAAU;EAAO;EAAU,cAFrD,EAEqD;EAAc,aADpE,EACoE;CAAY;CAEpG,OACE,kBAAC,GAAD;EACS;EACA;EACI;EACD;EACE;EACF;EACV,eAAc;EAEd,UAAA,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAAC,EAAqB,UAAtB;IAA+B,OAAO;IAAe;GAAwC,CAAA;EAC1F,CAAA;CACgB,CAAA;AAE3B;AAEA,EAAkB,cAAc"}
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-wrap flex-col\">\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,IAAM,KAAqB,EACzB,UACA,SACA,QAAQ,GACR,kBACA,aACA,aACA,WAAQ,IACR,cACA,cAAW,IACX,eACA,cAAW,SACA;CAKX,IAAM,IAAe;EAAE,QAJF,MAAqB,KAAA,IACO,IAAnB;EAGC;EAAM;EAAU;EAAU;EAAO;EAAU,cAFrD,EAEqD;EAAc,aADpE,EACoE;CAAY;CAEpG,OACE,kBAAC,GAAD;EACS;EACA;EACI;EACD;EACE;EACF;EACV,eAAc;EAEd,UAAA,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAAC,EAAqB,UAAtB;IAA+B,OAAO;IAAe;GAAwC,CAAA;EAC1F,CAAA;CACgB,CAAA;AAE3B;AAEA,EAAkB,cAAc"}
package/package.json CHANGED
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-checkbox-group",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "CheckboxGroup component, implemented in React, for the Bonprix Design System.",
5
- "type": "module",
6
- "publishConfig": {
7
- "access": "public",
8
- "provenance": true
5
+ "keywords": [],
6
+ "license": "UNLICENSED",
7
+ "author": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/bonprix/design-system.git",
11
+ "directory": "packages/react/checkbox-group"
9
12
  },
10
- "module": "./dist/index.js",
13
+ "files": [
14
+ "dist",
15
+ "!dist/tsconfig.tsbuildinfo",
16
+ "!dist/vite.config.d.ts",
17
+ "!dist/**/*.test.d.ts"
18
+ ],
19
+ "type": "module",
11
20
  "sideEffects": false,
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
12
23
  "exports": {
13
24
  ".": {
14
25
  "import": "./dist/index.js",
@@ -16,34 +27,24 @@
16
27
  "default": "./dist/index.js"
17
28
  }
18
29
  },
19
- "types": "./dist/index.d.ts",
20
- "files": [
21
- "dist"
22
- ],
23
- "keywords": [],
24
- "author": "",
25
- "license": "UNLICENSED",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/bonprix/design-system.git",
29
- "directory": "packages/react/checkbox-group"
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
30
33
  },
31
34
  "dependencies": {
32
- "@bonprix-ds/internal-components": "0.1.5",
33
- "@bonprix-ds/utils": "0.2.1"
34
- },
35
- "peerDependencies": {
36
- "react": "^19.0.0",
37
- "react-dom": "^19.0.0",
38
- "tailwind-variants": "0.3.1"
35
+ "@bonprix-ds/internal-components": "0.2.1",
36
+ "@bonprix-ds/utils": "0.2.2"
39
37
  },
40
38
  "devDependencies": {
41
- "vite": "8.2.2",
42
- "@types/react": "19.2.18",
43
- "@vitejs/plugin-react": "6.1.0",
39
+ "@types/react": "19.3.0",
40
+ "@vitejs/plugin-react": "6.1.1",
44
41
  "rollup-preserve-directives": "1.1.3",
45
- "unplugin-dts": "1.0.3",
46
- "@microsoft/api-extractor": "7.59.0"
42
+ "vite": "8.3.0"
43
+ },
44
+ "peerDependencies": {
45
+ "react": "^19.3.0",
46
+ "react-dom": "^19.3.0",
47
+ "tailwind-variants": "0.3.1"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "vite build"