@carbonid1/design-system 7.4.0 → 7.5.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.
- package/dist/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/Autocomplete/Autocomplete.js +6 -4
- package/dist/Badge/Badge.js +1 -1
- package/dist/Button/Button.variants.js +1 -1
- package/dist/Input/Input.js +1 -1
- package/dist/InputGroup/InputGroup.d.ts +1 -0
- package/dist/InputGroup/InputGroup.js +3 -1
- package/dist/Item/Item.js +1 -1
- package/dist/Select/Select.d.ts +1 -1
- package/dist/Select/Select.js +13 -3
- package/dist/Select/Select.types.d.ts +1 -0
- package/dist/Slider/Slider.js +2 -2
- package/dist/Switch/Switch.js +2 -2
- package/dist/helpers/cn/cn.tables.js +5 -5
- package/package.json +1 -1
- package/skills/design-system-package/references/tokens.md +4 -0
|
@@ -4,7 +4,7 @@ import type { AutocompleteClearProps, AutocompleteEmptyProps, AutocompleteGroupL
|
|
|
4
4
|
export declare const Autocomplete: {
|
|
5
5
|
Root: <Value>({ autoHighlight, modal, ...props }: AutocompleteRootProps<Value>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
InputGroup: ({ className, ...props }: AutocompleteInputGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
Input: (props: AutocompleteInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Input: ({ className, ...props }: AutocompleteInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
Trigger: ({ children, className, "aria-label": ariaLabel, ...props }: AutocompleteTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
Clear: ({ children, className, "aria-label": ariaLabel, keepMounted, ...props }: AutocompleteClearProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
4
4
|
import { Check, ChevronDown, X } from 'lucide-react';
|
|
5
|
-
import { InputGroup as StyledInputGroup } from '../InputGroup/InputGroup';
|
|
5
|
+
import { InputGroup as StyledInputGroup, inputGroupControlClassName, } from '../InputGroup/InputGroup';
|
|
6
6
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
7
7
|
const Root = ({ autoHighlight = true, modal = false, ...props }) => (_jsx(BaseCombobox.Root, { autoHighlight: autoHighlight, modal: modal, ...props, multiple: false }));
|
|
8
8
|
const InputGroup = ({ className, ...props }) => (_jsx(BaseCombobox.InputGroup, { render: _jsx(StyledInputGroup.Root, {}), className: mergeStatefulClassName('min-h-9 gap-0 p-0.5', className), ...props }));
|
|
9
|
+
// Only the group's look, not InputGroup.Control: that is a Field control, and it would submit the
|
|
10
|
+
// typed text under the field's name next to the combobox's own hidden input.
|
|
9
11
|
/** Compose inside InputGroup so the input and its actions share one focus ring and surface. */
|
|
10
|
-
const Input = (props) => (_jsx(BaseCombobox.Input, {
|
|
11
|
-
const Trigger = ({ children, className, 'aria-label': ariaLabel = 'Show options', ...props }) => (_jsx(BaseCombobox.Trigger, { "aria-label": ariaLabel, "aria-labelledby": undefined, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('group motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight]', className), ...props, children: children ?? (_jsx(ChevronDown, { "aria-hidden": true, className: "size-4 transition-transform group-data-[popup-open]:rotate-180 motion-reduce:transition-none" })) }));
|
|
12
|
-
const Clear = ({ children, className, 'aria-label': ariaLabel = 'Clear selection', keepMounted = true, ...props }) => (_jsx(BaseCombobox.Clear, { "aria-label": ariaLabel, keepMounted: keepMounted, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('not-data-[visible]:invisible motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight]', className), ...props, children: children ?? _jsx(X, { "aria-hidden": true, className: "size-4" }) }));
|
|
12
|
+
const Input = ({ className, ...props }) => (_jsx(BaseCombobox.Input, { "data-slot": "input-group-control", className: mergeStatefulClassName(inputGroupControlClassName, className), ...props }));
|
|
13
|
+
const Trigger = ({ children, className, 'aria-label': ariaLabel = 'Show options', ...props }) => (_jsx(BaseCombobox.Trigger, { "aria-label": ariaLabel, "aria-labelledby": undefined, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('group motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight] forced-colors:focus-visible:outline-solid', className), ...props, children: children ?? (_jsx(ChevronDown, { "aria-hidden": true, className: "size-4 transition-transform group-data-[popup-open]:rotate-180 motion-reduce:transition-none" })) }));
|
|
14
|
+
const Clear = ({ children, className, 'aria-label': ariaLabel = 'Clear selection', keepMounted = true, ...props }) => (_jsx(BaseCombobox.Clear, { "aria-label": ariaLabel, keepMounted: keepMounted, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('not-data-[visible]:invisible motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight] forced-colors:focus-visible:outline-solid', className), ...props, children: children ?? _jsx(X, { "aria-hidden": true, className: "size-4" }) }));
|
|
13
15
|
const Positioner = ({ className, sideOffset = 4, collisionPadding = 8, positionMethod = 'fixed', ...props }) => (_jsx(BaseCombobox.Positioner, { sideOffset: sideOffset, collisionPadding: collisionPadding, positionMethod: positionMethod, className: mergeStatefulClassName('z-50 outline-hidden', className), ...props }));
|
|
14
16
|
const Popup = ({ className, ...props }) => (_jsx(BaseCombobox.Popup, { className: mergeStatefulClassName('border-border bg-popover text-popover-foreground shadow-popover flex max-h-[var(--available-height)] w-[var(--anchor-width)] max-w-[var(--available-width)] flex-col overflow-hidden rounded-lg border outline-hidden', className), ...props }));
|
|
15
17
|
const List = ({ className, ...props }) => (_jsx(BaseCombobox.List, { className: mergeStatefulClassName('max-h-60 min-h-0 scroll-py-1 space-y-1 overflow-y-auto overscroll-contain p-1 empty:p-0', className), ...props }));
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -5,6 +5,6 @@ import { X } from 'lucide-react';
|
|
|
5
5
|
import { badgeVariants } from './Badge.variants';
|
|
6
6
|
const Badge = ({ className, variant, onRemove, removeLabel, children, ...props }) => {
|
|
7
7
|
const resolvedRemoveLabel = removeLabel ?? (typeof children === 'string' ? `Remove ${children}` : 'Remove');
|
|
8
|
-
return (_jsxs("span", { className: cn(badgeVariants({ variant }), className), ...props, children: [onRemove ? _jsx("span", { className: "truncate", children: children }) : children, onRemove && (_jsx("button", { type: "button", "aria-label": resolvedRemoveLabel, onClick: onRemove, className: "-me-0.5 inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full opacity-70 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1 focus-visible:ring-offset-transparent focus-visible:outline-none", children: _jsx(X, { className: "size-3", "aria-hidden": "true" }) }))] }));
|
|
8
|
+
return (_jsxs("span", { className: cn(badgeVariants({ variant }), className), ...props, children: [onRemove ? _jsx("span", { className: "truncate", children: children }) : children, onRemove && (_jsx("button", { type: "button", "aria-label": resolvedRemoveLabel, onClick: onRemove, className: "-me-0.5 inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full opacity-70 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1 focus-visible:ring-offset-transparent focus-visible:outline-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight] forced-colors:focus-visible:outline-solid", children: _jsx(X, { className: "size-3", "aria-hidden": "true" }) }))] }));
|
|
9
9
|
};
|
|
10
10
|
export { Badge };
|
|
@@ -24,7 +24,7 @@ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justi
|
|
|
24
24
|
relaxed: 'gap-2',
|
|
25
25
|
},
|
|
26
26
|
selected: {
|
|
27
|
-
true: 'bg-primary/10 ring-1 ring-primary/20',
|
|
27
|
+
true: 'bg-primary/10 ring-1 ring-primary/20 forced-colors:bg-[Highlight] forced-colors:text-[HighlightText] forced-colors:forced-color-adjust-none',
|
|
28
28
|
false: '',
|
|
29
29
|
},
|
|
30
30
|
},
|
package/dist/Input/Input.js
CHANGED
|
@@ -3,5 +3,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Input as BaseInput } from '@base-ui/react/input';
|
|
4
4
|
import { cn } from '../helpers/cn/cn';
|
|
5
5
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
6
|
-
const Input = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input", className: mergeStatefulClassName(cn('border-input-border bg-surface-inset inset-shadow-surface text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-lg border px-3 py-1 text-sm outline-hidden dark:inset-shadow-none', 'enabled:hover:border-ring', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 aria-invalid:ring-3'), className) }));
|
|
6
|
+
const Input = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input", className: mergeStatefulClassName(cn('border-input-border bg-surface-inset inset-shadow-surface text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-lg border px-3 py-1 text-sm outline-hidden dark:inset-shadow-none', 'enabled:hover:border-ring', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight] forced-colors:focus-visible:outline-solid', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 aria-invalid:ring-3'), className) }));
|
|
7
7
|
export { Input };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps } from './InputGroup.types';
|
|
2
|
+
export declare const inputGroupControlClassName = "text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 forced-colors:focus-visible:outline-none";
|
|
2
3
|
export declare const InputGroup: {
|
|
3
4
|
Root: ({ className, onPointerDown, ...props }: InputGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
Control: ({ className, ...props }: InputGroupControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,9 @@ const Root = ({ className, onPointerDown, ...props }) => {
|
|
|
16
16
|
};
|
|
17
17
|
return (_jsx("div", { ...props, "data-slot": "input-group", onPointerDown: focusControlFromShell, className: cn('border-input-border bg-surface-inset inset-shadow-surface flex min-h-11 w-full min-w-0 items-center gap-1 rounded-lg border p-2 dark:inset-shadow-none', 'has-[[data-slot=input-group-control]:enabled]:hover:border-ring', 'has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3', 'has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:border-destructive/50 dark:has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive/40 has-[[data-slot=input-group-control][aria-invalid=true]]:ring-3', 'forced-colors:has-[[data-slot=input-group-control]:focus-visible]:ring-0 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-offset-2 forced-colors:has-[[data-slot=input-group-control]:focus-visible]:outline-[Highlight]', '[&:has([data-native-picker-action])_[data-slot=input-group-control]::-webkit-calendar-picker-indicator]:hidden', className) }));
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
// Shared with inputs that bring their own form behavior, like Autocomplete's combobox input.
|
|
20
|
+
export const inputGroupControlClassName = 'text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 forced-colors:focus-visible:outline-none';
|
|
21
|
+
const Control = ({ className, ...props }) => (_jsx(BaseInput, { ...props, "data-slot": "input-group-control", className: mergeStatefulClassName(inputGroupControlClassName, className) }));
|
|
20
22
|
const Action = ({ className, variant = 'subtle', size = 'icon', replacesNativePicker = false, ...props }) => (_jsx(Button, { ...props, "data-slot": "input-group-action", "data-native-picker-action": replacesNativePicker ? '' : undefined, variant: variant, size: size, className: mergeStatefulClassName(cn('rounded-md',
|
|
21
23
|
// Firefox does not expose its native date indicator to author CSS, so it keeps that
|
|
22
24
|
// affordance and omits the replacement action instead of rendering two calendar buttons.
|
package/dist/Item/Item.js
CHANGED
|
@@ -10,7 +10,7 @@ const itemVariants = cva('min-w-0 rounded-lg', {
|
|
|
10
10
|
outline: 'border-border border bg-transparent',
|
|
11
11
|
},
|
|
12
12
|
interactive: {
|
|
13
|
-
true: 'outline-hidden hover:bg-accent focus-within:bg-accent focus-visible:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 dark:hover:bg-accent/50 dark:focus-within:bg-accent/50 dark:focus-visible:bg-accent/50 forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]',
|
|
13
|
+
true: 'outline-hidden hover:bg-accent focus-within:bg-accent focus-visible:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 dark:hover:bg-accent/50 dark:focus-within:bg-accent/50 dark:focus-visible:bg-accent/50 forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]',
|
|
14
14
|
false: '',
|
|
15
15
|
},
|
|
16
16
|
},
|
package/dist/Select/Select.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ type GroupLabelProps = ComponentPropsWithoutRef<typeof BaseSelect.GroupLabel> &
|
|
|
23
23
|
ref?: Ref<HTMLDivElement>;
|
|
24
24
|
};
|
|
25
25
|
export declare const Select: {
|
|
26
|
-
({ value, onChange, options, groups, placeholder, id, className, menuClassName, menuAlign, renderOption, onOpenChange, name, form, autoComplete, required, disabled, readOnly, "aria-label": ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ value, onChange, options, groups, placeholder, id, className, menuClassName, menuAlign, renderOption, onOpenChange, name, form, autoComplete, required, disabled, readOnly, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
} & {
|
|
29
29
|
Root: typeof BaseSelect.Root;
|
package/dist/Select/Select.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
4
4
|
import { ChevronDown } from 'lucide-react';
|
|
5
|
+
import { useCallback, useState } from 'react';
|
|
5
6
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
6
7
|
const triggerClasses = 'border-border bg-background text-foreground focus-visible:ring-ring/50 group flex items-center justify-between gap-2 rounded-lg border px-3 py-2 text-sm outline-hidden focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:ring-3 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40';
|
|
7
8
|
const popupClasses = 'bg-popover text-popover-foreground border-border shadow-popover z-50 min-w-[var(--anchor-width)] max-w-[var(--available-width)] overflow-hidden rounded-lg border outline-hidden';
|
|
@@ -20,17 +21,26 @@ const OptionItem = ({ option, renderOption }) => (_jsx(Item, { value: option.val
|
|
|
20
21
|
selected: state.selected,
|
|
21
22
|
})
|
|
22
23
|
: option.label }) })) }));
|
|
23
|
-
const SelectComponent = ({ value, onChange, options, groups, placeholder, id, className, menuClassName, menuAlign = 'start', renderOption, onOpenChange, name, form, autoComplete, required, disabled, readOnly, 'aria-label': ariaLabel, }) => {
|
|
24
|
+
const SelectComponent = ({ value, onChange, options, groups, placeholder, id, className, menuClassName, menuAlign = 'start', renderOption, onOpenChange, name, form, autoComplete, required, disabled, readOnly, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }) => {
|
|
24
25
|
const items = [...(options ?? []), ...(groups ?? []).flatMap(group => group.options)];
|
|
25
26
|
const selectedOption = items.find(option => option.value === value);
|
|
26
27
|
const selectedValue = selectedOption ? value : null;
|
|
27
28
|
const displayPlaceholder = selectedOption ? undefined : (placeholder ?? value);
|
|
28
|
-
|
|
29
|
+
// A combobox isn't named by its text, so an unlabelled select borrows its current text as a
|
|
30
|
+
// name. A <label> around the trigger or pointing at its id names it natively, and aria-label
|
|
31
|
+
// would override that. Until the trigger mounts, an id stands in for a label pointing at it.
|
|
32
|
+
const [hasNativeLabel, setHasNativeLabel] = useState(id !== undefined);
|
|
33
|
+
const detectNativeLabel = useCallback((trigger) => {
|
|
34
|
+
if (trigger)
|
|
35
|
+
setHasNativeLabel(trigger.labels.length > 0);
|
|
36
|
+
}, []);
|
|
37
|
+
const accessibleLabel = ariaLabel ??
|
|
38
|
+
(hasNativeLabel || ariaLabelledBy ? undefined : (selectedOption?.label ?? displayPlaceholder));
|
|
29
39
|
return (_jsxs(BaseSelect.Root, { value: selectedValue, onValueChange: nextValue => {
|
|
30
40
|
if (nextValue !== null) {
|
|
31
41
|
onChange(nextValue);
|
|
32
42
|
}
|
|
33
|
-
}, items: items, onOpenChange: open => onOpenChange?.(open), name: name, form: form, autoComplete: autoComplete, required: required, disabled: disabled, readOnly: readOnly, modal: false, children: [_jsxs(Trigger, { id: id, "aria-label": accessibleLabel, className: className, children: [_jsx(BaseSelect.Value, { className: "truncate", placeholder: displayPlaceholder }), _jsx(BaseSelect.Icon, { children: _jsx(ChevronDown, { "aria-hidden": true, className: "size-4 shrink-0 transition-transform duration-150 group-data-[popup-open]:rotate-180 motion-reduce:transition-none" }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(Positioner, { align: menuAlign, children: _jsx(Popup, { children: _jsxs(List, { className: menuClassName, children: [(options ?? []).map(option => (_jsx(OptionItem, { option: option, renderOption: renderOption }, option.value))), (groups ?? []).map(group => (_jsxs(BaseSelect.Group, { children: [_jsx(GroupLabel, { children: group.label }), group.options.map(option => (_jsx(OptionItem, { option: option, renderOption: renderOption }, option.value)))] }, group.label)))] }) }) }) })] }));
|
|
43
|
+
}, items: items, onOpenChange: open => onOpenChange?.(open), name: name, form: form, autoComplete: autoComplete, required: required, disabled: disabled, readOnly: readOnly, modal: false, children: [_jsxs(Trigger, { ref: detectNativeLabel, id: id, "aria-label": accessibleLabel, ...(ariaLabelledBy && { 'aria-labelledby': ariaLabelledBy }), className: className, children: [_jsx(BaseSelect.Value, { className: "truncate", placeholder: displayPlaceholder }), _jsx(BaseSelect.Icon, { children: _jsx(ChevronDown, { "aria-hidden": true, className: "size-4 shrink-0 transition-transform duration-150 group-data-[popup-open]:rotate-180 motion-reduce:transition-none" }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(Positioner, { align: menuAlign, children: _jsx(Popup, { children: _jsxs(List, { className: menuClassName, children: [(options ?? []).map(option => (_jsx(OptionItem, { option: option, renderOption: renderOption }, option.value))), (groups ?? []).map(group => (_jsxs(BaseSelect.Group, { children: [_jsx(GroupLabel, { children: group.label }), group.options.map(option => (_jsx(OptionItem, { option: option, renderOption: renderOption }, option.value)))] }, group.label)))] }) }) }) })] }));
|
|
34
44
|
};
|
|
35
45
|
SelectComponent.displayName = 'Select';
|
|
36
46
|
export const Select = Object.assign(SelectComponent, {
|
package/dist/Slider/Slider.js
CHANGED
|
@@ -4,8 +4,8 @@ import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
|
4
4
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
5
5
|
const rootClasses = 'relative flex touch-none flex-col gap-2 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-48 data-[orientation=vertical]:w-fit';
|
|
6
6
|
const controlClasses = 'relative flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:items-center data-[orientation=horizontal]:py-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:justify-center data-[orientation=vertical]:px-2';
|
|
7
|
-
const trackClasses = 'bg-input relative rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5';
|
|
8
|
-
const indicatorClasses = 'bg-primary rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full';
|
|
7
|
+
const trackClasses = 'bg-input relative rounded-full forced-colors:border data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5';
|
|
8
|
+
const indicatorClasses = 'bg-primary rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full forced-colors:bg-[Highlight]';
|
|
9
9
|
const thumbClasses = 'bg-primary border-background block size-4 rounded-full border-2 shadow-sm has-[input:focus-visible]:ring-ring/50 has-[input:focus-visible]:ring-3 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 forced-colors:has-[input:focus-visible]:ring-0 forced-colors:has-[input:focus-visible]:outline-2 forced-colors:has-[input:focus-visible]:outline-offset-2 forced-colors:has-[input:focus-visible]:outline-[Highlight]';
|
|
10
10
|
const Root = ({ className, ...props }) => (_jsx(BaseSlider.Root, { className: mergeStatefulClassName(rootClasses, className), ...props }));
|
|
11
11
|
const Label = ({ className, ...props }) => (_jsx(BaseSlider.Label, { className: mergeStatefulClassName('text-foreground text-sm font-medium', className), ...props }));
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
4
4
|
import { cn } from '../helpers/cn/cn';
|
|
5
|
-
const Root = ({ className, ...props }) => (_jsx(BaseSwitch.Root, { "data-slot": "switch", className: cn('border-input-border bg-input data-checked:border-primary data-checked:bg-primary inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border p-0.5 outline-hidden', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50', className), ...props }));
|
|
6
|
-
const Thumb = ({ className, ...props }) => (_jsx(BaseSwitch.Thumb, { "data-slot": "switch-thumb", className: cn('bg-background pointer-events-none block size-4 translate-x-0 rounded-full shadow-sm', 'transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none', 'data-checked:translate-x-4', className), ...props }));
|
|
5
|
+
const Root = ({ className, ...props }) => (_jsx(BaseSwitch.Root, { "data-slot": "switch", className: cn('border-input-border bg-input data-checked:border-primary data-checked:bg-primary inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border p-0.5 outline-hidden', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'forced-colors:focus-visible:outline-[Highlight] forced-colors:data-checked:border-[Highlight] forced-colors:data-checked:bg-[Highlight]', 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50', className), ...props }));
|
|
6
|
+
const Thumb = ({ className, ...props }) => (_jsx(BaseSwitch.Thumb, { "data-slot": "switch-thumb", className: cn('bg-background pointer-events-none block size-4 translate-x-0 rounded-full shadow-sm', 'transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none', 'data-checked:translate-x-4', 'forced-colors:bg-[CanvasText] forced-colors:data-checked:bg-[HighlightText]', className), ...props }));
|
|
7
7
|
export const Switch = {
|
|
8
8
|
Root,
|
|
9
9
|
Thumb,
|
|
@@ -71,7 +71,7 @@ const nodeVlist = (() => {
|
|
|
71
71
|
out[A[i]] = V[i];
|
|
72
72
|
return out;
|
|
73
73
|
})();
|
|
74
|
-
const SETS = "container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top|none | auto square video| auto fr max min px| auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| none surface| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform".split('|').map((s) => {
|
|
74
|
+
const SETS = "container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top|none | auto square video| auto fr max min px| auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| none surface| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| card inner none popover| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform".split('|').map((s) => {
|
|
75
75
|
const tails = s.split(' ');
|
|
76
76
|
const prefix = tails.shift();
|
|
77
77
|
for (let i = 0; i < tails.length; i++) {
|
|
@@ -82,11 +82,11 @@ const SETS = "container |break-after- all auto avoid avoid-page column left page
|
|
|
82
82
|
const AA = DZ("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422");
|
|
83
83
|
const AG = DZ("ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622");
|
|
84
84
|
const AS = DZ("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000|{0~}
22>22~22222222222G000sQXI000002>40000B00000Iª¯000²00000000000000021Q´³00¶000000000000000000000222HGHa5À222Å6Â2222ÏÒ000¯²2³");
|
|
85
|
-
const litAnchor = new Int32Array(
|
|
86
|
-
const litGroup = new Int32Array(
|
|
87
|
-
const litPool = new Int32Array(
|
|
85
|
+
const litAnchor = new Int32Array(994);
|
|
86
|
+
const litGroup = new Int32Array(994);
|
|
87
|
+
const litPool = new Int32Array(994);
|
|
88
88
|
let poolText = '';
|
|
89
|
-
const poolOffsets = new Int32Array(
|
|
89
|
+
const poolOffsets = new Int32Array(1036);
|
|
90
90
|
{
|
|
91
91
|
const tailRef = new Map();
|
|
92
92
|
let nextRef = 0;
|
package/package.json
CHANGED
|
@@ -5,3 +5,7 @@
|
|
|
5
5
|
3. Use it via Tailwind classes in components (`bg-my-token`, `text-my-token-foreground`). Opacity modifiers like `bg-my-token/10` work natively on those color variables.
|
|
6
6
|
|
|
7
7
|
Use enough sub-variants for depth — don't squeeze a semantic color into just `base + foreground` when the role needs distinct text/background/border values. Opacity modifiers are a poor substitute for dedicated tokens tuned per role.
|
|
8
|
+
|
|
9
|
+
## Non-color tokens in a color-sharing namespace
|
|
10
|
+
|
|
11
|
+
A custom `--shadow-*` or `--inset-shadow-*` token shares its utility prefix with colors (`shadow-black/10`), and `cn` classifies any value it doesn't know as a color. Register the name under `extend.theme` in `src/helpers/cn/cn.config.mjs` and add a merge case to `cn.test.ts`; the first test run rebuilds `cn.tables.js`. Namespaces without a color twin, like `font-*` and `animate-*`, merge correctly without this.
|