@choice-ui/react 1.3.10 → 1.3.11
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/dist/cjs/components/avatar/dist/index.cjs +1 -1
- package/dist/cjs/components/code-block/dist/index.cjs +20 -17
- package/dist/cjs/components/icon-button/dist/index.cjs +41 -42
- package/dist/cjs/components/menus/dist/index.cjs +0 -1
- package/dist/cjs/components/multi-select/dist/index.cjs +21 -6
- package/dist/cjs/components/segmented/dist/index.cjs +0 -1
- package/dist/cjs/components/tabs/dist/index.cjs +39 -4
- package/dist/core/app/components/button/dist/index.d.ts +0 -87
- package/dist/core/app/components/chip/dist/index.d.ts +1 -1
- package/dist/core/app/components/code-block/dist/index.d.ts +6 -0
- package/dist/core/app/components/command/dist/index.d.ts +1 -1
- package/dist/core/app/components/icon-button/dist/index.d.ts +4 -3
- package/dist/core/app/components/label/dist/index.d.ts +1 -1
- package/dist/core/app/components/link-button/dist/index.d.ts +1 -1
- package/dist/core/app/components/list/dist/index.d.ts +1 -53
- package/dist/core/app/components/menus/dist/index.d.ts +1 -31
- package/dist/core/app/components/multi-select/dist/index.d.ts +1 -82
- package/dist/core/app/components/segmented/dist/index.d.ts +1 -11
- package/dist/core/app/components/skeleton/dist/index.d.ts +1 -43
- package/dist/core/app/components/tabs/dist/index.d.ts +9 -17
- package/dist/core/app/components/toggle-button/dist/index.d.ts +1 -1
- package/dist/esm/components/avatar/dist/index.js +1 -1
- package/dist/esm/components/code-block/dist/index.js +21 -18
- package/dist/esm/components/icon-button/dist/index.js +41 -42
- package/dist/esm/components/menus/dist/index.js +0 -1
- package/dist/esm/components/multi-select/dist/index.js +22 -7
- package/dist/esm/components/segmented/dist/index.js +1 -2
- package/dist/esm/components/tabs/dist/index.js +40 -5
- package/package.json +1 -1
|
@@ -104,7 +104,6 @@ interface MenusComponentProps extends react__default.ForwardRefExoticComponent<M
|
|
|
104
104
|
SearchEmpty: typeof MenuSearchEmpty;
|
|
105
105
|
Value: typeof MenuValue;
|
|
106
106
|
}
|
|
107
|
-
declare const MenusBase: react__default.ForwardRefExoticComponent<Omit<MenusProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
|
|
108
107
|
declare const Menus: MenusComponentProps;
|
|
109
108
|
|
|
110
109
|
/**
|
|
@@ -169,34 +168,6 @@ interface MenuRefsResult {
|
|
|
169
168
|
}
|
|
170
169
|
declare function useMenuRefs(config?: MenuRefsConfig): MenuRefsResult;
|
|
171
170
|
|
|
172
|
-
/**
|
|
173
|
-
* 菜单触摸交互 Hook
|
|
174
|
-
*
|
|
175
|
-
* 处理菜单组件的触摸交互逻辑:
|
|
176
|
-
* - 触摸状态检测
|
|
177
|
-
* - 触摸开始事件处理
|
|
178
|
-
* - 指针移动事件处理
|
|
179
|
-
* - 触摸相关的事件处理器
|
|
180
|
-
*/
|
|
181
|
-
interface MenuTouchConfig {
|
|
182
|
-
/** 设置触摸状态 */
|
|
183
|
-
setTouch: (touch: boolean) => void;
|
|
184
|
-
/** 触摸状态 */
|
|
185
|
-
touch: boolean;
|
|
186
|
-
}
|
|
187
|
-
interface MenuTouchResult {
|
|
188
|
-
/** 获取触摸相关的引用属性 */
|
|
189
|
-
getTouchProps: () => {
|
|
190
|
-
onPointerMove: (event: React.PointerEvent) => void;
|
|
191
|
-
onTouchStart: () => void;
|
|
192
|
-
};
|
|
193
|
-
/** 指针移动事件处理器 */
|
|
194
|
-
handlePointerMove: (event: React.PointerEvent) => void;
|
|
195
|
-
/** 触摸开始事件处理器 */
|
|
196
|
-
handleTouchStart: () => void;
|
|
197
|
-
}
|
|
198
|
-
declare function useMenuTouch(config: MenuTouchConfig): MenuTouchResult;
|
|
199
|
-
|
|
200
171
|
/**
|
|
201
172
|
* 菜单滚动处理 Hook
|
|
202
173
|
*
|
|
@@ -477,7 +448,6 @@ interface MenuContextType {
|
|
|
477
448
|
variant?: "default" | "light" | "reset";
|
|
478
449
|
}
|
|
479
450
|
declare const MenuContext: react.Context<MenuContextType | null>;
|
|
480
|
-
declare const useMenu: () => MenuContextType;
|
|
481
451
|
|
|
482
452
|
interface MenuContextItemProps extends MenuItemProps {
|
|
483
453
|
customActive?: boolean;
|
|
@@ -509,4 +479,4 @@ declare const MenuContextLabel: react.NamedExoticComponent<MenuLabelProps>;
|
|
|
509
479
|
|
|
510
480
|
declare const MenuContextSubTrigger: react.MemoExoticComponent<react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLButtonElement>>>;
|
|
511
481
|
|
|
512
|
-
export {
|
|
482
|
+
export { MenuButton, MenuCheckbox, MenuContext, MenuContextContent, MenuContextItem, type MenuContextItemProps, MenuContextLabel, MenuContextSubTrigger, type MenuContextType, MenuDivider, MenuInput, MenuItem, MenuLabel, MenuScrollArrow, MenuSearch, MenuSearchEmpty, MenuTrigger, MenuValue, Menus, type MenusProps, useMenuBaseRefs, useMenuChildren, useMenuFloating, useMenuRefs, useMenuScroll, useMenuScrollHeight, useMenuSelection, useMenuState, useMenuTree };
|
|
@@ -74,85 +74,4 @@ interface MultiSelectComponentType extends React__default.ForwardRefExoticCompon
|
|
|
74
74
|
}
|
|
75
75
|
declare const MultiSelect: MultiSelectComponentType;
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
controlledOpen?: boolean;
|
|
79
|
-
onOpenChange?: (open: boolean) => void;
|
|
80
|
-
}
|
|
81
|
-
declare function useMultiSelectState({ controlledOpen, onOpenChange }: UseMultiSelectStateProps): {
|
|
82
|
-
open: boolean;
|
|
83
|
-
setOpen: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
84
|
-
touch: boolean;
|
|
85
|
-
setTouch: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
86
|
-
scrollTop: number;
|
|
87
|
-
setScrollTop: React$1.Dispatch<React$1.SetStateAction<number>>;
|
|
88
|
-
activeIndex: number | null;
|
|
89
|
-
setActiveIndex: React$1.Dispatch<React$1.SetStateAction<number | null>>;
|
|
90
|
-
validationMessage: string | null;
|
|
91
|
-
setValidationMessage: React$1.Dispatch<React$1.SetStateAction<string | null>>;
|
|
92
|
-
isControlledOpen: boolean;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
interface UseMultiSelectSelectionProps {
|
|
96
|
-
closeOnSelect?: boolean;
|
|
97
|
-
handleOpenChange: (open: boolean) => void;
|
|
98
|
-
i18n?: {
|
|
99
|
-
maxSelectionMessage?: (maxSelection: number) => string;
|
|
100
|
-
minSelectionMessage?: (minSelection: number) => string;
|
|
101
|
-
};
|
|
102
|
-
maxSelection?: number;
|
|
103
|
-
minSelection?: number;
|
|
104
|
-
onChange?: (values: string[]) => void;
|
|
105
|
-
selectableOptions: Array<{
|
|
106
|
-
disabled?: boolean;
|
|
107
|
-
element?: React.ReactElement;
|
|
108
|
-
value?: string;
|
|
109
|
-
}>;
|
|
110
|
-
setValidationMessage: (message: string | null) => void;
|
|
111
|
-
values: string[];
|
|
112
|
-
}
|
|
113
|
-
declare function useMultiSelectSelection({ values, onChange, selectableOptions, maxSelection, minSelection, closeOnSelect, i18n, setValidationMessage, handleOpenChange, }: UseMultiSelectSelectionProps): {
|
|
114
|
-
handleSelect: (index: number) => void;
|
|
115
|
-
handleRemove: (valueToRemove: string) => void;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
declare function extractItemElements(children: React__default.ReactNode): React__default.ReactNode[];
|
|
119
|
-
declare function processOptions(itemElements: React__default.ReactNode[]): ({
|
|
120
|
-
divider: boolean;
|
|
121
|
-
label?: undefined;
|
|
122
|
-
children?: undefined;
|
|
123
|
-
value?: undefined;
|
|
124
|
-
disabled?: undefined;
|
|
125
|
-
_originalIndex?: undefined;
|
|
126
|
-
element?: undefined;
|
|
127
|
-
} | {
|
|
128
|
-
label: boolean;
|
|
129
|
-
children: any;
|
|
130
|
-
divider?: undefined;
|
|
131
|
-
value?: undefined;
|
|
132
|
-
disabled?: undefined;
|
|
133
|
-
_originalIndex?: undefined;
|
|
134
|
-
element?: undefined;
|
|
135
|
-
} | {
|
|
136
|
-
value: string | undefined;
|
|
137
|
-
disabled: boolean | undefined;
|
|
138
|
-
_originalIndex: number;
|
|
139
|
-
element: React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
140
|
-
children: React__default.ReactNode;
|
|
141
|
-
divider?: undefined;
|
|
142
|
-
label?: undefined;
|
|
143
|
-
})[];
|
|
144
|
-
declare function filterSelectableOptions(options: Array<{
|
|
145
|
-
disabled?: boolean;
|
|
146
|
-
divider?: boolean;
|
|
147
|
-
element?: React__default.ReactElement;
|
|
148
|
-
label?: boolean;
|
|
149
|
-
value?: string;
|
|
150
|
-
}>): {
|
|
151
|
-
disabled?: boolean;
|
|
152
|
-
divider?: boolean;
|
|
153
|
-
element?: React__default.ReactElement;
|
|
154
|
-
label?: boolean;
|
|
155
|
-
value?: string;
|
|
156
|
-
}[];
|
|
157
|
-
|
|
158
|
-
export { MultiSelect, type MultiSelectProps, MultiSelectTrigger, type MultiSelectTriggerProps, type UseMultiSelectSelectionProps, type UseMultiSelectStateProps, extractItemElements, filterSelectableOptions, processOptions, useMultiSelectSelection, useMultiSelectState };
|
|
77
|
+
export { MultiSelect, type MultiSelectProps, MultiSelectTrigger, type MultiSelectTriggerProps };
|
|
@@ -26,14 +26,4 @@ declare const Segmented: react.ForwardRefExoticComponent<Omit<SegmentedProps, "r
|
|
|
26
26
|
Item: react.MemoExoticComponent<react.ForwardRefExoticComponent<SegmentedItemProps & react.RefAttributes<HTMLLabelElement>>>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
groupId: string;
|
|
32
|
-
onChange: (value: string) => void;
|
|
33
|
-
readOnly?: boolean;
|
|
34
|
-
value?: string;
|
|
35
|
-
variant?: "default" | "light" | "dark" | "reset";
|
|
36
|
-
}
|
|
37
|
-
declare function useSegmentedContext(): SegmentedContextValue;
|
|
38
|
-
|
|
39
|
-
export { Segmented, type SegmentedContextValue, type SegmentedItemProps, type SegmentedProps, useSegmentedContext };
|
|
29
|
+
export { Segmented, type SegmentedItemProps, type SegmentedProps };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import * as tailwind_variants from 'tailwind-variants';
|
|
4
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
type SkeletonVariant = "text" | "rectangular" | "rounded" | "circular";
|
|
@@ -55,47 +54,6 @@ interface SkeletonProps extends ComponentPropsWithoutRef<"span"> {
|
|
|
55
54
|
*/
|
|
56
55
|
declare const Skeleton: react.MemoExoticComponent<react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLSpanElement>>>;
|
|
57
56
|
|
|
58
|
-
declare const skeletonTv: tailwind_variants.TVReturnType<{
|
|
59
|
-
hasChildren: {
|
|
60
|
-
true: {};
|
|
61
|
-
false: {};
|
|
62
|
-
};
|
|
63
|
-
loading: {
|
|
64
|
-
true: {
|
|
65
|
-
root: string[];
|
|
66
|
-
};
|
|
67
|
-
false: {};
|
|
68
|
-
};
|
|
69
|
-
}, {
|
|
70
|
-
root: string[];
|
|
71
|
-
}, undefined, {
|
|
72
|
-
hasChildren: {
|
|
73
|
-
true: {};
|
|
74
|
-
false: {};
|
|
75
|
-
};
|
|
76
|
-
loading: {
|
|
77
|
-
true: {
|
|
78
|
-
root: string[];
|
|
79
|
-
};
|
|
80
|
-
false: {};
|
|
81
|
-
};
|
|
82
|
-
}, {
|
|
83
|
-
root: string[];
|
|
84
|
-
}, tailwind_variants.TVReturnType<{
|
|
85
|
-
hasChildren: {
|
|
86
|
-
true: {};
|
|
87
|
-
false: {};
|
|
88
|
-
};
|
|
89
|
-
loading: {
|
|
90
|
-
true: {
|
|
91
|
-
root: string[];
|
|
92
|
-
};
|
|
93
|
-
false: {};
|
|
94
|
-
};
|
|
95
|
-
}, {
|
|
96
|
-
root: string[];
|
|
97
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
98
|
-
|
|
99
57
|
interface UseSkeletonParams {
|
|
100
58
|
hasChildren: boolean;
|
|
101
59
|
height?: number | string;
|
|
@@ -116,4 +74,4 @@ interface SkeletonProviderProps {
|
|
|
116
74
|
}
|
|
117
75
|
declare function SkeletonProvider({ children, loading }: SkeletonProviderProps): react_jsx_runtime.JSX.Element;
|
|
118
76
|
|
|
119
|
-
export { Skeleton, type SkeletonContextValue, type SkeletonProps, SkeletonProvider, type SkeletonProviderProps,
|
|
77
|
+
export { Skeleton, type SkeletonContextValue, type SkeletonProps, SkeletonProvider, type SkeletonProviderProps, useSkeleton, useSkeletonContext };
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
id: string;
|
|
7
|
-
onChange: (value: string) => void;
|
|
8
|
-
readOnly?: boolean;
|
|
9
|
-
value: string;
|
|
10
|
-
variant: "default" | "light" | "dark" | "reset";
|
|
11
|
-
}
|
|
12
|
-
declare function useTabsContext(): TabsContextValue;
|
|
13
|
-
|
|
14
|
-
interface TabItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
|
|
4
|
+
interface TabItemProps extends Omit<HTMLProps<HTMLElement>, "value" | "as"> {
|
|
5
|
+
as?: React.ElementType;
|
|
15
6
|
children: ReactNode;
|
|
16
7
|
disabled?: boolean;
|
|
17
8
|
value: string;
|
|
18
9
|
}
|
|
19
|
-
declare const TabItem: react.MemoExoticComponent<react.ForwardRefExoticComponent<TabItemProps & react.RefAttributes<
|
|
10
|
+
declare const TabItem: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<TabItemProps, "ref"> & react.RefAttributes<HTMLElement>>>;
|
|
20
11
|
|
|
21
|
-
interface TabsProps extends Omit<HTMLProps<
|
|
12
|
+
interface TabsProps extends Omit<HTMLProps<HTMLElement>, "onChange" | "as"> {
|
|
13
|
+
as?: React.ElementType;
|
|
22
14
|
children?: ReactNode;
|
|
23
15
|
className?: string;
|
|
24
16
|
disabled?: boolean;
|
|
25
17
|
onChange?: (value: string) => void;
|
|
26
18
|
readOnly?: boolean;
|
|
27
19
|
value: string;
|
|
28
|
-
variant?: "default" | "light" | "dark" | "reset";
|
|
20
|
+
variant?: "default" | "light" | "dark" | "accent" | "reset";
|
|
29
21
|
}
|
|
30
|
-
interface TabsComponent extends React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<
|
|
22
|
+
interface TabsComponent extends React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLElement>> {
|
|
31
23
|
Item: typeof TabItem;
|
|
32
24
|
}
|
|
33
25
|
declare const Tabs: TabsComponent;
|
|
34
26
|
|
|
35
|
-
export { TabItem, type TabItemProps, Tabs, type
|
|
27
|
+
export { TabItem, type TabItemProps, Tabs, type TabsProps };
|
|
@@ -18,4 +18,4 @@ interface ToggleButtonProps extends Omit<HTMLProps<HTMLInputElement>, "value" |
|
|
|
18
18
|
}
|
|
19
19
|
declare const ToggleButton: react.ForwardRefExoticComponent<Omit<ToggleButtonProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
|
|
20
20
|
|
|
21
|
-
export { ToggleButton };
|
|
21
|
+
export { ToggleButton, type ToggleButtonProps };
|
|
@@ -25,7 +25,7 @@ var InitialLetter = memo(function InitialLetter2({
|
|
|
25
25
|
return /* @__PURE__ */ jsx(
|
|
26
26
|
"span",
|
|
27
27
|
{
|
|
28
|
-
className: "flex h-full w-full
|
|
28
|
+
className: "flex h-full w-full items-center justify-center uppercase select-none",
|
|
29
29
|
style: {
|
|
30
30
|
fontSize: `${fontSize}px`,
|
|
31
31
|
lineHeight: 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useState, useEffect } from "react";
|
|
2
2
|
import { useEventCallback } from "usehooks-ts";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
4
4
|
import { codeToHtml } from "shiki";
|
|
5
5
|
import { IconButton } from "../../icon-button/dist/index.js";
|
|
6
6
|
import { FileCode, CircleCirclehecirclek, ClipboardSmall, Enlarge, ChevronUpSmall, ChevronDownSmall } from "@choiceform/icons-react";
|
|
@@ -165,10 +165,10 @@ var CodeBlock = memo(function CodeBlock2(props) {
|
|
|
165
165
|
expandable = true,
|
|
166
166
|
defaultExpanded = true,
|
|
167
167
|
defaultCodeExpanded = false,
|
|
168
|
+
variant = "default",
|
|
168
169
|
onExpandChange,
|
|
169
170
|
onCodeExpandChange
|
|
170
171
|
} = props;
|
|
171
|
-
const theme = useTheme();
|
|
172
172
|
const { scrollRef, contentRef, scrollToBottom } = useStickToBottom({
|
|
173
173
|
resize: "smooth",
|
|
174
174
|
initial: "smooth"
|
|
@@ -233,7 +233,7 @@ var CodeBlock = memo(function CodeBlock2(props) {
|
|
|
233
233
|
handleCopy,
|
|
234
234
|
scrollRef,
|
|
235
235
|
contentRef,
|
|
236
|
-
|
|
236
|
+
variant
|
|
237
237
|
}),
|
|
238
238
|
[
|
|
239
239
|
language,
|
|
@@ -250,7 +250,7 @@ var CodeBlock = memo(function CodeBlock2(props) {
|
|
|
250
250
|
handleCopy,
|
|
251
251
|
scrollRef,
|
|
252
252
|
contentRef,
|
|
253
|
-
|
|
253
|
+
variant
|
|
254
254
|
]
|
|
255
255
|
);
|
|
256
256
|
const injectedChildren = React.useMemo(() => {
|
|
@@ -274,7 +274,10 @@ var CodeBlock = memo(function CodeBlock2(props) {
|
|
|
274
274
|
"div",
|
|
275
275
|
{
|
|
276
276
|
className: tcx(
|
|
277
|
-
"
|
|
277
|
+
"group relative overflow-hidden rounded-lg",
|
|
278
|
+
variant === "default" && "bg-secondary-background",
|
|
279
|
+
variant === "light" && "bg-gray-100",
|
|
280
|
+
variant === "dark" && "bg-gray-700",
|
|
278
281
|
className
|
|
279
282
|
),
|
|
280
283
|
children: injectedChildren
|
|
@@ -285,14 +288,10 @@ var codeBlockCodeTv = tcv({
|
|
|
285
288
|
base: "text-message-code w-fit min-w-full bg-transparent font-mono [&>pre]:!bg-transparent [&>pre]:px-4 [&>pre]:py-4"
|
|
286
289
|
});
|
|
287
290
|
var CodeBlockCode = memo(function CodeBlockCode2(props) {
|
|
288
|
-
const {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
codeBlock: _,
|
|
293
|
-
...rest
|
|
294
|
-
} = props;
|
|
295
|
-
const theme = useTheme();
|
|
291
|
+
const { code, language = "tsx", className, variant: variantProp, codeBlock, ...rest } = props;
|
|
292
|
+
const systemTheme = useTheme();
|
|
293
|
+
const resolvedVariant = variantProp ?? ((codeBlock == null ? void 0 : codeBlock.variant) === "default" ? void 0 : codeBlock == null ? void 0 : codeBlock.variant);
|
|
294
|
+
const theme = resolvedVariant ?? systemTheme;
|
|
296
295
|
const [highlightedHtml, setHighlightedHtml] = useState(null);
|
|
297
296
|
useEffect(() => {
|
|
298
297
|
async function highlight() {
|
|
@@ -1072,7 +1071,7 @@ var CodeBlockFooter = memo(function CodeBlockFooter2(props) {
|
|
|
1072
1071
|
var codeBlockTv = tcv({
|
|
1073
1072
|
slots: {
|
|
1074
1073
|
code: "overflow-hidden",
|
|
1075
|
-
content: "flex w-fit flex-col overflow-clip p-
|
|
1074
|
+
content: "flex w-fit flex-col overflow-clip p-[inherit]"
|
|
1076
1075
|
}
|
|
1077
1076
|
});
|
|
1078
1077
|
function CodeBlockContent(props) {
|
|
@@ -1087,11 +1086,13 @@ function CodeBlockContent(props) {
|
|
|
1087
1086
|
}
|
|
1088
1087
|
const tv = codeBlockTv();
|
|
1089
1088
|
const shouldLimitHeight = lineCount > lineThreshold && !codeExpanded;
|
|
1090
|
-
return /* @__PURE__ */ jsx(
|
|
1089
|
+
return /* @__PURE__ */ jsx(Fragment, { children: withScrollArea ? /* @__PURE__ */ jsx(
|
|
1091
1090
|
ScrollArea,
|
|
1092
1091
|
{
|
|
1093
1092
|
orientation: "both",
|
|
1094
1093
|
hoverBoundary: "none",
|
|
1094
|
+
className: tcx(tv.code(), className),
|
|
1095
|
+
variant: codeBlock.variant,
|
|
1095
1096
|
children: /* @__PURE__ */ jsx(
|
|
1096
1097
|
ScrollArea.Viewport,
|
|
1097
1098
|
{
|
|
@@ -1108,7 +1109,8 @@ function CodeBlockContent(props) {
|
|
|
1108
1109
|
CodeBlockCode,
|
|
1109
1110
|
{
|
|
1110
1111
|
code,
|
|
1111
|
-
language
|
|
1112
|
+
language,
|
|
1113
|
+
codeBlock
|
|
1112
1114
|
}
|
|
1113
1115
|
)
|
|
1114
1116
|
}
|
|
@@ -1116,11 +1118,12 @@ function CodeBlockContent(props) {
|
|
|
1116
1118
|
}
|
|
1117
1119
|
)
|
|
1118
1120
|
}
|
|
1119
|
-
) : /* @__PURE__ */ jsx("div", { className: tv.content(), children: /* @__PURE__ */ jsx(
|
|
1121
|
+
) : /* @__PURE__ */ jsx("div", { className: tcx(tv.content(), className), children: /* @__PURE__ */ jsx(
|
|
1120
1122
|
CodeBlockCode,
|
|
1121
1123
|
{
|
|
1122
1124
|
code,
|
|
1123
|
-
language
|
|
1125
|
+
language,
|
|
1126
|
+
codeBlock
|
|
1124
1127
|
}
|
|
1125
1128
|
) }) });
|
|
1126
1129
|
}
|
|
@@ -156,48 +156,47 @@ var iconButtonGroupTv = tcv({
|
|
|
156
156
|
button: ["flex-1", "rounded-none first:rounded-l-md last:rounded-r-md", "w-full min-w-6"]
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
|
-
var IconButton = forwardRef(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
159
|
+
var IconButton = forwardRef(function IconButton2(props, ref) {
|
|
160
|
+
const {
|
|
161
|
+
as = "button",
|
|
162
|
+
className,
|
|
163
|
+
children,
|
|
164
|
+
disabled,
|
|
165
|
+
readOnly = false,
|
|
166
|
+
active,
|
|
167
|
+
loading,
|
|
168
|
+
focused,
|
|
169
|
+
variant = "default",
|
|
170
|
+
size = "default",
|
|
171
|
+
tooltip,
|
|
172
|
+
asChild,
|
|
173
|
+
onClick,
|
|
174
|
+
...rest
|
|
175
|
+
} = props;
|
|
176
|
+
const As = asChild ? Slot : as;
|
|
177
|
+
const style = iconButtonTv({
|
|
178
|
+
disabled,
|
|
179
|
+
active,
|
|
180
|
+
focused,
|
|
181
|
+
loading,
|
|
182
|
+
variant,
|
|
183
|
+
size
|
|
184
|
+
});
|
|
185
|
+
const handleClick = readOnly ? void 0 : onClick;
|
|
186
|
+
const button = /* @__PURE__ */ jsx(
|
|
187
|
+
As,
|
|
188
|
+
{
|
|
189
|
+
...rest,
|
|
190
|
+
ref,
|
|
191
|
+
type: rest.type || "button",
|
|
192
|
+
className: tcx(style.button(), className),
|
|
193
|
+
disabled: disabled || loading,
|
|
194
|
+
onClick: handleClick,
|
|
195
|
+
children: loading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "animate-spin" }) : children
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
return tooltip ? /* @__PURE__ */ jsx(Tooltip, { ...tooltip, children: button }) : button;
|
|
199
|
+
});
|
|
201
200
|
IconButton.displayName = "IconButton";
|
|
202
201
|
var IconButtonGroup = forwardRef((props, ref) => {
|
|
203
202
|
const { children, className, variant = "solid", ...rest } = props;
|
|
@@ -64,6 +64,25 @@ var multiSelectTriggerTv = tcv({
|
|
|
64
64
|
hasValues: false
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
+
var multiSelectTv = tcv({
|
|
68
|
+
slots: {
|
|
69
|
+
validationMessage: "bg-menu-background absolute top-[calc(100%+4px)] right-0 left-0 rounded-xl px-3 py-2 text-white"
|
|
70
|
+
},
|
|
71
|
+
variants: {
|
|
72
|
+
variant: {
|
|
73
|
+
default: {
|
|
74
|
+
validationMessage: "bg-menu-background text-white"
|
|
75
|
+
},
|
|
76
|
+
light: {
|
|
77
|
+
validationMessage: "bg-white text-gray-900"
|
|
78
|
+
},
|
|
79
|
+
reset: {}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
variant: "default"
|
|
84
|
+
}
|
|
85
|
+
});
|
|
67
86
|
var MultiSelectTrigger = memo(
|
|
68
87
|
forwardRef((props, ref) => {
|
|
69
88
|
const {
|
|
@@ -406,6 +425,7 @@ var MultiSelectComponent = memo(
|
|
|
406
425
|
root,
|
|
407
426
|
variant = "default"
|
|
408
427
|
} = props;
|
|
428
|
+
const tv = multiSelectTv();
|
|
409
429
|
const [itemElements, triggerElement, contentElement] = useMemo(() => {
|
|
410
430
|
if (!children) return [[], null, null];
|
|
411
431
|
const childrenArray = Children.toArray(children);
|
|
@@ -798,7 +818,7 @@ var MultiSelectComponent = memo(
|
|
|
798
818
|
},
|
|
799
819
|
dir
|
|
800
820
|
)),
|
|
801
|
-
showValidationMessage && validationMessage && /* @__PURE__ */ jsx("div", { className:
|
|
821
|
+
showValidationMessage && validationMessage && /* @__PURE__ */ jsx("div", { className: tv.validationMessage({ variant }), children: validationMessage })
|
|
802
822
|
]
|
|
803
823
|
}
|
|
804
824
|
)
|
|
@@ -832,10 +852,5 @@ var MultiSelect2 = Object.assign(BaseMultiSelect, {
|
|
|
832
852
|
MultiSelect2.displayName = "MultiSelect";
|
|
833
853
|
export {
|
|
834
854
|
MultiSelect2 as MultiSelect,
|
|
835
|
-
MultiSelectTrigger
|
|
836
|
-
extractItemElements,
|
|
837
|
-
filterSelectableOptions,
|
|
838
|
-
processOptions,
|
|
839
|
-
useMultiSelectSelection,
|
|
840
|
-
useMultiSelectState
|
|
855
|
+
MultiSelectTrigger
|
|
841
856
|
};
|
|
@@ -27,6 +27,7 @@ var tabsTv = tcv({
|
|
|
27
27
|
default: {},
|
|
28
28
|
light: {},
|
|
29
29
|
dark: {},
|
|
30
|
+
accent: {},
|
|
30
31
|
reset: {}
|
|
31
32
|
},
|
|
32
33
|
active: {
|
|
@@ -128,6 +129,36 @@ var tabsTv = tcv({
|
|
|
128
129
|
class: {
|
|
129
130
|
tab: "text-white/50"
|
|
130
131
|
}
|
|
132
|
+
},
|
|
133
|
+
// Accent
|
|
134
|
+
{
|
|
135
|
+
variant: "accent",
|
|
136
|
+
active: false,
|
|
137
|
+
class: {
|
|
138
|
+
tab: "text-default-foreground"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
variant: "accent",
|
|
143
|
+
active: true,
|
|
144
|
+
class: {
|
|
145
|
+
tab: "bg-selected-background text-accent-foreground"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
variant: "accent",
|
|
150
|
+
disabled: false,
|
|
151
|
+
active: false,
|
|
152
|
+
class: {
|
|
153
|
+
tab: "hover:bg-secondary-background"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
variant: "accent",
|
|
158
|
+
disabled: true,
|
|
159
|
+
class: {
|
|
160
|
+
tab: "text-secondary-foreground"
|
|
161
|
+
}
|
|
131
162
|
}
|
|
132
163
|
],
|
|
133
164
|
defaultVariants: {
|
|
@@ -138,6 +169,7 @@ var tabsTv = tcv({
|
|
|
138
169
|
});
|
|
139
170
|
var TabItem = memo(
|
|
140
171
|
forwardRef(function TabItem2({
|
|
172
|
+
as = "button",
|
|
141
173
|
children,
|
|
142
174
|
value,
|
|
143
175
|
disabled,
|
|
@@ -183,8 +215,9 @@ var TabItem = memo(
|
|
|
183
215
|
onKeyDown(e);
|
|
184
216
|
}
|
|
185
217
|
});
|
|
218
|
+
const As = as ?? "button";
|
|
186
219
|
return /* @__PURE__ */ jsx(
|
|
187
|
-
|
|
220
|
+
As,
|
|
188
221
|
{
|
|
189
222
|
ref,
|
|
190
223
|
role: "tab",
|
|
@@ -217,6 +250,7 @@ var TabItem = memo(
|
|
|
217
250
|
TabItem.displayName = "TabItem";
|
|
218
251
|
var TabsRoot = forwardRef(function Tabs(props, ref) {
|
|
219
252
|
const {
|
|
253
|
+
as = "div",
|
|
220
254
|
value: valueProp,
|
|
221
255
|
onChange,
|
|
222
256
|
className,
|
|
@@ -232,6 +266,8 @@ var TabsRoot = forwardRef(function Tabs(props, ref) {
|
|
|
232
266
|
if (readOnly) return;
|
|
233
267
|
onChange == null ? void 0 : onChange(newValue);
|
|
234
268
|
});
|
|
269
|
+
const As = as ?? "div";
|
|
270
|
+
const divProps = As === "div" ? { role: "tablist" } : {};
|
|
235
271
|
const tv = tabsTv({ variant });
|
|
236
272
|
return /* @__PURE__ */ jsx(
|
|
237
273
|
TabsContext.Provider,
|
|
@@ -245,14 +281,14 @@ var TabsRoot = forwardRef(function Tabs(props, ref) {
|
|
|
245
281
|
id
|
|
246
282
|
},
|
|
247
283
|
children: /* @__PURE__ */ jsx(
|
|
248
|
-
|
|
284
|
+
As,
|
|
249
285
|
{
|
|
250
286
|
ref,
|
|
251
|
-
role: "tablist",
|
|
252
287
|
"aria-orientation": "horizontal",
|
|
253
288
|
"aria-disabled": disabled,
|
|
254
289
|
"aria-label": ariaLabel || "Tabs",
|
|
255
290
|
className: tcx(tv.root(), className),
|
|
291
|
+
...divProps,
|
|
256
292
|
...rest,
|
|
257
293
|
children
|
|
258
294
|
}
|
|
@@ -265,6 +301,5 @@ var Tabs2 = TabsRoot;
|
|
|
265
301
|
Tabs2.Item = TabItem;
|
|
266
302
|
export {
|
|
267
303
|
TabItem,
|
|
268
|
-
Tabs2 as Tabs
|
|
269
|
-
useTabsContext
|
|
304
|
+
Tabs2 as Tabs
|
|
270
305
|
};
|
package/package.json
CHANGED