@choice-ui/react 1.3.10 → 1.3.13
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 +19 -32
|
@@ -27,7 +27,7 @@ var InitialLetter = React.memo(function InitialLetter2({
|
|
|
27
27
|
return /* @__PURE__ */ require$$0.jsx(
|
|
28
28
|
"span",
|
|
29
29
|
{
|
|
30
|
-
className: "flex h-full w-full
|
|
30
|
+
className: "flex h-full w-full items-center justify-center uppercase select-none",
|
|
31
31
|
style: {
|
|
32
32
|
fontSize: `${fontSize}px`,
|
|
33
33
|
lineHeight: 1
|
|
@@ -167,10 +167,10 @@ var CodeBlock = React.memo(function CodeBlock2(props) {
|
|
|
167
167
|
expandable = true,
|
|
168
168
|
defaultExpanded = true,
|
|
169
169
|
defaultCodeExpanded = false,
|
|
170
|
+
variant = "default",
|
|
170
171
|
onExpandChange,
|
|
171
172
|
onCodeExpandChange
|
|
172
173
|
} = props;
|
|
173
|
-
const theme = useTheme();
|
|
174
174
|
const { scrollRef, contentRef, scrollToBottom } = useStickToBottom.useStickToBottom({
|
|
175
175
|
resize: "smooth",
|
|
176
176
|
initial: "smooth"
|
|
@@ -235,7 +235,7 @@ var CodeBlock = React.memo(function CodeBlock2(props) {
|
|
|
235
235
|
handleCopy,
|
|
236
236
|
scrollRef,
|
|
237
237
|
contentRef,
|
|
238
|
-
|
|
238
|
+
variant
|
|
239
239
|
}),
|
|
240
240
|
[
|
|
241
241
|
language,
|
|
@@ -252,7 +252,7 @@ var CodeBlock = React.memo(function CodeBlock2(props) {
|
|
|
252
252
|
handleCopy,
|
|
253
253
|
scrollRef,
|
|
254
254
|
contentRef,
|
|
255
|
-
|
|
255
|
+
variant
|
|
256
256
|
]
|
|
257
257
|
);
|
|
258
258
|
const injectedChildren = React.useMemo(() => {
|
|
@@ -276,7 +276,10 @@ var CodeBlock = React.memo(function CodeBlock2(props) {
|
|
|
276
276
|
"div",
|
|
277
277
|
{
|
|
278
278
|
className: tcx.tcx(
|
|
279
|
-
"
|
|
279
|
+
"group relative overflow-hidden rounded-lg",
|
|
280
|
+
variant === "default" && "bg-secondary-background",
|
|
281
|
+
variant === "light" && "bg-gray-100",
|
|
282
|
+
variant === "dark" && "bg-gray-700",
|
|
280
283
|
className
|
|
281
284
|
),
|
|
282
285
|
children: injectedChildren
|
|
@@ -287,14 +290,10 @@ var codeBlockCodeTv = tcx.tcv({
|
|
|
287
290
|
base: "text-message-code w-fit min-w-full bg-transparent font-mono [&>pre]:!bg-transparent [&>pre]:px-4 [&>pre]:py-4"
|
|
288
291
|
});
|
|
289
292
|
var CodeBlockCode = React.memo(function CodeBlockCode2(props) {
|
|
290
|
-
const {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
codeBlock: _,
|
|
295
|
-
...rest
|
|
296
|
-
} = props;
|
|
297
|
-
const theme = useTheme();
|
|
293
|
+
const { code, language = "tsx", className, variant: variantProp, codeBlock, ...rest } = props;
|
|
294
|
+
const systemTheme = useTheme();
|
|
295
|
+
const resolvedVariant = variantProp ?? ((codeBlock == null ? void 0 : codeBlock.variant) === "default" ? void 0 : codeBlock == null ? void 0 : codeBlock.variant);
|
|
296
|
+
const theme = resolvedVariant ?? systemTheme;
|
|
298
297
|
const [highlightedHtml, setHighlightedHtml] = React.useState(null);
|
|
299
298
|
React.useEffect(() => {
|
|
300
299
|
async function highlight() {
|
|
@@ -1074,7 +1073,7 @@ var CodeBlockFooter = React.memo(function CodeBlockFooter2(props) {
|
|
|
1074
1073
|
var codeBlockTv = tcx.tcv({
|
|
1075
1074
|
slots: {
|
|
1076
1075
|
code: "overflow-hidden",
|
|
1077
|
-
content: "flex w-fit flex-col overflow-clip p-
|
|
1076
|
+
content: "flex w-fit flex-col overflow-clip p-[inherit]"
|
|
1078
1077
|
}
|
|
1079
1078
|
});
|
|
1080
1079
|
function CodeBlockContent(props) {
|
|
@@ -1089,11 +1088,13 @@ function CodeBlockContent(props) {
|
|
|
1089
1088
|
}
|
|
1090
1089
|
const tv = codeBlockTv();
|
|
1091
1090
|
const shouldLimitHeight = lineCount > lineThreshold && !codeExpanded;
|
|
1092
|
-
return /* @__PURE__ */ require$$0.jsx(
|
|
1091
|
+
return /* @__PURE__ */ require$$0.jsx(require$$0.Fragment, { children: withScrollArea ? /* @__PURE__ */ require$$0.jsx(
|
|
1093
1092
|
index$1.ScrollArea,
|
|
1094
1093
|
{
|
|
1095
1094
|
orientation: "both",
|
|
1096
1095
|
hoverBoundary: "none",
|
|
1096
|
+
className: tcx.tcx(tv.code(), className),
|
|
1097
|
+
variant: codeBlock.variant,
|
|
1097
1098
|
children: /* @__PURE__ */ require$$0.jsx(
|
|
1098
1099
|
index$1.ScrollArea.Viewport,
|
|
1099
1100
|
{
|
|
@@ -1110,7 +1111,8 @@ function CodeBlockContent(props) {
|
|
|
1110
1111
|
CodeBlockCode,
|
|
1111
1112
|
{
|
|
1112
1113
|
code,
|
|
1113
|
-
language
|
|
1114
|
+
language,
|
|
1115
|
+
codeBlock
|
|
1114
1116
|
}
|
|
1115
1117
|
)
|
|
1116
1118
|
}
|
|
@@ -1118,11 +1120,12 @@ function CodeBlockContent(props) {
|
|
|
1118
1120
|
}
|
|
1119
1121
|
)
|
|
1120
1122
|
}
|
|
1121
|
-
) : /* @__PURE__ */ require$$0.jsx("div", { className: tv.content(), children: /* @__PURE__ */ require$$0.jsx(
|
|
1123
|
+
) : /* @__PURE__ */ require$$0.jsx("div", { className: tcx.tcx(tv.content(), className), children: /* @__PURE__ */ require$$0.jsx(
|
|
1122
1124
|
CodeBlockCode,
|
|
1123
1125
|
{
|
|
1124
1126
|
code,
|
|
1125
|
-
language
|
|
1127
|
+
language,
|
|
1128
|
+
codeBlock
|
|
1126
1129
|
}
|
|
1127
1130
|
) }) });
|
|
1128
1131
|
}
|
|
@@ -158,48 +158,47 @@ var iconButtonGroupTv = tcx.tcv({
|
|
|
158
158
|
button: ["flex-1", "rounded-none first:rounded-l-md last:rounded-r-md", "w-full min-w-6"]
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
var IconButton = React.forwardRef(
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
161
|
+
var IconButton = React.forwardRef(function IconButton2(props, ref) {
|
|
162
|
+
const {
|
|
163
|
+
as = "button",
|
|
164
|
+
className,
|
|
165
|
+
children,
|
|
166
|
+
disabled,
|
|
167
|
+
readOnly = false,
|
|
168
|
+
active,
|
|
169
|
+
loading,
|
|
170
|
+
focused,
|
|
171
|
+
variant = "default",
|
|
172
|
+
size = "default",
|
|
173
|
+
tooltip,
|
|
174
|
+
asChild,
|
|
175
|
+
onClick,
|
|
176
|
+
...rest
|
|
177
|
+
} = props;
|
|
178
|
+
const As = asChild ? index.Slot : as;
|
|
179
|
+
const style = iconButtonTv({
|
|
180
|
+
disabled,
|
|
181
|
+
active,
|
|
182
|
+
focused,
|
|
183
|
+
loading,
|
|
184
|
+
variant,
|
|
185
|
+
size
|
|
186
|
+
});
|
|
187
|
+
const handleClick = readOnly ? void 0 : onClick;
|
|
188
|
+
const button = /* @__PURE__ */ require$$0.jsx(
|
|
189
|
+
As,
|
|
190
|
+
{
|
|
191
|
+
...rest,
|
|
192
|
+
ref,
|
|
193
|
+
type: rest.type || "button",
|
|
194
|
+
className: tcx.tcx(style.button(), className),
|
|
195
|
+
disabled: disabled || loading,
|
|
196
|
+
onClick: handleClick,
|
|
197
|
+
children: loading ? /* @__PURE__ */ require$$0.jsx(iconsReact.LoaderCircle, { className: "animate-spin" }) : children
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
return tooltip ? /* @__PURE__ */ require$$0.jsx(index$1.Tooltip, { ...tooltip, children: button }) : button;
|
|
201
|
+
});
|
|
203
202
|
IconButton.displayName = "IconButton";
|
|
204
203
|
var IconButtonGroup = React.forwardRef((props, ref) => {
|
|
205
204
|
const { children, className, variant = "solid", ...rest } = props;
|
|
@@ -1134,7 +1134,6 @@ exports.MenuSearchEmpty = MenuSearchEmpty;
|
|
|
1134
1134
|
exports.MenuTrigger = MenuTrigger;
|
|
1135
1135
|
exports.MenuValue = MenuValue;
|
|
1136
1136
|
exports.Menus = Menus;
|
|
1137
|
-
exports.MenusBase = MenusBase;
|
|
1138
1137
|
exports.useMenuBaseRefs = useMenuBaseRefs;
|
|
1139
1138
|
exports.useMenuScroll = useMenuScroll;
|
|
1140
1139
|
exports.useMenuScrollHeight = useMenuScrollHeight;
|
|
@@ -66,6 +66,25 @@ var multiSelectTriggerTv = tcx.tcv({
|
|
|
66
66
|
hasValues: false
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
+
var multiSelectTv = tcx.tcv({
|
|
70
|
+
slots: {
|
|
71
|
+
validationMessage: "bg-menu-background absolute top-[calc(100%+4px)] right-0 left-0 rounded-xl px-3 py-2 text-white"
|
|
72
|
+
},
|
|
73
|
+
variants: {
|
|
74
|
+
variant: {
|
|
75
|
+
default: {
|
|
76
|
+
validationMessage: "bg-menu-background text-white"
|
|
77
|
+
},
|
|
78
|
+
light: {
|
|
79
|
+
validationMessage: "bg-white text-gray-900"
|
|
80
|
+
},
|
|
81
|
+
reset: {}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: "default"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
69
88
|
var MultiSelectTrigger = React.memo(
|
|
70
89
|
React.forwardRef((props, ref) => {
|
|
71
90
|
const {
|
|
@@ -408,6 +427,7 @@ var MultiSelectComponent = React.memo(
|
|
|
408
427
|
root,
|
|
409
428
|
variant = "default"
|
|
410
429
|
} = props;
|
|
430
|
+
const tv = multiSelectTv();
|
|
411
431
|
const [itemElements, triggerElement, contentElement] = React.useMemo(() => {
|
|
412
432
|
if (!children) return [[], null, null];
|
|
413
433
|
const childrenArray = React.Children.toArray(children);
|
|
@@ -800,7 +820,7 @@ var MultiSelectComponent = React.memo(
|
|
|
800
820
|
},
|
|
801
821
|
dir
|
|
802
822
|
)),
|
|
803
|
-
showValidationMessage && validationMessage && /* @__PURE__ */ require$$0.jsx("div", { className:
|
|
823
|
+
showValidationMessage && validationMessage && /* @__PURE__ */ require$$0.jsx("div", { className: tv.validationMessage({ variant }), children: validationMessage })
|
|
804
824
|
]
|
|
805
825
|
}
|
|
806
826
|
)
|
|
@@ -834,8 +854,3 @@ var MultiSelect2 = Object.assign(BaseMultiSelect, {
|
|
|
834
854
|
MultiSelect2.displayName = "MultiSelect";
|
|
835
855
|
exports.MultiSelect = MultiSelect2;
|
|
836
856
|
exports.MultiSelectTrigger = MultiSelectTrigger;
|
|
837
|
-
exports.extractItemElements = extractItemElements;
|
|
838
|
-
exports.filterSelectableOptions = filterSelectableOptions;
|
|
839
|
-
exports.processOptions = processOptions;
|
|
840
|
-
exports.useMultiSelectSelection = useMultiSelectSelection;
|
|
841
|
-
exports.useMultiSelectState = useMultiSelectState;
|
|
@@ -29,6 +29,7 @@ var tabsTv = tcx.tcv({
|
|
|
29
29
|
default: {},
|
|
30
30
|
light: {},
|
|
31
31
|
dark: {},
|
|
32
|
+
accent: {},
|
|
32
33
|
reset: {}
|
|
33
34
|
},
|
|
34
35
|
active: {
|
|
@@ -130,6 +131,36 @@ var tabsTv = tcx.tcv({
|
|
|
130
131
|
class: {
|
|
131
132
|
tab: "text-white/50"
|
|
132
133
|
}
|
|
134
|
+
},
|
|
135
|
+
// Accent
|
|
136
|
+
{
|
|
137
|
+
variant: "accent",
|
|
138
|
+
active: false,
|
|
139
|
+
class: {
|
|
140
|
+
tab: "text-default-foreground"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
variant: "accent",
|
|
145
|
+
active: true,
|
|
146
|
+
class: {
|
|
147
|
+
tab: "bg-selected-background text-accent-foreground"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
variant: "accent",
|
|
152
|
+
disabled: false,
|
|
153
|
+
active: false,
|
|
154
|
+
class: {
|
|
155
|
+
tab: "hover:bg-secondary-background"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
variant: "accent",
|
|
160
|
+
disabled: true,
|
|
161
|
+
class: {
|
|
162
|
+
tab: "text-secondary-foreground"
|
|
163
|
+
}
|
|
133
164
|
}
|
|
134
165
|
],
|
|
135
166
|
defaultVariants: {
|
|
@@ -140,6 +171,7 @@ var tabsTv = tcx.tcv({
|
|
|
140
171
|
});
|
|
141
172
|
var TabItem = React.memo(
|
|
142
173
|
React.forwardRef(function TabItem2({
|
|
174
|
+
as = "button",
|
|
143
175
|
children,
|
|
144
176
|
value,
|
|
145
177
|
disabled,
|
|
@@ -185,8 +217,9 @@ var TabItem = React.memo(
|
|
|
185
217
|
onKeyDown(e);
|
|
186
218
|
}
|
|
187
219
|
});
|
|
220
|
+
const As = as ?? "button";
|
|
188
221
|
return /* @__PURE__ */ require$$0.jsx(
|
|
189
|
-
|
|
222
|
+
As,
|
|
190
223
|
{
|
|
191
224
|
ref,
|
|
192
225
|
role: "tab",
|
|
@@ -219,6 +252,7 @@ var TabItem = React.memo(
|
|
|
219
252
|
TabItem.displayName = "TabItem";
|
|
220
253
|
var TabsRoot = React.forwardRef(function Tabs(props, ref) {
|
|
221
254
|
const {
|
|
255
|
+
as = "div",
|
|
222
256
|
value: valueProp,
|
|
223
257
|
onChange,
|
|
224
258
|
className,
|
|
@@ -234,6 +268,8 @@ var TabsRoot = React.forwardRef(function Tabs(props, ref) {
|
|
|
234
268
|
if (readOnly) return;
|
|
235
269
|
onChange == null ? void 0 : onChange(newValue);
|
|
236
270
|
});
|
|
271
|
+
const As = as ?? "div";
|
|
272
|
+
const divProps = As === "div" ? { role: "tablist" } : {};
|
|
237
273
|
const tv = tabsTv({ variant });
|
|
238
274
|
return /* @__PURE__ */ require$$0.jsx(
|
|
239
275
|
TabsContext.Provider,
|
|
@@ -247,14 +283,14 @@ var TabsRoot = React.forwardRef(function Tabs(props, ref) {
|
|
|
247
283
|
id
|
|
248
284
|
},
|
|
249
285
|
children: /* @__PURE__ */ require$$0.jsx(
|
|
250
|
-
|
|
286
|
+
As,
|
|
251
287
|
{
|
|
252
288
|
ref,
|
|
253
|
-
role: "tablist",
|
|
254
289
|
"aria-orientation": "horizontal",
|
|
255
290
|
"aria-disabled": disabled,
|
|
256
291
|
"aria-label": ariaLabel || "Tabs",
|
|
257
292
|
className: tcx.tcx(tv.root(), className),
|
|
293
|
+
...divProps,
|
|
258
294
|
...rest,
|
|
259
295
|
children
|
|
260
296
|
}
|
|
@@ -267,4 +303,3 @@ var Tabs2 = TabsRoot;
|
|
|
267
303
|
Tabs2.Item = TabItem;
|
|
268
304
|
exports.TabItem = TabItem;
|
|
269
305
|
exports.Tabs = Tabs2;
|
|
270
|
-
exports.useTabsContext = useTabsContext;
|
|
@@ -2,110 +2,23 @@ import { HTMLProps } from 'react';
|
|
|
2
2
|
import { TooltipProps } from '@choice-ui/tooltip';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Root
|
|
7
|
-
* Main button component properties
|
|
8
|
-
*/
|
|
9
5
|
interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
|
|
10
|
-
/**
|
|
11
|
-
* Whether the button is in an active/pressed state
|
|
12
|
-
*
|
|
13
|
-
* @default false
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <Button active>Active Button</Button>
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
6
|
active?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Render as a custom element instead of button
|
|
22
|
-
*
|
|
23
|
-
* @default false
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* <Button asChild>
|
|
27
|
-
* <Link href="/profile">Profile</Link>
|
|
28
|
-
* </Button>
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
7
|
asChild?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Additional CSS class names
|
|
34
|
-
*/
|
|
35
8
|
className?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the button appears focused (for keyboard navigation)
|
|
38
|
-
*
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
9
|
focused?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Whether the button is in loading state with spinner
|
|
44
|
-
*
|
|
45
|
-
* @default false
|
|
46
|
-
* @example
|
|
47
|
-
* ```tsx
|
|
48
|
-
* <Button loading>Saving...</Button>
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
10
|
loading?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Whether the button is in readOnly state
|
|
54
|
-
* In readOnly mode, the button will not respond to click events
|
|
55
|
-
*
|
|
56
|
-
* @default false
|
|
57
|
-
* @example
|
|
58
|
-
* ```tsx
|
|
59
|
-
* <Button readOnly>Read Only Button</Button>
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
11
|
readOnly?: boolean;
|
|
63
12
|
/**
|
|
64
|
-
* Button size variant
|
|
65
|
-
*
|
|
66
13
|
* @default "default"
|
|
67
|
-
* @example
|
|
68
|
-
* ```tsx
|
|
69
|
-
* <Button size="large">Large Button</Button>
|
|
70
|
-
* ```
|
|
71
14
|
*/
|
|
72
15
|
size?: "default" | "large";
|
|
73
|
-
/**
|
|
74
|
-
* Tooltip configuration for the button
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```tsx
|
|
78
|
-
* <Button tooltip={{ content: "Save your changes", placement: "top" }}>
|
|
79
|
-
* Save
|
|
80
|
-
* </Button>
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
16
|
tooltip?: TooltipProps;
|
|
84
17
|
/**
|
|
85
|
-
* Visual style variant of the button
|
|
86
|
-
*
|
|
87
18
|
* @default "primary"
|
|
88
|
-
* @example
|
|
89
|
-
* ```tsx
|
|
90
|
-
* <Button variant="primary">Primary Action</Button>
|
|
91
|
-
* <Button variant="destructive">Delete</Button>
|
|
92
|
-
* <Button variant="ghost">Subtle Action</Button>
|
|
93
|
-
* ```
|
|
94
19
|
*/
|
|
95
20
|
variant?: "primary" | "secondary" | "solid" | "destructive" | "secondary-destruct" | "inverse" | "success" | "link" | "link-danger" | "ghost" | "dark" | "reset";
|
|
96
21
|
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Button component for user interactions
|
|
100
|
-
*
|
|
101
|
-
* @displayName Button
|
|
102
|
-
* @description A versatile button component that supports various styles, states, and behaviors. Renders as a button element or can be used with asChild for custom elements.
|
|
103
|
-
* @category Actions
|
|
104
|
-
* @status stable
|
|
105
|
-
* @version 1.0.0
|
|
106
|
-
* @since 1.0.0
|
|
107
|
-
* @see {@link https://design-system.choiceform.io/components/button Button Documentation}
|
|
108
|
-
*/
|
|
109
22
|
declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
110
23
|
|
|
111
24
|
export { Button, type ButtonProps };
|
|
@@ -16,7 +16,7 @@ interface ChipProps extends Omit<HTMLProps<HTMLDivElement>, "size" | "as"> {
|
|
|
16
16
|
remove: string;
|
|
17
17
|
};
|
|
18
18
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
19
|
-
onRemove?: (e: React.MouseEvent<
|
|
19
|
+
onRemove?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
20
20
|
prefixElement?: ReactNode;
|
|
21
21
|
selected?: boolean;
|
|
22
22
|
size?: "default" | "medium";
|
|
@@ -17,6 +17,7 @@ interface CodeBlockContextValue {
|
|
|
17
17
|
lineThreshold: number;
|
|
18
18
|
needsScroll: boolean;
|
|
19
19
|
scrollRef?: RefObject<HTMLDivElement>;
|
|
20
|
+
variant?: "default" | "light" | "dark";
|
|
20
21
|
}
|
|
21
22
|
interface CodeBlockInjectedProps {
|
|
22
23
|
codeBlock?: CodeBlockContextValue;
|
|
@@ -32,6 +33,7 @@ interface CodeBlockProps {
|
|
|
32
33
|
lineThreshold?: number;
|
|
33
34
|
onCodeExpandChange?: (expanded: boolean) => void;
|
|
34
35
|
onExpandChange?: (expanded: boolean) => void;
|
|
36
|
+
variant?: "default" | "light" | "dark";
|
|
35
37
|
}
|
|
36
38
|
interface CodeBlockHeaderProps extends CodeBlockInjectedProps {
|
|
37
39
|
children?: ReactNode;
|
|
@@ -56,8 +58,12 @@ interface CodeBlockContentProps extends CodeBlockInjectedProps {
|
|
|
56
58
|
interface CodeBlockCodeProps extends HTMLProps<HTMLDivElement> {
|
|
57
59
|
className?: string;
|
|
58
60
|
code: string;
|
|
61
|
+
/** 从 CodeBlock 传递的 context */
|
|
62
|
+
codeBlock?: CodeBlockContextValue;
|
|
59
63
|
codeBlockId?: string;
|
|
60
64
|
language?: string;
|
|
65
|
+
/** 手动指定主题,覆盖自动检测 */
|
|
66
|
+
variant?: "light" | "dark";
|
|
61
67
|
}
|
|
62
68
|
interface UseCodeBlockOptions {
|
|
63
69
|
defaultCodeExpanded?: boolean;
|
|
@@ -124,7 +124,7 @@ declare const Command: react.ForwardRefExoticComponent<CommandProps & react.RefA
|
|
|
124
124
|
Divider: react.ForwardRefExoticComponent<Omit<CommandDividerProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
125
125
|
Value: react.ForwardRefExoticComponent<Omit<react.HTMLProps<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
126
126
|
Tabs: react.ForwardRefExoticComponent<Omit<_choice_ui_tabs.TabsProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
127
|
-
TabItem: react.MemoExoticComponent<react.ForwardRefExoticComponent<_choice_ui_tabs.TabItemProps & react.RefAttributes<
|
|
127
|
+
TabItem: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<_choice_ui_tabs.TabItemProps, "ref"> & react.RefAttributes<HTMLElement>>>;
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
export { Command, Command$1 as CommandRoot, defaultFilter, useCommandState };
|
|
@@ -2,8 +2,9 @@ import { HTMLProps } from 'react';
|
|
|
2
2
|
import { TooltipProps } from '@choice-ui/tooltip';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
|
-
interface IconButtonProps extends Omit<HTMLProps<
|
|
5
|
+
interface IconButtonProps extends Omit<HTMLProps<HTMLElement>, "size" | "as"> {
|
|
6
6
|
active?: boolean;
|
|
7
|
+
as?: React.ElementType;
|
|
7
8
|
asChild?: boolean;
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
className?: string;
|
|
@@ -15,7 +16,7 @@ interface IconButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
|
|
|
15
16
|
tooltip?: TooltipProps;
|
|
16
17
|
variant?: "default" | "secondary" | "solid" | "highlight" | "ghost" | "dark" | "reset";
|
|
17
18
|
}
|
|
18
|
-
declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & react.RefAttributes<
|
|
19
|
+
declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & react.RefAttributes<HTMLElement>>;
|
|
19
20
|
|
|
20
21
|
interface IconButtonGroupProps extends HTMLProps<HTMLDivElement> {
|
|
21
22
|
children: React.ReactNode;
|
|
@@ -23,4 +24,4 @@ interface IconButtonGroupProps extends HTMLProps<HTMLDivElement> {
|
|
|
23
24
|
}
|
|
24
25
|
declare const IconButtonGroup: react.ForwardRefExoticComponent<Omit<IconButtonGroupProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
25
26
|
|
|
26
|
-
export { IconButton, IconButtonGroup, type IconButtonProps };
|
|
27
|
+
export { IconButton, IconButtonGroup, type IconButtonGroupProps, type IconButtonProps };
|
|
@@ -14,4 +14,4 @@ type LinkButtonProps = BaseLinkButtonProps & ((React.AnchorHTMLAttributes<HTMLAn
|
|
|
14
14
|
}));
|
|
15
15
|
declare const LinkButton: react.ForwardRefExoticComponent<LinkButtonProps & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
16
16
|
|
|
17
|
-
export { LinkButton };
|
|
17
|
+
export { LinkButton, type LinkButtonProps };
|
|
@@ -2,7 +2,6 @@ import { ReactNode, HTMLProps } from 'react';
|
|
|
2
2
|
import { MenuValue } from '@choice-ui/menus';
|
|
3
3
|
import { KbdKey } from '@choice-ui/kbd';
|
|
4
4
|
import * as react from 'react';
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
6
|
interface ListContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
8
7
|
children: React.ReactNode;
|
|
@@ -73,57 +72,6 @@ interface ListComponentProps extends React.ForwardRefExoticComponent<ListProps &
|
|
|
73
72
|
SubTrigger: typeof ListSubTrigger;
|
|
74
73
|
Value: typeof MenuValue;
|
|
75
74
|
}
|
|
76
|
-
declare const ListBase: react.ForwardRefExoticComponent<Omit<ListProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
77
75
|
declare const List: ListComponentProps;
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
activeItem: string | null;
|
|
81
|
-
setActiveItem: (id: string | null) => void;
|
|
82
|
-
}
|
|
83
|
-
declare const ActiveItemContext: react.Context<ActiveItemContextValue | undefined>;
|
|
84
|
-
declare function useActiveItemContext(): ActiveItemContextValue;
|
|
85
|
-
interface ExpandContextValue {
|
|
86
|
-
expandedSubLists: Set<string>;
|
|
87
|
-
isSubListExpanded: (id: string) => boolean;
|
|
88
|
-
toggleSubList: (id: string) => void;
|
|
89
|
-
}
|
|
90
|
-
declare const ExpandContext: react.Context<ExpandContextValue | undefined>;
|
|
91
|
-
declare function useExpandContext(): ExpandContextValue;
|
|
92
|
-
interface SelectionContextValue {
|
|
93
|
-
isSelected: (id: string) => boolean;
|
|
94
|
-
selectedItems: Set<string>;
|
|
95
|
-
selection?: boolean;
|
|
96
|
-
toggleSelection: (id: string) => void;
|
|
97
|
-
}
|
|
98
|
-
declare const SelectionContext: react.Context<SelectionContextValue | undefined>;
|
|
99
|
-
declare function useSelectionContext(): SelectionContextValue;
|
|
100
|
-
interface StructureContextValue {
|
|
101
|
-
interactive?: boolean;
|
|
102
|
-
itemsMap: Map<string, {
|
|
103
|
-
parentId?: string;
|
|
104
|
-
}>;
|
|
105
|
-
registerItem: (id: string, parentId?: string) => void;
|
|
106
|
-
shouldShowReferenceLine?: boolean;
|
|
107
|
-
size?: "default" | "large";
|
|
108
|
-
unregisterItem: (id: string) => void;
|
|
109
|
-
variant?: "default" | "primary";
|
|
110
|
-
}
|
|
111
|
-
declare const StructureContext: react.Context<StructureContextValue | undefined>;
|
|
112
|
-
declare function useStructureContext(): StructureContextValue;
|
|
113
|
-
interface LevelContextValue {
|
|
114
|
-
level: number;
|
|
115
|
-
}
|
|
116
|
-
declare const LevelContext: react.Context<LevelContextValue>;
|
|
117
|
-
declare function useLevelContext(): LevelContextValue;
|
|
118
|
-
|
|
119
|
-
interface ListProviderProps {
|
|
120
|
-
children: ReactNode;
|
|
121
|
-
interactive?: boolean;
|
|
122
|
-
selection?: boolean;
|
|
123
|
-
shouldShowReferenceLine?: boolean;
|
|
124
|
-
size?: "default" | "large";
|
|
125
|
-
variant?: "default" | "primary";
|
|
126
|
-
}
|
|
127
|
-
declare function ListProvider({ children, interactive, shouldShowReferenceLine, selection, variant, size, }: ListProviderProps): react_jsx_runtime.JSX.Element;
|
|
128
|
-
|
|
129
|
-
export { ActiveItemContext, ExpandContext, LevelContext, List, ListBase, ListContent, ListDivider, ListItem, type ListItemProps, ListLabel, ListProvider, ListSubTrigger, type ListSubTriggerProps, SelectionContext, StructureContext, useActiveItemContext, useExpandContext, useLevelContext, useSelectionContext, useStructureContext };
|
|
77
|
+
export { List, type ListContentProps, type ListItemProps, type ListProps, type ListSubTriggerProps };
|