@zhin.js/console-ui 0.0.0-stage → 1.1.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/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +195 -2
- package/audit/index.mjs +21 -0
- package/audit/layout-audit.mjs +492 -0
- package/audit/mount-page.jsx +90 -0
- package/audit/plugin-pages.mjs +186 -0
- package/dist/cn.d.ts +4 -0
- package/dist/cn.js +6 -0
- package/dist/components/BrandMark.d.ts +16 -0
- package/dist/components/BrandMark.js +21 -0
- package/dist/components/InfoHint.d.ts +12 -0
- package/dist/components/InfoHint.js +13 -0
- package/dist/components/PageHeader.d.ts +18 -0
- package/dist/components/PageHeader.js +11 -0
- package/dist/components/PageShell.d.ts +26 -0
- package/dist/components/PageShell.js +10 -0
- package/dist/components/RefreshControl.d.ts +28 -0
- package/dist/components/RefreshControl.js +68 -0
- package/dist/components/StatCard.d.ts +41 -0
- package/dist/components/StatCard.js +53 -0
- package/dist/components/StatusBadge.d.ts +14 -0
- package/dist/components/StatusBadge.js +19 -0
- package/dist/components/actions.d.ts +53 -0
- package/dist/components/actions.js +50 -0
- package/dist/components/code.d.ts +11 -0
- package/dist/components/code.js +10 -0
- package/dist/components/confirm-dialog-model.d.ts +9 -0
- package/dist/components/confirm-dialog-model.js +20 -0
- package/dist/components/confirm-dialog.d.ts +32 -0
- package/dist/components/confirm-dialog.js +72 -0
- package/dist/components/content-blocks.d.ts +141 -0
- package/dist/components/content-blocks.js +77 -0
- package/dist/components/empty-illustrations.d.ts +15 -0
- package/dist/components/empty-illustrations.js +36 -0
- package/dist/components/empty-state.d.ts +35 -0
- package/dist/components/empty-state.js +43 -0
- package/dist/components/error-alert.d.ts +15 -0
- package/dist/components/error-alert.js +23 -0
- package/dist/components/icon.d.ts +11 -0
- package/dist/components/icon.js +8 -0
- package/dist/components/layout.d.ts +38 -0
- package/dist/components/layout.js +28 -0
- package/dist/components/page-chrome.d.ts +53 -0
- package/dist/components/page-chrome.js +66 -0
- package/dist/components/refresh-control-model.d.ts +9 -0
- package/dist/components/refresh-control-model.js +26 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +15 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/alert.js +24 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +30 -0
- package/dist/components/ui/button.d.ts +20 -0
- package/dist/components/ui/button.js +52 -0
- package/dist/components/ui/card.d.ts +17 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +10 -0
- package/dist/components/ui/control-variant.d.ts +10 -0
- package/dist/components/ui/control-variant.js +6 -0
- package/dist/components/ui/date-field-model.d.ts +39 -0
- package/dist/components/ui/date-field-model.js +105 -0
- package/dist/components/ui/date-field.d.ts +33 -0
- package/dist/components/ui/date-field.js +161 -0
- package/dist/components/ui/dialog.d.ts +24 -0
- package/dist/components/ui/dialog.js +27 -0
- package/dist/components/ui/dropdown-menu.d.ts +19 -0
- package/dist/components/ui/dropdown-menu.js +26 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.js +9 -0
- package/dist/components/ui/list-item-button.d.ts +10 -0
- package/dist/components/ui/list-item-button.js +6 -0
- package/dist/components/ui/popover.d.ts +6 -0
- package/dist/components/ui/popover.js +9 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +10 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +13 -0
- package/dist/components/ui/searchable-select-model.d.ts +29 -0
- package/dist/components/ui/searchable-select-model.js +38 -0
- package/dist/components/ui/searchable-select.d.ts +26 -0
- package/dist/components/ui/searchable-select.js +85 -0
- package/dist/components/ui/select.d.ts +29 -0
- package/dist/components/ui/select.js +39 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +11 -0
- package/dist/components/ui/sheet.d.ts +27 -0
- package/dist/components/ui/sheet.js +27 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/table.d.ts +27 -0
- package/dist/components/ui/table.js +47 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +13 -0
- package/dist/components/ui/textarea.d.ts +8 -0
- package/dist/components/ui/textarea.js +9 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +11 -0
- package/dist/components/use-container-width.d.ts +13 -0
- package/dist/components/use-container-width.js +30 -0
- package/dist/custom-media.css +13 -0
- package/dist/exports.json +178 -0
- package/dist/i18n/index.d.ts +27 -0
- package/dist/i18n/index.js +33 -0
- package/dist/i18n/messages.d.ts +55 -0
- package/dist/i18n/messages.js +110 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +55 -0
- package/dist/scale.json +643 -0
- package/dist/shared-module.d.ts +28 -0
- package/dist/shared-module.js +24 -0
- package/dist/styles.css +3399 -0
- package/dist/theme.css +469 -0
- package/dist/tokens.css +652 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +2 -0
- package/lint/eslint-plugin.mjs +128 -0
- package/lint/stylelint-config.mjs +43 -0
- package/lint/stylelint-plugin.mjs +195 -0
- package/lint/tailwind-classes.mjs +121 -0
- package/package.json +103 -3
- package/tokens/color.mjs +104 -0
- package/tokens/colors.css +220 -0
- package/tokens/generate.mjs +288 -0
- package/tokens/scale.mjs +137 -0
- package/tokens/tokens.mjs +362 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Check, ChevronDown, Search } from 'lucide-react';
|
|
4
|
+
import { CONSOLE_ICON_STROKE_WIDTH } from '../icon.js';
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
import { useConsoleUiI18n } from '../../i18n/index.js';
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from './popover.js';
|
|
8
|
+
import { groupSelectOptions, navigableValues } from './searchable-select-model.js';
|
|
9
|
+
/**
|
|
10
|
+
* A select for long lists: a popover with a search box and grouped options (combobox / listbox
|
|
11
|
+
* pattern). Same controlled contract as SelectField (`options` / `value` / `onValueChange`), plus
|
|
12
|
+
* `group`, `description` and `keywords` per option. ↑ / ↓ move, Enter picks, Esc closes.
|
|
13
|
+
*/
|
|
14
|
+
export const SearchableSelectField = forwardRef(({ options, value, onValueChange, disabled, className, id, searchPlaceholder, emptyText, variant, ...aria }, ref) => {
|
|
15
|
+
const i18n = useConsoleUiI18n();
|
|
16
|
+
const listId = useId();
|
|
17
|
+
const [open, setOpen] = useState(false);
|
|
18
|
+
const [query, setQuery] = useState('');
|
|
19
|
+
const [active, setActive] = useState(null);
|
|
20
|
+
const listRef = useRef(null);
|
|
21
|
+
const selected = options.find(option => option.value === value);
|
|
22
|
+
const grouped = useMemo(() => groupSelectOptions(options, query), [options, query]);
|
|
23
|
+
const order = useMemo(() => navigableValues(grouped), [grouped]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!open) {
|
|
26
|
+
setQuery('');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setActive(order.includes(value) ? value : order[0] ?? null);
|
|
30
|
+
}, [open]); // only on open / close: active and order are read, not tracked
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (open && (active === null || !order.includes(active)))
|
|
33
|
+
setActive(order[0] ?? null);
|
|
34
|
+
}, [order]); // only when the visible options change
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!open || active === null)
|
|
37
|
+
return;
|
|
38
|
+
// The list mounts with the popover: wait a frame so the chosen option can be scrolled into view.
|
|
39
|
+
const frame = requestAnimationFrame(() => {
|
|
40
|
+
listRef.current?.querySelector(`[data-value="${CSS.escape(active)}"]`)?.scrollIntoView({ block: 'nearest' });
|
|
41
|
+
});
|
|
42
|
+
return () => cancelAnimationFrame(frame);
|
|
43
|
+
}, [active, open]);
|
|
44
|
+
const pick = (next) => {
|
|
45
|
+
onValueChange(next);
|
|
46
|
+
setOpen(false);
|
|
47
|
+
};
|
|
48
|
+
const move = (step) => {
|
|
49
|
+
if (!order.length)
|
|
50
|
+
return;
|
|
51
|
+
const index = active === null ? -1 : order.indexOf(active);
|
|
52
|
+
setActive(order[(index + step + order.length) % order.length]);
|
|
53
|
+
};
|
|
54
|
+
const onKeyDown = (event) => {
|
|
55
|
+
if (event.key === 'ArrowDown') {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
move(1);
|
|
58
|
+
}
|
|
59
|
+
else if (event.key === 'ArrowUp') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
move(-1);
|
|
62
|
+
}
|
|
63
|
+
else if (event.key === 'Home') {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
setActive(order[0] ?? null);
|
|
66
|
+
}
|
|
67
|
+
else if (event.key === 'End') {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
setActive(order[order.length - 1] ?? null);
|
|
70
|
+
}
|
|
71
|
+
else if (event.key === 'Enter') {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
if (active !== null)
|
|
74
|
+
pick(active);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const optionId = (optionValue) => `${listId}-${order.indexOf(optionValue)}`;
|
|
78
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { ref: ref, type: "button", id: id, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? listId : undefined, disabled: disabled, "data-slot": "input", "data-variant": variant === 'ghost' ? 'ghost' : undefined, className: cn('console-control console-searchable-select-trigger', className), ...aria, children: [_jsx("span", { className: "console-searchable-select-value", children: selected ? selected.label : value }), _jsx(ChevronDown, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, "aria-hidden": "true", className: "console-searchable-select-chevron" })] }) }), _jsxs(PopoverContent, { className: "console-searchable-select-popover", sideOffset: 4, onOpenAutoFocus: event => event.preventDefault(), children: [_jsxs("div", { className: "console-searchable-select-search", children: [_jsx(Search, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, "aria-hidden": "true" }), _jsx("input", { autoFocus: true, value: query, onChange: event => setQuery(event.target.value), onKeyDown: onKeyDown, placeholder: searchPlaceholder ?? i18n.t('select.searchPlaceholder'), "aria-label": searchPlaceholder ?? i18n.t('select.searchPlaceholder'), "aria-controls": listId, "aria-activedescendant": active !== null && order.includes(active) ? optionId(active) : undefined, "aria-autocomplete": "list", role: "combobox", "aria-expanded": "true" })] }), _jsx("div", { ref: listRef, id: listId, role: "listbox", "aria-label": aria['aria-label'], className: "console-searchable-select-list", children: grouped.length ? grouped.map(entry => {
|
|
79
|
+
const items = entry.options.map(option => (_jsxs("div", { id: option.disabled ? undefined : optionId(option.value), role: "option", "data-value": option.value, "aria-selected": option.value === value, "aria-disabled": option.disabled || undefined, className: cn('console-searchable-select-option', option.value === active && 'is-active', option.value === value && 'is-selected'), onMouseMove: () => { if (!option.disabled && active !== option.value)
|
|
80
|
+
setActive(option.value); }, onMouseDown: event => event.preventDefault(), onClick: () => { if (!option.disabled)
|
|
81
|
+
pick(option.value); }, title: typeof option.label === 'string' ? option.label : undefined, children: [_jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "console-searchable-select-label", children: option.label }), option.description ? _jsx("span", { className: "console-searchable-select-description", children: option.description }) : null] }), option.value === value ? _jsx(Check, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, "aria-hidden": "true", className: "console-searchable-select-check" }) : null] }, option.value)));
|
|
82
|
+
return entry.group === null ? _jsx("div", { role: "group", children: items }, "__top") : (_jsxs("div", { role: "group", "aria-label": entry.group, className: "console-searchable-select-group", children: [_jsxs("div", { className: "console-searchable-select-group-label", "aria-hidden": "true", children: [entry.group, _jsx("span", { children: entry.options.length })] }), items] }, entry.group));
|
|
83
|
+
}) : _jsx("p", { className: "console-searchable-select-empty", children: emptyText ?? i18n.t('select.noMatch') }) })] })] }));
|
|
84
|
+
});
|
|
85
|
+
SearchableSelectField.displayName = 'SearchableSelectField';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import * as Radix from "radix-ui";
|
|
3
|
+
declare const SelectPrimitive: typeof Radix.Select;
|
|
4
|
+
import { type ControlVariant } from './control-variant.js';
|
|
5
|
+
declare const Select: React.FC<Radix.Select.SelectProps>;
|
|
6
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<Radix.Select.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const SelectValue: React.ForwardRefExoticComponent<Radix.Select.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
export interface SelectTriggerProps extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
|
|
9
|
+
/** `ghost`: no border until hovered, focused or open, for secondary fields (ADR 0063 D29). */
|
|
10
|
+
variant?: ControlVariant;
|
|
11
|
+
}
|
|
12
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<Radix.Select.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<Radix.Select.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<Radix.Select.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<Radix.Select.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<Radix.Select.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export interface SelectFieldOption {
|
|
19
|
+
value: string;
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface SelectFieldProps extends Omit<React.ComponentPropsWithoutRef<typeof SelectTrigger>, "value" | "defaultValue" | "onChange" | "children" | "asChild" | "name"> {
|
|
24
|
+
options: readonly SelectFieldOption[];
|
|
25
|
+
value: string;
|
|
26
|
+
onValueChange: (value: string) => void;
|
|
27
|
+
}
|
|
28
|
+
declare const SelectField: React.ForwardRefExoticComponent<SelectFieldProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, SelectField, };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as Radix from "radix-ui";
|
|
4
|
+
const SelectPrimitive = Radix.Select;
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
7
|
+
import { CONSOLE_ICON_STROKE_WIDTH } from '../icon.js';
|
|
8
|
+
import { controlVariantClass } from './control-variant.js';
|
|
9
|
+
const Select = SelectPrimitive.Root;
|
|
10
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
11
|
+
const SelectValue = SelectPrimitive.Value;
|
|
12
|
+
const SelectTrigger = forwardRef(({ className, children, variant, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, "data-slot": "input", "data-variant": variant === 'ghost' ? 'ghost' : undefined, className: cn("console-control flex h-control w-full items-center justify-between gap-2 whitespace-nowrap rounded-control border px-3 text-body transition-colors placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60 [&>span]:line-clamp-1", controlVariantClass(variant), className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, className: "size-4 shrink-0 opacity-50" }) })] })));
|
|
13
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
14
|
+
const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUp, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, className: "size-4" }) })));
|
|
15
|
+
SelectScrollUpButton.displayName = "SelectScrollUpButton";
|
|
16
|
+
const SelectScrollDownButton = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronDown, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, className: "size-4" }) })));
|
|
17
|
+
SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
18
|
+
const SelectContent = forwardRef(({ className, children, position: positionProp, ...props }, ref) => {
|
|
19
|
+
const position = (positionProp ?? "popper");
|
|
20
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, "data-slot": "popover", className: cn("console-popover relative flex max-h-[min(24rem,var(--radix-select-content-available-height,calc(100dvh-1rem)))] min-w-32 max-w-[calc(100vw-1rem)] flex-col p-0", position === "popper" &&
|
|
21
|
+
"w-[var(--radix-select-trigger-width)]", className), position: position, collisionPadding: 8, sideOffset: 4, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("min-h-0 w-full min-w-0 overflow-y-auto overscroll-contain p-1"), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
|
+
});
|
|
23
|
+
SelectContent.displayName = "SelectContent";
|
|
24
|
+
const SelectItem = forwardRef(({ className, children, value, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, value: value, className: cn("console-menu-item relative flex w-full min-w-0 cursor-default select-none items-center py-1 pl-3 pr-8 text-body leading-normal outline-none focus:bg-accent focus:text-accent-foreground data-[state=checked]:bg-brand-tint data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>span:last-child]:min-w-0 [&>span:last-child]:truncate", className), ...props, children: [_jsx("span", { className: "absolute right-2 flex size-4 items-center justify-center text-brand-text", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, className: "size-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] })));
|
|
25
|
+
SelectItem.displayName = "SelectItem";
|
|
26
|
+
const SelectSeparator = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
|
|
27
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
28
|
+
// Controlled UI only: Radix values are encoded, so native named-form submission is not exposed.
|
|
29
|
+
const SelectField = forwardRef(({ options, value, onValueChange, disabled, ...triggerProps }, ref) => {
|
|
30
|
+
const selected = options.find(option => option.value === value);
|
|
31
|
+
return (_jsxs(Select, { value: JSON.stringify(value), onValueChange: encoded => {
|
|
32
|
+
// Radix's hidden form control emits an empty sentinel for unmatched values.
|
|
33
|
+
const option = options.find(item => JSON.stringify(item.value) === encoded);
|
|
34
|
+
if (option)
|
|
35
|
+
onValueChange(option.value);
|
|
36
|
+
}, disabled: disabled, children: [_jsx(SelectTrigger, { ref: ref, disabled: disabled, ...triggerProps, children: _jsx(SelectValue, { children: selected ? selected.label : value }) }), _jsx(SelectContent, { children: options.map(option => (_jsx(SelectItem, { value: JSON.stringify(option.value), disabled: option.disabled, title: typeof option.label === "string" ? option.label : undefined, children: option.label }, option.value))) })] }));
|
|
37
|
+
});
|
|
38
|
+
SelectField.displayName = "SelectField";
|
|
39
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, SelectField, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import * as Radix from "radix-ui";
|
|
3
|
+
declare const Separator: React.ForwardRefExoticComponent<Omit<Radix.Separator.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export { Separator };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as Radix from "radix-ui";
|
|
4
|
+
const SeparatorPrimitive = Radix.Separator;
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
const Separator = forwardRef(({ className, orientation: orientationProp, decorative = true, ...props }, ref) => {
|
|
7
|
+
const orientation = (orientationProp ?? "horizontal");
|
|
8
|
+
return (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className), ...props }));
|
|
9
|
+
});
|
|
10
|
+
Separator.displayName = "Separator";
|
|
11
|
+
export { Separator };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import * as Radix from "radix-ui";
|
|
3
|
+
declare const SheetPrimitive: typeof Radix.Dialog;
|
|
4
|
+
declare const Sheet: React.FC<Radix.Dialog.DialogProps>;
|
|
5
|
+
declare const SheetTrigger: React.ForwardRefExoticComponent<Radix.Dialog.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const SheetPortal: React.FC<Radix.Dialog.DialogPortalProps>;
|
|
7
|
+
declare const SheetClose: React.ForwardRefExoticComponent<Radix.Dialog.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<Radix.Dialog.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> {
|
|
10
|
+
side?: "right" | "left" | "bottom";
|
|
11
|
+
}
|
|
12
|
+
declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const SheetHeader: {
|
|
14
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const SheetBody: {
|
|
18
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
declare const SheetFooter: {
|
|
22
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
declare const SheetTitle: React.ForwardRefExoticComponent<Omit<Radix.Dialog.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
26
|
+
declare const SheetDescription: React.ForwardRefExoticComponent<Omit<Radix.Dialog.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
27
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetBody, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ConsoleUiText } from '../../i18n/index.js';
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import * as Radix from "radix-ui";
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
import { X } from "lucide-react";
|
|
7
|
+
import { CONSOLE_ICON_STROKE_WIDTH } from '../icon.js';
|
|
8
|
+
const SheetPrimitive = Radix.Dialog;
|
|
9
|
+
const Sheet = SheetPrimitive.Root;
|
|
10
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
11
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
12
|
+
const SheetClose = SheetPrimitive.Close;
|
|
13
|
+
const SheetOverlay = forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Overlay, { ref: ref, className: cn("console-sheet-overlay", className), ...props })));
|
|
14
|
+
SheetOverlay.displayName = "SheetOverlay";
|
|
15
|
+
const SheetContent = forwardRef(({ side = "right", className, children, ...props }, ref) => (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { ref: ref, "data-side": side, "data-slot": "sheet", className: cn("console-sheet-content outline-none", className), ...props, children: [children, _jsxs(SheetPrimitive.Close, { className: "console-dialog-close disabled:pointer-events-none", children: [_jsx(X, { strokeWidth: CONSOLE_ICON_STROKE_WIDTH, className: "size-4" }), _jsx("span", { className: "sr-only", children: _jsx(ConsoleUiText, { id: "dialog.close" }) })] })] })] })));
|
|
16
|
+
SheetContent.displayName = "SheetContent";
|
|
17
|
+
const SheetHeader = ({ className, ...props }) => (_jsx("div", { className: cn("console-sheet-header", className), ...props }));
|
|
18
|
+
SheetHeader.displayName = "SheetHeader";
|
|
19
|
+
const SheetBody = ({ className, ...props }) => (_jsx("div", { className: cn("console-sheet-body", className), ...props }));
|
|
20
|
+
SheetBody.displayName = "SheetBody";
|
|
21
|
+
const SheetFooter = ({ className, ...props }) => (_jsx("div", { className: cn("console-sheet-footer", className), ...props }));
|
|
22
|
+
SheetFooter.displayName = "SheetFooter";
|
|
23
|
+
const SheetTitle = forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ref: ref, className: cn("console-section-title", className), ...props })));
|
|
24
|
+
SheetTitle.displayName = "SheetTitle";
|
|
25
|
+
const SheetDescription = forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ref: ref, className: cn("text-body text-muted-foreground", className), ...props })));
|
|
26
|
+
SheetDescription.displayName = "SheetDescription";
|
|
27
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetBody, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as Radix from "radix-ui";
|
|
4
|
+
const SwitchPrimitive = Radix.Switch;
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
const Switch = forwardRef(({ className, ...props }, ref) => (_jsx(SwitchPrimitive.Root, { className: cn("console-control console-touch peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent px-px transition-colors disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-brand-text data-[state=unchecked]:bg-input", className), ...props, ref: ref, children: _jsx(SwitchPrimitive.Thumb, { className: cn("pointer-events-none block size-4 rounded-full bg-background transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") }) })));
|
|
7
|
+
Switch.displayName = "Switch";
|
|
8
|
+
export { Switch };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/** Copies the column headers into `data-label` of every body cell that has no label of its own. */
|
|
3
|
+
export declare function syncTableCellLabels(table: HTMLTableElement): void;
|
|
4
|
+
declare const Table: React.ForwardRefExoticComponent<React.TableHTMLAttributes<HTMLTableElement> & {
|
|
5
|
+
containerClassName?: string;
|
|
6
|
+
/** `compact` uses the compact control height for controls inside cells (2rem on wide screens). */
|
|
7
|
+
density?: "default" | "compact";
|
|
8
|
+
} & React.RefAttributes<HTMLTableElement>>;
|
|
9
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & {
|
|
10
|
+
sticky?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLTableSectionElement>>;
|
|
12
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
14
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & {
|
|
15
|
+
numeric?: boolean;
|
|
16
|
+
/** `secondary` cells are hidden when the table turns into cards (narrow containers). */
|
|
17
|
+
priority?: "primary" | "secondary";
|
|
18
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
19
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & {
|
|
20
|
+
numeric?: boolean;
|
|
21
|
+
/** `secondary` cells are hidden when the table turns into cards (narrow containers). */
|
|
22
|
+
priority?: "primary" | "secondary";
|
|
23
|
+
} & {
|
|
24
|
+
/** Label shown in card mode; defaults to the column header. */
|
|
25
|
+
label?: string;
|
|
26
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
27
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from '../../cn.js';
|
|
4
|
+
/** Copies the column headers into `data-label` of every body cell that has no label of its own. */
|
|
5
|
+
export function syncTableCellLabels(table) {
|
|
6
|
+
const headers = [...table.querySelectorAll(":scope > thead > tr:last-child > th")]
|
|
7
|
+
.map((cell) => cell.textContent?.trim() ?? "");
|
|
8
|
+
if (!headers.length)
|
|
9
|
+
return;
|
|
10
|
+
for (const row of table.querySelectorAll(":scope > tbody > tr")) {
|
|
11
|
+
let column = 0;
|
|
12
|
+
for (const cell of row.cells) {
|
|
13
|
+
const label = headers[column];
|
|
14
|
+
if (label && (!cell.hasAttribute("data-label") || cell.dataset.labelAuto === "true")) {
|
|
15
|
+
cell.dataset.label = label;
|
|
16
|
+
cell.dataset.labelAuto = "true";
|
|
17
|
+
}
|
|
18
|
+
column += cell.colSpan || 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const Table = forwardRef(({ className, containerClassName, density = "default", ...props }, ref) => {
|
|
23
|
+
const own = useRef(null);
|
|
24
|
+
const setRef = useCallback((node) => {
|
|
25
|
+
own.current = node;
|
|
26
|
+
if (typeof ref === "function")
|
|
27
|
+
ref(node);
|
|
28
|
+
else if (ref)
|
|
29
|
+
ref.current = node;
|
|
30
|
+
}, [ref]);
|
|
31
|
+
// Runs after every render of the table, so rows added later get their labels too.
|
|
32
|
+
useEffect(() => { if (own.current)
|
|
33
|
+
syncTableCellLabels(own.current); });
|
|
34
|
+
return (_jsx("div", { className: cn("console-table console-cq", containerClassName), "data-slot": "table", "data-density": density, children: _jsx("div", { className: "console-table-scroll", children: _jsx("table", { ref: setRef, className: className, ...props }) }) }));
|
|
35
|
+
});
|
|
36
|
+
Table.displayName = "Table";
|
|
37
|
+
const TableHeader = forwardRef(({ className, sticky, ...props }, ref) => (_jsx("thead", { ref: ref, className: cn(sticky && "sticky top-0 z-10 bg-card", className), ...props })));
|
|
38
|
+
TableHeader.displayName = "TableHeader";
|
|
39
|
+
const TableBody = forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, className: className, ...props })));
|
|
40
|
+
TableBody.displayName = "TableBody";
|
|
41
|
+
const TableRow = forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: className, ...props })));
|
|
42
|
+
TableRow.displayName = "TableRow";
|
|
43
|
+
const TableHead = forwardRef(({ className, numeric, priority, scope = "col", ...props }, ref) => (_jsx("th", { ref: ref, scope: scope, "data-numeric": numeric ? "" : undefined, "data-priority": priority, className: className, ...props })));
|
|
44
|
+
TableHead.displayName = "TableHead";
|
|
45
|
+
const TableCell = forwardRef(({ className, numeric, priority, label, ...props }, ref) => (_jsx("td", { ref: ref, "data-numeric": numeric ? "" : undefined, "data-priority": priority, "data-label": label, className: className, ...props })));
|
|
46
|
+
TableCell.displayName = "TableCell";
|
|
47
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import * as Radix from "radix-ui";
|
|
3
|
+
declare const Tabs: React.ForwardRefExoticComponent<Radix.Tabs.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const TabsList: React.ForwardRefExoticComponent<Omit<Radix.Tabs.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<Radix.Tabs.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TabsContent: React.ForwardRefExoticComponent<Omit<Radix.Tabs.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as Radix from "radix-ui";
|
|
4
|
+
const TabsPrimitive = Radix.Tabs;
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
const TabsList = forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.List, { ref: ref, className: cn("inline-flex max-w-full items-center justify-start gap-1 overflow-x-auto rounded-control bg-foreground/6 p-1 text-muted-foreground", className), ...props })));
|
|
8
|
+
TabsList.displayName = "TabsList";
|
|
9
|
+
const TabsTrigger = forwardRef(({ className, value, ...props }, ref) => (_jsx(TabsPrimitive.Trigger, { ref: ref, value: value, className: cn("console-tabs-trigger inline-flex min-h-control-compact items-center justify-center whitespace-nowrap rounded-segment px-3 text-body font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 hover:text-foreground data-[state=active]:bg-card data-[state=active]:text-foreground", className), ...props })));
|
|
10
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
11
|
+
const TabsContent = forwardRef(({ className, value, ...props }, ref) => (_jsx(TabsPrimitive.Content, { ref: ref, value: value, className: cn("mt-3", className), ...props })));
|
|
12
|
+
TabsContent.displayName = "TabsContent";
|
|
13
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ControlVariant } from './control-variant.js';
|
|
3
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
/** `ghost`: no border until hovered or focused, for secondary fields (ADR 0063 D29). */
|
|
5
|
+
variant?: ControlVariant;
|
|
6
|
+
}
|
|
7
|
+
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
8
|
+
export { Textarea };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from '../../cn.js';
|
|
4
|
+
import { controlVariantClass } from './control-variant.js';
|
|
5
|
+
const Textarea = forwardRef(({ className, variant, ...props }, ref) => {
|
|
6
|
+
return (_jsx("textarea", { "data-slot": "input", "data-variant": variant === 'ghost' ? 'ghost' : undefined, className: cn("console-control flex min-h-20 w-full rounded-control border px-3 py-2 leading-relaxed text-body transition-colors placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60", controlVariantClass(variant), className), ref: ref, ...props }));
|
|
7
|
+
});
|
|
8
|
+
Textarea.displayName = "Textarea";
|
|
9
|
+
export { Textarea };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import * as Radix from "radix-ui";
|
|
3
|
+
declare const TooltipProvider: React.FC<Radix.Tooltip.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<Radix.Tooltip.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<Radix.Tooltip.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<Radix.Tooltip.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as Radix from "radix-ui";
|
|
4
|
+
const TooltipPrimitive = Radix.Tooltip;
|
|
5
|
+
import { cn } from '../../cn.js';
|
|
6
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
8
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
9
|
+
const TooltipContent = forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(TooltipPrimitive.Portal, { children: _jsx(TooltipPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 overflow-hidden rounded-popover-item bg-foreground px-2 py-1 text-label font-medium text-background shadow-popover", className), ...props }) })));
|
|
10
|
+
TooltipContent.displayName = "TooltipContent";
|
|
11
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the element is at least `rem` wide (ADR 0063 D18: components follow the width of their
|
|
4
|
+
* own container, not the viewport). `undefined` until measured (and during server rendering).
|
|
5
|
+
*/
|
|
6
|
+
export declare function useContainerAtLeast(ref: RefObject<HTMLElement | null>, rem: number): boolean | undefined;
|
|
7
|
+
/** Breakpoints of the size scale in rem (tokens/tokens.mjs `breakpoints`). */
|
|
8
|
+
export declare const CONSOLE_BREAKPOINTS_REM: Readonly<{
|
|
9
|
+
readonly sm: 40;
|
|
10
|
+
readonly md: 48;
|
|
11
|
+
readonly lg: 64;
|
|
12
|
+
readonly xl: 90;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
/** Root font size in px (rem breakpoints are compared against element widths in px). */
|
|
3
|
+
function remInPx() {
|
|
4
|
+
if (typeof document === 'undefined')
|
|
5
|
+
return 16;
|
|
6
|
+
const size = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
7
|
+
return Number.isFinite(size) && size > 0 ? size : 16;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether the element is at least `rem` wide (ADR 0063 D18: components follow the width of their
|
|
11
|
+
* own container, not the viewport). `undefined` until measured (and during server rendering).
|
|
12
|
+
*/
|
|
13
|
+
export function useContainerAtLeast(ref, rem) {
|
|
14
|
+
const [wide, setWide] = useState(undefined);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const element = ref.current;
|
|
17
|
+
if (!element)
|
|
18
|
+
return;
|
|
19
|
+
const measure = () => setWide(element.getBoundingClientRect().width >= rem * remInPx());
|
|
20
|
+
measure();
|
|
21
|
+
if (typeof ResizeObserver === 'undefined')
|
|
22
|
+
return;
|
|
23
|
+
const observer = new ResizeObserver(measure);
|
|
24
|
+
observer.observe(element);
|
|
25
|
+
return () => observer.disconnect();
|
|
26
|
+
}, [ref, rem]);
|
|
27
|
+
return wide;
|
|
28
|
+
}
|
|
29
|
+
/** Breakpoints of the size scale in rem (tokens/tokens.mjs `breakpoints`). */
|
|
30
|
+
export const CONSOLE_BREAKPOINTS_REM = Object.freeze({ sm: 40, md: 48, lg: 64, xl: 90 });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* GENERATED by @zhin.js/console-ui tokens/generate.mjs from tokens/tokens.mjs — do not edit.
|
|
3
|
+
* Breakpoints for the global shell (D16): `@media (--console-sm)`. Needs postcss-custom-media (or Lightning CSS drafts.customMedia).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@custom-media --console-sm (min-width: 40rem);
|
|
7
|
+
@custom-media --console-below-sm (width < 40rem);
|
|
8
|
+
@custom-media --console-md (min-width: 48rem);
|
|
9
|
+
@custom-media --console-below-md (width < 48rem);
|
|
10
|
+
@custom-media --console-lg (min-width: 64rem);
|
|
11
|
+
@custom-media --console-below-lg (width < 64rem);
|
|
12
|
+
@custom-media --console-xl (min-width: 90rem);
|
|
13
|
+
@custom-media --console-below-xl (width < 90rem);
|