@wellingtonhlc/shared-ui 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +20 -4
  2. package/dist/styles.css +655 -661
  3. package/package.json +14 -2
  4. package/dist/cli/check-page-actions.d.ts +0 -9
  5. package/dist/cli/check-page-actions.d.ts.map +0 -1
  6. package/dist/cli/check-page-actions.js +0 -108
  7. package/dist/components/ActionBar.d.ts +0 -26
  8. package/dist/components/ActionBar.d.ts.map +0 -1
  9. package/dist/components/ActionBar.js +0 -29
  10. package/dist/components/ActionPrimitives.d.ts +0 -31
  11. package/dist/components/ActionPrimitives.d.ts.map +0 -1
  12. package/dist/components/ActionPrimitives.js +0 -27
  13. package/dist/components/AppShell.d.ts +0 -65
  14. package/dist/components/AppShell.d.ts.map +0 -1
  15. package/dist/components/AppShell.js +0 -50
  16. package/dist/components/AppShellActions.d.ts +0 -24
  17. package/dist/components/AppShellActions.d.ts.map +0 -1
  18. package/dist/components/AppShellActions.js +0 -15
  19. package/dist/components/Badge.d.ts +0 -16
  20. package/dist/components/Badge.d.ts.map +0 -1
  21. package/dist/components/Badge.js +0 -36
  22. package/dist/components/Banner.d.ts +0 -13
  23. package/dist/components/Banner.d.ts.map +0 -1
  24. package/dist/components/Banner.js +0 -29
  25. package/dist/components/Button.d.ts +0 -14
  26. package/dist/components/Button.d.ts.map +0 -1
  27. package/dist/components/Button.js +0 -41
  28. package/dist/components/Card.d.ts +0 -36
  29. package/dist/components/Card.d.ts.map +0 -1
  30. package/dist/components/Card.js +0 -56
  31. package/dist/components/ConfirmationDialog.d.ts +0 -74
  32. package/dist/components/ConfirmationDialog.d.ts.map +0 -1
  33. package/dist/components/ConfirmationDialog.js +0 -234
  34. package/dist/components/CopyableField.d.ts +0 -10
  35. package/dist/components/CopyableField.d.ts.map +0 -1
  36. package/dist/components/CopyableField.js +0 -60
  37. package/dist/components/DateField.d.ts +0 -19
  38. package/dist/components/DateField.d.ts.map +0 -1
  39. package/dist/components/DateField.js +0 -172
  40. package/dist/components/DecimalField.d.ts +0 -21
  41. package/dist/components/DecimalField.d.ts.map +0 -1
  42. package/dist/components/DecimalField.js +0 -137
  43. package/dist/components/DismissiblePopover.d.ts +0 -14
  44. package/dist/components/DismissiblePopover.d.ts.map +0 -1
  45. package/dist/components/DismissiblePopover.js +0 -51
  46. package/dist/components/EmptyState.d.ts +0 -15
  47. package/dist/components/EmptyState.d.ts.map +0 -1
  48. package/dist/components/EmptyState.js +0 -32
  49. package/dist/components/FieldControl.d.ts +0 -20
  50. package/dist/components/FieldControl.d.ts.map +0 -1
  51. package/dist/components/FieldControl.js +0 -73
  52. package/dist/components/FieldGroup.d.ts +0 -11
  53. package/dist/components/FieldGroup.d.ts.map +0 -1
  54. package/dist/components/FieldGroup.js +0 -11
  55. package/dist/components/FieldSkeleton.d.ts +0 -14
  56. package/dist/components/FieldSkeleton.d.ts.map +0 -1
  57. package/dist/components/FieldSkeleton.js +0 -23
  58. package/dist/components/FieldValidationError.d.ts +0 -8
  59. package/dist/components/FieldValidationError.d.ts.map +0 -1
  60. package/dist/components/FieldValidationError.js +0 -7
  61. package/dist/components/Filter.d.ts +0 -51
  62. package/dist/components/Filter.d.ts.map +0 -1
  63. package/dist/components/Filter.js +0 -68
  64. package/dist/components/Loading.d.ts +0 -17
  65. package/dist/components/Loading.d.ts.map +0 -1
  66. package/dist/components/Loading.js +0 -15
  67. package/dist/components/LoadingOverlay.d.ts +0 -11
  68. package/dist/components/LoadingOverlay.d.ts.map +0 -1
  69. package/dist/components/LoadingOverlay.js +0 -8
  70. package/dist/components/Modal.d.ts +0 -49
  71. package/dist/components/Modal.d.ts.map +0 -1
  72. package/dist/components/Modal.js +0 -108
  73. package/dist/components/MultiSelectField.d.ts +0 -22
  74. package/dist/components/MultiSelectField.d.ts.map +0 -1
  75. package/dist/components/MultiSelectField.js +0 -84
  76. package/dist/components/NavCard.d.ts +0 -15
  77. package/dist/components/NavCard.d.ts.map +0 -1
  78. package/dist/components/NavCard.js +0 -13
  79. package/dist/components/Page.d.ts +0 -89
  80. package/dist/components/Page.d.ts.map +0 -1
  81. package/dist/components/Page.js +0 -346
  82. package/dist/components/PageMessage.d.ts +0 -12
  83. package/dist/components/PageMessage.d.ts.map +0 -1
  84. package/dist/components/PageMessage.js +0 -36
  85. package/dist/components/Pagination.d.ts +0 -15
  86. package/dist/components/Pagination.d.ts.map +0 -1
  87. package/dist/components/Pagination.js +0 -57
  88. package/dist/components/PasswordInput.d.ts +0 -8
  89. package/dist/components/PasswordInput.d.ts.map +0 -1
  90. package/dist/components/PasswordInput.js +0 -17
  91. package/dist/components/RadioGroup.d.ts +0 -32
  92. package/dist/components/RadioGroup.d.ts.map +0 -1
  93. package/dist/components/RadioGroup.js +0 -86
  94. package/dist/components/RenderCase.d.ts +0 -20
  95. package/dist/components/RenderCase.d.ts.map +0 -1
  96. package/dist/components/RenderCase.js +0 -31
  97. package/dist/components/RenderIf.d.ts +0 -10
  98. package/dist/components/RenderIf.d.ts.map +0 -1
  99. package/dist/components/RenderIf.js +0 -9
  100. package/dist/components/SearchField.d.ts +0 -22
  101. package/dist/components/SearchField.d.ts.map +0 -1
  102. package/dist/components/SearchField.js +0 -43
  103. package/dist/components/SelectField.d.ts +0 -31
  104. package/dist/components/SelectField.d.ts.map +0 -1
  105. package/dist/components/SelectField.js +0 -26
  106. package/dist/components/SelectionField.d.ts +0 -39
  107. package/dist/components/SelectionField.d.ts.map +0 -1
  108. package/dist/components/SelectionField.js +0 -105
  109. package/dist/components/Sidebar.d.ts +0 -104
  110. package/dist/components/Sidebar.d.ts.map +0 -1
  111. package/dist/components/Sidebar.js +0 -146
  112. package/dist/components/StatCard.d.ts +0 -16
  113. package/dist/components/StatCard.d.ts.map +0 -1
  114. package/dist/components/StatCard.js +0 -62
  115. package/dist/components/Switch.d.ts +0 -20
  116. package/dist/components/Switch.d.ts.map +0 -1
  117. package/dist/components/Switch.js +0 -63
  118. package/dist/components/Table.d.ts +0 -32
  119. package/dist/components/Table.d.ts.map +0 -1
  120. package/dist/components/Table.js +0 -41
  121. package/dist/components/TabsUnderlined.d.ts +0 -23
  122. package/dist/components/TabsUnderlined.d.ts.map +0 -1
  123. package/dist/components/TabsUnderlined.js +0 -29
  124. package/dist/components/TextField.d.ts +0 -25
  125. package/dist/components/TextField.d.ts.map +0 -1
  126. package/dist/components/TextField.js +0 -71
  127. package/dist/components/TextareaField.d.ts +0 -14
  128. package/dist/components/TextareaField.d.ts.map +0 -1
  129. package/dist/components/TextareaField.js +0 -34
  130. package/dist/components/ThemePreferencesSelector.d.ts +0 -29
  131. package/dist/components/ThemePreferencesSelector.d.ts.map +0 -1
  132. package/dist/components/ThemePreferencesSelector.js +0 -37
  133. package/dist/components/Tooltip.d.ts +0 -13
  134. package/dist/components/Tooltip.d.ts.map +0 -1
  135. package/dist/components/Tooltip.js +0 -40
  136. package/dist/components/Workspace.d.ts +0 -20
  137. package/dist/components/Workspace.d.ts.map +0 -1
  138. package/dist/components/Workspace.js +0 -25
  139. package/dist/components/WorkspaceContext.d.ts +0 -2
  140. package/dist/components/WorkspaceContext.d.ts.map +0 -1
  141. package/dist/components/WorkspaceContext.js +0 -2
  142. package/dist/components/form-control-helpers.d.ts +0 -24
  143. package/dist/components/form-control-helpers.d.ts.map +0 -1
  144. package/dist/components/form-control-helpers.js +0 -20
  145. package/dist/index.d.ts +0 -45
  146. package/dist/index.d.ts.map +0 -1
  147. package/dist/index.js +0 -44
  148. package/dist/tailwind-preset.d.ts +0 -23
  149. package/dist/tailwind-preset.d.ts.map +0 -1
  150. package/dist/tailwind-preset.js +0 -22
  151. package/dist/utils/cn.d.ts +0 -2
  152. package/dist/utils/cn.d.ts.map +0 -1
  153. package/dist/utils/cn.js +0 -33
