@wellingtonhlc/shared-ui 0.29.0 → 0.29.2

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.
Files changed (153) hide show
  1. package/README.md +25 -10
  2. package/dist/cli/check-page-actions.d.ts +9 -0
  3. package/dist/cli/check-page-actions.d.ts.map +1 -0
  4. package/dist/cli/check-page-actions.js +108 -0
  5. package/dist/components/ActionBar.d.ts +26 -0
  6. package/dist/components/ActionBar.d.ts.map +1 -0
  7. package/dist/components/ActionBar.js +29 -0
  8. package/dist/components/ActionPrimitives.d.ts +31 -0
  9. package/dist/components/ActionPrimitives.d.ts.map +1 -0
  10. package/dist/components/ActionPrimitives.js +27 -0
  11. package/dist/components/AppShell.d.ts +65 -0
  12. package/dist/components/AppShell.d.ts.map +1 -0
  13. package/dist/components/AppShell.js +50 -0
  14. package/dist/components/AppShellActions.d.ts +24 -0
  15. package/dist/components/AppShellActions.d.ts.map +1 -0
  16. package/dist/components/AppShellActions.js +15 -0
  17. package/dist/components/Badge.d.ts +16 -0
  18. package/dist/components/Badge.d.ts.map +1 -0
  19. package/dist/components/Badge.js +36 -0
  20. package/dist/components/Banner.d.ts +13 -0
  21. package/dist/components/Banner.d.ts.map +1 -0
  22. package/dist/components/Banner.js +29 -0
  23. package/dist/components/Button.d.ts +14 -0
  24. package/dist/components/Button.d.ts.map +1 -0
  25. package/dist/components/Button.js +39 -0
  26. package/dist/components/Card.d.ts +36 -0
  27. package/dist/components/Card.d.ts.map +1 -0
  28. package/dist/components/Card.js +56 -0
  29. package/dist/components/ConfirmationDialog.d.ts +74 -0
  30. package/dist/components/ConfirmationDialog.d.ts.map +1 -0
  31. package/dist/components/ConfirmationDialog.js +234 -0
  32. package/dist/components/CopyableField.d.ts +10 -0
  33. package/dist/components/CopyableField.d.ts.map +1 -0
  34. package/dist/components/CopyableField.js +60 -0
  35. package/dist/components/DateField.d.ts +20 -0
  36. package/dist/components/DateField.d.ts.map +1 -0
  37. package/dist/components/DateField.js +172 -0
  38. package/dist/components/DecimalField.d.ts +21 -0
  39. package/dist/components/DecimalField.d.ts.map +1 -0
  40. package/dist/components/DecimalField.js +137 -0
  41. package/dist/components/DismissiblePopover.d.ts +14 -0
  42. package/dist/components/DismissiblePopover.d.ts.map +1 -0
  43. package/dist/components/DismissiblePopover.js +51 -0
  44. package/dist/components/EmptyState.d.ts +15 -0
  45. package/dist/components/EmptyState.d.ts.map +1 -0
  46. package/dist/components/EmptyState.js +32 -0
  47. package/dist/components/FieldControl.d.ts +20 -0
  48. package/dist/components/FieldControl.d.ts.map +1 -0
  49. package/dist/components/FieldControl.js +73 -0
  50. package/dist/components/FieldGroup.d.ts +11 -0
  51. package/dist/components/FieldGroup.d.ts.map +1 -0
  52. package/dist/components/FieldGroup.js +11 -0
  53. package/dist/components/FieldSkeleton.d.ts +14 -0
  54. package/dist/components/FieldSkeleton.d.ts.map +1 -0
  55. package/dist/components/FieldSkeleton.js +23 -0
  56. package/dist/components/FieldValidationError.d.ts +8 -0
  57. package/dist/components/FieldValidationError.d.ts.map +1 -0
  58. package/dist/components/FieldValidationError.js +7 -0
  59. package/dist/components/Filter.d.ts +51 -0
  60. package/dist/components/Filter.d.ts.map +1 -0
  61. package/dist/components/Filter.js +68 -0
  62. package/dist/components/Loading.d.ts +17 -0
  63. package/dist/components/Loading.d.ts.map +1 -0
  64. package/dist/components/Loading.js +15 -0
  65. package/dist/components/LoadingOverlay.d.ts +11 -0
  66. package/dist/components/LoadingOverlay.d.ts.map +1 -0
  67. package/dist/components/LoadingOverlay.js +8 -0
  68. package/dist/components/Modal.d.ts +49 -0
  69. package/dist/components/Modal.d.ts.map +1 -0
  70. package/dist/components/Modal.js +108 -0
  71. package/dist/components/MultiSelectField.d.ts +22 -0
  72. package/dist/components/MultiSelectField.d.ts.map +1 -0
  73. package/dist/components/MultiSelectField.js +84 -0
  74. package/dist/components/NavCard.d.ts +15 -0
  75. package/dist/components/NavCard.d.ts.map +1 -0
  76. package/dist/components/NavCard.js +13 -0
  77. package/dist/components/Page.d.ts +89 -0
  78. package/dist/components/Page.d.ts.map +1 -0
  79. package/dist/components/Page.js +347 -0
  80. package/dist/components/PageMessage.d.ts +12 -0
  81. package/dist/components/PageMessage.d.ts.map +1 -0
  82. package/dist/components/PageMessage.js +36 -0
  83. package/dist/components/Pagination.d.ts +15 -0
  84. package/dist/components/Pagination.d.ts.map +1 -0
  85. package/dist/components/Pagination.js +57 -0
  86. package/dist/components/PasswordInput.d.ts +8 -0
  87. package/dist/components/PasswordInput.d.ts.map +1 -0
  88. package/dist/components/PasswordInput.js +17 -0
  89. package/dist/components/RadioGroup.d.ts +32 -0
  90. package/dist/components/RadioGroup.d.ts.map +1 -0
  91. package/dist/components/RadioGroup.js +86 -0
  92. package/dist/components/RenderCase.d.ts +20 -0
  93. package/dist/components/RenderCase.d.ts.map +1 -0
  94. package/dist/components/RenderCase.js +31 -0
  95. package/dist/components/RenderIf.d.ts +10 -0
  96. package/dist/components/RenderIf.d.ts.map +1 -0
  97. package/dist/components/RenderIf.js +9 -0
  98. package/dist/components/SearchField.d.ts +22 -0
  99. package/dist/components/SearchField.d.ts.map +1 -0
  100. package/dist/components/SearchField.js +43 -0
  101. package/dist/components/SelectField.d.ts +31 -0
  102. package/dist/components/SelectField.d.ts.map +1 -0
  103. package/dist/components/SelectField.js +26 -0
  104. package/dist/components/SelectionField.d.ts +39 -0
  105. package/dist/components/SelectionField.d.ts.map +1 -0
  106. package/dist/components/SelectionField.js +105 -0
  107. package/dist/components/Sidebar.d.ts +104 -0
  108. package/dist/components/Sidebar.d.ts.map +1 -0
  109. package/dist/components/Sidebar.js +146 -0
  110. package/dist/components/StatCard.d.ts +16 -0
  111. package/dist/components/StatCard.d.ts.map +1 -0
  112. package/dist/components/StatCard.js +62 -0
  113. package/dist/components/Switch.d.ts +20 -0
  114. package/dist/components/Switch.d.ts.map +1 -0
  115. package/dist/components/Switch.js +63 -0
  116. package/dist/components/Table.d.ts +65 -0
  117. package/dist/components/Table.d.ts.map +1 -0
  118. package/dist/components/Table.js +118 -0
  119. package/dist/components/TabsUnderlined.d.ts +23 -0
  120. package/dist/components/TabsUnderlined.d.ts.map +1 -0
  121. package/dist/components/TabsUnderlined.js +29 -0
  122. package/dist/components/TextField.d.ts +25 -0
  123. package/dist/components/TextField.d.ts.map +1 -0
  124. package/dist/components/TextField.js +71 -0
  125. package/dist/components/TextareaField.d.ts +14 -0
  126. package/dist/components/TextareaField.d.ts.map +1 -0
  127. package/dist/components/TextareaField.js +34 -0
  128. package/dist/components/ThemePreferencesSelector.d.ts +29 -0
  129. package/dist/components/ThemePreferencesSelector.d.ts.map +1 -0
  130. package/dist/components/ThemePreferencesSelector.js +37 -0
  131. package/dist/components/Tooltip.d.ts +13 -0
  132. package/dist/components/Tooltip.d.ts.map +1 -0
  133. package/dist/components/Tooltip.js +40 -0
  134. package/dist/components/Workspace.d.ts +22 -0
  135. package/dist/components/Workspace.d.ts.map +1 -0
  136. package/dist/components/Workspace.js +33 -0
  137. package/dist/components/WorkspaceContext.d.ts +2 -0
  138. package/dist/components/WorkspaceContext.d.ts.map +1 -0
  139. package/dist/components/WorkspaceContext.js +2 -0
  140. package/dist/components/form-control-helpers.d.ts +24 -0
  141. package/dist/components/form-control-helpers.d.ts.map +1 -0
  142. package/dist/components/form-control-helpers.js +20 -0
  143. package/dist/index.d.ts +45 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +44 -0
  146. package/dist/styles.css +26 -43
  147. package/dist/tailwind-preset.d.ts +23 -0
  148. package/dist/tailwind-preset.d.ts.map +1 -0
  149. package/dist/tailwind-preset.js +22 -0
  150. package/dist/utils/cn.d.ts +2 -0
  151. package/dist/utils/cn.d.ts.map +1 -0
  152. package/dist/utils/cn.js +33 -0
  153. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldValidationError.d.ts","sourceRoot":"","sources":["../../src/components/FieldValidationError.tsx"],"names":[],"mappings":"AAEA,UAAU,yBAAyB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,aAAqB,EAAE,EAAE,yBAAyB,sCAkBrG"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../utils/cn';
