@fuf-stack/uniform 0.19.3 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CheckboxGroup/index.cjs +2 -2
- package/dist/CheckboxGroup/index.d.cts +4 -3
- package/dist/CheckboxGroup/index.d.ts +4 -3
- package/dist/CheckboxGroup/index.js +1 -1
- package/dist/CheckboxGroup-B_1mu8Xo.d.cts +280 -0
- package/dist/CheckboxGroup-B_1mu8Xo.d.ts +280 -0
- package/dist/RadioBoxes/index.d.cts +2 -2
- package/dist/RadioBoxes/index.d.ts +2 -2
- package/dist/RadioGroup/index.d.cts +2 -2
- package/dist/RadioGroup/index.d.ts +2 -2
- package/dist/{chunk-YLTKVPHE.cjs → chunk-NVSZYURK.cjs} +52 -23
- package/dist/chunk-NVSZYURK.cjs.map +1 -0
- package/dist/{chunk-BC6ZP7TF.js → chunk-OLPDYX6B.js} +54 -25
- package/dist/chunk-OLPDYX6B.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/CheckboxGroup-Dh0YW4KV.d.cts +0 -132
- package/dist/CheckboxGroup-Dh0YW4KV.d.ts +0 -132
- package/dist/chunk-BC6ZP7TF.js.map +0 -1
- package/dist/chunk-YLTKVPHE.cjs.map +0 -1
- package/dist/{RadioBoxes-C61IRDCU.d.cts → RadioBoxes-BmJBBZVd.d.cts} +15 -15
- package/dist/{RadioBoxes-C61IRDCU.d.ts → RadioBoxes-BmJBBZVd.d.ts} +15 -15
- package/dist/{RadioGroup-C7I27oav.d.cts → RadioGroup-BJijfixt.d.cts} +15 -15
- package/dist/{RadioGroup-C7I27oav.d.ts → RadioGroup-BJijfixt.d.ts} +15 -15
|
@@ -14,7 +14,11 @@ var _chunkF4VYFBYCcjs = require('./chunk-F4VYFBYC.cjs');
|
|
|
14
14
|
var _chunk555JRYCScjs = require('./chunk-555JRYCS.cjs');
|
|
15
15
|
|
|
16
16
|
// src/CheckboxGroup/CheckboxGroup.tsx
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
17
20
|
var _checkbox = require('@heroui/checkbox');
|
|
21
|
+
var _theme = require('@heroui/theme');
|
|
18
22
|
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
19
23
|
var _jsxruntime = require('react/jsx-runtime');
|
|
20
24
|
var checkboxGroupVariants = _pixelutils.tv.call(void 0, {
|
|
@@ -22,20 +26,40 @@ var checkboxGroupVariants = _pixelutils.tv.call(void 0, {
|
|
|
22
26
|
base: "group",
|
|
23
27
|
// Needs group for group-data condition
|
|
24
28
|
errorMessage: "text-tiny",
|
|
25
|
-
itemBase: "",
|
|
26
|
-
itemIcon: "",
|
|
27
|
-
itemLabel: "text-sm",
|
|
28
|
-
itemWrapper: "",
|
|
29
29
|
// see HeroUI styles for group-data condition,
|
|
30
30
|
// e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts
|
|
31
31
|
label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger",
|
|
32
|
+
optionBase: "",
|
|
33
|
+
optionIcon: "",
|
|
34
|
+
optionLabel: "",
|
|
35
|
+
optionLabelSubline: "!text-small text-foreground-400",
|
|
36
|
+
optionWrapper: "",
|
|
32
37
|
wrapper: ""
|
|
38
|
+
},
|
|
39
|
+
variants: {
|
|
40
|
+
// see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts
|
|
41
|
+
color: _chunk555JRYCScjs.__spreadValues.call(void 0, {
|
|
42
|
+
info: {
|
|
43
|
+
wrapper: "text-info-foreground after:bg-info after:text-info-foreground"
|
|
44
|
+
}
|
|
45
|
+
}, _theme.checkbox.variants.color),
|
|
46
|
+
lineThrough: {
|
|
47
|
+
true: {
|
|
48
|
+
optionLabel: [
|
|
49
|
+
..._theme.checkbox.variants.lineThrough.true.label,
|
|
50
|
+
// fix stroke position when used with subline and enable animation
|
|
51
|
+
"relative before:transition-all before:duration-200"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
33
55
|
}
|
|
34
56
|
});
|
|
35
57
|
var CheckboxGroup = ({
|
|
36
58
|
className = void 0,
|
|
59
|
+
color = "primary",
|
|
37
60
|
inline = false,
|
|
38
61
|
label = void 0,
|
|
62
|
+
lineThrough = false,
|
|
39
63
|
options,
|
|
40
64
|
disabled = false,
|
|
41
65
|
name,
|
|
@@ -52,18 +76,17 @@ var CheckboxGroup = ({
|
|
|
52
76
|
const { onChange, value = [], ref, onBlur } = field;
|
|
53
77
|
const showTestIdCopyButton = debugMode === "debug-testids";
|
|
54
78
|
const showLabel = label || showTestIdCopyButton;
|
|
55
|
-
const variants = checkboxGroupVariants();
|
|
79
|
+
const variants = checkboxGroupVariants({ lineThrough });
|
|
56
80
|
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
|
|
57
|
-
const
|
|
58
|
-
base: classNames.itemBase,
|
|
59
|
-
wrapper: classNames.itemWrapper,
|
|
60
|
-
icon: classNames.itemIcon,
|
|
61
|
-
label: classNames.itemLabel
|
|
62
|
-
};
|
|
63
|
-
const itemGroupClassName = {
|
|
81
|
+
const heroCheckboxGroupClassNames = {
|
|
64
82
|
base: classNames.base,
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
label: classNames.label,
|
|
84
|
+
wrapper: classNames.wrapper
|
|
85
|
+
};
|
|
86
|
+
const heroCheckboxClassNames = {
|
|
87
|
+
base: classNames.optionBase,
|
|
88
|
+
icon: classNames.optionIcon,
|
|
89
|
+
wrapper: classNames.optionWrapper
|
|
67
90
|
};
|
|
68
91
|
const errorFlat = _error && Object.values(
|
|
69
92
|
_error
|
|
@@ -79,7 +102,7 @@ var CheckboxGroup = ({
|
|
|
79
102
|
};
|
|
80
103
|
const singleCheckboxProps = {
|
|
81
104
|
value: getCheckboxValue(value),
|
|
82
|
-
onChange: (newValue) => onChange(newValue
|
|
105
|
+
onChange: (newValue) => onChange(newValue == null ? void 0 : newValue[0])
|
|
83
106
|
};
|
|
84
107
|
const multipleCheckboxProps = {
|
|
85
108
|
onChange,
|
|
@@ -89,11 +112,11 @@ var CheckboxGroup = ({
|
|
|
89
112
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
113
|
_checkbox.CheckboxGroup,
|
|
91
114
|
_chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"data-testid": testId,
|
|
115
|
+
classNames: heroCheckboxGroupClassNames,
|
|
116
|
+
color: color === "info" ? "primary" : color,
|
|
95
117
|
"data-invalid": invalid,
|
|
96
|
-
|
|
118
|
+
"data-testid": testId,
|
|
119
|
+
errorMessage: errorFlat.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
97
120
|
_chunkGNYQC5IJcjs.FieldValidationError_default,
|
|
98
121
|
{
|
|
99
122
|
className: classNames.errorMessage,
|
|
@@ -109,6 +132,7 @@ var CheckboxGroup = ({
|
|
|
109
132
|
label,
|
|
110
133
|
showTestIdCopyButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPA2DQCBYcjs.FieldCopyTestIdButton_default, { testId })
|
|
111
134
|
] }),
|
|
135
|
+
name,
|
|
112
136
|
onBlur,
|
|
113
137
|
orientation: inline ? "horizontal" : "vertical",
|
|
114
138
|
ref
|
|
@@ -117,15 +141,20 @@ var CheckboxGroup = ({
|
|
|
117
141
|
const optionTestId = _pixelutils.slugify.call(void 0,
|
|
118
142
|
`${testId}_option_${(option == null ? void 0 : option.testId) || (option == null ? void 0 : option.value)}`
|
|
119
143
|
);
|
|
144
|
+
const labelContent = option.labelSubline ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-start", children: [
|
|
145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: classNames.optionLabel, children: option.label }),
|
|
146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${classNames.optionLabelSubline}`, children: option.labelSubline })
|
|
147
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: classNames.optionLabel, children: option.label });
|
|
120
148
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
121
149
|
_checkbox.Checkbox,
|
|
122
150
|
{
|
|
151
|
+
"aria-label": typeof option.label === "string" ? option.label : option.value,
|
|
152
|
+
classNames: heroCheckboxClassNames,
|
|
123
153
|
"data-invalid": invalid,
|
|
124
|
-
|
|
154
|
+
"data-testid": optionTestId,
|
|
125
155
|
isDisabled: disabled || option.disabled,
|
|
126
156
|
value: option == null ? void 0 : option.value,
|
|
127
|
-
|
|
128
|
-
children: option == null ? void 0 : option.label
|
|
157
|
+
children: labelContent
|
|
129
158
|
},
|
|
130
159
|
`index_${option.value}`
|
|
131
160
|
);
|
|
@@ -142,4 +171,4 @@ var CheckboxGroup_default2 = CheckboxGroup_default;
|
|
|
142
171
|
|
|
143
172
|
|
|
144
173
|
exports.CheckboxGroup_default = CheckboxGroup_default; exports.CheckboxGroup_default2 = CheckboxGroup_default2;
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-NVSZYURK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NVSZYURK.cjs","../src/CheckboxGroup/CheckboxGroup.tsx","../src/CheckboxGroup/index.ts"],"names":["CheckboxGroup_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACXA;AACE;AACA;AAAiB,4CACZ;AACP,sCAAiD;AAEjD,oDAAkD;AAsLxC,+CAAA;AAhLH,IAAM,sBAAA,EAAw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AA,MACA,WAAA,EAAa,OAAA,EAAS,aAAA,EAAe,UAAA;AAAA,MACrC;AAAA,IAAA,CAAA,EAEI,kBAAA,CAAA,EAjCL;AAAA,MAmCE,QAAA,EAAA,QAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,OAAA,CAAS,GAAA,CAAI,CAAC,MAAA,EAAA,GAAW;AACxB,QAAA,MAAM,aAAA,EAAe,iCAAA;AAAA,UACnB,CAAA,EAAA;AACF,QAAA;AAEA,QAAA;AAEI,0BAAA;AACA,0BAAA;AAGF,QAAA;AAKF,QAAA;AACG,UAAA;AAAA,UAAA;AAAA,YAAA;AAE4D,YAAA;AAE/C,YAAA;AACE,YAAA;AACD,YAAA;AACkB,YAAA;AAEhB,YAAA;AAEd,UAAA;AAHI,UAAA;AAIP,QAAA;AAEJ,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;AAEO;ADzFI;AACA;AEhKJA;AFkKI;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NVSZYURK.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { FieldError } from 'react-hook-form';\n\nimport {\n Checkbox as HeroCheckbox,\n CheckboxGroup as HeroCheckboxGroup,\n} from '@heroui/checkbox';\nimport { checkbox as heroCheckboxVariants } from '@heroui/theme';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const checkboxGroupVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n errorMessage: 'text-tiny',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n optionBase: '',\n optionIcon: '',\n optionLabel: '',\n optionLabelSubline: '!text-small text-foreground-400',\n optionWrapper: '',\n wrapper: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts\n color: {\n info: {\n wrapper:\n 'text-info-foreground after:bg-info after:text-info-foreground',\n },\n ...heroCheckboxVariants.variants.color,\n } as const,\n lineThrough: {\n true: {\n optionLabel: [\n ...heroCheckboxVariants.variants.lineThrough.true.label,\n // fix stroke position when used with subline and enable animation\n 'relative before:transition-all before:duration-200',\n ],\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof checkboxGroupVariants>;\ntype ClassName = TVClassName<typeof checkboxGroupVariants>;\n\nexport type CheckboxGroupOption = {\n /** option label */\n label?: ReactNode;\n /** subline displayed below the label */\n labelSubline?: ReactNode;\n /** option value */\n value: string;\n /** disables the option */\n disabled?: boolean;\n /** HTML data-testid attribute of the option */\n testId?: string;\n};\n\nexport interface CheckboxGroupProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Color scheme of the checkboxes */\n color?: VariantProps['color'];\n /** Sets all checkboxes disabled */\n disabled?: boolean;\n /** Orientation of the checkboxes */\n inline?: boolean;\n /** Label displayed above the checkboxes */\n label?: ReactNode;\n /** Whether the checkboxes label should be crossed out */\n lineThrough?: boolean;\n /** Name the Field is registered on the form */\n name: string;\n /** Checkboxes that should be displayed. */\n options: CheckboxGroupOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * CheckboxGroup component based on [HeroUI CheckboxGroup](https://www.heroui.com//docs/components/checkbox-group)\n */\nconst CheckboxGroup = ({\n className = undefined,\n color = 'primary',\n inline = false,\n label = undefined,\n lineThrough = false,\n options,\n disabled = false,\n name,\n testId: _testId = undefined,\n}: CheckboxGroupProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const {\n error: _error,\n invalid,\n required,\n testId,\n } = getFieldState(name, _testId);\n\n const { field } = useController({ control, name, disabled });\n const { onChange, value = [], ref, onBlur } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = checkboxGroupVariants({ lineThrough });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map slots to HeroUI class names\n const heroCheckboxGroupClassNames = {\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n };\n const heroCheckboxClassNames = {\n base: classNames.optionBase,\n icon: classNames.optionIcon,\n wrapper: classNames.optionWrapper,\n };\n\n // Convert React Hook Form's nested error object structure to a flat array\n // RHF errors can be nested like: checkboxField.0 (individual checkbox errors)\n // and checkboxField._error (global field errors) - this flattens all\n // error values into a single array for rendering with FieldValidationError\n const errorFlat: FieldError[] =\n (_error &&\n Object.values(\n _error as unknown as Record<string, FieldError[]>,\n ).flat()) ||\n [];\n\n /**\n * Handles the checkbox group value changes based on the number of options:\n * 1. For single checkbox (options.length === 1):\n * - Converts undefined/empty array to [] for consistent controlled behavior\n * - Extracts single value from array for onChange\n *\n * Example: undefined → []\n * [value] → value\n *\n * 2. For multiple checkboxes:\n * - Uses raw value array with fallback to empty array\n * - Passes through onChange directly\n *\n * Example: undefined → []\n * ['value1', 'value2'] → ['value1', 'value2']\n */\n const getCheckboxValue = (inputValue: unknown): string[] => {\n if (Array.isArray(inputValue)) {\n return inputValue;\n }\n if (inputValue) {\n return [inputValue as string];\n }\n return [];\n };\n\n const singleCheckboxProps = {\n value: getCheckboxValue(value),\n onChange: (newValue: string[]) => onChange(newValue?.[0]),\n };\n\n const multipleCheckboxProps = {\n onChange,\n value: getCheckboxValue(value),\n };\n\n const checkboxGroupProps =\n options.length === 1 ? singleCheckboxProps : multipleCheckboxProps;\n\n return (\n <HeroCheckboxGroup\n classNames={heroCheckboxGroupClassNames}\n color={color === 'info' ? 'primary' : color}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-testid={testId}\n errorMessage={\n errorFlat.length > 0 && (\n <FieldValidationError\n className={classNames.errorMessage}\n error={errorFlat}\n testId={testId}\n />\n )\n }\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </label>\n )\n }\n name={name}\n onBlur={onBlur}\n orientation={inline ? 'horizontal' : 'vertical'}\n ref={ref}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...checkboxGroupProps}\n >\n {options?.map((option) => {\n const optionTestId = slugify(\n `${testId}_option_${option?.testId || option?.value}`,\n );\n\n const labelContent = option.labelSubline ? (\n <div className=\"flex flex-col items-start\">\n <span className={classNames.optionLabel}>{option.label}</span>\n <span className={`${classNames.optionLabelSubline}`}>\n {option.labelSubline}\n </span>\n </div>\n ) : (\n <span className={classNames.optionLabel}>{option.label}</span>\n );\n\n return (\n <HeroCheckbox\n aria-label={\n typeof option.label === 'string' ? option.label : option.value\n }\n classNames={heroCheckboxClassNames}\n data-invalid={invalid}\n data-testid={optionTestId}\n isDisabled={disabled || option.disabled}\n key={`index_${option.value}`}\n value={option?.value}\n >\n {labelContent}\n </HeroCheckbox>\n );\n })}\n </HeroCheckboxGroup>\n );\n};\n\nexport default CheckboxGroup;\n","import CheckboxGroup from './CheckboxGroup';\n\nexport type { CheckboxGroupProps, CheckboxGroupOption } from './CheckboxGroup';\n\nexport { CheckboxGroup };\n\nexport default CheckboxGroup;\n"]}
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
} from "./chunk-K2V4ULA2.js";
|
|
15
15
|
|
|
16
16
|
// src/CheckboxGroup/CheckboxGroup.tsx
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
Checkbox as HeroCheckbox,
|
|
19
|
+
CheckboxGroup as HeroCheckboxGroup
|
|
20
|
+
} from "@heroui/checkbox";
|
|
21
|
+
import { checkbox as heroCheckboxVariants } from "@heroui/theme";
|
|
18
22
|
import { slugify, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
19
23
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
24
|
var checkboxGroupVariants = tv({
|
|
@@ -22,20 +26,40 @@ var checkboxGroupVariants = tv({
|
|
|
22
26
|
base: "group",
|
|
23
27
|
// Needs group for group-data condition
|
|
24
28
|
errorMessage: "text-tiny",
|
|
25
|
-
itemBase: "",
|
|
26
|
-
itemIcon: "",
|
|
27
|
-
itemLabel: "text-sm",
|
|
28
|
-
itemWrapper: "",
|
|
29
29
|
// see HeroUI styles for group-data condition,
|
|
30
30
|
// e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts
|
|
31
31
|
label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger",
|
|
32
|
+
optionBase: "",
|
|
33
|
+
optionIcon: "",
|
|
34
|
+
optionLabel: "",
|
|
35
|
+
optionLabelSubline: "!text-small text-foreground-400",
|
|
36
|
+
optionWrapper: "",
|
|
32
37
|
wrapper: ""
|
|
38
|
+
},
|
|
39
|
+
variants: {
|
|
40
|
+
// see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts
|
|
41
|
+
color: __spreadValues({
|
|
42
|
+
info: {
|
|
43
|
+
wrapper: "text-info-foreground after:bg-info after:text-info-foreground"
|
|
44
|
+
}
|
|
45
|
+
}, heroCheckboxVariants.variants.color),
|
|
46
|
+
lineThrough: {
|
|
47
|
+
true: {
|
|
48
|
+
optionLabel: [
|
|
49
|
+
...heroCheckboxVariants.variants.lineThrough.true.label,
|
|
50
|
+
// fix stroke position when used with subline and enable animation
|
|
51
|
+
"relative before:transition-all before:duration-200"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
33
55
|
}
|
|
34
56
|
});
|
|
35
57
|
var CheckboxGroup = ({
|
|
36
58
|
className = void 0,
|
|
59
|
+
color = "primary",
|
|
37
60
|
inline = false,
|
|
38
61
|
label = void 0,
|
|
62
|
+
lineThrough = false,
|
|
39
63
|
options,
|
|
40
64
|
disabled = false,
|
|
41
65
|
name,
|
|
@@ -52,18 +76,17 @@ var CheckboxGroup = ({
|
|
|
52
76
|
const { onChange, value = [], ref, onBlur } = field;
|
|
53
77
|
const showTestIdCopyButton = debugMode === "debug-testids";
|
|
54
78
|
const showLabel = label || showTestIdCopyButton;
|
|
55
|
-
const variants = checkboxGroupVariants();
|
|
79
|
+
const variants = checkboxGroupVariants({ lineThrough });
|
|
56
80
|
const classNames = variantsToClassNames(variants, className, "base");
|
|
57
|
-
const
|
|
58
|
-
base: classNames.itemBase,
|
|
59
|
-
wrapper: classNames.itemWrapper,
|
|
60
|
-
icon: classNames.itemIcon,
|
|
61
|
-
label: classNames.itemLabel
|
|
62
|
-
};
|
|
63
|
-
const itemGroupClassName = {
|
|
81
|
+
const heroCheckboxGroupClassNames = {
|
|
64
82
|
base: classNames.base,
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
label: classNames.label,
|
|
84
|
+
wrapper: classNames.wrapper
|
|
85
|
+
};
|
|
86
|
+
const heroCheckboxClassNames = {
|
|
87
|
+
base: classNames.optionBase,
|
|
88
|
+
icon: classNames.optionIcon,
|
|
89
|
+
wrapper: classNames.optionWrapper
|
|
67
90
|
};
|
|
68
91
|
const errorFlat = _error && Object.values(
|
|
69
92
|
_error
|
|
@@ -79,7 +102,7 @@ var CheckboxGroup = ({
|
|
|
79
102
|
};
|
|
80
103
|
const singleCheckboxProps = {
|
|
81
104
|
value: getCheckboxValue(value),
|
|
82
|
-
onChange: (newValue) => onChange(newValue
|
|
105
|
+
onChange: (newValue) => onChange(newValue == null ? void 0 : newValue[0])
|
|
83
106
|
};
|
|
84
107
|
const multipleCheckboxProps = {
|
|
85
108
|
onChange,
|
|
@@ -89,11 +112,11 @@ var CheckboxGroup = ({
|
|
|
89
112
|
return /* @__PURE__ */ jsx(
|
|
90
113
|
HeroCheckboxGroup,
|
|
91
114
|
__spreadProps(__spreadValues({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"data-testid": testId,
|
|
115
|
+
classNames: heroCheckboxGroupClassNames,
|
|
116
|
+
color: color === "info" ? "primary" : color,
|
|
95
117
|
"data-invalid": invalid,
|
|
96
|
-
|
|
118
|
+
"data-testid": testId,
|
|
119
|
+
errorMessage: errorFlat.length > 0 && /* @__PURE__ */ jsx(
|
|
97
120
|
FieldValidationError_default,
|
|
98
121
|
{
|
|
99
122
|
className: classNames.errorMessage,
|
|
@@ -109,6 +132,7 @@ var CheckboxGroup = ({
|
|
|
109
132
|
label,
|
|
110
133
|
showTestIdCopyButton && /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId })
|
|
111
134
|
] }),
|
|
135
|
+
name,
|
|
112
136
|
onBlur,
|
|
113
137
|
orientation: inline ? "horizontal" : "vertical",
|
|
114
138
|
ref
|
|
@@ -117,15 +141,20 @@ var CheckboxGroup = ({
|
|
|
117
141
|
const optionTestId = slugify(
|
|
118
142
|
`${testId}_option_${(option == null ? void 0 : option.testId) || (option == null ? void 0 : option.value)}`
|
|
119
143
|
);
|
|
144
|
+
const labelContent = option.labelSubline ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start", children: [
|
|
145
|
+
/* @__PURE__ */ jsx("span", { className: classNames.optionLabel, children: option.label }),
|
|
146
|
+
/* @__PURE__ */ jsx("span", { className: `${classNames.optionLabelSubline}`, children: option.labelSubline })
|
|
147
|
+
] }) : /* @__PURE__ */ jsx("span", { className: classNames.optionLabel, children: option.label });
|
|
120
148
|
return /* @__PURE__ */ jsx(
|
|
121
|
-
|
|
149
|
+
HeroCheckbox,
|
|
122
150
|
{
|
|
151
|
+
"aria-label": typeof option.label === "string" ? option.label : option.value,
|
|
152
|
+
classNames: heroCheckboxClassNames,
|
|
123
153
|
"data-invalid": invalid,
|
|
124
|
-
|
|
154
|
+
"data-testid": optionTestId,
|
|
125
155
|
isDisabled: disabled || option.disabled,
|
|
126
156
|
value: option == null ? void 0 : option.value,
|
|
127
|
-
|
|
128
|
-
children: option == null ? void 0 : option.label
|
|
157
|
+
children: labelContent
|
|
129
158
|
},
|
|
130
159
|
`index_${option.value}`
|
|
131
160
|
);
|
|
@@ -142,4 +171,4 @@ export {
|
|
|
142
171
|
CheckboxGroup_default,
|
|
143
172
|
CheckboxGroup_default2
|
|
144
173
|
};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-OLPDYX6B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/CheckboxGroup/CheckboxGroup.tsx","../src/CheckboxGroup/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { FieldError } from 'react-hook-form';\n\nimport {\n Checkbox as HeroCheckbox,\n CheckboxGroup as HeroCheckboxGroup,\n} from '@heroui/checkbox';\nimport { checkbox as heroCheckboxVariants } from '@heroui/theme';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const checkboxGroupVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n errorMessage: 'text-tiny',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n optionBase: '',\n optionIcon: '',\n optionLabel: '',\n optionLabelSubline: '!text-small text-foreground-400',\n optionWrapper: '',\n wrapper: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts\n color: {\n info: {\n wrapper:\n 'text-info-foreground after:bg-info after:text-info-foreground',\n },\n ...heroCheckboxVariants.variants.color,\n } as const,\n lineThrough: {\n true: {\n optionLabel: [\n ...heroCheckboxVariants.variants.lineThrough.true.label,\n // fix stroke position when used with subline and enable animation\n 'relative before:transition-all before:duration-200',\n ],\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof checkboxGroupVariants>;\ntype ClassName = TVClassName<typeof checkboxGroupVariants>;\n\nexport type CheckboxGroupOption = {\n /** option label */\n label?: ReactNode;\n /** subline displayed below the label */\n labelSubline?: ReactNode;\n /** option value */\n value: string;\n /** disables the option */\n disabled?: boolean;\n /** HTML data-testid attribute of the option */\n testId?: string;\n};\n\nexport interface CheckboxGroupProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Color scheme of the checkboxes */\n color?: VariantProps['color'];\n /** Sets all checkboxes disabled */\n disabled?: boolean;\n /** Orientation of the checkboxes */\n inline?: boolean;\n /** Label displayed above the checkboxes */\n label?: ReactNode;\n /** Whether the checkboxes label should be crossed out */\n lineThrough?: boolean;\n /** Name the Field is registered on the form */\n name: string;\n /** Checkboxes that should be displayed. */\n options: CheckboxGroupOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * CheckboxGroup component based on [HeroUI CheckboxGroup](https://www.heroui.com//docs/components/checkbox-group)\n */\nconst CheckboxGroup = ({\n className = undefined,\n color = 'primary',\n inline = false,\n label = undefined,\n lineThrough = false,\n options,\n disabled = false,\n name,\n testId: _testId = undefined,\n}: CheckboxGroupProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const {\n error: _error,\n invalid,\n required,\n testId,\n } = getFieldState(name, _testId);\n\n const { field } = useController({ control, name, disabled });\n const { onChange, value = [], ref, onBlur } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = checkboxGroupVariants({ lineThrough });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map slots to HeroUI class names\n const heroCheckboxGroupClassNames = {\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n };\n const heroCheckboxClassNames = {\n base: classNames.optionBase,\n icon: classNames.optionIcon,\n wrapper: classNames.optionWrapper,\n };\n\n // Convert React Hook Form's nested error object structure to a flat array\n // RHF errors can be nested like: checkboxField.0 (individual checkbox errors)\n // and checkboxField._error (global field errors) - this flattens all\n // error values into a single array for rendering with FieldValidationError\n const errorFlat: FieldError[] =\n (_error &&\n Object.values(\n _error as unknown as Record<string, FieldError[]>,\n ).flat()) ||\n [];\n\n /**\n * Handles the checkbox group value changes based on the number of options:\n * 1. For single checkbox (options.length === 1):\n * - Converts undefined/empty array to [] for consistent controlled behavior\n * - Extracts single value from array for onChange\n *\n * Example: undefined → []\n * [value] → value\n *\n * 2. For multiple checkboxes:\n * - Uses raw value array with fallback to empty array\n * - Passes through onChange directly\n *\n * Example: undefined → []\n * ['value1', 'value2'] → ['value1', 'value2']\n */\n const getCheckboxValue = (inputValue: unknown): string[] => {\n if (Array.isArray(inputValue)) {\n return inputValue;\n }\n if (inputValue) {\n return [inputValue as string];\n }\n return [];\n };\n\n const singleCheckboxProps = {\n value: getCheckboxValue(value),\n onChange: (newValue: string[]) => onChange(newValue?.[0]),\n };\n\n const multipleCheckboxProps = {\n onChange,\n value: getCheckboxValue(value),\n };\n\n const checkboxGroupProps =\n options.length === 1 ? singleCheckboxProps : multipleCheckboxProps;\n\n return (\n <HeroCheckboxGroup\n classNames={heroCheckboxGroupClassNames}\n color={color === 'info' ? 'primary' : color}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-testid={testId}\n errorMessage={\n errorFlat.length > 0 && (\n <FieldValidationError\n className={classNames.errorMessage}\n error={errorFlat}\n testId={testId}\n />\n )\n }\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </label>\n )\n }\n name={name}\n onBlur={onBlur}\n orientation={inline ? 'horizontal' : 'vertical'}\n ref={ref}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...checkboxGroupProps}\n >\n {options?.map((option) => {\n const optionTestId = slugify(\n `${testId}_option_${option?.testId || option?.value}`,\n );\n\n const labelContent = option.labelSubline ? (\n <div className=\"flex flex-col items-start\">\n <span className={classNames.optionLabel}>{option.label}</span>\n <span className={`${classNames.optionLabelSubline}`}>\n {option.labelSubline}\n </span>\n </div>\n ) : (\n <span className={classNames.optionLabel}>{option.label}</span>\n );\n\n return (\n <HeroCheckbox\n aria-label={\n typeof option.label === 'string' ? option.label : option.value\n }\n classNames={heroCheckboxClassNames}\n data-invalid={invalid}\n data-testid={optionTestId}\n isDisabled={disabled || option.disabled}\n key={`index_${option.value}`}\n value={option?.value}\n >\n {labelContent}\n </HeroCheckbox>\n );\n })}\n </HeroCheckboxGroup>\n );\n};\n\nexport default CheckboxGroup;\n","import CheckboxGroup from './CheckboxGroup';\n\nexport type { CheckboxGroupProps, CheckboxGroupOption } from './CheckboxGroup';\n\nexport { CheckboxGroup };\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;;;;;;;;;;;AAIA;AAAA,EACE,YAAY;AAAA,EACZ,iBAAiB;AAAA,OACZ;AACP,SAAS,YAAY,4BAA4B;AAEjD,SAAS,SAAS,IAAI,4BAA4B;AAsLxC,cAaA,YAbA;AAhLH,IAAM,wBAAwB,GAAG;AAAA,EACtC,OAAO;AAAA,IACL,MAAM;AAAA;AAAA,IACN,cAAc;AAAA;AAAA;AAAA,IAGd,OACE;AAAA,IACF,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,eAAe;AAAA,IACf,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA;AAAA,IAER,OAAO;AAAA,MACL,MAAM;AAAA,QACJ,SACE;AAAA,MACJ;AAAA,OACG,qBAAqB,SAAS;AAAA,IAEnC,aAAa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AAA,YACb,YAAY,YAAY,OAAO;AAAA,YAE/B,OAAO,iCAAQ;AAAA,YAEd;AAAA;AAAA,UAHI,SAAS,OAAO,KAAK;AAAA,QAI5B;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,wBAAQ;;;ACxPf,IAAOA,yBAAQ;","names":["CheckboxGroup_default"]}
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var _chunkEHTJ2BYBcjs = require('./chunk-EHTJ2BYB.cjs');
|
|
|
15
15
|
var _chunkJWYMBKE6cjs = require('./chunk-JWYMBKE6.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkNVSZYURKcjs = require('./chunk-NVSZYURK.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunk3ISETOB3cjs = require('./chunk-3ISETOB3.cjs');
|
|
@@ -80,5 +80,5 @@ require('./chunk-555JRYCS.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
exports.CheckboxGroup =
|
|
83
|
+
exports.CheckboxGroup = _chunkNVSZYURKcjs.CheckboxGroup_default; exports.FieldArray = _chunk3ISETOB3cjs.FieldArray_default; exports.FieldCopyTestIdButton = _chunkPA2DQCBYcjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkGNYQC5IJcjs.FieldValidationError_default; exports.Form = _chunkIYR5A3CVcjs.Form_default; exports.Grid = _chunk6GN255GPcjs.Grid_default; exports.Input = _chunkBDJHUA55cjs.Input_default; exports.RadioBoxes = _chunkYLJC74CQcjs.RadioBoxes_default; exports.RadioGroup = _chunkCUDJVXZXcjs.RadioGroup_default; exports.RadioTabs = _chunkY33HTDL6cjs.RadioTabs_default; exports.Select = _chunkRKZQKPRJcjs.Select_default; exports.SubmitButton = _chunkQ5KXDJU7cjs.SubmitButton_default; exports.Switch = _chunkEHTJ2BYBcjs.Switch_default; exports.TextArea = _chunkJWYMBKE6cjs.TextArea_default; exports.checkFieldIsRequired = _chunkF4VYFBYCcjs.checkFieldIsRequired; exports.fromNullishString = _chunkCESGUF6Fcjs.fromNullishString; exports.toFormFormat = _chunkCESGUF6Fcjs.toFormFormat; exports.toNullishString = _chunkCESGUF6Fcjs.toNullishString; exports.toValidationFormat = _chunkCESGUF6Fcjs.toValidationFormat; exports.useClientValidation = _chunkF4VYFBYCcjs.useClientValidation; exports.useController = _chunkF4VYFBYCcjs.useController; exports.useFieldArray = _chunkF4VYFBYCcjs.useFieldArray; exports.useFormContext = _chunkF4VYFBYCcjs.useFormContext; exports.useInput = _chunkF4VYFBYCcjs.useInput;
|
|
84
84
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CheckboxGroup, b as CheckboxGroupOption, a as CheckboxGroupProps } from './CheckboxGroup-
|
|
1
|
+
export { C as CheckboxGroup, b as CheckboxGroupOption, a as CheckboxGroupProps } from './CheckboxGroup-B_1mu8Xo.cjs';
|
|
2
2
|
export { F as FieldArray, a as FieldArrayChildrenRenderFn, b as FieldArrayFeatures, c as FieldArrayProps } from './FieldArray-hqxjr18x.cjs';
|
|
3
3
|
export { F as Form, a as FormProps } from './Form-D0grgL6G.cjs';
|
|
4
4
|
export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.cjs';
|
|
@@ -9,16 +9,16 @@ export { useInput } from '@heroui/input';
|
|
|
9
9
|
export { I as Input, a as InputProps } from './Input-B_wjhY9e.cjs';
|
|
10
10
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.cjs';
|
|
11
11
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-CU_xw0BL.cjs';
|
|
12
|
-
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-
|
|
13
|
-
export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-
|
|
12
|
+
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-BmJBBZVd.cjs';
|
|
13
|
+
export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BJijfixt.cjs';
|
|
14
14
|
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-CT8PT7ky.cjs';
|
|
15
15
|
export { S as Select, a as SelectProps } from './Select-JRwrSDew.cjs';
|
|
16
16
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-C81VCkmx.cjs';
|
|
17
17
|
export { S as Switch, a as SwitchProps } from './Switch-CLs964dL.cjs';
|
|
18
18
|
export { T as TextArea, a as TextAreaProps } from './TextArea-DNpInDsW.cjs';
|
|
19
19
|
import 'react/jsx-runtime';
|
|
20
|
-
import 'tailwind-variants/dist/config.js';
|
|
21
20
|
import 'tailwind-variants';
|
|
21
|
+
import 'tailwind-variants/dist/config.js';
|
|
22
22
|
import '@fuf-stack/pixel-utils';
|
|
23
23
|
import 'react';
|
|
24
24
|
import '@fuf-stack/veto';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CheckboxGroup, b as CheckboxGroupOption, a as CheckboxGroupProps } from './CheckboxGroup-
|
|
1
|
+
export { C as CheckboxGroup, b as CheckboxGroupOption, a as CheckboxGroupProps } from './CheckboxGroup-B_1mu8Xo.js';
|
|
2
2
|
export { F as FieldArray, a as FieldArrayChildrenRenderFn, b as FieldArrayFeatures, c as FieldArrayProps } from './FieldArray-hqxjr18x.js';
|
|
3
3
|
export { F as Form, a as FormProps } from './Form-DX5NTR-H.js';
|
|
4
4
|
export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.js';
|
|
@@ -9,16 +9,16 @@ export { useInput } from '@heroui/input';
|
|
|
9
9
|
export { I as Input, a as InputProps } from './Input-B_wjhY9e.js';
|
|
10
10
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.js';
|
|
11
11
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-CU_xw0BL.js';
|
|
12
|
-
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-
|
|
13
|
-
export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-
|
|
12
|
+
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-BmJBBZVd.js';
|
|
13
|
+
export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BJijfixt.js';
|
|
14
14
|
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-CT8PT7ky.js';
|
|
15
15
|
export { S as Select, a as SelectProps } from './Select-JRwrSDew.js';
|
|
16
16
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-C81VCkmx.js';
|
|
17
17
|
export { S as Switch, a as SwitchProps } from './Switch-CLs964dL.js';
|
|
18
18
|
export { T as TextArea, a as TextAreaProps } from './TextArea-DNpInDsW.js';
|
|
19
19
|
import 'react/jsx-runtime';
|
|
20
|
-
import 'tailwind-variants/dist/config.js';
|
|
21
20
|
import 'tailwind-variants';
|
|
21
|
+
import 'tailwind-variants/dist/config.js';
|
|
22
22
|
import '@fuf-stack/pixel-utils';
|
|
23
23
|
import 'react';
|
|
24
24
|
import '@fuf-stack/veto';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "fuf react form library",
|
|
5
5
|
"author": "Hannes Tiede",
|
|
6
6
|
"homepage": "https://github.com/fuf-stack/pixels#readme",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"react-icons": "5.5.0",
|
|
134
134
|
"react-hook-form": "7.55.0",
|
|
135
135
|
"react-select": "5.10.1",
|
|
136
|
-
"@fuf-stack/pixels": "0.43.8",
|
|
137
136
|
"@fuf-stack/pixel-utils": "0.5.4",
|
|
137
|
+
"@fuf-stack/pixels": "0.43.8",
|
|
138
138
|
"@fuf-stack/veto": "0.12.0"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
@@ -143,10 +143,10 @@
|
|
|
143
143
|
"@types/react-dom": "19.0.4",
|
|
144
144
|
"react": "19.0.0",
|
|
145
145
|
"react-dom": "19.0.0",
|
|
146
|
+
"@repo/storybook-config": "0.0.1",
|
|
146
147
|
"@repo/tailwind-config": "0.0.1",
|
|
147
148
|
"@repo/vite-config": "0.0.1",
|
|
148
|
-
"@repo/tsup-config": "0.0.1"
|
|
149
|
-
"@repo/storybook-config": "0.0.1"
|
|
149
|
+
"@repo/tsup-config": "0.0.1"
|
|
150
150
|
},
|
|
151
151
|
"scripts": {
|
|
152
152
|
"build": "tsup --config node_modules/@repo/tsup-config/config.ts",
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
3
|
-
import * as tailwind_variants from 'tailwind-variants';
|
|
4
|
-
import { TVProps, TVClassName } from '@fuf-stack/pixel-utils';
|
|
5
|
-
|
|
6
|
-
declare const checkboxGroupVariants: tailwind_variants.TVReturnType<{
|
|
7
|
-
[key: string]: {
|
|
8
|
-
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
-
base?: tailwind_variants.ClassValue;
|
|
10
|
-
label?: tailwind_variants.ClassValue;
|
|
11
|
-
errorMessage?: tailwind_variants.ClassValue;
|
|
12
|
-
itemBase?: tailwind_variants.ClassValue;
|
|
13
|
-
itemIcon?: tailwind_variants.ClassValue;
|
|
14
|
-
itemLabel?: tailwind_variants.ClassValue;
|
|
15
|
-
itemWrapper?: tailwind_variants.ClassValue;
|
|
16
|
-
wrapper?: tailwind_variants.ClassValue;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
} | {
|
|
20
|
-
[x: string]: {
|
|
21
|
-
[x: string]: tailwind_variants.ClassValue | {
|
|
22
|
-
base?: tailwind_variants.ClassValue;
|
|
23
|
-
label?: tailwind_variants.ClassValue;
|
|
24
|
-
errorMessage?: tailwind_variants.ClassValue;
|
|
25
|
-
itemBase?: tailwind_variants.ClassValue;
|
|
26
|
-
itemIcon?: tailwind_variants.ClassValue;
|
|
27
|
-
itemLabel?: tailwind_variants.ClassValue;
|
|
28
|
-
itemWrapper?: tailwind_variants.ClassValue;
|
|
29
|
-
wrapper?: tailwind_variants.ClassValue;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
} | {}, {
|
|
33
|
-
base: string;
|
|
34
|
-
errorMessage: string;
|
|
35
|
-
itemBase: string;
|
|
36
|
-
itemIcon: string;
|
|
37
|
-
itemLabel: string;
|
|
38
|
-
itemWrapper: string;
|
|
39
|
-
label: string;
|
|
40
|
-
wrapper: string;
|
|
41
|
-
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
42
|
-
[key: string]: {
|
|
43
|
-
[key: string]: tailwind_variants.ClassValue | {
|
|
44
|
-
base?: tailwind_variants.ClassValue;
|
|
45
|
-
label?: tailwind_variants.ClassValue;
|
|
46
|
-
errorMessage?: tailwind_variants.ClassValue;
|
|
47
|
-
itemBase?: tailwind_variants.ClassValue;
|
|
48
|
-
itemIcon?: tailwind_variants.ClassValue;
|
|
49
|
-
itemLabel?: tailwind_variants.ClassValue;
|
|
50
|
-
itemWrapper?: tailwind_variants.ClassValue;
|
|
51
|
-
wrapper?: tailwind_variants.ClassValue;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
} | {}>, {
|
|
55
|
-
[key: string]: {
|
|
56
|
-
[key: string]: tailwind_variants.ClassValue | {
|
|
57
|
-
base?: tailwind_variants.ClassValue;
|
|
58
|
-
label?: tailwind_variants.ClassValue;
|
|
59
|
-
errorMessage?: tailwind_variants.ClassValue;
|
|
60
|
-
itemBase?: tailwind_variants.ClassValue;
|
|
61
|
-
itemIcon?: tailwind_variants.ClassValue;
|
|
62
|
-
itemLabel?: tailwind_variants.ClassValue;
|
|
63
|
-
itemWrapper?: tailwind_variants.ClassValue;
|
|
64
|
-
wrapper?: tailwind_variants.ClassValue;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
} | {}, {
|
|
68
|
-
base: string;
|
|
69
|
-
errorMessage: string;
|
|
70
|
-
itemBase: string;
|
|
71
|
-
itemIcon: string;
|
|
72
|
-
itemLabel: string;
|
|
73
|
-
itemWrapper: string;
|
|
74
|
-
label: string;
|
|
75
|
-
wrapper: string;
|
|
76
|
-
}, tailwind_variants.TVReturnType<unknown, {
|
|
77
|
-
base: string;
|
|
78
|
-
errorMessage: string;
|
|
79
|
-
itemBase: string;
|
|
80
|
-
itemIcon: string;
|
|
81
|
-
itemLabel: string;
|
|
82
|
-
itemWrapper: string;
|
|
83
|
-
label: string;
|
|
84
|
-
wrapper: string;
|
|
85
|
-
}, undefined, tailwind_variants_dist_config_js.TVConfig<unknown, {
|
|
86
|
-
[key: string]: {
|
|
87
|
-
[key: string]: tailwind_variants.ClassValue | {
|
|
88
|
-
base?: tailwind_variants.ClassValue;
|
|
89
|
-
label?: tailwind_variants.ClassValue;
|
|
90
|
-
errorMessage?: tailwind_variants.ClassValue;
|
|
91
|
-
itemBase?: tailwind_variants.ClassValue;
|
|
92
|
-
itemIcon?: tailwind_variants.ClassValue;
|
|
93
|
-
itemLabel?: tailwind_variants.ClassValue;
|
|
94
|
-
itemWrapper?: tailwind_variants.ClassValue;
|
|
95
|
-
wrapper?: tailwind_variants.ClassValue;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
} | {}>, unknown, unknown, undefined>>;
|
|
99
|
-
type VariantProps = TVProps<typeof checkboxGroupVariants>;
|
|
100
|
-
type ClassName = TVClassName<typeof checkboxGroupVariants>;
|
|
101
|
-
type CheckboxGroupOption = {
|
|
102
|
-
/** option label */
|
|
103
|
-
label?: React.ReactNode;
|
|
104
|
-
/** option value */
|
|
105
|
-
value: string;
|
|
106
|
-
/** disables the option */
|
|
107
|
-
disabled?: boolean;
|
|
108
|
-
/** HTML data-testid attribute of the option */
|
|
109
|
-
testId?: string;
|
|
110
|
-
};
|
|
111
|
-
interface CheckboxGroupProps extends VariantProps {
|
|
112
|
-
/** CSS class name. ClassName: string | { buttons?: string | { base?: string; active?: string }; base?: string;} */
|
|
113
|
-
className?: ClassName;
|
|
114
|
-
/** determines orientation of the boxes. */
|
|
115
|
-
inline?: boolean;
|
|
116
|
-
/** label displayed above the Checkboxes */
|
|
117
|
-
label?: React.ReactNode;
|
|
118
|
-
/** Name the Field is registered on the form. */
|
|
119
|
-
name: string;
|
|
120
|
-
/** Checkboxes that should be displayed. */
|
|
121
|
-
options: CheckboxGroupOption[];
|
|
122
|
-
/** sets all buttons disabled */
|
|
123
|
-
disabled?: boolean;
|
|
124
|
-
/** id for internal testing. */
|
|
125
|
-
testId?: string;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* CheckboxGroup component based on [HeroUI CheckboxGroup](https://www.heroui.com//docs/components/checkbox-group)
|
|
129
|
-
*/
|
|
130
|
-
declare const CheckboxGroup: ({ className, inline, label, options, disabled, name, testId: _testId, }: CheckboxGroupProps) => react_jsx_runtime.JSX.Element;
|
|
131
|
-
|
|
132
|
-
export { CheckboxGroup as C, type CheckboxGroupProps as a, type CheckboxGroupOption as b };
|