analytica-frontend-lib 1.0.88 → 1.0.89

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.
@@ -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
+ });
@@ -0,0 +1,415 @@
1
+ // src/components/CheckBox/CheckboxList.tsx
2
+ import {
3
+ forwardRef as forwardRef2,
4
+ useId as useId2,
5
+ useEffect,
6
+ useRef,
7
+ Children,
8
+ cloneElement,
9
+ isValidElement
10
+ } from "react";
11
+ import { create, useStore } from "zustand";
12
+
13
+ // src/components/CheckBox/CheckBox.tsx
14
+ import {
15
+ forwardRef,
16
+ useState,
17
+ useId
18
+ } from "react";
19
+
20
+ // src/utils/utils.ts
21
+ import { clsx } from "clsx";
22
+ import { twMerge } from "tailwind-merge";
23
+ function cn(...inputs) {
24
+ return twMerge(clsx(inputs));
25
+ }
26
+
27
+ // src/components/Text/Text.tsx
28
+ import { jsx } from "react/jsx-runtime";
29
+ var Text = ({
30
+ children,
31
+ size = "md",
32
+ weight = "normal",
33
+ color = "text-text-950",
34
+ as,
35
+ className = "",
36
+ ...props
37
+ }) => {
38
+ let sizeClasses = "";
39
+ let weightClasses = "";
40
+ const sizeClassMap = {
41
+ "2xs": "text-2xs",
42
+ xs: "text-xs",
43
+ sm: "text-sm",
44
+ md: "text-md",
45
+ lg: "text-lg",
46
+ xl: "text-xl",
47
+ "2xl": "text-2xl",
48
+ "3xl": "text-3xl",
49
+ "4xl": "text-4xl",
50
+ "5xl": "text-5xl",
51
+ "6xl": "text-6xl"
52
+ };
53
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
54
+ const weightClassMap = {
55
+ hairline: "font-hairline",
56
+ light: "font-light",
57
+ normal: "font-normal",
58
+ medium: "font-medium",
59
+ semibold: "font-semibold",
60
+ bold: "font-bold",
61
+ extrabold: "font-extrabold",
62
+ black: "font-black"
63
+ };
64
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
65
+ const baseClasses = "font-primary";
66
+ const Component = as ?? "p";
67
+ return /* @__PURE__ */ jsx(
68
+ Component,
69
+ {
70
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
71
+ ...props,
72
+ children
73
+ }
74
+ );
75
+ };
76
+ var Text_default = Text;
77
+
78
+ // src/components/CheckBox/CheckBox.tsx
79
+ import { Check, Minus } from "phosphor-react";
80
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
81
+ var SIZE_CLASSES = {
82
+ small: {
83
+ checkbox: "w-4 h-4",
84
+ // 16px x 16px
85
+ textSize: "sm",
86
+ spacing: "gap-1.5",
87
+ // 6px
88
+ borderWidth: "border-2",
89
+ iconSize: 14,
90
+ // pixels for Phosphor icons
91
+ labelHeight: "h-[21px]"
92
+ },
93
+ medium: {
94
+ checkbox: "w-5 h-5",
95
+ // 20px x 20px
96
+ textSize: "md",
97
+ spacing: "gap-2",
98
+ // 8px
99
+ borderWidth: "border-2",
100
+ iconSize: 16,
101
+ // pixels for Phosphor icons
102
+ labelHeight: "h-6"
103
+ },
104
+ large: {
105
+ checkbox: "w-6 h-6",
106
+ // 24px x 24px
107
+ textSize: "lg",
108
+ spacing: "gap-2",
109
+ // 8px
110
+ borderWidth: "border-[3px]",
111
+ // 3px border
112
+ iconSize: 20,
113
+ // pixels for Phosphor icons
114
+ labelHeight: "h-[27px]"
115
+ }
116
+ };
117
+ var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
118
+ var STATE_CLASSES = {
119
+ default: {
120
+ unchecked: "border-border-400 bg-background hover:border-border-500",
121
+ checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
122
+ },
123
+ hovered: {
124
+ unchecked: "border-border-500 bg-background",
125
+ checked: "border-primary-800 bg-primary-800 text-text"
126
+ },
127
+ focused: {
128
+ unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
129
+ checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
130
+ },
131
+ invalid: {
132
+ unchecked: "border-error-700 bg-background hover:border-error-600",
133
+ checked: "border-error-700 bg-primary-950 text-text"
134
+ },
135
+ disabled: {
136
+ unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
137
+ checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
138
+ }
139
+ };
140
+ var CheckBox = forwardRef(
141
+ ({
142
+ label,
143
+ size = "medium",
144
+ state = "default",
145
+ indeterminate = false,
146
+ errorMessage,
147
+ helperText,
148
+ className = "",
149
+ labelClassName = "",
150
+ checked: checkedProp,
151
+ disabled,
152
+ id,
153
+ onChange,
154
+ ...props
155
+ }, ref) => {
156
+ const generatedId = useId();
157
+ const inputId = id ?? `checkbox-${generatedId}`;
158
+ const [internalChecked, setInternalChecked] = useState(false);
159
+ const isControlled = checkedProp !== void 0;
160
+ const checked = isControlled ? checkedProp : internalChecked;
161
+ const handleChange = (event) => {
162
+ if (!isControlled) {
163
+ setInternalChecked(event.target.checked);
164
+ }
165
+ onChange?.(event);
166
+ };
167
+ const currentState = disabled ? "disabled" : state;
168
+ const sizeClasses = SIZE_CLASSES[size];
169
+ const checkVariant = checked || indeterminate ? "checked" : "unchecked";
170
+ const stylingClasses = STATE_CLASSES[currentState][checkVariant];
171
+ const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
172
+ const checkboxClasses = cn(
173
+ BASE_CHECKBOX_CLASSES,
174
+ sizeClasses.checkbox,
175
+ borderWidthClass,
176
+ stylingClasses,
177
+ className
178
+ );
179
+ const renderIcon = () => {
180
+ if (indeterminate) {
181
+ return /* @__PURE__ */ jsx2(
182
+ Minus,
183
+ {
184
+ size: sizeClasses.iconSize,
185
+ weight: "bold",
186
+ color: "currentColor"
187
+ }
188
+ );
189
+ }
190
+ if (checked) {
191
+ return /* @__PURE__ */ jsx2(
192
+ Check,
193
+ {
194
+ size: sizeClasses.iconSize,
195
+ weight: "bold",
196
+ color: "currentColor"
197
+ }
198
+ );
199
+ }
200
+ return null;
201
+ };
202
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
203
+ /* @__PURE__ */ jsxs(
204
+ "div",
205
+ {
206
+ className: cn(
207
+ "flex flex-row items-center",
208
+ sizeClasses.spacing,
209
+ disabled ? "opacity-40" : ""
210
+ ),
211
+ children: [
212
+ /* @__PURE__ */ jsx2(
213
+ "input",
214
+ {
215
+ ref,
216
+ type: "checkbox",
217
+ id: inputId,
218
+ checked,
219
+ disabled,
220
+ onChange: handleChange,
221
+ className: "sr-only",
222
+ ...props
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx2("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
226
+ label && /* @__PURE__ */ jsx2(
227
+ "div",
228
+ {
229
+ className: cn(
230
+ "flex flex-row items-center",
231
+ sizeClasses.labelHeight
232
+ ),
233
+ children: /* @__PURE__ */ jsx2(
234
+ Text_default,
235
+ {
236
+ as: "label",
237
+ htmlFor: inputId,
238
+ size: sizeClasses.textSize,
239
+ weight: "normal",
240
+ className: cn(
241
+ "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
242
+ labelClassName
243
+ ),
244
+ children: label
245
+ }
246
+ )
247
+ }
248
+ )
249
+ ]
250
+ }
251
+ ),
252
+ errorMessage && /* @__PURE__ */ jsx2(
253
+ Text_default,
254
+ {
255
+ size: "sm",
256
+ weight: "normal",
257
+ className: "mt-1.5",
258
+ color: "text-error-600",
259
+ children: errorMessage
260
+ }
261
+ ),
262
+ helperText && !errorMessage && /* @__PURE__ */ jsx2(
263
+ Text_default,
264
+ {
265
+ size: "sm",
266
+ weight: "normal",
267
+ className: "mt-1.5",
268
+ color: "text-text-500",
269
+ children: helperText
270
+ }
271
+ )
272
+ ] });
273
+ }
274
+ );
275
+ CheckBox.displayName = "CheckBox";
276
+ var CheckBox_default = CheckBox;
277
+
278
+ // src/components/CheckBox/CheckboxList.tsx
279
+ import { jsx as jsx3 } from "react/jsx-runtime";
280
+ var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => create((set, get) => ({
281
+ values: defaultValues,
282
+ setValues: (values) => {
283
+ if (!get().disabled) {
284
+ set({ values });
285
+ get().onValuesChange?.(values);
286
+ }
287
+ },
288
+ toggleValue: (value) => {
289
+ if (!get().disabled) {
290
+ const currentValues = get().values;
291
+ const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
292
+ set({ values: newValues });
293
+ get().onValuesChange?.(newValues);
294
+ }
295
+ },
296
+ onValuesChange,
297
+ disabled,
298
+ name
299
+ }));
300
+ var useCheckboxListStore = (externalStore) => {
301
+ if (!externalStore) {
302
+ throw new Error("CheckboxListItem must be used within a CheckboxList");
303
+ }
304
+ return externalStore;
305
+ };
306
+ var injectStore = (children, store) => Children.map(children, (child) => {
307
+ if (!isValidElement(child)) return child;
308
+ const typedChild = child;
309
+ const shouldInject = typedChild.type === CheckboxListItem;
310
+ return cloneElement(typedChild, {
311
+ ...shouldInject ? { store } : {},
312
+ ...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
313
+ });
314
+ });
315
+ var CheckboxList = forwardRef2(
316
+ ({
317
+ values: propValues,
318
+ defaultValues = [],
319
+ onValuesChange,
320
+ name: propName,
321
+ disabled = false,
322
+ className = "",
323
+ children,
324
+ ...props
325
+ }, ref) => {
326
+ const generatedId = useId2();
327
+ const name = propName || `checkbox-list-${generatedId}`;
328
+ const storeRef = useRef(null);
329
+ storeRef.current ??= createCheckboxListStore(
330
+ name,
331
+ defaultValues,
332
+ disabled,
333
+ onValuesChange
334
+ );
335
+ const store = storeRef.current;
336
+ const { setValues } = useStore(store, (s) => s);
337
+ useEffect(() => {
338
+ const currentValues = store.getState().values;
339
+ if (currentValues.length > 0 && onValuesChange) {
340
+ onValuesChange(currentValues);
341
+ }
342
+ }, []);
343
+ useEffect(() => {
344
+ if (propValues !== void 0) {
345
+ setValues(propValues);
346
+ }
347
+ }, [propValues, setValues]);
348
+ useEffect(() => {
349
+ store.setState({ disabled });
350
+ }, [disabled, store]);
351
+ return /* @__PURE__ */ jsx3(
352
+ "div",
353
+ {
354
+ ref,
355
+ className: cn("flex flex-col gap-2 w-full", className),
356
+ "aria-label": name,
357
+ ...props,
358
+ children: injectStore(children, store)
359
+ }
360
+ );
361
+ }
362
+ );
363
+ CheckboxList.displayName = "CheckboxList";
364
+ var CheckboxListItem = forwardRef2(
365
+ ({
366
+ value,
367
+ store: externalStore,
368
+ disabled: itemDisabled,
369
+ size = "medium",
370
+ state = "default",
371
+ className = "",
372
+ id,
373
+ ...props
374
+ }, ref) => {
375
+ const store = useCheckboxListStore(externalStore);
376
+ const {
377
+ values: groupValues,
378
+ toggleValue,
379
+ disabled: groupDisabled,
380
+ name
381
+ } = useStore(store);
382
+ const generatedId = useId2();
383
+ const inputId = id ?? `checkbox-item-${generatedId}`;
384
+ const isChecked = groupValues.includes(value);
385
+ const isDisabled = groupDisabled || itemDisabled;
386
+ const currentState = isDisabled ? "disabled" : state;
387
+ return /* @__PURE__ */ jsx3(
388
+ CheckBox_default,
389
+ {
390
+ ref,
391
+ id: inputId,
392
+ name,
393
+ value,
394
+ checked: isChecked,
395
+ disabled: isDisabled,
396
+ size,
397
+ state: currentState,
398
+ className,
399
+ onChange: () => {
400
+ if (!isDisabled) {
401
+ toggleValue(value);
402
+ }
403
+ },
404
+ ...props
405
+ }
406
+ );
407
+ }
408
+ );
409
+ CheckboxListItem.displayName = "CheckboxListItem";
410
+ var CheckboxList_default = CheckboxList;
411
+ export {
412
+ CheckboxListItem,
413
+ CheckboxList_default as default,
414
+ useCheckboxListStore
415
+ };
@@ -4757,7 +4757,7 @@ var QuizFooter = (0, import_react11.forwardRef)(
4757
4757
  onClose: () => setModalNavigateOpen(false),
4758
4758
  title: "Quest\xF5es",
4759
4759
  size: "lg",
4760
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
4760
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col w-full h-full not-lg:max-h-[calc(100vh-200px)] lg:max-h-[calc(687px-76px)]", children: [
4761
4761
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
4762
4762
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
4763
4763
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
@@ -4769,7 +4769,7 @@ var QuizFooter = (0, import_react11.forwardRef)(
4769
4769
  ] })
