@xjur-ui/react 1.0.4 → 2.0.0
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/.turbo/turbo-build.log +98 -42
- package/CHANGELOG.md +51 -0
- package/README.md +146 -0
- package/dist/chunk-CBFC4QME.js +2 -0
- package/dist/chunk-CBFC4QME.js.map +1 -0
- package/dist/chunk-EIG6CBTQ.js +2 -0
- package/dist/chunk-EIG6CBTQ.js.map +1 -0
- package/dist/chunk-FASEHVMD.js +2 -0
- package/dist/chunk-FASEHVMD.js.map +1 -0
- package/dist/chunk-KIFR5VIE.js +2 -0
- package/dist/chunk-KIFR5VIE.js.map +1 -0
- package/dist/chunk-KS6WGBHQ.js +2 -0
- package/dist/chunk-KS6WGBHQ.js.map +1 -0
- package/dist/chunk-NELCN6E2.js +2 -0
- package/dist/chunk-NELCN6E2.js.map +1 -0
- package/dist/chunk-NPTLORW5.js +2 -0
- package/dist/chunk-NPTLORW5.js.map +1 -0
- package/dist/chunk-RWMV7APX.js +2 -0
- package/dist/chunk-RWMV7APX.js.map +1 -0
- package/dist/chunk-SHHXKVVR.js +2 -0
- package/dist/chunk-SHHXKVVR.js.map +1 -0
- package/dist/chunk-TB6KI6CL.js +2 -0
- package/dist/chunk-TB6KI6CL.js.map +1 -0
- package/dist/components/avatar-group.js +2 -179
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.js +2 -59
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +2 -111
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.js +2 -98
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.js +2 -751
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/checkbox.js +2 -153
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +3 -1
- package/dist/components/chip.js +2 -256
- package/dist/components/chip.js.map +1 -0
- package/dist/components/collapsible.js +2 -41
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/date-picker.d.ts +8 -3
- package/dist/components/date-picker.js +2 -232
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/divider.js +2 -29
- package/dist/components/divider.js.map +1 -0
- package/dist/components/dropdown-menu.js +2 -295
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/icon.js +2 -177
- package/dist/components/icon.js.map +1 -0
- package/dist/components/input.d.ts +9 -4
- package/dist/components/input.js +2 -315
- package/dist/components/input.js.map +1 -0
- package/dist/components/list.js +2 -179
- package/dist/components/list.js.map +1 -0
- package/dist/components/logo.js +2 -324
- package/dist/components/logo.js.map +1 -0
- package/dist/components/otp-input.js +2 -47
- package/dist/components/otp-input.js.map +1 -0
- package/dist/components/radio.js +2 -156
- package/dist/components/radio.js.map +1 -0
- package/dist/components/rich-editor.d.ts +2 -1
- package/dist/components/rich-editor.js +2 -723
- package/dist/components/rich-editor.js.map +1 -0
- package/dist/components/search-input.js +2 -274
- package/dist/components/search-input.js.map +1 -0
- package/dist/components/select.d.ts +6 -3
- package/dist/components/select.js +2 -550
- package/dist/components/select.js.map +1 -0
- package/dist/components/sheet.js +2 -251
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.js +2 -16
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/status.d.ts +14 -0
- package/dist/components/status.js +2 -0
- package/dist/components/status.js.map +1 -0
- package/dist/components/switch.js +2 -36
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +2 -196
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +9 -6
- package/dist/components/tabs.js +2 -54
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.d.ts +3 -1
- package/dist/components/tag.js +2 -189
- package/dist/components/tag.js.map +1 -0
- package/dist/components/tooltip.js +2 -58
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typography.js +2 -78
- package/dist/components/typography.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.css +2 -2318
- package/dist/index.css.map +1 -0
- package/dist/logo-PQRZORCS.js +3 -0
- package/dist/logo-PQRZORCS.js.map +1 -0
- package/package.json +42 -7
- package/src/components/calendar.tsx +7 -6
- package/src/components/chip.tsx +11 -3
- package/src/components/date-picker.tsx +125 -22
- package/src/components/icon.tsx +1 -1
- package/src/components/input.tsx +124 -60
- package/src/components/logo.tsx +25 -20
- package/src/components/rich-editor.tsx +4 -3
- package/src/components/select.tsx +104 -26
- package/src/components/status.tsx +43 -0
- package/src/components/tabs.tsx +56 -37
- package/src/components/tag.tsx +11 -3
- package/src/index.css +2 -2
- package/src/resources/logo/index.tsx +33 -0
- package/tsup.config.ts +23 -5
- package/dist/index.js +0 -0
- package/src/index.ts +0 -1
- package/src/resources/logo/index.ts +0 -3
|
@@ -1,723 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { useCallback, useMemo, useState as useState2 } from "react";
|
|
4
|
-
import {
|
|
5
|
-
EditorContent,
|
|
6
|
-
EditorContext,
|
|
7
|
-
useCurrentEditor as useRichTextEditor,
|
|
8
|
-
useEditorState as useRichTextEditorState,
|
|
9
|
-
useEditor
|
|
10
|
-
} from "@tiptap/react";
|
|
11
|
-
import { StarterKit } from "@tiptap/starter-kit";
|
|
12
|
-
import { Heading } from "@tiptap/extension-heading";
|
|
13
|
-
import { Placeholder } from "@tiptap/extensions";
|
|
14
|
-
|
|
15
|
-
// src/hooks/use-os.ts
|
|
16
|
-
import { useState, useEffect } from "react";
|
|
17
|
-
function useOS() {
|
|
18
|
-
const [os, setOs] = useState("unknown");
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (typeof window === "undefined") return;
|
|
21
|
-
const userAgent = window.navigator.userAgent;
|
|
22
|
-
if (/iPad|iPhone|iPod/.test(userAgent)) {
|
|
23
|
-
setOs("ios");
|
|
24
|
-
} else if (/Mac/.test(userAgent)) {
|
|
25
|
-
setOs("macos");
|
|
26
|
-
} else if (/Win/.test(userAgent)) {
|
|
27
|
-
setOs("windows");
|
|
28
|
-
} else if (/Android/.test(userAgent)) {
|
|
29
|
-
setOs("android");
|
|
30
|
-
} else if (/Linux/.test(userAgent)) {
|
|
31
|
-
setOs("linux");
|
|
32
|
-
} else {
|
|
33
|
-
setOs("unknown");
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
return {
|
|
37
|
-
os,
|
|
38
|
-
shortcut: ["macos", "ios"].includes(os) ? "\u2318" : "Ctrl"
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/components/icon.tsx
|
|
43
|
-
import { cx } from "@xjur-ui/util";
|
|
44
|
-
import { jsx } from "react/jsx-runtime";
|
|
45
|
-
function Icon({ className, filled = false, name, ...props }) {
|
|
46
|
-
return /* @__PURE__ */ jsx(
|
|
47
|
-
"span",
|
|
48
|
-
{
|
|
49
|
-
...props,
|
|
50
|
-
className: cx(
|
|
51
|
-
"material-symbols-outlined",
|
|
52
|
-
"text-size-body-lg",
|
|
53
|
-
className
|
|
54
|
-
),
|
|
55
|
-
style: {
|
|
56
|
-
fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' 600, 'GRAD' 0, 'opsz' 20`,
|
|
57
|
-
...props.style
|
|
58
|
-
},
|
|
59
|
-
children: name
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// src/components/button.tsx
|
|
65
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
66
|
-
import { cva, cx as cx2 } from "@xjur-ui/util";
|
|
67
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
68
|
-
var buttonVariants = cva(
|
|
69
|
-
[
|
|
70
|
-
"outline-none inline-flex items-center justify-center rounded-circle gap-small cursor-pointer disabled:opacity-38 disabled:pointer-events-none transition-colors"
|
|
71
|
-
],
|
|
72
|
-
{
|
|
73
|
-
variants: {
|
|
74
|
-
size: {
|
|
75
|
-
md: "py-small_1x-alt px-medium text-size-body-md",
|
|
76
|
-
sm: "py-small-1x px-small text-size-label-sm",
|
|
77
|
-
icon_md: "p-small text-size-body-md h-large-4x w-large-4x",
|
|
78
|
-
icon_sm: "p-small-1x text-size-label-sm h-large-2x w-large-2x"
|
|
79
|
-
},
|
|
80
|
-
variant: {
|
|
81
|
-
primary: "",
|
|
82
|
-
secondary: "",
|
|
83
|
-
tertiary: "",
|
|
84
|
-
destructive: "",
|
|
85
|
-
outlined: "bg-layer-2-idle border border-border-layer-2 hover:bg-layer-2-hover active:bg-layer-2-pressed"
|
|
86
|
-
},
|
|
87
|
-
appearance: {
|
|
88
|
-
solid: "",
|
|
89
|
-
ghost: "bg-transparent"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
compoundVariants: [
|
|
93
|
-
{
|
|
94
|
-
variant: "primary",
|
|
95
|
-
appearance: "solid",
|
|
96
|
-
class: "bg-primary-idle text-neutral-label hover:bg-primary-hover active:bg-primary-pressed"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
variant: "primary",
|
|
100
|
-
appearance: "ghost",
|
|
101
|
-
class: "text-primary-idle hover:bg-primary-alt-idle active:bg-primary-alt-pressed"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
variant: "secondary",
|
|
105
|
-
appearance: "solid",
|
|
106
|
-
class: "bg-layer-1-hover text-neutral-dark hover:bg-layer-1-pressed active:bg-layer-1-active"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
variant: "secondary",
|
|
110
|
-
appearance: "ghost",
|
|
111
|
-
class: "hover:bg-layer-1-hover active:bg-layer-1-pressed"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
variant: "tertiary",
|
|
115
|
-
appearance: "solid",
|
|
116
|
-
class: "bg-layer-2-hover text-neutral-dark hover:bg-layer-2-pressed active:bg-layer-2-active"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
variant: "tertiary",
|
|
120
|
-
appearance: "ghost",
|
|
121
|
-
class: "hover:bg-layer-2-hover active:bg-layer-2-pressed"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
variant: "destructive",
|
|
125
|
-
appearance: "solid",
|
|
126
|
-
class: "bg-danger-idle text-neutral-label hover:bg-danger-hover active:bg-danger-pressed"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
variant: "destructive",
|
|
130
|
-
appearance: "ghost",
|
|
131
|
-
class: "text-danger-label-idle hover:bg-danger-alt-idle active:bg-danger-alt-pressed"
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
defaultVariants: {
|
|
135
|
-
size: "md",
|
|
136
|
-
variant: "primary",
|
|
137
|
-
appearance: "solid"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
function Button({
|
|
142
|
-
asChild,
|
|
143
|
-
className,
|
|
144
|
-
variant = "primary",
|
|
145
|
-
size = "md",
|
|
146
|
-
appearance = "solid",
|
|
147
|
-
...props
|
|
148
|
-
}) {
|
|
149
|
-
const Component = asChild ? Slot : "button";
|
|
150
|
-
return /* @__PURE__ */ jsx2(
|
|
151
|
-
Component,
|
|
152
|
-
{
|
|
153
|
-
className: cx2(buttonVariants({ variant, appearance, size }), className),
|
|
154
|
-
...props
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// src/components/dropdown-menu.tsx
|
|
160
|
-
import "react";
|
|
161
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
162
|
-
import { cx as cx5 } from "@xjur-ui/util";
|
|
163
|
-
|
|
164
|
-
// src/components/list.tsx
|
|
165
|
-
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
166
|
-
import { cx as cx3, cva as cva3 } from "@xjur-ui/util";
|
|
167
|
-
|
|
168
|
-
// src/components/typography.tsx
|
|
169
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
170
|
-
import { cva as cva2 } from "@xjur-ui/util";
|
|
171
|
-
import { memo } from "react";
|
|
172
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
173
|
-
var typographyVariants = cva2("", {
|
|
174
|
-
variants: {
|
|
175
|
-
variant: {
|
|
176
|
-
body: "",
|
|
177
|
-
label: "",
|
|
178
|
-
title: "",
|
|
179
|
-
headline: ""
|
|
180
|
-
},
|
|
181
|
-
size: {
|
|
182
|
-
"sm-2x": "",
|
|
183
|
-
"sm-1x": "",
|
|
184
|
-
sm: "",
|
|
185
|
-
md: "",
|
|
186
|
-
lg: ""
|
|
187
|
-
},
|
|
188
|
-
weight: {
|
|
189
|
-
thin: "font-thin",
|
|
190
|
-
extraLight: "font-extralight",
|
|
191
|
-
light: "font-light",
|
|
192
|
-
normal: "font-normal",
|
|
193
|
-
medium: "font-medium",
|
|
194
|
-
semibold: "font-semibold",
|
|
195
|
-
bold: "font-bold",
|
|
196
|
-
extraBold: "font-extrabold",
|
|
197
|
-
black: "font-black"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
compoundVariants: [
|
|
201
|
-
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
202
|
-
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
203
|
-
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
204
|
-
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
205
|
-
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
206
|
-
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
207
|
-
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
208
|
-
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
209
|
-
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
210
|
-
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
211
|
-
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
212
|
-
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
213
|
-
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
214
|
-
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
215
|
-
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
216
|
-
],
|
|
217
|
-
defaultVariants: {
|
|
218
|
-
variant: "body",
|
|
219
|
-
size: "md",
|
|
220
|
-
weight: "normal"
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
var Typography = memo(
|
|
224
|
-
({
|
|
225
|
-
variant,
|
|
226
|
-
size,
|
|
227
|
-
weight,
|
|
228
|
-
asChild,
|
|
229
|
-
className,
|
|
230
|
-
...props
|
|
231
|
-
}) => {
|
|
232
|
-
const Component = asChild ? Slot2 : "span";
|
|
233
|
-
return /* @__PURE__ */ jsx3(
|
|
234
|
-
Component,
|
|
235
|
-
{
|
|
236
|
-
className: typographyVariants({ variant, size, weight, className }),
|
|
237
|
-
...props
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
Typography.displayName = "Typography";
|
|
243
|
-
|
|
244
|
-
// src/components/list.tsx
|
|
245
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
246
|
-
function ListRoot({
|
|
247
|
-
className,
|
|
248
|
-
asChild,
|
|
249
|
-
...props
|
|
250
|
-
}) {
|
|
251
|
-
const Comp = asChild ? Slot3 : "div";
|
|
252
|
-
return /* @__PURE__ */ jsx4(
|
|
253
|
-
Comp,
|
|
254
|
-
{
|
|
255
|
-
...props,
|
|
256
|
-
className: cx3(
|
|
257
|
-
className,
|
|
258
|
-
"rounded-small scrollbar-hide bg-layer-2-idle border-border-layer-2 shadow-elevation-3 z-10 max-h-[400px] list-none overflow-y-auto border"
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
function ListContent({
|
|
264
|
-
className,
|
|
265
|
-
asChild,
|
|
266
|
-
...props
|
|
267
|
-
}) {
|
|
268
|
-
const Comp = asChild ? Slot3 : "ul";
|
|
269
|
-
return /* @__PURE__ */ jsx4(
|
|
270
|
-
Comp,
|
|
271
|
-
{
|
|
272
|
-
...props,
|
|
273
|
-
className: cx3("gap-small-1x p-small flex flex-col", className)
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
var variants = cva3(
|
|
278
|
-
[
|
|
279
|
-
"py-medium px-small flex items-center gap-small rounded-small-1x",
|
|
280
|
-
"bg-layer-2-idle text-neutral-dark",
|
|
281
|
-
"hover:bg-layer-2-hover transition-colors duration-100 ease-out",
|
|
282
|
-
"active:bg-layer-2-pressed"
|
|
283
|
-
],
|
|
284
|
-
{
|
|
285
|
-
variants: {
|
|
286
|
-
size: {
|
|
287
|
-
md: "h-large-4x",
|
|
288
|
-
lg: "h-large-7x"
|
|
289
|
-
},
|
|
290
|
-
isActive: {
|
|
291
|
-
true: "bg-primary-alt-active text-primary-label-active hover:bg-primary-alt-hover active:bg-primary-alt-pressed"
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
defaultVariants: {
|
|
295
|
-
size: "md",
|
|
296
|
-
isActive: false
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
function ListItem({
|
|
301
|
-
className,
|
|
302
|
-
size,
|
|
303
|
-
isActive,
|
|
304
|
-
asChild,
|
|
305
|
-
...props
|
|
306
|
-
}) {
|
|
307
|
-
const Comp = asChild ? Slot3 : "li";
|
|
308
|
-
return /* @__PURE__ */ jsx4(Comp, { ...props, className: cx3(variants({ size, isActive }), className) });
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// src/components/divider.tsx
|
|
312
|
-
import "react";
|
|
313
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
314
|
-
import { cx as cx4 } from "@xjur-ui/util";
|
|
315
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
316
|
-
|
|
317
|
-
// src/components/dropdown-menu.tsx
|
|
318
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
319
|
-
function DropdownMenuRoot({
|
|
320
|
-
...props
|
|
321
|
-
}) {
|
|
322
|
-
return /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
323
|
-
}
|
|
324
|
-
function DropdownMenuTrigger({
|
|
325
|
-
...props
|
|
326
|
-
}) {
|
|
327
|
-
return /* @__PURE__ */ jsx6(
|
|
328
|
-
DropdownMenuPrimitive.Trigger,
|
|
329
|
-
{
|
|
330
|
-
"data-slot": "dropdown-menu-trigger",
|
|
331
|
-
...props
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
function DropdownMenuContent({
|
|
336
|
-
className,
|
|
337
|
-
sideOffset = 4,
|
|
338
|
-
align = "start",
|
|
339
|
-
side = "bottom",
|
|
340
|
-
children,
|
|
341
|
-
...props
|
|
342
|
-
}) {
|
|
343
|
-
return /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx6(
|
|
344
|
-
DropdownMenuPrimitive.Content,
|
|
345
|
-
{
|
|
346
|
-
align,
|
|
347
|
-
className: cx5(
|
|
348
|
-
"group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-trigger-width)] min-w-[var(--radix-popover-trigger-width)]",
|
|
349
|
-
className
|
|
350
|
-
),
|
|
351
|
-
"data-slot": "dropdown-menu-content",
|
|
352
|
-
side,
|
|
353
|
-
sideOffset,
|
|
354
|
-
...props,
|
|
355
|
-
children: /* @__PURE__ */ jsx6(ListRoot, { children })
|
|
356
|
-
}
|
|
357
|
-
) });
|
|
358
|
-
}
|
|
359
|
-
function DropdownMenuList({
|
|
360
|
-
...props
|
|
361
|
-
}) {
|
|
362
|
-
return /* @__PURE__ */ jsx6(ListContent, { ...props });
|
|
363
|
-
}
|
|
364
|
-
function DropdownMenuItem({
|
|
365
|
-
className,
|
|
366
|
-
...props
|
|
367
|
-
}) {
|
|
368
|
-
return /* @__PURE__ */ jsx6(ListItem, { className: cx5(className, "cursor-pointer"), ...props });
|
|
369
|
-
}
|
|
370
|
-
function DropdownMenuItemText({
|
|
371
|
-
...props
|
|
372
|
-
}) {
|
|
373
|
-
return /* @__PURE__ */ jsx6(Typography, { ...props });
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// src/components/tooltip.tsx
|
|
377
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
378
|
-
import { cx as cx6 } from "@xjur-ui/util";
|
|
379
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
380
|
-
function TooltipProvider({
|
|
381
|
-
delayDuration = 0,
|
|
382
|
-
...props
|
|
383
|
-
}) {
|
|
384
|
-
return /* @__PURE__ */ jsx7(
|
|
385
|
-
TooltipPrimitive.Provider,
|
|
386
|
-
{
|
|
387
|
-
"data-slot": "tooltip-provider",
|
|
388
|
-
delayDuration,
|
|
389
|
-
...props
|
|
390
|
-
}
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
function Tooltip({
|
|
394
|
-
...props
|
|
395
|
-
}) {
|
|
396
|
-
return /* @__PURE__ */ jsx7(TooltipProvider, { children: /* @__PURE__ */ jsx7(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
397
|
-
}
|
|
398
|
-
function TooltipTrigger({
|
|
399
|
-
...props
|
|
400
|
-
}) {
|
|
401
|
-
return /* @__PURE__ */ jsx7(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
402
|
-
}
|
|
403
|
-
function TooltipContent({
|
|
404
|
-
className,
|
|
405
|
-
sideOffset = 1,
|
|
406
|
-
variant = "simple",
|
|
407
|
-
children,
|
|
408
|
-
...props
|
|
409
|
-
}) {
|
|
410
|
-
return /* @__PURE__ */ jsx7(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
|
|
411
|
-
TooltipPrimitive.Content,
|
|
412
|
-
{
|
|
413
|
-
className: cx6(
|
|
414
|
-
"text-size-body-sm text-balance",
|
|
415
|
-
"data-[variant=simple]:bg-alt-2 data-[variant=simple]:text-neutral-label data-[variant=simple]:rounded-small-1x data-[variant=simple]:px-small data-[variant=simple]:py-small-1x",
|
|
416
|
-
"data-[variant=rich]:bg-layer-2-idle data-[variant=rich]:text-neutral-dark data-[variant=rich]:rounded-small data-[variant=rich]:border-border-layer-2 data-[variant=rich]:p-large data-[variant=rich]:border",
|
|
417
|
-
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin)",
|
|
418
|
-
className
|
|
419
|
-
),
|
|
420
|
-
"data-slot": "tooltip-content",
|
|
421
|
-
"data-variant": variant,
|
|
422
|
-
sideOffset,
|
|
423
|
-
...props,
|
|
424
|
-
children
|
|
425
|
-
}
|
|
426
|
-
) });
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// src/components/rich-editor.tsx
|
|
430
|
-
import { jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
431
|
-
var headingClasses = {
|
|
432
|
-
1: "text-size-body-md",
|
|
433
|
-
2: "text-size-title-lg",
|
|
434
|
-
3: "text-size-headline-lg"
|
|
435
|
-
};
|
|
436
|
-
function RichEditorRoot({
|
|
437
|
-
className,
|
|
438
|
-
editorOptions,
|
|
439
|
-
...props
|
|
440
|
-
}) {
|
|
441
|
-
const editor = useEditor({
|
|
442
|
-
...editorOptions,
|
|
443
|
-
extensions: [
|
|
444
|
-
StarterKit.configure({
|
|
445
|
-
bulletList: {
|
|
446
|
-
HTMLAttributes: {
|
|
447
|
-
class: "list-disc list-outside pl-large-1x"
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
orderedList: {
|
|
451
|
-
HTMLAttributes: {
|
|
452
|
-
class: "list-decimal list-outside pl-large-1x"
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
heading: false
|
|
456
|
-
}),
|
|
457
|
-
Placeholder.configure({
|
|
458
|
-
placeholder: ({ node, editor: editor2 }) => node.type.name === "paragraph" && editor2.isEmpty ? "Digite aqui\u2026" : "",
|
|
459
|
-
showOnlyWhenEditable: true,
|
|
460
|
-
includeChildren: false,
|
|
461
|
-
emptyNodeClass: "before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none"
|
|
462
|
-
}),
|
|
463
|
-
Heading.configure({
|
|
464
|
-
levels: [1, 2, 3]
|
|
465
|
-
}).extend({
|
|
466
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
467
|
-
const level = node.attrs.level ?? 1;
|
|
468
|
-
return [
|
|
469
|
-
"h",
|
|
470
|
-
{
|
|
471
|
-
...HTMLAttributes,
|
|
472
|
-
class: headingClasses[level]
|
|
473
|
-
},
|
|
474
|
-
0
|
|
475
|
-
];
|
|
476
|
-
}
|
|
477
|
-
}),
|
|
478
|
-
...editorOptions?.extensions ?? []
|
|
479
|
-
]
|
|
480
|
-
});
|
|
481
|
-
const value = useMemo(() => ({ editor }), [editor]);
|
|
482
|
-
return /* @__PURE__ */ jsx8(EditorContext.Provider, { value, children: /* @__PURE__ */ jsx8(
|
|
483
|
-
"div",
|
|
484
|
-
{
|
|
485
|
-
className: cx7("gap-small flex w-full flex-col", className),
|
|
486
|
-
"data-slot": "text-area-root",
|
|
487
|
-
...props
|
|
488
|
-
}
|
|
489
|
-
) });
|
|
490
|
-
}
|
|
491
|
-
function RichEditorContent({
|
|
492
|
-
className,
|
|
493
|
-
...props
|
|
494
|
-
}) {
|
|
495
|
-
return /* @__PURE__ */ jsx8(
|
|
496
|
-
"div",
|
|
497
|
-
{
|
|
498
|
-
className: cx7(
|
|
499
|
-
"bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent",
|
|
500
|
-
"hover:border-border-layer-2 transition-colors duration-200",
|
|
501
|
-
"[&_ul_ul]:list-[circle]",
|
|
502
|
-
"[&_ul_ul_ul]:list-[square]",
|
|
503
|
-
"[&_ol_ol]:list-[lower-alpha]",
|
|
504
|
-
"[&_ol_ol_ol]:list-[lower-roman]",
|
|
505
|
-
"gap-small flex flex-col overflow-x-hidden overflow-y-auto",
|
|
506
|
-
className
|
|
507
|
-
),
|
|
508
|
-
"data-slot": "text-area-content",
|
|
509
|
-
...props
|
|
510
|
-
}
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
function RichEditorCaption({
|
|
514
|
-
className,
|
|
515
|
-
...props
|
|
516
|
-
}) {
|
|
517
|
-
return /* @__PURE__ */ jsx8(
|
|
518
|
-
"p",
|
|
519
|
-
{
|
|
520
|
-
...props,
|
|
521
|
-
className: cx7(
|
|
522
|
-
"text-size-body-sm text-neutral-dark font-normal",
|
|
523
|
-
className
|
|
524
|
-
),
|
|
525
|
-
"data-slot": "text-area-caption"
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
function RichEditorAreaText({
|
|
530
|
-
className,
|
|
531
|
-
...props
|
|
532
|
-
}) {
|
|
533
|
-
const { editor } = useRichTextEditor();
|
|
534
|
-
return /* @__PURE__ */ jsx8(
|
|
535
|
-
EditorContent,
|
|
536
|
-
{
|
|
537
|
-
className: cx7(
|
|
538
|
-
"text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0",
|
|
539
|
-
className
|
|
540
|
-
),
|
|
541
|
-
editor,
|
|
542
|
-
...props
|
|
543
|
-
}
|
|
544
|
-
);
|
|
545
|
-
}
|
|
546
|
-
function RichEditorToolbar({
|
|
547
|
-
className,
|
|
548
|
-
...props
|
|
549
|
-
}) {
|
|
550
|
-
return /* @__PURE__ */ jsx8(
|
|
551
|
-
"div",
|
|
552
|
-
{
|
|
553
|
-
className: cx7(
|
|
554
|
-
"h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden",
|
|
555
|
-
className
|
|
556
|
-
),
|
|
557
|
-
"data-slot": "text-area-toolbar",
|
|
558
|
-
...props
|
|
559
|
-
}
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
function ToolbarButton({
|
|
563
|
-
appearance = "ghost",
|
|
564
|
-
variant = "secondary",
|
|
565
|
-
onMouseDown,
|
|
566
|
-
onPointerDown,
|
|
567
|
-
...props
|
|
568
|
-
}) {
|
|
569
|
-
return /* @__PURE__ */ jsx8(
|
|
570
|
-
Button,
|
|
571
|
-
{
|
|
572
|
-
appearance,
|
|
573
|
-
size: "icon_md",
|
|
574
|
-
tabIndex: -1,
|
|
575
|
-
type: "button",
|
|
576
|
-
variant,
|
|
577
|
-
onMouseDown: (e) => {
|
|
578
|
-
e.preventDefault();
|
|
579
|
-
onMouseDown?.(e);
|
|
580
|
-
},
|
|
581
|
-
onPointerDown: (e) => {
|
|
582
|
-
e.preventDefault();
|
|
583
|
-
onPointerDown?.(e);
|
|
584
|
-
},
|
|
585
|
-
...props
|
|
586
|
-
}
|
|
587
|
-
);
|
|
588
|
-
}
|
|
589
|
-
function ToggleButton({
|
|
590
|
-
name,
|
|
591
|
-
...props
|
|
592
|
-
}) {
|
|
593
|
-
const { editor } = useRichTextEditor();
|
|
594
|
-
const { shortcut } = useOS();
|
|
595
|
-
const isActive = useRichTextEditorState({
|
|
596
|
-
editor,
|
|
597
|
-
selector: (ctx) => ctx.editor?.isActive(name) ?? false
|
|
598
|
-
});
|
|
599
|
-
const icon = useMemo(() => {
|
|
600
|
-
const iconsMap = /* @__PURE__ */ new Map([
|
|
601
|
-
["bold", "format_bold"],
|
|
602
|
-
["italic", "format_italic"],
|
|
603
|
-
["underline", "format_underlined"],
|
|
604
|
-
["strike", "format_strikethrough"],
|
|
605
|
-
["bulletList", "format_list_bulleted"],
|
|
606
|
-
["orderedList", "format_list_numbered"],
|
|
607
|
-
["undo", "undo"],
|
|
608
|
-
["redo", "redo"]
|
|
609
|
-
]);
|
|
610
|
-
return iconsMap.get(name);
|
|
611
|
-
}, [name]);
|
|
612
|
-
const description = useMemo(() => {
|
|
613
|
-
const descriptionsMap = /* @__PURE__ */ new Map([
|
|
614
|
-
["bold", `Negrito (${shortcut} + B)`],
|
|
615
|
-
["italic", `It\xE1lico (${shortcut} + I)`],
|
|
616
|
-
["underline", `Sublinhado (${shortcut} + U)`],
|
|
617
|
-
["strike", `Tachado (${shortcut} + S)`],
|
|
618
|
-
["bulletList", `Lista (${shortcut} + Shift + 7)`],
|
|
619
|
-
["orderedList", `Lista numerada (${shortcut} + Shift + 8)`],
|
|
620
|
-
["undo", `Desfazer (${shortcut} + Z)`],
|
|
621
|
-
["redo", `Refazer (${shortcut} + Y)`]
|
|
622
|
-
]);
|
|
623
|
-
return descriptionsMap.get(name);
|
|
624
|
-
}, [name, shortcut]);
|
|
625
|
-
const handleToggle = useCallback(() => {
|
|
626
|
-
if (!editor) throw new Error("Editor not found");
|
|
627
|
-
const commandsMap = /* @__PURE__ */ new Map([
|
|
628
|
-
["bold", () => editor.chain().focus().toggleBold().run()],
|
|
629
|
-
["italic", () => editor.chain().focus().toggleItalic().run()],
|
|
630
|
-
["underline", () => editor.chain().focus().toggleUnderline().run()],
|
|
631
|
-
["strike", () => editor.chain().focus().toggleStrike().run()],
|
|
632
|
-
["bulletList", () => editor.chain().focus().toggleBulletList().run()],
|
|
633
|
-
["orderedList", () => editor.chain().focus().toggleOrderedList().run()],
|
|
634
|
-
["undo", () => editor.chain().focus().undo().run()],
|
|
635
|
-
["redo", () => editor.chain().focus().redo().run()]
|
|
636
|
-
]);
|
|
637
|
-
commandsMap.get(name)?.();
|
|
638
|
-
}, [editor, name]);
|
|
639
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
640
|
-
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
641
|
-
ToolbarButton,
|
|
642
|
-
{
|
|
643
|
-
onClick: handleToggle,
|
|
644
|
-
...isActive && { appearance: "solid" },
|
|
645
|
-
...props,
|
|
646
|
-
children: icon && /* @__PURE__ */ jsx8(Icon, { className: "text-icon-neutral-3", name: icon })
|
|
647
|
-
}
|
|
648
|
-
) }),
|
|
649
|
-
/* @__PURE__ */ jsx8(TooltipContent, { children: description && /* @__PURE__ */ jsx8(Typography, { size: "sm", children: description }) })
|
|
650
|
-
] });
|
|
651
|
-
}
|
|
652
|
-
function HeadingButton({
|
|
653
|
-
appearance = "ghost",
|
|
654
|
-
variant = "secondary",
|
|
655
|
-
...props
|
|
656
|
-
}) {
|
|
657
|
-
const [isOpen, setIsOpen] = useState2(false);
|
|
658
|
-
const { editor } = useRichTextEditor();
|
|
659
|
-
const isActive = useRichTextEditorState({
|
|
660
|
-
editor,
|
|
661
|
-
selector: (ctx) => ctx.editor?.isActive("heading") ?? false
|
|
662
|
-
});
|
|
663
|
-
const isLevelActive = useCallback(
|
|
664
|
-
(level) => {
|
|
665
|
-
if (!editor) throw new Error("Editor not found");
|
|
666
|
-
return editor.isActive("heading", { level });
|
|
667
|
-
},
|
|
668
|
-
[editor]
|
|
669
|
-
);
|
|
670
|
-
const toggleHeading = useCallback(
|
|
671
|
-
(level) => {
|
|
672
|
-
if (!editor) throw new Error("Editor not found");
|
|
673
|
-
setIsOpen(false);
|
|
674
|
-
setTimeout(() => {
|
|
675
|
-
editor.chain().focus().toggleHeading({ level }).run();
|
|
676
|
-
}, 0);
|
|
677
|
-
},
|
|
678
|
-
[editor]
|
|
679
|
-
);
|
|
680
|
-
const levels = [
|
|
681
|
-
{ level: 1, label: "Normal", className: headingClasses[1] },
|
|
682
|
-
{ level: 2, label: "Grande", className: headingClasses[2] },
|
|
683
|
-
{ level: 3, label: "Enorme", className: headingClasses[3] }
|
|
684
|
-
];
|
|
685
|
-
return /* @__PURE__ */ jsxs(DropdownMenuRoot, { open: isOpen, onOpenChange: (open) => setIsOpen(open), children: [
|
|
686
|
-
/* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
687
|
-
Button,
|
|
688
|
-
{
|
|
689
|
-
appearance: isActive ? "solid" : appearance,
|
|
690
|
-
size: "icon_md",
|
|
691
|
-
tabIndex: -1,
|
|
692
|
-
type: "button",
|
|
693
|
-
variant,
|
|
694
|
-
...props,
|
|
695
|
-
children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
696
|
-
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(Icon, { className: "text-icon-neutral-3", name: "format_size" }) }),
|
|
697
|
-
/* @__PURE__ */ jsx8(TooltipContent, { children: /* @__PURE__ */ jsx8(Typography, { size: "sm", children: "Tamanho" }) })
|
|
698
|
-
] })
|
|
699
|
-
}
|
|
700
|
-
) }),
|
|
701
|
-
/* @__PURE__ */ jsx8(DropdownMenuContent, { children: /* @__PURE__ */ jsx8(DropdownMenuList, { children: levels.map((level) => /* @__PURE__ */ jsx8(
|
|
702
|
-
DropdownMenuItem,
|
|
703
|
-
{
|
|
704
|
-
isActive: isLevelActive(level.level),
|
|
705
|
-
onPointerDown: () => toggleHeading(level.level),
|
|
706
|
-
children: /* @__PURE__ */ jsx8(DropdownMenuItemText, { className: level.className, children: level.label })
|
|
707
|
-
},
|
|
708
|
-
level.level
|
|
709
|
-
)) }) })
|
|
710
|
-
] });
|
|
711
|
-
}
|
|
712
|
-
export {
|
|
713
|
-
HeadingButton,
|
|
714
|
-
RichEditorAreaText,
|
|
715
|
-
RichEditorCaption,
|
|
716
|
-
RichEditorContent,
|
|
717
|
-
RichEditorRoot,
|
|
718
|
-
RichEditorToolbar,
|
|
719
|
-
ToggleButton,
|
|
720
|
-
ToolbarButton,
|
|
721
|
-
useRichTextEditor,
|
|
722
|
-
useRichTextEditorState
|
|
723
|
-
};
|
|
1
|
+
import {b as b$1,c as c$1,d}from'../chunk-NELCN6E2.js';import {a}from'../chunk-KS6WGBHQ.js';import {a as a$2,c as c$2,d as d$1,e,h,i}from'../chunk-RWMV7APX.js';import'../chunk-CBFC4QME.js';import'../chunk-KIFR5VIE.js';import {b}from'../chunk-FASEHVMD.js';import {a as a$1}from'../chunk-EIG6CBTQ.js';import {b as b$2}from'../chunk-SHHXKVVR.js';import {cx}from'@xjur-ui/util';import {useMemo,useCallback,useState}from'react';import {useEditor,EditorContext,useCurrentEditor,EditorContent,useEditorState}from'@tiptap/react';export{useCurrentEditor as useRichTextEditor,useEditorState as useRichTextEditorState}from'@tiptap/react';import {StarterKit}from'@tiptap/starter-kit';import {Heading}from'@tiptap/extension-heading';import {Placeholder}from'@tiptap/extension-placeholder';import {jsx,jsxs}from'react/jsx-runtime';var c={1:"text-size-body-md",2:"text-size-title-lg",3:"text-size-headline-lg"};function X({className:t,editorOptions:n,...r}){let i=useEditor({...n,extensions:[StarterKit.configure({bulletList:{HTMLAttributes:{class:"list-disc list-outside pl-large-1x"}},orderedList:{HTMLAttributes:{class:"list-decimal list-outside pl-large-1x"}},heading:false}),Placeholder.configure({placeholder:({node:o,editor:s})=>o.type.name==="paragraph"&&s.isEmpty?"Digite aqui\u2026":"",showOnlyWhenEditable:true,includeChildren:false,emptyNodeClass:"before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none"}),Heading.configure({levels:[1,2,3]}).extend({renderHTML({node:o,HTMLAttributes:s}){let u=o.attrs.level??1;return ["h",{...s,class:c[u]},0]}}),...n?.extensions??[]]}),a=useMemo(()=>({editor:i}),[i]);return jsx(EditorContext.Provider,{value:a,children:jsx("div",{className:cx("gap-small flex w-full flex-col",t),"data-slot":"text-area-root",...r})})}function j({className:t,...n}){return jsx("div",{className:cx("bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent","hover:border-border-layer-2 transition-colors duration-200","[&_ul_ul]:list-[circle]","[&_ul_ul_ul]:list-[square]","[&_ol_ol]:list-[lower-alpha]","[&_ol_ol_ol]:list-[lower-roman]","gap-small flex flex-col overflow-x-hidden overflow-y-auto",t),"data-slot":"text-area-content",...n})}function ee({className:t,...n}){return jsx("p",{...n,className:cx("text-size-body-sm text-neutral-dark font-normal",t),"data-slot":"text-area-caption"})}function te({className:t,...n}){let{editor:r}=useCurrentEditor();return jsx(EditorContent,{className:cx("text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0",t),editor:r,...n})}function oe({className:t,...n}){return jsx("div",{className:cx("h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden",t),"data-slot":"text-area-toolbar",...n})}function $({appearance:t="ghost",variant:n="secondary",onMouseDown:r,onPointerDown:i,...a}){return jsx(b,{appearance:t,size:"icon_md",tabIndex:-1,type:"button",variant:n,onMouseDown:o=>{o.preventDefault(),r?.(o);},onPointerDown:o=>{o.preventDefault(),i?.(o);},...a})}function re({name:t,...n}){let{editor:r}=useCurrentEditor(),{shortcut:i}=a(),a$2=useEditorState({editor:r,selector:d=>d.editor?.isActive(t)??false}),o=useMemo(()=>new Map([["bold","format_bold"],["italic","format_italic"],["underline","format_underlined"],["strike","format_strikethrough"],["bulletList","format_list_bulleted"],["orderedList","format_list_numbered"],["undo","undo"],["redo","redo"]]).get(t),[t]),s=useMemo(()=>new Map([["bold",`Negrito (${i} + B)`],["italic",`It\xE1lico (${i} + I)`],["underline",`Sublinhado (${i} + U)`],["strike",`Tachado (${i} + S)`],["bulletList",`Lista (${i} + Shift + 7)`],["orderedList",`Lista numerada (${i} + Shift + 8)`],["undo",`Desfazer (${i} + Z)`],["redo",`Refazer (${i} + Y)`]]).get(t),[t,i]),u=useCallback(()=>{if(!r)throw new Error("Editor not found");new Map([["bold",()=>r.chain().focus().toggleBold().run()],["italic",()=>r.chain().focus().toggleItalic().run()],["underline",()=>r.chain().focus().toggleUnderline().run()],["strike",()=>r.chain().focus().toggleStrike().run()],["bulletList",()=>r.chain().focus().toggleBulletList().run()],["orderedList",()=>r.chain().focus().toggleOrderedList().run()],["undo",()=>r.chain().focus().undo().run()],["redo",()=>r.chain().focus().redo().run()]]).get(t)?.();},[r,t]);return jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx($,{onClick:u,...a$2&&{appearance:"solid"},...n,children:o&&jsx(b$2,{className:"text-icon-neutral-3",name:o})})}),jsx(d,{children:s&&jsx(a$1,{size:"sm",children:s})})]})}function ne({appearance:t="ghost",variant:n="secondary",...r}){let[i$1,a]=useState(false),{editor:o}=useCurrentEditor(),s=useEditorState({editor:o,selector:l=>l.editor?.isActive("heading")??false}),u=useCallback(l=>{if(!o)throw new Error("Editor not found");return o.isActive("heading",{level:l})},[o]),d$2=useCallback(l=>{if(!o)throw new Error("Editor not found");a(false),setTimeout(()=>{o.chain().focus().toggleHeading({level:l}).run();},0);},[o]),P=[{level:1,label:"Normal",className:c[1]},{level:2,label:"Grande",className:c[2]},{level:3,label:"Enorme",className:c[3]}];return jsxs(a$2,{open:i$1,onOpenChange:l=>a(l),children:[jsx(c$2,{asChild:true,children:jsx(b,{appearance:s?"solid":t,size:"icon_md",tabIndex:-1,type:"button",variant:n,...r,children:jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{className:"text-icon-neutral-3",name:"format_size"})}),jsx(d,{children:jsx(a$1,{size:"sm",children:"Tamanho"})})]})})}),jsx(d$1,{children:jsx(e,{children:P.map(l=>jsx(h,{isActive:u(l.level),onPointerDown:()=>d$2(l.level),children:jsx(i,{className:l.className,children:l.label})},l.level))})})]})}export{ne as HeadingButton,te as RichEditorAreaText,ee as RichEditorCaption,j as RichEditorContent,X as RichEditorRoot,oe as RichEditorToolbar,re as ToggleButton,$ as ToolbarButton};//# sourceMappingURL=rich-editor.js.map
|
|
2
|
+
//# sourceMappingURL=rich-editor.js.map
|