@@ -1,146 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
3
- import { cn } from '../utils/cn';
4
- const Root = forwardRef(function SidebarRoot({ ariaLabel = 'Menu lateral', children, className, desktopWidthClass = 'lg:w-72', isOpen, mobileWidthClass = 'w-72', }, ref) {
5
- return (_jsx("aside", { ref: ref, "aria-label": ariaLabel, "data-open": isOpen, className: cn('border-app-border bg-background-secondary fixed inset-y-0 left-0 z-40 flex h-full w-20 shrink-0 -translate-x-full flex-col justify-between overflow-visible border-r px-2 transition-[width,transform] duration-300 ease-in-out data-[open=true]:w-4/5 data-[open=true]:translate-x-0 md:static md:z-[60] md:w-20 md:translate-x-0 md:shadow-none md:data-[open=true]:w-72', isOpen && `${mobileWidthClass} ${desktopWidthClass}`, className), children: children }));
6
- });
7
- function Content({ ariaLabel = 'Navegação principal', children, className }) {
8
- return (_jsx("nav", { "aria-label": ariaLabel, className: cn('flex min-h-0 w-full flex-1 flex-col', className), children: children }));
9
- }
10
- function Header({ children, className }) {
11
- return _jsx("div", { className: cn('flex h-16 w-full flex-none items-center', className), children: children });
12
- }
13
- function List({ children, className, isOpen }) {
14
- const listRef = useRef(null);
15
- useEffect(() => {
16
- if (!isOpen)
17
- return;
18
- const activeItem = listRef.current?.querySelector('[data-sidebar-active="true"]');
19
- activeItem?.scrollIntoView({ block: 'nearest' });
20
- }, [children, isOpen]);
21
- return (_jsx("ul", { ref: listRef, className: cn('flex min-h-0 w-full flex-1 flex-col gap-2', isOpen ? 'overflow-y-auto overflow-x-hidden' : 'overflow-visible', className), children: children }));
22
- }
23
- function Footer({ children, className }) {
24
- return _jsx("footer", { className: cn('border-app-border flex w-full flex-col border-t py-2', className), children: children });
25
- }
26
- function Separator({ className, flush = false }) {
27
- return (_jsx("div", { "aria-hidden": "true", className: cn('border-app-border w-full border-t', flush && 'my-0', className) }));
28
- }
29
- const ToggleButton = forwardRef(function SidebarToggleButton({ className, closedLabel = 'Abrir menu lateral', icon, isOpen, onToggle, openLabel = 'Recolher menu lateral' }, ref) {
30
- return (_jsx("button", { ref: ref, type: "button", onClick: onToggle, "aria-label": isOpen ? openLabel : closedLabel, "aria-expanded": isOpen, "data-open": isOpen, className: cn('border-app-border text-foreground-muted focus-visible:ring-brand/35 flex w-14 flex-none cursor-pointer items-center rounded-xl border bg-[rgb(var(--color-brand)/0.08)] transition-[width,background-color,color] focus-visible:ring-2 focus-visible:outline-none hover:bg-[rgb(var(--color-brand)/0.11)] hover:text-foreground data-[open=true]:w-full dark:bg-[rgb(var(--color-brand)/0.13)] dark:hover:bg-[rgb(var(--color-brand)/0.16)] dark:hover:text-foreground', className), children: _jsx("span", { className: "grid w-14 flex-none place-items-center py-2", children: icon }) }));
31
- });
32
- const ActionButton = forwardRef(function SidebarActionButton({ active = false, className, expanded = false, icon, isOpen, label, labelClassName, showChevron = false, size = 'default', title, tone = 'nav', type = 'button', ...props }, ref) {
33
- return (_jsxs("button", { ref: ref, type: type, title: title ? (typeof label === 'string' && !isOpen ? label : undefined) : undefined, "data-sidebar-active": active ? 'true' : undefined, className: cn(sidebarButtonClasses(active, size, tone), className), ...props, children: [_jsx("span", { className: cn('grid w-14 min-w-14 flex-none place-items-center transition-colors', size === 'compact' ? 'h-9' : 'h-11', active ? 'text-current' : 'text-current'), children: icon }), _jsx("span", { className: cn('min-w-0 flex-1 truncate text-left font-medium whitespace-nowrap transition-opacity duration-200', size === 'compact' ? 'text-xs max-md:text-base' : 'text-[13px] max-md:text-base', isOpen ? 'opacity-100' : 'pointer-events-none w-0 opacity-0', labelClassName), children: label }), _jsx("span", { className: cn('grid flex-none place-items-center', size === 'compact' ? 'h-9 w-6' : 'h-11 w-7', showChevron && isOpen ? 'opacity-100' : 'opacity-0'), children: _jsx(ChevronIcon, { expanded: expanded }) })] }));
34
- });
35
- const SubActionButton = forwardRef(function SidebarSubActionButton({ active = false, className, isOpen, label, size = 'compact', title, type = 'button', ...props }, ref) {
36
- return (_jsx("button", { ref: ref, type: type, title: title ? (typeof label === 'string' && !isOpen ? label : undefined) : undefined, "data-sidebar-active": active ? 'true' : undefined, className: cn('focus-visible:ring-brand/35 flex w-full cursor-pointer items-center rounded-xl font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none', size === 'compact' ? 'h-9 min-h-9 text-xs' : 'h-11 min-h-11 text-[13px]', isOpen ? 'justify-start pl-14' : 'justify-center', subActionButtonTone(active, size), className), ...props, children: _jsx("span", { className: cn('truncate', isOpen ? 'opacity-100' : 'sr-only'), children: label }) }));
37
- });
38
- function NavGroup({ active = false, className, collapsible = false, defaultExpanded, icon, isOpen, items, subItemSize = 'compact', title, }) {
39
- const itemByKey = useMemo(() => new Map(items.map((item) => [item.key, item])), [items]);
40
- const [expanded, setExpanded] = useState(defaultExpanded ?? (active ? !collapsible : false));
41
- const [hovered, setHovered] = useState(false);
42
- const [labelVisible, setLabelVisible] = useState(isOpen);
43
- const openHoverTimerRef = useRef(null);
44
- const closeHoverTimerRef = useRef(null);
45
- const groupActive = active || items.some((item) => item.active);
46
- const singleItem = !collapsible && items.length === 1 ? items[0] : null;
47
- useEffect(() => {
48
- if (isOpen) {
49
- setLabelVisible(true);
50
- return undefined;
51
- }
52
- setLabelVisible(false);
53
- return undefined;
54
- }, [isOpen]);
55
- useEffect(() => {
56
- if (groupActive) {
57
- setExpanded(true);
58
- }
59
- }, [groupActive]);
60
- useEffect(() => () => {
61
- clearHoverTimer(openHoverTimerRef);
62
- clearHoverTimer(closeHoverTimerRef);
63
- }, []);
64
- function handleSingleItemClick(event) {
65
- singleItem?.onSelect?.(event);
66
- }
67
- function handleGroupClick(event) {
68
- if (!isOpen) {
69
- items[0]?.onSelect?.(event);
70
- return;
71
- }
72
- if (collapsible) {
73
- setExpanded((current) => !current);
74
- }
75
- }
76
- function handleMouseEnter() {
77
- clearHoverTimer(closeHoverTimerRef);
78
- clearHoverTimer(openHoverTimerRef);
79
- openHoverTimerRef.current = setTimeout(() => setHovered(true), 280);
80
- }
81
- function handleMouseLeave() {
82
- clearHoverTimer(openHoverTimerRef);
83
- clearHoverTimer(closeHoverTimerRef);
84
- closeHoverTimerRef.current = setTimeout(() => setHovered(false), 350);
85
- }
86
- function handleItemSelect(event) {
87
- const key = event.currentTarget.dataset.sidebarItemKey;
88
- const item = key ? itemByKey.get(key) : undefined;
89
- item?.onSelect?.(event);
90
- setHovered(false);
91
- }
92
- if (singleItem) {
93
- return (_jsx("li", { className: cn('w-full', className), children: _jsx(ActionButton, { active: singleItem.active, icon: singleItem.icon ?? icon, isOpen: isOpen, label: singleItem.label, onClick: handleSingleItemClick, title: singleItem.title, tone: "subtle" }) }));
94
- }
95
- return (_jsxs("li", { className: cn('relative w-full', className), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx(ActionButton, { active: groupActive, "aria-expanded": isOpen ? expanded : undefined, icon: icon, isOpen: isOpen, label: title, labelClassName: labelVisible ? 'opacity-100' : 'opacity-0', onClick: handleGroupClick, expanded: expanded, showChevron: collapsible && isOpen, tone: "subtle" }), isOpen ? (_jsx("div", { className: "grid grid-rows-[0fr] opacity-0 transition-[grid-template-rows,opacity] duration-200 ease-out data-[expanded=true]:grid-rows-[1fr] data-[expanded=true]:opacity-100", "data-expanded": expanded, children: _jsx("div", { className: "relative min-h-0 overflow-hidden", children: _jsx("ul", { className: "flex w-full flex-col", children: items.map((item, index) => (_jsxs("li", { className: "relative w-full", children: [_jsx("span", { "aria-hidden": "true", className: cn('bg-app-border absolute left-7 top-0 w-px', index === items.length - 1 ? 'h-1/2' : 'bottom-0') }), _jsx("span", { "aria-hidden": "true", className: "bg-app-border absolute left-7 top-1/2 h-px w-5" }), _jsx(SubActionButton, { active: item.active, "data-sidebar-item-key": item.key, isOpen: isOpen, label: item.label, onClick: handleItemSelect, size: subItemSize, title: item.title })] }, item.key))) }) }) })) : (_jsx(Flyout, { open: hovered, title: title, items: items, onItemSelect: handleItemSelect }))] }));
96
- }
97
- function Flyout({ items, onItemSelect, open, title }) {
98
- return (_jsxs("div", { className: "border-app-border bg-background-secondary invisible pointer-events-none absolute left-[calc(100%+0.375rem)] top-0 z-[70] min-w-52 -translate-x-2 overflow-hidden rounded-xl border p-2 opacity-0 shadow-[0_8px_24px_-4px_rgba(0,0,0,0.16),0_2px_8px_-2px_rgba(0,0,0,0.08)] transition-[opacity,transform,visibility] duration-150 data-[open=true]:visible data-[open=true]:pointer-events-auto data-[open=true]:translate-x-0 data-[open=true]:opacity-100", "data-open": open, children: [_jsx("span", { "aria-hidden": "true", className: "absolute right-full top-0 h-full w-2.5" }), _jsx("p", { className: "text-foreground-muted mb-2 text-[11px] font-semibold uppercase tracking-[0.14em]", children: title }), _jsx("div", { className: "flex max-h-[calc(100vh-5rem)] flex-col overflow-y-auto", children: items.map((item) => (_jsxs("button", { type: "button", "data-sidebar-item-key": item.key, onClick: onItemSelect, className: cn('group focus-visible:ring-brand/35 flex h-9 min-h-9 w-full cursor-pointer items-center gap-2 rounded-lg text-left text-xs font-medium leading-none transition-colors focus-visible:ring-2 focus-visible:outline-none', item.active
99
- ? '!bg-[rgb(var(--color-brand)/0.08)] text-foreground font-semibold shadow-[inset_0_0_0_1px_rgb(var(--color-brand)/0.10)] hover:!bg-[rgb(var(--color-brand)/0.12)] dark:!bg-[rgb(var(--color-brand)/0.13)] dark:text-foreground dark:hover:!bg-[rgb(var(--color-brand)/0.17)]'
100
- : '!bg-transparent text-foreground-muted hover:!bg-[rgb(var(--color-brand)/0.12)] hover:text-foreground hover:font-semibold dark:hover:!bg-[rgb(var(--color-brand)/0.17)] dark:hover:text-foreground'), children: [_jsx("span", { className: "grid h-3.5 w-3.5 flex-none place-items-center text-current transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5", children: item.icon }), _jsx("span", { className: "flex min-h-4 items-center leading-none", children: item.label })] }, item.key))) })] }));
101
- }
102
- function subActionButtonTone(active, size) {
103
- if (size === 'compact') {
104
- return active
105
- ? '!bg-[rgb(var(--color-brand)/0.08)] text-foreground font-semibold shadow-[inset_0_0_0_1px_rgb(var(--color-brand)/0.10)] hover:!bg-[rgb(var(--color-brand)/0.12)] dark:!bg-[rgb(var(--color-brand)/0.13)] dark:text-foreground dark:hover:!bg-[rgb(var(--color-brand)/0.17)]'
106
- : '!bg-transparent text-foreground-muted hover:!bg-[rgb(var(--color-brand)/0.12)] hover:text-foreground hover:font-semibold dark:hover:!bg-[rgb(var(--color-brand)/0.17)] dark:hover:text-foreground';
107
- }
108
- return active
109
- ? 'bg-[rgb(var(--color-brand)/0.08)] text-foreground font-semibold dark:bg-[rgb(var(--color-brand)/0.13)] dark:text-foreground'
110
- : 'text-foreground-muted hover:bg-[rgb(var(--color-brand)/0.12)] hover:text-foreground hover:font-semibold dark:hover:bg-[rgb(var(--color-brand)/0.17)] dark:hover:text-foreground';
111
- }
112
- function sidebarButtonClasses(active, size, tone) {
113
- return cn('group focus-visible:ring-brand/35 flex w-full cursor-pointer items-center rounded-xl bg-transparent text-left transition-colors focus-visible:ring-2 focus-visible:outline-none', size === 'compact' ? 'h-9 min-h-9' : 'h-11 min-h-11', actionButtonTone(active, tone));
114
- }
115
- function actionButtonTone(active, tone) {
116
- if (tone === 'subtle') {
117
- return active
118
- ? '!bg-[rgb(var(--color-brand)/0.08)] text-foreground font-semibold shadow-[inset_0_0_0_1px_rgb(var(--color-brand)/0.12)] hover:!bg-[rgb(var(--color-brand)/0.12)] dark:!bg-[rgb(var(--color-brand)/0.13)] dark:text-foreground dark:shadow-[inset_0_0_0_1px_rgb(var(--color-brand)/0.18)] dark:hover:!bg-[rgb(var(--color-brand)/0.17)]'
119
- : '!bg-transparent text-foreground-muted hover:!bg-[rgb(var(--color-brand)/0.12)] hover:text-foreground hover:font-semibold dark:hover:!bg-[rgb(var(--color-brand)/0.17)] dark:hover:text-foreground';
120
- }
121
- return active
122
- ? 'bg-white/80 text-foreground font-semibold shadow-[inset_0_0_0_1px_rgba(15,23,42,0.06)] dark:bg-white/[0.08] dark:text-foreground'
123
- : 'text-foreground-muted hover:bg-white/70 hover:text-foreground hover:shadow-[inset_0_0_0_1px_rgba(15,23,42,0.05)] dark:hover:bg-white/[0.06] dark:hover:text-foreground';
124
- }
125
- function clearHoverTimer(timerRef) {
126
- if (timerRef.current) {
127
- clearTimeout(timerRef.current);
128
- timerRef.current = null;
129
- }
130
- }
131
- function ChevronIcon({ expanded }) {
132
- return (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: cn('h-4 w-4 transition-transform duration-200', expanded && 'rotate-180'), fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.8", children: _jsx("path", { d: "m6 8 4 4 4-4" }) }));
133
- }
134
- export const Sidebar = {
135
- Root,
136
- Content,
137
- Header,
138
- List,
139
- Footer,
140
- Separator,
141
- ToggleButton,
142
- ActionButton,
143
- SubActionButton,
144
- NavGroup,
145
- Flyout,
146
- };
@@ -1,16 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export type StatCardVariant = 'default' | 'success' | 'info' | 'warning' | 'danger';
3
- export type StatCardSize = 'sm' | 'md' | 'lg';
4
- export interface StatCardProps<TValue> {
5
- className?: string;
6
- description?: ReactNode;
7
- format?: (value: TValue) => ReactNode;
8
- icon?: ReactNode;
9
- label: ReactNode;
10
- size?: StatCardSize;
11
- value: TValue;
12
- variant?: StatCardVariant;
13
- valueClassName?: string;
14
- }
15
- export declare function StatCard<TValue>({ className, description, format, icon, label, size, value, variant, valueClassName, }: StatCardProps<TValue>): import("react").JSX.Element;
16
- //# sourceMappingURL=StatCard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatCard.d.ts","sourceRoot":"","sources":["../../src/components/StatCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AACpF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,WAAW,aAAa,CAAC,MAAM;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAmED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,EAC/B,SAAS,EACT,WAAW,EACX,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAW,EACX,KAAK,EACL,OAAmB,EACnB,cAAc,GACf,EAAE,aAAa,CAAC,MAAM,CAAC,+BAiCvB"}
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from '../utils/cn';
3
- const variantClasses = {
4
- default: {
5
- container: 'app-stat-card--default shadow-sm',
6
- label: 'app-stat-card__label--default',
7
- value: 'app-stat-card__value--default',
8
- description: 'app-stat-card__description--default',
9
- icon: 'app-stat-card__icon--default',
10
- },
11
- success: {
12
- container: 'app-stat-card--success shadow-sm',
13
- label: 'app-stat-card__label--success',
14
- value: 'app-stat-card__value--success',
15
- description: 'app-stat-card__description--success',
16
- icon: 'app-stat-card__icon--success',
17
- },
18
- info: {
19
- container: 'app-stat-card--info shadow-sm',
20
- label: 'app-stat-card__label--info',
21
- value: 'app-stat-card__value--info',
22
- description: 'app-stat-card__description--info',
23
- icon: 'app-stat-card__icon--info',
24
- },
25
- warning: {
26
- container: 'app-stat-card--warning shadow-sm',
27
- label: 'app-stat-card__label--warning',
28
- value: 'app-stat-card__value--warning',
29
- description: 'app-stat-card__description--warning',
30
- icon: 'app-stat-card__icon--warning',
31
- },
32
- danger: {
33
- container: 'app-stat-card--danger shadow-sm',
34
- label: 'app-stat-card__label--danger',
35
- value: 'app-stat-card__value--danger',
36
- description: 'app-stat-card__description--danger',
37
- icon: 'app-stat-card__icon--danger',
38
- },
39
- };
40
- const sizeClasses = {
41
- sm: {
42
- container: 'px-3 py-3',
43
- icon: 'size-4',
44
- value: 'text-lg',
45
- },
46
- md: {
47
- container: 'px-4 py-4',
48
- icon: 'size-5',
49
- value: 'text-2xl',
50
- },
51
- lg: {
52
- container: 'px-4 py-4',
53
- icon: 'size-5',
54
- value: 'text-3xl',
55
- },
56
- };
57
- export function StatCard({ className, description, format, icon, label, size = 'md', value, variant = 'default', valueClassName, }) {
58
- const variantStyle = variantClasses[variant];
59
- const sizeStyle = sizeClasses[size];
60
- const formattedValue = format ? format(value) : String(value ?? '-');
61
- return (_jsxs("div", { className: cn('app-stat-card rounded-xl border', variantStyle.container, sizeStyle.container, className), children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("div", { className: cn('min-w-0 text-xs font-medium tracking-wide uppercase', variantStyle.label), children: label }), icon && (_jsx("div", { className: cn('shrink-0 [&>svg]:size-full', sizeStyle.icon, variantStyle.icon), children: icon }))] }), _jsx("div", { className: cn('mt-1 font-semibold', sizeStyle.value, variantStyle.value, valueClassName), children: formattedValue }), description && (_jsx("div", { className: cn('mt-1 text-xs', size === 'lg' && 'min-h-8 leading-4', variantStyle.description), children: description }))] }));
62
- }
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { type FieldValues } from 'react-hook-form';
3
- export interface SwitchProps<TFieldValues extends FieldValues = FieldValues> extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
4
- checked?: boolean;
5
- onChange?: (checked: boolean) => void;
6
- label?: string;
7
- errorMessage?: string;
8
- wrapperClassName?: string;
9
- labelClassName?: string;
10
- labelPosition?: 'top' | 'right' | 'bottom' | 'left';
11
- display?: 'field' | 'inline';
12
- size?: 'xs' | 'sm' | 'md' | 'lg';
13
- control?: unknown;
14
- rules?: unknown;
15
- }
16
- export declare function Switch<TFieldValues extends FieldValues = FieldValues>(props: SwitchProps<TFieldValues>): React.JSX.Element;
17
- export declare namespace Switch {
18
- var displayName: string;
19
- }
20
- //# sourceMappingURL=Switch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,iBAAiB,CAAC;AAKzB,MAAM,WAAW,WAAW,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,CACzE,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyJD,wBAAgB,MAAM,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,qBAMtG;yBANe,MAAM"}
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useController, } from 'react-hook-form';
3
- import { cn } from '../utils/cn';
4
- import { FieldControl } from './FieldControl';
5
- const switchSizeClasses = {
6
- xs: {
7
- root: 'h-4 w-7 min-w-7 max-w-7 p-0.5',
8
- thumb: 'size-3',
9
- offset: 12,
10
- },
11
- sm: {
12
- root: 'h-5 w-9 min-w-9 max-w-9 p-0.5',
13
- thumb: 'size-4',
14
- offset: 16,
15
- },
16
- md: {
17
- root: 'h-5 w-10 min-w-10 max-w-10 p-0.5',
18
- thumb: 'size-4',
19
- offset: 20,
20
- },
21
- lg: {
22
- root: 'h-6 w-11 min-w-11 max-w-11 p-0.5',
23
- thumb: 'size-5',
24
- offset: 20,
25
- },
26
- };
27
- function SwitchBase({ checked, className, errorMessage, id, inputChecked, inputDisabled, inputName, inputOnBlur, label, labelClassName = '', labelPosition = 'left', display = 'field', name, onChange, onCheckedChange, size = 'md', wrapperClassName, ...props }) {
28
- const resolvedChecked = inputChecked ?? checked;
29
- const resolvedName = inputName ?? name;
30
- const resolvedDisabled = inputDisabled ?? props.disabled;
31
- const componentId = id || resolvedName;
32
- const isHorizontal = labelPosition === 'left' || labelPosition === 'right';
33
- const sizeClasses = switchSizeClasses[size];
34
- function handleClick() {
35
- const nextChecked = !resolvedChecked;
36
- onCheckedChange?.(nextChecked);
37
- onChange?.(nextChecked);
38
- }
39
- const button = (controlId, describedBy, disabled = resolvedDisabled) => (_jsx("button", { type: "button", role: "switch", "aria-checked": !!resolvedChecked, "aria-label": label, "aria-describedby": describedBy, id: controlId, name: resolvedName, onClick: handleClick, onBlur: inputOnBlur, disabled: disabled, "data-checked": !!resolvedChecked, className: cn('app-switch focus:ring-brand/50 inline-flex shrink-0 flex-none self-center rounded-full transition-colors duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none', sizeClasses.root, disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer', className), ...props, children: _jsx("span", { className: cn('app-switch__thumb block rounded-full shadow-sm transition-transform duration-200', sizeClasses.thumb), style: { transform: `translateX(${resolvedChecked ? sizeClasses.offset : 0}px)` } }) }));
40
- if (display === 'inline') {
41
- const labelElement = label ? (_jsx("span", { className: cn('min-w-0 flex-1 text-sm font-medium leading-snug text-foreground', labelClassName), children: label })) : null;
42
- const isLabelAfter = labelPosition === 'right' || labelPosition === 'bottom';
43
- const isVertical = labelPosition === 'top' || labelPosition === 'bottom';
44
- return (_jsxs("div", { className: cn('flex gap-3', isVertical ? 'flex-col items-start' : 'items-center justify-between', resolvedDisabled && 'opacity-70', wrapperClassName), "data-disabled": resolvedDisabled || undefined, children: [!isLabelAfter && labelElement, button(componentId, undefined, resolvedDisabled), isLabelAfter && labelElement] }));
45
- }
46
- return (_jsx(FieldControl, { label: label, id: componentId, labelClassName: cn('whitespace-nowrap leading-none', isHorizontal && 'self-center', labelClassName), labelPosition: labelPosition, wrapperClassName: wrapperClassName, errorMessage: errorMessage, size: size, disabled: resolvedDisabled, children: ({ controlId, describedBy, disabled }) => (button(controlId, describedBy, disabled)) }));
47
- }
48
- function HookFormSwitch(props) {
49
- const { control, name, rules, ...rest } = props;
50
- const { field } = useController({
51
- control: control,
52
- name: name,
53
- rules: rules,
54
- });
55
- return _jsx(SwitchBase, { ...rest, name: name, inputName: field.name, inputChecked: !!field.value, inputDisabled: field.disabled, inputOnBlur: () => field.onBlur(), onCheckedChange: (nextChecked) => field.onChange(nextChecked) });
56
- }
57
- export function Switch(props) {
58
- if (props.control && props.name) {
59
- return _jsx(HookFormSwitch, { ...props });
60
- }
61
- return _jsx(SwitchBase, { ...props });
62
- }
63
- Switch.displayName = 'Switch';
@@ -1,32 +0,0 @@
1
- import { type ButtonHTMLAttributes, type HTMLAttributes, type TableHTMLAttributes, type TdHTMLAttributes, type ThHTMLAttributes } from 'react';
2
- import { Pagination } from './Pagination';
3
- interface TableRootProps extends TableHTMLAttributes<HTMLTableElement> {
4
- chrome?: 'default' | 'flat';
5
- density?: 'default' | 'compact';
6
- fill?: boolean;
7
- isFramed?: boolean;
8
- viewportClassName?: string;
9
- wrapperClassName?: string;
10
- wrapperProps?: HTMLAttributes<HTMLDivElement>;
11
- }
12
- interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
13
- isInteractive?: boolean;
14
- }
15
- interface TableActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
16
- variant?: 'default' | 'ghost' | 'danger';
17
- tooltip?: string;
18
- }
19
- export declare const Table: {
20
- Root: import("react").ForwardRefExoticComponent<TableRootProps & import("react").RefAttributes<HTMLTableElement>>;
21
- Header: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
22
- Body: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
23
- Footer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
24
- Row: import("react").ForwardRefExoticComponent<TableRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
25
- Head: import("react").ForwardRefExoticComponent<ThHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
26
- Cell: import("react").ForwardRefExoticComponent<TdHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
27
- ActionCell: import("react").ForwardRefExoticComponent<TdHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
28
- Action: import("react").ForwardRefExoticComponent<TableActionProps & import("react").RefAttributes<HTMLButtonElement>>;
29
- Pagination: typeof Pagination;
30
- };
31
- export {};
32
- //# sourceMappingURL=Table.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,UAAU,cAAe,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACpE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CAC/C;AA4ED,UAAU,aAAc,SAAQ,cAAc,CAAC,mBAAmB,CAAC;IACjE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAmDD,UAAU,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAkBD,eAAO,MAAM,KAAK;;;;;;;;;;;CAWjB,CAAC"}
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, forwardRef, isValidElement, } from 'react';
3
- import { cn } from '../utils/cn';
4
- import { Button } from './Button';
5
- import { Pagination } from './Pagination';
6
- const Root = forwardRef(({ children, chrome = 'default', className, density = 'default', fill = true, isFramed = true, viewportClassName, wrapperClassName, wrapperProps, ...props }, ref) => {
7
- const childNodes = Children.toArray(children);
8
- const tableChildren = childNodes.filter((child) => !isValidElement(child) || child.type !== Pagination);
9
- const paginationChildren = childNodes.filter((child) => isValidElement(child) && child.type === Pagination);
10
- const { className: wrapperPropsClassName, ...resolvedWrapperProps } = wrapperProps ?? {};
11
- return (_jsxs("div", { ...resolvedWrapperProps, "data-slot": "table-root", className: cn('bg-surface flex w-full min-w-0 flex-col overflow-hidden', fill && 'h-full min-h-0 grow', isFramed && 'border-app-border rounded-[var(--radius)] border', isFramed && chrome === 'default' && 'shadow-[0_4px_6px_-1px_rgb(0_0_0/0.07),0_2px_4px_-2px_rgb(0_0_0/0.05)]', density === 'compact' && '[&_td]:py-2 [&_th]:py-2', wrapperPropsClassName, wrapperClassName), children: [_jsx("div", { className: cn('min-h-0 flex-1 overflow-auto', viewportClassName), children: _jsx("table", { ref: ref, className: cn('w-full border-separate border-spacing-0 caption-bottom text-sm text-foreground', className), ...props, children: tableChildren }) }), paginationChildren.length > 0 && (_jsx("div", { "data-slot": "table-pagination", className: cn('border-app-border bg-background-secondary shrink-0 border-t px-3 py-2', density === 'compact' && 'px-3 py-2'), children: paginationChildren }))] }));
12
- });
13
- Root.displayName = 'Table.Root';
14
- const Header = forwardRef(({ className, ...props }, ref) => _jsx("thead", { ref: ref, className: cn('bg-background-secondary', className), ...props }));
15
- Header.displayName = 'Table.Header';
16
- const Body = forwardRef(({ className, ...props }, ref) => _jsx("tbody", { ref: ref, className: className, ...props }));
17
- Body.displayName = 'Table.Body';
18
- const Footer = forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref: ref, className: cn('border-app-border bg-background border-t font-medium', className), ...props })));
19
- Footer.displayName = 'Table.Footer';
20
- const Row = forwardRef(({ className, isInteractive = true, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn('transition-colors hover:bg-[color-mix(in_srgb,var(--brand)_5%,transparent)] last:[&>td]:border-b-0', isInteractive && 'cursor-pointer', className), ...props })));
21
- Row.displayName = 'Table.Row';
22
- const Head = forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn('border-app-border bg-background-secondary sticky top-0 z-[2] h-10 whitespace-nowrap border-b px-3 py-2.5 text-left align-middle text-xs font-extrabold tracking-[0.045em] text-foreground-muted uppercase', className), ...props })));
23
- Head.displayName = 'Table.Head';
24
- const Cell = forwardRef(({ className, ...props }, ref) => (_jsx("td", { ref: ref, className: cn('border-app-border border-b px-3 py-2.5 align-middle text-foreground', className), ...props })));
25
- Cell.displayName = 'Table.Cell';
26
- const ActionCell = forwardRef(({ children, className, ...props }, ref) => (_jsx("td", { ref: ref, className: cn('px-2 py-1.5 text-center align-middle', className), ...props, children: _jsx("div", { className: "flex min-h-8 items-center justify-center gap-2", children: children }) })));
27
- ActionCell.displayName = 'Table.ActionCell';
28
- const Action = forwardRef(({ className, variant = 'default', tooltip, ...props }, ref) => (_jsx(Button, { ref: ref, "aria-label": props['aria-label'] ?? tooltip, className: className, size: "sm", variant: variant === 'danger' ? 'danger' : variant === 'ghost' ? 'ghost' : 'secondary', tooltip: tooltip, ...props })));
29
- Action.displayName = 'Table.Action';
30
- export const Table = {
31
- Root,
32
- Header,
33
- Body,
34
- Footer,
35
- Row,
36
- Head,
37
- Cell,
38
- ActionCell,
39
- Action,
40
- Pagination,
41
- };
@@ -1,23 +0,0 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
2
- export interface UnderlinedTabItem {
3
- id: string;
4
- label: string;
5
- visible?: boolean;
6
- children: ReactNode;
7
- }
8
- export interface TabsUnderlinedProps {
9
- items: UnderlinedTabItem[];
10
- defaultValue?: string;
11
- value?: string;
12
- onValueChange?: (value: string) => void;
13
- className?: string;
14
- listClassName?: string;
15
- triggerClassName?: string;
16
- contentClassName?: string;
17
- tabWidth?: CSSProperties['width'];
18
- tabMinWidth?: CSSProperties['minWidth'];
19
- tabMaxWidth?: CSSProperties['maxWidth'];
20
- truncateLabels?: boolean;
21
- }
22
- export declare function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, tabMaxWidth, tabMinWidth, tabWidth, triggerClassName, truncateLabels, value, }: TabsUnderlinedProps): import("react").JSX.Element;
23
- //# sourceMappingURL=TabsUnderlined.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabsUnderlined.d.ts","sourceRoot":"","sources":["../../src/components/TabsUnderlined.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAa9E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,cAAsB,EACtB,KAAK,GACN,EAAE,mBAAmB,+BA4DrB"}
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from 'react';
3
- import * as Tabs from '@radix-ui/react-tabs';
4
- import { cn } from '../utils/cn';
5
- const DEFAULT_TAB_MIN_WIDTH = '8.75rem';
6
- const TAB_BAR_BACKGROUND = 'bg-[color-mix(in_srgb,var(--foreground-muted)_5%,var(--background-secondary))]';
7
- const TAB_INACTIVE_BACKGROUND = 'bg-[color-mix(in_srgb,var(--foreground-muted)_5%,var(--background-secondary))]';
8
- const TAB_INACTIVE_HOVER_BACKGROUND = 'hover:bg-[color-mix(in_srgb,var(--foreground-muted)_8%,var(--background-secondary))]';
9
- export function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, tabMaxWidth, tabMinWidth, tabWidth, triggerClassName, truncateLabels = false, value, }) {
10
- const visibleItems = useMemo(() => items.filter((item) => item.visible ?? true), [items]);
11
- const initialValue = defaultValue && visibleItems.some((item) => item.id === defaultValue)
12
- ? defaultValue
13
- : visibleItems[0]?.id || '';
14
- const [internalValue, setInternalValue] = useState(initialValue);
15
- const resolvedValue = value ?? internalValue;
16
- function handleValueChange(nextValue) {
17
- setInternalValue(nextValue);
18
- onValueChange?.(nextValue);
19
- }
20
- return (_jsx("div", { className: cn('border-app-border bg-background-secondary flex h-full min-w-0 flex-col overflow-hidden rounded-xl border', className), children: _jsxs(Tabs.Root, { value: resolvedValue, onValueChange: handleValueChange, className: "flex min-w-0 flex-1 flex-col", children: [_jsx(Tabs.List, { className: cn('border-app-border flex min-w-0 overflow-x-auto overflow-y-hidden border-b text-sm', TAB_BAR_BACKGROUND, listClassName), children: visibleItems.map((item) => (_jsx(TabTrigger, { value: item.id, className: triggerClassName, maxWidth: tabMaxWidth, minWidth: tabMinWidth, width: tabWidth, truncate: truncateLabels, children: item.label }, item.id))) }), visibleItems.map((item) => (_jsx(Tabs.Content, { value: item.id, className: cn('flex h-full min-w-0 flex-1 flex-col overflow-hidden', contentClassName), children: item.children }, item.id)))] }) }));
21
- }
22
- function TabTrigger({ children, className, value, maxWidth, minWidth, width, truncate, }) {
23
- const style = {
24
- maxWidth,
25
- minWidth: minWidth ?? DEFAULT_TAB_MIN_WIDTH,
26
- width,
27
- };
28
- return (_jsx(Tabs.Trigger, { value: value, style: style, className: cn('text-foreground-muted hover:text-foreground focus-visible:ring-brand/50 data-[state=active]:border-app-border data-[state=active]:border-b-background-secondary data-[state=active]:bg-background-secondary data-[state=active]:text-foreground -mb-px inline-flex shrink-0 cursor-pointer items-center justify-center border border-t-0 border-transparent px-4 py-2 text-sm font-medium transition-colors first:border-l-0 focus:outline-none focus-visible:ring-2', TAB_INACTIVE_BACKGROUND, TAB_INACTIVE_HOVER_BACKGROUND, className), children: _jsx("span", { className: cn('min-w-0', truncate && 'overflow-hidden text-ellipsis whitespace-nowrap'), children: children }) }));
29
- }
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { type FormControlVariant } from './form-control-helpers';
3
- export type TextFieldVariant = FormControlVariant;
4
- export type TextFieldIconPosition = 'left' | 'right';
5
- export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
6
- wrapperClassName?: string;
7
- labelClassName?: string;
8
- label?: string;
9
- errorMessage?: string;
10
- error?: string;
11
- helperText?: string;
12
- hasValidation?: boolean;
13
- roundedFull?: boolean;
14
- size?: 'xs' | 'sm' | 'md' | 'lg';
15
- labelPosition?: 'top' | 'right' | 'bottom' | 'left';
16
- variant?: TextFieldVariant;
17
- icon?: React.ReactNode;
18
- iconPosition?: TextFieldIconPosition;
19
- children?: React.ReactNode;
20
- startAdornment?: React.ReactNode;
21
- endAdornment?: React.ReactNode;
22
- adornmentClassName?: string;
23
- }
24
- export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
25
- //# sourceMappingURL=TextField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../src/components/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjF,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAClD,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC/F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,SAAS,yFA+KrB,CAAC"}
@@ -1,71 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { cn } from '../utils/cn';
4
- import { controlClasses } from './form-control-helpers';
5
- import { FieldControl } from './FieldControl';
6
- export const TextField = React.forwardRef(({ label, errorMessage, error, id, className, wrapperClassName, labelClassName = '', labelPosition = 'top', icon, iconPosition = 'right', children, startAdornment, endAdornment, adornmentClassName, roundedFull = false, size = 'sm', variant = 'default', placeholder, disabled = false, helperText, hasValidation = false, ...props }, ref) => {
7
- const componentId = id || props.name;
8
- const positionedIcon = icon;
9
- const resolvedStartAdornment = startAdornment ?? (iconPosition === 'left' ? positionedIcon : undefined);
10
- const resolvedEndAdornment = endAdornment ?? children ?? (iconPosition === 'right' ? positionedIcon : undefined);
11
- const hasStartAdornment = !!resolvedStartAdornment;
12
- const hasEndAdornment = !!resolvedEndAdornment;
13
- const resolvedError = errorMessage ?? error;
14
- const sizeMap = {
15
- xs: 'h-7 text-xs',
16
- sm: 'h-9 text-sm',
17
- md: 'h-12 text-md',
18
- lg: 'h-14 text-base',
19
- };
20
- const roundedClass = roundedFull ? 'rounded-full' : size === 'lg' ? 'rounded-lg' : 'rounded-md';
21
- const sizeClass = `${sizeMap[size ?? 'sm']} ${roundedClass}`;
22
- const paddingClass = {
23
- xs: 'px-2',
24
- sm: 'px-3',
25
- md: 'px-4',
26
- lg: 'px-6',
27
- };
28
- const rightPaddingMap = {
29
- xs: 'pr-8',
30
- sm: 'pr-10',
31
- md: 'pr-12',
32
- lg: 'pr-14',
33
- };
34
- const leftPaddingMap = {
35
- xs: 'pl-8',
36
- sm: 'pl-10',
37
- md: 'pl-12',
38
- lg: 'pl-14',
39
- };
40
- const startAdornmentOffsetMap = {
41
- xs: 'left-2',
42
- sm: 'left-2',
43
- md: 'left-3',
44
- lg: 'left-4',
45
- };
46
- const endAdornmentOffsetMap = {
47
- xs: 'right-1.5',
48
- sm: 'right-2',
49
- md: 'right-3',
50
- lg: 'right-4',
51
- };
52
- const adornmentSizeMap = {
53
- xs: '[&>svg]:size-3.5',
54
- sm: '[&>svg]:size-4',
55
- md: '[&>svg]:size-[1.125rem]',
56
- lg: '[&>svg]:size-5',
57
- };
58
- return (_jsx(FieldControl, { label: label, id: componentId, labelClassName: labelClassName, labelPosition: labelPosition, wrapperClassName: wrapperClassName, errorMessage: resolvedError, hasValidation: hasValidation || !!helperText || props['aria-invalid'] === true, roundedFull: roundedFull, size: size, disabled: disabled, children: ({ controlId, describedBy, errorMessage: controlError, disabled: controlDisabled, label: controlLabel }) => {
59
- const helperId = `${controlId}-helper`;
60
- const inputDescribedBy = cn(describedBy, helperText && !controlError && helperId);
61
- return (_jsxs("div", { children: [_jsxs("div", { className: "relative", children: [_jsx("input", { ref: ref, ...props, id: controlId, disabled: controlDisabled, placeholder: placeholder ?? controlLabel, "aria-invalid": !!controlError, "aria-describedby": inputDescribedBy || undefined, className: controlClasses({
62
- errorMessage: controlError,
63
- disabled: controlDisabled,
64
- variant,
65
- extra: cn(className, 'truncate', roundedFull
66
- ? cn('rounded-full', paddingClass[size ?? 'sm'], sizeClass, hasStartAdornment && leftPaddingMap[size ?? 'sm'], hasEndAdornment && rightPaddingMap[size ?? 'sm'])
67
- : cn(paddingClass[size ?? 'sm'], sizeClass, hasStartAdornment && leftPaddingMap[size ?? 'sm'], hasEndAdornment && rightPaddingMap[size ?? 'sm'])),
68
- }) }), hasStartAdornment && (_jsx("div", { className: cn('pointer-events-none absolute inset-y-0 flex items-center justify-center text-foreground-muted', startAdornmentOffsetMap[size ?? 'sm'], adornmentSizeMap[size ?? 'sm'], adornmentClassName), children: resolvedStartAdornment })), hasEndAdornment && (_jsx("div", { className: cn('pointer-events-none absolute inset-y-0 flex items-center justify-center text-foreground-muted', endAdornmentOffsetMap[size ?? 'sm'], adornmentSizeMap[size ?? 'sm'], adornmentClassName), children: resolvedEndAdornment }))] }), helperText && !controlError ? (_jsx("p", { id: helperId, className: "mt-1 text-xs font-medium text-foreground-muted", children: helperText })) : null] }));
69
- } }));
70
- });
71
- TextField.displayName = 'TextField';
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export interface TextareaFieldProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
3
- wrapperClassName?: string;
4
- labelClassName?: string;
5
- label?: string;
6
- errorMessage?: string;
7
- hasValidation?: boolean;
8
- roundedFull?: boolean;
9
- size?: 'xs' | 'sm' | 'md' | 'lg';
10
- /** Faz o textarea preencher a altura disponivel do container em vez de usar altura fixa. */
11
- stretch?: boolean;
12
- }
13
- export declare const TextareaField: React.ForwardRefExoticComponent<TextareaFieldProps & React.RefAttributes<HTMLTextAreaElement>>;
14
- //# sourceMappingURL=TextareaField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextareaField.d.ts","sourceRoot":"","sources":["../../src/components/TextareaField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACzG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,4FAA4F;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,gGA8EzB,CAAC"}