@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.
Files changed (181) hide show
  1. package/README.md +7 -7
  2. package/dist/_vendor/kortix-shared.js +36 -1
  3. package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
  4. package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
  5. package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
  6. package/dist/customize/connectors/catalog/connector-categories.js +2 -2
  7. package/dist/customize/connectors/detail/connector-modal.js +1 -1
  8. package/dist/customize/sections/gateway-view.d.ts +1 -1
  9. package/dist/customize/sections/gateway-view.js +1 -1
  10. package/dist/customize/sections/view/account-secret-resources-panel.js +4 -2
  11. package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
  12. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
  13. package/dist/customize/sections/view/git-view.js +1 -1
  14. package/dist/customize/sections/view/permission-editor.js +1 -1
  15. package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
  16. package/dist/customize/sections/view/subscription-usage.js +2 -86
  17. package/dist/customize/shared/entity/entity-modal.js +8 -10
  18. package/dist/files/project/components/drive-toolbar.d.ts +1 -1
  19. package/dist/files/project/components/drive-toolbar.js +1 -1
  20. package/dist/files/project/store/version-store.d.ts +1 -1
  21. package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
  22. package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
  23. package/dist/files/renderers/shared/select-compat.js +3 -7
  24. package/dist/files/viewer/file-preview-modal.d.ts +10 -11
  25. package/dist/files/viewer/file-preview-modal.js +17 -18
  26. package/dist/i18n/en.d.ts +3 -0
  27. package/dist/i18n/en.js +7 -4
  28. package/dist/index.js +1 -1
  29. package/dist/internal/account-hub/account-hub-location.js +2 -2
  30. package/dist/internal/account-hub/use-account-members.d.ts +28 -1
  31. package/dist/internal/account-hub/use-account-members.js +27 -10
  32. package/dist/internal/components/agent-mark.d.ts +1 -8
  33. package/dist/internal/components/agent-mark.js +2 -19
  34. package/dist/internal/lib/navigation/modified-click.js +2 -2
  35. package/dist/internal/lib/pixel-mark.d.ts +3 -20
  36. package/dist/internal/lib/pixel-mark.js +3 -34
  37. package/dist/internal/stores/active-space-store.d.ts +1 -1
  38. package/dist/internal/stores/browser-recents-store.d.ts +1 -1
  39. package/dist/internal/stores/current-account-store.d.ts +1 -1
  40. package/dist/internal/stores/first-chat-store.d.ts +1 -1
  41. package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
  42. package/dist/internal/stores/session-browser-store.d.ts +1 -1
  43. package/dist/internal/stores/session-expanded-store.d.ts +1 -1
  44. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  45. package/dist/internal/stores/session-history-view-store.d.ts +1 -1
  46. package/dist/internal/stores/session-hover-store.d.ts +1 -1
  47. package/dist/internal/stores/session-hover-store.js +1 -1
  48. package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
  49. package/dist/internal/stores/sound-store.d.ts +1 -1
  50. package/dist/internal/stores/tab-store.d.ts +1 -1
  51. package/dist/internal/stores/user-preferences-store.d.ts +1 -1
  52. package/dist/internal/stores/web-notification-store.d.ts +1 -1
  53. package/dist/lib/base-ui-compat.d.ts +149 -0
  54. package/dist/lib/base-ui-compat.js +339 -0
  55. package/dist/lib/portal-container.d.ts +3 -7
  56. package/dist/lib/portal-container.js +5 -3
  57. package/dist/lib/z-stack.d.ts +4 -4
  58. package/dist/lib/z-stack.js +5 -5
  59. package/dist/primitives/accordion.d.ts +36 -5
  60. package/dist/primitives/accordion.js +41 -8
  61. package/dist/primitives/alert-dialog.d.ts +33 -11
  62. package/dist/primitives/alert-dialog.js +41 -19
  63. package/dist/primitives/avatar.d.ts +5 -2
  64. package/dist/primitives/avatar.js +3 -3
  65. package/dist/primitives/badge.js +1 -1
  66. package/dist/primitives/breadcrumb.js +1 -1
  67. package/dist/primitives/button-group.js +3 -3
  68. package/dist/primitives/button.js +1 -1
  69. package/dist/primitives/checkbox.d.ts +14 -5
  70. package/dist/primitives/checkbox.js +24 -9
  71. package/dist/primitives/collapsible.d.ts +16 -4
  72. package/dist/primitives/collapsible.js +18 -7
  73. package/dist/primitives/command-core.d.ts +121 -0
  74. package/dist/primitives/command-core.js +642 -0
  75. package/dist/primitives/command.d.ts +38 -4
  76. package/dist/primitives/command.js +22 -13
  77. package/dist/primitives/context-menu.d.ts +61 -31
  78. package/dist/primitives/context-menu.js +40 -53
  79. package/dist/primitives/dialog.d.ts +48 -10
  80. package/dist/primitives/dialog.js +48 -19
  81. package/dist/primitives/disclosure.d.ts +1 -1
  82. package/dist/primitives/disclosure.js +2 -2
  83. package/dist/primitives/drawer.d.ts +28 -9
  84. package/dist/primitives/drawer.js +42 -18
  85. package/dist/primitives/dropdown-menu.d.ts +55 -33
  86. package/dist/primitives/dropdown-menu.js +46 -82
  87. package/dist/primitives/faded-scroll-area.js +2 -1
  88. package/dist/primitives/hint.js +3 -3
  89. package/dist/primitives/hover-card.d.ts +17 -5
  90. package/dist/primitives/hover-card.js +45 -8
  91. package/dist/primitives/item.js +2 -2
  92. package/dist/primitives/label.d.ts +5 -2
  93. package/dist/primitives/label.js +10 -3
  94. package/dist/primitives/menu-base.d.ts +150 -0
  95. package/dist/primitives/menu-base.js +171 -0
  96. package/dist/primitives/menu-recipe.d.ts +1 -1
  97. package/dist/primitives/menu-recipe.js +2 -7
  98. package/dist/primitives/modal.d.ts +19 -52
  99. package/dist/primitives/modal.js +24 -28
  100. package/dist/primitives/navigation-menu.d.ts +36 -11
  101. package/dist/primitives/navigation-menu.js +31 -12
  102. package/dist/primitives/popover.d.ts +31 -6
  103. package/dist/primitives/popover.js +79 -12
  104. package/dist/primitives/preview-image.d.ts +18 -7
  105. package/dist/primitives/preview-image.js +14 -11
  106. package/dist/primitives/progress.d.ts +4 -2
  107. package/dist/primitives/progress.js +4 -3
  108. package/dist/primitives/project-icon-picker.js +2 -2
  109. package/dist/primitives/radio-group.d.ts +28 -5
  110. package/dist/primitives/radio-group.js +18 -10
  111. package/dist/primitives/scroll-area.d.ts +2 -2
  112. package/dist/primitives/scroll-area.js +8 -3
  113. package/dist/primitives/select.d.ts +55 -12
  114. package/dist/primitives/select.js +93 -36
  115. package/dist/primitives/separator.d.ts +6 -2
  116. package/dist/primitives/separator.js +10 -2
  117. package/dist/primitives/sheet.d.ts +17 -10
  118. package/dist/primitives/sheet.js +19 -22
  119. package/dist/primitives/sidebar-menu-primitives.js +8 -8
  120. package/dist/primitives/slider-native.d.ts +2 -2
  121. package/dist/primitives/slider-native.js +11 -9
  122. package/dist/primitives/slider.d.ts +24 -6
  123. package/dist/primitives/slider.js +26 -24
  124. package/dist/primitives/slot.d.ts +6 -0
  125. package/dist/primitives/slot.js +7 -0
  126. package/dist/primitives/split-sheet.js +1 -1
  127. package/dist/primitives/stepper.js +1 -1
  128. package/dist/primitives/switch.d.ts +16 -3
  129. package/dist/primitives/switch.js +7 -6
  130. package/dist/primitives/tabs.d.ts +36 -20
  131. package/dist/primitives/tabs.js +131 -102
  132. package/dist/primitives/toggle.d.ts +16 -3
  133. package/dist/primitives/toggle.js +8 -3
  134. package/dist/primitives/tooltip.d.ts +24 -5
  135. package/dist/primitives/tooltip.js +32 -10
  136. package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
  137. package/dist/primitives/type-to-confirm-dialog.js +1 -1
  138. package/dist/session/composer/animated-placeholder.js +1 -1
  139. package/dist/session/composer/chat-input/chat-input-control.js +3 -3
  140. package/dist/session/composer/editor/composer-editor.js +1 -1
  141. package/dist/session/composer/menus/menu-shell.d.ts +1 -1
  142. package/dist/session/composer/menus/menu-shell.js +1 -1
  143. package/dist/session/composer/menus/mount.js +1 -1
  144. package/dist/session/composer/reasoning-effort-selector.js +1 -1
  145. package/dist/session/header/session-site-header.js +2 -2
  146. package/dist/session/header/subagent-hover-card.js +2 -2
  147. package/dist/session/media/image-preview.js +1 -1
  148. package/dist/session/models/model-selector.d.ts +1 -1
  149. package/dist/session/models/model-selector.js +18 -12
  150. package/dist/session/models/subscription-switcher.d.ts +37 -0
  151. package/dist/session/models/subscription-switcher.js +97 -0
  152. package/dist/session/models/subscription-windows.d.ts +40 -0
  153. package/dist/session/models/subscription-windows.js +86 -0
  154. package/dist/session/overrides/session-overrides-control.js +3 -3
  155. package/dist/session/panel/diff-dialog.js +1 -1
  156. package/dist/session/panel/easy/detail-view.js +3 -3
  157. package/dist/session/panel/mobile-tool-drawer.js +2 -2
  158. package/dist/session/panel/panel-fallback.js +1 -1
  159. package/dist/session/panel/session-files-explorer.d.ts +1 -1
  160. package/dist/session/panel/session-files-explorer.js +1 -1
  161. package/dist/session/thread/session-chat.js +2 -2
  162. package/dist/session/thread/session-context-message-explorer.js +1 -1
  163. package/dist/session/thread/turn-share.js +3 -4
  164. package/dist/session/tool/shared/show-helpers.js +1 -1
  165. package/dist/session/turn/message-time-label.js +1 -1
  166. package/dist/styles.css +1 -1
  167. package/dist/test-utils/intl.d.ts +3 -0
  168. package/dist/workspace/projects/modal/project-icon-field.js +9 -23
  169. package/dist/workspace/review/review-center.js +1 -1
  170. package/dist/workspace/sessions/session-row.js +1 -1
  171. package/dist/workspace/sidebar/project-session-list.js +2 -2
  172. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
  173. package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
  174. package/dist/workspace/sidebar/session-title.d.ts +2 -2
  175. package/dist/workspace/sidebar/session-title.js +2 -2
  176. package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
  177. package/dist/workspace/spaces/space-links.js +1 -1
  178. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  179. package/package.json +16 -35
  180. package/skills/kortix-ui/SKILL.md +1 -1
  181. package/skills/kortix-ui/references/custom-dashboard.md +1 -1
