@wellingtonhlc/shared-ui 0.27.1 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -14
- package/dist/components/ActionBar.js +3 -3
- package/dist/components/ActionPrimitives.js +5 -5
- package/dist/components/AppShell.js +5 -5
- package/dist/components/Badge.js +4 -4
- package/dist/components/Banner.js +5 -5
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +11 -13
- package/dist/components/Card.js +3 -3
- package/dist/components/ConfirmationDialog.js +12 -12
- package/dist/components/CopyableField.js +1 -1
- package/dist/components/DateField.d.ts +1 -0
- package/dist/components/DateField.d.ts.map +1 -1
- package/dist/components/DateField.js +2 -2
- package/dist/components/FieldControl.js +2 -2
- package/dist/components/FieldValidationError.js +1 -1
- package/dist/components/LoadingOverlay.js +1 -1
- package/dist/components/Modal.js +2 -2
- package/dist/components/MultiSelectField.js +3 -3
- package/dist/components/NavCard.js +1 -1
- package/dist/components/Page.js +4 -4
- package/dist/components/Pagination.js +7 -7
- package/dist/components/RadioGroup.js +2 -2
- package/dist/components/SelectionField.js +1 -1
- package/dist/components/Sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar.js +17 -17
- package/dist/components/Switch.js +1 -1
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +6 -8
- package/dist/components/TabsUnderlined.d.ts.map +1 -1
- package/dist/components/TabsUnderlined.js +5 -5
- package/dist/components/ThemePreferencesSelector.js +4 -4
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/form-control-helpers.js +1 -1
- package/dist/styles.css +606 -745
- package/package.json +14 -2
|
@@ -5,23 +5,23 @@ import { Button } from './Button';
|
|
|
5
5
|
const sizeClasses = {
|
|
6
6
|
sm: {
|
|
7
7
|
root: 'gap-2 md:gap-3',
|
|
8
|
-
count: 'text-xs md:min-w-[7rem] md:text-[
|
|
8
|
+
count: 'text-xs md:min-w-[7rem] md:text-[length:var(--font-size-compact)]',
|
|
9
9
|
controls: 'gap-1',
|
|
10
10
|
iconButton: 'h-8 min-h-8 min-w-8 px-2 py-0 [&_svg]:size-3.5',
|
|
11
11
|
navButton: 'h-8 min-h-8 min-w-8 px-2 py-0 min-[901px]:min-w-[5.75rem] [&_svg]:size-3.5',
|
|
12
|
-
pageIndicator: 'h-8 px-2 text-xs md:min-w-[6.75rem] md:text-[
|
|
12
|
+
pageIndicator: 'h-8 px-2 text-xs md:min-w-[6.75rem] md:text-[length:var(--font-size-compact)]',
|
|
13
13
|
select: 'h-8 min-w-18 px-2.5 text-xs',
|
|
14
|
-
selectLabel: 'text-xs md:text-[
|
|
14
|
+
selectLabel: 'text-xs md:text-[length:var(--font-size-compact)]',
|
|
15
15
|
},
|
|
16
16
|
md: {
|
|
17
17
|
root: 'gap-2.5 md:gap-3',
|
|
18
|
-
count: 'text-[
|
|
18
|
+
count: 'text-[length:var(--font-size-compact)] md:min-w-[7.5rem]',
|
|
19
19
|
controls: 'gap-1.5',
|
|
20
20
|
iconButton: 'h-9 min-h-9 min-w-9 px-2.5 py-0 [&_svg]:size-4',
|
|
21
21
|
navButton: 'h-9 min-h-9 min-w-9 px-3 py-0 min-[901px]:min-w-[6.25rem] [&_svg]:size-4',
|
|
22
|
-
pageIndicator: 'h-9 px-3 text-[
|
|
23
|
-
select: 'h-9 min-w-20 px-3 text-[
|
|
24
|
-
selectLabel: 'text-[
|
|
22
|
+
pageIndicator: 'h-9 px-3 text-[length:var(--font-size-compact)] md:min-w-[7.25rem]',
|
|
23
|
+
select: 'h-9 min-w-20 px-3 text-[length:var(--font-size-compact)]',
|
|
24
|
+
selectLabel: 'text-[length:var(--font-size-compact)]',
|
|
25
25
|
},
|
|
26
26
|
lg: {
|
|
27
27
|
root: 'gap-3 md:gap-4',
|
|
@@ -56,7 +56,7 @@ function RadioGroupBase({ children, direction = 'row', disabled = false, errorMe
|
|
|
56
56
|
if (variant === 'plain') {
|
|
57
57
|
return (_jsx(RadioGroupContext.Provider, { value: { name: resolvedName, value: resolvedValue, disabled: resolvedDisabled, size, onChange: handleChange }, children: _jsx(FieldControl, { label: label, wrapperClassName: wrapperClassName, labelClassName: labelClassName, errorMessage: errorMessage, size: size, disabled: resolvedDisabled, children: () => (_jsx("div", { role: "radiogroup", "aria-label": label, "aria-describedby": describedBy, onBlur: inputOnBlur, className: groupClassName, children: children })) }) }));
|
|
58
58
|
}
|
|
59
|
-
return (_jsx(RadioGroupContext.Provider, { value: { name: resolvedName, value: resolvedValue, disabled: resolvedDisabled, size, onChange: handleChange }, children: _jsxs("div", { className: cn(fieldWrapper, wrapperClassName), "data-disabled": resolvedDisabled || undefined, "data-invalid": !!errorMessage || undefined, children: [_jsxs("fieldset", { className: cn('border-app-border flex h-full flex-1 flex-col justify-center rounded-xl border px-3 pb-2 pt-0 transition-[background-color,border-color,box-shadow,color] duration-
|
|
59
|
+
return (_jsx(RadioGroupContext.Provider, { value: { name: resolvedName, value: resolvedValue, disabled: resolvedDisabled, size, onChange: handleChange }, children: _jsxs("div", { className: cn(fieldWrapper, wrapperClassName), "data-disabled": resolvedDisabled || undefined, "data-invalid": !!errorMessage || undefined, children: [_jsxs("fieldset", { className: cn('border-app-border flex h-full flex-1 flex-col justify-center rounded-xl border px-3 pb-2 pt-0 transition-[background-color,border-color,box-shadow,color] duration-[var(--duration-normal)]', boxedFieldsetHeightStyles[size], resolvedDisabled && 'cursor-not-allowed opacity-60', errorMessage && 'border-red-500 dark:border-red-400'), children: [label ? (_jsx("legend", { id: legendId, className: cn('text-foreground-muted px-2 text-xs font-medium transition-colors', resolvedDisabled && 'cursor-not-allowed opacity-70', errorMessage && 'text-red-600 dark:text-red-400', labelClassName), children: label })) : null, _jsx("div", { role: "radiogroup", "aria-label": label ? undefined : resolvedName, "aria-labelledby": label ? legendId : undefined, "aria-describedby": describedBy, onBlur: inputOnBlur, className: boxedGroupClassName, children: children })] }), _jsx(FieldValidationError, { id: errorId, message: errorMessage })] }) }));
|
|
60
60
|
}
|
|
61
61
|
function Item({ className, disabled: itemDisabled, label, value }) {
|
|
62
62
|
const { value: groupValue, disabled: groupDisabled, size, onChange } = React.useContext(RadioGroupContext);
|
|
@@ -66,7 +66,7 @@ function Item({ className, disabled: itemDisabled, label, value }) {
|
|
|
66
66
|
function handleClick() {
|
|
67
67
|
onChange(value);
|
|
68
68
|
}
|
|
69
|
-
return (_jsxs("button", { type: "button", role: "radio", "aria-checked": isChecked, "aria-label": label, disabled: isDisabled, onClick: handleClick, className: cn('flex items-center gap-2 transition-colors focus:outline-none', isDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer', className), children: [_jsx("span", { "data-checked": isChecked, className: cn('app-radio flex shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-
|
|
69
|
+
return (_jsxs("button", { type: "button", role: "radio", "aria-checked": isChecked, "aria-label": label, disabled: isDisabled, onClick: handleClick, className: cn('flex items-center gap-2 transition-colors focus:outline-none', isDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer', className), children: [_jsx("span", { "data-checked": isChecked, className: cn('app-radio flex shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-[var(--duration-normal)]', s.outer), children: isChecked ? _jsx("span", { className: cn('app-radio__dot rounded-full', s.dot) }) : null }), _jsx("span", { className: cn('leading-none transition-colors duration-[var(--duration-normal)]', s.text, isChecked ? 'text-foreground' : 'text-foreground-muted'), children: label })] }));
|
|
70
70
|
}
|
|
71
71
|
function HookFormRadioGroup(props) {
|
|
72
72
|
const { control, name, rules, ...rest } = props;
|
|
@@ -100,6 +100,6 @@ export function SelectionField({ label, description, value, placeholder = 'Selec
|
|
|
100
100
|
? 'cursor-not-allowed'
|
|
101
101
|
: cn('cursor-pointer', !isClearHover &&
|
|
102
102
|
'hover:border-[color-mix(in_srgb,var(--brand)_58%,var(--app-border))] hover:bg-[color-mix(in_srgb,var(--brand)_8%,var(--surface))]'), size === 'lg' ? 'rounded-lg' : 'rounded-md', controlSizeClass[size], controlGapClass[size], resolvedIcon ? controlIconPaddingClass[size] : controlLeadingPaddingClass[size], controlClassName),
|
|
103
|
-
}), "data-empty": !hasValue || undefined, "data-loading": loading || undefined, onClick: handleOpen, children: [resolvedIcon ? (_jsx("span", { className: cn('inline-flex shrink-0 items-center justify-center rounded-md text-foreground-muted', !hasValue && 'text-[color-mix(in_srgb,var(--brand)_72%,var(--foreground-muted))]', actionSizeClass[size], iconSizeClass[size]), "aria-hidden": "true", children: resolvedIcon })) : null, _jsxs("div", { className: cn('min-w-0 flex-1 text-left', textGapClass[size]), children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsxs("span", { className: cn('min-w-0 truncate font-semibold', hasValue ? 'text-foreground' : 'text-foreground-muted'), children: [title, required && !hasValue ? _jsx("span", { "aria-hidden": "true", children: " *" }) : null] }), meta ? (_jsx("span", { className: "border-app-border bg-background text-foreground-muted shrink-0 rounded border px-1.5 py-0.5 font-mono text-[
|
|
103
|
+
}), "data-empty": !hasValue || undefined, "data-loading": loading || undefined, onClick: handleOpen, children: [resolvedIcon ? (_jsx("span", { className: cn('inline-flex shrink-0 items-center justify-center rounded-md text-foreground-muted', !hasValue && 'text-[color-mix(in_srgb,var(--brand)_72%,var(--foreground-muted))]', actionSizeClass[size], iconSizeClass[size]), "aria-hidden": "true", children: resolvedIcon })) : null, _jsxs("div", { className: cn('min-w-0 flex-1 text-left', textGapClass[size]), children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsxs("span", { className: cn('min-w-0 truncate font-semibold', hasValue ? 'text-foreground' : 'text-foreground-muted'), children: [title, required && !hasValue ? _jsx("span", { "aria-hidden": "true", children: " *" }) : null] }), meta ? (_jsx("span", { className: "border-app-border bg-background text-foreground-muted shrink-0 rounded border px-1.5 py-0.5 font-mono text-[length:var(--font-size-2xs)] leading-none", children: meta })) : null] }), subtitle ? (_jsx("p", { className: cn('text-foreground-muted truncate text-xs font-medium', (size === 'xs' || size === 'sm') && 'sr-only'), children: subtitle })) : null] }), shortcutHint ? (_jsx("kbd", { className: "border-app-border bg-background text-foreground-muted hidden shrink-0 rounded border px-1.5 py-1 font-mono text-[length:var(--font-size-2xs)] leading-none sm:inline-flex", children: shortcutHint })) : null, showClear ? (_jsx("button", { type: "button", "aria-label": clearTooltip, className: cn('inline-flex cursor-pointer shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent text-foreground-muted transition-colors', 'hover:bg-[color-mix(in_srgb,var(--destructive)_10%,transparent)] hover:text-[var(--destructive)]', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--destructive)]/25', actionSizeClass[size]), title: clearTooltip, onClick: handleClear, onMouseEnter: handleClearMouseEnter, onMouseLeave: handleClearMouseLeave, children: _jsx(X, { "aria-hidden": "true" }) })) : null, disabled ? null : _jsx("span", { onClick: stopPropagation, children: selectionTrigger })] }), description ? (_jsx("p", { id: describedById, className: "mt-1 text-xs font-medium text-foreground-muted", children: description })) : null] }));
|
|
104
104
|
} }));
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../src/components/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,oBAAoB,EAAE,KAAK,UAAU,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5J,KAAK,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAC7C,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AA6BD,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAA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,MAAM,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,kBAAkB,+BA8BvE;AA0DD,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYnB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { cn } from '../utils/cn';
|
|
4
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
|
|
5
|
+
return (_jsx("aside", { ref: ref, "aria-label": ariaLabel, "data-open": isOpen, className: cn('border-app-border bg-[var(--sidebar-background)] fixed inset-y-0 left-0 z-[var(--z-navigation)] flex h-full w-20 shrink-0 -translate-x-full flex-col justify-between overflow-visible border-r px-2 transition-[width,transform] duration-[var(--duration-slow)] ease-in-out data-[open=true]:w-4/5 data-[open=true]:translate-x-0 md:static md:z-[var(--z-navigation-desktop)] md:w-20 md:translate-x-0 md:shadow-none md:data-[open=true]:w-72', isOpen && `${mobileWidthClass} ${desktopWidthClass}`, className), children: children }));
|
|
6
6
|
});
|
|
7
7
|
function Content({ ariaLabel = 'Navegação principal', children, className }) {
|
|
8
8
|
return (_jsx("nav", { "aria-label": ariaLabel, className: cn('flex min-h-0 w-full flex-1 flex-col', className), children: children }));
|
|
@@ -27,13 +27,13 @@ function Separator({ className, flush = false }) {
|
|
|
27
27
|
return (_jsx("div", { "aria-hidden": "true", className: cn('border-app-border w-full border-t', flush && 'my-0', className) }));
|
|
28
28
|
}
|
|
29
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('
|
|
30
|
+
return (_jsx("button", { ref: ref, type: "button", onClick: onToggle, "aria-label": isOpen ? openLabel : closedLabel, "aria-expanded": isOpen, "data-open": isOpen, className: cn('text-foreground-muted focus-visible:ring-brand/35 flex w-full flex-none cursor-pointer items-center rounded-xl bg-transparent transition-[background-color,color] focus-visible:ring-2 focus-visible:outline-none hover:bg-[var(--sidebar-item-hover)] hover:text-foreground', className), children: _jsx("span", { className: "grid w-16 min-w-16 flex-none place-items-center py-2", children: icon }) }));
|
|
31
31
|
});
|
|
32
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-
|
|
33
|
+
return (_jsxs("button", { ref: ref, type: type, title: title ? (typeof label === 'string' && !isOpen ? label : undefined) : undefined, "data-open": isOpen, "data-sidebar-active": active ? 'true' : undefined, className: cn(sidebarButtonClasses(active, size, tone), showChevron && isOpen && 'pr-2', className), ...props, children: [_jsx("span", { className: cn('grid w-16 min-w-16 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-[var(--duration-normal)]', size === 'compact' ? 'text-xs max-md:text-base' : 'text-[length:var(--font-size-compact)] max-md:text-base', isOpen ? 'opacity-100' : 'pointer-events-none w-0 opacity-0', labelClassName), children: label }), _jsx("span", { className: cn('flex-none place-items-center', isOpen ? 'grid' : 'hidden', size === 'compact' ? 'h-9 w-6' : 'h-11 w-7', showChevron && isOpen ? 'opacity-100' : 'opacity-0'), children: _jsx(ChevronIcon, { expanded: expanded }) })] }));
|
|
34
34
|
});
|
|
35
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-[
|
|
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-[length:var(--font-size-compact)]', 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
37
|
});
|
|
38
38
|
function NavGroup({ active = false, className, collapsible = false, defaultExpanded, icon, isOpen, items, subItemSize = 'compact', title, }) {
|
|
39
39
|
const itemByKey = useMemo(() => new Map(items.map((item) => [item.key, item])), [items]);
|
|
@@ -92,22 +92,22 @@ function NavGroup({ active = false, className, collapsible = false, defaultExpan
|
|
|
92
92
|
if (singleItem) {
|
|
93
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
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-
|
|
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-[var(--duration-normal)] 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
96
|
}
|
|
97
97
|
function Flyout({ items, onItemSelect, open, title }) {
|
|
98
|
-
return (_jsxs("div", { className: "border-app-border bg-background
|
|
99
|
-
? '!bg-
|
|
100
|
-
: '!bg-transparent text-foreground-muted hover
|
|
98
|
+
return (_jsxs("div", { className: "border-app-border bg-[var(--sidebar-flyout-background)] invisible pointer-events-none absolute left-[calc(100%+0.375rem)] top-0 z-[var(--z-flyout)] min-w-52 -translate-x-2 overflow-hidden rounded-xl border p-2 opacity-0 shadow-[var(--shadow-flyout)] transition-[opacity,transform,visibility] duration-[var(--duration-fast)] 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-[length:var(--font-size-caption)] font-semibold uppercase tracking-[var(--letter-spacing-caps)]", 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-transparent text-foreground font-semibold'
|
|
100
|
+
: '!bg-transparent text-foreground-muted hover:text-foreground hover:font-semibold'), 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
101
|
}
|
|
102
102
|
function subActionButtonTone(active, size) {
|
|
103
103
|
if (size === 'compact') {
|
|
104
104
|
return active
|
|
105
|
-
? '!bg-
|
|
106
|
-
: '!bg-transparent text-foreground-muted hover
|
|
105
|
+
? '!bg-transparent text-foreground font-semibold'
|
|
106
|
+
: '!bg-transparent text-foreground-muted hover:text-foreground hover:font-semibold';
|
|
107
107
|
}
|
|
108
108
|
return active
|
|
109
|
-
? 'bg-
|
|
110
|
-
: 'text-foreground-muted hover:
|
|
109
|
+
? 'bg-transparent text-foreground font-semibold'
|
|
110
|
+
: 'text-foreground-muted hover:text-foreground hover:font-semibold';
|
|
111
111
|
}
|
|
112
112
|
function sidebarButtonClasses(active, size, tone) {
|
|
113
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));
|
|
@@ -115,12 +115,12 @@ function sidebarButtonClasses(active, size, tone) {
|
|
|
115
115
|
function actionButtonTone(active, tone) {
|
|
116
116
|
if (tone === 'subtle') {
|
|
117
117
|
return active
|
|
118
|
-
? '!bg-[
|
|
119
|
-
: '!bg-transparent text-foreground-muted hover:!bg-[
|
|
118
|
+
? '!bg-[var(--sidebar-item-active)] text-foreground font-semibold hover:!bg-[var(--sidebar-item-hover)]'
|
|
119
|
+
: '!bg-transparent text-foreground-muted hover:!bg-[var(--sidebar-item-hover)] hover:text-foreground hover:font-semibold';
|
|
120
120
|
}
|
|
121
121
|
return active
|
|
122
|
-
? 'bg-
|
|
123
|
-
: 'text-foreground-muted hover:bg-
|
|
122
|
+
? 'bg-[var(--sidebar-neutral-active)] text-foreground font-semibold'
|
|
123
|
+
: 'text-foreground-muted hover:bg-[var(--sidebar-neutral-hover)] hover:text-foreground';
|
|
124
124
|
}
|
|
125
125
|
function clearHoverTimer(timerRef) {
|
|
126
126
|
if (timerRef.current) {
|
|
@@ -129,7 +129,7 @@ function clearHoverTimer(timerRef) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
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-
|
|
132
|
+
return (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: cn('h-4 w-4 transition-transform duration-[var(--duration-normal)]', 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
133
|
}
|
|
134
134
|
export const Sidebar = {
|
|
135
135
|
Root,
|
|
@@ -36,7 +36,7 @@ function SwitchBase({ checked, className, errorMessage, id, inputChecked, inputD
|
|
|
36
36
|
onCheckedChange?.(nextChecked);
|
|
37
37
|
onChange?.(nextChecked);
|
|
38
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-
|
|
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-[var(--duration-normal)] 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-[var(--duration-normal)]', sizeClasses.thumb), style: { transform: `translateX(${resolvedChecked ? sizeClasses.offset : 0}px)` } }) }));
|
|
40
40
|
if (display === 'inline') {
|
|
41
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
42
|
const isLabelAfter = labelPosition === 'right' || labelPosition === 'bottom';
|
|
@@ -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I,EAAE,aAAa,UAAQ,UAQ/E;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACvD,UAAU,oBAAqB,SAAQ,gBAAgB,CAAC,oBAAoB,CAAC;IAC3E,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AA+BD,UAAU,mBAAoB,SAAQ,iBAAiB,CAAC,mBAAmB,CAAC;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAYD,UAAU,oBAAqB,SAAQ,gBAAgB,CAAC,oBAAoB,CAAC;CAAG;AA8BhF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAiB/D,UAAU,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAoBD,eAAO,MAAM,KAAK;;;;;;;;;;;;;CAajB,CAAC"}
|
package/dist/components/Table.js
CHANGED
|
@@ -8,7 +8,7 @@ const Root = forwardRef(({ children, chrome = 'default', className, density = 'd
|
|
|
8
8
|
const tableChildren = childNodes.filter((child) => !isValidElement(child) || child.type !== Pagination);
|
|
9
9
|
const paginationChildren = childNodes.filter((child) => isValidElement(child) && child.type === Pagination);
|
|
10
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-[
|
|
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-[var(--shadow-sm)]', 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', layout === 'fixed' && 'table-fixed', 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
12
|
});
|
|
13
13
|
Root.displayName = 'Table.Root';
|
|
14
14
|
const Header = forwardRef(({ className, ...props }, ref) => _jsx("thead", { ref: ref, className: cn('bg-background-secondary', className), ...props }));
|
|
@@ -19,7 +19,7 @@ const Footer = forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref
|
|
|
19
19
|
Footer.displayName = 'Table.Footer';
|
|
20
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)] has-[td[data-slot=table-action-cell]:hover]:bg-transparent last:[&>td]:border-b-0', isInteractive && 'cursor-pointer', className), ...props })));
|
|
21
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-[
|
|
22
|
+
const Head = forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn('border-app-border bg-background-secondary sticky top-0 z-[var(--z-table-header)] h-10 whitespace-nowrap border-b px-3 py-2.5 text-left align-middle text-xs font-extrabold tracking-[var(--letter-spacing-label)] text-foreground-muted uppercase', className), ...props })));
|
|
23
23
|
Head.displayName = 'Table.Head';
|
|
24
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
25
|
Cell.displayName = 'Table.Cell';
|
|
@@ -86,18 +86,16 @@ const ActionCell = forwardRef(({ children, className, style, ...props }, ref) =>
|
|
|
86
86
|
}, ...props, children: _jsx("div", { className: "flex min-h-7 items-center justify-center", children: children }) })));
|
|
87
87
|
ActionCell.displayName = 'Table.ActionCell';
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* mantem o tom saturado nos dois. Nao usar os tokens `--status-*-text`: eles sao
|
|
92
|
-
* feitos para texto sobre o fundo do badge e, no escuro, saem lavados (rosa/menta).
|
|
89
|
+
* Os tons usam os tokens semanticos de icone, que preservam saturacao e contraste
|
|
90
|
+
* nos temas claro e escuro sem repetir hexadecimais no componente.
|
|
93
91
|
*
|
|
94
92
|
* `!` obrigatorio: o cn do pacote nao usa tailwind-merge, entao sem ele o
|
|
95
93
|
* `text-foreground-muted`/`hover:bg` do ghost venceria pela ordem do CSS.
|
|
96
94
|
*/
|
|
97
95
|
const actionToneClasses = {
|
|
98
96
|
default: '',
|
|
99
|
-
success: 'text-[
|
|
100
|
-
danger: 'text-[
|
|
97
|
+
success: 'text-[var(--status-success-icon)]! hover:bg-[color-mix(in_srgb,var(--status-success-icon)_10%,transparent)]! hover:text-[var(--status-success-icon)]! dark:hover:bg-[color-mix(in_srgb,var(--status-success-icon)_16%,transparent)]!',
|
|
98
|
+
danger: 'text-[var(--status-danger-icon)]! hover:bg-[color-mix(in_srgb,var(--status-danger-icon)_10%,transparent)]! hover:text-[var(--status-danger-icon)]! dark:hover:bg-[color-mix(in_srgb,var(--status-danger-icon)_16%,transparent)]!',
|
|
101
99
|
};
|
|
102
100
|
const Action = forwardRef(({ className, size = 'xs', tone = 'default', tooltip, ...props }, ref) => (
|
|
103
101
|
// `props` vem primeiro: o corpo (variant/size/className) e do Table.Action, e nao
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAW9E,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"}
|
|
@@ -3,9 +3,9 @@ import { useMemo, useState } from 'react';
|
|
|
3
3
|
import * as Tabs from '@radix-ui/react-tabs';
|
|
4
4
|
import { cn } from '../utils/cn';
|
|
5
5
|
const DEFAULT_TAB_MIN_WIDTH = '8.75rem';
|
|
6
|
-
const TAB_BAR_BACKGROUND = 'bg-[
|
|
7
|
-
const TAB_INACTIVE_BACKGROUND = 'bg-[
|
|
8
|
-
const TAB_INACTIVE_HOVER_BACKGROUND = 'hover:bg-[color-mix(in_srgb,var(--foreground-muted)_8%,var(--background
|
|
6
|
+
const TAB_BAR_BACKGROUND = 'bg-[var(--tabs-background)]';
|
|
7
|
+
const TAB_INACTIVE_BACKGROUND = 'bg-[var(--tabs-background)]';
|
|
8
|
+
const TAB_INACTIVE_HOVER_BACKGROUND = 'hover:bg-[color-mix(in_srgb,var(--foreground-muted)_8%,var(--tabs-background))]';
|
|
9
9
|
export function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, tabMaxWidth, tabMinWidth, tabWidth, triggerClassName, truncateLabels = false, value, }) {
|
|
10
10
|
const visibleItems = useMemo(() => items.filter((item) => item.visible ?? true), [items]);
|
|
11
11
|
const initialValue = defaultValue && visibleItems.some((item) => item.id === defaultValue)
|
|
@@ -17,7 +17,7 @@ export function TabsUnderlined({ className, contentClassName, defaultValue, item
|
|
|
17
17
|
setInternalValue(nextValue);
|
|
18
18
|
onValueChange?.(nextValue);
|
|
19
19
|
}
|
|
20
|
-
return (_jsx("div", { className: cn('border-app-border bg-
|
|
20
|
+
return (_jsx("div", { className: cn('border-app-border bg-surface 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("flex min-w-0 overflow-x-auto overflow-y-hidden rounded-t-[calc(var(--radius-xl)-1px)] text-sm after:min-w-0 after:flex-1 after:border-b after:border-app-border after:bg-[var(--tabs-background)] after:content-['']", 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
21
|
}
|
|
22
22
|
function TabTrigger({ children, className, value, maxWidth, minWidth, width, truncate, }) {
|
|
23
23
|
const style = {
|
|
@@ -25,5 +25,5 @@ function TabTrigger({ children, className, value, maxWidth, minWidth, width, tru
|
|
|
25
25
|
minWidth: minWidth ?? DEFAULT_TAB_MIN_WIDTH,
|
|
26
26
|
width,
|
|
27
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]
|
|
28
|
+
return (_jsx(Tabs.Trigger, { value: value, style: style, className: cn('text-foreground-muted hover:text-foreground focus-visible:ring-brand/50 border-b-app-border data-[state=active]:border-app-border data-[state=active]:!border-b-transparent data-[state=active]:bg-surface data-[state=active]:text-foreground inline-flex shrink-0 cursor-pointer items-center justify-center border border-t-0 border-x-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
29
|
}
|
|
@@ -21,17 +21,17 @@ export function ThemePreferencesSelector({ disabled = false, locked = false, onC
|
|
|
21
21
|
}
|
|
22
22
|
onChange({ ...value, color: option.key });
|
|
23
23
|
}
|
|
24
|
-
return (_jsxs("div", { className: "grid gap-4", children: [showColorSelector ? (_jsxs("section", { className: "grid gap-2", children: [_jsx("span", { className: "text-xs font-bold uppercase tracking-[
|
|
24
|
+
return (_jsxs("div", { className: "grid gap-4", children: [showColorSelector ? (_jsxs("section", { className: "grid gap-2", children: [_jsx("span", { className: "text-xs font-bold uppercase tracking-[var(--letter-spacing-caps)] text-foreground-muted", children: "Cor do sistema" }), _jsx("div", { className: "flex flex-wrap gap-2", children: options.map((option) => {
|
|
25
25
|
const isSelected = value.color === option.key;
|
|
26
26
|
const isOptionLocked = locked || option.locked;
|
|
27
|
-
return (_jsx("button", { type: "button", className: cn('relative size-8 cursor-pointer rounded-full border-2 border-transparent shadow-[
|
|
27
|
+
return (_jsx("button", { type: "button", className: cn('relative size-8 cursor-pointer rounded-full border-2 border-transparent shadow-[var(--shadow-theme-swatch)] transition-[border-color,box-shadow,transform,opacity] hover:-translate-y-px hover:border-[color-mix(in_srgb,var(--brand)_52%,transparent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/35 disabled:opacity-60', isSelected && 'border-[color-mix(in_srgb,var(--brand)_64%,var(--on-solid))] shadow-[var(--shadow-focus)]', isOptionLocked && 'cursor-not-allowed opacity-45 saturate-50 hover:translate-y-0 hover:border-transparent'), style: { '--theme-color': option.primary, background: option.primary }, onClick: () => selectColor(option), disabled: disabled, "aria-pressed": isSelected, "aria-label": isOptionLocked ? `${option.label} bloqueado` : option.label, title: isOptionLocked && option.requiredPlan
|
|
28
28
|
? `${option.label} exige ${option.requiredPlan}`
|
|
29
29
|
: option.label }, option.key));
|
|
30
|
-
}) })] })) : null, showAppearanceSelector ? (_jsxs("section", { className: "grid gap-2", children: [_jsx("span", { className: "text-xs font-bold uppercase tracking-[
|
|
30
|
+
}) })] })) : null, showAppearanceSelector ? (_jsxs("section", { className: "grid gap-2", children: [_jsx("span", { className: "text-xs font-bold uppercase tracking-[var(--letter-spacing-caps)] text-foreground-muted", children: "Aparencia" }), _jsx("div", { className: "flex flex-wrap items-center justify-start gap-2", children: appearanceOptions.map((option) => {
|
|
31
31
|
const Icon = option.Icon;
|
|
32
32
|
const isSelected = value.appearance === option.value;
|
|
33
33
|
return (_jsxs("button", { type: "button", className: cn('border-app-border bg-surface inline-flex h-9 w-full max-w-[120px] cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-xs font-bold text-foreground-muted transition-[background-color,border-color,color,box-shadow] hover:border-[color-mix(in_srgb,var(--brand)_44%,var(--app-border))] hover:bg-[color-mix(in_srgb,var(--brand)_10%,var(--surface))] hover:text-brand focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/35 disabled:cursor-not-allowed disabled:opacity-60', appearanceButtonClassName, isSelected &&
|
|
34
34
|
(selectedAppearanceButtonClassName ??
|
|
35
|
-
'border-brand bg-brand text-primary-foreground shadow-[
|
|
35
|
+
'border-brand bg-brand text-primary-foreground shadow-[var(--shadow-focus)]')), style: isSelected ? { ...appearanceButtonStyle, ...selectedAppearanceButtonStyle } : appearanceButtonStyle, onClick: () => selectAppearance(option.value), disabled: disabled || locked, "aria-pressed": isSelected, "data-selected": isSelected, children: [_jsx(Icon, { "aria-hidden": "true", size: 14, strokeWidth: 2 }), option.label] }, option.value));
|
|
36
36
|
}) })] })) : null] }));
|
|
37
37
|
}
|
|
@@ -36,5 +36,5 @@ export function Tooltip({ children, className, content, delayDuration = 300, ope
|
|
|
36
36
|
return;
|
|
37
37
|
setOpen((current) => !current);
|
|
38
38
|
}
|
|
39
|
-
return (_jsx(TooltipPrimitive.Provider, { delayDuration: delayDuration, children: _jsxs(TooltipPrimitive.Root, { open: openOnClick ? open : undefined, onOpenChange: openOnClick ? handleOpenChange : undefined, children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, ref: triggerRef, onClick: handleTriggerClick, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { ref: contentRef, className: cn('border-app-border bg-surface text-foreground z-[
|
|
39
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: delayDuration, children: _jsxs(TooltipPrimitive.Root, { open: openOnClick ? open : undefined, onOpenChange: openOnClick ? handleOpenChange : undefined, children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, ref: triggerRef, onClick: handleTriggerClick, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { ref: contentRef, className: cn('border-app-border bg-surface text-foreground z-[var(--z-tooltip)] rounded-md border px-3 py-1.5 text-xs shadow-[var(--shadow-md)]', 'data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0', className), side: side, sideOffset: sideOffset, children: [content, _jsx(TooltipPrimitive.Arrow, { className: "fill-surface" })] }) })] }) }));
|
|
40
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from '../utils/cn';
|
|
2
2
|
export const fieldWrapper = 'flex w-full flex-col space-y-1';
|
|
3
3
|
export const labelBase = 'text-md font-medium';
|
|
4
|
-
const controlShared = cn('text-foreground placeholder:text-foreground-muted w-full rounded-md px-3 py-2 font-medium border', 'transition-[background-color,border-color,box-shadow,color] duration-
|
|
4
|
+
const controlShared = cn('text-foreground placeholder:text-foreground-muted w-full rounded-md px-3 py-2 font-medium border', 'transition-[background-color,border-color,box-shadow,color] duration-[var(--duration-normal)]', 'disabled:cursor-not-allowed disabled:opacity-60');
|
|
5
5
|
const controlDefault = cn(controlShared, 'bg-surface border-app-border', 'enabled:hover:border-brand', 'focus:outline-none focus:bg-surface focus:border-brand focus:ring-2 focus:ring-inset focus:ring-brand/35', 'disabled:bg-input-bg disabled:border-app-border');
|
|
6
6
|
const controlFilled = cn(controlShared, 'bg-input-bg border-app-border', 'enabled:hover:border-brand enabled:hover:bg-[color-mix(in_srgb,var(--input-bg)_75%,var(--surface))]', 'focus:outline-none focus:bg-surface focus:border-brand focus:ring-2 focus:ring-inset focus:ring-brand/35', 'disabled:bg-input-bg disabled:border-app-border');
|
|
7
7
|
const controlGhost = cn(controlShared, 'bg-transparent border-transparent', 'enabled:hover:bg-[color-mix(in_srgb,var(--foreground-muted)_8%,transparent)] enabled:hover:border-[color-mix(in_srgb,var(--foreground-muted)_24%,transparent)]', 'focus:outline-none focus:bg-surface focus:border-brand focus:ring-2 focus:ring-inset focus:ring-brand/25', 'disabled:bg-transparent disabled:border-transparent');
|