4770
4770
  ] }) })
4771
4771
  ] }),
4772
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4772
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-2 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4773
4773
  QuizQuestionList,
4774
4774
  {
4775
4775
  filterType,
@@ -4782,7 +4782,7 @@ var QuizFooter = forwardRef9(
4782
4782
  onClose: () => setModalNavigateOpen(false),
4783
4783
  title: "Quest\xF5es",
4784
4784
  size: "lg",
4785
- children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col w-full h-full", children: [
4785
+ children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col w-full h-full not-lg:max-h-[calc(100vh-200px)] lg:max-h-[calc(687px-76px)]", children: [
4786
4786
  /* @__PURE__ */ jsxs13("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
4787
4787
  /* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
4788
4788
  /* @__PURE__ */ jsx16("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs13(Select_default, { value: filterType, onValueChange: setFilterType, children: [
@@ -4794,7 +4794,7 @@ var QuizFooter = forwardRef9(
4794
4794
  ] })
4795
4795
  ] }) })
4796
4796
  ] }),
4797
- /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx16(
4797
+ /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2 overflow-y-auto", children: /* @__PURE__ */ jsx16(
4798
4798
  QuizQuestionList,
4799
4799
  {
4800
4800
  filterType,
package/dist/index.css CHANGED
@@ -3460,9 +3460,9 @@
3460
3460
  border-radius: var(--radius-xl);
3461
3461
  }
3462
3462
  }