@@ -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 AccordionPrimitive from '@radix-ui/react-accordion';
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
- function Accordion({ ...props }) {
7
- return _jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
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
- return (_jsx(AccordionPrimitive.Item, { "data-slot": "accordion-item", className: cn('border-b last:border-b-0', className), ...props }));
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), ...props, children: [children, _jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-moderate" })] }) }));
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.Content, { "data-slot": "accordion-content", className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm", ...props, children: _jsx("div", { className: cn('pt-0 pb-4', className), children: children }) }));
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
- declare function AlertDialog({ children, open, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): React.JSX.Element;
5
- declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): React.JSX.Element;
6
- declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): React.JSX.Element;
7
- declare function AlertDialogOverlay({ className, style, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
8
- declare function AlertDialogContent({ className, style, overlayClassName, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
9
- overlayClassName?: string;
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<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
14
- declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): React.JSX.Element;
15
- declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action> & {
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 }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>): React.JSX.Element;
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 * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
4
- import { buttonVariants } from './button.js';
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 { DialogDepthProvider, dialogContentZ, dialogOverlayZ, useDialogDepth, useDialogRootLayer, } from '../lib/z-stack.js';
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, ...props }) {
15
+ function AlertDialog({ children, open, defaultOpen, onOpenChange }) {
14
16
  const layer = useDialogRootLayer({ open, defaultOpen, onOpenChange });
15
- return (_jsx(DialogDepthProvider, { depth: layer.depth, children: _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props, open: layer.open, onOpenChange: layer.onOpenChange, children: children }) }));
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
- return _jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
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({ ...props }) {
25
+ function AlertDialogPortal({ container, forceMount, children, }) {
21
26
  const scoped = usePortalContainer();
22
- return _jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props, container: props.container ?? scoped });
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.Overlay, { "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 }, ...props }));
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
- return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, { className: overlayClassName }), _jsx(AlertDialogPrimitive.Content, { "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 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 duration-moderate sm:max-w-md', className), style: { zIndex: dialogContentZ(depth), ...style }, ...props })] }));
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
- function AlertDialogDescription({ className, ...props }) {
42
- 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 }));
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(AlertDialogPrimitive.Action, { className: cn(buttonVariants({ size: 'sm', variant: props.variant }), className), ...props }));
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(AlertDialogPrimitive.Cancel, { className: cn(buttonVariants({ variant: 'outline-ghost', size: 'sm' }), className), ...props }));
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 'radix-ui';
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>): React.JSX.Element;
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 'radix-ui';
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 }));
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Slot } from '@radix-ui/react-slot';
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 '@radix-ui/react-slot';
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, is what made the props bag
8
- // below fail against `Slot.Root`. The explicit import pins every `React.*` type
9
- // here to the same copy the JSX checker and `radix-ui` use.
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 '@radix-ui/react-slot';
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
- type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root> & {
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 | undefined;
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 * as CheckboxPrimitive from '@radix-ui/react-checkbox';
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
- function Checkbox({ className, label, id, variant = 'blue', ...props }) {
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 control = (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", "data-variant": variant, id: itemId, className: cn(checkboxControlClassName, checkboxVariantClassName[variant], !label && className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center", children: _jsx(CheckMark, { indeterminate: props.checked === 'indeterminate' }) }) }));
20
- if (!label) {
21
- return control;
22
- }
23
- return (_jsxs("label", { htmlFor: itemId, className: 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)
24
- className), children: [control, _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 })] }));
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 = CheckboxPrimitive.Root.displayName;
41
+ Checkbox.displayName = 'Checkbox';
27
42
  export { Checkbox };
@@ -1,5 +1,17 @@
1
- import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
2
- declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react").JSX.Element;
3
- declare function CollapsibleTrigger({ className, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react").JSX.Element;
4
- declare function CollapsibleContent({ className, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react").JSX.Element;
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
- import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
5
- function Collapsible({ ...props }) {
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
- return (_jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", className: cn('cursor-pointer', className), ...props }));
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
- return (_jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", className: cn('data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden', className), ...props }));
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 {};