@choice-ui/react 1.6.7 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/code-block/dist/index.d.ts +11 -14
- package/dist/components/code-block/dist/index.js +120 -93
- package/dist/components/code-block/src/code-block.d.ts +1 -2
- package/dist/components/code-block/src/code-block.js +11 -21
- package/dist/components/code-block/src/components/code-block-code.js +25 -13
- package/dist/components/code-block/src/components/code-block-content.d.ts +1 -1
- package/dist/components/code-block/src/components/code-block-content.js +14 -11
- package/dist/components/code-block/src/components/code-block-footer.js +4 -3
- package/dist/components/code-block/src/components/code-block-header.js +5 -6
- package/dist/components/code-block/src/hooks/index.d.ts +0 -1
- package/dist/components/code-block/src/hooks/use-code-block.js +26 -5
- package/dist/components/code-block/src/hooks/use-scroll-detection.d.ts +1 -2
- package/dist/components/code-block/src/hooks/use-scroll-detection.js +18 -12
- package/dist/components/code-block/src/types.d.ts +3 -5
- package/dist/components/code-block/src/utils/extract-code.js +23 -0
- package/dist/components/command/src/components/command-list.js +15 -3
- package/dist/components/description/dist/index.d.ts +8 -0
- package/dist/components/description/dist/index.js +29 -0
- package/dist/components/description/src/description.d.ts +6 -0
- package/dist/components/description/src/description.js +18 -0
- package/dist/components/description/src/index.d.ts +2 -0
- package/dist/components/description/src/tv.d.ts +13 -0
- package/dist/components/description/src/tv.js +15 -0
- package/dist/components/description/tsup.config.d.ts +2 -0
- package/dist/components/emoji-picker/dist/index.d.ts +1 -0
- package/dist/components/emoji-picker/dist/index.js +4 -2
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -0
- package/dist/components/emoji-picker/src/emoji-picker.js +4 -2
- package/dist/components/error-message/dist/index.d.ts +8 -0
- package/dist/components/error-message/dist/index.js +30 -0
- package/dist/components/error-message/src/error-message.d.ts +6 -0
- package/dist/components/error-message/src/error-message.js +19 -0
- package/dist/components/error-message/src/index.d.ts +2 -0
- package/dist/components/error-message/src/tv.d.ts +13 -0
- package/dist/components/error-message/src/tv.js +15 -0
- package/dist/components/error-message/tsup.config.d.ts +2 -0
- package/dist/components/form/src/adapters/base-adapter.js +4 -2
- package/dist/components/form/src/tv.d.ts +0 -12
- package/dist/components/form/src/tv.js +1 -13
- package/dist/components/index.d.ts +3 -0
- package/dist/components/md-render/dist/index.d.ts +2 -1
- package/dist/components/md-render/dist/index.js +5 -9
- package/dist/components/md-render/src/components/markdown-components.js +1 -7
- package/dist/components/md-render/src/md-render.js +4 -2
- package/dist/components/md-render/src/types.d.ts +2 -1
- package/dist/components/notifications/dist/index.d.ts +1 -5
- package/dist/components/notifications/src/notifications.d.ts +0 -1
- package/dist/components/notifications/src/notifications.js +0 -1
- package/dist/components/numeric-input/dist/index.d.ts +23 -9
- package/dist/components/numeric-input/dist/index.js +26 -3
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +4 -1
- package/dist/components/numeric-input/src/hooks/index.d.ts +1 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.d.ts +13 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.js +27 -0
- package/dist/components/numeric-input/src/index.d.ts +1 -0
- package/dist/components/numeric-input/src/tv.js +22 -2
- package/dist/components/picture-preview/dist/index.d.ts +5 -0
- package/dist/components/picture-preview/dist/index.js +287 -140
- package/dist/components/picture-preview/src/hooks/useWheelHandler.d.ts +6 -1
- package/dist/components/picture-preview/src/hooks/useWheelHandler.js +25 -7
- package/dist/components/picture-preview/src/picture-preview.d.ts +5 -0
- package/dist/components/picture-preview/src/picture-preview.js +214 -123
- package/dist/components/picture-preview/src/tv.d.ts +93 -3
- package/dist/components/picture-preview/src/tv.js +48 -10
- package/dist/components/separator/dist/index.d.ts +1 -8
- package/dist/components/separator/src/separator.d.ts +1 -8
- package/dist/components/separator/src/separator.js +33 -5
- package/dist/components/separator/src/tv.d.ts +39 -18
- package/dist/components/separator/src/tv.js +37 -7
- package/dist/components/text-field/dist/index.d.ts +2 -3
- package/dist/components/text-field/dist/index.js +4 -19
- package/dist/components/text-field/src/components/index.d.ts +0 -1
- package/dist/components/text-field/src/text-field.d.ts +3 -2
- package/dist/components/text-field/src/text-field.js +2 -2
- package/dist/components/text-field/src/tv.d.ts +3 -3
- package/dist/components/text-field/src/tv.js +1 -6
- package/dist/components/toast/dist/index.d.ts +248 -0
- package/dist/components/toast/src/components/index.d.ts +3 -0
- package/dist/components/toast/src/components/toast-progress-bar.d.ts +7 -0
- package/dist/components/toast/src/components/toast-progress-bar.js +53 -0
- package/dist/components/toast/src/components/toaster-item.d.ts +26 -0
- package/dist/components/toast/src/components/toaster-item.js +416 -0
- package/dist/components/toast/src/components/toaster-slots.d.ts +87 -0
- package/dist/components/toast/src/components/toaster-slots.js +38 -0
- package/dist/components/toast/src/index.d.ts +5 -0
- package/dist/components/toast/src/store.d.ts +101 -0
- package/dist/components/toast/src/store.js +205 -0
- package/dist/components/toast/src/toaster.d.ts +87 -0
- package/dist/components/toast/src/toaster.js +271 -0
- package/dist/components/toast/src/tv.d.ts +365 -0
- package/dist/components/toast/src/tv.js +412 -0
- package/dist/components/toast/src/types.d.ts +79 -0
- package/dist/components/toast/tsup.config.d.ts +2 -0
- package/dist/index.js +11 -2
- package/dist/styles/components.css +2 -0
- package/package.json +1 -1
- package/dist/components/code-block/src/hooks/use-line-count.d.ts +0 -2
- package/dist/components/code-block/src/hooks/use-line-count.js +0 -27
- package/dist/components/text-field/src/components/field-description.d.ts +0 -2
- package/dist/components/text-field/src/components/field-description.js +0 -16
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ScrollArea } from "../../../scroll-area/dist/index.js";
|
|
3
|
+
import { memo } from "react";
|
|
3
4
|
import { CodeBlockCode } from "./code-block-code.js";
|
|
4
5
|
import { tcv, tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
6
|
+
const LINE_HEIGHT_PX = 16;
|
|
7
|
+
const HEIGHT_PADDING_PX = 32 + 40;
|
|
5
8
|
const codeBlockTv = tcv({
|
|
6
9
|
slots: {
|
|
7
|
-
code: "overflow-hidden",
|
|
10
|
+
code: "overflow-hidden min-h-0 flex-1",
|
|
8
11
|
content: "flex w-fit flex-col overflow-clip p-[inherit]"
|
|
9
12
|
}
|
|
10
13
|
});
|
|
11
|
-
|
|
12
|
-
const {
|
|
14
|
+
const CodeBlockContent = memo(function CodeBlockContent2(props) {
|
|
15
|
+
const { className, codeBlock, withScrollArea = true, children } = props;
|
|
13
16
|
if (!codeBlock) return null;
|
|
14
17
|
const { language, isExpanded, codeExpanded, scrollRef, contentRef, lineCount, lineThreshold } = codeBlock;
|
|
15
18
|
if (!isExpanded) {
|
|
16
19
|
return null;
|
|
17
20
|
}
|
|
18
|
-
if (typeof
|
|
21
|
+
if (typeof children !== "string") {
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
21
24
|
const tv = codeBlockTv();
|
|
22
|
-
const shouldLimitHeight = lineCount > lineThreshold && !codeExpanded;
|
|
25
|
+
const shouldLimitHeight = lineThreshold && lineCount > lineThreshold && !codeExpanded;
|
|
23
26
|
return /* @__PURE__ */ jsx(Fragment, { children: withScrollArea ? /* @__PURE__ */ jsx(
|
|
24
27
|
ScrollArea,
|
|
25
28
|
{
|
|
@@ -32,7 +35,7 @@ function CodeBlockContent(props) {
|
|
|
32
35
|
{
|
|
33
36
|
ref: scrollRef,
|
|
34
37
|
style: {
|
|
35
|
-
maxHeight: shouldLimitHeight ? `${lineThreshold *
|
|
38
|
+
maxHeight: shouldLimitHeight ? `${lineThreshold * LINE_HEIGHT_PX + HEIGHT_PADDING_PX}px` : "none"
|
|
36
39
|
},
|
|
37
40
|
children: /* @__PURE__ */ jsx(
|
|
38
41
|
ScrollArea.Content,
|
|
@@ -42,9 +45,9 @@ function CodeBlockContent(props) {
|
|
|
42
45
|
children: /* @__PURE__ */ jsx(
|
|
43
46
|
CodeBlockCode,
|
|
44
47
|
{
|
|
45
|
-
code,
|
|
46
48
|
language,
|
|
47
|
-
codeBlock
|
|
49
|
+
codeBlock,
|
|
50
|
+
children
|
|
48
51
|
}
|
|
49
52
|
)
|
|
50
53
|
}
|
|
@@ -55,12 +58,12 @@ function CodeBlockContent(props) {
|
|
|
55
58
|
) : /* @__PURE__ */ jsx("div", { className: tcx(tv.content(), className), children: /* @__PURE__ */ jsx(
|
|
56
59
|
CodeBlockCode,
|
|
57
60
|
{
|
|
58
|
-
code,
|
|
59
61
|
language,
|
|
60
|
-
codeBlock
|
|
62
|
+
codeBlock,
|
|
63
|
+
children
|
|
61
64
|
}
|
|
62
65
|
) }) });
|
|
63
|
-
}
|
|
66
|
+
});
|
|
64
67
|
export {
|
|
65
68
|
CodeBlockContent
|
|
66
69
|
};
|
|
@@ -15,9 +15,10 @@ const codeBlockFooterTv = tcv({
|
|
|
15
15
|
},
|
|
16
16
|
false: {
|
|
17
17
|
footer: [
|
|
18
|
-
"bg-secondary-background/
|
|
18
|
+
"bg-secondary-background/80 absolute inset-x-0 bottom-0 z-3",
|
|
19
19
|
"opacity-0 group-hover:opacity-100",
|
|
20
|
-
"hover:bg-tertiary-background"
|
|
20
|
+
"hover:bg-tertiary-background",
|
|
21
|
+
"backdrop-blur-xs"
|
|
21
22
|
]
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -31,7 +32,7 @@ const CodeBlockFooter = memo(function CodeBlockFooter2(props) {
|
|
|
31
32
|
if (!codeBlock) return null;
|
|
32
33
|
const { isExpanded, codeExpanded, handleCodeExpand, lineCount, lineThreshold, needsScroll } = codeBlock;
|
|
33
34
|
const tv = codeBlockFooterTv({ codeExpanded });
|
|
34
|
-
if (!(lineCount > lineThreshold || needsScroll || codeExpanded) || !isExpanded) {
|
|
35
|
+
if (lineThreshold && !(lineCount > lineThreshold || needsScroll || codeExpanded) || !isExpanded) {
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
38
|
return /* @__PURE__ */ jsx(
|
|
@@ -83,9 +83,8 @@ const CodeBlockHeader = memo(function CodeBlockHeader2(props) {
|
|
|
83
83
|
handleCopy,
|
|
84
84
|
variant
|
|
85
85
|
} = codeBlock;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
86
|
+
const canExpand = Boolean(handleExpand);
|
|
87
|
+
const canCopy = Boolean(handleCopy);
|
|
89
88
|
const tv = codeBlockHeaderTv({ isExpanded, variant });
|
|
90
89
|
let icon = null;
|
|
91
90
|
try {
|
|
@@ -109,17 +108,17 @@ const CodeBlockHeader = memo(function CodeBlockHeader2(props) {
|
|
|
109
108
|
children
|
|
110
109
|
] }),
|
|
111
110
|
/* @__PURE__ */ jsxs("div", { className: tv.actions(), children: [
|
|
112
|
-
isExpanded && /* @__PURE__ */ jsx(
|
|
111
|
+
isExpanded && canCopy && /* @__PURE__ */ jsx(
|
|
113
112
|
IconButton,
|
|
114
113
|
{
|
|
115
114
|
className: tv.button(),
|
|
116
115
|
variant: variant === "dark" ? "dark" : "ghost",
|
|
117
|
-
onClick: () => handleCopy(),
|
|
116
|
+
onClick: () => handleCopy == null ? void 0 : handleCopy(),
|
|
118
117
|
tooltip: { content: copyTooltipContent },
|
|
119
118
|
children: copied ? /* @__PURE__ */ jsx(Check, { className: "text-success-foreground" }) : /* @__PURE__ */ jsx(ClipboardSmall, {})
|
|
120
119
|
}
|
|
121
120
|
),
|
|
122
|
-
expandable && /* @__PURE__ */ jsx(
|
|
121
|
+
expandable && canExpand && /* @__PURE__ */ jsx(
|
|
123
122
|
IconButton,
|
|
124
123
|
{
|
|
125
124
|
className: tv.button(),
|
|
@@ -27,13 +27,34 @@ function useCodeBlock({
|
|
|
27
27
|
if (!code || typeof code !== "string") {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const onSuccess = () => {
|
|
31
|
+
setCopied(true);
|
|
32
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
33
|
+
};
|
|
34
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
35
|
+
try {
|
|
32
36
|
await navigator.clipboard.writeText(code);
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
onSuccess();
|
|
38
|
+
return;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const textArea = document.createElement("textarea");
|
|
43
|
+
try {
|
|
44
|
+
textArea.value = code;
|
|
45
|
+
textArea.style.cssText = "position:fixed;top:0;left:0;width:2em;height:2em;padding:0;border:none;outline:none;box-shadow:none;background:transparent;";
|
|
46
|
+
document.body.appendChild(textArea);
|
|
47
|
+
textArea.focus();
|
|
48
|
+
textArea.select();
|
|
49
|
+
const successful = document.execCommand("copy");
|
|
50
|
+
if (successful) {
|
|
51
|
+
onSuccess();
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
} finally {
|
|
55
|
+
if (textArea.parentNode) {
|
|
56
|
+
textArea.parentNode.removeChild(textArea);
|
|
35
57
|
}
|
|
36
|
-
} catch (error) {
|
|
37
58
|
}
|
|
38
59
|
});
|
|
39
60
|
return {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
interface UseScrollDetectionProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
3
|
codeExpanded: boolean;
|
|
5
4
|
contentRef: RefObject<HTMLElement>;
|
|
6
5
|
isExpanded: boolean;
|
|
7
6
|
scrollRef: RefObject<HTMLElement>;
|
|
8
7
|
}
|
|
9
|
-
export declare function useScrollDetection({ scrollRef, contentRef, isExpanded, codeExpanded,
|
|
8
|
+
export declare function useScrollDetection({ scrollRef, contentRef, isExpanded, codeExpanded, }: UseScrollDetectionProps): boolean;
|
|
10
9
|
export {};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
1
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
2
2
|
function useScrollDetection({
|
|
3
3
|
scrollRef,
|
|
4
4
|
contentRef,
|
|
5
5
|
isExpanded,
|
|
6
|
-
codeExpanded
|
|
7
|
-
children
|
|
6
|
+
codeExpanded
|
|
8
7
|
}) {
|
|
9
8
|
const [needsScroll, setNeedsScroll] = useState(false);
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const debounceRef = useRef(null);
|
|
10
|
+
const checkScrollNeeded = useCallback(() => {
|
|
11
|
+
if (debounceRef.current) {
|
|
12
|
+
clearTimeout(debounceRef.current);
|
|
13
|
+
}
|
|
14
|
+
debounceRef.current = setTimeout(() => {
|
|
12
15
|
if (!scrollRef.current || !contentRef.current) {
|
|
13
16
|
setNeedsScroll(false);
|
|
14
17
|
return;
|
|
@@ -18,25 +21,28 @@ function useScrollDetection({
|
|
|
18
21
|
const content = contentRef.current;
|
|
19
22
|
const hasScroll = content.scrollHeight > viewport.clientHeight;
|
|
20
23
|
setNeedsScroll(hasScroll);
|
|
21
|
-
} catch
|
|
24
|
+
} catch {
|
|
22
25
|
setNeedsScroll(false);
|
|
23
26
|
}
|
|
24
|
-
};
|
|
27
|
+
}, 50);
|
|
28
|
+
}, [scrollRef, contentRef]);
|
|
29
|
+
useEffect(() => {
|
|
25
30
|
const timeoutId = setTimeout(checkScrollNeeded, 100);
|
|
26
31
|
window.addEventListener("resize", checkScrollNeeded);
|
|
27
32
|
let resizeObserver = null;
|
|
28
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
33
|
+
if (typeof ResizeObserver !== "undefined" && contentRef.current) {
|
|
29
34
|
resizeObserver = new ResizeObserver(checkScrollNeeded);
|
|
30
|
-
|
|
31
|
-
resizeObserver.observe(contentRef.current);
|
|
32
|
-
}
|
|
35
|
+
resizeObserver.observe(contentRef.current);
|
|
33
36
|
}
|
|
34
37
|
return () => {
|
|
35
38
|
clearTimeout(timeoutId);
|
|
39
|
+
if (debounceRef.current) {
|
|
40
|
+
clearTimeout(debounceRef.current);
|
|
41
|
+
}
|
|
36
42
|
window.removeEventListener("resize", checkScrollNeeded);
|
|
37
43
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
38
44
|
};
|
|
39
|
-
}, [
|
|
45
|
+
}, [checkScrollNeeded, isExpanded, codeExpanded]);
|
|
40
46
|
return needsScroll;
|
|
41
47
|
}
|
|
42
48
|
export {
|
|
@@ -11,7 +11,7 @@ export interface CodeBlockContextValue {
|
|
|
11
11
|
isExpanded: boolean;
|
|
12
12
|
language: string;
|
|
13
13
|
lineCount: number;
|
|
14
|
-
lineThreshold
|
|
14
|
+
lineThreshold?: number;
|
|
15
15
|
needsScroll: boolean;
|
|
16
16
|
scrollRef?: RefObject<HTMLDivElement>;
|
|
17
17
|
variant?: "default" | "light" | "dark";
|
|
@@ -48,18 +48,16 @@ export interface CodeBlockFooterProps extends CodeBlockInjectedProps {
|
|
|
48
48
|
}
|
|
49
49
|
export interface CodeBlockContentProps extends CodeBlockInjectedProps {
|
|
50
50
|
className?: string;
|
|
51
|
-
code: string;
|
|
52
51
|
language?: string;
|
|
53
52
|
withScrollArea?: boolean;
|
|
53
|
+
children?: string;
|
|
54
54
|
}
|
|
55
55
|
export interface CodeBlockCodeProps extends HTMLProps<HTMLDivElement> {
|
|
56
56
|
className?: string;
|
|
57
|
-
|
|
58
|
-
/** 从 CodeBlock 传递的 context */
|
|
57
|
+
children?: string;
|
|
59
58
|
codeBlock?: CodeBlockContextValue;
|
|
60
59
|
codeBlockId?: string;
|
|
61
60
|
language?: string;
|
|
62
|
-
/** 手动指定主题,覆盖自动检测 */
|
|
63
61
|
variant?: "light" | "dark";
|
|
64
62
|
}
|
|
65
63
|
export interface UseCodeBlockOptions {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
function extractCodeFromChildren(children) {
|
|
3
|
+
if (!children) return "";
|
|
4
|
+
try {
|
|
5
|
+
return React__default.Children.toArray(children).map((child) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if (React__default.isValidElement(child)) {
|
|
8
|
+
if (((_a = child.props) == null ? void 0 : _a.code) && typeof child.props.code === "string") {
|
|
9
|
+
return child.props.code;
|
|
10
|
+
}
|
|
11
|
+
if (((_b = child.props) == null ? void 0 : _b.children) && typeof child.props.children === "string") {
|
|
12
|
+
return child.props.children;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return "";
|
|
16
|
+
}).filter(Boolean).join("");
|
|
17
|
+
} catch {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
extractCodeFromChildren
|
|
23
|
+
};
|
|
@@ -6,7 +6,17 @@ import { useCommandState } from "../hooks/use-command-state.js";
|
|
|
6
6
|
import { useCommand } from "../hooks/use-command.js";
|
|
7
7
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
8
8
|
const CommandList = forwardRef((props, forwardedRef) => {
|
|
9
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
label = "Suggestions",
|
|
13
|
+
hoverBoundary = "none",
|
|
14
|
+
scrollbarMode = "padding-b",
|
|
15
|
+
orientation,
|
|
16
|
+
variant,
|
|
17
|
+
type,
|
|
18
|
+
...rest
|
|
19
|
+
} = props;
|
|
10
20
|
const ref = useRef(null);
|
|
11
21
|
const height = useRef(null);
|
|
12
22
|
const selectedItemId = useCommandState((state) => state.selectedItemId);
|
|
@@ -33,9 +43,11 @@ const CommandList = forwardRef((props, forwardedRef) => {
|
|
|
33
43
|
return /* @__PURE__ */ jsx(
|
|
34
44
|
ScrollArea,
|
|
35
45
|
{
|
|
36
|
-
variant: context.variant,
|
|
46
|
+
variant: variant ?? context.variant,
|
|
37
47
|
hoverBoundary,
|
|
38
|
-
|
|
48
|
+
scrollbarMode,
|
|
49
|
+
orientation,
|
|
50
|
+
type,
|
|
39
51
|
children: /* @__PURE__ */ jsx(
|
|
40
52
|
ScrollArea.Viewport,
|
|
41
53
|
{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const Description: React.NamedExoticComponent<DescriptionProps>;
|
|
7
|
+
|
|
8
|
+
export { Description, type DescriptionProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
4
|
+
var descriptionTv = tcv({
|
|
5
|
+
base: "text-secondary-foreground px-0.5 break-words whitespace-pre-wrap",
|
|
6
|
+
variants: {
|
|
7
|
+
disabled: {
|
|
8
|
+
true: "text-disabled-foreground"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
disabled: false
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var Description = memo(function Description2(props) {
|
|
16
|
+
const { children, className, disabled, ...rest } = props;
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"p",
|
|
19
|
+
{
|
|
20
|
+
className: descriptionTv({ disabled, className }),
|
|
21
|
+
slot: "description",
|
|
22
|
+
...rest,
|
|
23
|
+
children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
Description
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { descriptionTv } from "./tv.js";
|
|
4
|
+
const Description = memo(function Description2(props) {
|
|
5
|
+
const { children, className, disabled, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"p",
|
|
8
|
+
{
|
|
9
|
+
className: descriptionTv({ disabled, className }),
|
|
10
|
+
slot: "description",
|
|
11
|
+
...rest,
|
|
12
|
+
children
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
Description
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const descriptionTv: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: string;
|
|
4
|
+
};
|
|
5
|
+
}, undefined, "text-secondary-foreground px-0.5 break-words whitespace-pre-wrap", {
|
|
6
|
+
disabled: {
|
|
7
|
+
true: string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
10
|
+
disabled: {
|
|
11
|
+
true: string;
|
|
12
|
+
};
|
|
13
|
+
}, undefined, "text-secondary-foreground px-0.5 break-words whitespace-pre-wrap", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const descriptionTv = tcv({
|
|
3
|
+
base: "text-secondary-foreground px-0.5 break-words whitespace-pre-wrap",
|
|
4
|
+
variants: {
|
|
5
|
+
disabled: {
|
|
6
|
+
true: "text-disabled-foreground"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
disabled: false
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
descriptionTv
|
|
15
|
+
};
|
|
@@ -12017,6 +12017,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12017
12017
|
showCategories = true,
|
|
12018
12018
|
showFrequentlyUsed = true,
|
|
12019
12019
|
showSearch = true,
|
|
12020
|
+
showFooter = true,
|
|
12020
12021
|
children,
|
|
12021
12022
|
variant = "dark"
|
|
12022
12023
|
}) {
|
|
@@ -12063,6 +12064,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12063
12064
|
onChange == null ? void 0 : onChange(emoji);
|
|
12064
12065
|
});
|
|
12065
12066
|
const handleEmojiHover = useEventCallback((emoji) => {
|
|
12067
|
+
if (!showFooter) return;
|
|
12066
12068
|
setHoveredEmoji(emoji);
|
|
12067
12069
|
});
|
|
12068
12070
|
const handleCategoryClick = useEventCallback((category) => {
|
|
@@ -12079,7 +12081,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12079
12081
|
className: tv.container({ className }),
|
|
12080
12082
|
style: rootStyle,
|
|
12081
12083
|
children: [
|
|
12082
|
-
/* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
|
|
12084
|
+
(showSearch || showCategories) && /* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
|
|
12083
12085
|
showSearch && /* @__PURE__ */ jsx(
|
|
12084
12086
|
SearchInput,
|
|
12085
12087
|
{
|
|
@@ -12181,7 +12183,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12181
12183
|
)
|
|
12182
12184
|
}
|
|
12183
12185
|
),
|
|
12184
|
-
/* @__PURE__ */ jsx(
|
|
12186
|
+
showFooter && /* @__PURE__ */ jsx(
|
|
12185
12187
|
EmojiFooter,
|
|
12186
12188
|
{
|
|
12187
12189
|
hoveredEmoji,
|
|
@@ -33,6 +33,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
33
33
|
showCategories = true,
|
|
34
34
|
showFrequentlyUsed = true,
|
|
35
35
|
showSearch = true,
|
|
36
|
+
showFooter = true,
|
|
36
37
|
children,
|
|
37
38
|
variant = "dark"
|
|
38
39
|
}) {
|
|
@@ -80,6 +81,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
80
81
|
onChange == null ? void 0 : onChange(emoji);
|
|
81
82
|
});
|
|
82
83
|
const handleEmojiHover = useEventCallback((emoji) => {
|
|
84
|
+
if (!showFooter) return;
|
|
83
85
|
setHoveredEmoji(emoji);
|
|
84
86
|
});
|
|
85
87
|
const handleCategoryClick = useEventCallback((category) => {
|
|
@@ -96,7 +98,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
96
98
|
className: tv.container({ className }),
|
|
97
99
|
style: rootStyle,
|
|
98
100
|
children: [
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
|
|
101
|
+
(showSearch || showCategories) && /* @__PURE__ */ jsxs("div", { className: tv.header(), children: [
|
|
100
102
|
showSearch && /* @__PURE__ */ jsx(
|
|
101
103
|
SearchInput,
|
|
102
104
|
{
|
|
@@ -198,7 +200,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
198
200
|
)
|
|
199
201
|
}
|
|
200
202
|
),
|
|
201
|
-
/* @__PURE__ */ jsx(
|
|
203
|
+
showFooter && /* @__PURE__ */ jsx(
|
|
202
204
|
EmojiFooter,
|
|
203
205
|
{
|
|
204
206
|
hoveredEmoji,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ErrorMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const ErrorMessage: React.NamedExoticComponent<ErrorMessageProps>;
|
|
7
|
+
|
|
8
|
+
export { ErrorMessage, type ErrorMessageProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
4
|
+
var errorMessageTv = tcv({
|
|
5
|
+
base: "text-danger-foreground break-words whitespace-pre-wrap px-0.5",
|
|
6
|
+
variants: {
|
|
7
|
+
disabled: {
|
|
8
|
+
true: "text-disabled-foreground"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
disabled: false
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var ErrorMessage = memo(function ErrorMessage2(props) {
|
|
16
|
+
const { children, className, disabled, ...rest } = props;
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"em",
|
|
19
|
+
{
|
|
20
|
+
className: errorMessageTv({ disabled, className }),
|
|
21
|
+
slot: "errorMessage",
|
|
22
|
+
role: "alert",
|
|
23
|
+
...rest,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
ErrorMessage
|
|
30
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ErrorMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const ErrorMessage: React.NamedExoticComponent<ErrorMessageProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { errorMessageTv } from "./tv.js";
|
|
4
|
+
const ErrorMessage = memo(function ErrorMessage2(props) {
|
|
5
|
+
const { children, className, disabled, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"em",
|
|
8
|
+
{
|
|
9
|
+
className: errorMessageTv({ disabled, className }),
|
|
10
|
+
slot: "errorMessage",
|
|
11
|
+
role: "alert",
|
|
12
|
+
...rest,
|
|
13
|
+
children
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
ErrorMessage
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const errorMessageTv: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: string;
|
|
4
|
+
};
|
|
5
|
+
}, undefined, "text-danger-foreground break-words whitespace-pre-wrap px-0.5", {
|
|
6
|
+
disabled: {
|
|
7
|
+
true: string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
10
|
+
disabled: {
|
|
11
|
+
true: string;
|
|
12
|
+
};
|
|
13
|
+
}, undefined, "text-danger-foreground break-words whitespace-pre-wrap px-0.5", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const errorMessageTv = tcv({
|
|
3
|
+
base: "text-danger-foreground break-words whitespace-pre-wrap px-0.5",
|
|
4
|
+
variants: {
|
|
5
|
+
disabled: {
|
|
6
|
+
true: "text-disabled-foreground"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
disabled: false
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
errorMessageTv
|
|
15
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Description } from "../../../description/dist/index.js";
|
|
3
|
+
import { ErrorMessage } from "../../../error-message/dist/index.js";
|
|
2
4
|
import { Label } from "../../../label/dist/index.js";
|
|
3
5
|
import { FormTv } from "../tv.js";
|
|
4
6
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
@@ -23,8 +25,8 @@ function BaseAdapter({
|
|
|
23
25
|
}
|
|
24
26
|
),
|
|
25
27
|
children,
|
|
26
|
-
description
|
|
27
|
-
error
|
|
28
|
+
typeof description === "string" ? /* @__PURE__ */ jsx(Description, { id: `${htmlFor}-description`, children: description }) : description,
|
|
29
|
+
typeof error === "string" ? /* @__PURE__ */ jsx(ErrorMessage, { id: `${htmlFor}-error`, children: error }) : error
|
|
28
30
|
] });
|
|
29
31
|
}
|
|
30
32
|
function filterFormProps(props) {
|