3463
- .not-lg\:h-\[calc\(100vh-200px\)\] {
3463
+ .not-lg\:max-h-\[calc\(100vh-200px\)\] {
3464
3464
  @media not (width >= 64rem) {
3465
- height: calc(100vh - 200px);
3465
+ max-height: calc(100vh - 200px);
3466
3466
  }
3467
3467
  }
3468
3468
  .not-lg\:max-w-\[calc\(100vw-32px\)\] {
@@ -8039,9 +8039,9 @@
8039
8039
  height: calc(var(--spacing) * 6);
8040
8040
  }
8041
8041
  }
8042
- .lg\:max-h-\[687px\] {
8042
+ .lg\:max-h-\[calc\(687px-76px\)\] {
8043
8043
  @media (width >= 64rem) {
8044
- max-height: 687px;
8044
+ max-height: calc(687px - 76px);
8045
8045
  }
8046
8046
  }
8047
8047
  .lg\:w-3\.5 {
package/dist/index.js CHANGED
@@ -7689,7 +7689,7 @@ var QuizFooter = (0, import_react24.forwardRef)(
7689
7689
  onClose: () => setModalNavigateOpen(false),
7690
7690
  title: "Quest\xF5es",
7691
7691
  size: "lg",
7692
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
7692
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col w-full h-full not-lg:max-h-[calc(100vh-200px)] lg:max-h-[calc(687px-76px)]", children: [
7693
7693
  /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
7694
7694
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
7695
7695
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
@@ -7701,7 +7701,7 @@ var QuizFooter = (0, import_react24.forwardRef)(
7701
7701
  ] })
7702
7702
  ] }) })
