analytica-frontend-lib 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +177 -0
- package/dist/index.d.mts +145 -2
- package/dist/index.d.ts +145 -2
- package/dist/index.js +262 -39
- package/dist/index.mjs +258 -33
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef, HTMLAttributes, TdHTMLAttributes } from 'react';
|
|
3
|
+
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef, InputHTMLAttributes, HTMLAttributes, TdHTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Button component props interface
|
|
@@ -184,6 +184,76 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
|
|
|
184
184
|
*/
|
|
185
185
|
declare const Text: <T extends ElementType = "p">({ children, size, weight, color, as, className, ...props }: TextProps<T>) => react_jsx_runtime.JSX.Element;
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* CheckBox size variants
|
|
189
|
+
*/
|
|
190
|
+
type CheckBoxSize = 'small' | 'medium' | 'large';
|
|
191
|
+
/**
|
|
192
|
+
* CheckBox visual state
|
|
193
|
+
*/
|
|
194
|
+
type CheckBoxState = 'default' | 'hovered' | 'focused' | 'invalid' | 'disabled';
|
|
195
|
+
/**
|
|
196
|
+
* CheckBox component props interface
|
|
197
|
+
*/
|
|
198
|
+
type CheckBoxProps = {
|
|
199
|
+
/** Label text to display next to the checkbox */
|
|
200
|
+
label?: ReactNode;
|
|
201
|
+
/** Size variant of the checkbox */
|
|
202
|
+
size?: CheckBoxSize;
|
|
203
|
+
/** Visual state of the checkbox */
|
|
204
|
+
state?: CheckBoxState;
|
|
205
|
+
/** Indeterminate state for partial selections */
|
|
206
|
+
indeterminate?: boolean;
|
|
207
|
+
/** Error message to display */
|
|
208
|
+
errorMessage?: string;
|
|
209
|
+
/** Helper text to display */
|
|
210
|
+
helperText?: string;
|
|
211
|
+
/** Additional CSS classes */
|
|
212
|
+
className?: string;
|
|
213
|
+
/** Label CSS classes */
|
|
214
|
+
labelClassName?: string;
|
|
215
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>;
|
|
216
|
+
/**
|
|
217
|
+
* CheckBox component for Analytica Ensino platforms
|
|
218
|
+
*
|
|
219
|
+
* A checkbox component with essential states, sizes and themes.
|
|
220
|
+
* Uses the Analytica Ensino Design System colors from styles.css with automatic
|
|
221
|
+
* light/dark mode support. Includes Text component integration for consistent typography.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```tsx
|
|
225
|
+
* // Basic checkbox
|
|
226
|
+
* <CheckBox label="Option" />
|
|
227
|
+
*
|
|
228
|
+
* // Small size
|
|
229
|
+
* <CheckBox size="small" label="Small option" />
|
|
230
|
+
*
|
|
231
|
+
* // Invalid state
|
|
232
|
+
* <CheckBox state="invalid" label="Required field" />
|
|
233
|
+
*
|
|
234
|
+
* // Disabled state
|
|
235
|
+
* <CheckBox disabled label="Disabled option" />
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
declare const CheckBox: react.ForwardRefExoticComponent<{
|
|
239
|
+
/** Label text to display next to the checkbox */
|
|
240
|
+
label?: ReactNode;
|
|
241
|
+
/** Size variant of the checkbox */
|
|
242
|
+
size?: CheckBoxSize;
|
|
243
|
+
/** Visual state of the checkbox */
|
|
244
|
+
state?: CheckBoxState;
|
|
245
|
+
/** Indeterminate state for partial selections */
|
|
246
|
+
indeterminate?: boolean;
|
|
247
|
+
/** Error message to display */
|
|
248
|
+
errorMessage?: string;
|
|
249
|
+
/** Helper text to display */
|
|
250
|
+
helperText?: string;
|
|
251
|
+
/** Additional CSS classes */
|
|
252
|
+
className?: string;
|
|
253
|
+
/** Label CSS classes */
|
|
254
|
+
labelClassName?: string;
|
|
255
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & react.RefAttributes<HTMLInputElement>>;
|
|
256
|
+
|
|
187
257
|
type TableRowState = 'default' | 'selected' | 'invalid' | 'disabled';
|
|
188
258
|
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
189
259
|
state?: TableRowState;
|
|
@@ -275,4 +345,77 @@ declare const NavButton: react.ForwardRefExoticComponent<{
|
|
|
275
345
|
className?: string;
|
|
276
346
|
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
277
347
|
|
|
278
|
-
|
|
348
|
+
/**
|
|
349
|
+
* IconButton component props interface
|
|
350
|
+
*/
|
|
351
|
+
type IconButtonProps = {
|
|
352
|
+
/** Ícone a ser exibido no botão */
|
|
353
|
+
icon: ReactNode;
|
|
354
|
+
/** Tamanho do botão */
|
|
355
|
+
size?: 'sm' | 'md';
|
|
356
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
357
|
+
active?: boolean;
|
|
358
|
+
/** Additional CSS classes to apply */
|
|
359
|
+
className?: string;
|
|
360
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
361
|
+
/**
|
|
362
|
+
* IconButton component for Analytica Ensino platforms
|
|
363
|
+
*
|
|
364
|
+
* Um botão compacto apenas com ícone, ideal para menus dropdown,
|
|
365
|
+
* barras de ferramentas e ações secundárias.
|
|
366
|
+
* Oferece dois tamanhos com estilo consistente.
|
|
367
|
+
* Estado ativo permanece até ser clicado novamente ou outro botão ser ativado.
|
|
368
|
+
* Compatível com Next.js 15 e React 19.
|
|
369
|
+
* Suporta forwardRef para acesso programático ao elemento DOM.
|
|
370
|
+
*
|
|
371
|
+
* @param icon - O ícone a ser exibido no botão
|
|
372
|
+
* @param size - Tamanho do botão (sm, md)
|
|
373
|
+
* @param active - Estado ativo/selecionado do botão
|
|
374
|
+
* @param className - Classes CSS adicionais
|
|
375
|
+
* @param props - Todos os outros atributos HTML padrão de button
|
|
376
|
+
* @returns Um elemento button compacto estilizado apenas com ícone
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```tsx
|
|
380
|
+
* <IconButton
|
|
381
|
+
* icon={<MoreVerticalIcon />}
|
|
382
|
+
* size="sm"
|
|
383
|
+
* onClick={() => openMenu()}
|
|
384
|
+
* />
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```tsx
|
|
389
|
+
* // Botão ativo em uma barra de ferramentas - permanece ativo até outro clique
|
|
390
|
+
* <IconButton
|
|
391
|
+
* icon={<BoldIcon />}
|
|
392
|
+
* active={isBold}
|
|
393
|
+
* onClick={toggleBold}
|
|
394
|
+
* />
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```tsx
|
|
399
|
+
* // Usando ref para controle programático
|
|
400
|
+
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
401
|
+
*
|
|
402
|
+
* <IconButton
|
|
403
|
+
* ref={buttonRef}
|
|
404
|
+
* icon={<EditIcon />}
|
|
405
|
+
* size="md"
|
|
406
|
+
* onClick={() => startEditing()}
|
|
407
|
+
* />
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
declare const IconButton: react.ForwardRefExoticComponent<{
|
|
411
|
+
/** Ícone a ser exibido no botão */
|
|
412
|
+
icon: ReactNode;
|
|
413
|
+
/** Tamanho do botão */
|
|
414
|
+
size?: "sm" | "md";
|
|
415
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
416
|
+
active?: boolean;
|
|
417
|
+
/** Additional CSS classes to apply */
|
|
418
|
+
className?: string;
|
|
419
|
+
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
420
|
+
|
|
421
|
+
export { Button, CheckBox, type CheckBoxProps, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text };
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Button: () => Button,
|
|
24
|
+
CheckBox: () => CheckBox,
|
|
24
25
|
DropdownMenu: () => DropdownMenu,
|
|
25
26
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
27
|
+
IconButton: () => IconButton,
|
|
26
28
|
IconRoundedButton: () => IconRoundedButton,
|
|
27
29
|
MenuContent: () => MenuContent,
|
|
28
30
|
MenuItem: () => MenuItem,
|
|
@@ -250,25 +252,192 @@ var Text = ({
|
|
|
250
252
|
);
|
|
251
253
|
};
|
|
252
254
|
|
|
253
|
-
// src/components/
|
|
255
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
254
256
|
var import_react2 = require("react");
|
|
257
|
+
var import_phosphor_react = require("phosphor-react");
|
|
255
258
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
256
|
-
var
|
|
257
|
-
|
|
259
|
+
var SIZE_CLASSES2 = {
|
|
260
|
+
small: {
|
|
261
|
+
checkbox: "w-4 h-4",
|
|
262
|
+
// 16px x 16px
|
|
263
|
+
textSize: "sm",
|
|
264
|
+
spacing: "gap-1.5",
|
|
265
|
+
// 6px
|
|
266
|
+
borderWidth: "border-2",
|
|
267
|
+
iconSize: 14,
|
|
268
|
+
// pixels for Phosphor icons
|
|
269
|
+
labelHeight: "h-[21px]"
|
|
270
|
+
},
|
|
271
|
+
medium: {
|
|
272
|
+
checkbox: "w-5 h-5",
|
|
273
|
+
// 20px x 20px
|
|
274
|
+
textSize: "md",
|
|
275
|
+
spacing: "gap-2",
|
|
276
|
+
// 8px
|
|
277
|
+
borderWidth: "border-2",
|
|
278
|
+
iconSize: 16,
|
|
279
|
+
// pixels for Phosphor icons
|
|
280
|
+
labelHeight: "h-6"
|
|
281
|
+
},
|
|
282
|
+
large: {
|
|
283
|
+
checkbox: "w-6 h-6",
|
|
284
|
+
// 24px x 24px
|
|
285
|
+
textSize: "lg",
|
|
286
|
+
spacing: "gap-2",
|
|
287
|
+
// 8px
|
|
288
|
+
borderWidth: "border-[3px]",
|
|
289
|
+
// 3px border
|
|
290
|
+
iconSize: 20,
|
|
291
|
+
// pixels for Phosphor icons
|
|
292
|
+
labelHeight: "h-[27px]"
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
296
|
+
var STATE_CLASSES = {
|
|
297
|
+
default: {
|
|
298
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
299
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
300
|
+
},
|
|
301
|
+
hovered: {
|
|
302
|
+
unchecked: "border-border-500 bg-background",
|
|
303
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
304
|
+
},
|
|
305
|
+
focused: {
|
|
306
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
307
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
308
|
+
},
|
|
309
|
+
invalid: {
|
|
310
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
311
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
312
|
+
},
|
|
313
|
+
disabled: {
|
|
314
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
315
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
var CheckBox = (0, import_react2.forwardRef)(
|
|
319
|
+
({
|
|
320
|
+
label,
|
|
321
|
+
size = "medium",
|
|
322
|
+
state = "default",
|
|
323
|
+
indeterminate = false,
|
|
324
|
+
errorMessage,
|
|
325
|
+
helperText,
|
|
326
|
+
className = "",
|
|
327
|
+
labelClassName = "",
|
|
328
|
+
checked: checkedProp,
|
|
329
|
+
disabled,
|
|
330
|
+
id,
|
|
331
|
+
onChange,
|
|
332
|
+
...props
|
|
333
|
+
}, ref) => {
|
|
334
|
+
const generatedId = (0, import_react2.useId)();
|
|
335
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
336
|
+
const [internalChecked, setInternalChecked] = (0, import_react2.useState)(false);
|
|
337
|
+
const isControlled = checkedProp !== void 0;
|
|
338
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
339
|
+
const handleChange = (event) => {
|
|
340
|
+
if (!isControlled) {
|
|
341
|
+
setInternalChecked(event.target.checked);
|
|
342
|
+
}
|
|
343
|
+
onChange?.(event);
|
|
344
|
+
};
|
|
345
|
+
const currentState = disabled ? "disabled" : state;
|
|
346
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
347
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
348
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
349
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
350
|
+
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
351
|
+
const renderIcon = () => {
|
|
352
|
+
if (indeterminate) {
|
|
353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
354
|
+
import_phosphor_react.Minus,
|
|
355
|
+
{
|
|
356
|
+
size: sizeClasses.iconSize,
|
|
357
|
+
weight: "bold",
|
|
358
|
+
color: "currentColor"
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
if (checked) {
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
364
|
+
import_phosphor_react.Check,
|
|
365
|
+
{
|
|
366
|
+
size: sizeClasses.iconSize,
|
|
367
|
+
weight: "bold",
|
|
368
|
+
color: "currentColor"
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
};
|
|
374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col", children: [
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
381
|
+
"input",
|
|
382
|
+
{
|
|
383
|
+
ref,
|
|
384
|
+
type: "checkbox",
|
|
385
|
+
id: inputId,
|
|
386
|
+
checked,
|
|
387
|
+
disabled,
|
|
388
|
+
onChange: handleChange,
|
|
389
|
+
className: "sr-only",
|
|
390
|
+
...props
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
394
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
395
|
+
"div",
|
|
396
|
+
{
|
|
397
|
+
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
399
|
+
Text,
|
|
400
|
+
{
|
|
401
|
+
as: "label",
|
|
402
|
+
htmlFor: inputId,
|
|
403
|
+
size: sizeClasses.textSize,
|
|
404
|
+
weight: "normal",
|
|
405
|
+
color: "black",
|
|
406
|
+
className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
|
|
407
|
+
children: label
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
416
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
|
|
417
|
+
] });
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
CheckBox.displayName = "CheckBox";
|
|
421
|
+
|
|
422
|
+
// src/components/Table/Table.tsx
|
|
423
|
+
var import_react3 = require("react");
|
|
424
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
425
|
+
var Table = (0, import_react3.forwardRef)(
|
|
426
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
258
427
|
"table",
|
|
259
428
|
{
|
|
260
429
|
ref,
|
|
261
430
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
262
431
|
...props,
|
|
263
432
|
children: [
|
|
264
|
-
/* @__PURE__ */ (0,
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
265
434
|
children
|
|
266
435
|
]
|
|
267
436
|
}
|
|
268
437
|
) })
|
|
269
438
|
);
|
|
270
439
|
Table.displayName = "Table";
|
|
271
|
-
var TableHeader = (0,
|
|
440
|
+
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
272
441
|
"thead",
|
|
273
442
|
{
|
|
274
443
|
ref,
|
|
@@ -277,7 +446,7 @@ var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) =
|
|
|
277
446
|
}
|
|
278
447
|
));
|
|
279
448
|
TableHeader.displayName = "TableHeader";
|
|
280
|
-
var TableBody = (0,
|
|
449
|
+
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
281
450
|
"tbody",
|
|
282
451
|
{
|
|
283
452
|
ref,
|
|
@@ -286,7 +455,7 @@ var TableBody = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
286
455
|
}
|
|
287
456
|
));
|
|
288
457
|
TableBody.displayName = "TableBody";
|
|
289
|
-
var TableFooter = (0,
|
|
458
|
+
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
290
459
|
"tfoot",
|
|
291
460
|
{
|
|
292
461
|
ref,
|
|
@@ -301,9 +470,9 @@ var VARIANT_STATES_ROW = {
|
|
|
301
470
|
invalid: "border-b-2 border-indicator-error",
|
|
302
471
|
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
303
472
|
};
|
|
304
|
-
var TableRow = (0,
|
|
473
|
+
var TableRow = (0, import_react3.forwardRef)(
|
|
305
474
|
({ state = "default", className, ...props }, ref) => {
|
|
306
|
-
return /* @__PURE__ */ (0,
|
|
475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
307
476
|
"tr",
|
|
308
477
|
{
|
|
309
478
|
ref,
|
|
@@ -320,7 +489,7 @@ var TableRow = (0, import_react2.forwardRef)(
|
|
|
320
489
|
}
|
|
321
490
|
);
|
|
322
491
|
TableRow.displayName = "TableRow";
|
|
323
|
-
var TableHead = (0,
|
|
492
|
+
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
324
493
|
"th",
|
|
325
494
|
{
|
|
326
495
|
ref,
|
|
@@ -329,7 +498,7 @@ var TableHead = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
329
498
|
}
|
|
330
499
|
));
|
|
331
500
|
TableHead.displayName = "TableHead";
|
|
332
|
-
var TableCell = (0,
|
|
501
|
+
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
333
502
|
"td",
|
|
334
503
|
{
|
|
335
504
|
ref,
|
|
@@ -338,7 +507,7 @@ var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
338
507
|
}
|
|
339
508
|
));
|
|
340
509
|
TableCell.displayName = "TableCell";
|
|
341
|
-
var TableCaption = (0,
|
|
510
|
+
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
342
511
|
"caption",
|
|
343
512
|
{
|
|
344
513
|
ref,
|
|
@@ -349,23 +518,23 @@ var TableCaption = (0, import_react2.forwardRef)(({ className, ...props }, ref)
|
|
|
349
518
|
TableCaption.displayName = "TableCaption";
|
|
350
519
|
|
|
351
520
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
352
|
-
var
|
|
353
|
-
var
|
|
354
|
-
var DropdownMenuContext = (0,
|
|
521
|
+
var import_react4 = require("react");
|
|
522
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
523
|
+
var DropdownMenuContext = (0, import_react4.createContext)(
|
|
355
524
|
void 0
|
|
356
525
|
);
|
|
357
526
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
358
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
527
|
+
const [internalOpen, setInternalOpen] = (0, import_react4.useState)(false);
|
|
359
528
|
const isControlled = open !== void 0;
|
|
360
529
|
const currentOpen = isControlled ? open : internalOpen;
|
|
361
|
-
const setOpen = (0,
|
|
530
|
+
const setOpen = (0, import_react4.useCallback)(
|
|
362
531
|
(newOpen) => {
|
|
363
532
|
if (onOpenChange) onOpenChange(newOpen);
|
|
364
533
|
if (!isControlled) setInternalOpen(newOpen);
|
|
365
534
|
},
|
|
366
535
|
[isControlled, onOpenChange]
|
|
367
536
|
);
|
|
368
|
-
const menuRef = (0,
|
|
537
|
+
const menuRef = (0, import_react4.useRef)(null);
|
|
369
538
|
const handleEscape = (event) => {
|
|
370
539
|
if (event.key === "Escape") {
|
|
371
540
|
setOpen(false);
|
|
@@ -376,7 +545,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
376
545
|
setOpen(false);
|
|
377
546
|
}
|
|
378
547
|
};
|
|
379
|
-
(0,
|
|
548
|
+
(0, import_react4.useEffect)(() => {
|
|
380
549
|
if (currentOpen) {
|
|
381
550
|
document.addEventListener("mousedown", handleClickOutside);
|
|
382
551
|
document.addEventListener("keydown", handleEscape);
|
|
@@ -386,18 +555,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
386
555
|
document.removeEventListener("keydown", handleEscape);
|
|
387
556
|
};
|
|
388
557
|
}, [currentOpen]);
|
|
389
|
-
const value = (0,
|
|
558
|
+
const value = (0, import_react4.useMemo)(
|
|
390
559
|
() => ({ open: currentOpen, setOpen }),
|
|
391
560
|
[currentOpen, setOpen]
|
|
392
561
|
);
|
|
393
|
-
return /* @__PURE__ */ (0,
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
394
563
|
};
|
|
395
|
-
var DropdownMenuTrigger = (0,
|
|
396
|
-
const context = (0,
|
|
564
|
+
var DropdownMenuTrigger = (0, import_react4.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
565
|
+
const context = (0, import_react4.useContext)(DropdownMenuContext);
|
|
397
566
|
if (!context)
|
|
398
567
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
399
568
|
const { open, setOpen } = context;
|
|
400
|
-
return /* @__PURE__ */ (0,
|
|
569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
401
570
|
"button",
|
|
402
571
|
{
|
|
403
572
|
ref,
|
|
@@ -429,7 +598,7 @@ var ALIGN_CLASSES = {
|
|
|
429
598
|
center: "left-1/2 -translate-x-1/2",
|
|
430
599
|
end: "right-0"
|
|
431
600
|
};
|
|
432
|
-
var MenuLabel = (0,
|
|
601
|
+
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
433
602
|
"fieldset",
|
|
434
603
|
{
|
|
435
604
|
ref,
|
|
@@ -439,7 +608,7 @@ var MenuLabel = (0, import_react3.forwardRef)(({ className, inset, ...props }, r
|
|
|
439
608
|
}
|
|
440
609
|
));
|
|
441
610
|
MenuLabel.displayName = "MenuLabel";
|
|
442
|
-
var MenuContent = (0,
|
|
611
|
+
var MenuContent = (0, import_react4.forwardRef)(
|
|
443
612
|
({
|
|
444
613
|
className,
|
|
445
614
|
align = "start",
|
|
@@ -448,9 +617,9 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
448
617
|
children,
|
|
449
618
|
...props
|
|
450
619
|
}, ref) => {
|
|
451
|
-
const { open } = (0,
|
|
452
|
-
const [isVisible, setIsVisible] = (0,
|
|
453
|
-
(0,
|
|
620
|
+
const { open } = (0, import_react4.useContext)(DropdownMenuContext);
|
|
621
|
+
const [isVisible, setIsVisible] = (0, import_react4.useState)(open);
|
|
622
|
+
(0, import_react4.useEffect)(() => {
|
|
454
623
|
if (open) {
|
|
455
624
|
setIsVisible(true);
|
|
456
625
|
} else {
|
|
@@ -464,7 +633,7 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
464
633
|
const horizontal = ALIGN_CLASSES[align];
|
|
465
634
|
return `absolute ${vertical} ${horizontal}`;
|
|
466
635
|
};
|
|
467
|
-
return /* @__PURE__ */ (0,
|
|
636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
468
637
|
"div",
|
|
469
638
|
{
|
|
470
639
|
ref,
|
|
@@ -488,7 +657,7 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
488
657
|
}
|
|
489
658
|
);
|
|
490
659
|
MenuContent.displayName = "MenuContent";
|
|
491
|
-
var MenuItem = (0,
|
|
660
|
+
var MenuItem = (0, import_react4.forwardRef)(
|
|
492
661
|
({
|
|
493
662
|
className,
|
|
494
663
|
inset,
|
|
@@ -509,7 +678,7 @@ var MenuItem = (0, import_react3.forwardRef)(
|
|
|
509
678
|
}
|
|
510
679
|
onClick?.(e);
|
|
511
680
|
};
|
|
512
|
-
return /* @__PURE__ */ (0,
|
|
681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
513
682
|
"div",
|
|
514
683
|
{
|
|
515
684
|
ref,
|
|
@@ -538,7 +707,7 @@ var MenuItem = (0, import_react3.forwardRef)(
|
|
|
538
707
|
}
|
|
539
708
|
);
|
|
540
709
|
MenuItem.displayName = "MenuItem";
|
|
541
|
-
var MenuSeparator = (0,
|
|
710
|
+
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
542
711
|
"div",
|
|
543
712
|
{
|
|
544
713
|
ref,
|
|
@@ -549,9 +718,9 @@ var MenuSeparator = (0, import_react3.forwardRef)(({ className, ...props }, ref)
|
|
|
549
718
|
MenuSeparator.displayName = "MenuSeparator";
|
|
550
719
|
|
|
551
720
|
// src/components/NavButton/NavButton.tsx
|
|
552
|
-
var
|
|
553
|
-
var
|
|
554
|
-
var NavButton = (0,
|
|
721
|
+
var import_react5 = require("react");
|
|
722
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
723
|
+
var NavButton = (0, import_react5.forwardRef)(
|
|
555
724
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
556
725
|
const baseClasses = [
|
|
557
726
|
"flex",
|
|
@@ -578,7 +747,7 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
578
747
|
];
|
|
579
748
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
580
749
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
581
|
-
return /* @__PURE__ */ (0,
|
|
750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
582
751
|
"button",
|
|
583
752
|
{
|
|
584
753
|
ref,
|
|
@@ -588,19 +757,73 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
588
757
|
"aria-pressed": selected,
|
|
589
758
|
...props,
|
|
590
759
|
children: [
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
593
762
|
]
|
|
594
763
|
}
|
|
595
764
|
);
|
|
596
765
|
}
|
|
597
766
|
);
|
|
598
767
|
NavButton.displayName = "NavButton";
|
|
768
|
+
|
|
769
|
+
// src/components/IconButton/IconButton.tsx
|
|
770
|
+
var import_react6 = require("react");
|
|
771
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
772
|
+
var IconButton = (0, import_react6.forwardRef)(
|
|
773
|
+
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
774
|
+
const baseClasses = [
|
|
775
|
+
"inline-flex",
|
|
776
|
+
"items-center",
|
|
777
|
+
"justify-center",
|
|
778
|
+
"rounded-lg",
|
|
779
|
+
"font-medium",
|
|
780
|
+
"bg-transparent",
|
|
781
|
+
"text-text-950",
|
|
782
|
+
"cursor-pointer",
|
|
783
|
+
"hover:bg-primary-600",
|
|
784
|
+
"hover:text-text",
|
|
785
|
+
"focus-visible:outline-none",
|
|
786
|
+
"focus-visible:ring-2",
|
|
787
|
+
"focus-visible:ring-offset-0",
|
|
788
|
+
"focus-visible:ring-indicator-info",
|
|
789
|
+
"disabled:opacity-50",
|
|
790
|
+
"disabled:cursor-not-allowed",
|
|
791
|
+
"disabled:pointer-events-none"
|
|
792
|
+
];
|
|
793
|
+
const sizeClasses = {
|
|
794
|
+
sm: ["w-6", "h-6", "text-sm"],
|
|
795
|
+
md: ["w-10", "h-10", "text-base"]
|
|
796
|
+
};
|
|
797
|
+
const activeClasses = active ? ["!bg-primary-50", "!text-primary-950", "hover:!bg-primary-100"] : [];
|
|
798
|
+
const allClasses = [
|
|
799
|
+
...baseClasses,
|
|
800
|
+
...sizeClasses[size],
|
|
801
|
+
...activeClasses
|
|
802
|
+
].join(" ");
|
|
803
|
+
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
805
|
+
"button",
|
|
806
|
+
{
|
|
807
|
+
ref,
|
|
808
|
+
type: "button",
|
|
809
|
+
className: `${allClasses} ${className}`,
|
|
810
|
+
disabled,
|
|
811
|
+
"aria-pressed": active,
|
|
812
|
+
"aria-label": ariaLabel,
|
|
813
|
+
...props,
|
|
814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
IconButton.displayName = "IconButton";
|
|
599
820
|
// Annotate the CommonJS export names for ESM import in node:
|
|
600
821
|
0 && (module.exports = {
|
|
601
822
|
Button,
|
|
823
|
+
CheckBox,
|
|
602
824
|
DropdownMenu,
|
|
603
825
|
DropdownMenuTrigger,
|
|
826
|
+
IconButton,
|
|
604
827
|
IconRoundedButton,
|
|
605
828
|
MenuContent,
|
|
606
829
|
MenuItem,
|