3
+ export function FieldValidationError({ id, message, hasValidation = false }) {
4
+ if (!hasValidation && !message)
5
+ return null;
6
+ return (_jsx("p", { id: id, className: cn('mt-px text-left text-[length:var(--font-size-2xs)] leading-[var(--line-height-2xs)] transition-opacity duration-[var(--duration-normal)] select-none', hasValidation ? 'min-h-[14px]' : 'min-h-0', message ? 'text-red-600 opacity-100 dark:text-red-400' : 'opacity-0'), "aria-live": "polite", "aria-atomic": "true", role: message ? 'alert' : undefined, children: message ?? '' }));
7
+ }
@@ -0,0 +1,51 @@
1
+ import { type FormEvent, type ReactElement, type ReactNode } from 'react';
2
+ import { type ActionButtonPrimitiveProps } from './ActionPrimitives';
3
+ export interface FilterRootProps {
4
+ title?: ReactNode;
5
+ description?: ReactNode;
6
+ children: ReactNode;
7
+ className?: string;
8
+ bodyClassName?: string;
9
+ contentClassName?: string;
10
+ maxHeightClassName?: string;
11
+ onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
12
+ onClear?: () => void;
13
+ submitLabel?: ReactNode;
14
+ clearLabel?: ReactNode;
15
+ isSubmitting?: boolean;
16
+ actionsDisabled?: boolean;
17
+ fieldsClassName?: string;
18
+ }
19
+ export interface FilterFooterProps {
20
+ children: ReactNode;
21
+ className?: string;
22
+ }
23
+ export interface FilterVisibilityProps {
24
+ children: ReactNode;
25
+ defaultOpen?: boolean;
26
+ open?: boolean;
27
+ onOpenChange?: (open: boolean) => void;
28
+ className?: string;
29
+ }
30
+ export interface FilterTriggerProps extends Omit<ActionButtonPrimitiveProps, 'children'> {
31
+ triggerSlot?: ReactElement;
32
+ label?: ReactNode;
33
+ }
34
+ interface FilterVisibilityContextValue {
35
+ open: boolean;
36
+ setOpen: (open: boolean) => void;
37
+ contentId: string;
38
+ }
39
+ export declare const FilterVisibilityContext: import("react").Context<FilterVisibilityContextValue | null>;
40
+ declare function FilterFooter({ children, className }: FilterFooterProps): import("react").JSX.Element;
41
+ declare function FilterVisibility({ children, defaultOpen, open: controlledOpen, onOpenChange, className }: FilterVisibilityProps): import("react").JSX.Element;
42
+ declare function FilterTrigger({ triggerSlot, label, onClick, ...props }: FilterTriggerProps): import("react").JSX.Element;
43
+ declare function FilterRoot({ title, description, children, className, bodyClassName, contentClassName, maxHeightClassName, onSubmit, onClear, submitLabel, clearLabel, isSubmitting, actionsDisabled, fieldsClassName, }: FilterRootProps): import("react").JSX.Element;
44
+ export declare const Filter: {
45
+ Root: typeof FilterRoot;
46
+ Footer: typeof FilterFooter;
47
+ Visibility: typeof FilterVisibility;
48
+ Trigger: typeof FilterTrigger;
49
+ };
50
+ export {};
51
+ //# sourceMappingURL=Filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../../src/components/Filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAEd,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAK5F,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAA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AO,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,+BAmB/F;AAuBD,iBAAS,UAAU,CAAC,EAClB,KAAiB,EACjB,WAAgB,EAChB,QAAQ,EACR,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,YAAoB,EACpB,eAAuB,EACvB,eAAe,GAChB,EAAE,eAAe,+BAoDjB;AAED,eAAO,MAAM,MAAM;;;;;CAKlB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, cloneElement, createContext, isValidElement, useContext, useId, useState, } from 'react';
3
+ import { FilterIcon } from 'lucide-react';
4
+ import { cn } from '../utils/cn';
5
+ import { ActionButtonPrimitive } from './ActionPrimitives';
6
+ import { Button } from './Button';
7
+ import { Card } from './Card';
8
+ import { RenderIf } from './RenderIf';
9
+ export const FilterVisibilityContext = createContext(null);
10
+ function FilterFooter({ children, className }) {
11
+ return (_jsx("div", { "data-slot": "filter-footer", className: cn('border-app-border flex shrink-0 items-center justify-end gap-2 border-t px-4 py-3', className), children: children }));
12
+ }
13
+ function FilterVisibility({ children, defaultOpen = true, open: controlledOpen, onOpenChange, className }) {
14
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
15
+ const open = controlledOpen ?? uncontrolledOpen;
16
+ const contentId = useId();
17
+ function setOpen(nextOpen) {
18
+ if (controlledOpen === undefined)
19
+ setUncontrolledOpen(nextOpen);
20
+ onOpenChange?.(nextOpen);
21
+ }
22
+ return (_jsx(FilterVisibilityContext.Provider, { value: { contentId, open, setOpen }, children: _jsx("div", { className: cn('contents', className), "data-state": open ? 'open' : 'closed', children: children }) }));
23
+ }
24
+ function FilterTrigger({ triggerSlot, label = 'Filtros', onClick, ...props }) {
25
+ const visibility = useContext(FilterVisibilityContext);
26
+ function handleClick(event) {
27
+ onClick?.(event);
28
+ if (!event.defaultPrevented)
29
+ visibility?.setOpen(!visibility.open);
30
+ }
31
+ const triggerProps = {
32
+ ...props,
33
+ 'aria-controls': visibility?.contentId,
34
+ 'aria-expanded': visibility?.open,
35
+ 'data-state': visibility?.open ?? true ? 'open' : 'closed',
36
+ onClick: handleClick,
37
+ };
38
+ if (triggerSlot)
39
+ return cloneElement(triggerSlot, triggerProps);
40
+ return _jsx(ActionButtonPrimitive, { ...triggerProps, label: label });
41
+ }
42
+ function FilterActions({ clearLabel, submitLabel, onClear, onSubmit, isSubmitting, actionsDisabled }) {
43
+ function handleClear() {
44
+ onClear?.();
45
+ }
46
+ return (_jsxs(FilterFooter, { children: [_jsx(RenderIf, { when: Boolean(onClear), children: _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: handleClear, disabled: actionsDisabled, children: clearLabel ?? 'Redefinir' }) }), _jsx(RenderIf, { when: Boolean(onSubmit), children: _jsx(Button, { type: "submit", size: "sm", className: "flex-1", isLoading: isSubmitting, disabled: actionsDisabled, children: submitLabel ?? 'Pesquisar' }) })] }));
47
+ }
48
+ function FilterRoot({ title = 'Filtros', description = '', children, className, bodyClassName, contentClassName, maxHeightClassName = '', onSubmit, onClear, submitLabel, clearLabel, isSubmitting = false, actionsDisabled = false, fieldsClassName, }) {
49
+ const visibility = useContext(FilterVisibilityContext);
50
+ const isOpen = visibility?.open ?? true;
51
+ const childrenArray = Children.toArray(children);
52
+ const hasExplicitFooter = childrenArray.some((child) => isValidElement(child) && child.type === FilterFooter);
53
+ const footerChildren = childrenArray.filter((child) => isValidElement(child) && child.type === FilterFooter);
54
+ const contentChildren = childrenArray.filter((child) => !(isValidElement(child) && child.type === FilterFooter));
55
+ const hasAutomaticActions = Boolean(onSubmit || onClear);
56
+ function handleSubmit(event) {
57
+ event.preventDefault();
58
+ onSubmit?.(event);
59
+ }
60
+ const bodyContent = (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [_jsx("div", { className: cn('min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]', contentClassName), children: _jsxs("div", { className: cn('flex flex-col gap-1 py-3 pl-4 pr-1', fieldsClassName), children: [description ? _jsx("p", { className: "text-foreground-muted text-xs leading-5", children: description }) : null, contentChildren] }) }), hasExplicitFooter ? footerChildren : null, !hasExplicitFooter && hasAutomaticActions ? (_jsx(FilterActions, { actionsDisabled: actionsDisabled, clearLabel: clearLabel, isSubmitting: isSubmitting, onClear: onClear, onSubmit: onSubmit, submitLabel: submitLabel })) : null] }));
61
+ return (_jsxs(Card.Root, { id: visibility?.contentId, className: cn('flex h-full w-full min-w-0 flex-col overflow-hidden', maxHeightClassName, className), "data-slot": "filter-root", "data-state": isOpen ? 'open' : 'closed', children: [_jsxs(Card.Title, { "data-slot": "filter-header", children: [_jsx(FilterIcon, { className: "text-primary h-4 w-4" }), title] }), _jsx(Card.Body, { density: "none", className: cn('flex min-h-0 flex-1 flex-col', bodyClassName), children: onSubmit ? _jsx("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: handleSubmit, children: bodyContent }) : bodyContent })] }));
62
+ }
63
+ export const Filter = {
64
+ Root: FilterRoot,
65
+ Footer: FilterFooter,
66
+ Visibility: FilterVisibility,
67
+ Trigger: FilterTrigger,
68
+ };
@@ -0,0 +1,17 @@
1
+ import { type ReactNode, type SVGProps } from 'react';
2
+ declare const sizeClasses: {
3
+ readonly xs: "h-3 w-3";
4
+ readonly sm: "h-4 w-4";
5
+ readonly md: "h-5 w-5";
6
+ readonly lg: "h-6 w-6";
7
+ };
8
+ export type LoadingSize = keyof typeof sizeClasses;
9
+ export interface LoadingProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
10
+ isLoading?: boolean;
11
+ children?: ReactNode;
12
+ size?: LoadingSize;
13
+ strokeWidth?: number;
14
+ }
15
+ export declare function Loading({ isLoading, children, className, size, strokeWidth, 'aria-label': ariaLabel, ...props }: LoadingProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
16
+ export {};
17
+ //# sourceMappingURL=Loading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../src/components/Loading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAS,MAAM,OAAO,CAAC;AAI7D,QAAA,MAAM,WAAW;;;;;CAKP,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,WAAW,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,EACtB,SAAgB,EAChB,QAAQ,EACR,SAAS,EACT,IAAW,EACX,WAAe,EACf,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,YAAY,+TAoCd"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { cn } from '../utils/cn';
4
+ const sizeClasses = {
5
+ xs: 'h-3 w-3',
6
+ sm: 'h-4 w-4',
7
+ md: 'h-5 w-5',
8
+ lg: 'h-6 w-6',
9
+ };
10
+ export function Loading({ isLoading = true, children, className, size = 'sm', strokeWidth = 4, 'aria-label': ariaLabel, ...props }) {
11
+ const gradientId = useId().replace(/:/g, '');
12
+ if (!isLoading)
13
+ return children;
14
+ return (_jsxs("svg", { className: cn('text-brand m-auto animate-spin', sizeClasses[size], className), viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg", role: ariaLabel ? 'status' : undefined, "aria-label": ariaLabel, "aria-hidden": ariaLabel ? undefined : true, ...props, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "1" }), _jsx("stop", { offset: "70%", stopColor: "currentColor", stopOpacity: "0.25" }), _jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0" })] }) }), _jsx("circle", { cx: "24", cy: "24", r: "18", stroke: "currentColor", strokeOpacity: "0.06", strokeWidth: strokeWidth, fill: "none" }), _jsx("circle", { cx: "24", cy: "24", r: "18", stroke: `url(#${gradientId})`, strokeWidth: strokeWidth, strokeLinecap: "round", strokeDasharray: "80 113", transform: "rotate(-90 24 24)", fill: "none" })] }));
15
+ }
@@ -0,0 +1,11 @@
1
+ import { type LoadingSize } from './Loading';
2
+ export type LoadingOverlayVariant = 'solid' | 'scrim';
3
+ export interface LoadingOverlayProps {
4
+ open?: boolean;
5
+ variant?: LoadingOverlayVariant;
6
+ size?: LoadingSize;
7
+ label?: string;
8
+ className?: string;
9
+ }
10
+ export declare function LoadingOverlay({ open, variant, size, label, className, }: LoadingOverlayProps): import("react").JSX.Element | null;
11
+ //# sourceMappingURL=LoadingOverlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingOverlay.d.ts","sourceRoot":"","sources":["../../src/components/LoadingOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAItD,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAY,EACZ,OAAiB,EACjB,IAAW,EACX,KAAoB,EACpB,SAAS,GACV,EAAE,mBAAmB,sCAiBrB"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Loading } from './Loading';
3
+ import { cn } from '../utils/cn';
4
+ export function LoadingOverlay({ open = false, variant = 'solid', size = 'lg', label = 'Carregando', className, }) {
5
+ if (!open)
6
+ return null;
7
+ return (_jsx("div", { className: cn('fixed inset-0 z-[var(--z-loading-overlay)] flex items-center justify-center', variant === 'solid' ? 'bg-background' : 'bg-[var(--overlay-loading)] backdrop-blur-[var(--backdrop-blur-md)]', className), role: "status", "aria-label": label, "aria-live": "polite", children: _jsx(Loading, { size: size, "aria-label": label }) }));
8
+ }
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ export type ModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
4
+ export type ModalVariant = 'default' | 'elevated';
5
+ export type ModalDensity = 'default' | 'compact';
6
+ export interface ModalRootProps extends React.ComponentProps<typeof DialogPrimitive.Root> {
7
+ size?: ModalSize;
8
+ offset?: number;
9
+ centered?: boolean;
10
+ density?: ModalDensity;
11
+ showCloseButton?: boolean;
12
+ variant?: ModalVariant;
13
+ className?: string;
14
+ overlayClassName?: string;
15
+ allowExternalFocus?: boolean;
16
+ }
17
+ export interface ModalBodyProps extends React.ComponentProps<'div'> {
18
+ scrollable?: boolean;
19
+ density?: ModalDensity;
20
+ overflowVisible?: boolean;
21
+ }
22
+ export interface ModalSectionProps extends React.ComponentProps<'div'> {
23
+ density?: ModalDensity;
24
+ separated?: boolean;
25
+ }
26
+ declare function createTrigger(trigger: React.ReactNode, options: {
27
+ open: boolean;
28
+ onOpen: () => void;
29
+ }): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
30
+ declare function ModalRoot({ allowExternalFocus, centered, children, className, density, overlayClassName, offset, showCloseButton, size, variant, onOpenChange, ...props }: ModalRootProps): React.JSX.Element;
31
+ declare function ModalHeader({ className, density, separated, ...props }: ModalSectionProps): React.JSX.Element;
32
+ declare function ModalBody({ className, density, overflowVisible, scrollable, ...props }: ModalBodyProps): React.JSX.Element;
33
+ declare function ModalFooter({ className, density, separated, ...props }: ModalSectionProps): React.JSX.Element;
34
+ declare function ModalTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
35
+ declare function ModalDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
36
+ export declare const Modal: {
37
+ Root: typeof ModalRoot;
38
+ Header: typeof ModalHeader;
39
+ Body: typeof ModalBody;
40
+ Footer: typeof ModalFooter;
41
+ Title: typeof ModalTitle;
42
+ Description: typeof ModalDescription;
43
+ Trigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
44
+ Close: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
45
+ Portal: React.FC<DialogPrimitive.DialogPortalProps>;
46
+ createTrigger: typeof createTrigger;
47
+ };
48
+ export {};
49
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;A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,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,qBAetG;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,OAAmB,EAAE,eAAuB,EAAE,UAAkB,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBAc3H;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,OAAmB,EAAE,SAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,qBAcrG;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAE9F;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,qBAE1G;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;CAWjB,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
4
+ import { XIcon } from 'lucide-react';
5
+ import { cn } from '../utils/cn';
6
+ let nextModalLayer = 0;
7
+ function useModalLayer(open) {
8
+ const [layer, setLayer] = React.useState(0);
9
+ React.useEffect(() => {
10
+ if (!open) {
11
+ setLayer(0);
12
+ return;
13
+ }
14
+ nextModalLayer += 1;
15
+ setLayer(nextModalLayer);
16
+ }, [open]);
17
+ return layer;
18
+ }
19
+ const sizeVariants = {
20
+ xs: '',
21
+ sm: '',
22
+ md: '',
23
+ lg: '',
24
+ xl: '',
25
+ full: '',
26
+ };
27
+ const widthVariants = {
28
+ xs: 'min(22rem, calc(100vw - 1.5rem))',
29
+ sm: 'min(28rem, calc(100vw - 1.5rem))',
30
+ md: 'min(42rem, calc(100vw - 1.5rem))',
31
+ lg: 'min(62rem, calc(100vw - 1.5rem))',
32
+ xl: 'min(82rem, calc(100vw - 1.5rem))',
33
+ full: '95vw',
34
+ };
35
+ const minHeightVariants = {
36
+ xs: 'min-h-[10rem]',
37
+ sm: 'min-h-[12rem]',
38
+ md: 'min-h-[14rem]',
39
+ lg: 'min-h-[14rem]',
40
+ xl: 'min-h-[14rem]',
41
+ full: 'min-h-[14rem]',
42
+ };
43
+ function composeClickHandlers(currentHandler, nextHandler) {
44
+ return (event) => {
45
+ currentHandler?.(event);
46
+ if (typeof event === 'object' && event !== null && 'defaultPrevented' in event && event.defaultPrevented) {
47
+ return;
48
+ }
49
+ nextHandler(event);
50
+ };
51
+ }
52
+ function createTrigger(trigger, options) {
53
+ if (!React.isValidElement(trigger)) {
54
+ return trigger ?? null;
55
+ }
56
+ return React.cloneElement(trigger, {
57
+ onClick: composeClickHandlers(trigger.props.onClick, options.onOpen),
58
+ 'aria-haspopup': 'dialog',
59
+ 'aria-expanded': options.open,
60
+ 'data-state': options.open ? 'open' : 'closed',
61
+ });
62
+ }
63
+ function ModalRoot({ allowExternalFocus = false, centered = false, children, className, density = 'default', overlayClassName, offset, showCloseButton = true, size = 'lg', variant = 'default', onOpenChange, ...props }) {
64
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(props.defaultOpen ?? false);
65
+ const open = props.open ?? uncontrolledOpen;
66
+ const layer = useModalLayer(open);
67
+ const overlayZIndex = 100 + layer * 20;
68
+ const contentZIndex = 110 + layer * 20;
69
+ function handleOpenChange(nextOpen) {
70
+ if (props.open === undefined) {
71
+ setUncontrolledOpen(nextOpen);
72
+ }
73
+ onOpenChange?.(nextOpen);
74
+ }
75
+ const hasFooter = React.Children.toArray(children).some((child) => React.isValidElement(child) && child.type === ModalFooter);
76
+ return (_jsx(DialogPrimitive.Root, { ...props, modal: !allowExternalFocus, open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { style: { zIndex: overlayZIndex }, className: cn('fixed inset-0 z-[var(--z-modal-overlay)] bg-[var(--overlay-scrim)] backdrop-blur-[var(--backdrop-blur-sm)]', allowExternalFocus && 'pointer-events-none', overlayClassName) }), _jsxs(DialogPrimitive.Content, { style: {
77
+ zIndex: contentZIndex,
78
+ width: widthVariants[size],
79
+ ...(!centered && offset ? { top: `${offset}px` } : {}),
80
+ }, className: cn('fixed z-[var(--z-modal)] grid max-h-[95vh]', hasFooter ? 'grid-rows-[auto_minmax(0,1fr)_auto]' : 'grid-rows-[auto_minmax(0,1fr)]', 'rounded-xl', density === 'default' && 'p-6', density === 'compact' && 'p-4', variant === 'default' && 'border-app-border bg-background-secondary text-foreground border shadow-[var(--shadow-lg)]', variant === 'elevated' && 'border-app-border bg-surface text-foreground border shadow-[var(--shadow-overlay)]', centered ? 'left-[50%] top-[50%] -translate-x-1/2 -translate-y-1/2' : 'left-[50%] top-[2.5%] -translate-x-1/2', sizeVariants[size], minHeightVariants[size], className), children: [children, showCloseButton ? (_jsxs(DialogPrimitive.Close, { className: cn('absolute right-4 top-4 inline-flex h-8 w-8 items-center justify-center rounded-md', 'text-foreground-muted hover:bg-background hover:text-foreground cursor-pointer transition-colors', 'focus:ring-brand/50 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none'), children: [_jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Fechar" })] })) : null] })] }) }));
81
+ }
82
+ function ModalHeader({ className, density = 'default', separated = false, ...props }) {
83
+ return (_jsx("div", { "data-slot": "modal-header", className: cn('flex flex-col text-center sm:text-left', density === 'default' && 'gap-1.5 [&_[data-slot=modal-description]]:text-sm [&_[data-slot=modal-title]]:text-lg', density === 'compact' && 'gap-0.5 [&_[data-slot=modal-description]]:text-xs [&_[data-slot=modal-title]]:text-base', separated && density === 'default' && 'border-app-border border-b pb-4', separated && density === 'compact' && 'border-app-border border-b pb-2', className), ...props }));
84
+ }
85
+ function ModalBody({ className, density = 'default', overflowVisible = false, scrollable = false, ...props }) {
86
+ return (_jsx("div", { "data-slot": "modal-body", className: cn('flex min-h-0 flex-col', density === 'default' && 'space-y-5 py-4 text-sm leading-6', density === 'compact' && 'space-y-2 py-2 text-xs leading-5', overflowVisible ? 'overflow-visible' : scrollable ? 'overflow-y-auto pr-1' : 'overflow-visible', className), ...props }));
87
+ }
88
+ function ModalFooter({ className, density = 'default', separated = true, ...props }) {
89
+ return (_jsx("div", { "data-slot": "modal-footer", className: cn('flex flex-col-reverse sm:flex-row sm:justify-end', density === 'default' && 'mt-3 gap-2.5 pt-5', density === 'compact' && 'mt-0 gap-1.5 pt-2', separated && 'border-app-border border-t', className), ...props }));
90
+ }
91
+ function ModalTitle({ className, ...props }) {
92
+ return _jsx(DialogPrimitive.Title, { "data-slot": "modal-title", className: cn('text-foreground flex items-center gap-2 text-lg font-semibold leading-none tracking-tight', className), ...props });
93
+ }
94
+ function ModalDescription({ className, ...props }) {
95
+ return _jsx(DialogPrimitive.Description, { "data-slot": "modal-description", className: cn('text-foreground-muted text-sm', className), ...props });
96
+ }
97
+ export const Modal = {
98
+ Root: ModalRoot,
99
+ Header: ModalHeader,
100
+ Body: ModalBody,
101
+ Footer: ModalFooter,
102
+ Title: ModalTitle,
103
+ Description: ModalDescription,
104
+ Trigger: DialogPrimitive.Trigger,
105
+ Close: DialogPrimitive.Close,
106
+ Portal: DialogPrimitive.Portal,
107
+ createTrigger,
108
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import type { FormControlSize } from './form-control-helpers';
3
+ export interface MultiSelectOption<TValue extends string | number = string> {
4
+ label: string;
5
+ value: TValue;
6
+ disabled?: boolean;
7
+ }
8
+ export interface MultiSelectFieldProps<TValue extends string | number = string> {
9
+ label?: string;
10
+ value: TValue[];
11
+ options: MultiSelectOption<TValue>[];
12
+ onChange: (value: TValue[]) => void;
13
+ placeholder?: string;
14
+ errorMessage?: string;
15
+ disabled?: boolean;
16
+ maxSelected?: number;
17
+ wrapperClassName?: string;
18
+ size?: FormControlSize;
19
+ labelPosition?: 'top' | 'right' | 'bottom' | 'left';
20
+ }
21
+ export declare function MultiSelectField<TValue extends string | number = string>({ label, value, options, onChange, placeholder, errorMessage, disabled, maxSelected, wrapperClassName, size, labelPosition, }: MultiSelectFieldProps<TValue>): React.JSX.Element;
22
+ //# sourceMappingURL=MultiSelectField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiSelectField.d.ts","sourceRoot":"","sources":["../../src/components/MultiSelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;CACrD;AA4ED,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,EACxE,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAA4B,EAC5B,YAAY,EACZ,QAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,IAAW,EACX,aAAqB,GACtB,EAAE,qBAAqB,CAAC,MAAM,CAAC,qBA8I/B"}
@@ -0,0 +1,84 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { cn } from '../utils/cn';
4
+ import { FieldControl } from './FieldControl';
5
+ import { RenderCase } from './RenderCase';
6
+ import { RenderIf } from './RenderIf';
7
+ import { Check, ChevronDown, X } from 'lucide-react';
8
+ const DROPDOWN_MAX_HEIGHT = 220;
9
+ function ChipItem({ option, disabled, onRemove, }) {
10
+ function handleRemove(event) {
11
+ onRemove(event, option.value);
12
+ }
13
+ return (_jsxs("span", { className: "text-brand bg-brand/15 inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium", children: [option.label, _jsx(RenderIf, { when: !disabled, children: _jsx("button", { type: "button", tabIndex: -1, className: "hover:text-brand/70", onClick: handleRemove, children: _jsx(X, { className: "size-3" }) }) })] }));
14
+ }
15
+ function OptionListItem({ option, isSelected, isDisabledByMax, onToggle, }) {
16
+ const disabled = option.disabled || isDisabledByMax;
17
+ function handleClick() {
18
+ if (disabled)
19
+ return;
20
+ onToggle(option.value);
21
+ }
22
+ return (_jsxs("li", { role: "option", "aria-selected": isSelected, className: cn('hover:bg-background flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition-colors', disabled && 'cursor-not-allowed opacity-50'), onClick: handleClick, children: [_jsx("span", { className: cn('border-app-border flex size-4 shrink-0 items-center justify-center rounded border', isSelected && 'bg-brand border-brand'), children: _jsx(RenderIf, { when: isSelected, children: _jsx(Check, { className: "size-3 text-[var(--on-solid)]" }) }) }), option.label] }));
23
+ }
24
+ export function MultiSelectField({ label, value, options, onChange, placeholder = 'Selecione...', errorMessage, disabled = false, maxSelected, wrapperClassName, size = 'sm', labelPosition = 'top', }) {
25
+ const [open, setOpen] = useState(false);
26
+ const [direction, setDirection] = useState('down');
27
+ const containerRef = useRef(null);
28
+ useEffect(() => {
29
+ if (!open)
30
+ return undefined;
31
+ function handleOutsideMouseDown(event) {
32
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
33
+ setOpen(false);
34
+ }
35
+ }
36
+ document.addEventListener('mousedown', handleOutsideMouseDown);
37
+ return () => document.removeEventListener('mousedown', handleOutsideMouseDown);
38
+ }, [open]);
39
+ function handleOpen() {
40
+ if (disabled)
41
+ return;
42
+ if (!open && containerRef.current) {
43
+ const rect = containerRef.current.getBoundingClientRect();
44
+ const spaceBelow = window.innerHeight - rect.bottom;
45
+ setDirection(spaceBelow < DROPDOWN_MAX_HEIGHT ? 'up' : 'down');
46
+ }
47
+ setOpen((current) => !current);
48
+ }
49
+ function handleToggle(optionValue) {
50
+ if (value.includes(optionValue)) {
51
+ onChange(value.filter((currentValue) => currentValue !== optionValue));
52
+ return;
53
+ }
54
+ if (maxSelected != null && value.length >= maxSelected)
55
+ return;
56
+ onChange([...value, optionValue]);
57
+ }
58
+ function handleRemoveChip(event, optionValue) {
59
+ event.stopPropagation();
60
+ onChange(value.filter((currentValue) => currentValue !== optionValue));
61
+ }
62
+ function handleComboboxKeyDown(event) {
63
+ if (event.key === 'Enter' || event.key === ' ') {
64
+ event.preventDefault();
65
+ handleOpen();
66
+ }
67
+ if (event.key === 'Escape')
68
+ setOpen(false);
69
+ }
70
+ const sizeClassMap = {
71
+ xs: 'min-h-7 text-xs px-2',
72
+ sm: 'min-h-9 text-sm px-3',
73
+ md: 'min-h-12 text-sm px-4',
74
+ lg: 'min-h-14 text-base px-6',
75
+ };
76
+ const triggerClass = cn('bg-surface border-app-border text-foreground w-full rounded-md border transition-colors duration-[var(--duration-normal)]', 'relative flex cursor-pointer select-none flex-wrap items-center gap-1 py-1.5 pr-8', sizeClassMap[size], !disabled && 'hover:border-brand focus:outline-none focus:ring-2 focus:ring-brand/50', errorMessage && 'border-red-500 focus:ring-red-200', disabled && 'bg-input-bg cursor-not-allowed opacity-60');
77
+ const dropdownClass = cn('bg-surface border-app-border text-foreground absolute left-0 z-[var(--z-popover)] w-full rounded-md border shadow-[var(--shadow-md)]', direction === 'down' ? 'top-full mt-1' : 'bottom-full mb-1');
78
+ const selectedOptions = options.filter((option) => value.includes(option.value));
79
+ return (_jsx(FieldControl, { label: label, wrapperClassName: wrapperClassName, errorMessage: errorMessage, disabled: disabled, size: size, labelPosition: labelPosition, children: _jsxs("div", { ref: containerRef, className: "relative", children: [_jsxs("div", { role: "combobox", "aria-expanded": open, "aria-haspopup": "listbox", tabIndex: disabled ? -1 : 0, className: triggerClass, onClick: handleOpen, onKeyDown: handleComboboxKeyDown, children: [_jsxs(RenderCase.Root, { children: [_jsx(RenderCase.If, { when: selectedOptions.length === 0, children: _jsx("span", { className: "text-foreground-muted/50 text-sm", children: placeholder }) }), _jsx(RenderCase.Else, { children: selectedOptions.map((option) => (_jsx(ChipItem, { option: option, disabled: disabled, onRemove: handleRemoveChip }, String(option.value)))) })] }), _jsx("div", { className: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2", children: _jsx(ChevronDown, { className: cn('text-foreground-muted/90 size-4 transition-transform', open && 'rotate-180') }) })] }), _jsx(RenderIf, { when: open, children: _jsx("div", { className: dropdownClass, children: _jsx("ul", { role: "listbox", "aria-multiselectable": "true", className: "max-h-52 overflow-y-auto py-1", children: options.map((option) => {
80
+ const isSelected = value.includes(option.value);
81
+ const isDisabledByMax = !isSelected && maxSelected != null && value.length >= maxSelected;
82
+ return (_jsx(OptionListItem, { option: option, isSelected: isSelected, isDisabledByMax: isDisabledByMax, onToggle: handleToggle }, String(option.value)));
83
+ }) }) }) })] }) }));
84
+ }
@@ -0,0 +1,15 @@
1
+ import { type ButtonHTMLAttributes, type ReactNode } from 'react';
2
+ export interface NavCardProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {
3
+ title: ReactNode;
4
+ description?: ReactNode;
5
+ icon?: ReactNode;
6
+ /** Oculta a seta de navegacao a direita. */
7
+ hideArrow?: boolean;
8
+ }
9
+ /**
10
+ * Card/botao navegavel generico: titulo, descricao e icone opcionais, com seta a
11
+ * direita que desliza no hover/focus. Sem regra de dominio — use para atalhos,
12
+ * itens de listas navegaveis e acessos rapidos.
13
+ */
14
+ export declare const NavCard: import("react").ForwardRefExoticComponent<NavCardProps & import("react").RefAttributes<HTMLButtonElement>>;
15
+ //# sourceMappingURL=NavCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavCard.d.ts","sourceRoot":"","sources":["../../src/components/NavCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9E,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC1F,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,4GAoCnB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { ArrowRightIcon } from 'lucide-react';
4
+ import { cn } from '../utils/cn';
5
+ /**
6
+ * Card/botao navegavel generico: titulo, descricao e icone opcionais, com seta a
7
+ * direita que desliza no hover/focus. Sem regra de dominio — use para atalhos,
8
+ * itens de listas navegaveis e acessos rapidos.
9
+ */
10
+ export const NavCard = forwardRef(({ className, description, hideArrow = false, icon, title, type = 'button', ...props }, ref) => {
11
+ return (_jsxs("button", { ref: ref, type: type, className: cn('group border-app-border bg-surface flex w-full cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-left transition-[background-color,border-color,box-shadow]', 'hover:border-[color-mix(in_srgb,var(--brand)_44%,var(--app-border))] hover:bg-[color-mix(in_srgb,var(--brand)_7%,var(--surface))] hover:shadow-[var(--shadow-action)]', 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color-mix(in_srgb,var(--brand)_36%,transparent)] focus-visible:outline-none', className), ...props, children: [icon && (_jsx("span", { className: "text-[color-mix(in_srgb,var(--brand)_68%,var(--foreground-muted))] group-hover:text-brand inline-flex shrink-0 items-center justify-center transition-colors [&_svg]:size-5", children: icon })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { className: "text-foreground line-clamp-2 text-sm leading-snug font-medium", children: title }), description && (_jsx("span", { className: "text-foreground-muted truncate text-xs", children: description }))] }), !hideArrow && (_jsx(ArrowRightIcon, { "aria-hidden": "true", className: "text-foreground-muted/50 group-hover:text-brand size-4 shrink-0 transition-transform duration-[var(--duration-fast)] group-hover:translate-x-0.5" }))] }));
12
+ });
13
+ NavCard.displayName = 'NavCard';
@@ -0,0 +1,89 @@
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode } from 'react';
2
+ import { type ActionButtonPrimitiveProps, type ActionGroupAlign, type ActionGroupSize, type ActionSeparatorPrimitiveProps } from './ActionPrimitives';
3
+ export type PageActionsPosition = 'left' | 'top' | 'bottom' | 'right';
4
+ export type PageActionsAlign = ActionGroupAlign;
5
+ export type PageActionsSize = ActionGroupSize;
6
+ export interface PageActionsProps {
7
+ children: ReactNode;
8
+ className?: string;
9
+ position?: PageActionsPosition;
10
+ defaultPosition?: PageActionsPosition;
11
+ mobilePosition?: PageActionsPosition;
12
+ allowedPositions?: PageActionsPosition[];
13
+ movable?: boolean;
14
+ onPositionChange?: (position: PageActionsPosition) => void;
15
+ onShowLabelsChange?: (showLabels: boolean) => void;
16
+ align?: PageActionsAlign;
17
+ size?: PageActionsSize;
18
+ showLabels?: boolean;
19
+ helpContent?: ReactNode;
20
+ helpLabel?: string;
21
+ helpClassName?: string;
22
+ metaActions?: ReactNode;
23
+ __fromSlot?: boolean;
24
+ }
25
+ export type PageActionsElement = ReactElement<PageActionsProps, typeof Actions>;
26
+ export type PageActionsSeparatorProps = ActionSeparatorPrimitiveProps;
27
+ export interface PageActionButtonProps extends Omit<ActionButtonPrimitiveProps, 'label'> {
28
+ label: ReactNode;
29
+ }
30
+ export interface PageActionsPreferences {
31
+ allowedPositions?: PageActionsPosition[];
32
+ defaultPosition?: PageActionsPosition;
33
+ mobilePosition?: PageActionsPosition;
34
+ movable?: boolean;
35
+ onPositionChange?: (position: PageActionsPosition) => void;
36
+ onShowLabelsChange?: (showLabels: boolean) => void;
37
+ position?: PageActionsPosition;
38
+ showLabels?: boolean;
39
+ }
40
+ export interface PageActionsHelpContentProps {
41
+ children?: ReactNode;
42
+ className?: string;
43
+ items?: ReactNode[];
44
+ title?: ReactNode;
45
+ }
46
+ declare function ActionsHelpContent({ children, className, items, title }: PageActionsHelpContentProps): import("react").JSX.Element;
47
+ declare function Actions({ align, __fromSlot, children, className, defaultPosition, mobilePosition, allowedPositions, helpClassName, helpContent, helpLabel, metaActions, movable, onShowLabelsChange, onPositionChange, position, showLabels, size, }: PageActionsProps): import("react").JSX.Element | null;
48
+ declare function ActionsSeparator(props: PageActionsSeparatorProps): import("react").JSX.Element;
49
+ declare function ActionButton({ label, tooltip, ...props }: PageActionButtonProps): import("react").JSX.Element;
50
+ interface PageRootProps extends HTMLAttributes<HTMLElement> {
51
+ children: ReactNode;
52
+ actions?: PageActionsElement;
53
+ }
54
+ declare function Root({ actions, children, className, ...props }: PageRootProps): import("react").JSX.Element;
55
+ interface PageActionsProviderProps {
56
+ children: ReactNode;
57
+ preferences?: PageActionsPreferences;
58
+ }
59
+ declare function ActionsProvider({ children, preferences }: PageActionsProviderProps): import("react").JSX.Element;
60
+ interface PageActionsSlotProps {
61
+ className?: string;
62
+ position: PageActionsPosition;
63
+ }
64
+ declare function ActionsSlot({ className, position }: PageActionsSlotProps): import("react").JSX.Element | null;
65
+ interface PageHeaderProps {
66
+ eyebrow?: string;
67
+ title?: string;
68
+ description?: string;
69
+ actions?: PageActionsElement;
70
+ }
71
+ export type PageTitleProps = HTMLAttributes<HTMLHeadingElement>;
72
+ export type PageDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
73
+ declare function Title({ children, className, ...props }: PageTitleProps): import("react").JSX.Element;
74
+ declare function Description({ children, className, ...props }: PageDescriptionProps): import("react").JSX.Element;
75
+ declare function Header({ actions, description, eyebrow, title }: PageHeaderProps): import("react").JSX.Element;
76
+ export declare const Page: {
77
+ Root: typeof Root;
78
+ Header: typeof Header;
79
+ Title: typeof Title;
80
+ Description: typeof Description;
81
+ Actions: typeof Actions;
82
+ ActionsHelpContent: typeof ActionsHelpContent;
83
+ ActionButton: typeof ActionButton;
84
+ ActionsSeparator: typeof ActionsSeparator;
85
+ ActionsProvider: typeof ActionsProvider;
86
+ ActionsSlot: typeof ActionsSlot;
87
+ };
88
+ export {};
89
+ //# sourceMappingURL=Page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,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