7703
7703
  ] }),
7704
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7704
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col gap-2 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7705
7705
  QuizQuestionList,
7706
7706
  {
7707
7707
  filterType,
package/dist/index.mjs CHANGED
@@ -7673,7 +7673,7 @@ var QuizFooter = forwardRef18(
7673
7673
  onClose: () => setModalNavigateOpen(false),
7674
7674
  title: "Quest\xF5es",
7675
7675
  size: "lg",
7676
- children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col w-full h-full", children: [
7676
+ children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col w-full h-full not-lg:max-h-[calc(100vh-200px)] lg:max-h-[calc(687px-76px)]", children: [
7677
7677
  /* @__PURE__ */ jsxs28("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
7678
7678
  /* @__PURE__ */ jsx35("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
7679
7679
  /* @__PURE__ */ jsx35("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs28(Select_default, { value: filterType, onValueChange: setFilterType, children: [
@@ -7685,7 +7685,7 @@ var QuizFooter = forwardRef18(
7685
7685
  ] })
7686
7686
  ] }) })
7687
7687
  ] }),
7688
- /* @__PURE__ */ jsx35("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx35(
7688
+ /* @__PURE__ */ jsx35("div", { className: "flex flex-col gap-2 overflow-y-auto", children: /* @__PURE__ */ jsx35(
7689
7689
  QuizQuestionList,
7690
7690
  {
7691
7691
  filterType,
package/dist/styles.css CHANGED
@@ -3460,9 +3460,9 @@
3460
3460
  border-radius: var(--radius-xl);
3461
3461
  }
3462
3462
  }
3463
- .not-lg\:h-\[calc\(100vh-200px\)\] {
3463
+ .not-lg\:max-h-\[calc\(100vh-200px\)\] {
3464
3464
  @media not (width >= 64rem) {
3465
- height: calc(100vh - 200px);
3465
+ max-height: calc(100vh - 200px);
3466
3466
  }
3467
3467
  }
3468
3468
  .not-lg\:max-w-\[calc\(100vw-32px\)\] {
@@ -8039,9 +8039,9 @@
8039
8039
  height: calc(var(--spacing) * 6);
8040
8040
  }
8041
8041
  }
8042
- .lg\:max-h-\[687px\] {
8042
+ .lg\:max-h-\[calc\(687px-76px\)\] {
8043
8043
  @media (width >= 64rem) {
8044
- max-height: 687px;
8044
+ max-height: calc(687px - 76px);
8045
8045
  }
8046
8046
  }
8047
8047
  .lg\:w-3\.5 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica-frontend-lib",
3
- "version": "1.0.88",
3
+ "version": "1.0.89",
4
4
  "description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "./dist/index.js",