@kortix/ui 0.15.7 → 0.15.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/_vendor/kortix-shared.js +36 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
- package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
- package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
- package/dist/customize/connectors/catalog/connector-categories.js +2 -2
- package/dist/customize/connectors/detail/connector-modal.js +1 -1
- package/dist/customize/sections/gateway-view.d.ts +1 -1
- package/dist/customize/sections/gateway-view.js +1 -1
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -2
- package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/git-view.js +1 -1
- package/dist/customize/sections/view/permission-editor.js +1 -1
- package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
- package/dist/customize/sections/view/subscription-usage.js +2 -86
- package/dist/customize/shared/entity/entity-modal.js +8 -10
- package/dist/files/project/components/drive-toolbar.d.ts +1 -1
- package/dist/files/project/components/drive-toolbar.js +1 -1
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
- package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
- package/dist/files/renderers/shared/select-compat.js +3 -7
- package/dist/files/viewer/file-preview-modal.d.ts +10 -11
- package/dist/files/viewer/file-preview-modal.js +17 -18
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +7 -4
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-location.js +2 -2
- package/dist/internal/account-hub/use-account-members.d.ts +28 -1
- package/dist/internal/account-hub/use-account-members.js +27 -10
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/navigation/modified-click.js +2 -2
- package/dist/internal/lib/pixel-mark.d.ts +3 -20
- package/dist/internal/lib/pixel-mark.js +3 -34
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.js +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +1 -1
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.d.ts +149 -0
- package/dist/lib/base-ui-compat.js +339 -0
- package/dist/lib/portal-container.d.ts +3 -7
- package/dist/lib/portal-container.js +5 -3
- package/dist/lib/z-stack.d.ts +4 -4
- package/dist/lib/z-stack.js +5 -5
- package/dist/primitives/accordion.d.ts +36 -5
- package/dist/primitives/accordion.js +41 -8
- package/dist/primitives/alert-dialog.d.ts +33 -11
- package/dist/primitives/alert-dialog.js +41 -19
- package/dist/primitives/avatar.d.ts +5 -2
- package/dist/primitives/avatar.js +3 -3
- package/dist/primitives/badge.js +1 -1
- package/dist/primitives/breadcrumb.js +1 -1
- package/dist/primitives/button-group.js +3 -3
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox.d.ts +14 -5
- package/dist/primitives/checkbox.js +24 -9
- package/dist/primitives/collapsible.d.ts +16 -4
- package/dist/primitives/collapsible.js +18 -7
- package/dist/primitives/command-core.d.ts +121 -0
- package/dist/primitives/command-core.js +642 -0
- package/dist/primitives/command.d.ts +38 -4
- package/dist/primitives/command.js +22 -13
- package/dist/primitives/context-menu.d.ts +61 -31
- package/dist/primitives/context-menu.js +40 -53
- package/dist/primitives/dialog.d.ts +48 -10
- package/dist/primitives/dialog.js +48 -19
- package/dist/primitives/disclosure.d.ts +1 -1
- package/dist/primitives/disclosure.js +2 -2
- package/dist/primitives/drawer.d.ts +28 -9
- package/dist/primitives/drawer.js +42 -18
- package/dist/primitives/dropdown-menu.d.ts +55 -33
- package/dist/primitives/dropdown-menu.js +46 -82
- package/dist/primitives/faded-scroll-area.js +2 -1
- package/dist/primitives/hint.js +3 -3
- package/dist/primitives/hover-card.d.ts +17 -5
- package/dist/primitives/hover-card.js +45 -8
- package/dist/primitives/item.js +2 -2
- package/dist/primitives/label.d.ts +5 -2
- package/dist/primitives/label.js +10 -3
- package/dist/primitives/menu-base.d.ts +150 -0
- package/dist/primitives/menu-base.js +171 -0
- package/dist/primitives/menu-recipe.d.ts +1 -1
- package/dist/primitives/menu-recipe.js +2 -7
- package/dist/primitives/modal.d.ts +19 -52
- package/dist/primitives/modal.js +24 -28
- package/dist/primitives/navigation-menu.d.ts +36 -11
- package/dist/primitives/navigation-menu.js +31 -12
- package/dist/primitives/popover.d.ts +31 -6
- package/dist/primitives/popover.js +79 -12
- package/dist/primitives/preview-image.d.ts +18 -7
- package/dist/primitives/preview-image.js +14 -11
- package/dist/primitives/progress.d.ts +4 -2
- package/dist/primitives/progress.js +4 -3
- package/dist/primitives/project-icon-picker.js +2 -2
- package/dist/primitives/radio-group.d.ts +28 -5
- package/dist/primitives/radio-group.js +18 -10
- package/dist/primitives/scroll-area.d.ts +2 -2
- package/dist/primitives/scroll-area.js +8 -3
- package/dist/primitives/select.d.ts +55 -12
- package/dist/primitives/select.js +93 -36
- package/dist/primitives/separator.d.ts +6 -2
- package/dist/primitives/separator.js +10 -2
- package/dist/primitives/sheet.d.ts +17 -10
- package/dist/primitives/sheet.js +19 -22
- package/dist/primitives/sidebar-menu-primitives.js +8 -8
- package/dist/primitives/slider-native.d.ts +2 -2
- package/dist/primitives/slider-native.js +11 -9
- package/dist/primitives/slider.d.ts +24 -6
- package/dist/primitives/slider.js +26 -24
- package/dist/primitives/slot.d.ts +6 -0
- package/dist/primitives/slot.js +7 -0
- package/dist/primitives/split-sheet.js +1 -1
- package/dist/primitives/stepper.js +1 -1
- package/dist/primitives/switch.d.ts +16 -3
- package/dist/primitives/switch.js +7 -6
- package/dist/primitives/tabs.d.ts +36 -20
- package/dist/primitives/tabs.js +131 -102
- package/dist/primitives/toggle.d.ts +16 -3
- package/dist/primitives/toggle.js +8 -3
- package/dist/primitives/tooltip.d.ts +24 -5
- package/dist/primitives/tooltip.js +32 -10
- package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
- package/dist/primitives/type-to-confirm-dialog.js +1 -1
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +3 -3
- package/dist/session/composer/editor/composer-editor.js +1 -1
- package/dist/session/composer/menus/menu-shell.d.ts +1 -1
- package/dist/session/composer/menus/menu-shell.js +1 -1
- package/dist/session/composer/menus/mount.js +1 -1
- package/dist/session/composer/reasoning-effort-selector.js +1 -1
- package/dist/session/header/session-site-header.js +2 -2
- package/dist/session/header/subagent-hover-card.js +2 -2
- package/dist/session/media/image-preview.js +1 -1
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +18 -12
- package/dist/session/models/subscription-switcher.d.ts +37 -0
- package/dist/session/models/subscription-switcher.js +97 -0
- package/dist/session/models/subscription-windows.d.ts +40 -0
- package/dist/session/models/subscription-windows.js +86 -0
- package/dist/session/overrides/session-overrides-control.js +3 -3
- package/dist/session/panel/diff-dialog.js +1 -1
- package/dist/session/panel/easy/detail-view.js +3 -3
- package/dist/session/panel/mobile-tool-drawer.js +2 -2
- package/dist/session/panel/panel-fallback.js +1 -1
- package/dist/session/panel/session-files-explorer.d.ts +1 -1
- package/dist/session/panel/session-files-explorer.js +1 -1
- package/dist/session/thread/session-chat.js +2 -2
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/turn-share.js +3 -4
- package/dist/session/tool/shared/show-helpers.js +1 -1
- package/dist/session/turn/message-time-label.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +3 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/review-center.js +1 -1
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
- package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
- package/dist/workspace/sidebar/session-title.d.ts +2 -2
- package/dist/workspace/sidebar/session-title.js +2 -2
- package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
- package/dist/workspace/spaces/space-links.js +1 -1
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/package.json +16 -35
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { cn } from '../lib/utils.js';
|
|
5
|
-
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
import { Switch as SwitchPrimitive } from '@base-ui/react/switch';
|
|
6
4
|
import { animate, m, useMotionValue } from 'motion/react';
|
|
7
5
|
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { checkedState, stateRender, controlRender } from '../lib/base-ui-compat.js';
|
|
7
|
+
import { spring } from '../lib/springs.js';
|
|
8
|
+
import { cn } from '../lib/utils.js';
|
|
8
9
|
// Track is `w-[34px] h-[20px]` in the className — keep it in sync with these.
|
|
9
10
|
const TRACK_WIDTH = 34;
|
|
10
11
|
const THUMB_SIZE = 16;
|
|
@@ -102,7 +103,7 @@ const Switch = forwardRef(({ label, checked, onCheckedChange, disabled = false,
|
|
|
102
103
|
}, [isChecked, onCheckedChange, motionX]);
|
|
103
104
|
const switchControl = (_jsx(SwitchPrimitive.Root, { ref: ref, id: id, checked: checked, disabled: disabled, tabIndex: 0, className: cn('group/switch relative h-[20px] w-[34px] shrink-0 touch-none rounded-full outline-none', // pointer comes from the global rule; disabled keeps the default cursor
|
|
104
105
|
'transition-colors duration-80', 'focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-1 focus-visible:ring-offset-2',
|
|
105
|
-
// Colours come from
|
|
106
|
+
// Colours come from `data-state` (checked / unchecked), never from JS state.
|
|
106
107
|
// Off is translucent ink, so one class reads in both themes and on
|
|
107
108
|
// any panel. Thumb vs track (WCAG 1.4.11, 3:1), worst of page /
|
|
108
109
|
// card / muted: rest 3.13:1, hover 4.13:1. On: white thumb 3.23:1.
|
|
@@ -113,7 +114,7 @@ const Switch = forwardRef(({ label, checked, onCheckedChange, disabled = false,
|
|
|
113
114
|
if (didDrag.current)
|
|
114
115
|
return;
|
|
115
116
|
onCheckedChange?.(nextChecked);
|
|
116
|
-
}, ...props, children: _jsx(SwitchPrimitive.Thumb, {
|
|
117
|
+
}, ...props, nativeButton: true, render: controlRender(checkedState), children: _jsx(SwitchPrimitive.Thumb, { render: stateRender('span', checkedState, _jsx(m.span, { className: cn('duration-fast absolute top-0 left-0 rounded-full shadow-sm transition-colors', 'data-[state=checked]:bg-white',
|
|
117
118
|
// A white thumb on the light off track would be ~1.25:1.
|
|
118
119
|
'data-[state=unchecked]:bg-foreground/45 group-hover/switch:data-[state=unchecked]:bg-foreground/55'), initial: false,
|
|
119
120
|
// Motion value binding for drag, not a colour or layout style.
|
|
@@ -121,7 +122,7 @@ const Switch = forwardRef(({ label, checked, onCheckedChange, disabled = false,
|
|
|
121
122
|
y: thumbY,
|
|
122
123
|
width: thumbWidth,
|
|
123
124
|
height: thumbHeight,
|
|
124
|
-
}, transition: hasMounted.current ? spring.moderate : { duration: 0 } }) }) }));
|
|
125
|
+
}, transition: hasMounted.current ? spring.moderate : { duration: 0 } })) }) }));
|
|
125
126
|
if (!label) {
|
|
126
127
|
return switchControl;
|
|
127
128
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as React from "react";
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
declare const tabsTriggerPaddingVariants: (props?: ({
|
|
4
3
|
size?: "default" | "xs" | "sm" | "lg" | "md" | null | undefined;
|
|
5
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -10,22 +9,22 @@ declare const tabsTriggerHeightVariants: (props?: ({
|
|
|
10
9
|
declare const tabsTriggerTextVariants: (props?: ({
|
|
11
10
|
size?: "default" | "xs" | "sm" | "lg" | "md" | null | undefined;
|
|
12
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
-
type TabsTriggerSize =
|
|
14
|
-
type TabsSize = TabsTriggerSize |
|
|
12
|
+
type TabsTriggerSize = 'xs' | 'sm' | 'default' | 'md';
|
|
13
|
+
type TabsSize = TabsTriggerSize | 'lg';
|
|
15
14
|
/**
|
|
16
15
|
* `default` is the filled pill; `outline` is a bordered active chip;
|
|
17
16
|
* `segmented` is the raised surface chip of a segmented control.
|
|
18
17
|
*/
|
|
19
|
-
type TabsTriggerVariant =
|
|
18
|
+
type TabsTriggerVariant = 'default' | 'outline' | 'secondary' | 'segmented';
|
|
20
19
|
/** Stroke thickness of the active underline rule (`type="underline"` only). */
|
|
21
|
-
type TabsUnderlineSize =
|
|
20
|
+
type TabsUnderlineSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
22
21
|
/**
|
|
23
22
|
* `default` is the segmented control: a recessed track whose active tab is a
|
|
24
23
|
* raised surface chip. `segmented` is the same control, kept as an explicit
|
|
25
24
|
* name. `underline` is the flat rule. A vertical list (a settings rail) is
|
|
26
25
|
* never segmented.
|
|
27
26
|
*/
|
|
28
|
-
type TabsListType =
|
|
27
|
+
type TabsListType = 'default' | 'underline' | 'secondary' | 'segmented';
|
|
29
28
|
/**
|
|
30
29
|
* Segmented track + chip. Radii are concentric: the track is `rounded-md` (8px)
|
|
31
30
|
* with 2px of padding, so the chip is `rounded-sm` (6px). The chip lifts with a
|
|
@@ -39,36 +38,53 @@ type TabsListType = "default" | "underline" | "secondary" | "segmented";
|
|
|
39
38
|
*/
|
|
40
39
|
declare const tabsSegmentedTrackClasses = "bg-muted rounded-md p-[2px]";
|
|
41
40
|
declare const tabsSegmentedChipClasses = "bg-popover ring-border rounded-sm shadow-xs ring-1";
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
type TabsProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'dir'> & {
|
|
42
|
+
value?: string;
|
|
43
|
+
defaultValue?: string;
|
|
44
|
+
onValueChange?: (value: string) => void;
|
|
45
|
+
orientation?: 'horizontal' | 'vertical';
|
|
46
|
+
activationMode?: 'automatic' | 'manual';
|
|
47
|
+
dir?: 'ltr' | 'rtl';
|
|
48
|
+
};
|
|
49
|
+
declare function Tabs({ className, value, defaultValue, onValueChange, activationMode, orientation, ...props }: TabsProps): React.JSX.Element;
|
|
50
|
+
interface TabsListProps extends React.ComponentProps<'div'> {
|
|
51
|
+
/** Radix `loop`: arrow keys wrap from the last tab to the first. Default `true`. */
|
|
52
|
+
loop?: boolean;
|
|
44
53
|
type?: TabsListType;
|
|
45
54
|
/**
|
|
46
55
|
* `segmented` renders the segmented control (recessed track + raised chip):
|
|
47
56
|
* `<TabsList variant="segmented">`. Same as `type="segmented"`; `variant`
|
|
48
57
|
* wins when both are set.
|
|
49
58
|
*/
|
|
50
|
-
variant?:
|
|
59
|
+
variant?: 'default' | 'secondary' | 'segmented';
|
|
51
60
|
size?: TabsSize;
|
|
52
61
|
/** Active underline stroke. Only applies when `type="underline"`. Default `sm`. */
|
|
53
62
|
underlineSize?: TabsUnderlineSize;
|
|
54
|
-
animate?:
|
|
63
|
+
animate?: 'fluid' | 'none';
|
|
55
64
|
/**
|
|
56
65
|
* `vertical` stacks triggers full-width in a column (e.g. a settings
|
|
57
66
|
* rail) instead of laying them out inline. This is a styling switch only —
|
|
58
|
-
* `aria-orientation` still comes from `orientation` on the `Tabs` root
|
|
59
|
-
*
|
|
67
|
+
* `aria-orientation` still comes from `orientation` on the `Tabs` root.
|
|
68
|
+
* Default `horizontal`.
|
|
60
69
|
*/
|
|
61
|
-
orientation?:
|
|
70
|
+
orientation?: 'horizontal' | 'vertical';
|
|
62
71
|
}
|
|
63
72
|
declare function TabsList(props: TabsListProps): React.JSX.Element;
|
|
64
|
-
declare function TabsTrigger({ className, size: sizeProp, variant, value, ...props }: React.ComponentProps<
|
|
73
|
+
declare function TabsTrigger({ className, size: sizeProp, variant, value, asChild, children, onMouseDown, disabled, ref, ...props }: Omit<React.ComponentProps<'button'>, 'value'> & {
|
|
74
|
+
value: string;
|
|
75
|
+
asChild?: boolean;
|
|
65
76
|
size?: TabsTriggerSize;
|
|
66
77
|
variant?: TabsTriggerVariant;
|
|
67
78
|
}): React.JSX.Element;
|
|
68
|
-
declare function TabsContent({ className, ...props }: React.ComponentProps<
|
|
79
|
+
declare function TabsContent({ className, forceMount, asChild, children, ...props }: Omit<React.ComponentProps<'div'>, 'value'> & {
|
|
80
|
+
value: string;
|
|
81
|
+
/** Keep the panel's content mounted while inactive (hidden). */
|
|
82
|
+
forceMount?: true;
|
|
83
|
+
asChild?: boolean;
|
|
84
|
+
}): React.JSX.Element;
|
|
69
85
|
/** Standalone filter pill bar — works WITHOUT a <Tabs> root. Use for filter bars, mode toggles. */
|
|
70
|
-
declare function FilterBar({ className, ...props }: React.ComponentProps<
|
|
86
|
+
declare function FilterBar({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
71
87
|
/** Standalone filter pill — works WITHOUT a <Tabs> root. Pair with FilterBar. */
|
|
72
|
-
declare function FilterBarItem({ className, ...props }: React.ComponentProps<
|
|
73
|
-
export {
|
|
74
|
-
export type { TabsListType, TabsSize, TabsTriggerSize, TabsTriggerVariant, TabsUnderlineSize, };
|
|
88
|
+
declare function FilterBarItem({ className, ...props }: React.ComponentProps<'button'>): React.JSX.Element;
|
|
89
|
+
export { FilterBar, FilterBarItem, Tabs, TabsContent, TabsList, tabsSegmentedChipClasses, tabsSegmentedTrackClasses, TabsTrigger, tabsTriggerHeightVariants, tabsTriggerPaddingVariants, tabsTriggerTextVariants, };
|
|
90
|
+
export type { TabsListProps, TabsListType, TabsProps, TabsSize, TabsTriggerSize, TabsTriggerVariant, TabsUnderlineSize, };
|
package/dist/primitives/tabs.js
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { cva } from
|
|
5
|
-
import * as React from
|
|
6
|
-
import {
|
|
7
|
-
import { cn } from
|
|
8
|
-
|
|
3
|
+
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { asChildRender, composeRefs, controlRender, stateRender, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
import { SlidingTabIndicator } from './sliding-tab-indicator.js';
|
|
9
|
+
const tabsTriggerPaddingVariants = cva('', {
|
|
9
10
|
variants: {
|
|
10
11
|
size: {
|
|
11
|
-
default:
|
|
12
|
-
xs:
|
|
13
|
-
sm:
|
|
14
|
-
md:
|
|
15
|
-
lg:
|
|
12
|
+
default: 'gap-2 px-4 py-2 has-[>svg]:px-3',
|
|
13
|
+
xs: 'gap-1.5 px-2.5 has-[>svg]:px-2',
|
|
14
|
+
sm: 'gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
15
|
+
md: 'gap-2 px-5 has-[>svg]:px-4',
|
|
16
|
+
lg: 'gap-2 px-6 has-[>svg]:px-4',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
defaultVariants: {
|
|
19
|
-
size:
|
|
20
|
+
size: 'default',
|
|
20
21
|
},
|
|
21
22
|
});
|
|
22
|
-
const tabsTriggerHeightVariants = cva(
|
|
23
|
+
const tabsTriggerHeightVariants = cva('', {
|
|
23
24
|
variants: {
|
|
24
25
|
size: {
|
|
25
|
-
default:
|
|
26
|
-
xs:
|
|
27
|
-
sm:
|
|
28
|
-
md:
|
|
29
|
-
lg:
|
|
26
|
+
default: 'h-8',
|
|
27
|
+
xs: 'h-7',
|
|
28
|
+
sm: 'h-8',
|
|
29
|
+
md: 'h-10',
|
|
30
|
+
lg: 'h-10',
|
|
30
31
|
},
|
|
31
32
|
},
|
|
32
33
|
defaultVariants: {
|
|
33
|
-
size:
|
|
34
|
+
size: 'default',
|
|
34
35
|
},
|
|
35
36
|
});
|
|
36
37
|
/** Shared tab typography for web and desktop. */
|
|
37
|
-
const tabsTriggerTextVariants = cva(
|
|
38
|
+
const tabsTriggerTextVariants = cva('font-medium', {
|
|
38
39
|
variants: {
|
|
39
40
|
size: {
|
|
40
|
-
default:
|
|
41
|
-
xs:
|
|
42
|
-
sm:
|
|
43
|
-
md:
|
|
44
|
-
lg:
|
|
41
|
+
default: 'text-sm',
|
|
42
|
+
xs: 'text-xs rounded-sm',
|
|
43
|
+
sm: 'text-xs',
|
|
44
|
+
md: 'text-sm',
|
|
45
|
+
lg: 'text-sm',
|
|
45
46
|
},
|
|
46
47
|
},
|
|
47
48
|
defaultVariants: {
|
|
48
|
-
size:
|
|
49
|
+
size: 'default',
|
|
49
50
|
},
|
|
50
51
|
});
|
|
51
52
|
const tabsListHeightClasses = {
|
|
52
|
-
default:
|
|
53
|
-
xs:
|
|
54
|
-
sm:
|
|
55
|
-
md:
|
|
56
|
-
lg:
|
|
53
|
+
default: 'h-9',
|
|
54
|
+
xs: 'h-6',
|
|
55
|
+
sm: 'h-8',
|
|
56
|
+
md: 'h-10',
|
|
57
|
+
lg: 'h-10',
|
|
57
58
|
};
|
|
58
59
|
const tabsUnderlineBorderClasses = {
|
|
59
|
-
xs:
|
|
60
|
-
sm:
|
|
61
|
-
md:
|
|
62
|
-
lg:
|
|
60
|
+
xs: '**:data-[slot=tabs-trigger]:after:h-px',
|
|
61
|
+
sm: '**:data-[slot=tabs-trigger]:after:h-[1.5px]',
|
|
62
|
+
md: '**:data-[slot=tabs-trigger]:after:h-0.5',
|
|
63
|
+
lg: '**:data-[slot=tabs-trigger]:after:h-[3px]',
|
|
63
64
|
};
|
|
64
65
|
/** Shared underline-list chrome; indicator height comes from `underlineSize`. */
|
|
65
66
|
const tabsListUnderlineBaseClasses = "border-border **:data-[slot=tabs-trigger]:data-[state=inactive]:text-muted-foreground text-muted-foreground **:data-[slot=tabs-trigger]:data-[state=active]:text-foreground inline-flex w-fit items-center justify-center gap-0 rounded-none border-b **:data-[slot=tabs-trigger]:relative **:data-[slot=tabs-trigger]:h-full **:data-[slot=tabs-trigger]:rounded-none **:data-[slot=tabs-trigger]:border-0 **:data-[slot=tabs-trigger]:bg-transparent **:data-[slot=tabs-trigger]:shadow-none **:data-[slot=tabs-trigger]:after:pointer-events-none **:data-[slot=tabs-trigger]:after:absolute **:data-[slot=tabs-trigger]:after:inset-x-0 **:data-[slot=tabs-trigger]:after:bottom-0 **:data-[slot=tabs-trigger]:after:rounded-full **:data-[slot=tabs-trigger]:after:bg-transparent **:data-[slot=tabs-trigger]:after:content-[''] **:data-[slot=tabs-trigger]:data-[state=active]:bg-transparent **:data-[slot=tabs-trigger]:data-[state=active]:shadow-none **:data-[slot=tabs-trigger]:data-[state=active]:after:bg-foreground **:data-[slot=tabs-trigger]:data-[state=inactive]:bg-transparent";
|
|
@@ -74,132 +75,160 @@ const tabsListUnderlineBaseClasses = "border-border **:data-[slot=tabs-trigger]:
|
|
|
74
75
|
* a pixel rounds differently on each side — 1px of track on one end and none on
|
|
75
76
|
* the other at 1x. A whole 2px leaves exactly 1px on every side.
|
|
76
77
|
*/
|
|
77
|
-
const tabsSegmentedTrackClasses =
|
|
78
|
-
const tabsSegmentedChipClasses =
|
|
78
|
+
const tabsSegmentedTrackClasses = 'bg-muted rounded-md p-[2px]';
|
|
79
|
+
const tabsSegmentedChipClasses = 'bg-popover ring-border rounded-sm shadow-xs ring-1';
|
|
79
80
|
function resolveTabsTriggerSize(sizeProp, listSize) {
|
|
80
81
|
if (sizeProp)
|
|
81
82
|
return sizeProp;
|
|
82
|
-
if (listSize ===
|
|
83
|
-
return
|
|
84
|
-
if (listSize ===
|
|
85
|
-
return
|
|
83
|
+
if (listSize === 'xs')
|
|
84
|
+
return 'xs';
|
|
85
|
+
if (listSize === 'lg')
|
|
86
|
+
return 'md';
|
|
86
87
|
return listSize;
|
|
87
88
|
}
|
|
88
|
-
const TabsActiveValueContext = React.createContext(
|
|
89
|
-
const TabsListTypeContext = React.createContext(
|
|
90
|
-
const TabsAnimateContext = React.createContext(
|
|
91
|
-
const TabsSizeContext = React.createContext(
|
|
89
|
+
const TabsActiveValueContext = React.createContext('');
|
|
90
|
+
const TabsListTypeContext = React.createContext('default');
|
|
91
|
+
const TabsAnimateContext = React.createContext('none');
|
|
92
|
+
const TabsSizeContext = React.createContext('default');
|
|
92
93
|
/** Lets `TabsTrigger` adapt to a vertical `TabsList` without every caller re-passing orientation. */
|
|
93
|
-
const TabsOrientationContext = React.createContext(
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const TabsOrientationContext = React.createContext('horizontal');
|
|
95
|
+
/** Radix: `automatic` selects a tab when it gets focus, `manual` on press only. */
|
|
96
|
+
const TabsActivationContext = React.createContext('automatic');
|
|
97
|
+
const TabsRootOrientationContext = React.createContext('horizontal');
|
|
98
|
+
/** Radix's ids: `<base>-trigger-<value>` and `<base>-content-<value>`, so SSR markup links tab and panel. */
|
|
99
|
+
const TabsBaseIdContext = React.createContext('');
|
|
100
|
+
/** Selects a tab. Radix selects on primary-button mousedown, before the click. */
|
|
101
|
+
const TabsSelectContext = React.createContext(() => { });
|
|
102
|
+
const tabId = (base, value) => `${base}-trigger-${value}`;
|
|
103
|
+
const panelId = (base, value) => `${base}-content-${value}`;
|
|
104
|
+
const activeState = (s) => s.active === false || s.hidden ? 'inactive' : 'active';
|
|
105
|
+
function Tabs({ className, value, defaultValue, onValueChange, activationMode = 'automatic', orientation = 'horizontal', ...props }) {
|
|
106
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue ?? '');
|
|
96
107
|
const activeValue = value !== undefined ? value : uncontrolledValue;
|
|
108
|
+
const baseId = React.useId();
|
|
97
109
|
const handleValueChange = React.useCallback((next) => {
|
|
110
|
+
if (next === activeValue)
|
|
111
|
+
return;
|
|
98
112
|
if (value === undefined) {
|
|
99
113
|
setUncontrolledValue(next);
|
|
100
114
|
}
|
|
101
115
|
onValueChange?.(next);
|
|
102
|
-
}, [onValueChange, value]);
|
|
103
|
-
return (_jsx(TabsActiveValueContext.Provider, { value: activeValue, children: _jsx(TabsPrimitive.Root, { "data-slot": "tabs", className: cn(
|
|
116
|
+
}, [activeValue, onValueChange, value]);
|
|
117
|
+
return (_jsx(TabsActiveValueContext.Provider, { value: activeValue, children: _jsx(TabsActivationContext.Provider, { value: activationMode, children: _jsx(TabsRootOrientationContext.Provider, { value: orientation, children: _jsx(TabsBaseIdContext.Provider, { value: baseId, children: _jsx(TabsSelectContext.Provider, { value: handleValueChange, children: _jsx(TabsPrimitive.Root, { "data-slot": "tabs", "data-orientation": orientation, className: cn('flex flex-col gap-2', className), orientation: orientation, ...props,
|
|
118
|
+
// Always controlled: Base UI selects its first tab when it owns an empty value; Radix selects none.
|
|
119
|
+
value: activeValue, onValueChange: (next) => handleValueChange(String(next)) }) }) }) }) }) }));
|
|
104
120
|
}
|
|
105
121
|
function TabsList(props) {
|
|
106
|
-
return
|
|
122
|
+
return _jsx(TabsListRenderer, { ...props, orientation: props.orientation ?? 'horizontal' });
|
|
107
123
|
}
|
|
108
|
-
function TabsListRenderer({ className, type: typeProp =
|
|
124
|
+
function TabsListRenderer({ className, type: typeProp = 'default', variant, size = 'default', underlineSize = 'sm', animate = 'none', orientation, children, loop = true, ...props }) {
|
|
109
125
|
const activeValue = React.useContext(TabsActiveValueContext);
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
? "segmented"
|
|
115
|
-
: typeProp;
|
|
126
|
+
const activationMode = React.useContext(TabsActivationContext);
|
|
127
|
+
const rootOrientation = React.useContext(TabsRootOrientationContext);
|
|
128
|
+
const isVertical = orientation === 'vertical';
|
|
129
|
+
const requested = variant === 'secondary' ? 'secondary' : variant === 'segmented' ? 'segmented' : typeProp;
|
|
116
130
|
// Every horizontal list that is not `underline` is the segmented control.
|
|
117
131
|
// Triggers read the resolved type from context, so a vertical rail keeps its
|
|
118
132
|
// own row styling.
|
|
119
|
-
const type = requested ===
|
|
133
|
+
const type = requested === 'underline' || requested === 'secondary'
|
|
120
134
|
? requested
|
|
121
135
|
: isVertical
|
|
122
|
-
?
|
|
123
|
-
:
|
|
124
|
-
const isSegmented = type ===
|
|
125
|
-
const useSlidingIndicator = isSegmented && animate ===
|
|
126
|
-
const trackClassName = cn(
|
|
127
|
-
const list = (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn(type ===
|
|
128
|
-
cn(
|
|
129
|
-
|
|
130
|
-
type === "underline" &&
|
|
131
|
-
tabsUnderlineBorderClasses[underlineSize], !isVertical && type === "underline" && tabsListHeightClasses[size], isVertical &&
|
|
132
|
-
"flex h-auto w-full flex-col items-stretch gap-0.5 rounded-none bg-transparent p-0", className), ...props, children: children }));
|
|
136
|
+
? 'default'
|
|
137
|
+
: 'segmented';
|
|
138
|
+
const isSegmented = type === 'segmented';
|
|
139
|
+
const useSlidingIndicator = isSegmented && animate === 'fluid';
|
|
140
|
+
const trackClassName = cn('text-muted-foreground inline-flex w-fit items-center justify-center', tabsListHeightClasses[size], tabsSegmentedTrackClasses, className);
|
|
141
|
+
const list = (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn(type === 'secondary' &&
|
|
142
|
+
cn('inline-flex w-fit items-center gap-0.5', tabsListHeightClasses[size]), isSegmented && 'relative z-10 flex h-full w-full items-stretch justify-center gap-0.5', !isVertical && type === 'underline' && tabsListUnderlineBaseClasses, !isVertical && type === 'underline' && tabsUnderlineBorderClasses[underlineSize], !isVertical && type === 'underline' && tabsListHeightClasses[size], isVertical &&
|
|
143
|
+
'flex h-auto w-full flex-col items-stretch gap-0.5 rounded-none bg-transparent p-0', className), ...props, "aria-orientation": rootOrientation, activateOnFocus: activationMode === 'automatic', loopFocus: loop, children: children }));
|
|
133
144
|
// The sliding pill indicator only measures the x-axis (see
|
|
134
145
|
// SlidingTabIndicator) — in a column it would collapse to a
|
|
135
146
|
// zero-width bar, so vertical lists render without it.
|
|
136
|
-
const content = isVertical || type ===
|
|
137
|
-
return (_jsx(TabsListTypeContext.Provider, { value: type, children: _jsx(TabsAnimateContext.Provider, { value: animate, children: _jsx(TabsSizeContext.Provider, { value: size, children: _jsx(TabsOrientationContext.Provider, { value: orientation ??
|
|
147
|
+
const content = isVertical || type === 'underline' || type === 'secondary' ? (list) : useSlidingIndicator ? (_jsx(SlidingTabIndicator, { activeId: activeValue, className: trackClassName, indicatorClassName: tabsSegmentedChipClasses, children: list })) : (_jsx("div", { className: trackClassName, children: list }));
|
|
148
|
+
return (_jsx(TabsListTypeContext.Provider, { value: type, children: _jsx(TabsAnimateContext.Provider, { value: animate, children: _jsx(TabsSizeContext.Provider, { value: size, children: _jsx(TabsOrientationContext.Provider, { value: orientation ?? 'horizontal', children: content }) }) }) }));
|
|
138
149
|
}
|
|
139
|
-
function TabsTrigger({ className, size: sizeProp, variant =
|
|
150
|
+
function TabsTrigger({ className, size: sizeProp, variant = 'default', value, asChild, children, onMouseDown, disabled, ref, ...props }) {
|
|
151
|
+
const slot = asChildRender(asChild, children);
|
|
152
|
+
const baseId = React.useContext(TabsBaseIdContext);
|
|
153
|
+
const select = React.useContext(TabsSelectContext);
|
|
154
|
+
// Radix sets the native `disabled` attribute on a disabled trigger. Base UI
|
|
155
|
+
// clears it (in a layout effect and its ref) to keep the tab focusable; this
|
|
156
|
+
// effect runs after both, because a child's layout effects run first.
|
|
157
|
+
const buttonRef = React.useRef(null);
|
|
158
|
+
const native = useNativeButton(asChild, children);
|
|
159
|
+
const mergedRef = React.useMemo(() => composeRefs(ref, buttonRef, native.ref), [ref, native.ref]);
|
|
160
|
+
React.useLayoutEffect(() => {
|
|
161
|
+
const node = buttonRef.current;
|
|
162
|
+
if (node?.tagName === 'BUTTON')
|
|
163
|
+
node.disabled = Boolean(disabled);
|
|
164
|
+
}, [disabled]);
|
|
140
165
|
const listType = React.useContext(TabsListTypeContext);
|
|
141
166
|
const animate = React.useContext(TabsAnimateContext);
|
|
142
167
|
const listSize = React.useContext(TabsSizeContext);
|
|
143
168
|
const listOrientation = React.useContext(TabsOrientationContext);
|
|
144
169
|
const size = resolveTabsTriggerSize(sizeProp, listSize);
|
|
145
|
-
const isUnderlineList = listType ===
|
|
170
|
+
const isUnderlineList = listType === 'underline';
|
|
146
171
|
// A segmented trigger either sits in a segmented list (the list's sliding
|
|
147
172
|
// chip paints the active state) or asks for it alone with
|
|
148
173
|
// `variant="segmented"` (it paints its own chip — there is no track to slide in).
|
|
149
|
-
const isSegmentedList = listType ===
|
|
174
|
+
const isSegmentedList = listType === 'segmented';
|
|
150
175
|
// An explicit `variant="outline"` keeps its bordered chip even in a segmented list.
|
|
151
|
-
const isSecondary = !isUnderlineList && (variant ===
|
|
152
|
-
const isOutline = !isUnderlineList && !isSecondary && variant ===
|
|
153
|
-
const isSegmented = !isUnderlineList &&
|
|
154
|
-
!isOutline &&
|
|
155
|
-
!isSecondary &&
|
|
156
|
-
(isSegmentedList || variant === "segmented");
|
|
176
|
+
const isSecondary = !isUnderlineList && (variant === 'secondary' || listType === 'secondary');
|
|
177
|
+
const isOutline = !isUnderlineList && !isSecondary && variant === 'outline';
|
|
178
|
+
const isSegmented = !isUnderlineList && !isOutline && !isSecondary && (isSegmentedList || variant === 'segmented');
|
|
157
179
|
// Outline paints its own border; the sliding pill fill would fight it.
|
|
158
180
|
const useSlidingIndicator = !isUnderlineList &&
|
|
159
181
|
!isSecondary &&
|
|
160
182
|
!isOutline &&
|
|
161
183
|
(!isSegmented || isSegmentedList) &&
|
|
162
|
-
animate ===
|
|
163
|
-
const isVertical = listOrientation ===
|
|
164
|
-
return (_jsx(TabsPrimitive.
|
|
165
|
-
? "h-full"
|
|
166
|
-
: tabsTriggerHeightVariants({ size }),
|
|
184
|
+
animate === 'fluid';
|
|
185
|
+
const isVertical = listOrientation === 'vertical';
|
|
186
|
+
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", "data-sliding-tab": useSlidingIndicator ? value : undefined, "data-variant": variant, value: value, className: cn("focus-visible:ring-kortix-blue duration-normal ease-default inline-flex flex-1 cursor-pointer items-center justify-center rounded-[calc(var(--radius)-2.5px)] border border-transparent whitespace-nowrap transition-[color,background-color,border-color,box-shadow] focus-visible:ring-[0.6px] focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", tabsTriggerTextVariants({ size }), tabsTriggerPaddingVariants({ size }), isUnderlineList || isSegmentedList ? 'h-full' : tabsTriggerHeightVariants({ size }),
|
|
167
187
|
// Segmented: the chip sits inside the track's padding, so the trigger
|
|
168
188
|
// fills the track and takes the chip's concentric radius.
|
|
169
|
-
isSegmented &&
|
|
189
|
+
isSegmented && 'rounded-sm',
|
|
170
190
|
// Without the sliding indicator the active trigger paints the chip itself.
|
|
171
191
|
isSegmented &&
|
|
172
192
|
!useSlidingIndicator &&
|
|
173
|
-
|
|
174
|
-
|
|
193
|
+
'data-[state=active]:bg-popover data-[state=active]:ring-border data-[state=active]:shadow-xs data-[state=active]:ring-1', isUnderlineList &&
|
|
194
|
+
'data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground hover:data-[state=inactive]:text-foreground rounded-none bg-transparent shadow-none data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=inactive]:bg-transparent',
|
|
175
195
|
// Default: a secondary-coloured pill. With animate="fluid" the sliding
|
|
176
196
|
// indicator paints the pill behind the trigger, so the trigger itself
|
|
177
197
|
// stays transparent; otherwise the trigger paints its own.
|
|
178
198
|
!isUnderlineList &&
|
|
179
199
|
!isOutline &&
|
|
180
|
-
|
|
200
|
+
'data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground hover:data-[state=inactive]:text-foreground relative z-10 data-[state=inactive]:bg-transparent', !isUnderlineList &&
|
|
181
201
|
!isOutline &&
|
|
182
202
|
!isSegmented &&
|
|
183
203
|
!isSecondary &&
|
|
184
204
|
(useSlidingIndicator
|
|
185
|
-
?
|
|
186
|
-
:
|
|
187
|
-
useSlidingIndicator &&
|
|
188
|
-
"data-[state=active]:bg-transparent",
|
|
205
|
+
? 'data-[state=active]:bg-transparent'
|
|
206
|
+
: 'data-[state=active]:bg-input'), isSegmented && useSlidingIndicator && 'data-[state=active]:bg-transparent',
|
|
189
207
|
// Outline: bordered active chip — matches Button `outline` (border + transparent fill).
|
|
190
208
|
isOutline &&
|
|
191
|
-
|
|
192
|
-
|
|
209
|
+
'data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground hover:data-[state=inactive]:bg-foreground/5 hover:data-[state=inactive]:text-foreground data-[state=active]:border-border relative z-10 bg-transparent data-[state=active]:bg-transparent data-[state=inactive]:bg-transparent', isSecondary &&
|
|
210
|
+
'data-[state=active]:bg-secondary data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground hover:data-[state=inactive]:bg-hover rounded-sm data-[state=inactive]:bg-transparent', isVertical && 'w-full justify-start text-left', className), ref: mergedRef, id: tabId(baseId, value), "aria-controls": panelId(baseId, value), disabled: disabled, ...props, onMouseDown: (event) => {
|
|
211
|
+
onMouseDown?.(event);
|
|
212
|
+
// Radix: primary button without Ctrl selects on mousedown.
|
|
213
|
+
if (!disabled && event.button === 0 && !event.ctrlKey && !event.defaultPrevented) {
|
|
214
|
+
select(value);
|
|
215
|
+
}
|
|
216
|
+
}, nativeButton: native.nativeButton, render: slot.render ? stateRender('button', activeState, slot.render) : controlRender(activeState), children: slot.children }));
|
|
193
217
|
}
|
|
194
|
-
function TabsContent({ className, ...props }) {
|
|
195
|
-
|
|
218
|
+
function TabsContent({ className, forceMount, asChild, children, ...props }) {
|
|
219
|
+
const slot = asChildRender(asChild, children);
|
|
220
|
+
const baseId = React.useContext(TabsBaseIdContext);
|
|
221
|
+
const active = React.useContext(TabsActiveValueContext) === props.value;
|
|
222
|
+
// Radix renders every panel element (inactive ones empty and `hidden`) and
|
|
223
|
+
// mounts the content only while active or with `forceMount`.
|
|
224
|
+
return (_jsx(TabsPrimitive.Panel, { "data-slot": "tabs-content", id: panelId(baseId, props.value), "aria-labelledby": tabId(baseId, props.value), className: cn('flex-1 outline-none', className), ...props, keepMounted: true, render: stateRender('div', activeState, slot.render), children: active || forceMount ? slot.children : null }));
|
|
196
225
|
}
|
|
197
226
|
/** Standalone filter pill bar — works WITHOUT a <Tabs> root. Use for filter bars, mode toggles. */
|
|
198
227
|
function FilterBar({ className, ...props }) {
|
|
199
|
-
return (_jsx("div", { "data-slot": "filter-bar", role: "tablist", className: cn(
|
|
228
|
+
return (_jsx("div", { "data-slot": "filter-bar", role: "tablist", className: cn('bg-foreground/5 text-muted-foreground inline-flex h-9 w-fit items-center justify-center gap-0.5 p-0.5', className), ...props }));
|
|
200
229
|
}
|
|
201
230
|
/** Standalone filter pill — works WITHOUT a <Tabs> root. Pair with FilterBar. */
|
|
202
231
|
function FilterBarItem({ className, ...props }) {
|
|
203
|
-
return (_jsx("button", { "data-slot": "filter-bar-item", role: "tab", type: "button", className: cn(
|
|
232
|
+
return (_jsx("button", { "data-slot": "filter-bar-item", role: "tab", type: "button", className: cn('duration-normal inline-flex h-[calc(100%-4px)] flex-1 cursor-pointer items-center justify-center gap-1.5 border border-transparent px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-colors', 'text-muted-foreground/60 hover:text-foreground/80', 'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-foreground/6 data-[state=active]:shadow-sm data-[state=active]:ring-1', 'disabled:pointer-events-none disabled:opacity-50', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", className), ...props }));
|
|
204
233
|
}
|
|
205
|
-
export {
|
|
234
|
+
export { FilterBar, FilterBarItem, Tabs, TabsContent, TabsList, tabsSegmentedChipClasses, tabsSegmentedTrackClasses, TabsTrigger, tabsTriggerHeightVariants, tabsTriggerPaddingVariants, tabsTriggerTextVariants, };
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
2
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
declare const toggleVariants: (props?: ({
|
|
5
4
|
variant?: "outline" | "secondary" | "default" | null | undefined;
|
|
6
5
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
-
|
|
7
|
+
type ToggleProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'value'> & VariantProps<typeof toggleVariants> & {
|
|
8
|
+
pressed?: boolean;
|
|
9
|
+
defaultPressed?: boolean;
|
|
10
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
11
|
+
value?: string;
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const Toggle: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "value"> & VariantProps<(props?: ({
|
|
9
15
|
variant?: "outline" | "secondary" | "default" | null | undefined;
|
|
10
16
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string> &
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
18
|
+
pressed?: boolean;
|
|
19
|
+
defaultPressed?: boolean;
|
|
20
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
21
|
+
value?: string;
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
12
24
|
export { Toggle, toggleVariants };
|
|
25
|
+
export type { ToggleProps };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Toggle as TogglePrimitive } from '@base-ui/react/toggle';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { asChildRender, composeRefs, stateRender, useNativeButton } from '../lib/base-ui-compat.js';
|
|
5
6
|
import { cn } from '../lib/utils.js';
|
|
6
7
|
const toggleVariants = cva('inline-flex items-center justify-center gap-2 rounded-md bg-transparent text-sm font-medium text-muted-foreground transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-kortix-base focus-visible:ring-[0.6px] disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary/10 data-[state=on]:text-primary data-[state=on]:hover:bg-primary/[0.14] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
7
8
|
variants: {
|
|
@@ -21,6 +22,10 @@ const toggleVariants = cva('inline-flex items-center justify-center gap-2 rounde
|
|
|
21
22
|
size: 'default',
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
|
-
const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) =>
|
|
25
|
-
|
|
25
|
+
const Toggle = React.forwardRef(({ className, variant, size, asChild, children, onPressedChange, ...props }, ref) => {
|
|
26
|
+
const slot = asChildRender(asChild, children);
|
|
27
|
+
const native = useNativeButton(asChild, children);
|
|
28
|
+
return (_jsx(TogglePrimitive, { ref: composeRefs(ref, native.ref), className: cn(toggleVariants({ variant, size, className })), ...props, onPressedChange: (pressed) => onPressedChange?.(pressed), nativeButton: native.nativeButton, render: stateRender('button', (s) => (s.pressed ? 'on' : 'off'), slot.render), children: slot.children }));
|
|
29
|
+
});
|
|
30
|
+
Toggle.displayName = 'Toggle';
|
|
26
31
|
export { Toggle, toggleVariants };
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
import { type LegacyPositionProps } from '../lib/base-ui-compat.js';
|
|
3
|
+
declare function TooltipProvider({ delayDuration, skipDelayDuration, children, }: {
|
|
4
|
+
delayDuration?: number;
|
|
5
|
+
skipDelayDuration?: number;
|
|
6
|
+
/** Accepted for Radix parity; Base UI popups are hoverable unless the root disables it. */
|
|
7
|
+
disableHoverableContent?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export interface TooltipProps {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
delayDuration?: number;
|
|
15
|
+
disableHoverableContent?: boolean;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}
|
|
4
18
|
/** @deprecated In feature code use `Hint` (`@kortix/ui/hint`). `Tooltip` is the primitive `Hint` builds on. */
|
|
5
|
-
declare
|
|
6
|
-
declare const TooltipTrigger: React.ForwardRefExoticComponent<
|
|
19
|
+
declare function Tooltip({ open, defaultOpen, onOpenChange, delayDuration, disableHoverableContent, children, }: TooltipProps): React.JSX.Element;
|
|
20
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
7
23
|
/** @deprecated In feature code use `Hint` (`@kortix/ui/hint`). */
|
|
8
|
-
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<
|
|
24
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & LegacyPositionProps & {
|
|
25
|
+
asChild?: boolean;
|
|
26
|
+
forceMount?: true;
|
|
27
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
28
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|