@kortix/ui 0.15.6 → 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/providers/provider-accordion.js +3 -2
- package/dist/customize/providers/provider-connect.d.ts +7 -0
- package/dist/customize/providers/provider-connect.js +21 -2
- package/dist/customize/providers/provider-sheet.js +3 -2
- package/dist/customize/sections/gateway-view.d.ts +2 -2
- package/dist/customize/sections/gateway-view.js +30 -15
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.d.ts +3 -1
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/view/account-secret-resources-panel.js +8 -5
- 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/review-center-connected.js +15 -3
- package/dist/customize/sections/view/subscription-usage.d.ts +269 -17
- package/dist/customize/sections/view/subscription-usage.js +197 -54
- 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 +40 -47
- package/dist/i18n/en.js +47 -54
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +5 -0
- 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/auth/auth-primitives.d.ts +27 -0
- package/dist/internal/auth/auth-primitives.js +21 -0
- package/dist/internal/billing/index.d.ts +1 -0
- package/dist/internal/billing/index.js +2 -0
- package/dist/internal/billing/use-free-grant-unspent.d.ts +10 -0
- package/dist/internal/billing/use-free-grant-unspent.js +20 -0
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/billing/billing-gate-state.d.ts +20 -0
- package/dist/internal/lib/billing/billing-gate-state.js +22 -0
- package/dist/internal/lib/error-handler.js +0 -2
- 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/notifications/notification-inbox.js +1 -1
- 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/upgrade-dialog-store.d.ts +0 -2
- package/dist/internal/stores/upgrade-dialog-store.js +0 -2
- 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/markdown/setup-links/approval-decision.d.ts +1 -1
- package/dist/markdown/setup-links/approval-decision.js +1 -1
- 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/prompts/ask-deck.d.ts +14 -2
- package/dist/session/prompts/ask-deck.js +6 -2
- 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 +40 -47
- package/dist/workspace/admin/settings-search.js +4 -12
- package/dist/workspace/inbox/workspace-inbox.js +11 -2
- package/dist/workspace/layout/new-session-create.d.ts +4 -2
- package/dist/workspace/layout/new-session-create.js +11 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/approval-modal.d.ts +6 -6
- package/dist/workspace/review/approval-modal.js +10 -14
- package/dist/workspace/review/review-center.d.ts +9 -2
- package/dist/workspace/review/review-center.js +258 -126
- package/dist/workspace/review/review-detail.d.ts +20 -10
- package/dist/workspace/review/review-detail.js +39 -44
- package/dist/workspace/review/review-meta.d.ts +27 -6
- package/dist/workspace/review/review-meta.js +46 -34
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +53 -0
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +2 -1
- package/dist/workspace/sidebar/footer/promo-nav-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/project-sidebar.d.ts +6 -1
- package/dist/workspace/sidebar/project-sidebar.js +3 -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-model.d.ts +19 -13
- package/dist/workspace/sidebar/workspace-menu-model.js +7 -8
- 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
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +0 -25
- package/dist/customize/sections/view/subscription-usage-tab.js +0 -121
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
type AccordionBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'dir' | 'onChange'> & {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
orientation?: 'horizontal' | 'vertical';
|
|
5
|
+
dir?: 'ltr' | 'rtl';
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type AccordionSingleProps = AccordionBaseProps & {
|
|
9
|
+
type: 'single';
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
|
+
/** Lets the open item close again. Without it one item always stays open. */
|
|
14
|
+
collapsible?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type AccordionMultipleProps = AccordionBaseProps & {
|
|
17
|
+
type: 'multiple';
|
|
18
|
+
value?: string[];
|
|
19
|
+
defaultValue?: string[];
|
|
20
|
+
onValueChange?: (value: string[]) => void;
|
|
21
|
+
};
|
|
22
|
+
type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
23
|
+
/**
|
|
24
|
+
* The Radix accordion contract on Base UI: `type="single"` takes and returns
|
|
25
|
+
* a string, `type="multiple"` an array, and a single accordion without
|
|
26
|
+
* `collapsible` keeps its open item open.
|
|
27
|
+
*/
|
|
28
|
+
declare function Accordion(props: AccordionProps): React.JSX.Element;
|
|
29
|
+
declare function AccordionItem({ className, asChild, children, ...props }: Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> & {
|
|
30
|
+
value: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
declare function AccordionTrigger({ className, children, ...props }: React.ComponentPropsWithoutRef<'button'>): React.JSX.Element;
|
|
35
|
+
declare function AccordionContent({ className, children, forceMount, style, ...props }: React.ComponentPropsWithoutRef<'div'> & {
|
|
36
|
+
forceMount?: true;
|
|
37
|
+
}): React.JSX.Element;
|
|
7
38
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion';
|
|
3
4
|
import { CaretDownIcon as ChevronDownIcon } from '@phosphor-icons/react';
|
|
4
|
-
import * as
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { asChildRender, openState, stateRender } from '../lib/base-ui-compat.js';
|
|
5
7
|
import { cn } from '../lib/utils.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const toArray = (value) => value === undefined ? undefined : Array.isArray(value) ? value : value ? [value] : [];
|
|
9
|
+
/**
|
|
10
|
+
* The Radix accordion contract on Base UI: `type="single"` takes and returns
|
|
11
|
+
* a string, `type="multiple"` an array, and a single accordion without
|
|
12
|
+
* `collapsible` keeps its open item open.
|
|
13
|
+
*/
|
|
14
|
+
function Accordion(props) {
|
|
15
|
+
const { type, value, defaultValue, onValueChange, collapsible: collapsibleProp, asChild, children, dir: _dir, ...rest } = props;
|
|
16
|
+
const single = type === 'single';
|
|
17
|
+
const collapsible = single ? collapsibleProp : true;
|
|
18
|
+
const isControlled = value !== undefined;
|
|
19
|
+
const [inner, setInner] = React.useState(() => toArray(defaultValue) ?? []);
|
|
20
|
+
const current = isControlled ? (toArray(value) ?? []) : inner;
|
|
21
|
+
const handleChange = (next) => {
|
|
22
|
+
const values = next;
|
|
23
|
+
if (single && !collapsible && values.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
if (!isControlled)
|
|
26
|
+
setInner(values);
|
|
27
|
+
if (single)
|
|
28
|
+
onValueChange?.(values[0] ?? '');
|
|
29
|
+
else
|
|
30
|
+
onValueChange?.(values);
|
|
31
|
+
};
|
|
32
|
+
const slot = asChildRender(asChild, children);
|
|
33
|
+
return (_jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...rest, multiple: !single, value: current, onValueChange: handleChange, render: slot.render, children: slot.children }));
|
|
8
34
|
}
|
|
9
|
-
function AccordionItem({ className, ...props }) {
|
|
10
|
-
|
|
35
|
+
function AccordionItem({ className, asChild, children, ...props }) {
|
|
36
|
+
const slot = asChildRender(asChild, children);
|
|
37
|
+
return (_jsx(AccordionPrimitive.Item, { "data-slot": "accordion-item", ...props, className: cn('border-b last:border-b-0', className), render: stateRender('div', openState, slot.render), children: slot.children }));
|
|
11
38
|
}
|
|
12
39
|
function AccordionTrigger({ className, children, ...props }) {
|
|
13
|
-
return (_jsx(AccordionPrimitive.Header, { className: "flex", children: _jsxs(AccordionPrimitive.Trigger, { "data-slot": "accordion-trigger", className: cn('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-2xl py-4 text-left text-sm font-medium transition-colors outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className),
|
|
40
|
+
return (_jsx(AccordionPrimitive.Header, { className: "flex", render: stateRender('h3', openState), children: _jsxs(AccordionPrimitive.Trigger, { "data-slot": "accordion-trigger", ...props, className: cn('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-2xl py-4 text-left text-sm font-medium transition-colors outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className), render: stateRender('button', openState), children: [children, _jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-moderate" })] }) }));
|
|
14
41
|
}
|
|
15
|
-
function AccordionContent({ className, children, ...props }) {
|
|
16
|
-
return (_jsx(AccordionPrimitive.
|
|
42
|
+
function AccordionContent({ className, children, forceMount, style, ...props }) {
|
|
43
|
+
return (_jsx(AccordionPrimitive.Panel, { "data-slot": "accordion-content", ...props, keepMounted: forceMount, className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
44
|
+
// The keyframes in theme.css read the Radix variable name.
|
|
45
|
+
style: {
|
|
46
|
+
'--radix-accordion-content-height': 'var(--accordion-panel-height)',
|
|
47
|
+
'--radix-accordion-content-width': 'var(--accordion-panel-width)',
|
|
48
|
+
...style,
|
|
49
|
+
}, render: stateRender('div', openState), children: _jsx("div", { className: cn('pt-0 pb-4', className), children: children }) }));
|
|
17
50
|
}
|
|
18
51
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { type DismissHandlers } from '../lib/base-ui-compat.js';
|
|
3
3
|
import { ButtonProps } from './button.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type ButtonLikeProps = Omit<React.ComponentProps<'button'>, 'size'> & {
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface AlertDialogProps {
|
|
8
|
+
open?: boolean;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function AlertDialog({ children, open, defaultOpen, onOpenChange }: AlertDialogProps): React.JSX.Element;
|
|
14
|
+
declare function AlertDialogTrigger({ asChild, children, ...props }: ButtonLikeProps): React.JSX.Element;
|
|
15
|
+
declare function AlertDialogPortal({ container, forceMount, children, }: {
|
|
16
|
+
container?: HTMLElement | null;
|
|
17
|
+
forceMount?: true;
|
|
18
|
+
children?: React.ReactNode;
|
|
10
19
|
}): React.JSX.Element;
|
|
20
|
+
declare function AlertDialogOverlay({ className, style, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
21
|
+
type AlertDialogContentProps = React.ComponentProps<'div'> & Omit<DismissHandlers, 'onPointerDownOutside' | 'onInteractOutside' | 'onFocusOutside'> & {
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
forceMount?: true;
|
|
24
|
+
overlayClassName?: string;
|
|
25
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
26
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
27
|
+
};
|
|
28
|
+
declare function AlertDialogContent({ className, style, overlayClassName, asChild, forceMount, children, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }: AlertDialogContentProps): React.JSX.Element;
|
|
11
29
|
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
30
|
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
13
|
-
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
declare function AlertDialogTitle({ className, asChild, children, ...props }: React.ComponentProps<'h2'> & {
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
declare function AlertDialogDescription({ className, asChild, children, ...props }: React.ComponentProps<'p'> & {
|
|
35
|
+
asChild?: boolean;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
declare function AlertDialogAction({ className, variant, ...props }: ButtonLikeProps & {
|
|
16
38
|
variant?: ButtonProps['variant'];
|
|
17
39
|
}): React.JSX.Element;
|
|
18
|
-
declare function AlertDialogCancel({ className, ...props }:
|
|
40
|
+
declare function AlertDialogCancel({ className, ...props }: ButtonLikeProps): React.JSX.Element;
|
|
19
41
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -1,33 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { asChildRender, composeRefs, DismissProvider, focusProps, openState, stateRender, useDismissContent, useDismissRoot, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
5
6
|
import { usePortalContainer } from '../lib/portal-container.js';
|
|
6
7
|
import { cn } from '../lib/utils.js';
|
|
7
|
-
import {
|
|
8
|
+
import { dialogContentZ, DialogDepthProvider, dialogOverlayZ, useDialogDepth, useDialogRootLayer, } from '../lib/z-stack.js';
|
|
9
|
+
import { buttonVariants } from './button.js';
|
|
8
10
|
// Depth follows the runtime layer stack, so an alert stacks above whatever is
|
|
9
11
|
// open even when it is rendered as a sibling. Still prefer rendering an alert
|
|
10
12
|
// that confirms for a dialog INSIDE that dialog's React tree: React events from
|
|
11
13
|
// the alert then bubble through the dialog, so the dialog's own outside-click
|
|
12
14
|
// and focus handlers never see the alert as "outside".
|
|
13
|
-
function AlertDialog({ children, open, defaultOpen, onOpenChange
|
|
15
|
+
function AlertDialog({ children, open, defaultOpen, onOpenChange }) {
|
|
14
16
|
const layer = useDialogRootLayer({ open, defaultOpen, onOpenChange });
|
|
15
|
-
|
|
17
|
+
const dismiss = useDismissRoot(layer.onOpenChange);
|
|
18
|
+
return (_jsx(DialogDepthProvider, { depth: layer.depth, children: _jsx(DismissProvider, { kind: "dialog", registry: dismiss.registry, children: _jsx(AlertDialogPrimitive.Root, { open: layer.open, onOpenChange: dismiss.onOpenChange, children: children }) }) }));
|
|
16
19
|
}
|
|
17
|
-
function AlertDialogTrigger({ ...props }) {
|
|
18
|
-
|
|
20
|
+
function AlertDialogTrigger({ asChild, children, ...props }) {
|
|
21
|
+
const slot = asChildRender(asChild, children);
|
|
22
|
+
const native = useNativeButton(asChild, children);
|
|
23
|
+
return (_jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props, ref: composeRefs(props.ref, native.ref), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
19
24
|
}
|
|
20
|
-
function AlertDialogPortal({
|
|
25
|
+
function AlertDialogPortal({ container, forceMount, children, }) {
|
|
21
26
|
const scoped = usePortalContainer();
|
|
22
|
-
return _jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal",
|
|
27
|
+
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", container: container ?? scoped, keepMounted: forceMount, children: children }));
|
|
23
28
|
}
|
|
24
29
|
function AlertDialogOverlay({ className, style, ...props }) {
|
|
25
30
|
const depth = useDialogDepth();
|
|
26
|
-
return (_jsx(AlertDialogPrimitive.
|
|
31
|
+
return (_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", 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/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
|
|
27
32
|
}
|
|
28
|
-
function AlertDialogContent({ className, style, overlayClassName, ...props }) {
|
|
33
|
+
function AlertDialogContent({ className, style, overlayClassName, asChild, forceMount, children, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }) {
|
|
29
34
|
const depth = useDialogDepth();
|
|
30
|
-
|
|
35
|
+
useDismissContent('dialog', { onEscapeKeyDown });
|
|
36
|
+
const popupRef = React.useRef(null);
|
|
37
|
+
const slot = asChildRender(asChild, children);
|
|
38
|
+
return (_jsxs(AlertDialogPortal, { forceMount: forceMount, children: [_jsx(AlertDialogOverlay, { className: overlayClassName }), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", className: cn('bg-sidebar border-muted/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 duration-moderate fixed top-[50%] left-[50%] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 space-y-5 rounded-xl border p-5 shadow-lg sm:max-w-md', className), style: { zIndex: dialogContentZ(depth), ...style }, ref: popupRef, ...focusProps(() => popupRef.current, onOpenAutoFocus, onCloseAutoFocus), ...props, render: stateRender('div', openState, slot.render), children: slot.children })] }));
|
|
31
39
|
}
|
|
32
40
|
function AlertDialogHeader({ className, ...props }) {
|
|
33
41
|
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
@@ -35,16 +43,30 @@ function AlertDialogHeader({ className, ...props }) {
|
|
|
35
43
|
function AlertDialogFooter({ className, ...props }) {
|
|
36
44
|
return (_jsx("div", { "data-slot": "alert-dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
|
|
37
45
|
}
|
|
38
|
-
function AlertDialogTitle({ className, ...props }) {
|
|
39
|
-
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn('text-lg font-medium', className), ...props }));
|
|
46
|
+
function AlertDialogTitle({ className, asChild, children, ...props }) {
|
|
47
|
+
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn('text-lg font-medium', className), ...props, ...asChildRender(asChild, children) }));
|
|
48
|
+
}
|
|
49
|
+
function AlertDialogDescription({ className, asChild, children, ...props }) {
|
|
50
|
+
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn('text-muted-foreground text-[length:var(--text-md,0.9rem)] leading-snug', className), ...props, ...asChildRender(asChild, children) }));
|
|
40
51
|
}
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A button that closes the alert. As with Radix, an `onClick` that calls
|
|
54
|
+
* `preventDefault()` keeps the alert open (an async confirm closes it itself).
|
|
55
|
+
*/
|
|
56
|
+
function AlertDialogClose({ asChild, children, onClick, ...props }) {
|
|
57
|
+
const slot = asChildRender(asChild, children);
|
|
58
|
+
const native = useNativeButton(asChild, children);
|
|
59
|
+
return (_jsx(AlertDialogPrimitive.Close, { ...props, ref: composeRefs(props.ref, native.ref), onClick: (event) => {
|
|
60
|
+
onClick?.(event);
|
|
61
|
+
if (event.defaultPrevented) {
|
|
62
|
+
event.preventBaseUIHandler?.();
|
|
63
|
+
}
|
|
64
|
+
}, render: slot.render, nativeButton: native.nativeButton, children: slot.children }));
|
|
43
65
|
}
|
|
44
|
-
function AlertDialogAction({ className, ...props }) {
|
|
45
|
-
return (_jsx(
|
|
66
|
+
function AlertDialogAction({ className, variant, ...props }) {
|
|
67
|
+
return (_jsx(AlertDialogClose, { className: cn(buttonVariants({ size: 'sm', variant }), className), ...props }));
|
|
46
68
|
}
|
|
47
69
|
function AlertDialogCancel({ className, ...props }) {
|
|
48
|
-
return (_jsx(
|
|
70
|
+
return (_jsx(AlertDialogClose, { className: cn(buttonVariants({ variant: 'outline-ghost', size: 'sm' }), className), ...props }));
|
|
49
71
|
}
|
|
50
72
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Avatar as AvatarPrimitive } from '
|
|
1
|
+
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
4
4
|
size?: 'default' | 'sm' | 'lg';
|
|
5
5
|
}): React.JSX.Element;
|
|
6
6
|
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): React.JSX.Element;
|
|
7
|
-
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>
|
|
7
|
+
declare function AvatarFallback({ className, delayMs, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback> & {
|
|
8
|
+
/** Waits this long before showing the fallback, so a fast image never flashes it. */
|
|
9
|
+
delayMs?: number;
|
|
10
|
+
}): React.JSX.Element;
|
|
8
11
|
declare function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
9
12
|
declare function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
13
|
declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar as AvatarPrimitive } from '
|
|
3
|
+
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
function Avatar({ className, size = 'default', ...props }) {
|
|
6
6
|
return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", "data-size": size, className: cn('group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-sm select-none data-[size=lg]:size-10 data-[size=sm]:size-6', className), ...props }));
|
|
@@ -8,8 +8,8 @@ function Avatar({ className, size = 'default', ...props }) {
|
|
|
8
8
|
function AvatarImage({ className, ...props }) {
|
|
9
9
|
return (_jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn('aspect-square size-full', className), ...props }));
|
|
10
10
|
}
|
|
11
|
-
function AvatarFallback({ className, ...props }) {
|
|
12
|
-
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn('bg-muted text-muted-foreground flex size-full items-center justify-center rounded-sm text-sm group-data-[size=sm]/avatar:text-xs', className), ...props }));
|
|
11
|
+
function AvatarFallback({ className, delayMs, ...props }) {
|
|
12
|
+
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", delay: delayMs, className: cn('bg-muted text-muted-foreground flex size-full items-center justify-center rounded-sm text-sm group-data-[size=sm]/avatar:text-xs', className), ...props }));
|
|
13
13
|
}
|
|
14
14
|
function AvatarBadge({ className, ...props }) {
|
|
15
15
|
return (_jsx("span", { "data-slot": "avatar-badge", className: cn('bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full ring-2 select-none', 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden', 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2', 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2', className), ...props }));
|
package/dist/primitives/badge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Slot } from '
|
|
2
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
const badgeVariants = cva('inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-[calc(var(--radius)-5px)] px-1.5 py-[0.1rem] font-mono text-[0.8rem] font-medium tracking-tight [overflow-wrap:anywhere] has-[>svg]:gap-0.5 has-[>[data-slot=status-dot]]:gap-1 [&>svg]:block [&>svg]:!size-[0.75em] [&>svg]:shrink-0 [&>svg]:pointer-events-none [&>[data-slot=status-dot]]:shrink-0 [&>[data-slot=status-dot]]:!size-[0.45em] uppercase', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DotsThreeIcon as MoreHorizontal } from '@phosphor-icons/react';
|
|
3
|
-
import { Slot } from '
|
|
3
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
import { LineVerticalIcon as HiOutlineSlash } from '@phosphor-icons/react';
|
|
6
6
|
function Breadcrumb({ ...props }) {
|
|
@@ -4,9 +4,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
// (19.2.18 for apps/web, 19.1.17 pulled in by `next` and `@sentry/react`), and
|
|
5
5
|
// the UMD global binds to 19.1.17 — which still types `DOMAttributes.onChange`
|
|
6
6
|
// as `FormEventHandler<T>` instead of 19.2.18's `ChangeEventHandler<T>`. That
|
|
7
|
-
// version skew, not any real prop incompatibility,
|
|
8
|
-
//
|
|
9
|
-
//
|
|
7
|
+
// version skew, not any real prop incompatibility, made the props bag below
|
|
8
|
+
// fail to type-check. The explicit import pins every `React.*` type here to the
|
|
9
|
+
// same copy the JSX checker uses.
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { Separator } from './separator.js';
|
|
12
12
|
import { cn } from '../lib/utils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Slot } from '
|
|
2
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
const buttonVariants = cva("flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,opacity,scale,translate] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive text-center shadow-none data-[state=open]:ring-0 focus-visible:outline-none focus-visible:ring-kortix-base focus-visible:ring-[0.6px]", {
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
type CheckboxVariant = 'blue' | 'black';
|
|
4
|
-
|
|
3
|
+
/** Radix's checked state: a boolean, or `'indeterminate'` for a mixed box. */
|
|
4
|
+
type CheckedState = boolean | 'indeterminate';
|
|
5
|
+
type CheckboxProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'checked' | 'defaultChecked' | 'onChange'> & {
|
|
6
|
+
checked?: CheckedState;
|
|
7
|
+
defaultChecked?: CheckedState;
|
|
8
|
+
/** A user toggle always reports a boolean; an indeterminate box becomes `true`. */
|
|
9
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
10
|
+
name?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
5
14
|
label?: React.ReactNode;
|
|
6
15
|
/** Fill of the checked box. `black` is the foreground ink, so it inverts in dark mode. */
|
|
7
16
|
variant?: CheckboxVariant;
|
|
8
17
|
};
|
|
9
|
-
declare function Checkbox({ className, label, id, variant, ...props }: CheckboxProps): React.JSX.Element;
|
|
18
|
+
declare function Checkbox({ className, label, id, variant, checked, defaultChecked, onCheckedChange, ...props }: CheckboxProps): React.JSX.Element;
|
|
10
19
|
declare namespace Checkbox {
|
|
11
|
-
var displayName: string
|
|
20
|
+
var displayName: string;
|
|
12
21
|
}
|
|
13
22
|
export { Checkbox };
|
|
14
|
-
export type { CheckboxProps, CheckboxVariant };
|
|
23
|
+
export type { CheckboxProps, CheckboxVariant, CheckedState };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { checkedState, useLabelReentryGuard } from '../lib/base-ui-compat.js';
|
|
5
6
|
import { cn } from '../lib/utils.js';
|
|
6
7
|
// One size everywhere: an 18px box, 6px corners, a round-capped check.
|
|
7
8
|
const checkboxControlClassName = cn('peer flex size-[18px] shrink-0 items-center justify-center rounded-sm border-[length:calc(var(--border-width,1px)*1.5)] border-muted-foreground/60 bg-transparent text-background', 'transition-[border-color,background-color]', 'outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background', 'disabled:cursor-default disabled:opacity-50', // cursor-default: disabled keeps the default cursor (AGENTS.md → States)
|
|
@@ -13,15 +14,29 @@ const checkboxVariantClassName = {
|
|
|
13
14
|
function CheckMark({ indeterminate }) {
|
|
14
15
|
return (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, className: "size-3", children: _jsx("path", { d: indeterminate ? 'M4 8h8' : 'M3.5 8.5l3 3 6-7', stroke: "currentColor", strokeWidth: 2.25, strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The checkbox `<button>`. The check mounts only while checked or
|
|
19
|
+
* indeterminate, with no transition, as Radix's indicator did.
|
|
20
|
+
*/
|
|
21
|
+
function renderCheckbox(props, state) {
|
|
22
|
+
const { disabled: _disabled, children: _children, ...rest } = props;
|
|
23
|
+
const on = state.checked || state.indeterminate;
|
|
24
|
+
return (_jsx("button", { ...rest, "data-state": checkedState(state), disabled: state.disabled || undefined, children: on && (_jsx("span", { "data-slot": "checkbox-indicator", "data-state": checkedState(state), className: "flex items-center justify-center", children: _jsx(CheckMark, { indeterminate: state.indeterminate }) })) }));
|
|
25
|
+
}
|
|
26
|
+
function Checkbox({ className, label, id, variant = 'blue', checked, defaultChecked, onCheckedChange, ...props }) {
|
|
17
27
|
const generatedId = React.useId();
|
|
18
28
|
const itemId = id ?? generatedId;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
const indeterminate = checked === 'indeterminate';
|
|
30
|
+
const onClick = useLabelReentryGuard(props.onClick);
|
|
31
|
+
const labelClassName = cn('flex w-full cursor-pointer items-center gap-3 rounded-md px-3 py-1.5 transition-colors', 'hover:bg-foreground/3', 'has-data-[state=checked]:bg-foreground/6 has-data-[state=checked]:hover:bg-foreground/6', 'has-focus-visible:ring-ring has-focus-visible:ring-offset-background has-focus-visible:ring-2 has-focus-visible:ring-offset-2', props.disabled && 'cursor-default opacity-50', // cursor-default: disabled keeps the default cursor (AGENTS.md → States)
|
|
32
|
+
className);
|
|
33
|
+
// With a label, the label wraps only the button. Base UI renders its hidden
|
|
34
|
+
// input next to the root, so it stays outside the label: one control per
|
|
35
|
+
// label, and the input's click does not bubble into the label's activation.
|
|
36
|
+
const render = label
|
|
37
|
+
? (buttonProps, state) => (_jsxs("label", { className: labelClassName, children: [renderCheckbox(buttonProps, state), _jsx("span", { className: cn('text-sm transition-[color,font-weight]', 'text-muted-foreground', 'peer-data-[state=checked]:text-foreground peer-data-[state=checked]:font-medium', props.disabled && 'text-muted-foreground'), children: label })] }))
|
|
38
|
+
: renderCheckbox;
|
|
39
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", "data-variant": variant, id: itemId, ...props, onClick: onClick, checked: checked === undefined ? undefined : checked === true, defaultChecked: defaultChecked === undefined ? undefined : defaultChecked === true, indeterminate: indeterminate, onCheckedChange: (next) => onCheckedChange?.(next), className: cn(checkboxControlClassName, checkboxVariantClassName[variant], !label && className), nativeButton: true, render: render }));
|
|
25
40
|
}
|
|
26
|
-
Checkbox.displayName =
|
|
41
|
+
Checkbox.displayName = 'Checkbox';
|
|
27
42
|
export { Checkbox };
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface CollapsibleProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function Collapsible({ asChild, children, onOpenChange, ...props }: CollapsibleProps): React.JSX.Element;
|
|
10
|
+
declare function CollapsibleTrigger({ className, asChild, children, ...props }: React.ComponentPropsWithoutRef<'button'> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare function CollapsibleContent({ className, asChild, children, forceMount, style, ...props }: React.ComponentPropsWithoutRef<'div'> & {
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
forceMount?: true;
|
|
16
|
+
}): React.JSX.Element;
|
|
5
17
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';
|
|
4
|
+
import { asChildRender, composeRefs, openState, stateRender, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
3
5
|
import { cn } from '../lib/utils.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
6
|
+
function Collapsible({ asChild, children, onOpenChange, ...props }) {
|
|
7
|
+
const slot = asChildRender(asChild, children);
|
|
8
|
+
return (_jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props, onOpenChange: onOpenChange ? (open) => onOpenChange(open) : undefined, render: stateRender('div', openState, slot.render), children: slot.children }));
|
|
7
9
|
}
|
|
8
|
-
function CollapsibleTrigger({ className, ...props }) {
|
|
9
|
-
|
|
10
|
+
function CollapsibleTrigger({ className, asChild, children, ...props }) {
|
|
11
|
+
const slot = asChildRender(asChild, children);
|
|
12
|
+
const native = useNativeButton(asChild, children);
|
|
13
|
+
return (_jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", ...props, ref: composeRefs(props.ref, native.ref), className: cn('cursor-pointer', className), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
10
14
|
}
|
|
11
|
-
function CollapsibleContent({ className, ...props }) {
|
|
12
|
-
|
|
15
|
+
function CollapsibleContent({ className, asChild, children, forceMount, style, ...props }) {
|
|
16
|
+
const slot = asChildRender(asChild, children);
|
|
17
|
+
return (_jsx(CollapsiblePrimitive.Panel, { "data-slot": "collapsible-content", ...props, keepMounted: forceMount, className: cn('data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden', className),
|
|
18
|
+
// The keyframes in theme.css read the Radix variable name.
|
|
19
|
+
style: {
|
|
20
|
+
'--radix-collapsible-content-height': 'var(--collapsible-panel-height)',
|
|
21
|
+
'--radix-collapsible-content-width': 'var(--collapsible-panel-width)',
|
|
22
|
+
...style,
|
|
23
|
+
}, render: stateRender('div', openState, slot.render), children: slot.children }));
|
|
13
24
|
}
|
|
14
25
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The headless command list behind `./command`: a port of cmdk 0.2.1 without
|
|
3
|
+
* its Radix dialog.
|
|
4
|
+
*
|
|
5
|
+
* cmdk 0.2.1 depends on `@radix-ui/react-dialog` only for `Command.Dialog`,
|
|
6
|
+
* which `@kortix/ui` never used (`CommandDialog` wraps our own `Dialog`). The
|
|
7
|
+
* ⌘K palette depends on cmdk's exact behavior — lowercased `value` identity,
|
|
8
|
+
* `forceMount` groups, Enter dispatching `cmdk-item-select`, `aria-selected`
|
|
9
|
+
* on the highlighted row, and the `[cmdk-*]` attributes its classes select —
|
|
10
|
+
* so this port keeps all of it, including the DOM re-sort after a search.
|
|
11
|
+
* That re-sort reads scores by `data-value` from a map keyed by item id, so
|
|
12
|
+
* every score is 0: it keeps row order, and its one visible effect is moving
|
|
13
|
+
* ungrouped rows after the groups in the list. Kept for parity.
|
|
14
|
+
*
|
|
15
|
+
* cmdk: Copyright (c) 2022 Paco Coursey. MIT License. Permission is hereby
|
|
16
|
+
* granted, free of charge, to any person obtaining a copy of this software and
|
|
17
|
+
* associated documentation files (the "Software"), to deal in the Software
|
|
18
|
+
* without restriction, including without limitation the rights to use, copy,
|
|
19
|
+
* modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
20
|
+
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
21
|
+
* subject to the following conditions: The above copyright notice and this
|
|
22
|
+
* permission notice shall be included in all copies or substantial portions
|
|
23
|
+
* of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
24
|
+
* KIND, EXPRESS OR IMPLIED.
|
|
25
|
+
*/
|
|
26
|
+
import * as React from 'react';
|
|
27
|
+
/** cmdk's default filter: 0 hides the row, 1 is a perfect match. */
|
|
28
|
+
export declare function commandScore(string: string, abbreviation: string): number;
|
|
29
|
+
export interface CommandState {
|
|
30
|
+
search: string;
|
|
31
|
+
value: string;
|
|
32
|
+
filtered: {
|
|
33
|
+
count: number;
|
|
34
|
+
items: Map<string, number>;
|
|
35
|
+
groups: Set<string>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Reads a slice of the command state; re-renders when it changes. */
|
|
39
|
+
export declare function useCommandState<T>(selector: (state: CommandState) => T): T;
|
|
40
|
+
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
41
|
+
export type CommandRootProps = DivProps & {
|
|
42
|
+
/** Accessible label for this command menu. Not shown visibly. */
|
|
43
|
+
label?: string;
|
|
44
|
+
/** `false` turns off filtering; the caller renders only matching rows. */
|
|
45
|
+
shouldFilter?: boolean;
|
|
46
|
+
/** Returns 0 (hide) to 1 (best match). Defaults to `commandScore`. */
|
|
47
|
+
filter?: (value: string, search: string) => number;
|
|
48
|
+
/** The highlighted row's value on first render. */
|
|
49
|
+
defaultValue?: string;
|
|
50
|
+
/** The highlighted row's value, controlled. */
|
|
51
|
+
value?: string;
|
|
52
|
+
onValueChange?: (value: string) => void;
|
|
53
|
+
/** Arrow keys wrap from the last row to the first and back. */
|
|
54
|
+
loop?: boolean;
|
|
55
|
+
/** `false` turns off ctrl+n/j/p/k. Defaults to `true`. */
|
|
56
|
+
vimBindings?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export declare const CommandRoot: React.ForwardRefExoticComponent<DivProps & {
|
|
59
|
+
/** Accessible label for this command menu. Not shown visibly. */
|
|
60
|
+
label?: string;
|
|
61
|
+
/** `false` turns off filtering; the caller renders only matching rows. */
|
|
62
|
+
shouldFilter?: boolean;
|
|
63
|
+
/** Returns 0 (hide) to 1 (best match). Defaults to `commandScore`. */
|
|
64
|
+
filter?: (value: string, search: string) => number;
|
|
65
|
+
/** The highlighted row's value on first render. */
|
|
66
|
+
defaultValue?: string;
|
|
67
|
+
/** The highlighted row's value, controlled. */
|
|
68
|
+
value?: string;
|
|
69
|
+
onValueChange?: (value: string) => void;
|
|
70
|
+
/** Arrow keys wrap from the last row to the first and back. */
|
|
71
|
+
loop?: boolean;
|
|
72
|
+
/** `false` turns off ctrl+n/j/p/k. Defaults to `true`. */
|
|
73
|
+
vimBindings?: boolean;
|
|
74
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
75
|
+
export type CommandItemProps = Omit<DivProps, 'disabled' | 'onSelect' | 'value'> & {
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** Called on click and on Enter while highlighted. */
|
|
78
|
+
onSelect?: (value: string) => void;
|
|
79
|
+
/** The row's identity; defaults to its text. */
|
|
80
|
+
value?: string;
|
|
81
|
+
/** Render regardless of filtering. */
|
|
82
|
+
forceMount?: boolean;
|
|
83
|
+
};
|
|
84
|
+
export declare const CommandItemCore: React.ForwardRefExoticComponent<Omit<DivProps, "onSelect" | "disabled" | "value"> & {
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
/** Called on click and on Enter while highlighted. */
|
|
87
|
+
onSelect?: (value: string) => void;
|
|
88
|
+
/** The row's identity; defaults to its text. */
|
|
89
|
+
value?: string;
|
|
90
|
+
/** Render regardless of filtering. */
|
|
91
|
+
forceMount?: boolean;
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
export type CommandGroupProps = Omit<DivProps, 'value' | 'heading'> & {
|
|
94
|
+
heading?: React.ReactNode;
|
|
95
|
+
/** Required when there is no heading: the group's unique value. */
|
|
96
|
+
value?: string;
|
|
97
|
+
/** Render regardless of filtering, with every row in it. */
|
|
98
|
+
forceMount?: boolean;
|
|
99
|
+
};
|
|
100
|
+
export declare const CommandGroupCore: React.ForwardRefExoticComponent<Omit<DivProps, "value" | "heading"> & {
|
|
101
|
+
heading?: React.ReactNode;
|
|
102
|
+
/** Required when there is no heading: the group's unique value. */
|
|
103
|
+
value?: string;
|
|
104
|
+
/** Render regardless of filtering, with every row in it. */
|
|
105
|
+
forceMount?: boolean;
|
|
106
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
export declare const CommandSeparatorCore: React.ForwardRefExoticComponent<DivProps & {
|
|
108
|
+
alwaysRender?: boolean;
|
|
109
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
110
|
+
export type CommandInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'type'> & {
|
|
111
|
+
value?: string;
|
|
112
|
+
onValueChange?: (search: string) => void;
|
|
113
|
+
};
|
|
114
|
+
export declare const CommandInputCore: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "value"> & {
|
|
115
|
+
value?: string;
|
|
116
|
+
onValueChange?: (search: string) => void;
|
|
117
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
118
|
+
export declare const CommandListCore: React.ForwardRefExoticComponent<DivProps & React.RefAttributes<HTMLDivElement>>;
|
|
119
|
+
/** Shows when no row matches the search. Hidden on the first render, as in cmdk. */
|
|
120
|
+
export declare const CommandEmptyCore: React.ForwardRefExoticComponent<DivProps & React.RefAttributes<HTMLDivElement>>;
|
|
121
|
+
export {};
|