@kortix/ui 0.15.7 → 0.15.8
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 +7 -7
- package/dist/_vendor/kortix-shared.js +36 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
- package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
- package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
- package/dist/customize/connectors/catalog/connector-categories.js +2 -2
- package/dist/customize/connectors/detail/connector-modal.js +1 -1
- package/dist/customize/sections/gateway-view.d.ts +1 -1
- package/dist/customize/sections/gateway-view.js +1 -1
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -2
- package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/git-view.js +1 -1
- package/dist/customize/sections/view/permission-editor.js +1 -1
- package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
- package/dist/customize/sections/view/subscription-usage.js +2 -86
- package/dist/customize/shared/entity/entity-modal.js +8 -10
- package/dist/files/project/components/drive-toolbar.d.ts +1 -1
- package/dist/files/project/components/drive-toolbar.js +1 -1
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
- package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
- package/dist/files/renderers/shared/select-compat.js +3 -7
- package/dist/files/viewer/file-preview-modal.d.ts +10 -11
- package/dist/files/viewer/file-preview-modal.js +17 -18
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +7 -4
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-location.js +2 -2
- package/dist/internal/account-hub/use-account-members.d.ts +28 -1
- package/dist/internal/account-hub/use-account-members.js +27 -10
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/navigation/modified-click.js +2 -2
- package/dist/internal/lib/pixel-mark.d.ts +3 -20
- package/dist/internal/lib/pixel-mark.js +3 -34
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.js +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +1 -1
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.d.ts +149 -0
- package/dist/lib/base-ui-compat.js +339 -0
- package/dist/lib/portal-container.d.ts +3 -7
- package/dist/lib/portal-container.js +5 -3
- package/dist/lib/z-stack.d.ts +4 -4
- package/dist/lib/z-stack.js +5 -5
- package/dist/primitives/accordion.d.ts +36 -5
- package/dist/primitives/accordion.js +41 -8
- package/dist/primitives/alert-dialog.d.ts +33 -11
- package/dist/primitives/alert-dialog.js +41 -19
- package/dist/primitives/avatar.d.ts +5 -2
- package/dist/primitives/avatar.js +3 -3
- package/dist/primitives/badge.js +1 -1
- package/dist/primitives/breadcrumb.js +1 -1
- package/dist/primitives/button-group.js +3 -3
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox.d.ts +14 -5
- package/dist/primitives/checkbox.js +24 -9
- package/dist/primitives/collapsible.d.ts +16 -4
- package/dist/primitives/collapsible.js +18 -7
- package/dist/primitives/command-core.d.ts +121 -0
- package/dist/primitives/command-core.js +642 -0
- package/dist/primitives/command.d.ts +38 -4
- package/dist/primitives/command.js +22 -13
- package/dist/primitives/context-menu.d.ts +61 -31
- package/dist/primitives/context-menu.js +40 -53
- package/dist/primitives/dialog.d.ts +48 -10
- package/dist/primitives/dialog.js +48 -19
- package/dist/primitives/disclosure.d.ts +1 -1
- package/dist/primitives/disclosure.js +2 -2
- package/dist/primitives/drawer.d.ts +28 -9
- package/dist/primitives/drawer.js +42 -18
- package/dist/primitives/dropdown-menu.d.ts +55 -33
- package/dist/primitives/dropdown-menu.js +46 -82
- package/dist/primitives/faded-scroll-area.js +2 -1
- package/dist/primitives/hint.js +3 -3
- package/dist/primitives/hover-card.d.ts +17 -5
- package/dist/primitives/hover-card.js +45 -8
- package/dist/primitives/item.js +2 -2
- package/dist/primitives/label.d.ts +5 -2
- package/dist/primitives/label.js +10 -3
- package/dist/primitives/menu-base.d.ts +150 -0
- package/dist/primitives/menu-base.js +171 -0
- package/dist/primitives/menu-recipe.d.ts +1 -1
- package/dist/primitives/menu-recipe.js +2 -7
- package/dist/primitives/modal.d.ts +19 -52
- package/dist/primitives/modal.js +24 -28
- package/dist/primitives/navigation-menu.d.ts +36 -11
- package/dist/primitives/navigation-menu.js +31 -12
- package/dist/primitives/popover.d.ts +31 -6
- package/dist/primitives/popover.js +79 -12
- package/dist/primitives/preview-image.d.ts +18 -7
- package/dist/primitives/preview-image.js +14 -11
- package/dist/primitives/progress.d.ts +4 -2
- package/dist/primitives/progress.js +4 -3
- package/dist/primitives/project-icon-picker.js +2 -2
- package/dist/primitives/radio-group.d.ts +28 -5
- package/dist/primitives/radio-group.js +18 -10
- package/dist/primitives/scroll-area.d.ts +2 -2
- package/dist/primitives/scroll-area.js +8 -3
- package/dist/primitives/select.d.ts +55 -12
- package/dist/primitives/select.js +93 -36
- package/dist/primitives/separator.d.ts +6 -2
- package/dist/primitives/separator.js +10 -2
- package/dist/primitives/sheet.d.ts +17 -10
- package/dist/primitives/sheet.js +19 -22
- package/dist/primitives/sidebar-menu-primitives.js +8 -8
- package/dist/primitives/slider-native.d.ts +2 -2
- package/dist/primitives/slider-native.js +11 -9
- package/dist/primitives/slider.d.ts +24 -6
- package/dist/primitives/slider.js +26 -24
- package/dist/primitives/slot.d.ts +6 -0
- package/dist/primitives/slot.js +7 -0
- package/dist/primitives/split-sheet.js +1 -1
- package/dist/primitives/stepper.js +1 -1
- package/dist/primitives/switch.d.ts +16 -3
- package/dist/primitives/switch.js +7 -6
- package/dist/primitives/tabs.d.ts +36 -20
- package/dist/primitives/tabs.js +131 -102
- package/dist/primitives/toggle.d.ts +16 -3
- package/dist/primitives/toggle.js +8 -3
- package/dist/primitives/tooltip.d.ts +24 -5
- package/dist/primitives/tooltip.js +32 -10
- package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
- package/dist/primitives/type-to-confirm-dialog.js +1 -1
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +3 -3
- package/dist/session/composer/editor/composer-editor.js +1 -1
- package/dist/session/composer/menus/menu-shell.d.ts +1 -1
- package/dist/session/composer/menus/menu-shell.js +1 -1
- package/dist/session/composer/menus/mount.js +1 -1
- package/dist/session/composer/reasoning-effort-selector.js +1 -1
- package/dist/session/header/session-site-header.js +2 -2
- package/dist/session/header/subagent-hover-card.js +2 -2
- package/dist/session/media/image-preview.js +1 -1
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +18 -12
- package/dist/session/models/subscription-switcher.d.ts +37 -0
- package/dist/session/models/subscription-switcher.js +97 -0
- package/dist/session/models/subscription-windows.d.ts +40 -0
- package/dist/session/models/subscription-windows.js +86 -0
- package/dist/session/overrides/session-overrides-control.js +3 -3
- package/dist/session/panel/diff-dialog.js +1 -1
- package/dist/session/panel/easy/detail-view.js +3 -3
- package/dist/session/panel/mobile-tool-drawer.js +2 -2
- package/dist/session/panel/panel-fallback.js +1 -1
- package/dist/session/panel/session-files-explorer.d.ts +1 -1
- package/dist/session/panel/session-files-explorer.js +1 -1
- package/dist/session/thread/session-chat.js +2 -2
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/turn-share.js +3 -4
- package/dist/session/tool/shared/show-helpers.js +1 -1
- package/dist/session/turn/message-time-label.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +3 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/review-center.js +1 -1
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
- package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
- package/dist/workspace/sidebar/session-title.d.ts +2 -2
- package/dist/workspace/sidebar/session-title.js +2 -2
- package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
- package/dist/workspace/spaces/space-links.js +1 -1
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/package.json +16 -35
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Select as SelectPrimitive } from '@base-ui/react/select';
|
|
4
|
+
import { CheckIcon as Check, CaretDownIcon as ChevronDown, CaretUpIcon as ChevronUp, } from '@phosphor-icons/react';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { checkedState, FLOATING_LAYER_ATTR, openState, radixPositionVars, splitPosition, stateRender, } from '../lib/base-ui-compat.js';
|
|
3
7
|
import { withPortalContainer } from '../lib/portal-container.js';
|
|
4
8
|
import { cn } from '../lib/utils.js';
|
|
5
9
|
import { floatingZ, useDialogDepth } from '../lib/z-stack.js';
|
|
6
|
-
import { CheckIcon as Check, CaretDownIcon as ChevronDown, CaretUpIcon as ChevronUp, } from '@phosphor-icons/react';
|
|
7
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
8
|
-
import * as React from 'react';
|
|
9
10
|
import { MENU_INDICATOR, MENU_INDICATOR_ICON, MENU_INSET_END, MENU_LABEL, MENU_PANEL_STATIC, MENU_SEPARATOR, menuRow, } from './menu-recipe.js';
|
|
10
11
|
import { TRIGGER_CARET_CLASS, TRIGGER_ICON_SIZE, triggerVariants, } from './trigger-variants.js';
|
|
11
12
|
const SelectPortal = withPortalContainer(SelectPrimitive.Portal);
|
|
@@ -13,7 +14,7 @@ const SelectPortal = withPortalContainer(SelectPrimitive.Portal);
|
|
|
13
14
|
* A select is a menu: the same floating surface holding the same rows, and it
|
|
14
15
|
* shares both with the dropdown and context menu through `./menu-recipe`.
|
|
15
16
|
*
|
|
16
|
-
* Local to a select: `max-h-96` plus the scroll
|
|
17
|
+
* Local to a select: `max-h-96` plus the scroll arrows, because the option
|
|
17
18
|
* list is data-length and a dropdown's is authored; and `min-w-56`, because a
|
|
18
19
|
* select is anchored to a trigger it should not visibly undercut.
|
|
19
20
|
*
|
|
@@ -21,41 +22,97 @@ const SelectPortal = withPortalContainer(SelectPrimitive.Portal);
|
|
|
21
22
|
* on the frame it mounts and unmounts on the frame it closes. See
|
|
22
23
|
* `dropdown-menu.tsx` for why.
|
|
23
24
|
*/
|
|
24
|
-
const SELECT_PANEL = cn(MENU_PANEL_STATIC, '
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
25
|
+
const SELECT_PANEL = cn(MENU_PANEL_STATIC, 'min-w-56 overflow-hidden');
|
|
26
|
+
const SelectLabelsContext = React.createContext(null);
|
|
27
|
+
function collectLabels(node, out) {
|
|
28
|
+
React.Children.forEach(node, (child) => {
|
|
29
|
+
if (!React.isValidElement(child))
|
|
30
|
+
return;
|
|
31
|
+
const props = child.props;
|
|
32
|
+
if (child.type === SelectItem && props.value != null) {
|
|
33
|
+
out[String(props.value)] = props.children;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (props.children)
|
|
37
|
+
collectLabels(props.children, out);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Radix treats `''` and `undefined` as "no value"; Base UI uses `null`. */
|
|
41
|
+
const toBaseValue = (value) => value === undefined || value === '' ? null : value;
|
|
42
|
+
function Select(allProps) {
|
|
43
|
+
const { value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, dir: _dir, children, ...props } = allProps;
|
|
44
|
+
const [mounted, setMounted] = React.useState({});
|
|
45
|
+
const register = React.useCallback((key, label) => {
|
|
46
|
+
setMounted((prev) => (prev[key] === label ? prev : { ...prev, [key]: label }));
|
|
47
|
+
}, []);
|
|
48
|
+
const items = React.useMemo(() => {
|
|
49
|
+
const fromTree = {};
|
|
50
|
+
collectLabels(children, fromTree);
|
|
51
|
+
return { ...mounted, ...fromTree };
|
|
52
|
+
}, [children, mounted]);
|
|
53
|
+
// A `value` key, even `value={undefined}`, means a controlled select that
|
|
54
|
+
// shows its placeholder; no key means uncontrolled.
|
|
55
|
+
const controlled = 'value' in allProps;
|
|
56
|
+
return (_jsx(SelectLabelsContext.Provider, { value: register, children: _jsx(SelectPrimitive.Root, { ...props, items: items, ...(controlled
|
|
57
|
+
? { value: toBaseValue(value) }
|
|
58
|
+
: { defaultValue: toBaseValue(defaultValue) }), onValueChange: (next) => {
|
|
59
|
+
if (typeof next === 'string')
|
|
60
|
+
onValueChange?.(next);
|
|
61
|
+
}, open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, children: children }) }));
|
|
62
|
+
}
|
|
63
|
+
/* ---------- group and label ---------- */
|
|
64
|
+
const SelectGroupContext = React.createContext(false);
|
|
65
|
+
const SelectGroup = React.forwardRef((props, ref) => (_jsx(SelectGroupContext.Provider, { value: true, children: _jsx(SelectPrimitive.Group, { ref: ref, ...props }) })));
|
|
66
|
+
SelectGroup.displayName = 'SelectGroup';
|
|
67
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
68
|
+
const inGroup = React.useContext(SelectGroupContext);
|
|
69
|
+
// Was `pl-8 text-sm font-semibold` — the `pl-8` reserved a left gutter for a
|
|
70
|
+
// leading check that this select does not have (its indicator is at
|
|
71
|
+
// `right-3`), so the label sat indented past every option under it.
|
|
72
|
+
const classes = cn(MENU_LABEL, className);
|
|
73
|
+
// `GroupLabel` labels its group; outside a group the label is plain text.
|
|
74
|
+
return inGroup ? (_jsx(SelectPrimitive.GroupLabel, { ref: ref, className: classes, ...props })) : (_jsx("div", { ref: ref, className: classes, ...props }));
|
|
75
|
+
});
|
|
76
|
+
SelectLabel.displayName = 'SelectLabel';
|
|
77
|
+
/* ---------- trigger and value ---------- */
|
|
78
|
+
const SelectValue = React.forwardRef(({ children, ...props }, ref) => (_jsx(SelectPrimitive.Value, { ref: ref, ...props, children: children ?? undefined })));
|
|
79
|
+
SelectValue.displayName = 'SelectValue';
|
|
80
|
+
const SelectTrigger = React.forwardRef(({ className, children, variant, size, arrow = true, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn(triggerVariants({ variant, size }), className), ...props, render: stateRender('button', openState), children: [children, arrow && (
|
|
81
|
+
// Children, not `render`: without children Base UI fills the icon with a `▼` glyph.
|
|
82
|
+
_jsx(SelectPrimitive.Icon, { className: "flex shrink-0", children: _jsx(ChevronDown, { className: cn(TRIGGER_CARET_CLASS, TRIGGER_ICON_SIZE[size ?? 'sm']) }) }))] })));
|
|
83
|
+
SelectTrigger.displayName = 'SelectTrigger';
|
|
84
|
+
/* ---------- content ---------- */
|
|
85
|
+
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpArrow, { ref: ref, className: cn('bg-popover absolute inset-x-0 top-0 z-[1] flex cursor-default items-center justify-center py-1', // cursor-default: hover-scroll area, not a control.
|
|
31
86
|
className), ...props, children: _jsx(ChevronUp, { className: "size-4" }) })));
|
|
32
|
-
SelectScrollUpButton.displayName =
|
|
33
|
-
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.
|
|
87
|
+
SelectScrollUpButton.displayName = 'SelectScrollUpButton';
|
|
88
|
+
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownArrow, { ref: ref, className: cn('bg-popover absolute inset-x-0 bottom-0 z-[1] flex cursor-default items-center justify-center py-1', // cursor-default: hover-scroll area, not a control.
|
|
34
89
|
className), ...props, children: _jsx(ChevronDown, { className: "size-4" }) })));
|
|
35
|
-
SelectScrollDownButton.displayName =
|
|
36
|
-
const SelectContent = React.forwardRef(({ className, children, position = 'popper', style, ...
|
|
90
|
+
SelectScrollDownButton.displayName = 'SelectScrollDownButton';
|
|
91
|
+
const SelectContent = React.forwardRef(({ className, children, position = 'popper', alignItemWithTrigger, container, style, onCloseAutoFocus: _onCloseAutoFocus, onEscapeKeyDown: _onEscapeKeyDown, onPointerDownOutside: _onPointerDownOutside, ...rest }, ref) => {
|
|
37
92
|
const depth = useDialogDepth();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
93
|
+
const { positioner, rest: props } = splitPosition(rest);
|
|
94
|
+
const aligned = alignItemWithTrigger ?? position === 'item-aligned';
|
|
95
|
+
return (_jsx(SelectPortal, { container: container, children: _jsx(SelectPrimitive.Positioner, { ...positioner, ...FLOATING_LAYER_ATTR, alignItemWithTrigger: aligned, className: "outline-none", style: { zIndex: floatingZ(depth), ...radixPositionVars('select') }, children: _jsxs(SelectPrimitive.Popup, { ref: ref, className: cn(SELECT_PANEL, !aligned &&
|
|
96
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), style: style, ...props, render: stateRender('div', openState), children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.List, { className: cn('max-h-[min(24rem,var(--available-height))] scroll-py-6 overflow-y-auto', !aligned && 'w-full min-w-[calc(var(--anchor-width)-8px)]'), children: children }), _jsx(SelectScrollDownButton, {})] }) }) }));
|
|
97
|
+
});
|
|
98
|
+
SelectContent.displayName = 'SelectContent';
|
|
99
|
+
/* ---------- item ---------- */
|
|
100
|
+
const SelectItem = React.forwardRef(({ className, children, size = 'sm', description, value, textValue, ...props }, ref) => {
|
|
101
|
+
const register = React.useContext(SelectLabelsContext);
|
|
102
|
+
React.useEffect(() => {
|
|
103
|
+
register?.(value, children);
|
|
104
|
+
}, [register, value, children]);
|
|
105
|
+
return (_jsxs(SelectPrimitive.Item, { ref: ref, value: value, label: textValue,
|
|
106
|
+
// `MENU_INSET_END` reserves the trailing slot on every row, checked or
|
|
107
|
+
// not, so a long label truncates before the check instead of running
|
|
108
|
+
// under it, and the check column is the same x on every row.
|
|
109
|
+
className: cn(menuRow(size, 'default'), MENU_INSET_END, description && 'items-start', className), ...props, render: stateRender('div', (s) => checkedState({ checked: s.selected })), children: [_jsx("span", { "data-slot": "select-item-indicator",
|
|
110
|
+
// Absolute inside a flex row: its static position follows the row's
|
|
111
|
+
// `items-*`, so it centres on a one-line row. On a described row it tops
|
|
112
|
+
// out, and `mt-0.5` centres the ~15px slot on the 20px first line.
|
|
113
|
+
className: cn(MENU_INDICATOR, 'absolute right-2', description && 'mt-0.5'), children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }), description ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx(SelectPrimitive.ItemText, { children: children }), _jsx("span", { className: "text-muted-foreground max-w-64 text-xs whitespace-normal", children: description })] })) : (_jsx(SelectPrimitive.ItemText, { children: children }))] }));
|
|
41
114
|
});
|
|
42
|
-
|
|
43
|
-
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (
|
|
44
|
-
// Was `pl-8 text-sm font-semibold` — the `pl-8` reserved a left gutter for a
|
|
45
|
-
// leading check that this select does not have (its indicator is at
|
|
46
|
-
// `right-3`), so the label sat indented past every option under it.
|
|
47
|
-
_jsx(SelectPrimitive.Label, { ref: ref, className: cn(MENU_LABEL, className), ...props })));
|
|
48
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
49
|
-
const SelectItem = React.forwardRef(({ className, children, size = 'sm', description, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref,
|
|
50
|
-
// `MENU_INSET_END` reserves the trailing slot on every row, checked or
|
|
51
|
-
// not, so a long label truncates before the check instead of running
|
|
52
|
-
// under it, and the check column is the same x on every row.
|
|
53
|
-
className: cn(menuRow(size, 'default'), MENU_INSET_END, description && 'items-start', className), ...props, children: [_jsx("span", { "data-slot": "select-item-indicator",
|
|
54
|
-
// Absolute inside a flex row: its static position follows the row's
|
|
55
|
-
// `items-*`, so it centres on a one-line row. On a described row it tops
|
|
56
|
-
// out, and `mt-0.5` centres the ~15px slot on the 20px first line.
|
|
57
|
-
className: cn(MENU_INDICATOR, 'absolute right-2', description && 'mt-0.5'), children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }), description ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx(SelectPrimitive.ItemText, { children: children }), _jsx("span", { className: "text-muted-foreground max-w-64 text-xs whitespace-normal", children: description })] })) : (_jsx(SelectPrimitive.ItemText, { children: children }))] })));
|
|
58
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
115
|
+
SelectItem.displayName = 'SelectItem';
|
|
59
116
|
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn(MENU_SEPARATOR, className), ...props })));
|
|
60
|
-
SelectSeparator.displayName =
|
|
117
|
+
SelectSeparator.displayName = 'SelectSeparator';
|
|
61
118
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<
|
|
2
|
+
declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<'div'> & {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
/** Purely visual: hidden from assistive tech (`role="none"`). */
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
}): React.JSX.Element;
|
|
4
8
|
export { Separator };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
function Separator({ className, orientation = 'horizontal', decorative = true, ...props }) {
|
|
6
|
-
|
|
6
|
+
const { asChild, ...rest } = props;
|
|
7
|
+
const Comp = (asChild ? Slot : 'div');
|
|
8
|
+
// Base UI's Separator is never decorative, so this renders the Radix contract itself.
|
|
9
|
+
return (_jsx(Comp, { "data-slot": "separator", "data-orientation": orientation, ...(decorative
|
|
10
|
+
? { role: 'none' }
|
|
11
|
+
: {
|
|
12
|
+
role: 'separator',
|
|
13
|
+
'aria-orientation': orientation === 'vertical' ? 'vertical' : undefined,
|
|
14
|
+
}), className: cn('bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px', className), ...rest }));
|
|
7
15
|
}
|
|
8
16
|
export { Separator };
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
2
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
2
|
import * as React from 'react';
|
|
4
|
-
import { type
|
|
5
|
-
declare const Sheet: ({ open, defaultOpen, onOpenChange,
|
|
6
|
-
declare const SheetTrigger:
|
|
7
|
-
|
|
3
|
+
import { type DialogContentBaseProps } from './dialog.js';
|
|
4
|
+
declare const Sheet: ({ open, defaultOpen, onOpenChange, modal, children }: import("./dialog.js").DialogProps) => React.JSX.Element;
|
|
5
|
+
declare const SheetTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
} & import("./trigger-variants.js").TriggerVariantProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const SheetClose: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
8
11
|
declare const SheetPortal: {
|
|
9
|
-
(props:
|
|
12
|
+
(props: Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
|
|
10
13
|
displayName: string;
|
|
11
14
|
};
|
|
12
|
-
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<
|
|
15
|
+
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
16
|
declare const sheetVariants: (props?: ({
|
|
14
17
|
side?: "bottom" | "left" | "right" | "top" | null | undefined;
|
|
15
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
-
interface SheetContentProps extends
|
|
19
|
+
interface SheetContentProps extends DialogContentBaseProps, VariantProps<typeof sheetVariants> {
|
|
17
20
|
showCloseButton?: boolean;
|
|
18
21
|
overlayClassName?: string;
|
|
19
22
|
}
|
|
@@ -30,6 +33,10 @@ declare const SheetBody: {
|
|
|
30
33
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
31
34
|
displayName: string;
|
|
32
35
|
};
|
|
33
|
-
declare const SheetTitle: React.ForwardRefExoticComponent<Omit<
|
|
34
|
-
|
|
36
|
+
declare const SheetTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
39
|
+
declare const SheetDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
40
|
+
asChild?: boolean;
|
|
41
|
+
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
35
42
|
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, };
|
package/dist/primitives/sheet.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Close } from '../icons/close.js';
|
|
7
|
-
import {
|
|
7
|
+
import { asChildRender, openState, stateRender } from '../lib/base-ui-compat.js';
|
|
8
8
|
import { cn } from '../lib/utils.js';
|
|
9
9
|
import { useUiStrings } from '../providers/ui-provider.js';
|
|
10
|
-
import {
|
|
10
|
+
import { dialogContentZ, dialogOverlayZ, useDialogDepth } from '../lib/z-stack.js';
|
|
11
11
|
import { buttonVariants } from './button.js';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
className: asChild ? className : cn(triggerVariants({ variant, size }), className), ...props }));
|
|
20
|
-
const SheetClose = SheetPrimitive.Close;
|
|
21
|
-
const SheetPortal = withPortalContainer(SheetPrimitive.Portal);
|
|
12
|
+
import { Dialog, DialogClose, DialogPopup, DialogPortal, DialogTrigger, } from './dialog.js';
|
|
13
|
+
// A sheet is a dialog that slides in from an edge: same root, trigger, close,
|
|
14
|
+
// portal and popup contract; only the surface and its motion differ.
|
|
15
|
+
const Sheet = Dialog;
|
|
16
|
+
const SheetTrigger = DialogTrigger;
|
|
17
|
+
const SheetClose = DialogClose;
|
|
18
|
+
const SheetPortal = DialogPortal;
|
|
22
19
|
const SheetOverlay = React.forwardRef(({ className, style, ...props }, ref) => {
|
|
23
20
|
const depth = useDialogDepth();
|
|
24
|
-
return (_jsx(SheetPrimitive.
|
|
21
|
+
return (_jsx(SheetPrimitive.Backdrop, { className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 bg-black/80', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props, ref: ref }));
|
|
25
22
|
});
|
|
26
|
-
SheetOverlay.displayName =
|
|
23
|
+
SheetOverlay.displayName = 'SheetOverlay';
|
|
27
24
|
const sheetVariants = cva('fixed flex min-h-0 flex-col gap-4 overflow-hidden bg-sidebar p-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out h-[calc(100vh-1.4rem)]', {
|
|
28
25
|
variants: {
|
|
29
26
|
side: {
|
|
@@ -37,20 +34,20 @@ const sheetVariants = cva('fixed flex min-h-0 flex-col gap-4 overflow-hidden bg-
|
|
|
37
34
|
side: 'right',
|
|
38
35
|
},
|
|
39
36
|
});
|
|
40
|
-
const SheetContent = React.forwardRef(({ side = 'right', className, children, showCloseButton = true, overlayClassName, style, ...props }, ref) => {
|
|
37
|
+
const SheetContent = React.forwardRef(({ side = 'right', className, children, showCloseButton = true, overlayClassName, style, forceMount, ...props }, ref) => {
|
|
41
38
|
const depth = useDialogDepth();
|
|
42
39
|
const strings = useUiStrings();
|
|
43
|
-
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, { className: overlayClassName }), _jsxs(
|
|
40
|
+
return (_jsxs(SheetPortal, { keepMounted: forceMount, children: [_jsx(SheetOverlay, { className: overlayClassName }), _jsxs(DialogPopup, { ref: ref, className: cn(sheetVariants({ side }), className), style: { zIndex: dialogContentZ(depth), ...style }, ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { className: cn('absolute top-4 right-4', buttonVariants({ variant: 'ghost', size: 'icon' })), children: [_jsx(Close, { className: "size-[1.15rem] stroke-0" }), _jsx("span", { className: "sr-only", children: strings.close })] }))] })] }));
|
|
44
41
|
});
|
|
45
|
-
SheetContent.displayName =
|
|
42
|
+
SheetContent.displayName = 'SheetContent';
|
|
46
43
|
const SheetHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex shrink-0 flex-col space-y-2 text-center sm:text-left', className), ...props }));
|
|
47
44
|
SheetHeader.displayName = 'SheetHeader';
|
|
48
45
|
const SheetFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex shrink-0 flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
|
|
49
46
|
SheetFooter.displayName = 'SheetFooter';
|
|
50
47
|
const SheetBody = ({ className, ...props }) => (_jsx("div", { className: cn('flex min-h-0 w-full flex-1 flex-col items-start justify-start gap-4 overflow-y-auto py-6', className), ...props }));
|
|
51
48
|
SheetBody.displayName = 'SheetBody';
|
|
52
|
-
const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ref: ref, className: cn('text-foreground text-lg font-semibold', className), ...props })));
|
|
53
|
-
SheetTitle.displayName =
|
|
54
|
-
const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ref: ref, className: cn('text-muted-foreground text-sm', className), ...props })));
|
|
55
|
-
SheetDescription.displayName =
|
|
49
|
+
const SheetTitle = React.forwardRef(({ className, asChild, children, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ...asChildRender(asChild, children), ref: ref, className: cn('text-foreground text-lg font-semibold', className), ...props })));
|
|
50
|
+
SheetTitle.displayName = 'SheetTitle';
|
|
51
|
+
const SheetDescription = React.forwardRef(({ className, asChild, children, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ...asChildRender(asChild, children), ref: ref, className: cn('text-muted-foreground text-sm', className), ...props })));
|
|
52
|
+
SheetDescription.displayName = 'SheetDescription';
|
|
56
53
|
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { Slot } from 'radix-ui';
|
|
5
4
|
import * as React from 'react';
|
|
5
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
6
|
+
import { cn } from '../lib/utils.js';
|
|
6
7
|
import { useSidebar } from './sidebar-context.js';
|
|
7
8
|
import { Skeleton } from './skeleton.js';
|
|
8
9
|
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip.js';
|
|
9
|
-
import { cn } from '../lib/utils.js';
|
|
10
10
|
function SidebarGroup({ className, ...props }) {
|
|
11
11
|
return (_jsx("div", { "data-slot": "sidebar-group", "data-sidebar": "group", className: cn('relative flex w-full min-w-0 flex-col p-2', className), ...props }));
|
|
12
12
|
}
|
|
13
13
|
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
14
|
-
const Comp = asChild ? Slot
|
|
15
|
-
return (_jsx(Comp, { "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity]
|
|
14
|
+
const Comp = asChild ? Slot : 'div';
|
|
15
|
+
return (_jsx(Comp, { "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring duration-moderate flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className), ...props }));
|
|
16
16
|
}
|
|
17
17
|
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
18
|
-
const Comp = asChild ? Slot
|
|
18
|
+
const Comp = asChild ? Slot : 'button';
|
|
19
19
|
return (_jsx(Comp, { "data-slot": "sidebar-group-action", "data-sidebar": "group-action", className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-hover hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
20
20
|
// Increases the hit area of the button on mobile.
|
|
21
21
|
'after:absolute after:-inset-2 md:after:hidden', 'group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
@@ -52,7 +52,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
54
|
function SidebarMenuButton({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }) {
|
|
55
|
-
const Comp = asChild ? Slot
|
|
55
|
+
const Comp = asChild ? Slot : 'button';
|
|
56
56
|
const { isMobile, state } = useSidebar();
|
|
57
57
|
const button = (_jsx(Comp, { "data-slot": "sidebar-menu-button", "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
|
|
58
58
|
if (!tooltip) {
|
|
@@ -66,7 +66,7 @@ function SidebarMenuButton({ asChild = false, isActive = false, variant = 'defau
|
|
|
66
66
|
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== 'collapsed' || isMobile, ...tooltip })] }));
|
|
67
67
|
}
|
|
68
68
|
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
69
|
-
const Comp = asChild ? Slot
|
|
69
|
+
const Comp = asChild ? Slot : 'button';
|
|
70
70
|
return (_jsx(Comp, { "data-slot": "sidebar-menu-action", "data-sidebar": "menu-action", className: cn('text-sidebar-foreground ring-sidebar-ring peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-hover hover:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
71
71
|
// Increases the hit area of the button on mobile.
|
|
72
72
|
'after:absolute after:-inset-2 md:after:hidden', 'peer-data-[size=sm]/menu-button:top-1', 'peer-data-[size=default]/menu-button:top-1.5', 'peer-data-[size=lg]/menu-button:top-2.5', 'group-data-[collapsible=icon]:hidden', showOnHover &&
|
|
@@ -91,7 +91,7 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
91
91
|
return (_jsx("li", { "data-slot": "sidebar-menu-sub-item", "data-sidebar": "menu-sub-item", className: cn('group/menu-sub-item relative', className), ...props }));
|
|
92
92
|
}
|
|
93
93
|
function SidebarMenuSubButton({ asChild = false, size = 'md', isActive = false, className, ...props }) {
|
|
94
|
-
const Comp = asChild ? Slot
|
|
94
|
+
const Comp = asChild ? Slot : 'a';
|
|
95
95
|
return (_jsx(Comp, { "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-hover hover:text-sidebar-accent-foreground active:bg-active active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-active data-[active=true]:text-sidebar-accent-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
96
96
|
}
|
|
97
97
|
export { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
import type { SliderRootProps } from './slider.js';
|
|
3
|
+
declare function NativeSlider({ className, defaultValue, value, min, max, tooltip, onValueChange, onValueCommit, minStepsBetweenThumbs, inverted: _inverted, orientation, ...props }: SliderRootProps & {
|
|
4
4
|
/** Shown in a Hint above the thumb while hovering it. */
|
|
5
5
|
tooltip?: React.ReactNode;
|
|
6
6
|
}): React.JSX.Element;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Slider as SliderPrimitive } from '
|
|
3
|
+
import { Slider as SliderPrimitive } from '@base-ui/react/slider';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import Hint from './hint.js';
|
|
6
5
|
import { cn } from '../lib/utils.js';
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import Hint from './hint.js';
|
|
7
|
+
// `has-focus-visible`: the thumb's focusable node is its hidden range input.
|
|
8
|
+
const thumb = (index) => (_jsx(SliderPrimitive.Thumb, { "data-slot": "slider-thumb", index: index, className: "border-ring ring-ring/50 hit-area-4 relative block size-3.5 shrink-0 rounded-full border bg-white transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 has-focus-visible:ring-3 data-disabled:pointer-events-none data-disabled:opacity-50" }));
|
|
9
|
+
const asArray = (value) => (Array.isArray(value) ? [...value] : [value]);
|
|
10
|
+
function NativeSlider({ className, defaultValue, value, min = 0, max = 100, tooltip, onValueChange, onValueCommit, minStepsBetweenThumbs, inverted: _inverted, orientation, ...props }) {
|
|
9
11
|
const _values = React.useMemo(() => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]), [value, defaultValue, min, max]);
|
|
10
|
-
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
return (_jsx(SliderPrimitive.Root, { "data-slot": "slider", defaultValue: defaultValue, value: value, min: min, max: max, orientation: orientation, "data-orientation": orientation ?? 'horizontal', minStepsBetweenValues: minStepsBetweenThumbs, onValueChange: onValueChange ? (next) => onValueChange(asArray(next)) : undefined, onValueCommitted: onValueCommit ? (next) => onValueCommit(asArray(next)) : undefined, className: cn('relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-40 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col', className), ...props, children: _jsxs(SliderPrimitive.Control, { "data-slot": "slider-control", className: "relative flex w-full grow items-center data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", children: [_jsx(SliderPrimitive.Track, { "data-slot": "slider-track", className: "bg-kortix-base/60 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1", children: _jsx(SliderPrimitive.Indicator, { "data-slot": "slider-range", className: "bg-kortix-blue absolute select-none data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full" }) }), Array.from({ length: _values.length }, (_, index) => {
|
|
13
|
+
if (tooltip == null)
|
|
14
|
+
return _jsx(React.Fragment, { children: thumb(index) }, index);
|
|
15
|
+
return (_jsx(Hint, { side: "top", label: tooltip, children: thumb(index) }, index));
|
|
16
|
+
})] }) }));
|
|
15
17
|
}
|
|
16
18
|
export { NativeSlider };
|
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
/** The Radix slider contract: values are always `number[]`, one per thumb. */
|
|
3
|
+
type SliderRootProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'dir' | 'onChange'> & {
|
|
4
|
+
value?: number[];
|
|
5
|
+
defaultValue?: number[];
|
|
6
|
+
onValueChange?: (value: number[]) => void;
|
|
7
|
+
/** Fires once when a drag or key press ends. */
|
|
8
|
+
onValueCommit?: (value: number[]) => void;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
minStepsBetweenThumbs?: number;
|
|
13
|
+
orientation?: 'horizontal' | 'vertical';
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Accepted for Radix parity; Base UI does not invert. */
|
|
16
|
+
inverted?: boolean;
|
|
17
|
+
dir?: 'ltr' | 'rtl';
|
|
18
|
+
name?: string;
|
|
19
|
+
};
|
|
20
|
+
type SliderProps = SliderRootProps & {
|
|
4
21
|
/**
|
|
5
|
-
* Accessible name for the thumb(s).
|
|
6
|
-
*
|
|
7
|
-
*
|
|
22
|
+
* Accessible name for the thumb(s). Each thumb holds the `role="slider"`
|
|
23
|
+
* input, so a name on the root is never announced — it has to land here.
|
|
24
|
+
* Pass an array to name each thumb of a range slider.
|
|
8
25
|
*/
|
|
9
26
|
thumbLabel?: string | string[];
|
|
10
27
|
/** Announced in place of the raw number (`aria-valuetext`), e.g. `40%`, `0.85`. */
|
|
11
28
|
formatValue?: (value: number, index: number) => string;
|
|
12
29
|
};
|
|
13
|
-
declare function Slider({ className, defaultValue, value, min, max, onValueChange, thumbLabel, formatValue, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: SliderProps): React.JSX.Element;
|
|
30
|
+
declare function Slider({ className, defaultValue, value, min, max, onValueChange, thumbLabel, formatValue, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, onValueCommit, minStepsBetweenThumbs, inverted: _inverted, orientation, ...props }: SliderProps): React.JSX.Element;
|
|
14
31
|
export { Slider };
|
|
32
|
+
export type { SliderProps, SliderRootProps };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Slider as SliderPrimitive } from '@base-ui/react/slider';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { cn } from '../lib/utils.js';
|
|
6
|
-
|
|
6
|
+
const asArray = (value) => (Array.isArray(value) ? [...value] : [value]);
|
|
7
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, onValueChange, thumbLabel, formatValue, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, onValueCommit, minStepsBetweenThumbs, inverted: _inverted, orientation, ...props }) {
|
|
7
8
|
const [uncontrolledValues, setUncontrolledValues] = React.useState(() => Array.isArray(defaultValue) ? defaultValue : [min, max]);
|
|
8
9
|
const values = Array.isArray(value) ? value : uncontrolledValues;
|
|
9
10
|
const handleValueChange = React.useCallback((next) => {
|
|
@@ -22,27 +23,28 @@ function Slider({ className, defaultValue, value, min = 0, max = 100, onValueCha
|
|
|
22
23
|
return `${base} maximum`;
|
|
23
24
|
return `${base} ${index + 1}`;
|
|
24
25
|
};
|
|
25
|
-
return (
|
|
26
|
-
'data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col', className), ...props, children: [_jsx(SliderPrimitive.Track, { "data-slot": "slider-track", className: cn(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
return (_jsx(SliderPrimitive.Root, { "data-slot": "slider", "data-orientation": orientation ?? 'horizontal', defaultValue: defaultValue, value: value, min: min, max: max, orientation: orientation, minStepsBetweenValues: minStepsBetweenThumbs, onValueChange: (next) => handleValueChange(asArray(next)), onValueCommitted: onValueCommit ? (next) => onValueCommit(asArray(next)) : undefined, className: cn('group/slider relative flex w-full cursor-pointer touch-none items-center select-none', 'data-disabled:pointer-events-none data-disabled:cursor-default data-disabled:opacity-50', // cursor-default: disabled control.
|
|
27
|
+
'data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col', className), ...props, children: _jsxs(SliderPrimitive.Control, { "data-slot": "slider-control", className: "relative flex w-full grow items-center data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", children: [_jsx(SliderPrimitive.Track, { "data-slot": "slider-track", className: cn(
|
|
28
|
+
// Hairline rail: the whole control is one thin ink stroke.
|
|
29
|
+
'bg-primary/10 relative grow overflow-hidden rounded-full', 'data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:w-full', 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1'), children: _jsx(SliderPrimitive.Indicator, { "data-slot": "slider-range", className: cn('bg-primary absolute rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full') }) }), values.map((_, index) => (_jsx(SliderPrimitive.Thumb, { "data-slot": "slider-thumb", index: index, "aria-label": labelFor(index), "aria-labelledby": ariaLabelledBy, getAriaValueText: formatValue ? (_formatted, thumbValue) => formatValue(thumbValue, index) : undefined, className: cn(
|
|
30
|
+
// Caret thumb: a short vertical bar in the same ink as the fill, so
|
|
31
|
+
// the range reads as one continuous stroke that rises into a handle.
|
|
32
|
+
'bg-primary block h-4 w-2 shrink-0 rounded-full', 'group-data-[orientation=vertical]/slider:h-1 group-data-[orientation=vertical]/slider:w-4',
|
|
33
|
+
// 44x51px touch target without shifting layout.
|
|
34
|
+
'hit-area-x-4 hit-area-y-5 cursor-pointer',
|
|
35
|
+
// `scale` composes with the thumb's inline `translate: -50% -50%` (Tailwind v4
|
|
36
|
+
// uses the standalone `scale` property), so the bar grows around its
|
|
37
|
+
// own center without breaking thumb positioning.
|
|
38
|
+
'duration-fast ease-default transition-[scale,box-shadow] outline-none', 'active:scale-x-150 active:scale-y-125',
|
|
39
|
+
// Focus: accent ring with a surface-coloured gap that punches through
|
|
40
|
+
// the track, so the indicator reads as "on the thumb".
|
|
41
|
+
// `:focus-within` — the thumb's focusable node is its hidden range input.
|
|
42
|
+
// Not `:focus-visible`: Chrome resolves focus-visible once, at
|
|
43
|
+
// focus time, so a thumb grabbed by pointer would stay unringed for the
|
|
44
|
+
// rest of the interaction even after the user switches to arrow keys.
|
|
45
|
+
'focus-within:ring-ring focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2',
|
|
46
|
+
// Forced-colors mode strips box-shadow rings; a transparent outline is
|
|
47
|
+
// repainted there as a real system-coloured focus ring.
|
|
48
|
+
'focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-transparent focus-within:outline-solid', 'data-disabled:pointer-events-none data-disabled:cursor-default') }, index)))] }) }));
|
|
47
49
|
}
|
|
48
50
|
export { Slider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* `Slot` renders its only child with the props it receives merged in:
|
|
4
|
+
* handlers chain, classes join, styles merge, refs compose. It is the
|
|
5
|
+
* `asChild` building block for components outside `@kortix/ui`.
|
|
6
|
+
*/
|
|
7
|
+
export { Slot } from '../lib/base-ui-compat.js';
|
|
@@ -53,7 +53,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
import { XIcon } from '@phosphor-icons/react';
|
|
56
|
-
import { Slot } from '
|
|
56
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
57
57
|
import * as React from 'react';
|
|
58
58
|
import { cn } from '../lib/utils.js';
|
|
59
59
|
import { hasOpenFloatingLayer } from '../lib/z-stack.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import { createContext, useContext } from 'react';
|
|
5
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
6
6
|
import { cn } from '../lib/utils.js';
|
|
7
7
|
const StepperContext = createContext(undefined);
|
|
8
8
|
const StepItemContext = createContext(undefined);
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
2
1
|
import { type ComponentProps } from 'react';
|
|
3
|
-
type SwitchProps = Omit<ComponentProps<
|
|
2
|
+
type SwitchProps = Omit<ComponentProps<'button'>, 'value' | 'checked' | 'defaultChecked' | 'onChange' | 'ref'> & {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
required?: boolean;
|
|
4
9
|
label?: string;
|
|
5
10
|
};
|
|
6
|
-
declare const Switch: import("react").ForwardRefExoticComponent<Omit<
|
|
11
|
+
declare const Switch: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref" | "defaultChecked" | "onChange" | "value" | "checked"> & {
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
15
|
+
name?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
20
|
export { Switch };
|
|
8
21
|
export type { SwitchProps };
|