@kortix/ui 0.15.7 → 0.15.9
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 +39 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
- package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
- package/dist/access/access/access-dialog-share.js +12 -6
- package/dist/access/access/share-selection.d.ts +9 -0
- package/dist/access/access/share-selection.js +64 -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/connector-identity.js +3 -3
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
- package/dist/customize/connectors/detail/connector-accounts.js +2 -2
- package/dist/customize/connectors/detail/connector-modal.js +1 -1
- package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
- package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
- package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
- package/dist/customize/connectors/detail/connector-notice.js +23 -4
- package/dist/customize/connectors/detail/connector-page.js +27 -7
- package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
- package/dist/customize/connectors/detail/connector-status.js +11 -0
- package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
- package/dist/customize/connectors/detail/status-badge.js +2 -1
- package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
- package/dist/customize/providers/provider-accordion.js +5 -4
- package/dist/customize/providers/provider-connect.js +3 -1
- package/dist/customize/providers/provider-sheet.js +9 -4
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- package/dist/customize/sections/connectors-view.d.ts +4 -1
- package/dist/customize/sections/connectors-view.js +42 -7
- package/dist/customize/sections/gateway-view.d.ts +1 -1
- package/dist/customize/sections/gateway-view.js +1 -1
- package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
- package/dist/customize/sections/view/account-secret-resources-panel.js +48 -7
- 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/secret-delivery.d.ts +9 -2
- package/dist/customize/sections/view/secret-delivery.js +14 -4
- package/dist/customize/sections/view/secrets-view.js +21 -5
- package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
- package/dist/customize/sections/view/subscription-usage.js +2 -86
- package/dist/customize/shared/entity/entity-modal.js +8 -10
- package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
- package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
- package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
- package/dist/customize/triggers/schedule/then-fields.js +8 -4
- package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
- package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
- package/dist/customize/triggers/schedule/trigger-list.js +18 -2
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
- 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/pptx-renderer.js +5 -20
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
- package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
- package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
- package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
- package/dist/files/renderers/presentation/presentation-utils.js +4 -0
- package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
- package/dist/files/renderers/presentation/slide-iframe.js +61 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
- package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
- package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
- 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/renderers/shared/use-stage-fit-scale.d.ts +19 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
- package/dist/files/renderers/show-content-renderer.js +16 -11
- package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
- package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
- package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
- package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
- package/dist/files/viewer/file-content-renderer.js +1 -4
- package/dist/files/viewer/file-preview-modal.d.ts +10 -11
- package/dist/files/viewer/file-preview-modal.js +17 -18
- package/dist/files/viewer/use-file-content-state.js +10 -9
- package/dist/i18n/en.d.ts +51 -0
- package/dist/i18n/en.js +58 -7
- 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/chrome/use-chrome-offered.d.ts +2 -1
- package/dist/internal/chrome/use-chrome-offered.js +4 -2
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
- package/dist/internal/lib/error-handler.js +33 -0
- 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/lib/trigger-clock.d.ts +7 -2
- package/dist/internal/lib/trigger-clock.js +17 -3
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.js +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +1 -1
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.d.ts +149 -0
- package/dist/lib/base-ui-compat.js +339 -0
- package/dist/lib/portal-container.d.ts +3 -7
- package/dist/lib/portal-container.js +5 -3
- package/dist/lib/z-stack.d.ts +9 -5
- package/dist/lib/z-stack.js +17 -7
- 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-connection-gate.js +16 -3
- package/dist/session/models/model-picker-panel.js +6 -2
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +18 -12
- package/dist/session/models/provider-key-action.d.ts +10 -0
- package/dist/session/models/provider-key-action.js +35 -0
- package/dist/session/models/provider-key-slot.d.ts +9 -0
- package/dist/session/models/provider-key-slot.js +19 -0
- 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/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/thread/session-chat.js +9 -4
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/transcript.js +31 -7
- 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 +51 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/review-center.js +1 -1
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
- package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
- package/dist/workspace/sidebar/session-title.d.ts +2 -2
- package/dist/workspace/sidebar/session-title.js +2 -2
- package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
- package/dist/workspace/spaces/space-links.js +1 -1
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/package.json +16 -35
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
|
|
2
4
|
import { CaretDownIcon as ChevronDownIcon } from '@phosphor-icons/react';
|
|
3
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
4
5
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
import {
|
|
6
|
+
import { asChildRender, FLOATING_LAYER_ATTR, openState, stateRender } from '../lib/base-ui-compat.js';
|
|
7
|
+
import { usePortalContainer } from '../lib/portal-container.js';
|
|
6
8
|
import { cn } from '../lib/utils.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Base UI always renders the open item's content in one popup viewport, so
|
|
11
|
+
* `viewport={false}` (inline content under each trigger) is accepted and
|
|
12
|
+
* renders the same shared viewport.
|
|
13
|
+
*/
|
|
14
|
+
function NavigationMenu({ className, children, viewport = true, value, defaultValue, onValueChange, delayDuration, ...props }) {
|
|
15
|
+
const { dir: _dir, ...rest } = props;
|
|
16
|
+
return (_jsxs(NavigationMenuPrimitive.Root, { "data-slot": "navigation-menu", "data-viewport": viewport, className: cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className), ...(value !== undefined ? { value: value || null } : {}), defaultValue: defaultValue ?? null, onValueChange: onValueChange ? (next) => onValueChange(next ?? '') : undefined, delay: delayDuration, ...rest, children: [children, _jsx(NavigationMenuViewport, {})] }));
|
|
9
17
|
}
|
|
10
18
|
function NavigationMenuList({ className, ...props }) {
|
|
11
19
|
return (_jsx(NavigationMenuPrimitive.List, { "data-slot": "navigation-menu-list", className: cn('group flex flex-1 list-none items-center justify-center gap-1', className), ...props }));
|
|
@@ -15,21 +23,32 @@ function NavigationMenuItem({ className, ...props }) {
|
|
|
15
23
|
}
|
|
16
24
|
const navigationMenuTriggerStyle = cva('group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent');
|
|
17
25
|
function NavigationMenuTrigger({ className, children, ...props }) {
|
|
18
|
-
return (_jsxs(NavigationMenuPrimitive.Trigger, { "data-slot": "navigation-menu-trigger", className: cn(navigationMenuTriggerStyle(), 'group', className), ...props, children: [children, ' ', _jsx(ChevronDownIcon, { className: "relative top-[1px] ml-1 size-3 transition
|
|
26
|
+
return (_jsxs(NavigationMenuPrimitive.Trigger, { "data-slot": "navigation-menu-trigger", className: cn(navigationMenuTriggerStyle(), 'group', className), ...props, render: stateRender('button', openState), children: [children, ' ', _jsx(ChevronDownIcon, { className: "duration-slow relative top-[1px] ml-1 size-3 transition group-data-[state=open]:rotate-180", "aria-hidden": "true" })] }));
|
|
19
27
|
}
|
|
20
|
-
function NavigationMenuContent({ className, ...props }) {
|
|
21
|
-
|
|
28
|
+
function NavigationMenuContent({ className, children, ...props }) {
|
|
29
|
+
const { forceMount: _forceMount, ...rest } = props;
|
|
30
|
+
return (_jsx(NavigationMenuPrimitive.Content, { "data-slot": "navigation-menu-content", className: cn('data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out top-0 left-0 w-full p-1 md:absolute md:w-auto', 'group-data-[viewport=false]/navigation-menu:bg-background group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:duration-moderate group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow-xs **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none', className), ...rest, render: stateRender('div', openState), children: _jsx("div", { className: "bg-muted dark:bg-popover/50 rounded-sm p-0.5", children: children }) }));
|
|
22
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Portal → Positioner → Popup → Viewport. The popup keeps the Radix
|
|
34
|
+
* `--radix-navigation-menu-viewport-*` names for its size.
|
|
35
|
+
*/
|
|
23
36
|
function NavigationMenuViewport({ className, ...props }) {
|
|
24
|
-
|
|
37
|
+
const scoped = usePortalContainer();
|
|
38
|
+
return (_jsx(NavigationMenuPrimitive.Portal, { container: scoped, children: _jsx(NavigationMenuPrimitive.Positioner, { ...FLOATING_LAYER_ATTR, className: "isolate z-50", sideOffset: 0, children: _jsx(NavigationMenuPrimitive.Popup, { "data-slot": "navigation-menu-viewport", className: cn('origin-top-center bg-popover text-popover-foreground data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]', className), style: {
|
|
39
|
+
'--radix-navigation-menu-viewport-height': 'var(--popup-height)',
|
|
40
|
+
'--radix-navigation-menu-viewport-width': 'var(--popup-width)',
|
|
41
|
+
}, ...props, render: stateRender('div', openState), children: _jsx(NavigationMenuPrimitive.Viewport, { className: "relative h-full w-full overflow-hidden" }) }) }) }));
|
|
25
42
|
}
|
|
26
|
-
function NavigationMenuLink({ className, ...props }) {
|
|
27
|
-
|
|
43
|
+
function NavigationMenuLink({ className, asChild, children, active, ...props }) {
|
|
44
|
+
const slot = asChildRender(asChild, children);
|
|
45
|
+
return (_jsx(NavigationMenuPrimitive.Link, { "data-slot": "navigation-menu-link", "data-active": active ? 'true' : undefined, active: active, className: cn("hover:bg-popover dark:hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4", className), ...props, render: slot.render, children: slot.children }));
|
|
28
46
|
}
|
|
29
47
|
function NavigationMenuSeparator({ className, orientation = 'horizontal', decorative = true, ...props }) {
|
|
30
|
-
return (_jsx(
|
|
48
|
+
return (_jsx("div", { "data-slot": "navigation-menu-separator", "data-orientation": orientation, ...(decorative ? { role: 'none' } : { role: 'separator', 'aria-orientation': orientation }), className: cn('bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch', className), ...props }));
|
|
31
49
|
}
|
|
50
|
+
/** The arrow that points at the open trigger. Renders inside the popup. */
|
|
32
51
|
function NavigationMenuIndicator({ className, ...props }) {
|
|
33
|
-
return (_jsx(NavigationMenuPrimitive.
|
|
52
|
+
return (_jsx(NavigationMenuPrimitive.Arrow, { "data-slot": "navigation-menu-indicator", className: cn('data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden', className), ...props, render: stateRender('div', (s) => (s.open ? 'visible' : 'hidden')), children: _jsx("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow" }) }));
|
|
34
53
|
}
|
|
35
54
|
export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuSeparator, NavigationMenuTrigger, navigationMenuTriggerStyle, NavigationMenuViewport, };
|
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { type DismissHandlers, type LegacyPositionProps } from '../lib/base-ui-compat.js';
|
|
3
3
|
import { type TriggerVariantProps } from './trigger-variants.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export interface PopoverProps {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
modal?: boolean;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function Popover({ open, defaultOpen, onOpenChange, modal, children }: PopoverProps): React.JSX.Element;
|
|
12
|
+
type PopoverTriggerProps = Omit<React.ComponentProps<'button'>, 'size'> & TriggerVariantProps & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function PopoverTrigger({ className, variant, size, asChild, children, ...props }: PopoverTriggerProps): React.JSX.Element;
|
|
16
|
+
export type PopoverContentProps = React.ComponentProps<'div'> & LegacyPositionProps & DismissHandlers & {
|
|
17
|
+
asChild?: boolean;
|
|
7
18
|
container?: HTMLElement;
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
forceMount?: true;
|
|
20
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
21
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
22
|
+
};
|
|
23
|
+
declare function PopoverContent({ className, align, sideOffset, container, style, asChild, forceMount, children, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, ref, ...rest }: PopoverContentProps): React.JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* The element the content positions against instead of the trigger. With
|
|
26
|
+
* `asChild` it is the child; `virtualRef` positions against a measurable
|
|
27
|
+
* object (a caret, a pointer position) as Radix did.
|
|
28
|
+
*/
|
|
29
|
+
declare function PopoverAnchor({ asChild, virtualRef, children, ref, ...props }: React.ComponentProps<'div'> & {
|
|
30
|
+
asChild?: boolean;
|
|
31
|
+
virtualRef?: React.RefObject<{
|
|
32
|
+
getBoundingClientRect(): DOMRect;
|
|
33
|
+
} | null>;
|
|
34
|
+
}): React.JSX.Element | null;
|
|
10
35
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { asChildRender, composeRefs, FLOATING_LAYER_ATTR, focusProps, openState, radixPositionVars, splitPosition, stateRender, useDismissRoot, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
4
6
|
import { usePortalContainer } from '../lib/portal-container.js';
|
|
5
7
|
import { cn } from '../lib/utils.js';
|
|
6
8
|
import { floatingZ, useDialogDepth } from '../lib/z-stack.js';
|
|
@@ -17,24 +19,89 @@ import { triggerVariants } from './trigger-variants.js';
|
|
|
17
19
|
*
|
|
18
20
|
* What stays local is what a popover holds rather than what it is: `p-4`
|
|
19
21
|
* because the content is prose and controls rather than a list of `p-1` rows,
|
|
20
|
-
* a `w-72` default, and `outline-hidden` because
|
|
21
|
-
* on open and the ring would trace the whole card.
|
|
22
|
+
* a `w-72` default, and `outline-hidden` because the popover focuses the panel
|
|
23
|
+
* itself on open and the ring would trace the whole card.
|
|
22
24
|
*/
|
|
23
25
|
const POPOVER_PANEL = cn(FLOATING_PANEL_SURFACE, 'w-72 p-4 outline-hidden');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The popover's own context: its anchor and its dismiss registry. Its own,
|
|
28
|
+
* not the shared `DismissProvider`, so a `PopoverContent` rendered inside a
|
|
29
|
+
* nested hover card or menu root still reaches this popover.
|
|
30
|
+
*/
|
|
31
|
+
const PopoverAnchorContext = React.createContext(null);
|
|
32
|
+
function Popover({ open, defaultOpen, onOpenChange, modal, children }) {
|
|
33
|
+
const dismiss = useDismissRoot(onOpenChange);
|
|
34
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
35
|
+
const registry = dismiss.registry;
|
|
36
|
+
const anchorValue = React.useMemo(() => ({ anchor, setAnchor, dismiss: registry }), [anchor, registry]);
|
|
37
|
+
return (_jsx(PopoverAnchorContext.Provider, { value: anchorValue, children: _jsx(PopoverPrimitive.Root, { "data-slot": "popover", open: open, defaultOpen: defaultOpen, onOpenChange: dismiss.onOpenChange, modal: modal, children: children }) }));
|
|
26
38
|
}
|
|
27
|
-
function PopoverTrigger({ className, variant, size, asChild, ...props }) {
|
|
28
|
-
|
|
39
|
+
function PopoverTrigger({ className, variant, size, asChild, children, ...props }) {
|
|
40
|
+
const slot = asChildRender(asChild, children);
|
|
41
|
+
const native = useNativeButton(asChild, children);
|
|
42
|
+
return (_jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props, ref: composeRefs(props.ref, native.ref),
|
|
29
43
|
// With `asChild` the child owns its styling — merging ours would double it.
|
|
30
|
-
className: asChild ? className : cn(triggerVariants({ variant, size }), className),
|
|
44
|
+
className: asChild ? className : cn(triggerVariants({ variant, size }), className), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
31
45
|
}
|
|
32
|
-
function PopoverContent({ className, align = 'center', sideOffset = 4, container, style, ...
|
|
46
|
+
function PopoverContent({ className, align = 'center', sideOffset = 4, container, style, asChild, forceMount, children, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, ref, ...rest }) {
|
|
33
47
|
const depth = useDialogDepth();
|
|
34
48
|
const scoped = usePortalContainer();
|
|
35
|
-
|
|
49
|
+
const anchorCtx = React.useContext(PopoverAnchorContext);
|
|
50
|
+
const dismiss = anchorCtx?.dismiss;
|
|
51
|
+
React.useLayoutEffect(() => {
|
|
52
|
+
if (dismiss) {
|
|
53
|
+
dismiss.current = {
|
|
54
|
+
onEscapeKeyDown,
|
|
55
|
+
onPointerDownOutside,
|
|
56
|
+
onFocusOutside,
|
|
57
|
+
onInteractOutside,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const { positioner, rest: props } = splitPosition({
|
|
62
|
+
align,
|
|
63
|
+
sideOffset,
|
|
64
|
+
...rest,
|
|
65
|
+
});
|
|
66
|
+
const slot = asChildRender(asChild, children);
|
|
67
|
+
const popupRef = React.useRef(null);
|
|
68
|
+
const composedPopupRef = React.useMemo(() => composeRefs(popupRef, ref), [ref]);
|
|
69
|
+
return (_jsx(PopoverPrimitive.Portal, { container: container ?? scoped, keepMounted: forceMount, children: _jsx(PopoverPrimitive.Positioner, { ...FLOATING_LAYER_ATTR, ...positioner, ...(anchorCtx?.anchor ? { anchor: anchorCtx.anchor } : {}), style: { zIndex: floatingZ(depth) }, children: _jsx(PopoverPrimitive.Popup, { "data-slot": "popover-content", ...props, ref: composedPopupRef, ...focusProps(() => popupRef.current, onOpenAutoFocus, onCloseAutoFocus), className: cn(POPOVER_PANEL, className), style: { ...radixPositionVars('popover'), ...style }, render: stateRender('div', openState, slot.render), children: slot.children }) }) }));
|
|
36
70
|
}
|
|
37
|
-
|
|
38
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The element the content positions against instead of the trigger. With
|
|
73
|
+
* `asChild` it is the child; `virtualRef` positions against a measurable
|
|
74
|
+
* object (a caret, a pointer position) as Radix did.
|
|
75
|
+
*/
|
|
76
|
+
function PopoverAnchor({ asChild, virtualRef, children, ref, ...props }) {
|
|
77
|
+
const ctx = React.useContext(PopoverAnchorContext);
|
|
78
|
+
const setAnchor = ctx?.setAnchor;
|
|
79
|
+
React.useLayoutEffect(() => {
|
|
80
|
+
if (!virtualRef || !setAnchor)
|
|
81
|
+
return;
|
|
82
|
+
// A stable proxy: the ref's target may change between renders.
|
|
83
|
+
setAnchor({
|
|
84
|
+
getBoundingClientRect: () => virtualRef.current?.getBoundingClientRect() ?? new DOMRect(),
|
|
85
|
+
});
|
|
86
|
+
return () => setAnchor(null);
|
|
87
|
+
}, [virtualRef, setAnchor]);
|
|
88
|
+
const register = React.useCallback((node) => {
|
|
89
|
+
if (!virtualRef)
|
|
90
|
+
setAnchor?.(node);
|
|
91
|
+
}, [setAnchor, virtualRef]);
|
|
92
|
+
const childRef = asChild && React.isValidElement(children)
|
|
93
|
+
? children.props.ref
|
|
94
|
+
: undefined;
|
|
95
|
+
// Memoized: a new ref callback each render would detach and re-register the anchor.
|
|
96
|
+
const composed = React.useMemo(() => composeRefs(childRef, register, ref), [childRef, register, ref]);
|
|
97
|
+
if (virtualRef)
|
|
98
|
+
return null;
|
|
99
|
+
if (asChild && React.isValidElement(children)) {
|
|
100
|
+
return React.cloneElement(children, {
|
|
101
|
+
...props,
|
|
102
|
+
ref: composed,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return (_jsx("div", { "data-slot": "popover-anchor", ...props, ref: composed, children: children }));
|
|
39
106
|
}
|
|
40
107
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { type DialogContentBaseProps } from './dialog.js';
|
|
3
|
+
/** The image preview root. It sits outside the dialog layer stack: its content carries its own z-index. */
|
|
4
|
+
declare function PreviewImage({ open, defaultOpen, onOpenChange, modal, children, }: {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
modal?: boolean;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare const PreviewImageTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
} & import("./trigger-variants.js").TriggerVariantProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
14
|
declare const PreviewImagePortal: {
|
|
6
|
-
(props:
|
|
15
|
+
(props: Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
|
|
7
16
|
displayName: string;
|
|
8
17
|
};
|
|
9
|
-
declare const PreviewImageClose: React.ForwardRefExoticComponent<
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
declare const PreviewImageClose: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
declare const PreviewImageOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
interface PreviewImageContentProps extends DialogContentBaseProps {
|
|
12
23
|
fileContent?: string;
|
|
13
24
|
fileName?: string;
|
|
14
25
|
fullscreen?: boolean;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import * as VisuallyHidden from '@radix-ui/react-visually-hidden';
|
|
3
|
+
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import { Close } from '../icons/close.js';
|
|
7
|
-
import {
|
|
6
|
+
import { VisuallyHidden } from '../lib/base-ui-compat.js';
|
|
8
7
|
import { cn } from '../lib/utils.js';
|
|
9
8
|
import { Button } from './button.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import { DialogClose, DialogPopup, DialogPortal, DialogTrigger } from './dialog.js';
|
|
10
|
+
/** The image preview root. It sits outside the dialog layer stack: its content carries its own z-index. */
|
|
11
|
+
function PreviewImage({ open, defaultOpen, onOpenChange, modal, children, }) {
|
|
12
|
+
return (_jsx(DialogPrimitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, modal: modal, children: children }));
|
|
13
|
+
}
|
|
14
|
+
const PreviewImageTrigger = DialogTrigger;
|
|
15
|
+
const PreviewImagePortal = DialogPortal;
|
|
16
|
+
const PreviewImageClose = DialogClose;
|
|
17
|
+
const PreviewImageOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Backdrop, { ref: ref, className: cn('fixed inset-0 z-50 bg-black/40', className), ...props })));
|
|
18
|
+
PreviewImageOverlay.displayName = 'PreviewImageOverlay';
|
|
16
19
|
const MIN_ZOOM = 0.7;
|
|
17
20
|
const DEFAULT_ZOOM = 1;
|
|
18
21
|
const MAX_ZOOM = 2;
|
|
@@ -51,11 +54,11 @@ const PreviewImageContent = React.forwardRef(({ className, fileContent, fileName
|
|
|
51
54
|
setTransformOrigin(getTransformOrigin(event));
|
|
52
55
|
setZoomLevel((currentZoom) => (currentZoom > DEFAULT_ZOOM ? DEFAULT_ZOOM : MAX_ZOOM));
|
|
53
56
|
};
|
|
54
|
-
return (_jsxs(PreviewImagePortal, { children: [_jsx(PreviewImageOverlay, {}), _jsxs(
|
|
57
|
+
return (_jsxs(PreviewImagePortal, { children: [_jsx(PreviewImageOverlay, {}), _jsxs(DialogPopup, { ref: ref, className: cn('fixed top-[50%] left-[50%] z-[99999] grid h-full w-full -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-4 shadow-lg duration-moderate sm:rounded-lg', className), ...props, children: [_jsx(VisuallyHidden, { children: _jsx(DialogPrimitive.Title, { children: "Image preview" }) }), _jsx("div", { className: "absolute top-3 right-3 z-[60] flex gap-1", onClick: (event) => event.stopPropagation(), children: _jsx(PreviewImageClose, { asChild: true, children: _jsx(Button, { size: "icon", type: "button", "aria-label": "Close image preview", className: "text-background", children: _jsx(Close, { className: "size-4" }) }) }) }), _jsx("div", { className: "flex h-full max-h-[100vh] w-[100vw] items-center justify-center overflow-auto", onWheel: handleWheelZoom, onClick: handleImageClick, children: _jsx("div", { className: cn(zoomLevel > DEFAULT_ZOOM ? 'cursor-zoom-out' : 'cursor-zoom-in'), style: {
|
|
55
58
|
transform: `scale(${zoomLevel})`,
|
|
56
59
|
transformOrigin,
|
|
57
60
|
transition: 'transform 200ms',
|
|
58
61
|
}, children: fileContent ? (_jsx("img", { src: fileContent, alt: fileName || 'Image preview', width: 1920, height: 1080, className: "max-h-[100vh] w-auto object-contain" })) : null }) })] })] }));
|
|
59
62
|
});
|
|
60
|
-
PreviewImageContent.displayName =
|
|
63
|
+
PreviewImageContent.displayName = 'PreviewImageContent';
|
|
61
64
|
export { PreviewImage, PreviewImageClose, PreviewImageContent, PreviewImageOverlay, PreviewImagePortal, PreviewImageTrigger, };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
declare function Progress({ className, indicatorClassName, value, ...
|
|
2
|
+
declare function Progress({ className, indicatorClassName, value, max, getValueLabel, ...rest }: Omit<React.ComponentProps<'div'>, 'children'> & {
|
|
3
|
+
value?: number | null;
|
|
4
|
+
max?: number;
|
|
5
|
+
getValueLabel?: (value: number, max: number) => string;
|
|
4
6
|
indicatorClassName?: string;
|
|
5
7
|
}): React.JSX.Element;
|
|
6
8
|
export { Progress };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Progress as ProgressPrimitive } from '@base-ui/react/progress';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
|
-
function Progress({ className, indicatorClassName, value, ...
|
|
6
|
-
|
|
5
|
+
function Progress({ className, indicatorClassName, value, max = 100, getValueLabel, ...rest }) {
|
|
6
|
+
const state = value == null ? 'indeterminate' : value >= max ? 'complete' : 'loading';
|
|
7
|
+
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", "data-state": state, "data-value": value ?? undefined, "data-max": max, value: value ?? null, max: max, getAriaValueText: getValueLabel ? (_f, v) => getValueLabel(v ?? 0, max) : undefined, className: cn('bg-primary/20 relative h-3 w-full overflow-hidden rounded-full', className), ...rest, children: _jsx("div", { "data-state": state, "data-slot": "progress-indicator", className: cn('bg-primary duration-slow h-full w-full flex-1 transition-transform ease-out', indicatorClassName), style: { transform: `translateX(-${100 - (value || 0)}%)` } }) }));
|
|
7
8
|
}
|
|
8
9
|
export { Progress };
|
|
@@ -20,8 +20,8 @@ import { cn } from '../lib/utils.js';
|
|
|
20
20
|
* outlives a single tab switch, rather than inside `GlyphPicker` itself,
|
|
21
21
|
* which would reset it every time the tab remounts.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
* `forceMount
|
|
23
|
+
* `TabsContent` mounts its children only while active (or with
|
|
24
|
+
* `forceMount`), so switching to Icon is also the first moment
|
|
25
25
|
* `GlyphPicker` renders — cheap, since unlike `EmojiPicker` it fetches
|
|
26
26
|
* nothing.
|
|
27
27
|
*/
|
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type RadioGroupProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'dir' | 'onChange'> & {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onValueChange?: (value: string) => void;
|
|
6
|
+
name?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
orientation?: 'horizontal' | 'vertical';
|
|
10
|
+
/** Accepted for Radix parity; arrow keys always wrap. */
|
|
11
|
+
loop?: boolean;
|
|
12
|
+
dir?: 'ltr' | 'rtl';
|
|
13
|
+
};
|
|
14
|
+
declare function RadioGroup({ className, onValueChange, orientation, loop: _loop, dir, ...props }: RadioGroupProps): React.JSX.Element;
|
|
15
|
+
/** A Radix-shaped radio item: a `<button>` with `data-state` checked/unchecked. */
|
|
16
|
+
type RadioGroupItemBaseProps = Omit<React.ComponentProps<'button'>, 'value' | 'ref'> & {
|
|
17
|
+
value: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Wraps the rendered button, e.g. in its `<label>`. Base UI renders the
|
|
22
|
+
* hidden input next to the root, so a wrapper here keeps it outside.
|
|
23
|
+
*/
|
|
24
|
+
wrap?: (button: React.ReactElement) => React.ReactElement;
|
|
25
|
+
};
|
|
26
|
+
declare function RadioGroupItemBase({ id, children, wrap, ...props }: RadioGroupItemBaseProps): React.JSX.Element;
|
|
27
|
+
type RadioGroupItemProps = RadioGroupItemBaseProps & {
|
|
5
28
|
label?: React.ReactNode;
|
|
6
29
|
description?: React.ReactNode;
|
|
7
30
|
size?: 'sm' | 'md' | 'lg';
|
|
8
31
|
variant?: 'default' | 'outline';
|
|
9
32
|
};
|
|
10
33
|
declare function RadioGroupItem({ className, label, description, id, disabled, size, variant, ...props }: RadioGroupItemProps): React.JSX.Element;
|
|
11
|
-
export { RadioGroup, RadioGroupItem };
|
|
12
|
-
export type { RadioGroupItemProps };
|
|
34
|
+
export { RadioGroup, RadioGroupItem, RadioGroupItemBase };
|
|
35
|
+
export type { RadioGroupItemBaseProps, RadioGroupItemProps, RadioGroupProps };
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Radio as RadioPrimitive } from '@base-ui/react/radio';
|
|
4
|
+
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';
|
|
4
5
|
import * as React from 'react';
|
|
6
|
+
import { checkedState, controlRender, useLabelReentryGuard } from '../lib/base-ui-compat.js';
|
|
5
7
|
import { cn } from '../lib/utils.js';
|
|
6
|
-
function RadioGroup({ className, ...props }) {
|
|
7
|
-
return (_jsx(RadioGroupPrimitive
|
|
8
|
+
function RadioGroup({ className, onValueChange, orientation, loop: _loop, dir, ...props }) {
|
|
9
|
+
return (_jsx(RadioGroupPrimitive, { "data-slot": "radio-group", "data-orientation": orientation, "aria-orientation": orientation, dir: dir, className: cn('grid gap-1', className), ...props, onValueChange: (value) => onValueChange?.(value) }));
|
|
8
10
|
}
|
|
9
|
-
const
|
|
11
|
+
const renderRadio = controlRender(checkedState);
|
|
12
|
+
function RadioGroupItemBase({ id, children, wrap, ...props }) {
|
|
13
|
+
const onClick = useLabelReentryGuard(props.onClick);
|
|
14
|
+
return (_jsx(RadioPrimitive.Root
|
|
15
|
+
// The root renders a <button> (`nativeButton`), so button props are right at runtime.
|
|
16
|
+
, { ...props, onClick: onClick, id: id, nativeButton: true, render: wrap ? (buttonProps, state) => wrap(renderRadio(buttonProps, state)) : renderRadio, children: children }));
|
|
17
|
+
}
|
|
18
|
+
const radioControlClassName = cn('peer aspect-square size-4 shrink-0 rounded-full border border-muted-foreground/60 bg-transparent', 'transition-[color,box-shadow,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-not-allowed disabled:opacity-50 data-disabled:cursor-not-allowed data-disabled:opacity-50', 'data-[state=checked]:border-foreground data-[state=checked]:bg-background data-[state=checked]:border-kortix-blue data-[state=checked]:border-4 ', 'aria-invalid:border-destructive');
|
|
10
19
|
function RadioGroupItem({ className, label, description, id, disabled, size = 'md', variant = 'default', ...props }) {
|
|
11
20
|
const generatedId = React.useId();
|
|
12
21
|
const itemId = id ?? generatedId;
|
|
13
22
|
const hasCaption = label != null || description != null;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return (_jsxs("label", { htmlFor: itemId, className: cn('flex w-full cursor-pointer gap-3 rounded-md px-3 py-1.5 transition-colors', description != null ? 'items-start justify-start' : 'items-center justify-center', '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', disabled && 'cursor-not-allowed opacity-50', className, size === 'sm' && 'px-2 py-1.5', size === 'md' && 'px-3 py-1.5', size === 'lg' && 'px-4 py-2.5', variant === 'outline' && 'border-border border'), children: [control, _jsxs("div", { className: cn('flex min-w-0 flex-1 flex-col', description != null ? 'justify-start' : 'justify-center'), children: [label != null && (_jsx("span", { className: cn('text-sm transition-[color,font-weight]', 'text-foreground', 'peer-data-[state=checked]:text-foreground peer-data-[state=checked]:font-medium', disabled && 'text-muted-foreground'), children: label })), description != null && (_jsx("span", { "data-slot": "radio-group-item-description", className: "text-muted-foreground block text-[length:var(--text-xs,0.8125rem)]", children: description }))] })] }));
|
|
23
|
+
const wrap = hasCaption
|
|
24
|
+
? (button) => (_jsxs("label", { className: cn('flex w-full cursor-pointer gap-3 rounded-md px-3 py-1.5 transition-colors', description != null ? 'items-start justify-start' : 'items-center justify-center', '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', disabled && 'cursor-not-allowed opacity-50', className, size === 'sm' && 'px-2 py-1.5', size === 'md' && 'px-3 py-1.5', size === 'lg' && 'px-4 py-2.5', variant === 'outline' && 'border-border border'), children: [button, _jsxs("div", { className: cn('flex min-w-0 flex-1 flex-col', description != null ? 'justify-start' : 'justify-center'), children: [label != null && (_jsx("span", { className: cn('text-sm transition-[color,font-weight]', 'text-foreground', 'peer-data-[state=checked]:text-foreground peer-data-[state=checked]:font-medium', disabled && 'text-muted-foreground'), children: label })), description != null && (_jsx("span", { "data-slot": "radio-group-item-description", className: "text-muted-foreground block text-[length:var(--text-xs,0.8125rem)]", children: description }))] })] }))
|
|
25
|
+
: undefined;
|
|
26
|
+
return (_jsx(RadioGroupItemBase, { "data-slot": "radio-group-item", id: itemId, disabled: disabled, className: cn(radioControlClassName, !hasCaption && className, description != null && 'mt-[3px]'), wrap: wrap, ...props }));
|
|
19
27
|
}
|
|
20
|
-
export { RadioGroup, RadioGroupItem };
|
|
28
|
+
export { RadioGroup, RadioGroupItem, RadioGroupItemBase };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): React.JSX.Element;
|
|
4
|
-
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.
|
|
4
|
+
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Scrollbar>): React.JSX.Element;
|
|
5
5
|
export { ScrollArea, ScrollBar };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
5
|
function ScrollArea({ className, children, ...props }) {
|
|
6
|
-
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn('relative', className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1
|
|
6
|
+
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn('relative', className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollBar, { orientation: "horizontal" }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The bar shows while the pointer is over the area or it scrolls, and only
|
|
10
|
+
* when the content overflows (the `type="hover"` behavior).
|
|
11
|
+
*/
|
|
12
|
+
const SCROLLBAR = 'flex touch-none p-px select-none opacity-0 transition-opacity duration-moderate data-hovering:opacity-100 data-scrolling:opacity-100 data-scrolling:duration-0';
|
|
8
13
|
function ScrollBar({ className, orientation = 'vertical', ...props }) {
|
|
9
|
-
return (_jsx(ScrollAreaPrimitive.
|
|
14
|
+
return (_jsx(ScrollAreaPrimitive.Scrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn(SCROLLBAR, orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent', orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent', className), ...props, children: _jsx(ScrollAreaPrimitive.Thumb, { "data-slot": "scroll-area-thumb", className: "bg-border relative flex-1 cursor-grab rounded-full active:cursor-grabbing" }) }));
|
|
10
15
|
}
|
|
11
16
|
export { ScrollArea, ScrollBar };
|
|
@@ -1,25 +1,68 @@
|
|
|
1
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { type LegacyPositionProps } from '../lib/base-ui-compat.js';
|
|
3
3
|
import { type MenuRowSize } from './menu-recipe.js';
|
|
4
4
|
import { type TriggerVariantProps } from './trigger-variants.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export interface SelectProps {
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
form?: string;
|
|
16
|
+
autoComplete?: string;
|
|
17
|
+
modal?: boolean;
|
|
18
|
+
/** Accepted for Radix parity; Base UI reads the direction from the document. */
|
|
19
|
+
dir?: 'ltr' | 'rtl';
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare function Select(allProps: SelectProps): React.JSX.Element;
|
|
23
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const SelectValue: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & {
|
|
26
|
+
placeholder?: React.ReactNode;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
export type SelectTriggerProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'size' | 'value'> & TriggerVariantProps & {
|
|
9
30
|
arrow?: boolean;
|
|
10
31
|
};
|
|
11
|
-
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<Omit<
|
|
32
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size" | "value"> & TriggerVariantProps & {
|
|
12
33
|
arrow?: boolean;
|
|
13
34
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
-
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<
|
|
15
|
-
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export type SelectContentProps = React.ComponentPropsWithoutRef<'div'> & LegacyPositionProps & {
|
|
38
|
+
/** Radix positioning mode. `item-aligned` overlaps the trigger like a native select. */
|
|
39
|
+
position?: 'popper' | 'item-aligned';
|
|
40
|
+
/** The Base UI name for `position="item-aligned"`. Wins over `position`. */
|
|
41
|
+
alignItemWithTrigger?: boolean;
|
|
42
|
+
container?: HTMLElement;
|
|
43
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
44
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
45
|
+
onPointerDownOutside?: (event: Event) => void;
|
|
46
|
+
};
|
|
47
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & LegacyPositionProps & {
|
|
48
|
+
/** Radix positioning mode. `item-aligned` overlaps the trigger like a native select. */
|
|
49
|
+
position?: "popper" | "item-aligned";
|
|
50
|
+
/** The Base UI name for `position="item-aligned"`. Wins over `position`. */
|
|
51
|
+
alignItemWithTrigger?: boolean;
|
|
52
|
+
container?: HTMLElement;
|
|
53
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
54
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
55
|
+
onPointerDownOutside?: (event: Event) => void;
|
|
56
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
57
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "value"> & {
|
|
58
|
+
value: string;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** Typeahead text when the children are not plain text. */
|
|
61
|
+
textValue?: string;
|
|
19
62
|
/** Row height step — see `MENU_ROW_SIZE` in `./menu-recipe`. */
|
|
20
63
|
size?: MenuRowSize;
|
|
21
64
|
/** Renders below children in the dropdown only — not in the trigger. */
|
|
22
65
|
description?: React.ReactNode;
|
|
23
66
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
-
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<
|
|
67
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
68
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|