@choice-ui/react 1.5.4 → 1.5.5
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/calendar/dist/index.js +2 -2
- package/dist/components/calendar/src/time-calendar/time-calendar.js +2 -2
- package/dist/components/code-block/dist/index.js +13 -13
- package/dist/components/code-block/src/code-block.js +11 -11
- package/dist/components/code-block/src/hooks/use-line-count.js +3 -3
- package/dist/components/command/src/components/command-group.js +2 -2
- package/dist/components/command/src/components/command-item.js +3 -3
- package/dist/components/command/src/hooks/index.js +2 -2
- package/dist/components/command/src/hooks/use-command-state.js +3 -3
- package/dist/components/command/src/hooks/use-command.js +2 -2
- package/dist/components/command/src/utils/helpers.js +4 -4
- package/dist/components/comments/src/comment-item/comment-item.js +2 -2
- package/dist/components/comments/src/comment-item/components/comment-item-reactions.js +2 -2
- package/dist/components/conditions/src/hooks/use-drag-and-drop.js +3 -3
- package/dist/components/context-input/src/components/copy-button.js +2 -2
- package/dist/components/context-input/src/components/mention.js +2 -2
- package/dist/components/context-input/src/components/slate-editor.js +3 -3
- package/dist/components/context-input/src/context-input.js +5 -5
- package/dist/components/context-menu/src/context-menu.js +6 -6
- package/dist/components/dialog/dist/index.js +2 -2
- package/dist/components/dialog/src/dialog.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/md-input/src/components/toolbar/toolbar.js +2 -2
- package/dist/components/md-input/src/md-input.js +3 -3
- package/dist/components/menus/dist/index.js +2 -2
- package/dist/components/menus/src/menus.js +2 -2
- package/dist/components/multi-select/dist/index.js +2 -2
- package/dist/components/multi-select/src/utils/extract-options.js +2 -2
- package/dist/components/otp-input/dist/index.d.ts +30 -0
- package/dist/components/otp-input/src/index.d.ts +2 -0
- package/dist/components/otp-input/src/otp-input.d.ts +27 -0
- package/dist/components/otp-input/src/otp-input.js +115 -0
- package/dist/components/otp-input/src/otp-input.module.css +15 -0
- package/dist/components/otp-input/src/otp-input.module.css.js +8 -0
- package/dist/components/otp-input/src/tv.d.ts +121 -0
- package/dist/components/otp-input/src/tv.js +150 -0
- package/dist/components/otp-input/tsup.config.d.ts +2 -0
- package/dist/components/panel/src/components/panel-sortable.js +3 -3
- package/dist/components/rich-input/src/hooks/use-editor-config.js +3 -3
- package/dist/components/rich-input/src/utils/custom-options.js +15 -15
- package/dist/components/select/dist/index.js +2 -2
- package/dist/components/select/src/select.js +2 -2
- package/dist/components/slot/dist/index.d.ts +10 -10
- package/dist/components/slot/dist/index.js +7 -15
- package/dist/components/slot/src/slot.d.ts +12 -12
- package/dist/components/slot/src/slot.js +10 -18
- package/dist/components/textarea/dist/index.js +14 -14
- package/dist/components/textarea/src/components/autosize/hooks.js +5 -5
- package/dist/components/textarea/src/components/autosize/index.js +10 -10
- package/dist/components/tree-list/src/tree-list.js +3 -3
- package/dist/components/virtualized-grid/src/error-boundary.js +2 -2
- package/dist/index.js +2 -0
- package/dist/node_modules/.pnpm/input-otp@1.4.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-otp/dist/index.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type OTPInputVariant = "default" | "light" | "dark";
|
|
6
|
+
interface OTPInputRootProps extends Omit<ComponentProps<typeof OTPInput>, "disabled" | "containerClassName" | "render"> {
|
|
7
|
+
variant?: OTPInputVariant;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
isInvalid?: boolean;
|
|
10
|
+
inputClassName?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function OTPInputRoot({ className, inputClassName, variant, disabled, isInvalid, children, ...props }: OTPInputRootProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
interface OTPInputGroupProps extends ComponentProps<"div"> {
|
|
15
|
+
}
|
|
16
|
+
declare function OTPInputGroup({ className, ...props }: OTPInputGroupProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
interface OTPInputSlotProps extends ComponentProps<"div"> {
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
declare function OTPInputSlot({ className, index, ...props }: OTPInputSlotProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
interface OTPInputSeparatorProps extends ComponentProps<"div"> {
|
|
22
|
+
}
|
|
23
|
+
declare function OTPInputSeparator({ className, children, ...props }: OTPInputSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const OtpInput: typeof OTPInputRoot & {
|
|
25
|
+
Group: typeof OTPInputGroup;
|
|
26
|
+
Slot: typeof OTPInputSlot;
|
|
27
|
+
Separator: typeof OTPInputSeparator;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { type OTPInputGroupProps, type OTPInputRootProps, type OTPInputSeparatorProps, type OTPInputSlotProps, OtpInput };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
type OTPInputVariant = "default" | "light" | "dark";
|
|
4
|
+
export interface OTPInputRootProps extends Omit<ComponentProps<typeof OTPInput>, "disabled" | "containerClassName" | "render"> {
|
|
5
|
+
variant?: OTPInputVariant;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isInvalid?: boolean;
|
|
8
|
+
inputClassName?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function OTPInputRoot({ className, inputClassName, variant, disabled, isInvalid, children, ...props }: OTPInputRootProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export interface OTPInputGroupProps extends ComponentProps<"div"> {
|
|
13
|
+
}
|
|
14
|
+
declare function OTPInputGroup({ className, ...props }: OTPInputGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface OTPInputSlotProps extends ComponentProps<"div"> {
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
18
|
+
declare function OTPInputSlot({ className, index, ...props }: OTPInputSlotProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export interface OTPInputSeparatorProps extends ComponentProps<"div"> {
|
|
20
|
+
}
|
|
21
|
+
declare function OTPInputSeparator({ className, children, ...props }: OTPInputSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const OtpInput: typeof OTPInputRoot & {
|
|
23
|
+
Group: typeof OTPInputGroup;
|
|
24
|
+
Slot: typeof OTPInputSlot;
|
|
25
|
+
Separator: typeof OTPInputSeparator;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { OTPInput as Lt } from "../../../node_modules/.pnpm/input-otp@1.4.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-otp/dist/index.js";
|
|
3
|
+
import { useMemo, createContext, useContext } from "react";
|
|
4
|
+
import { otpInputTv } from "./tv.js";
|
|
5
|
+
import css from "./otp-input.module.css.js";
|
|
6
|
+
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
7
|
+
const OTPInputCtx = createContext({
|
|
8
|
+
styles: otpInputTv({}),
|
|
9
|
+
slotProps: [],
|
|
10
|
+
variant: "default",
|
|
11
|
+
disabled: false,
|
|
12
|
+
isInvalid: false
|
|
13
|
+
});
|
|
14
|
+
function OTPInputRoot({
|
|
15
|
+
className,
|
|
16
|
+
inputClassName,
|
|
17
|
+
variant = "default",
|
|
18
|
+
disabled = false,
|
|
19
|
+
isInvalid = false,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
const tv = useMemo(
|
|
24
|
+
() => otpInputTv({ variant, disabled, isInvalid }),
|
|
25
|
+
[variant, disabled, isInvalid]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Lt,
|
|
29
|
+
{
|
|
30
|
+
className: tv.input({ className: inputClassName }),
|
|
31
|
+
containerClassName: tv.base({ className }),
|
|
32
|
+
spellCheck: false,
|
|
33
|
+
autoComplete: "off",
|
|
34
|
+
"data-disabled": disabled || void 0,
|
|
35
|
+
"data-invalid": isInvalid || void 0,
|
|
36
|
+
"data-slot": "otp-input",
|
|
37
|
+
disabled,
|
|
38
|
+
render: ({ slots: slotProps }) => /* @__PURE__ */ jsx(OTPInputCtx.Provider, { value: { styles: tv, slotProps, variant, disabled, isInvalid }, children }),
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function OTPInputGroup({ className, ...props }) {
|
|
44
|
+
var _a;
|
|
45
|
+
const { styles } = useContext(OTPInputCtx);
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: (_a = styles == null ? void 0 : styles.group) == null ? void 0 : _a.call(styles, { className }),
|
|
50
|
+
"data-slot": "otp-input-group",
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function OTPInputSlot({ className, index, ...props }) {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
const { styles, slotProps, variant, disabled, isInvalid } = useContext(OTPInputCtx);
|
|
58
|
+
const { char, hasFakeCaret, isActive } = (slotProps == null ? void 0 : slotProps[index]) ?? {};
|
|
59
|
+
const slotStyles = otpInputTv({
|
|
60
|
+
variant,
|
|
61
|
+
selected: isActive,
|
|
62
|
+
disabled,
|
|
63
|
+
isInvalid
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
...props,
|
|
69
|
+
className: tcx((_a = styles == null ? void 0 : styles.slot) == null ? void 0 : _a.call(styles, { className }), (_b = slotStyles == null ? void 0 : slotStyles.slot) == null ? void 0 : _b.call(slotStyles)),
|
|
70
|
+
"data-active": isActive || void 0,
|
|
71
|
+
"data-disabled": disabled || void 0,
|
|
72
|
+
"data-filled": !!char || void 0,
|
|
73
|
+
"data-invalid": isInvalid || void 0,
|
|
74
|
+
"data-slot": "otp-input-slot",
|
|
75
|
+
children: [
|
|
76
|
+
char ? /* @__PURE__ */ jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: (_c = styles == null ? void 0 : styles.slotValue) == null ? void 0 : _c.call(styles),
|
|
80
|
+
"data-slot": "otp-input-slot-value",
|
|
81
|
+
children: char
|
|
82
|
+
}
|
|
83
|
+
) : null,
|
|
84
|
+
hasFakeCaret && isActive ? /* @__PURE__ */ jsx(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: tcx((_d = styles == null ? void 0 : styles.caret) == null ? void 0 : _d.call(styles), css.caret),
|
|
88
|
+
"data-slot": "otp-input-caret"
|
|
89
|
+
}
|
|
90
|
+
) : null
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function OTPInputSeparator({ className, children, ...props }) {
|
|
96
|
+
var _a;
|
|
97
|
+
const { styles } = useContext(OTPInputCtx);
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: (_a = styles == null ? void 0 : styles.separator) == null ? void 0 : _a.call(styles, { className }),
|
|
102
|
+
"data-slot": "otp-input-separator",
|
|
103
|
+
...props,
|
|
104
|
+
children: children ?? /* @__PURE__ */ jsx("span", { children: "-" })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const OtpInput = Object.assign(OTPInputRoot, {
|
|
109
|
+
Group: OTPInputGroup,
|
|
110
|
+
Slot: OTPInputSlot,
|
|
111
|
+
Separator: OTPInputSeparator
|
|
112
|
+
});
|
|
113
|
+
export {
|
|
114
|
+
OtpInput
|
|
115
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export declare const otpInputTv: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
variant: {
|
|
3
|
+
default: {
|
|
4
|
+
slot: string;
|
|
5
|
+
slotValue: string;
|
|
6
|
+
caret: string;
|
|
7
|
+
};
|
|
8
|
+
light: {
|
|
9
|
+
slot: string;
|
|
10
|
+
slotValue: string;
|
|
11
|
+
caret: string;
|
|
12
|
+
};
|
|
13
|
+
dark: {
|
|
14
|
+
slot: string;
|
|
15
|
+
slotValue: string;
|
|
16
|
+
caret: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
selected: {
|
|
20
|
+
true: {};
|
|
21
|
+
false: {};
|
|
22
|
+
};
|
|
23
|
+
disabled: {
|
|
24
|
+
true: {
|
|
25
|
+
slot: string;
|
|
26
|
+
};
|
|
27
|
+
false: {};
|
|
28
|
+
};
|
|
29
|
+
isInvalid: {
|
|
30
|
+
true: {};
|
|
31
|
+
false: {};
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
base: string;
|
|
35
|
+
input: string;
|
|
36
|
+
group: string;
|
|
37
|
+
slot: string[];
|
|
38
|
+
slotValue: string;
|
|
39
|
+
caret: string;
|
|
40
|
+
separator: string;
|
|
41
|
+
}, undefined, {
|
|
42
|
+
variant: {
|
|
43
|
+
default: {
|
|
44
|
+
slot: string;
|
|
45
|
+
slotValue: string;
|
|
46
|
+
caret: string;
|
|
47
|
+
};
|
|
48
|
+
light: {
|
|
49
|
+
slot: string;
|
|
50
|
+
slotValue: string;
|
|
51
|
+
caret: string;
|
|
52
|
+
};
|
|
53
|
+
dark: {
|
|
54
|
+
slot: string;
|
|
55
|
+
slotValue: string;
|
|
56
|
+
caret: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
selected: {
|
|
60
|
+
true: {};
|
|
61
|
+
false: {};
|
|
62
|
+
};
|
|
63
|
+
disabled: {
|
|
64
|
+
true: {
|
|
65
|
+
slot: string;
|
|
66
|
+
};
|
|
67
|
+
false: {};
|
|
68
|
+
};
|
|
69
|
+
isInvalid: {
|
|
70
|
+
true: {};
|
|
71
|
+
false: {};
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
base: string;
|
|
75
|
+
input: string;
|
|
76
|
+
group: string;
|
|
77
|
+
slot: string[];
|
|
78
|
+
slotValue: string;
|
|
79
|
+
caret: string;
|
|
80
|
+
separator: string;
|
|
81
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
82
|
+
variant: {
|
|
83
|
+
default: {
|
|
84
|
+
slot: string;
|
|
85
|
+
slotValue: string;
|
|
86
|
+
caret: string;
|
|
87
|
+
};
|
|
88
|
+
light: {
|
|
89
|
+
slot: string;
|
|
90
|
+
slotValue: string;
|
|
91
|
+
caret: string;
|
|
92
|
+
};
|
|
93
|
+
dark: {
|
|
94
|
+
slot: string;
|
|
95
|
+
slotValue: string;
|
|
96
|
+
caret: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
selected: {
|
|
100
|
+
true: {};
|
|
101
|
+
false: {};
|
|
102
|
+
};
|
|
103
|
+
disabled: {
|
|
104
|
+
true: {
|
|
105
|
+
slot: string;
|
|
106
|
+
};
|
|
107
|
+
false: {};
|
|
108
|
+
};
|
|
109
|
+
isInvalid: {
|
|
110
|
+
true: {};
|
|
111
|
+
false: {};
|
|
112
|
+
};
|
|
113
|
+
}, {
|
|
114
|
+
base: string;
|
|
115
|
+
input: string;
|
|
116
|
+
group: string;
|
|
117
|
+
slot: string[];
|
|
118
|
+
slotValue: string;
|
|
119
|
+
caret: string;
|
|
120
|
+
separator: string;
|
|
121
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const otpInputTv = tcv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: "relative flex items-center gap-2",
|
|
5
|
+
input: "!absolute inset-0 w-full h-full opacity-0 cursor-text",
|
|
6
|
+
group: "flex items-center gap-1.5",
|
|
7
|
+
slot: [
|
|
8
|
+
"relative flex items-center justify-center",
|
|
9
|
+
"h-8 w-8",
|
|
10
|
+
"rounded-md",
|
|
11
|
+
"text-body-large",
|
|
12
|
+
"border border-solid border-transparent"
|
|
13
|
+
],
|
|
14
|
+
slotValue: "",
|
|
15
|
+
caret: "absolute inset-y-2 left-1/2 w-px -translate-x-1/2",
|
|
16
|
+
separator: "text-secondary-foreground mx-1"
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: {
|
|
21
|
+
slot: "bg-secondary-background",
|
|
22
|
+
slotValue: "text-default-foreground",
|
|
23
|
+
caret: "bg-default-foreground"
|
|
24
|
+
},
|
|
25
|
+
light: {
|
|
26
|
+
slot: "bg-gray-100",
|
|
27
|
+
slotValue: "text-gray-900",
|
|
28
|
+
caret: "bg-gray-900"
|
|
29
|
+
},
|
|
30
|
+
dark: {
|
|
31
|
+
slot: "bg-gray-700",
|
|
32
|
+
slotValue: "text-white",
|
|
33
|
+
caret: "bg-white"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
selected: {
|
|
37
|
+
true: {},
|
|
38
|
+
false: {}
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
true: {
|
|
42
|
+
slot: "cursor-not-allowed"
|
|
43
|
+
},
|
|
44
|
+
false: {}
|
|
45
|
+
},
|
|
46
|
+
isInvalid: {
|
|
47
|
+
true: {},
|
|
48
|
+
false: {}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
compoundVariants: [
|
|
52
|
+
{
|
|
53
|
+
variant: "default",
|
|
54
|
+
selected: true,
|
|
55
|
+
disabled: false,
|
|
56
|
+
class: {
|
|
57
|
+
slot: "bg-default-background border-selected-boundary"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
variant: "default",
|
|
62
|
+
selected: false,
|
|
63
|
+
disabled: false,
|
|
64
|
+
class: {
|
|
65
|
+
slot: "hover:border-default-boundary"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
variant: "light",
|
|
70
|
+
selected: false,
|
|
71
|
+
disabled: false,
|
|
72
|
+
class: {
|
|
73
|
+
slot: "hover:border-gray-200"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
variant: "dark",
|
|
78
|
+
selected: false,
|
|
79
|
+
disabled: false,
|
|
80
|
+
class: {
|
|
81
|
+
slot: "hover:border-gray-600"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: ["default", "light", "dark"],
|
|
86
|
+
selected: true,
|
|
87
|
+
disabled: false,
|
|
88
|
+
class: {
|
|
89
|
+
slot: "border-selected-boundary"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
variant: "default",
|
|
94
|
+
disabled: true,
|
|
95
|
+
class: {
|
|
96
|
+
slot: "bg-secondary-background",
|
|
97
|
+
slotValue: "text-disabled-foreground"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
variant: "light",
|
|
102
|
+
disabled: true,
|
|
103
|
+
class: {
|
|
104
|
+
slot: "bg-gray-100",
|
|
105
|
+
slotValue: "text-black/30"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
variant: "dark",
|
|
110
|
+
disabled: true,
|
|
111
|
+
class: {
|
|
112
|
+
slot: "bg-gray-700",
|
|
113
|
+
slotValue: "text-white/40"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
variant: "default",
|
|
118
|
+
isInvalid: true,
|
|
119
|
+
disabled: false,
|
|
120
|
+
class: {
|
|
121
|
+
slot: "border-danger-boundary"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
variant: "light",
|
|
126
|
+
isInvalid: true,
|
|
127
|
+
disabled: false,
|
|
128
|
+
class: {
|
|
129
|
+
slot: "border-danger-boundary"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
variant: "dark",
|
|
134
|
+
isInvalid: true,
|
|
135
|
+
disabled: false,
|
|
136
|
+
class: {
|
|
137
|
+
slot: "border-danger-boundary"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
defaultVariants: {
|
|
142
|
+
variant: "default",
|
|
143
|
+
selected: false,
|
|
144
|
+
disabled: false,
|
|
145
|
+
isInvalid: false
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
export {
|
|
149
|
+
otpInputTv
|
|
150
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, useRef, useCallback, useEffect, useMemo, memo } from "react";
|
|
3
3
|
import { usePanelDragDrop } from "../hooks/use-panel-drag-drop.js";
|
|
4
4
|
import { SortablePaneContext, SortableRowDataContext, useSortableRowItem, useSortablePane } from "../context/sortable-context.js";
|
|
5
5
|
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
@@ -93,8 +93,8 @@ const PanelSortable = forwardRef(function PanelSortable2(props, ref) {
|
|
|
93
93
|
SortableRowDataContext.Provider,
|
|
94
94
|
{
|
|
95
95
|
value: { item },
|
|
96
|
-
children: /* @__PURE__ */ jsx(RowContainer, { children:
|
|
97
|
-
if (
|
|
96
|
+
children: /* @__PURE__ */ jsx(RowContainer, { children: React__default.Children.map(props.children, (child) => {
|
|
97
|
+
if (React__default.isValidElement(child)) {
|
|
98
98
|
return child;
|
|
99
99
|
}
|
|
100
100
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useMemo, useCallback } from "react";
|
|
2
2
|
import { createEditor } from "slate";
|
|
3
3
|
import { withHistory } from "slate-history";
|
|
4
4
|
import { withReact } from "slate-react";
|
|
@@ -16,10 +16,10 @@ const useEditorConfig = (props) => {
|
|
|
16
16
|
disableTabFocus
|
|
17
17
|
});
|
|
18
18
|
const renderElement = useCallback((props2) => {
|
|
19
|
-
return
|
|
19
|
+
return React__default.createElement(ElementRender, props2);
|
|
20
20
|
}, []);
|
|
21
21
|
const renderLeaf = useCallback((props2) => {
|
|
22
|
-
return
|
|
22
|
+
return React__default.createElement(LeafRender, props2);
|
|
23
23
|
}, []);
|
|
24
24
|
return {
|
|
25
25
|
editor,
|
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import { ParagraphPilcrow, ParagraphQuote, ParagraphCode, ParagraphHeading1, ParagraphHeading2, ParagraphHeading3, ParagraphListOrdered, ParagraphList, ParagraphListTodo, ParagraphBold, ParagraphItalic, ParagraphUnderline, ParagraphStrikethrough } from "@choiceform/icons-react";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
const charactersOptions = [
|
|
4
4
|
{
|
|
5
5
|
format: "bold",
|
|
6
|
-
icon:
|
|
6
|
+
icon: React__default.createElement(ParagraphBold)
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
format: "italic",
|
|
10
|
-
icon:
|
|
10
|
+
icon: React__default.createElement(ParagraphItalic)
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
format: "underlined",
|
|
14
|
-
icon:
|
|
14
|
+
icon: React__default.createElement(ParagraphUnderline)
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
format: "strikethrough",
|
|
18
|
-
icon:
|
|
18
|
+
icon: React__default.createElement(ParagraphStrikethrough)
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
format: "code",
|
|
22
|
-
icon:
|
|
22
|
+
icon: React__default.createElement(ParagraphCode)
|
|
23
23
|
}
|
|
24
24
|
];
|
|
25
25
|
const paragraphOptions = [
|
|
26
26
|
{
|
|
27
27
|
format: "paragraph",
|
|
28
|
-
icon:
|
|
28
|
+
icon: React__default.createElement(ParagraphPilcrow)
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
format: "block_quote",
|
|
32
|
-
icon:
|
|
32
|
+
icon: React__default.createElement(ParagraphQuote)
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
format: "code",
|
|
36
|
-
icon:
|
|
36
|
+
icon: React__default.createElement(ParagraphCode)
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
format: "h1",
|
|
40
|
-
icon:
|
|
40
|
+
icon: React__default.createElement(ParagraphHeading1)
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
format: "h2",
|
|
44
|
-
icon:
|
|
44
|
+
icon: React__default.createElement(ParagraphHeading2)
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
format: "h3",
|
|
48
|
-
icon:
|
|
48
|
+
icon: React__default.createElement(ParagraphHeading3)
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
format: "numbered_list",
|
|
52
|
-
icon:
|
|
52
|
+
icon: React__default.createElement(ParagraphListOrdered)
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
format: "bulleted_list",
|
|
56
|
-
icon:
|
|
56
|
+
icon: React__default.createElement(ParagraphList)
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
format: "check_list",
|
|
60
|
-
icon:
|
|
60
|
+
icon: React__default.createElement(ParagraphListTodo)
|
|
61
61
|
}
|
|
62
62
|
];
|
|
63
63
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Slot } from "../../slot/dist/index.js";
|
|
2
2
|
import { MenuValue, MenuTrigger, MenuContextLabel, MenuContextItem, MenuEmpty, MenuDivider, MenuContextContent, useMenuScroll, MenuContext, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
3
3
|
import { useFloatingParentNodeId, FloatingTree, useFloatingNodeId, useFloating, offset, shift, flip, size, inner, autoUpdate, useClick, useDismiss, useRole, useInnerOffset, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingPortal, FloatingOverlay, FloatingFocusManager, FloatingList } from "@floating-ui/react";
|
|
4
|
-
import
|
|
4
|
+
import React__default, { memo, useMemo, Children, isValidElement, useRef, useState, useId, useEffect, cloneElement } from "react";
|
|
5
5
|
import { useEventCallback } from "usehooks-ts";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
@@ -47,7 +47,7 @@ var SelectComponent = memo(function SelectComponent2(props) {
|
|
|
47
47
|
if (!isValidElement(child)) return;
|
|
48
48
|
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel || child.type === MenuEmpty) {
|
|
49
49
|
result.push(child);
|
|
50
|
-
} else if (child.type ===
|
|
50
|
+
} else if (child.type === React__default.Fragment && child.props.children) {
|
|
51
51
|
const fragmentChildren = Children.toArray(child.props.children);
|
|
52
52
|
result.push(...extractSelectItems(fragmentChildren));
|
|
53
53
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Slot } from "../../slot/dist/index.js";
|
|
3
3
|
import { MenuValue, MenuTrigger, MenuContextLabel, MenuContextItem, MenuEmpty, MenuDivider, MenuContextContent, useMenuScroll, MenuContext, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
4
4
|
import { useFloatingParentNodeId, FloatingTree, useFloatingNodeId, useFloating, offset, shift, flip, size, inner, autoUpdate, useClick, useDismiss, useRole, useInnerOffset, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingPortal, FloatingOverlay, FloatingFocusManager, FloatingList } from "@floating-ui/react";
|
|
5
|
-
import
|
|
5
|
+
import React__default, { memo, useMemo, Children, isValidElement, useRef, useState, useId, useEffect, cloneElement } from "react";
|
|
6
6
|
import { useEventCallback } from "usehooks-ts";
|
|
7
7
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
8
8
|
const PORTAL_ROOT_ID = "floating-menu-root";
|
|
@@ -47,7 +47,7 @@ const SelectComponent = memo(function SelectComponent2(props) {
|
|
|
47
47
|
if (!isValidElement(child)) return;
|
|
48
48
|
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel || child.type === MenuEmpty) {
|
|
49
49
|
result.push(child);
|
|
50
|
-
} else if (child.type ===
|
|
50
|
+
} else if (child.type === React__default.Fragment && child.props.children) {
|
|
51
51
|
const fragmentChildren = Children.toArray(child.props.children);
|
|
52
52
|
result.push(...extractSelectItems(fragmentChildren));
|
|
53
53
|
}
|
|
@@ -3,23 +3,23 @@ interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* 优化的 Slot 组件实现
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* 1.
|
|
10
|
-
* 2.
|
|
11
|
-
* 3.
|
|
12
|
-
* 4.
|
|
8
|
+
* 相比 @radix-ui/react-slot 的性能优化:
|
|
9
|
+
* 1. 使用 useMemo 缓存 children 处理结果
|
|
10
|
+
* 2. 简化 props 合并逻辑
|
|
11
|
+
* 3. 避免不必要的深度遍历
|
|
12
|
+
* 4. 更好的类型安全
|
|
13
13
|
*/
|
|
14
14
|
declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
|
15
15
|
/**
|
|
16
|
-
* Hook
|
|
17
|
-
*
|
|
16
|
+
* Hook 版本的 Slot 逻辑
|
|
17
|
+
* 用于需要更细粒度控制的场景
|
|
18
18
|
*/
|
|
19
19
|
declare function useSlot(children: React.ReactNode, slotProps: Record<string, unknown>, forwardedRef?: React.Ref<unknown>): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* 性能优化的 asChild 模式 Hook
|
|
22
|
+
* 用于替代 `const Component = asChild ? Slot : "button"` 模式
|
|
23
23
|
*/
|
|
24
24
|
declare function useAsChild<T extends React.ElementType = "button">(asChild: boolean | undefined, defaultElement: T): T | typeof Slot;
|
|
25
25
|
|