analytica-frontend-lib 1.0.88 → 1.0.90
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/Accordation/index.d.ts +1 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/AlertDialog/index.d.ts +1 -0
- package/dist/Alternative/index.d.ts +1 -0
- package/dist/Auth/AuthProvider/index.d.ts +1 -0
- package/dist/Auth/ProtectedRoute/index.d.ts +1 -0
- package/dist/Auth/PublicRoute/index.d.ts +1 -0
- package/dist/Auth/getRootDomain/index.d.ts +1 -0
- package/dist/Auth/index.d.ts +1 -0
- package/dist/Auth/useApiConfig/index.d.ts +1 -0
- package/dist/Auth/useAuth/index.d.ts +1 -0
- package/dist/Auth/useAuthGuard/index.d.ts +1 -0
- package/dist/Auth/useRouteAuth/index.d.ts +1 -0
- package/dist/Auth/useUrlAuthentication/index.d.ts +1 -0
- package/dist/Auth/withAuth/index.d.ts +1 -0
- package/dist/Auth/zustandAuthAdapter/index.d.ts +1 -0
- package/dist/Badge/index.d.ts +1 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Calendar/index.d.ts +1 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/CheckBox/CheckboxList/index.d.ts +1 -0
- package/dist/CheckBox/CheckboxList/index.js +429 -0
- package/dist/CheckBox/CheckboxList/index.mjs +415 -0
- package/dist/CheckBox/index.d.ts +1 -0
- package/dist/Chips/index.d.ts +1 -0
- package/dist/Divider/index.d.ts +1 -0
- package/dist/DropdownMenu/index.d.ts +1 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconRoundedButton/index.d.ts +1 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Menu/index.d.ts +1 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/MultipleChoice/index.d.ts +1 -0
- package/dist/NavButton/index.d.ts +1 -0
- package/dist/NotFound/index.d.ts +1 -0
- package/dist/ProgressBar/index.d.ts +1 -0
- package/dist/ProgressCircle/index.d.ts +1 -0
- package/dist/Quiz/index.d.ts +1 -0
- package/dist/Quiz/index.js +2 -2
- package/dist/Quiz/index.mjs +2 -2
- package/dist/Quiz/useQuizStore/index.d.ts +1 -0
- package/dist/Radio/index.d.ts +1 -0
- package/dist/Select/index.d.ts +1 -0
- package/dist/SelectionButton/index.d.ts +1 -0
- package/dist/Skeleton/index.d.ts +1 -0
- package/dist/Stepper/index.d.ts +1 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/Text/index.d.ts +1 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/Toast/ToastStore/index.d.ts +1 -0
- package/dist/Toast/Toaster/index.d.ts +1 -0
- package/dist/Toast/index.d.ts +1 -0
- package/dist/index.css +4 -4
- package/dist/index.d.mts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +6 -2
- package/dist/index.mjs +4 -2
- package/dist/styles.css +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../index';
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/CheckBox/CheckboxList.tsx
|
|
21
|
+
var CheckboxList_exports = {};
|
|
22
|
+
__export(CheckboxList_exports, {
|
|
23
|
+
CheckboxListItem: () => CheckboxListItem,
|
|
24
|
+
default: () => CheckboxList_default,
|
|
25
|
+
useCheckboxListStore: () => useCheckboxListStore
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(CheckboxList_exports);
|
|
28
|
+
var import_react2 = require("react");
|
|
29
|
+
var import_zustand = require("zustand");
|
|
30
|
+
|
|
31
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
|
|
34
|
+
// src/utils/utils.ts
|
|
35
|
+
var import_clsx = require("clsx");
|
|
36
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/components/Text/Text.tsx
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var Text = ({
|
|
44
|
+
children,
|
|
45
|
+
size = "md",
|
|
46
|
+
weight = "normal",
|
|
47
|
+
color = "text-text-950",
|
|
48
|
+
as,
|
|
49
|
+
className = "",
|
|
50
|
+
...props
|
|
51
|
+
}) => {
|
|
52
|
+
let sizeClasses = "";
|
|
53
|
+
let weightClasses = "";
|
|
54
|
+
const sizeClassMap = {
|
|
55
|
+
"2xs": "text-2xs",
|
|
56
|
+
xs: "text-xs",
|
|
57
|
+
sm: "text-sm",
|
|
58
|
+
md: "text-md",
|
|
59
|
+
lg: "text-lg",
|
|
60
|
+
xl: "text-xl",
|
|
61
|
+
"2xl": "text-2xl",
|
|
62
|
+
"3xl": "text-3xl",
|
|
63
|
+
"4xl": "text-4xl",
|
|
64
|
+
"5xl": "text-5xl",
|
|
65
|
+
"6xl": "text-6xl"
|
|
66
|
+
};
|
|
67
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
68
|
+
const weightClassMap = {
|
|
69
|
+
hairline: "font-hairline",
|
|
70
|
+
light: "font-light",
|
|
71
|
+
normal: "font-normal",
|
|
72
|
+
medium: "font-medium",
|
|
73
|
+
semibold: "font-semibold",
|
|
74
|
+
bold: "font-bold",
|
|
75
|
+
extrabold: "font-extrabold",
|
|
76
|
+
black: "font-black"
|
|
77
|
+
};
|
|
78
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
79
|
+
const baseClasses = "font-primary";
|
|
80
|
+
const Component = as ?? "p";
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
+
Component,
|
|
83
|
+
{
|
|
84
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
85
|
+
...props,
|
|
86
|
+
children
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
var Text_default = Text;
|
|
91
|
+
|
|
92
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
93
|
+
var import_phosphor_react = require("phosphor-react");
|
|
94
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
95
|
+
var SIZE_CLASSES = {
|
|
96
|
+
small: {
|
|
97
|
+
checkbox: "w-4 h-4",
|
|
98
|
+
// 16px x 16px
|
|
99
|
+
textSize: "sm",
|
|
100
|
+
spacing: "gap-1.5",
|
|
101
|
+
// 6px
|
|
102
|
+
borderWidth: "border-2",
|
|
103
|
+
iconSize: 14,
|
|
104
|
+
// pixels for Phosphor icons
|
|
105
|
+
labelHeight: "h-[21px]"
|
|
106
|
+
},
|
|
107
|
+
medium: {
|
|
108
|
+
checkbox: "w-5 h-5",
|
|
109
|
+
// 20px x 20px
|
|
110
|
+
textSize: "md",
|
|
111
|
+
spacing: "gap-2",
|
|
112
|
+
// 8px
|
|
113
|
+
borderWidth: "border-2",
|
|
114
|
+
iconSize: 16,
|
|
115
|
+
// pixels for Phosphor icons
|
|
116
|
+
labelHeight: "h-6"
|
|
117
|
+
},
|
|
118
|
+
large: {
|
|
119
|
+
checkbox: "w-6 h-6",
|
|
120
|
+
// 24px x 24px
|
|
121
|
+
textSize: "lg",
|
|
122
|
+
spacing: "gap-2",
|
|
123
|
+
// 8px
|
|
124
|
+
borderWidth: "border-[3px]",
|
|
125
|
+
// 3px border
|
|
126
|
+
iconSize: 20,
|
|
127
|
+
// pixels for Phosphor icons
|
|
128
|
+
labelHeight: "h-[27px]"
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
132
|
+
var STATE_CLASSES = {
|
|
133
|
+
default: {
|
|
134
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
135
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
136
|
+
},
|
|
137
|
+
hovered: {
|
|
138
|
+
unchecked: "border-border-500 bg-background",
|
|
139
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
140
|
+
},
|
|
141
|
+
focused: {
|
|
142
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
143
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
144
|
+
},
|
|
145
|
+
invalid: {
|
|
146
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
147
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
148
|
+
},
|
|
149
|
+
disabled: {
|
|
150
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
151
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var CheckBox = (0, import_react.forwardRef)(
|
|
155
|
+
({
|
|
156
|
+
label,
|
|
157
|
+
size = "medium",
|
|
158
|
+
state = "default",
|
|
159
|
+
indeterminate = false,
|
|
160
|
+
errorMessage,
|
|
161
|
+
helperText,
|
|
162
|
+
className = "",
|
|
163
|
+
labelClassName = "",
|
|
164
|
+
checked: checkedProp,
|
|
165
|
+
disabled,
|
|
166
|
+
id,
|
|
167
|
+
onChange,
|
|
168
|
+
...props
|
|
169
|
+
}, ref) => {
|
|
170
|
+
const generatedId = (0, import_react.useId)();
|
|
171
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
172
|
+
const [internalChecked, setInternalChecked] = (0, import_react.useState)(false);
|
|
173
|
+
const isControlled = checkedProp !== void 0;
|
|
174
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
175
|
+
const handleChange = (event) => {
|
|
176
|
+
if (!isControlled) {
|
|
177
|
+
setInternalChecked(event.target.checked);
|
|
178
|
+
}
|
|
179
|
+
onChange?.(event);
|
|
180
|
+
};
|
|
181
|
+
const currentState = disabled ? "disabled" : state;
|
|
182
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
183
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
184
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
185
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
186
|
+
const checkboxClasses = cn(
|
|
187
|
+
BASE_CHECKBOX_CLASSES,
|
|
188
|
+
sizeClasses.checkbox,
|
|
189
|
+
borderWidthClass,
|
|
190
|
+
stylingClasses,
|
|
191
|
+
className
|
|
192
|
+
);
|
|
193
|
+
const renderIcon = () => {
|
|
194
|
+
if (indeterminate) {
|
|
195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
196
|
+
import_phosphor_react.Minus,
|
|
197
|
+
{
|
|
198
|
+
size: sizeClasses.iconSize,
|
|
199
|
+
weight: "bold",
|
|
200
|
+
color: "currentColor"
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
if (checked) {
|
|
205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
206
|
+
import_phosphor_react.Check,
|
|
207
|
+
{
|
|
208
|
+
size: sizeClasses.iconSize,
|
|
209
|
+
weight: "bold",
|
|
210
|
+
color: "currentColor"
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
};
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col", children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
218
|
+
"div",
|
|
219
|
+
{
|
|
220
|
+
className: cn(
|
|
221
|
+
"flex flex-row items-center",
|
|
222
|
+
sizeClasses.spacing,
|
|
223
|
+
disabled ? "opacity-40" : ""
|
|
224
|
+
),
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
227
|
+
"input",
|
|
228
|
+
{
|
|
229
|
+
ref,
|
|
230
|
+
type: "checkbox",
|
|
231
|
+
id: inputId,
|
|
232
|
+
checked,
|
|
233
|
+
disabled,
|
|
234
|
+
onChange: handleChange,
|
|
235
|
+
className: "sr-only",
|
|
236
|
+
...props
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
240
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
className: cn(
|
|
244
|
+
"flex flex-row items-center",
|
|
245
|
+
sizeClasses.labelHeight
|
|
246
|
+
),
|
|
247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
248
|
+
Text_default,
|
|
249
|
+
{
|
|
250
|
+
as: "label",
|
|
251
|
+
htmlFor: inputId,
|
|
252
|
+
size: sizeClasses.textSize,
|
|
253
|
+
weight: "normal",
|
|
254
|
+
className: cn(
|
|
255
|
+
"cursor-pointer select-none leading-[150%] flex items-center font-roboto",
|
|
256
|
+
labelClassName
|
|
257
|
+
),
|
|
258
|
+
children: label
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
267
|
+
Text_default,
|
|
268
|
+
{
|
|
269
|
+
size: "sm",
|
|
270
|
+
weight: "normal",
|
|
271
|
+
className: "mt-1.5",
|
|
272
|
+
color: "text-error-600",
|
|
273
|
+
children: errorMessage
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
277
|
+
Text_default,
|
|
278
|
+
{
|
|
279
|
+
size: "sm",
|
|
280
|
+
weight: "normal",
|
|
281
|
+
className: "mt-1.5",
|
|
282
|
+
color: "text-text-500",
|
|
283
|
+
children: helperText
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
] });
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
CheckBox.displayName = "CheckBox";
|
|
290
|
+
var CheckBox_default = CheckBox;
|
|
291
|
+
|
|
292
|
+
// src/components/CheckBox/CheckboxList.tsx
|
|
293
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
294
|
+
var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => (0, import_zustand.create)((set, get) => ({
|
|
295
|
+
values: defaultValues,
|
|
296
|
+
setValues: (values) => {
|
|
297
|
+
if (!get().disabled) {
|
|
298
|
+
set({ values });
|
|
299
|
+
get().onValuesChange?.(values);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
toggleValue: (value) => {
|
|
303
|
+
if (!get().disabled) {
|
|
304
|
+
const currentValues = get().values;
|
|
305
|
+
const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
|
|
306
|
+
set({ values: newValues });
|
|
307
|
+
get().onValuesChange?.(newValues);
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
onValuesChange,
|
|
311
|
+
disabled,
|
|
312
|
+
name
|
|
313
|
+
}));
|
|
314
|
+
var useCheckboxListStore = (externalStore) => {
|
|
315
|
+
if (!externalStore) {
|
|
316
|
+
throw new Error("CheckboxListItem must be used within a CheckboxList");
|
|
317
|
+
}
|
|
318
|
+
return externalStore;
|
|
319
|
+
};
|
|
320
|
+
var injectStore = (children, store) => import_react2.Children.map(children, (child) => {
|
|
321
|
+
if (!(0, import_react2.isValidElement)(child)) return child;
|
|
322
|
+
const typedChild = child;
|
|
323
|
+
const shouldInject = typedChild.type === CheckboxListItem;
|
|
324
|
+
return (0, import_react2.cloneElement)(typedChild, {
|
|
325
|
+
...shouldInject ? { store } : {},
|
|
326
|
+
...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
var CheckboxList = (0, import_react2.forwardRef)(
|
|
330
|
+
({
|
|
331
|
+
values: propValues,
|
|
332
|
+
defaultValues = [],
|
|
333
|
+
onValuesChange,
|
|
334
|
+
name: propName,
|
|
335
|
+
disabled = false,
|
|
336
|
+
className = "",
|
|
337
|
+
children,
|
|
338
|
+
...props
|
|
339
|
+
}, ref) => {
|
|
340
|
+
const generatedId = (0, import_react2.useId)();
|
|
341
|
+
const name = propName || `checkbox-list-${generatedId}`;
|
|
342
|
+
const storeRef = (0, import_react2.useRef)(null);
|
|
343
|
+
storeRef.current ??= createCheckboxListStore(
|
|
344
|
+
name,
|
|
345
|
+
defaultValues,
|
|
346
|
+
disabled,
|
|
347
|
+
onValuesChange
|
|
348
|
+
);
|
|
349
|
+
const store = storeRef.current;
|
|
350
|
+
const { setValues } = (0, import_zustand.useStore)(store, (s) => s);
|
|
351
|
+
(0, import_react2.useEffect)(() => {
|
|
352
|
+
const currentValues = store.getState().values;
|
|
353
|
+
if (currentValues.length > 0 && onValuesChange) {
|
|
354
|
+
onValuesChange(currentValues);
|
|
355
|
+
}
|
|
356
|
+
}, []);
|
|
357
|
+
(0, import_react2.useEffect)(() => {
|
|
358
|
+
if (propValues !== void 0) {
|
|
359
|
+
setValues(propValues);
|
|
360
|
+
}
|
|
361
|
+
}, [propValues, setValues]);
|
|
362
|
+
(0, import_react2.useEffect)(() => {
|
|
363
|
+
store.setState({ disabled });
|
|
364
|
+
}, [disabled, store]);
|
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
ref,
|
|
369
|
+
className: cn("flex flex-col gap-2 w-full", className),
|
|
370
|
+
"aria-label": name,
|
|
371
|
+
...props,
|
|
372
|
+
children: injectStore(children, store)
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
CheckboxList.displayName = "CheckboxList";
|
|
378
|
+
var CheckboxListItem = (0, import_react2.forwardRef)(
|
|
379
|
+
({
|
|
380
|
+
value,
|
|
381
|
+
store: externalStore,
|
|
382
|
+
disabled: itemDisabled,
|
|
383
|
+
size = "medium",
|
|
384
|
+
state = "default",
|
|
385
|
+
className = "",
|
|
386
|
+
id,
|
|
387
|
+
...props
|
|
388
|
+
}, ref) => {
|
|
389
|
+
const store = useCheckboxListStore(externalStore);
|
|
390
|
+
const {
|
|
391
|
+
values: groupValues,
|
|
392
|
+
toggleValue,
|
|
393
|
+
disabled: groupDisabled,
|
|
394
|
+
name
|
|
395
|
+
} = (0, import_zustand.useStore)(store);
|
|
396
|
+
const generatedId = (0, import_react2.useId)();
|
|
397
|
+
const inputId = id ?? `checkbox-item-${generatedId}`;
|
|
398
|
+
const isChecked = groupValues.includes(value);
|
|
399
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
400
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
402
|
+
CheckBox_default,
|
|
403
|
+
{
|
|
404
|
+
ref,
|
|
405
|
+
id: inputId,
|
|
406
|
+
name,
|
|
407
|
+
value,
|
|
408
|
+
checked: isChecked,
|
|
409
|
+
disabled: isDisabled,
|
|
410
|
+
size,
|
|
411
|
+
state: currentState,
|
|
412
|
+
className,
|
|
413
|
+
onChange: () => {
|
|
414
|
+
if (!isDisabled) {
|
|
415
|
+
toggleValue(value);
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
...props
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
CheckboxListItem.displayName = "CheckboxListItem";
|
|
424
|
+
var CheckboxList_default = CheckboxList;
|
|
425
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
426
|
+
0 && (module.exports = {
|
|
427
|
+
CheckboxListItem,
|
|
428
|
+
useCheckboxListStore
|
|
429
|
+
});
|