@aircall/ds 0.31.4 → 0.33.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/dist/globals.css +1 -1
- package/dist/index.d.ts +437 -192
- package/dist/index.js +1660 -287
- package/dist/theme.css +28 -0
- package/package.json +14 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createContext, useCallback, useContext, useSyncExternalStore } from "re
|
|
|
3
3
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
6
|
-
import { ArrowDownToLine, ArrowLeft, ArrowRight, Backward10, CalendarDaysIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlert, CircleAlertIcon, CircleCheck, FLAGS, FastForward, FlagUs, Forward10, Info, Loader2Icon, Minus, MinusIcon, MoreHorizontalIcon, PanelLeftIcon, Pause, Play, Plus, PlusIcon, Rewind, RotateCcw, Search, Smile, TriangleAlertIcon, XIcon } from "@aircall/react-icons";
|
|
6
|
+
import { ArrowDownToLine, ArrowLeft, ArrowRight, Backward10, Bold, CalendarDaysIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlert, CircleAlertIcon, CircleCheck, Code, ExternalLink, FLAGS, FastForward, FlagUs, Forward10, Info, Italic, Link, List as List$1, ListOrdered, Loader2Icon, Minus, MinusIcon, MoreHorizontalIcon, PanelLeftIcon, Pause, Play, Plus, PlusIcon, Rewind, RotateCcw, Search, Smile, Strikethrough, Text, TriangleAlertIcon, Underline, Unlink, XIcon } from "@aircall/react-icons";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
9
9
|
import { cva } from "class-variance-authority";
|
|
@@ -40,13 +40,30 @@ import { PreviewCard } from "@base-ui/react/preview-card";
|
|
|
40
40
|
import { NumberField } from "@base-ui/react/number-field";
|
|
41
41
|
import { OTPInput, OTPInputContext } from "input-otp";
|
|
42
42
|
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
43
|
+
import { BoldRules, CodeRules, ItalicRules, StrikethroughRules } from "@platejs/basic-nodes";
|
|
44
|
+
import { BasicMarksPlugin, BoldPlugin, CodePlugin, ItalicPlugin, StrikethroughPlugin } from "@platejs/basic-nodes/react";
|
|
45
|
+
import { filterWords, withTriggerCombobox } from "@platejs/combobox";
|
|
46
|
+
import { IndentPlugin } from "@platejs/indent/react";
|
|
47
|
+
import { LinkRules, getLinkAttributes, upsertLink, validateUrl } from "@platejs/link";
|
|
48
|
+
import { FloatingLinkUrlInput, LinkPlugin, useFloatingLinkEdit, useFloatingLinkEditState, useFloatingLinkInsert, useFloatingLinkInsertState, useLinkToolbarButton, useLinkToolbarButtonState } from "@platejs/link/react";
|
|
49
|
+
import { ListPlugin, useListToolbarButton, useListToolbarButtonState } from "@platejs/list/react";
|
|
50
|
+
import { MarkdownPlugin } from "@platejs/markdown";
|
|
51
|
+
import { getMentionOnSelectItem } from "@platejs/mention";
|
|
52
|
+
import { MentionInputPlugin, MentionPlugin } from "@platejs/mention/react";
|
|
53
|
+
import { SlashInputPlugin, SlashPlugin } from "@platejs/slash-command/react";
|
|
54
|
+
import { KEYS, createSlatePlugin, createTSlatePlugin } from "platejs";
|
|
55
|
+
import { Plate, PlateContent, PlateElement, createPlatePlugin, toPlatePlugin, useComposedRef, useEditorId, useEditorReadOnly, useEditorRef, useEditorSelection, useEventEditorValue, useFocused, useMarkToolbarButton, useMarkToolbarButtonState, usePlateEditor, usePluginOption, useReadOnly, useSelected } from "platejs/react";
|
|
56
|
+
import remarkGfm from "remark-gfm";
|
|
57
|
+
import { Combobox as Combobox$2, ComboboxGroup as ComboboxGroup$1, ComboboxItem as ComboboxItem$1, ComboboxPopover, ComboboxProvider, Portal, useComboboxContext, useComboboxStore, useStoreState } from "@ariakit/react";
|
|
58
|
+
import { useComboboxInput, useHTMLInputCursorState } from "@platejs/combobox/react";
|
|
59
|
+
import { flip, offset, shift, useFloatingToolbar, useFloatingToolbarState } from "@platejs/floating";
|
|
60
|
+
import { ListStyleType } from "@platejs/list";
|
|
61
|
+
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
43
62
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
44
63
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
45
64
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
46
65
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
47
|
-
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
48
66
|
import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
|
|
49
|
-
|
|
50
67
|
//#region src/lib/utils.ts
|
|
51
68
|
const DS_COLORS = [
|
|
52
69
|
"background",
|
|
@@ -107,7 +124,6 @@ const twMerge = extendTailwindMerge({ extend: { theme: {
|
|
|
107
124
|
function cn(...inputs) {
|
|
108
125
|
return twMerge(clsx(inputs));
|
|
109
126
|
}
|
|
110
|
-
|
|
111
127
|
//#endregion
|
|
112
128
|
//#region src/components/accordion.tsx
|
|
113
129
|
/**
|
|
@@ -196,7 +212,6 @@ const AccordionContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
196
212
|
});
|
|
197
213
|
});
|
|
198
214
|
AccordionContent.displayName = "AccordionContent";
|
|
199
|
-
|
|
200
215
|
//#endregion
|
|
201
216
|
//#region src/components/button.tsx
|
|
202
217
|
/** Tailwind class string for link-styled buttons and anchors (primary color, underlined). */
|
|
@@ -253,7 +268,6 @@ const Button = React.forwardRef((componentProps, forwardRef) => {
|
|
|
253
268
|
});
|
|
254
269
|
});
|
|
255
270
|
Button.displayName = "Button";
|
|
256
|
-
|
|
257
271
|
//#endregion
|
|
258
272
|
//#region src/i18n/locales/de.ts
|
|
259
273
|
const de = {
|
|
@@ -285,10 +299,23 @@ const de = {
|
|
|
285
299
|
"datePicker.beforeMin": "Das Datum liegt vor dem frühesten verfügbaren Datum ({{date}})",
|
|
286
300
|
"datePicker.afterMax": "Das Datum liegt nach dem spätesten verfügbaren Datum ({{date}})",
|
|
287
301
|
"datePicker.unavailable": "Dieses Datum ist nicht verfügbar",
|
|
288
|
-
"datePicker.rangeOrder": "Das Startdatum muss vor oder gleich dem Enddatum sein"
|
|
302
|
+
"datePicker.rangeOrder": "Das Startdatum muss vor oder gleich dem Enddatum sein",
|
|
303
|
+
"richTextarea.noResults": "Keine Ergebnisse",
|
|
304
|
+
"richTextarea.slashNoCommands": "Keine Befehle",
|
|
305
|
+
"richTextarea.bold": "Fett",
|
|
306
|
+
"richTextarea.italic": "Kursiv",
|
|
307
|
+
"richTextarea.underline": "Unterstrichen",
|
|
308
|
+
"richTextarea.strikethrough": "Durchgestrichen",
|
|
309
|
+
"richTextarea.inlineCode": "Inline-Code",
|
|
310
|
+
"richTextarea.bulletedList": "Aufzählungsliste",
|
|
311
|
+
"richTextarea.numberedList": "Nummerierte Liste",
|
|
312
|
+
"richTextarea.link": "Link",
|
|
313
|
+
"richTextarea.linkPlaceholder": "Link einfügen",
|
|
314
|
+
"richTextarea.linkText": "Anzuzeigender Text",
|
|
315
|
+
"richTextarea.linkEdit": "Link bearbeiten",
|
|
316
|
+
"richTextarea.linkOpen": "Link in neuem Tab öffnen",
|
|
317
|
+
"richTextarea.linkRemove": "Link entfernen"
|
|
289
318
|
};
|
|
290
|
-
var de_default = de;
|
|
291
|
-
|
|
292
319
|
//#endregion
|
|
293
320
|
//#region src/i18n/locales/en.ts
|
|
294
321
|
const en = {
|
|
@@ -320,10 +347,23 @@ const en = {
|
|
|
320
347
|
"datePicker.beforeMin": "Date is before the earliest available date ({{date}})",
|
|
321
348
|
"datePicker.afterMax": "Date is after the latest available date ({{date}})",
|
|
322
349
|
"datePicker.unavailable": "That date isn't available",
|
|
323
|
-
"datePicker.rangeOrder": "Start date must be on or before the end date"
|
|
350
|
+
"datePicker.rangeOrder": "Start date must be on or before the end date",
|
|
351
|
+
"richTextarea.noResults": "No results",
|
|
352
|
+
"richTextarea.slashNoCommands": "No commands",
|
|
353
|
+
"richTextarea.bold": "Bold",
|
|
354
|
+
"richTextarea.italic": "Italic",
|
|
355
|
+
"richTextarea.underline": "Underline",
|
|
356
|
+
"richTextarea.strikethrough": "Strikethrough",
|
|
357
|
+
"richTextarea.inlineCode": "Inline code",
|
|
358
|
+
"richTextarea.bulletedList": "Bulleted list",
|
|
359
|
+
"richTextarea.numberedList": "Numbered list",
|
|
360
|
+
"richTextarea.link": "Link",
|
|
361
|
+
"richTextarea.linkPlaceholder": "Paste link",
|
|
362
|
+
"richTextarea.linkText": "Text to display",
|
|
363
|
+
"richTextarea.linkEdit": "Edit link",
|
|
364
|
+
"richTextarea.linkOpen": "Open link in a new tab",
|
|
365
|
+
"richTextarea.linkRemove": "Remove link"
|
|
324
366
|
};
|
|
325
|
-
var en_default = en;
|
|
326
|
-
|
|
327
367
|
//#endregion
|
|
328
368
|
//#region src/i18n/locales/es.ts
|
|
329
369
|
const es = {
|
|
@@ -355,10 +395,23 @@ const es = {
|
|
|
355
395
|
"datePicker.beforeMin": "La fecha es anterior a la fecha más antigua disponible ({{date}})",
|
|
356
396
|
"datePicker.afterMax": "La fecha es posterior a la fecha más reciente disponible ({{date}})",
|
|
357
397
|
"datePicker.unavailable": "Esa fecha no está disponible",
|
|
358
|
-
"datePicker.rangeOrder": "La fecha de inicio debe ser anterior o igual a la fecha de fin"
|
|
398
|
+
"datePicker.rangeOrder": "La fecha de inicio debe ser anterior o igual a la fecha de fin",
|
|
399
|
+
"richTextarea.noResults": "Sin resultados",
|
|
400
|
+
"richTextarea.slashNoCommands": "Sin comandos",
|
|
401
|
+
"richTextarea.bold": "Negrita",
|
|
402
|
+
"richTextarea.italic": "Cursiva",
|
|
403
|
+
"richTextarea.underline": "Subrayado",
|
|
404
|
+
"richTextarea.strikethrough": "Tachado",
|
|
405
|
+
"richTextarea.inlineCode": "Código en línea",
|
|
406
|
+
"richTextarea.bulletedList": "Lista con viñetas",
|
|
407
|
+
"richTextarea.numberedList": "Lista numerada",
|
|
408
|
+
"richTextarea.link": "Enlace",
|
|
409
|
+
"richTextarea.linkPlaceholder": "Pegar enlace",
|
|
410
|
+
"richTextarea.linkText": "Texto para mostrar",
|
|
411
|
+
"richTextarea.linkEdit": "Editar enlace",
|
|
412
|
+
"richTextarea.linkOpen": "Abrir enlace en una pestaña nueva",
|
|
413
|
+
"richTextarea.linkRemove": "Eliminar enlace"
|
|
359
414
|
};
|
|
360
|
-
var es_default = es;
|
|
361
|
-
|
|
362
415
|
//#endregion
|
|
363
416
|
//#region src/i18n/locales/fr.ts
|
|
364
417
|
const fr = {
|
|
@@ -390,10 +443,23 @@ const fr = {
|
|
|
390
443
|
"datePicker.beforeMin": "La date est antérieure à la date la plus ancienne disponible ({{date}})",
|
|
391
444
|
"datePicker.afterMax": "La date est postérieure à la date la plus récente disponible ({{date}})",
|
|
392
445
|
"datePicker.unavailable": "Cette date n'est pas disponible",
|
|
393
|
-
"datePicker.rangeOrder": "La date de debut doit etre anterieure ou egale a la date de fin"
|
|
446
|
+
"datePicker.rangeOrder": "La date de debut doit etre anterieure ou egale a la date de fin",
|
|
447
|
+
"richTextarea.noResults": "Aucun résultat",
|
|
448
|
+
"richTextarea.slashNoCommands": "Aucune commande",
|
|
449
|
+
"richTextarea.bold": "Gras",
|
|
450
|
+
"richTextarea.italic": "Italique",
|
|
451
|
+
"richTextarea.underline": "Souligné",
|
|
452
|
+
"richTextarea.strikethrough": "Barré",
|
|
453
|
+
"richTextarea.inlineCode": "Code en ligne",
|
|
454
|
+
"richTextarea.bulletedList": "Liste à puces",
|
|
455
|
+
"richTextarea.numberedList": "Liste numérotée",
|
|
456
|
+
"richTextarea.link": "Lien",
|
|
457
|
+
"richTextarea.linkPlaceholder": "Coller le lien",
|
|
458
|
+
"richTextarea.linkText": "Texte à afficher",
|
|
459
|
+
"richTextarea.linkEdit": "Modifier le lien",
|
|
460
|
+
"richTextarea.linkOpen": "Ouvrir le lien dans un nouvel onglet",
|
|
461
|
+
"richTextarea.linkRemove": "Supprimer le lien"
|
|
394
462
|
};
|
|
395
|
-
var fr_default = fr;
|
|
396
|
-
|
|
397
463
|
//#endregion
|
|
398
464
|
//#region src/i18n/locales/it.ts
|
|
399
465
|
const it = {
|
|
@@ -425,10 +491,23 @@ const it = {
|
|
|
425
491
|
"datePicker.beforeMin": "La data è precedente alla prima data disponibile ({{date}})",
|
|
426
492
|
"datePicker.afterMax": "La data è successiva all'ultima data disponibile ({{date}})",
|
|
427
493
|
"datePicker.unavailable": "Questa data non è disponibile",
|
|
428
|
-
"datePicker.rangeOrder": "La data di inizio deve essere precedente o uguale alla data di fine"
|
|
494
|
+
"datePicker.rangeOrder": "La data di inizio deve essere precedente o uguale alla data di fine",
|
|
495
|
+
"richTextarea.noResults": "Nessun risultato",
|
|
496
|
+
"richTextarea.slashNoCommands": "Nessun comando",
|
|
497
|
+
"richTextarea.bold": "Grassetto",
|
|
498
|
+
"richTextarea.italic": "Corsivo",
|
|
499
|
+
"richTextarea.underline": "Sottolineato",
|
|
500
|
+
"richTextarea.strikethrough": "Barrato",
|
|
501
|
+
"richTextarea.inlineCode": "Codice inline",
|
|
502
|
+
"richTextarea.bulletedList": "Elenco puntato",
|
|
503
|
+
"richTextarea.numberedList": "Elenco numerato",
|
|
504
|
+
"richTextarea.link": "Collegamento",
|
|
505
|
+
"richTextarea.linkPlaceholder": "Incolla il link",
|
|
506
|
+
"richTextarea.linkText": "Testo da visualizzare",
|
|
507
|
+
"richTextarea.linkEdit": "Modifica link",
|
|
508
|
+
"richTextarea.linkOpen": "Apri il link in una nuova scheda",
|
|
509
|
+
"richTextarea.linkRemove": "Rimuovi link"
|
|
429
510
|
};
|
|
430
|
-
var it_default = it;
|
|
431
|
-
|
|
432
511
|
//#endregion
|
|
433
512
|
//#region src/i18n/instance.ts
|
|
434
513
|
const SUPPORTED_LANGUAGES = [
|
|
@@ -455,11 +534,11 @@ dsI18n.init({
|
|
|
455
534
|
ns: ["ds"],
|
|
456
535
|
defaultNS: "ds",
|
|
457
536
|
resources: {
|
|
458
|
-
en: { ds:
|
|
459
|
-
fr: { ds:
|
|
460
|
-
es: { ds:
|
|
461
|
-
de: { ds:
|
|
462
|
-
it: { ds:
|
|
537
|
+
en: { ds: en },
|
|
538
|
+
fr: { ds: fr },
|
|
539
|
+
es: { ds: es },
|
|
540
|
+
de: { ds: de },
|
|
541
|
+
it: { ds: it }
|
|
463
542
|
},
|
|
464
543
|
interpolation: { escapeValue: false },
|
|
465
544
|
keySeparator: false,
|
|
@@ -470,7 +549,6 @@ dsI18n.init({
|
|
|
470
549
|
function registerI18nNamespace(ns, resources) {
|
|
471
550
|
for (const [lng, bundle] of Object.entries(resources)) dsI18n.addResourceBundle(lng, ns, bundle, true, true);
|
|
472
551
|
}
|
|
473
|
-
|
|
474
552
|
//#endregion
|
|
475
553
|
//#region src/i18n/use-ds-translation.ts
|
|
476
554
|
function subscribe(onChange) {
|
|
@@ -486,12 +564,12 @@ function getLanguageSnapshot() {
|
|
|
486
564
|
* Used by @aircall/ds and @aircall/blocks components only — not part of the consumer contract.
|
|
487
565
|
*/
|
|
488
566
|
function useDsTranslation(ns) {
|
|
567
|
+
const language = useSyncExternalStore(subscribe, getLanguageSnapshot, getLanguageSnapshot);
|
|
489
568
|
return useCallback((key, opts) => dsI18n.t(key, {
|
|
490
569
|
ns,
|
|
491
570
|
...opts
|
|
492
|
-
}), [ns,
|
|
571
|
+
}), [ns, language]);
|
|
493
572
|
}
|
|
494
|
-
|
|
495
573
|
//#endregion
|
|
496
574
|
//#region src/components/action-bar.tsx
|
|
497
575
|
/** Fixed height of the ActionBar (px). Single source of truth — the bar uses it
|
|
@@ -541,7 +619,7 @@ const ActionBar = React.forwardRef((componentProps, forwardRef) => {
|
|
|
541
619
|
className: cn("relative flex w-full items-center gap-2 rounded-md border border-border bg-popover px-2 text-popover-foreground shadow-lg", className),
|
|
542
620
|
style: {
|
|
543
621
|
...style,
|
|
544
|
-
height:
|
|
622
|
+
height: 48
|
|
545
623
|
},
|
|
546
624
|
...props,
|
|
547
625
|
children: [
|
|
@@ -563,7 +641,6 @@ const ActionBar = React.forwardRef((componentProps, forwardRef) => {
|
|
|
563
641
|
});
|
|
564
642
|
});
|
|
565
643
|
ActionBar.displayName = "ActionBar";
|
|
566
|
-
|
|
567
644
|
//#endregion
|
|
568
645
|
//#region src/components/spinner.tsx
|
|
569
646
|
/** Class variants for `Spinner`, controlling its `size` (`default`, `sm`, `lg`, `xl`). */
|
|
@@ -598,7 +675,6 @@ const Spinner = React.forwardRef((componentProps, forwardRef) => {
|
|
|
598
675
|
});
|
|
599
676
|
});
|
|
600
677
|
Spinner.displayName = "Spinner";
|
|
601
|
-
|
|
602
678
|
//#endregion
|
|
603
679
|
//#region src/components/audio-player.tsx
|
|
604
680
|
const AudioPlayerContext = React.createContext(null);
|
|
@@ -770,9 +846,9 @@ function Audio({ src, defaultPlaybackRate = 1, preload = "metadata", crossOrigin
|
|
|
770
846
|
} catch {}
|
|
771
847
|
if (item === void 0 || item !== null && item?.src === activeItem?.src) {
|
|
772
848
|
managerRef.current?.register(audio);
|
|
773
|
-
const p
|
|
774
|
-
playPromiseRef.current = p
|
|
775
|
-
return p
|
|
849
|
+
const p = audio.play();
|
|
850
|
+
playPromiseRef.current = p;
|
|
851
|
+
return p;
|
|
776
852
|
}
|
|
777
853
|
swapSrc(item);
|
|
778
854
|
if (item == null) return;
|
|
@@ -805,7 +881,7 @@ function Audio({ src, defaultPlaybackRate = 1, preload = "metadata", crossOrigin
|
|
|
805
881
|
const setPlaybackRate = React.useCallback((rate) => {
|
|
806
882
|
setPlaybackRateState(rate);
|
|
807
883
|
}, []);
|
|
808
|
-
const isItemActive = React.useCallback((src
|
|
884
|
+
const isItemActive = React.useCallback((src) => src != null && activeItem?.src === src, [activeItem]);
|
|
809
885
|
const ctx = React.useMemo(() => ({
|
|
810
886
|
audioRef,
|
|
811
887
|
activeItem,
|
|
@@ -1092,7 +1168,8 @@ const AudioPlayerSpeed = React.forwardRef(function AudioPlayerSpeed({ speeds = D
|
|
|
1092
1168
|
function handleClick(event) {
|
|
1093
1169
|
onClick?.(event);
|
|
1094
1170
|
if (event.defaultPrevented) return;
|
|
1095
|
-
|
|
1171
|
+
const next = speeds[(speeds.indexOf(playbackRate) + 1) % speeds.length] ?? speeds[0];
|
|
1172
|
+
setPlaybackRate(next);
|
|
1096
1173
|
}
|
|
1097
1174
|
const label = `${Number.isInteger(playbackRate) ? playbackRate.toFixed(1) : playbackRate}x`;
|
|
1098
1175
|
const buttonSize = resolvedVariant === "default" ? "default" : "sm";
|
|
@@ -1125,7 +1202,8 @@ const AudioPlayerSkip = React.forwardRef(function AudioPlayerSkip({ offset, rend
|
|
|
1125
1202
|
function handleClick(event) {
|
|
1126
1203
|
onClick?.(event);
|
|
1127
1204
|
if (event.defaultPrevented) return;
|
|
1128
|
-
|
|
1205
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
1206
|
+
seek(current + offset);
|
|
1129
1207
|
}
|
|
1130
1208
|
return useRender({
|
|
1131
1209
|
defaultTagName: "button",
|
|
@@ -1180,7 +1258,6 @@ function AudioPlayerManager({ children }) {
|
|
|
1180
1258
|
children
|
|
1181
1259
|
});
|
|
1182
1260
|
}
|
|
1183
|
-
|
|
1184
1261
|
//#endregion
|
|
1185
1262
|
//#region src/components/alert-dialog.tsx
|
|
1186
1263
|
/**
|
|
@@ -1378,7 +1455,6 @@ const AlertDialogCancel = React.forwardRef((componentProps, forwardRef) => {
|
|
|
1378
1455
|
});
|
|
1379
1456
|
});
|
|
1380
1457
|
AlertDialogCancel.displayName = "AlertDialogCancel";
|
|
1381
|
-
|
|
1382
1458
|
//#endregion
|
|
1383
1459
|
//#region src/components/alert.tsx
|
|
1384
1460
|
/**
|
|
@@ -1484,7 +1560,6 @@ const AlertAction = React.forwardRef((componentProps, forwardRef) => {
|
|
|
1484
1560
|
});
|
|
1485
1561
|
});
|
|
1486
1562
|
AlertAction.displayName = "AlertAction";
|
|
1487
|
-
|
|
1488
1563
|
//#endregion
|
|
1489
1564
|
//#region src/components/attachment.tsx
|
|
1490
1565
|
const attachmentVariants = cva("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
|
|
@@ -1685,7 +1760,6 @@ const AttachmentGroup = React.forwardRef((componentProps, forwardRef) => {
|
|
|
1685
1760
|
});
|
|
1686
1761
|
});
|
|
1687
1762
|
AttachmentGroup.displayName = "AttachmentGroup";
|
|
1688
|
-
|
|
1689
1763
|
//#endregion
|
|
1690
1764
|
//#region src/components/avatar.tsx
|
|
1691
1765
|
/**
|
|
@@ -1791,7 +1865,6 @@ const AvatarGroupCount = React.forwardRef((componentProps, forwardRef) => {
|
|
|
1791
1865
|
});
|
|
1792
1866
|
});
|
|
1793
1867
|
AvatarGroupCount.displayName = "AvatarGroupCount";
|
|
1794
|
-
|
|
1795
1868
|
//#endregion
|
|
1796
1869
|
//#region src/components/counter-badge.tsx
|
|
1797
1870
|
/**
|
|
@@ -1833,7 +1906,6 @@ const CounterBadge = React.forwardRef((componentProps, forwardRef) => {
|
|
|
1833
1906
|
});
|
|
1834
1907
|
});
|
|
1835
1908
|
CounterBadge.displayName = "CounterBadge";
|
|
1836
|
-
|
|
1837
1909
|
//#endregion
|
|
1838
1910
|
//#region src/components/badge.tsx
|
|
1839
1911
|
const OVERLAY_DARK = "bg-[linear-gradient(0deg,var(--badge-film-10)_0%,var(--badge-film-10)_100%)]";
|
|
@@ -2149,7 +2221,6 @@ const FALLBACK_TAG_COLOR = {
|
|
|
2149
2221
|
function resolveTagColor(hex) {
|
|
2150
2222
|
return LEGACY_TAG_COLOR_MAP[hex.trim().toLowerCase()] ?? FALLBACK_TAG_COLOR;
|
|
2151
2223
|
}
|
|
2152
|
-
|
|
2153
2224
|
//#endregion
|
|
2154
2225
|
//#region src/components/banner.tsx
|
|
2155
2226
|
/**
|
|
@@ -2207,7 +2278,6 @@ const Banner = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2207
2278
|
});
|
|
2208
2279
|
});
|
|
2209
2280
|
Banner.displayName = "Banner";
|
|
2210
|
-
|
|
2211
2281
|
//#endregion
|
|
2212
2282
|
//#region src/components/notification-queue.tsx
|
|
2213
2283
|
const PRIORITY_WEIGHT = {
|
|
@@ -2261,7 +2331,7 @@ function reducer(state, action) {
|
|
|
2261
2331
|
if (state.dismissed.has(key)) return state;
|
|
2262
2332
|
return {
|
|
2263
2333
|
...state,
|
|
2264
|
-
dismissed: new Set([...state.dismissed, key])
|
|
2334
|
+
dismissed: /* @__PURE__ */ new Set([...state.dismissed, key])
|
|
2265
2335
|
};
|
|
2266
2336
|
}
|
|
2267
2337
|
}
|
|
@@ -2405,7 +2475,6 @@ const NotificationSlot = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2405
2475
|
});
|
|
2406
2476
|
});
|
|
2407
2477
|
NotificationSlot.displayName = "NotificationSlot";
|
|
2408
|
-
|
|
2409
2478
|
//#endregion
|
|
2410
2479
|
//#region src/components/separator.tsx
|
|
2411
2480
|
/**
|
|
@@ -2431,7 +2500,6 @@ const Separator = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2431
2500
|
});
|
|
2432
2501
|
});
|
|
2433
2502
|
Separator.displayName = "Separator";
|
|
2434
|
-
|
|
2435
2503
|
//#endregion
|
|
2436
2504
|
//#region src/components/button-group.tsx
|
|
2437
2505
|
/** `cva` variant definitions for {@link ButtonGroup} — resolves `orientation` (horizontal / vertical) into class names. */
|
|
@@ -2498,7 +2566,6 @@ const ButtonGroupSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2498
2566
|
});
|
|
2499
2567
|
});
|
|
2500
2568
|
ButtonGroupSeparator.displayName = "ButtonGroupSeparator";
|
|
2501
|
-
|
|
2502
2569
|
//#endregion
|
|
2503
2570
|
//#region src/components/select.tsx
|
|
2504
2571
|
/** `class-variance-authority` variants for the select trigger; exposes the `size` variant. */
|
|
@@ -2584,7 +2651,8 @@ const SelectContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2584
2651
|
align,
|
|
2585
2652
|
alignOffset,
|
|
2586
2653
|
alignItemWithTrigger,
|
|
2587
|
-
|
|
2654
|
+
"data-slot": "select-positioner",
|
|
2655
|
+
className: "isolate z-popup",
|
|
2588
2656
|
children: /* @__PURE__ */ jsxs(Select$1.Popup, {
|
|
2589
2657
|
ref: forwardRef,
|
|
2590
2658
|
"data-slot": "select-content",
|
|
@@ -2680,7 +2748,6 @@ const SelectScrollDownButton = React.forwardRef((componentProps, forwardRef) =>
|
|
|
2680
2748
|
});
|
|
2681
2749
|
});
|
|
2682
2750
|
SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
2683
|
-
|
|
2684
2751
|
//#endregion
|
|
2685
2752
|
//#region src/components/calendar.tsx
|
|
2686
2753
|
/**
|
|
@@ -2708,13 +2775,15 @@ SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
|
2708
2775
|
* `options` array that react-day-picker passes for month/year values.
|
|
2709
2776
|
*/
|
|
2710
2777
|
function CalendarDropdown({ options, value, onChange, disabled, "aria-label": ariaLabel, className, components: _components, classNames: _classNames }) {
|
|
2778
|
+
const currentValue = value !== void 0 ? String(value) : void 0;
|
|
2779
|
+
const itemsMap = React.useMemo(() => {
|
|
2780
|
+
if (!options) return {};
|
|
2781
|
+
return Object.fromEntries(options.map((o) => [String(o.value), String(o.label)]));
|
|
2782
|
+
}, [options]);
|
|
2711
2783
|
return /* @__PURE__ */ jsxs(Select, {
|
|
2712
|
-
value:
|
|
2784
|
+
value: currentValue,
|
|
2713
2785
|
disabled,
|
|
2714
|
-
items:
|
|
2715
|
-
if (!options) return {};
|
|
2716
|
-
return Object.fromEntries(options.map((o) => [String(o.value), String(o.label)]));
|
|
2717
|
-
}, [options]),
|
|
2786
|
+
items: itemsMap,
|
|
2718
2787
|
modal: false,
|
|
2719
2788
|
onValueChange: (newValue) => {
|
|
2720
2789
|
if (onChange) {
|
|
@@ -2907,7 +2976,6 @@ function CalendarDayButton({ className: dayClassName, day, modifiers, locale, ..
|
|
|
2907
2976
|
...props
|
|
2908
2977
|
});
|
|
2909
2978
|
}
|
|
2910
|
-
|
|
2911
2979
|
//#endregion
|
|
2912
2980
|
//#region src/components/card.tsx
|
|
2913
2981
|
/**
|
|
@@ -3019,7 +3087,6 @@ const CardFooter = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3019
3087
|
});
|
|
3020
3088
|
});
|
|
3021
3089
|
CardFooter.displayName = "CardFooter";
|
|
3022
|
-
|
|
3023
3090
|
//#endregion
|
|
3024
3091
|
//#region src/components/carousel.tsx
|
|
3025
3092
|
const CarouselContext = React.createContext(null);
|
|
@@ -3052,10 +3119,10 @@ const Carousel = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3052
3119
|
}, plugins);
|
|
3053
3120
|
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
3054
3121
|
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
3055
|
-
const onSelect = React.useCallback((api
|
|
3056
|
-
if (!api
|
|
3057
|
-
setCanScrollPrev(api
|
|
3058
|
-
setCanScrollNext(api
|
|
3122
|
+
const onSelect = React.useCallback((api) => {
|
|
3123
|
+
if (!api) return;
|
|
3124
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
3125
|
+
setCanScrollNext(api.canScrollNext());
|
|
3059
3126
|
}, []);
|
|
3060
3127
|
const scrollPrev = React.useCallback(() => {
|
|
3061
3128
|
api?.scrollPrev();
|
|
@@ -3191,7 +3258,6 @@ const CarouselNext = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3191
3258
|
});
|
|
3192
3259
|
});
|
|
3193
3260
|
CarouselNext.displayName = "CarouselNext";
|
|
3194
|
-
|
|
3195
3261
|
//#endregion
|
|
3196
3262
|
//#region src/components/checkbox.tsx
|
|
3197
3263
|
/**
|
|
@@ -3220,7 +3286,6 @@ const Checkbox = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3220
3286
|
});
|
|
3221
3287
|
});
|
|
3222
3288
|
Checkbox.displayName = "Checkbox";
|
|
3223
|
-
|
|
3224
3289
|
//#endregion
|
|
3225
3290
|
//#region src/components/chip.tsx
|
|
3226
3291
|
const chipGlowVariants = cva("", {
|
|
@@ -3326,7 +3391,6 @@ const Chip = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3326
3391
|
});
|
|
3327
3392
|
});
|
|
3328
3393
|
Chip.displayName = "Chip";
|
|
3329
|
-
|
|
3330
3394
|
//#endregion
|
|
3331
3395
|
//#region src/components/collapsible.tsx
|
|
3332
3396
|
/**
|
|
@@ -3376,7 +3440,6 @@ const CollapsibleContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3376
3440
|
});
|
|
3377
3441
|
});
|
|
3378
3442
|
CollapsibleContent.displayName = "CollapsibleContent";
|
|
3379
|
-
|
|
3380
3443
|
//#endregion
|
|
3381
3444
|
//#region src/components/input.tsx
|
|
3382
3445
|
const inputVariants = cva("text-foreground file:text-foreground placeholder:text-muted-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-md border bg-background px-3 py-2 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80 md:text-sm focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:border-destructive focus-visible:aria-invalid:ring-destructive/20 focus-visible:aria-invalid:ring-3 dark:focus-visible:aria-invalid:ring-destructive/40", { variants: { block: { true: "w-full" } } });
|
|
@@ -3407,7 +3470,6 @@ const Input = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3407
3470
|
});
|
|
3408
3471
|
});
|
|
3409
3472
|
Input.displayName = "Input";
|
|
3410
|
-
|
|
3411
3473
|
//#endregion
|
|
3412
3474
|
//#region src/components/textarea.tsx
|
|
3413
3475
|
/**
|
|
@@ -3432,7 +3494,6 @@ const Textarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3432
3494
|
});
|
|
3433
3495
|
});
|
|
3434
3496
|
Textarea.displayName = "Textarea";
|
|
3435
|
-
|
|
3436
3497
|
//#endregion
|
|
3437
3498
|
//#region src/components/input-group.tsx
|
|
3438
3499
|
/**
|
|
@@ -3441,7 +3502,7 @@ Textarea.displayName = "Textarea";
|
|
|
3441
3502
|
* affix-driven input padding adjustments. Exported so `NumericInput` renders an
|
|
3442
3503
|
* identical container without nesting inside `InputGroup`.
|
|
3443
3504
|
*/
|
|
3444
|
-
const inputGroupShellClassName = cn("group/input-group bg-background border-input dark:bg-input/30 relative flex h-10 w-full items-center rounded-md border transition-[color,box-shadow] outline-none has-[>textarea]:h-auto", "has-[input:disabled]:bg-input/50 has-[textarea:disabled]:bg-input/50 has-[input:disabled]:opacity-50 has-[textarea:disabled]:opacity-50 dark:has-[input:disabled]:bg-input/80 dark:has-[textarea:disabled]:bg-input/80", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]:focus-visible]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]:focus-visible]:ring-destructive/40", "data-[invalid]:border-destructive has-[input:focus-visible]:data-[invalid]:ring-3 has-[input:focus-visible]:data-[invalid]:ring-destructive/20 dark:has-[input:focus-visible]:data-[invalid]:ring-destructive/40");
|
|
3505
|
+
const inputGroupShellClassName = cn("group/input-group bg-background border-input dark:bg-input/30 relative flex h-10 w-full items-center rounded-md border transition-[color,box-shadow] outline-none has-[>textarea]:h-auto has-[>[data-multiline=true]]:h-auto", "has-[input:disabled]:bg-input/50 has-[textarea:disabled]:bg-input/50 has-[input:disabled]:opacity-50 has-[textarea:disabled]:opacity-50 dark:has-[input:disabled]:bg-input/80 dark:has-[textarea:disabled]:bg-input/80", "has-[[data-slot=input-group-control][aria-disabled=true]]:bg-input/50 has-[[data-slot=input-group-control][aria-disabled=true]]:opacity-50 dark:has-[[data-slot=input-group-control][aria-disabled=true]]:bg-input/80", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]:focus-visible]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]:focus-visible]:ring-destructive/40", "data-[invalid]:border-destructive has-[input:focus-visible]:data-[invalid]:ring-3 has-[input:focus-visible]:data-[invalid]:ring-destructive/20 dark:has-[input:focus-visible]:data-[invalid]:ring-destructive/40");
|
|
3445
3506
|
/**
|
|
3446
3507
|
* Bordered flex-row container that groups an input with leading/trailing addons
|
|
3447
3508
|
* (icons, buttons, text). Renders a `<div role="group">` and owns the shared
|
|
@@ -3489,7 +3550,7 @@ const InputGroupAddon = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3489
3550
|
className: cn(inputGroupAddonVariants({ align }), className),
|
|
3490
3551
|
onClick: (e) => {
|
|
3491
3552
|
if (e.target.closest("button")) return;
|
|
3492
|
-
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
3553
|
+
e.currentTarget.parentElement?.querySelector("input, textarea, [data-slot=\"input-group-control\"]")?.focus();
|
|
3493
3554
|
},
|
|
3494
3555
|
...props
|
|
3495
3556
|
});
|
|
@@ -3536,7 +3597,6 @@ const InputGroupTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3536
3597
|
});
|
|
3537
3598
|
});
|
|
3538
3599
|
InputGroupTextarea.displayName = "InputGroupTextarea";
|
|
3539
|
-
|
|
3540
3600
|
//#endregion
|
|
3541
3601
|
//#region src/components/combobox.tsx
|
|
3542
3602
|
/**
|
|
@@ -3643,7 +3703,8 @@ const ComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3643
3703
|
align,
|
|
3644
3704
|
alignOffset,
|
|
3645
3705
|
anchor,
|
|
3646
|
-
|
|
3706
|
+
"data-slot": "combobox-positioner",
|
|
3707
|
+
className: "isolate z-popup",
|
|
3647
3708
|
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
3648
3709
|
ref: forwardRef,
|
|
3649
3710
|
"data-slot": "combobox-content",
|
|
@@ -3806,7 +3867,6 @@ ComboboxChipsInput.displayName = "ComboboxChipsInput";
|
|
|
3806
3867
|
function useComboboxAnchor() {
|
|
3807
3868
|
return React.useRef(null);
|
|
3808
3869
|
}
|
|
3809
|
-
|
|
3810
3870
|
//#endregion
|
|
3811
3871
|
//#region src/components/skeleton.tsx
|
|
3812
3872
|
/**
|
|
@@ -3828,7 +3888,6 @@ const Skeleton = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3828
3888
|
});
|
|
3829
3889
|
});
|
|
3830
3890
|
Skeleton.displayName = "Skeleton";
|
|
3831
|
-
|
|
3832
3891
|
//#endregion
|
|
3833
3892
|
//#region src/lib/use-fetch-more-sentinel.ts
|
|
3834
3893
|
/**
|
|
@@ -3895,7 +3954,6 @@ function useFetchMoreSentinel(onFetchMore, getRoot, resetKey) {
|
|
|
3895
3954
|
observe();
|
|
3896
3955
|
}, [observe]);
|
|
3897
3956
|
}
|
|
3898
|
-
|
|
3899
3957
|
//#endregion
|
|
3900
3958
|
//#region src/components/combobox-rows.tsx
|
|
3901
3959
|
const DEFAULT_SKELETON_COUNT$1 = 5;
|
|
@@ -3994,12 +4052,11 @@ function ComboboxLoadedRows(componentProps) {
|
|
|
3994
4052
|
const { groups, renderRow, virtualRows, isFiltering, isLoadingMore, emptyState, listClassName, listTabIndex, "aria-label": ariaLabel } = componentProps;
|
|
3995
4053
|
const t = useDsTranslation("ds");
|
|
3996
4054
|
const listChildren = virtualRows ?? (groups === null ? renderRow : renderGroupSection(renderRow));
|
|
3997
|
-
const tabIndexProps = listTabIndex === void 0 ? {} : { tabIndex: listTabIndex };
|
|
3998
4055
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3999
4056
|
/* @__PURE__ */ jsx(ComboboxList, {
|
|
4000
4057
|
"aria-label": ariaLabel,
|
|
4001
4058
|
className: listClassName,
|
|
4002
|
-
...
|
|
4059
|
+
...listTabIndex === void 0 ? {} : { tabIndex: listTabIndex },
|
|
4003
4060
|
children: listChildren
|
|
4004
4061
|
}),
|
|
4005
4062
|
isFiltering ? null : /* @__PURE__ */ jsx(ComboboxEmpty, {
|
|
@@ -4117,7 +4174,6 @@ function ComboboxSkeletonRows({ count }) {
|
|
|
4117
4174
|
}, `skeleton-${i}`))
|
|
4118
4175
|
});
|
|
4119
4176
|
}
|
|
4120
|
-
|
|
4121
4177
|
//#endregion
|
|
4122
4178
|
//#region src/lib/use-combobox-item-selection.ts
|
|
4123
4179
|
const EMPTY_KEYS$1 = /* @__PURE__ */ new Set();
|
|
@@ -4131,7 +4187,7 @@ const EMPTY_KEYS$1 = /* @__PURE__ */ new Set();
|
|
|
4131
4187
|
* `escape-key` is deliberately absent: with a popup, Escape CLOSES it rather
|
|
4132
4188
|
* than clearing the query, so forwarding it would refetch on every dismissal.
|
|
4133
4189
|
*/
|
|
4134
|
-
const POPUP_SEARCH_TRIGGER_REASONS = new Set([
|
|
4190
|
+
const POPUP_SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
4135
4191
|
"input-change",
|
|
4136
4192
|
"input-clear",
|
|
4137
4193
|
"clear-press"
|
|
@@ -4145,7 +4201,7 @@ const POPUP_SEARCH_TRIGGER_REASONS = new Set([
|
|
|
4145
4201
|
* in step with the reset it just performed — otherwise the component presents
|
|
4146
4202
|
* itself as reset while the caller keeps serving the previous query's page.
|
|
4147
4203
|
*/
|
|
4148
|
-
const INLINE_SEARCH_TRIGGER_REASONS = new Set([
|
|
4204
|
+
const INLINE_SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
4149
4205
|
"input-change",
|
|
4150
4206
|
"input-clear",
|
|
4151
4207
|
"clear-press",
|
|
@@ -4199,7 +4255,6 @@ function useComboboxItemSelection(options) {
|
|
|
4199
4255
|
} : void 0
|
|
4200
4256
|
};
|
|
4201
4257
|
}
|
|
4202
|
-
|
|
4203
4258
|
//#endregion
|
|
4204
4259
|
//#region src/components/combobox-body.tsx
|
|
4205
4260
|
const LIST_MAX_HEIGHT = "max-h-63";
|
|
@@ -4269,7 +4324,7 @@ function ComboboxBody(componentProps) {
|
|
|
4269
4324
|
const { items, getItemValue, getItemLabel, renderItem, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, selectedItems, disabledKeys, loadingState = "idle", skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, estimateRowHeight, searchable = true, placeholder, className, "aria-label": ariaLabel } = componentProps;
|
|
4270
4325
|
const multiple = selectionMode === "multiple";
|
|
4271
4326
|
const autoVirtualizeLatch = React.useRef(false);
|
|
4272
|
-
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = !!onFetchMore || items.length >=
|
|
4327
|
+
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = !!onFetchMore || items.length >= 100;
|
|
4273
4328
|
const virtualizeRows = (componentProps.virtualizeRows ?? autoVirtualizeLatch.current) && !getGroupKey;
|
|
4274
4329
|
const scrollRowIntoViewRef = React.useRef(null);
|
|
4275
4330
|
const { selectedObjects, commit, handleInputValueChange } = useComboboxItemSelection({
|
|
@@ -4342,7 +4397,6 @@ function ComboboxBody(componentProps) {
|
|
|
4342
4397
|
children: body
|
|
4343
4398
|
}, selectionMode);
|
|
4344
4399
|
}
|
|
4345
|
-
|
|
4346
4400
|
//#endregion
|
|
4347
4401
|
//#region src/components/dialog.tsx
|
|
4348
4402
|
/**
|
|
@@ -4504,7 +4558,6 @@ const DialogDescription = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4504
4558
|
});
|
|
4505
4559
|
});
|
|
4506
4560
|
DialogDescription.displayName = "DialogDescription";
|
|
4507
|
-
|
|
4508
4561
|
//#endregion
|
|
4509
4562
|
//#region src/components/command.tsx
|
|
4510
4563
|
/**
|
|
@@ -4671,7 +4724,6 @@ const CommandShortcut = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4671
4724
|
});
|
|
4672
4725
|
});
|
|
4673
4726
|
CommandShortcut.displayName = "CommandShortcut";
|
|
4674
|
-
|
|
4675
4727
|
//#endregion
|
|
4676
4728
|
//#region src/components/country-flag.tsx
|
|
4677
4729
|
const sizeMap = {
|
|
@@ -4694,14 +4746,14 @@ const sizeMap = {
|
|
|
4694
4746
|
*/
|
|
4695
4747
|
const CountryFlag = React.forwardRef((componentProps, forwardRef) => {
|
|
4696
4748
|
const { countryIsoCode, size = "xl", className, ...otherProps } = componentProps;
|
|
4697
|
-
|
|
4749
|
+
const CurrentFlag = FLAGS[countryIsoCode.toLowerCase()] ?? FlagUs;
|
|
4750
|
+
return /* @__PURE__ */ jsx(CurrentFlag, {
|
|
4698
4751
|
ref: forwardRef,
|
|
4699
4752
|
className: cn("flex-none", sizeMap[size], className),
|
|
4700
4753
|
...otherProps
|
|
4701
4754
|
});
|
|
4702
4755
|
});
|
|
4703
4756
|
CountryFlag.displayName = "CountryFlag";
|
|
4704
|
-
|
|
4705
4757
|
//#endregion
|
|
4706
4758
|
//#region src/components/data-combobox.tsx
|
|
4707
4759
|
/**
|
|
@@ -4802,7 +4854,6 @@ function DataCombobox(componentProps) {
|
|
|
4802
4854
|
})] })
|
|
4803
4855
|
}, selectionMode);
|
|
4804
4856
|
}
|
|
4805
|
-
|
|
4806
4857
|
//#endregion
|
|
4807
4858
|
//#region src/components/table.tsx
|
|
4808
4859
|
/**
|
|
@@ -4906,7 +4957,6 @@ const TableCell = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4906
4957
|
});
|
|
4907
4958
|
});
|
|
4908
4959
|
TableCell.displayName = "TableCell";
|
|
4909
|
-
|
|
4910
4960
|
//#endregion
|
|
4911
4961
|
//#region src/components/data-table.tsx
|
|
4912
4962
|
const SELECT_COLUMN_ID = "__select";
|
|
@@ -5006,7 +5056,7 @@ function DataTable(componentProps) {
|
|
|
5006
5056
|
const paddingTop = virtualItems && virtualItems.length > 0 ? virtualItems[0].start : 0;
|
|
5007
5057
|
const paddingBottom = virtualItems && virtualItems.length > 0 ? rowVirtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
|
|
5008
5058
|
const showActionBar = !!actionBar && hasSelection;
|
|
5009
|
-
const reservedBottom = showActionBar ?
|
|
5059
|
+
const reservedBottom = showActionBar ? 64 : void 0;
|
|
5010
5060
|
const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => fillHeight ? node.closest("[data-slot=\"table-container\"]") : null, data.length);
|
|
5011
5061
|
return /* @__PURE__ */ jsxs("div", {
|
|
5012
5062
|
className: cn("relative w-full", fillHeight && "flex min-h-0 flex-1 flex-col", className),
|
|
@@ -5205,7 +5255,6 @@ function SkeletonRows({ columns, count }) {
|
|
|
5205
5255
|
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full max-w-full" })
|
|
5206
5256
|
}, col.id ?? `col-${ci}`)) }, `skeleton-${i}`)) });
|
|
5207
5257
|
}
|
|
5208
|
-
|
|
5209
5258
|
//#endregion
|
|
5210
5259
|
//#region src/components/tree.tsx
|
|
5211
5260
|
const TreeContext = React.createContext({
|
|
@@ -5257,7 +5306,7 @@ function Tree({ indent = 20, tree, className, ...props }) {
|
|
|
5257
5306
|
})
|
|
5258
5307
|
});
|
|
5259
5308
|
}
|
|
5260
|
-
const ACTIVATION_KEYS = new Set([
|
|
5309
|
+
const ACTIVATION_KEYS = /* @__PURE__ */ new Set([
|
|
5261
5310
|
"Enter",
|
|
5262
5311
|
" ",
|
|
5263
5312
|
"Spacebar"
|
|
@@ -5375,7 +5424,6 @@ function TreeDragLine({ className, ...props }) {
|
|
|
5375
5424
|
...props
|
|
5376
5425
|
});
|
|
5377
5426
|
}
|
|
5378
|
-
|
|
5379
5427
|
//#endregion
|
|
5380
5428
|
//#region src/components/data-tree.tsx
|
|
5381
5429
|
const ROOT_ID = "__data_tree_root__";
|
|
@@ -5476,12 +5524,13 @@ function DataTree(componentProps) {
|
|
|
5476
5524
|
if (!node) return /* @__PURE__ */ jsx(TreeItemLabel, {});
|
|
5477
5525
|
const label = getLabel(node);
|
|
5478
5526
|
if (!getIcon) return /* @__PURE__ */ jsx(TreeItemLabel, { children: label });
|
|
5527
|
+
const icon = getIcon(node, {
|
|
5528
|
+
isFolder: item.isFolder(),
|
|
5529
|
+
isExpanded: item.isExpanded()
|
|
5530
|
+
});
|
|
5479
5531
|
return /* @__PURE__ */ jsx(TreeItemLabel, { children: /* @__PURE__ */ jsxs("span", {
|
|
5480
5532
|
className: "flex items-center gap-2",
|
|
5481
|
-
children: [
|
|
5482
|
-
isFolder: item.isFolder(),
|
|
5483
|
-
isExpanded: item.isExpanded()
|
|
5484
|
-
}) ?? /* @__PURE__ */ jsx("span", {
|
|
5533
|
+
children: [icon ?? /* @__PURE__ */ jsx("span", {
|
|
5485
5534
|
"aria-hidden": "true",
|
|
5486
5535
|
className: "size-4 shrink-0"
|
|
5487
5536
|
}), label]
|
|
@@ -5508,7 +5557,6 @@ function DataTree(componentProps) {
|
|
|
5508
5557
|
})
|
|
5509
5558
|
});
|
|
5510
5559
|
}
|
|
5511
|
-
|
|
5512
5560
|
//#endregion
|
|
5513
5561
|
//#region src/components/label.tsx
|
|
5514
5562
|
/**
|
|
@@ -5531,7 +5579,6 @@ const Label = React.forwardRef((componentProps, forwardRef) => {
|
|
|
5531
5579
|
});
|
|
5532
5580
|
});
|
|
5533
5581
|
Label.displayName = "Label";
|
|
5534
|
-
|
|
5535
5582
|
//#endregion
|
|
5536
5583
|
//#region src/components/popover.tsx
|
|
5537
5584
|
/**
|
|
@@ -5607,7 +5654,8 @@ const PopoverContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
5607
5654
|
side,
|
|
5608
5655
|
sideOffset,
|
|
5609
5656
|
anchor,
|
|
5610
|
-
|
|
5657
|
+
"data-slot": "popover-positioner",
|
|
5658
|
+
className: "isolate z-popup",
|
|
5611
5659
|
children: /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
5612
5660
|
ref: forwardRef,
|
|
5613
5661
|
"data-slot": "popover-content",
|
|
@@ -5659,7 +5707,6 @@ const PopoverDescription = React.forwardRef((componentProps, forwardRef) => {
|
|
|
5659
5707
|
});
|
|
5660
5708
|
});
|
|
5661
5709
|
PopoverDescription.displayName = "PopoverDescription";
|
|
5662
|
-
|
|
5663
5710
|
//#endregion
|
|
5664
5711
|
//#region src/components/field.tsx
|
|
5665
5712
|
/**
|
|
@@ -5932,7 +5979,6 @@ const FieldError = React.forwardRef((componentProps, forwardRef) => {
|
|
|
5932
5979
|
});
|
|
5933
5980
|
});
|
|
5934
5981
|
FieldError.displayName = "FieldError";
|
|
5935
|
-
|
|
5936
5982
|
//#endregion
|
|
5937
5983
|
//#region src/i18n/date-mask.ts
|
|
5938
5984
|
/** Module-level cache: one Intl.DisplayNames instance per locale. */
|
|
@@ -6096,7 +6142,6 @@ function deriveDateMask(localeCode) {
|
|
|
6096
6142
|
return fallback;
|
|
6097
6143
|
}
|
|
6098
6144
|
}
|
|
6099
|
-
|
|
6100
6145
|
//#endregion
|
|
6101
6146
|
//#region src/hooks/segmented-date/segment-math.ts
|
|
6102
6147
|
/**
|
|
@@ -6144,7 +6189,6 @@ function clampDayToMonth(day, month, year) {
|
|
|
6144
6189
|
const max = daysInMonth(month, year);
|
|
6145
6190
|
return day > max ? max : day;
|
|
6146
6191
|
}
|
|
6147
|
-
|
|
6148
6192
|
//#endregion
|
|
6149
6193
|
//#region src/hooks/segmented-date/reducer.ts
|
|
6150
6194
|
function toCommitted(d, m, y) {
|
|
@@ -6201,9 +6245,9 @@ function applyDigitToSegment(state, segment, digit) {
|
|
|
6201
6245
|
};
|
|
6202
6246
|
if (segment === "year") {
|
|
6203
6247
|
if (newAcc.length > 4) return state;
|
|
6204
|
-
const num
|
|
6248
|
+
const num = parseInt(newAcc, 10);
|
|
6205
6249
|
if (newAcc.length === 4) {
|
|
6206
|
-
const clamped = clamp(num
|
|
6250
|
+
const clamped = clamp(num, 1e3, 9999);
|
|
6207
6251
|
return {
|
|
6208
6252
|
...state,
|
|
6209
6253
|
year: clamped,
|
|
@@ -6215,8 +6259,8 @@ function applyDigitToSegment(state, segment, digit) {
|
|
|
6215
6259
|
}
|
|
6216
6260
|
return {
|
|
6217
6261
|
...state,
|
|
6218
|
-
year: num
|
|
6219
|
-
day: clampDayToMonth(state.day, state.month, num
|
|
6262
|
+
year: num,
|
|
6263
|
+
day: clampDayToMonth(state.day, state.month, num),
|
|
6220
6264
|
accumulator: newAcc,
|
|
6221
6265
|
announce: null
|
|
6222
6266
|
};
|
|
@@ -6242,12 +6286,13 @@ function processDigitsForSegment(segType, digitsStr, currentValues, yearMin, yea
|
|
|
6242
6286
|
acc += d;
|
|
6243
6287
|
consumed++;
|
|
6244
6288
|
const num = parseInt(acc, 10);
|
|
6245
|
-
if (segType === "year")
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6289
|
+
if (segType === "year") {
|
|
6290
|
+
if (acc.length === 4) {
|
|
6291
|
+
finalVal = clamp(num, 1e3, 9999);
|
|
6292
|
+
shouldAdvance = true;
|
|
6293
|
+
break;
|
|
6294
|
+
} else finalVal = num;
|
|
6295
|
+
} else {
|
|
6251
6296
|
const autoAdvanceThreshold = segType === "month" ? 1 : 3;
|
|
6252
6297
|
if (acc.length === 1 && num > autoAdvanceThreshold) {
|
|
6253
6298
|
finalVal = clamp(num, segMin, segMax);
|
|
@@ -6441,14 +6486,14 @@ function segmentedDateReducer(state, action) {
|
|
|
6441
6486
|
const candidateMonth = segment === "month" ? next : state.month;
|
|
6442
6487
|
const candidateYear = segment === "year" ? next : state.year;
|
|
6443
6488
|
const newDay = clampDayToMonth(state.day, candidateMonth, candidateYear);
|
|
6444
|
-
let announceText
|
|
6445
|
-
if (next !== cur) announceText
|
|
6489
|
+
let announceText = null;
|
|
6490
|
+
if (next !== cur) announceText = segment === "month" ? monthNames[next - 1] ?? String(next) : String(next);
|
|
6446
6491
|
return {
|
|
6447
6492
|
...state,
|
|
6448
6493
|
[segment]: next,
|
|
6449
6494
|
day: newDay,
|
|
6450
6495
|
accumulator: "",
|
|
6451
|
-
announce: announceText
|
|
6496
|
+
announce: announceText
|
|
6452
6497
|
};
|
|
6453
6498
|
}
|
|
6454
6499
|
const realDay = state.day;
|
|
@@ -6467,14 +6512,14 @@ function segmentedDateReducer(state, action) {
|
|
|
6467
6512
|
accumulator: "",
|
|
6468
6513
|
announce: null
|
|
6469
6514
|
};
|
|
6470
|
-
let announceText
|
|
6471
|
-
if (next !== cur) announceText
|
|
6515
|
+
let announceText = null;
|
|
6516
|
+
if (next !== cur) announceText = segment === "month" ? monthNames[next - 1] ?? String(next) : String(next);
|
|
6472
6517
|
return {
|
|
6473
6518
|
...state,
|
|
6474
6519
|
[segment]: next,
|
|
6475
6520
|
day: newDay,
|
|
6476
6521
|
accumulator: "",
|
|
6477
|
-
announce: announceText
|
|
6522
|
+
announce: announceText
|
|
6478
6523
|
};
|
|
6479
6524
|
}
|
|
6480
6525
|
const landedValue = findFirstAllowed(next, direction, minVal, maxVal, (candidate) => {
|
|
@@ -6691,7 +6736,6 @@ function isComplete(state) {
|
|
|
6691
6736
|
function isAllEmpty(state) {
|
|
6692
6737
|
return state.day === null && state.month === null && state.year === null;
|
|
6693
6738
|
}
|
|
6694
|
-
|
|
6695
6739
|
//#endregion
|
|
6696
6740
|
//#region src/hooks/use-segmented-date.ts
|
|
6697
6741
|
/**
|
|
@@ -7165,7 +7209,6 @@ function useSegmentedDate(options) {
|
|
|
7165
7209
|
groupRef
|
|
7166
7210
|
};
|
|
7167
7211
|
}
|
|
7168
|
-
|
|
7169
7212
|
//#endregion
|
|
7170
7213
|
//#region src/i18n/number-format.ts
|
|
7171
7214
|
/**
|
|
@@ -7199,16 +7242,15 @@ function resolveLocale(localeProp, dsLocale) {
|
|
|
7199
7242
|
* locale); otherwise `undefined`, so an invalid option (e.g. a bad `currency` or
|
|
7200
7243
|
* `unit`) degrades to default number formatting instead of throwing a `RangeError`.
|
|
7201
7244
|
*/
|
|
7202
|
-
function resolveFormat(locale, format
|
|
7203
|
-
if (format
|
|
7245
|
+
function resolveFormat(locale, format) {
|
|
7246
|
+
if (format == null) return;
|
|
7204
7247
|
try {
|
|
7205
|
-
new Intl.NumberFormat(locale, format
|
|
7206
|
-
return format
|
|
7248
|
+
new Intl.NumberFormat(locale, format).format(0);
|
|
7249
|
+
return format;
|
|
7207
7250
|
} catch {
|
|
7208
7251
|
return;
|
|
7209
7252
|
}
|
|
7210
7253
|
}
|
|
7211
|
-
|
|
7212
7254
|
//#endregion
|
|
7213
7255
|
//#region src/i18n/use-ds-locale.ts
|
|
7214
7256
|
function subscribeToLanguage(onChange) {
|
|
@@ -7224,7 +7266,6 @@ function subscribeToLanguage(onChange) {
|
|
|
7224
7266
|
function useDsLocale() {
|
|
7225
7267
|
return useSyncExternalStore(subscribeToLanguage, () => dsI18n.language, () => dsI18n.language);
|
|
7226
7268
|
}
|
|
7227
|
-
|
|
7228
7269
|
//#endregion
|
|
7229
7270
|
//#region src/components/date-picker.tsx
|
|
7230
7271
|
function DateInputSegment({ segmentProps, disabled, id }) {
|
|
@@ -7531,10 +7572,11 @@ const DatePicker = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7531
7572
|
if (fromBlocked || toBlocked) {
|
|
7532
7573
|
const nextFrom = fromBlocked ? void 0 : rangeValue?.from;
|
|
7533
7574
|
const nextTo = toBlocked ? void 0 : rangeValue?.to;
|
|
7534
|
-
|
|
7575
|
+
const next = nextFrom ? {
|
|
7535
7576
|
from: nextFrom,
|
|
7536
7577
|
...nextTo ? { to: nextTo } : {}
|
|
7537
|
-
} : void 0
|
|
7578
|
+
} : void 0;
|
|
7579
|
+
commitRange(next);
|
|
7538
7580
|
}
|
|
7539
7581
|
}
|
|
7540
7582
|
}, [constraintMatchers]);
|
|
@@ -7594,8 +7636,10 @@ const DatePicker = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7594
7636
|
onReject
|
|
7595
7637
|
});
|
|
7596
7638
|
const handleSelectDate = React.useCallback((date) => {
|
|
7597
|
-
if (componentProps.mode !== "range")
|
|
7598
|
-
|
|
7639
|
+
if (componentProps.mode !== "range") {
|
|
7640
|
+
if (date) singleSegmented.onCalendarPick(date);
|
|
7641
|
+
else commitSingleDate(void 0);
|
|
7642
|
+
}
|
|
7599
7643
|
handleSetIsOpen(false);
|
|
7600
7644
|
}, [
|
|
7601
7645
|
componentProps.mode,
|
|
@@ -7618,10 +7662,11 @@ const DatePicker = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7618
7662
|
onCommit: React.useCallback((date) => {
|
|
7619
7663
|
if (date) {
|
|
7620
7664
|
if (!commitRangeEndpoint(date)) return;
|
|
7621
|
-
|
|
7665
|
+
const next = liveToRef.current ? {
|
|
7622
7666
|
from: date,
|
|
7623
7667
|
to: liveToRef.current
|
|
7624
|
-
} : { from: date }
|
|
7668
|
+
} : { from: date };
|
|
7669
|
+
commitRange(next);
|
|
7625
7670
|
setCalendarMonth(date);
|
|
7626
7671
|
const justCompleted = !fromWasCompleteRef.current;
|
|
7627
7672
|
fromWasCompleteRef.current = true;
|
|
@@ -7909,7 +7954,6 @@ const DatePicker = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7909
7954
|
});
|
|
7910
7955
|
});
|
|
7911
7956
|
DatePicker.displayName = "DatePicker";
|
|
7912
|
-
|
|
7913
7957
|
//#endregion
|
|
7914
7958
|
//#region src/components/scroll-area.tsx
|
|
7915
7959
|
/**
|
|
@@ -7962,7 +8006,6 @@ const ScrollBar = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7962
8006
|
});
|
|
7963
8007
|
});
|
|
7964
8008
|
ScrollBar.displayName = "ScrollBar";
|
|
7965
|
-
|
|
7966
8009
|
//#endregion
|
|
7967
8010
|
//#region src/components/drawer.tsx
|
|
7968
8011
|
const DrawerContext = createContext({ position: "bottom" });
|
|
@@ -8126,13 +8169,14 @@ DrawerPopup.displayName = "DrawerPopup";
|
|
|
8126
8169
|
*/
|
|
8127
8170
|
const DrawerHeader = React.forwardRef((componentProps, forwardRef) => {
|
|
8128
8171
|
const { className, allowSelection = false, render, ...props } = componentProps;
|
|
8172
|
+
const defaultProps = {
|
|
8173
|
+
className: cn("flex flex-col gap-2 p-6 in-[[data-slot=drawer-popup]:has([data-slot=drawer-panel])]:pb-3 max-sm:pb-4", !allowSelection && "cursor-default", className),
|
|
8174
|
+
ref: forwardRef,
|
|
8175
|
+
"data-slot": "drawer-header"
|
|
8176
|
+
};
|
|
8129
8177
|
return useRender({
|
|
8130
8178
|
defaultTagName: "div",
|
|
8131
|
-
props: mergeProps(
|
|
8132
|
-
className: cn("flex flex-col gap-2 p-6 in-[[data-slot=drawer-popup]:has([data-slot=drawer-panel])]:pb-3 max-sm:pb-4", !allowSelection && "cursor-default", className),
|
|
8133
|
-
ref: forwardRef,
|
|
8134
|
-
"data-slot": "drawer-header"
|
|
8135
|
-
}, props),
|
|
8179
|
+
props: mergeProps(defaultProps, props),
|
|
8136
8180
|
render: allowSelection ? /* @__PURE__ */ jsx(DrawerContent, { render }) : render
|
|
8137
8181
|
});
|
|
8138
8182
|
});
|
|
@@ -8143,13 +8187,14 @@ DrawerHeader.displayName = "DrawerHeader";
|
|
|
8143
8187
|
*/
|
|
8144
8188
|
const DrawerFooter = React.forwardRef((componentProps, forwardRef) => {
|
|
8145
8189
|
const { className, variant = "default", allowSelection = true, render, ...props } = componentProps;
|
|
8190
|
+
const defaultProps = {
|
|
8191
|
+
className: cn("flex flex-col-reverse gap-2 px-6 pb-(--safe-area-inset-bottom,0px) sm:flex-row sm:justify-end", !allowSelection && "cursor-default", variant === "default" && "border-t bg-muted/72 pt-4 pb-[calc(env(safe-area-inset-bottom,0px)+--spacing(4))]", variant === "bare" && "in-[[data-slot=drawer-popup]:has([data-slot=drawer-panel])]:pt-3 pt-4 pb-[calc(env(safe-area-inset-bottom,0px)+--spacing(6))]", className),
|
|
8192
|
+
ref: forwardRef,
|
|
8193
|
+
"data-slot": "drawer-footer"
|
|
8194
|
+
};
|
|
8146
8195
|
return useRender({
|
|
8147
8196
|
defaultTagName: "div",
|
|
8148
|
-
props: mergeProps(
|
|
8149
|
-
className: cn("flex flex-col-reverse gap-2 px-6 pb-(--safe-area-inset-bottom,0px) sm:flex-row sm:justify-end", !allowSelection && "cursor-default", variant === "default" && "border-t bg-muted/72 pt-4 pb-[calc(env(safe-area-inset-bottom,0px)+--spacing(4))]", variant === "bare" && "in-[[data-slot=drawer-popup]:has([data-slot=drawer-panel])]:pt-3 pt-4 pb-[calc(env(safe-area-inset-bottom,0px)+--spacing(6))]", className),
|
|
8150
|
-
ref: forwardRef,
|
|
8151
|
-
"data-slot": "drawer-footer"
|
|
8152
|
-
}, props),
|
|
8197
|
+
props: mergeProps(defaultProps, props),
|
|
8153
8198
|
render: allowSelection ? /* @__PURE__ */ jsx(DrawerContent, { render }) : render
|
|
8154
8199
|
});
|
|
8155
8200
|
});
|
|
@@ -8188,13 +8233,14 @@ DrawerDescription.displayName = "DrawerDescription";
|
|
|
8188
8233
|
*/
|
|
8189
8234
|
const DrawerPanel = React.forwardRef((componentProps, forwardRef) => {
|
|
8190
8235
|
const { className, scrollFade = true, scrollable = true, allowSelection = true, render, ...props } = componentProps;
|
|
8236
|
+
const defaultProps = {
|
|
8237
|
+
className: cn("p-6 in-[[data-slot=drawer-popup]:has([data-slot=drawer-header])]:pt-1 in-[[data-slot=drawer-popup]:has([data-slot=drawer-footer]:not(.border-t))]:pb-1", !allowSelection && "cursor-default", className),
|
|
8238
|
+
ref: forwardRef,
|
|
8239
|
+
"data-slot": "drawer-panel"
|
|
8240
|
+
};
|
|
8191
8241
|
const content = useRender({
|
|
8192
8242
|
defaultTagName: "div",
|
|
8193
|
-
props: mergeProps(
|
|
8194
|
-
className: cn("p-6 in-[[data-slot=drawer-popup]:has([data-slot=drawer-header])]:pt-1 in-[[data-slot=drawer-popup]:has([data-slot=drawer-footer]:not(.border-t))]:pb-1", !allowSelection && "cursor-default", className),
|
|
8195
|
-
ref: forwardRef,
|
|
8196
|
-
"data-slot": "drawer-panel"
|
|
8197
|
-
}, props),
|
|
8243
|
+
props: mergeProps(defaultProps, props),
|
|
8198
8244
|
render: allowSelection ? /* @__PURE__ */ jsx(DrawerContent, { render }) : render
|
|
8199
8245
|
});
|
|
8200
8246
|
if (scrollable) return /* @__PURE__ */ jsx(ScrollArea, {
|
|
@@ -8213,15 +8259,15 @@ const DrawerBar = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8213
8259
|
const { className, position: positionProp, render, ...props } = componentProps;
|
|
8214
8260
|
const { position: contextPosition } = useContext(DrawerContext);
|
|
8215
8261
|
const position = positionProp ?? contextPosition;
|
|
8216
|
-
const
|
|
8262
|
+
const defaultProps = {
|
|
8263
|
+
"aria-hidden": true,
|
|
8264
|
+
className: cn("absolute flex touch-none items-center justify-center p-3 before:rounded-full before:bg-input", position === "left" || position === "right" ? "inset-y-0 before:h-12 before:w-1" : "inset-x-0 before:h-1 before:w-12", position === "top" && "bottom-0", position === "bottom" && "top-0", position === "left" && "right-0", position === "right" && "left-0", className),
|
|
8265
|
+
ref: forwardRef,
|
|
8266
|
+
"data-slot": "drawer-bar"
|
|
8267
|
+
};
|
|
8217
8268
|
return useRender({
|
|
8218
8269
|
defaultTagName: "div",
|
|
8219
|
-
props: mergeProps(
|
|
8220
|
-
"aria-hidden": true,
|
|
8221
|
-
className: cn("absolute flex touch-none items-center justify-center p-3 before:rounded-full before:bg-input", horizontal ? "inset-y-0 before:h-12 before:w-1" : "inset-x-0 before:h-1 before:w-12", position === "top" && "bottom-0", position === "bottom" && "top-0", position === "left" && "right-0", position === "right" && "left-0", className),
|
|
8222
|
-
ref: forwardRef,
|
|
8223
|
-
"data-slot": "drawer-bar"
|
|
8224
|
-
}, props),
|
|
8270
|
+
props: mergeProps(defaultProps, props),
|
|
8225
8271
|
render
|
|
8226
8272
|
});
|
|
8227
8273
|
});
|
|
@@ -8238,13 +8284,14 @@ const DrawerContent = DrawerPrimitive.Content;
|
|
|
8238
8284
|
*/
|
|
8239
8285
|
const DrawerMenu = React.forwardRef((componentProps, forwardRef) => {
|
|
8240
8286
|
const { className, render, ...props } = componentProps;
|
|
8287
|
+
const defaultProps = {
|
|
8288
|
+
className: cn("-m-2 flex flex-col", className),
|
|
8289
|
+
ref: forwardRef,
|
|
8290
|
+
"data-slot": "drawer-menu"
|
|
8291
|
+
};
|
|
8241
8292
|
return useRender({
|
|
8242
8293
|
defaultTagName: "nav",
|
|
8243
|
-
props: mergeProps(
|
|
8244
|
-
className: cn("-m-2 flex flex-col", className),
|
|
8245
|
-
ref: forwardRef,
|
|
8246
|
-
"data-slot": "drawer-menu"
|
|
8247
|
-
}, props),
|
|
8294
|
+
props: mergeProps(defaultProps, props),
|
|
8248
8295
|
render
|
|
8249
8296
|
});
|
|
8250
8297
|
});
|
|
@@ -8255,16 +8302,17 @@ DrawerMenu.displayName = "DrawerMenu";
|
|
|
8255
8302
|
*/
|
|
8256
8303
|
const DrawerMenuItem = React.forwardRef((componentProps, forwardRef) => {
|
|
8257
8304
|
const { className, variant = "default", render, disabled, ...props } = componentProps;
|
|
8305
|
+
const defaultProps = {
|
|
8306
|
+
className: cn("flex min-h-9 w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-64 data-[variant=destructive]:text-destructive-foreground sm:min-h-8 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0", className),
|
|
8307
|
+
ref: forwardRef,
|
|
8308
|
+
"data-slot": "drawer-menu-item",
|
|
8309
|
+
"data-variant": variant,
|
|
8310
|
+
disabled,
|
|
8311
|
+
type: "button"
|
|
8312
|
+
};
|
|
8258
8313
|
return useRender({
|
|
8259
8314
|
defaultTagName: "button",
|
|
8260
|
-
props: mergeProps(
|
|
8261
|
-
className: cn("flex min-h-9 w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-64 data-[variant=destructive]:text-destructive-foreground sm:min-h-8 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0", className),
|
|
8262
|
-
ref: forwardRef,
|
|
8263
|
-
"data-slot": "drawer-menu-item",
|
|
8264
|
-
"data-variant": variant,
|
|
8265
|
-
disabled,
|
|
8266
|
-
type: "button"
|
|
8267
|
-
}, props),
|
|
8315
|
+
props: mergeProps(defaultProps, props),
|
|
8268
8316
|
render
|
|
8269
8317
|
});
|
|
8270
8318
|
});
|
|
@@ -8275,13 +8323,14 @@ DrawerMenuItem.displayName = "DrawerMenuItem";
|
|
|
8275
8323
|
*/
|
|
8276
8324
|
const DrawerMenuSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
8277
8325
|
const { className, render, ...props } = componentProps;
|
|
8326
|
+
const defaultProps = {
|
|
8327
|
+
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
8328
|
+
ref: forwardRef,
|
|
8329
|
+
"data-slot": "drawer-menu-separator"
|
|
8330
|
+
};
|
|
8278
8331
|
return useRender({
|
|
8279
8332
|
defaultTagName: "div",
|
|
8280
|
-
props: mergeProps(
|
|
8281
|
-
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
8282
|
-
ref: forwardRef,
|
|
8283
|
-
"data-slot": "drawer-menu-separator"
|
|
8284
|
-
}, props),
|
|
8333
|
+
props: mergeProps(defaultProps, props),
|
|
8285
8334
|
render
|
|
8286
8335
|
});
|
|
8287
8336
|
});
|
|
@@ -8292,13 +8341,14 @@ DrawerMenuSeparator.displayName = "DrawerMenuSeparator";
|
|
|
8292
8341
|
*/
|
|
8293
8342
|
const DrawerMenuGroup = React.forwardRef((componentProps, forwardRef) => {
|
|
8294
8343
|
const { className, render, ...props } = componentProps;
|
|
8344
|
+
const defaultProps = {
|
|
8345
|
+
className: cn("flex flex-col", className),
|
|
8346
|
+
ref: forwardRef,
|
|
8347
|
+
"data-slot": "drawer-menu-group"
|
|
8348
|
+
};
|
|
8295
8349
|
return useRender({
|
|
8296
8350
|
defaultTagName: "div",
|
|
8297
|
-
props: mergeProps(
|
|
8298
|
-
className: cn("flex flex-col", className),
|
|
8299
|
-
ref: forwardRef,
|
|
8300
|
-
"data-slot": "drawer-menu-group"
|
|
8301
|
-
}, props),
|
|
8351
|
+
props: mergeProps(defaultProps, props),
|
|
8302
8352
|
render
|
|
8303
8353
|
});
|
|
8304
8354
|
});
|
|
@@ -8309,13 +8359,14 @@ DrawerMenuGroup.displayName = "DrawerMenuGroup";
|
|
|
8309
8359
|
*/
|
|
8310
8360
|
const DrawerMenuGroupLabel = React.forwardRef((componentProps, forwardRef) => {
|
|
8311
8361
|
const { className, render, ...props } = componentProps;
|
|
8362
|
+
const defaultProps = {
|
|
8363
|
+
className: cn("px-2 py-1.5 font-medium text-muted-foreground text-xs", className),
|
|
8364
|
+
ref: forwardRef,
|
|
8365
|
+
"data-slot": "drawer-menu-group-label"
|
|
8366
|
+
};
|
|
8312
8367
|
return useRender({
|
|
8313
8368
|
defaultTagName: "div",
|
|
8314
|
-
props: mergeProps(
|
|
8315
|
-
className: cn("px-2 py-1.5 font-medium text-muted-foreground text-xs", className),
|
|
8316
|
-
ref: forwardRef,
|
|
8317
|
-
"data-slot": "drawer-menu-group-label"
|
|
8318
|
-
}, props),
|
|
8369
|
+
props: mergeProps(defaultProps, props),
|
|
8319
8370
|
render
|
|
8320
8371
|
});
|
|
8321
8372
|
});
|
|
@@ -8428,7 +8479,6 @@ const DrawerMenuRadioItem = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8428
8479
|
});
|
|
8429
8480
|
});
|
|
8430
8481
|
DrawerMenuRadioItem.displayName = "DrawerMenuRadioItem";
|
|
8431
|
-
|
|
8432
8482
|
//#endregion
|
|
8433
8483
|
//#region src/components/dropdown-menu.tsx
|
|
8434
8484
|
/**
|
|
@@ -8493,7 +8543,8 @@ const DropdownMenuContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8493
8543
|
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
8494
8544
|
container,
|
|
8495
8545
|
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
8496
|
-
|
|
8546
|
+
"data-slot": "dropdown-menu-positioner",
|
|
8547
|
+
className: "isolate z-popup outline-none",
|
|
8497
8548
|
align,
|
|
8498
8549
|
alignOffset,
|
|
8499
8550
|
side,
|
|
@@ -8698,7 +8749,6 @@ const DropdownMenuAddon = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8698
8749
|
});
|
|
8699
8750
|
});
|
|
8700
8751
|
DropdownMenuAddon.displayName = "DropdownMenuAddon";
|
|
8701
|
-
|
|
8702
8752
|
//#endregion
|
|
8703
8753
|
//#region src/components/empty.tsx
|
|
8704
8754
|
/**
|
|
@@ -8808,7 +8858,6 @@ const EmptyContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8808
8858
|
});
|
|
8809
8859
|
});
|
|
8810
8860
|
EmptyContent.displayName = "EmptyContent";
|
|
8811
|
-
|
|
8812
8861
|
//#endregion
|
|
8813
8862
|
//#region src/components/dropzone.tsx
|
|
8814
8863
|
const DropzoneContext = React.createContext(null);
|
|
@@ -8825,7 +8874,7 @@ const DEFAULT_ERROR_MESSAGES = {
|
|
|
8825
8874
|
};
|
|
8826
8875
|
function formatBytes(bytes) {
|
|
8827
8876
|
if (bytes < 1024) return `${bytes} B`;
|
|
8828
|
-
if (bytes <
|
|
8877
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(0)} KB`;
|
|
8829
8878
|
return `${(bytes / 1024 / 1024).toFixed(0)} MB`;
|
|
8830
8879
|
}
|
|
8831
8880
|
function parseAccept(accept) {
|
|
@@ -9111,7 +9160,6 @@ const DropzoneTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9111
9160
|
});
|
|
9112
9161
|
});
|
|
9113
9162
|
DropzoneTrigger.displayName = "DropzoneTrigger";
|
|
9114
|
-
|
|
9115
9163
|
//#endregion
|
|
9116
9164
|
//#region src/components/theme-provider.tsx
|
|
9117
9165
|
/**
|
|
@@ -9137,7 +9185,6 @@ function ThemeProvider(componentProps) {
|
|
|
9137
9185
|
children
|
|
9138
9186
|
});
|
|
9139
9187
|
}
|
|
9140
|
-
|
|
9141
9188
|
//#endregion
|
|
9142
9189
|
//#region src/components/emoji-picker.tsx
|
|
9143
9190
|
/** Emoji category identifiers, for the `categories` prop of `EmojiPickerContent`. */
|
|
@@ -9248,7 +9295,6 @@ function EmojiPickerContent({ className, align = "start", searchPlaceholder, cat
|
|
|
9248
9295
|
})
|
|
9249
9296
|
});
|
|
9250
9297
|
}
|
|
9251
|
-
|
|
9252
9298
|
//#endregion
|
|
9253
9299
|
//#region src/components/fab.tsx
|
|
9254
9300
|
/**
|
|
@@ -9300,7 +9346,6 @@ const FAB = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9300
9346
|
});
|
|
9301
9347
|
});
|
|
9302
9348
|
FAB.displayName = "FAB";
|
|
9303
|
-
|
|
9304
9349
|
//#endregion
|
|
9305
9350
|
//#region src/components/gauge.tsx
|
|
9306
9351
|
const GAUGES = 8;
|
|
@@ -9350,7 +9395,6 @@ const Gauge = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9350
9395
|
});
|
|
9351
9396
|
});
|
|
9352
9397
|
Gauge.displayName = "Gauge";
|
|
9353
|
-
|
|
9354
9398
|
//#endregion
|
|
9355
9399
|
//#region src/components/hover-card.tsx
|
|
9356
9400
|
/**
|
|
@@ -9435,7 +9479,8 @@ const HoverCardContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9435
9479
|
sideOffset,
|
|
9436
9480
|
align,
|
|
9437
9481
|
alignOffset,
|
|
9438
|
-
|
|
9482
|
+
"data-slot": "hover-card-positioner",
|
|
9483
|
+
className: "isolate z-popup",
|
|
9439
9484
|
children: /* @__PURE__ */ jsx(PreviewCard.Popup, {
|
|
9440
9485
|
ref: forwardRef,
|
|
9441
9486
|
"data-slot": "hover-card-content",
|
|
@@ -9445,7 +9490,6 @@ const HoverCardContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9445
9490
|
}) });
|
|
9446
9491
|
});
|
|
9447
9492
|
HoverCardContent.displayName = "HoverCardContent";
|
|
9448
|
-
|
|
9449
9493
|
//#endregion
|
|
9450
9494
|
//#region src/components/inline-edit.tsx
|
|
9451
9495
|
/** Context shared between InlineEditSelect root and its compound sub-parts. */
|
|
@@ -9530,7 +9574,6 @@ function useInlineEditCommit({ value, defaultValue, onValueChange, onValueCommit
|
|
|
9530
9574
|
}, [isControlled, onValueChange])
|
|
9531
9575
|
};
|
|
9532
9576
|
}
|
|
9533
|
-
|
|
9534
9577
|
//#endregion
|
|
9535
9578
|
//#region src/components/inline-edit-input.tsx
|
|
9536
9579
|
/**
|
|
@@ -9605,7 +9648,6 @@ const InlineEditInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
9605
9648
|
});
|
|
9606
9649
|
});
|
|
9607
9650
|
InlineEditInput.displayName = "InlineEditInput";
|
|
9608
|
-
|
|
9609
9651
|
//#endregion
|
|
9610
9652
|
//#region src/components/inline-edit-multiselect.tsx
|
|
9611
9653
|
/** Context shared between the `InlineEditMultiselect` root and its compound sub-parts. */
|
|
@@ -9925,7 +9967,6 @@ function InlineEditMultiselect(componentProps) {
|
|
|
9925
9967
|
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(InlineEditMultiselectDataDriven, { ...componentProps });
|
|
9926
9968
|
return /* @__PURE__ */ jsx(InlineEditMultiselectCompound, { ...componentProps });
|
|
9927
9969
|
}
|
|
9928
|
-
|
|
9929
9970
|
//#endregion
|
|
9930
9971
|
//#region src/components/inline-edit-select.tsx
|
|
9931
9972
|
/**
|
|
@@ -10001,7 +10042,8 @@ const InlineEditSelectContent = React.forwardRef((componentProps, forwardRef) =>
|
|
|
10001
10042
|
align,
|
|
10002
10043
|
alignOffset,
|
|
10003
10044
|
alignItemWithTrigger,
|
|
10004
|
-
|
|
10045
|
+
"data-slot": "inline-edit-select-positioner",
|
|
10046
|
+
className: "isolate z-popup",
|
|
10005
10047
|
children: /* @__PURE__ */ jsx(Select$1.Popup, {
|
|
10006
10048
|
ref: forwardRef,
|
|
10007
10049
|
"data-slot": "inline-edit-content",
|
|
@@ -10115,7 +10157,6 @@ function InlineEditSelectCompound(props) {
|
|
|
10115
10157
|
})
|
|
10116
10158
|
});
|
|
10117
10159
|
}
|
|
10118
|
-
|
|
10119
10160
|
//#endregion
|
|
10120
10161
|
//#region src/components/inline-edit-textarea.tsx
|
|
10121
10162
|
/**
|
|
@@ -10217,7 +10258,6 @@ const InlineEditTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10217
10258
|
});
|
|
10218
10259
|
});
|
|
10219
10260
|
InlineEditTextarea.displayName = "InlineEditTextarea";
|
|
10220
|
-
|
|
10221
10261
|
//#endregion
|
|
10222
10262
|
//#region src/components/numeric-input.tsx
|
|
10223
10263
|
/**
|
|
@@ -10242,9 +10282,9 @@ InlineEditTextarea.displayName = "InlineEditTextarea";
|
|
|
10242
10282
|
* ```
|
|
10243
10283
|
*/
|
|
10244
10284
|
const NumericInput = React.forwardRef((componentProps, forwardRef) => {
|
|
10245
|
-
const { className, children, prefix, suffix, hideStepper = false, locale, format
|
|
10285
|
+
const { className, children, prefix, suffix, hideStepper = false, locale, format, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": ariaInvalid, ...rootProps } = componentProps;
|
|
10246
10286
|
const resolvedLocale = resolveLocale(locale, useDsLocale());
|
|
10247
|
-
const resolvedFormat = resolveFormat(resolvedLocale, format
|
|
10287
|
+
const resolvedFormat = resolveFormat(resolvedLocale, format);
|
|
10248
10288
|
const ariaForRoot = children != null ? {
|
|
10249
10289
|
"aria-label": ariaLabel,
|
|
10250
10290
|
"aria-labelledby": ariaLabelledby,
|
|
@@ -10354,7 +10394,6 @@ const NumericInputDecrement = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10354
10394
|
});
|
|
10355
10395
|
});
|
|
10356
10396
|
NumericInputDecrement.displayName = "NumericInputDecrement";
|
|
10357
|
-
|
|
10358
10397
|
//#endregion
|
|
10359
10398
|
//#region src/components/input-otp.tsx
|
|
10360
10399
|
/**
|
|
@@ -10432,7 +10471,6 @@ const InputOTPSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10432
10471
|
});
|
|
10433
10472
|
});
|
|
10434
10473
|
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
10435
|
-
|
|
10436
10474
|
//#endregion
|
|
10437
10475
|
//#region src/components/item.tsx
|
|
10438
10476
|
/**
|
|
@@ -10624,7 +10662,6 @@ const ItemFooter = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10624
10662
|
});
|
|
10625
10663
|
});
|
|
10626
10664
|
ItemFooter.displayName = "ItemFooter";
|
|
10627
|
-
|
|
10628
10665
|
//#endregion
|
|
10629
10666
|
//#region src/components/anchor.tsx
|
|
10630
10667
|
const anchorVariants = cn(linkStyle, "inline-flex cursor-pointer items-center gap-1.5 font-medium outline-none transition-colors hover:text-primary/80 focus-visible:ring-3 focus-visible:ring-ring/50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[1em]");
|
|
@@ -10660,7 +10697,6 @@ const Anchor = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10660
10697
|
});
|
|
10661
10698
|
});
|
|
10662
10699
|
Anchor.displayName = "Anchor";
|
|
10663
|
-
|
|
10664
10700
|
//#endregion
|
|
10665
10701
|
//#region src/components/list.tsx
|
|
10666
10702
|
/**
|
|
@@ -10715,7 +10751,6 @@ const ListCol = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10715
10751
|
});
|
|
10716
10752
|
});
|
|
10717
10753
|
ListCol.displayName = "ListCol";
|
|
10718
|
-
|
|
10719
10754
|
//#endregion
|
|
10720
10755
|
//#region src/components/pagination.tsx
|
|
10721
10756
|
/**
|
|
@@ -10862,7 +10897,6 @@ const PaginationEllipsis = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10862
10897
|
});
|
|
10863
10898
|
});
|
|
10864
10899
|
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
10865
|
-
|
|
10866
10900
|
//#endregion
|
|
10867
10901
|
//#region src/components/progress.tsx
|
|
10868
10902
|
/**
|
|
@@ -10945,7 +10979,6 @@ const ProgressValue = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10945
10979
|
});
|
|
10946
10980
|
});
|
|
10947
10981
|
ProgressValue.displayName = "ProgressValue";
|
|
10948
|
-
|
|
10949
10982
|
//#endregion
|
|
10950
10983
|
//#region src/components/radio-group.tsx
|
|
10951
10984
|
/**
|
|
@@ -10989,7 +11022,1412 @@ const RadioGroupItem = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10989
11022
|
});
|
|
10990
11023
|
});
|
|
10991
11024
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
10992
|
-
|
|
11025
|
+
//#endregion
|
|
11026
|
+
//#region src/components/rich-textarea-combobox.tsx
|
|
11027
|
+
const InlineComboboxContext = React.createContext(null);
|
|
11028
|
+
const defaultFilter = ({ group, keywords = [], label, value }, search) => {
|
|
11029
|
+
const uniqueTerms = new Set([
|
|
11030
|
+
value,
|
|
11031
|
+
...keywords,
|
|
11032
|
+
group,
|
|
11033
|
+
label
|
|
11034
|
+
].filter(Boolean));
|
|
11035
|
+
return Array.from(uniqueTerms).some((keyword) => filterWords(keyword, search));
|
|
11036
|
+
};
|
|
11037
|
+
/**
|
|
11038
|
+
* Root of an inline autocomplete menu bound to a Plate combobox-input node.
|
|
11039
|
+
* Detects the trigger character, tracks the search string, and closes the menu
|
|
11040
|
+
* cleanly (restoring the typed text) when cancelled. Renders no visible DOM of
|
|
11041
|
+
* its own — place `InlineComboboxInput` and `InlineComboboxContent` inside.
|
|
11042
|
+
*/
|
|
11043
|
+
const InlineCombobox = ({ children, element, filter = defaultFilter, hideWhenNoValue = false, initialInputValue, loadingState, onNoMatchEnter, setValue: setValueProp, showTrigger = true, trigger, value: valueProp }) => {
|
|
11044
|
+
const editor = useEditorRef();
|
|
11045
|
+
const inputRef = React.useRef(null);
|
|
11046
|
+
const cursorState = useHTMLInputCursorState(inputRef);
|
|
11047
|
+
const [valueState, setValueState] = React.useState("");
|
|
11048
|
+
const hasValueProp = valueProp !== void 0;
|
|
11049
|
+
const value = hasValueProp ? valueProp : valueState;
|
|
11050
|
+
const setValue = React.useCallback((newValue) => {
|
|
11051
|
+
setValueProp?.(newValue);
|
|
11052
|
+
if (!hasValueProp) setValueState(newValue);
|
|
11053
|
+
}, [setValueProp, hasValueProp]);
|
|
11054
|
+
/**
|
|
11055
|
+
* Track the point just before the input element so we know where to
|
|
11056
|
+
* insertText if the combobox closes due to a selection change.
|
|
11057
|
+
*/
|
|
11058
|
+
const insertPointRef = React.useRef(null);
|
|
11059
|
+
React.useEffect(() => {
|
|
11060
|
+
const path = editor.api.findPath(element);
|
|
11061
|
+
if (!path) return;
|
|
11062
|
+
const point = editor.api.before(path);
|
|
11063
|
+
if (!point) return;
|
|
11064
|
+
const pointRef = editor.api.pointRef(point);
|
|
11065
|
+
insertPointRef.current = pointRef;
|
|
11066
|
+
return () => {
|
|
11067
|
+
if (insertPointRef.current === pointRef) insertPointRef.current = null;
|
|
11068
|
+
pointRef.unref();
|
|
11069
|
+
};
|
|
11070
|
+
}, [editor, element]);
|
|
11071
|
+
const { props: inputProps, removeInput } = useComboboxInput({
|
|
11072
|
+
cancelInputOnBlur: true,
|
|
11073
|
+
cursorState,
|
|
11074
|
+
autoFocus: true,
|
|
11075
|
+
ref: inputRef,
|
|
11076
|
+
onCancelInput: (cause) => {
|
|
11077
|
+
if (cause !== "backspace") editor.tf.insertText(trigger + value, { at: insertPointRef.current?.current ?? void 0 });
|
|
11078
|
+
if (cause === "arrowLeft" || cause === "arrowRight") editor.tf.move({
|
|
11079
|
+
distance: 1,
|
|
11080
|
+
reverse: cause === "arrowLeft"
|
|
11081
|
+
});
|
|
11082
|
+
}
|
|
11083
|
+
});
|
|
11084
|
+
const [hasEmpty, setHasEmpty] = React.useState(false);
|
|
11085
|
+
const isFetching = loadingState === "loading" || loadingState === "filtering" || loadingState === "loadingMore";
|
|
11086
|
+
const handleEmptyEnter = React.useCallback(() => {
|
|
11087
|
+
if (!onNoMatchEnter || isFetching) return false;
|
|
11088
|
+
removeInput(true);
|
|
11089
|
+
editor.tf.insertText(trigger + value, { at: insertPointRef.current?.current ?? void 0 });
|
|
11090
|
+
onNoMatchEnter();
|
|
11091
|
+
return true;
|
|
11092
|
+
}, [
|
|
11093
|
+
onNoMatchEnter,
|
|
11094
|
+
isFetching,
|
|
11095
|
+
removeInput,
|
|
11096
|
+
editor,
|
|
11097
|
+
trigger,
|
|
11098
|
+
value
|
|
11099
|
+
]);
|
|
11100
|
+
const contextValue = React.useMemo(() => ({
|
|
11101
|
+
filter,
|
|
11102
|
+
handleEmptyEnter,
|
|
11103
|
+
inputProps,
|
|
11104
|
+
inputRef,
|
|
11105
|
+
removeInput,
|
|
11106
|
+
setHasEmpty,
|
|
11107
|
+
showTrigger,
|
|
11108
|
+
trigger
|
|
11109
|
+
}), [
|
|
11110
|
+
trigger,
|
|
11111
|
+
showTrigger,
|
|
11112
|
+
filter,
|
|
11113
|
+
inputRef,
|
|
11114
|
+
inputProps,
|
|
11115
|
+
removeInput,
|
|
11116
|
+
setHasEmpty,
|
|
11117
|
+
handleEmptyEnter
|
|
11118
|
+
]);
|
|
11119
|
+
const store = useComboboxStore({
|
|
11120
|
+
setInputValue: setValue,
|
|
11121
|
+
defaultValue: initialInputValue
|
|
11122
|
+
});
|
|
11123
|
+
const items = useStoreState(store, "items");
|
|
11124
|
+
/**
|
|
11125
|
+
* If there is no active ID and the list of items changes, select the first
|
|
11126
|
+
* item.
|
|
11127
|
+
*/
|
|
11128
|
+
React.useEffect(() => {
|
|
11129
|
+
if (!store.getState().activeId) store.setActiveId(store.first());
|
|
11130
|
+
}, [items, store]);
|
|
11131
|
+
return /* @__PURE__ */ jsx("span", {
|
|
11132
|
+
contentEditable: false,
|
|
11133
|
+
children: /* @__PURE__ */ jsx(ComboboxProvider, {
|
|
11134
|
+
open: (items.length > 0 || hasEmpty || loadingState === "loading") && (!hideWhenNoValue || value.length > 0),
|
|
11135
|
+
store,
|
|
11136
|
+
children: /* @__PURE__ */ jsx(InlineComboboxContext.Provider, {
|
|
11137
|
+
value: contextValue,
|
|
11138
|
+
children
|
|
11139
|
+
})
|
|
11140
|
+
})
|
|
11141
|
+
});
|
|
11142
|
+
};
|
|
11143
|
+
/**
|
|
11144
|
+
* Wraps active-item selection at the list ends (ArrowUp on the first item -> last,
|
|
11145
|
+
* ArrowDown on the last -> first). Ariakit's combobox does not wrap by default. Must be
|
|
11146
|
+
* attached to the focused input in capture phase (not the portaled popover, which never
|
|
11147
|
+
* receives the input's key events) so it runs before Ariakit clamps at the boundary.
|
|
11148
|
+
*/
|
|
11149
|
+
function wrapComboboxAtEnds(event, store) {
|
|
11150
|
+
const { items, activeId } = store.getState();
|
|
11151
|
+
if (!items.length) return;
|
|
11152
|
+
const currentIndex = items.findIndex((item) => item.id === activeId);
|
|
11153
|
+
if (event.key === "ArrowUp" && currentIndex <= 0) {
|
|
11154
|
+
event.preventDefault();
|
|
11155
|
+
store.setActiveId(store.last());
|
|
11156
|
+
} else if (event.key === "ArrowDown" && currentIndex >= items.length - 1) {
|
|
11157
|
+
event.preventDefault();
|
|
11158
|
+
store.setActiveId(store.first());
|
|
11159
|
+
}
|
|
11160
|
+
}
|
|
11161
|
+
/**
|
|
11162
|
+
* The auto-resizing text input that captures the query typed after the trigger.
|
|
11163
|
+
* Rendered on top of a visually hidden mirror span so it grows with its value.
|
|
11164
|
+
*/
|
|
11165
|
+
const InlineComboboxInput = ({ className, ref: propRef, ...props }) => {
|
|
11166
|
+
const { handleEmptyEnter, inputProps, inputRef: contextRef, showTrigger, trigger } = React.useContext(InlineComboboxContext);
|
|
11167
|
+
const store = useComboboxContext();
|
|
11168
|
+
const value = useStoreState(store, "inputValue");
|
|
11169
|
+
const open = useStoreState(store, "open");
|
|
11170
|
+
const ref = useComposedRef(propRef, contextRef);
|
|
11171
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [showTrigger && trigger, /* @__PURE__ */ jsxs("span", {
|
|
11172
|
+
className: "relative min-h-[1lh]",
|
|
11173
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
11174
|
+
className: "invisible overflow-hidden text-nowrap",
|
|
11175
|
+
"aria-hidden": "true",
|
|
11176
|
+
children: value || ""
|
|
11177
|
+
}), /* @__PURE__ */ jsx(Combobox$2, {
|
|
11178
|
+
ref,
|
|
11179
|
+
className: cn("absolute top-0 left-0 size-full bg-transparent outline-none", className),
|
|
11180
|
+
value,
|
|
11181
|
+
autoSelect: true,
|
|
11182
|
+
...inputProps,
|
|
11183
|
+
...props,
|
|
11184
|
+
onKeyDownCapture: (event) => {
|
|
11185
|
+
wrapComboboxAtEnds(event, store);
|
|
11186
|
+
if (event.key === "Enter" && !open && handleEmptyEnter()) {
|
|
11187
|
+
event.preventDefault();
|
|
11188
|
+
event.stopPropagation();
|
|
11189
|
+
}
|
|
11190
|
+
props.onKeyDownCapture?.(event);
|
|
11191
|
+
}
|
|
11192
|
+
})]
|
|
11193
|
+
})] });
|
|
11194
|
+
};
|
|
11195
|
+
InlineComboboxInput.displayName = "InlineComboboxInput";
|
|
11196
|
+
/**
|
|
11197
|
+
* Portaled, anchored panel that holds the combobox items. End-of-list wrap navigation is
|
|
11198
|
+
* handled on the input (see wrapComboboxAtEnds) since the input, not this portaled popover,
|
|
11199
|
+
* receives the key events.
|
|
11200
|
+
*/
|
|
11201
|
+
const InlineComboboxContent = ({ className, ...props }) => {
|
|
11202
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(ComboboxPopover, {
|
|
11203
|
+
"data-slot": "inline-combobox-content",
|
|
11204
|
+
className: cn("z-50 max-h-[288px] w-[300px] overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md", className),
|
|
11205
|
+
...props
|
|
11206
|
+
}) });
|
|
11207
|
+
};
|
|
11208
|
+
const comboboxItemVariants = cva("relative mx-1 flex h-[28px] select-none items-center rounded-sm px-2 text-foreground text-sm outline-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
11209
|
+
defaultVariants: { interactive: true },
|
|
11210
|
+
variants: { interactive: {
|
|
11211
|
+
false: "",
|
|
11212
|
+
true: "cursor-pointer transition-colors hover:bg-accent hover:text-accent-foreground data-[active-item=true]:bg-accent data-[active-item=true]:text-accent-foreground"
|
|
11213
|
+
} }
|
|
11214
|
+
});
|
|
11215
|
+
/** A selectable row in the combobox. Hidden automatically when it fails the filter. */
|
|
11216
|
+
const InlineComboboxItem = ({ className, focusEditor = true, group, keywords, label, onClick, ...props }) => {
|
|
11217
|
+
const { value } = props;
|
|
11218
|
+
const { filter, removeInput } = React.useContext(InlineComboboxContext);
|
|
11219
|
+
const store = useComboboxContext();
|
|
11220
|
+
const search = useStoreState(store, "inputValue");
|
|
11221
|
+
if (!(!filter || filter({
|
|
11222
|
+
group,
|
|
11223
|
+
keywords,
|
|
11224
|
+
label,
|
|
11225
|
+
value
|
|
11226
|
+
}, search ?? ""))) return null;
|
|
11227
|
+
return /* @__PURE__ */ jsx(ComboboxItem$1, {
|
|
11228
|
+
className: cn(comboboxItemVariants(), className),
|
|
11229
|
+
onClick: (event) => {
|
|
11230
|
+
removeInput(focusEditor);
|
|
11231
|
+
onClick?.(event);
|
|
11232
|
+
},
|
|
11233
|
+
...props
|
|
11234
|
+
});
|
|
11235
|
+
};
|
|
11236
|
+
/** Placeholder row shown when no items match the current search. */
|
|
11237
|
+
const InlineComboboxEmpty = ({ children, className }) => {
|
|
11238
|
+
const { setHasEmpty } = React.useContext(InlineComboboxContext);
|
|
11239
|
+
const store = useComboboxContext();
|
|
11240
|
+
const items = useStoreState(store, "items");
|
|
11241
|
+
React.useEffect(() => {
|
|
11242
|
+
setHasEmpty(true);
|
|
11243
|
+
return () => {
|
|
11244
|
+
setHasEmpty(false);
|
|
11245
|
+
};
|
|
11246
|
+
}, [setHasEmpty]);
|
|
11247
|
+
if (items.length > 0) return null;
|
|
11248
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11249
|
+
className: cn(comboboxItemVariants({ interactive: false }), className),
|
|
11250
|
+
children
|
|
11251
|
+
});
|
|
11252
|
+
};
|
|
11253
|
+
/** Groups related items under an optional label; hidden when it has no visible options. */
|
|
11254
|
+
function InlineComboboxGroup({ className, ...props }) {
|
|
11255
|
+
return /* @__PURE__ */ jsx(ComboboxGroup$1, {
|
|
11256
|
+
...props,
|
|
11257
|
+
className: cn("hidden not-last:border-b py-1.5 [&:has([role=option])]:block", className)
|
|
11258
|
+
});
|
|
11259
|
+
}
|
|
11260
|
+
/**
|
|
11261
|
+
* Skeleton rows shown on the first async load (`loadingState="loading"`), before
|
|
11262
|
+
* any items exist. Not selectable and not registered as combobox items.
|
|
11263
|
+
*/
|
|
11264
|
+
const InlineComboboxSkeleton = ({ count = 5 }) => {
|
|
11265
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11266
|
+
className: "py-1",
|
|
11267
|
+
children: Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx("div", {
|
|
11268
|
+
className: cn(comboboxItemVariants({ interactive: false })),
|
|
11269
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" })
|
|
11270
|
+
}, index))
|
|
11271
|
+
});
|
|
11272
|
+
};
|
|
11273
|
+
InlineComboboxSkeleton.displayName = "InlineComboboxSkeleton";
|
|
11274
|
+
/**
|
|
11275
|
+
* A centered spinner row appended below the list while the next page is loading
|
|
11276
|
+
* (`loadingState="loadingMore"`), so infinite scroll shows progress in place.
|
|
11277
|
+
*/
|
|
11278
|
+
const InlineComboboxSpinnerRow = () => {
|
|
11279
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11280
|
+
className: cn(comboboxItemVariants({ interactive: false }), "justify-center"),
|
|
11281
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: "size-4" })
|
|
11282
|
+
});
|
|
11283
|
+
};
|
|
11284
|
+
InlineComboboxSpinnerRow.displayName = "InlineComboboxSpinnerRow";
|
|
11285
|
+
/**
|
|
11286
|
+
* Invisible sentinel placed at the bottom of the async list. When it scrolls into
|
|
11287
|
+
* view (within 200px) it calls `onFetchMore` once, re-arming whenever the result set's
|
|
11288
|
+
* content changes. Reuses the shared DS infinite-scroll hook so the inline menu paginates
|
|
11289
|
+
* like `DataCombobox`.
|
|
11290
|
+
*
|
|
11291
|
+
* `resetKey` is a CONTENT key (e.g. the joined item ids), not the item count or array
|
|
11292
|
+
* reference. Length alone stalls after a same-size new search; the array reference re-arms on
|
|
11293
|
+
* every render if a consumer rebuilds `items` (e.g. `data ?? []`), which would loop `onFetchMore`.
|
|
11294
|
+
* A content key changes only when the results actually change, and it is converted here into a
|
|
11295
|
+
* stable numeric version for the hook.
|
|
11296
|
+
*/
|
|
11297
|
+
const InlineComboboxFetchSentinel = ({ onFetchMore, resetKey }) => {
|
|
11298
|
+
const versionRef = React.useRef(0);
|
|
11299
|
+
const lastKeyRef = React.useRef(null);
|
|
11300
|
+
if (lastKeyRef.current !== resetKey) {
|
|
11301
|
+
lastKeyRef.current = resetKey;
|
|
11302
|
+
versionRef.current += 1;
|
|
11303
|
+
}
|
|
11304
|
+
const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => node.closest("[data-slot=\"inline-combobox-content\"]"), versionRef.current);
|
|
11305
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11306
|
+
"aria-hidden": true,
|
|
11307
|
+
ref: sentinelRef
|
|
11308
|
+
});
|
|
11309
|
+
};
|
|
11310
|
+
InlineComboboxFetchSentinel.displayName = "InlineComboboxFetchSentinel";
|
|
11311
|
+
//#endregion
|
|
11312
|
+
//#region src/components/toggle.tsx
|
|
11313
|
+
/**
|
|
11314
|
+
* Class-variance-authority variants for {@link Toggle}: `variant` (`default` | `outline`)
|
|
11315
|
+
* and `size` (`default` | `sm` | `lg`).
|
|
11316
|
+
*/
|
|
11317
|
+
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-sm text-foreground font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 data-disabled:pointer-events-none data-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
11318
|
+
variants: {
|
|
11319
|
+
variant: {
|
|
11320
|
+
default: "bg-transparent",
|
|
11321
|
+
outline: "border border-input bg-background"
|
|
11322
|
+
},
|
|
11323
|
+
size: {
|
|
11324
|
+
default: "h-8 min-w-8 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
11325
|
+
sm: "h-6 min-w-6 px-1.5 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
11326
|
+
lg: "h-10 min-w-10 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
|
|
11327
|
+
},
|
|
11328
|
+
pressedColor: {
|
|
11329
|
+
highContrast: "data-pressed:bg-secondary data-pressed:text-secondary-foreground data-pressed:hover:bg-secondary data-pressed:hover:text-secondary-foreground",
|
|
11330
|
+
lowContrast: "data-pressed:bg-muted data-pressed:text-muted-foreground data-pressed:hover:bg-muted data-pressed:hover:text-muted-foreground"
|
|
11331
|
+
}
|
|
11332
|
+
},
|
|
11333
|
+
defaultVariants: {
|
|
11334
|
+
variant: "default",
|
|
11335
|
+
size: "default",
|
|
11336
|
+
pressedColor: "highContrast"
|
|
11337
|
+
}
|
|
11338
|
+
});
|
|
11339
|
+
/**
|
|
11340
|
+
* A two-state button that can be pressed on or off, wrapping Base UI's `Toggle`.
|
|
11341
|
+
* Renders a `<button aria-pressed>` styled via {@link toggleVariants}.
|
|
11342
|
+
*
|
|
11343
|
+
* @example
|
|
11344
|
+
* ```tsx
|
|
11345
|
+
* <Toggle aria-label="Bold">B</Toggle>
|
|
11346
|
+
* ```
|
|
11347
|
+
*/
|
|
11348
|
+
const Toggle = React.forwardRef((componentProps, forwardRef) => {
|
|
11349
|
+
const { className, variant = "default", size = "default", pressedColor = "highContrast", ...props } = componentProps;
|
|
11350
|
+
return /* @__PURE__ */ jsx(Toggle$1, {
|
|
11351
|
+
ref: forwardRef,
|
|
11352
|
+
"data-slot": "toggle",
|
|
11353
|
+
className: cn(toggleVariants({
|
|
11354
|
+
variant,
|
|
11355
|
+
size,
|
|
11356
|
+
pressedColor,
|
|
11357
|
+
className
|
|
11358
|
+
})),
|
|
11359
|
+
...props
|
|
11360
|
+
});
|
|
11361
|
+
});
|
|
11362
|
+
Toggle.displayName = "Toggle";
|
|
11363
|
+
//#endregion
|
|
11364
|
+
//#region src/components/rich-textarea-toolbar.tsx
|
|
11365
|
+
/**
|
|
11366
|
+
* Presentational toggle shared by every toolbar control. Owns the read-only gating: a
|
|
11367
|
+
* disabled editor renders the toggle `disabled` and drops its handlers so `editor.tf`
|
|
11368
|
+
* cannot mutate content. `onMouseDown` preventDefault (from the Plate hook props) keeps
|
|
11369
|
+
* the editor selection when the button is clicked.
|
|
11370
|
+
*/
|
|
11371
|
+
function ToolbarToggle({ label, pressed, onMouseDown, onClick, children }) {
|
|
11372
|
+
const readOnly = useEditorReadOnly();
|
|
11373
|
+
return /* @__PURE__ */ jsx(Toggle, {
|
|
11374
|
+
size: "sm",
|
|
11375
|
+
"aria-label": label,
|
|
11376
|
+
disabled: readOnly,
|
|
11377
|
+
pressed,
|
|
11378
|
+
onMouseDown: readOnly ? void 0 : onMouseDown,
|
|
11379
|
+
onClick: readOnly ? void 0 : onClick,
|
|
11380
|
+
children
|
|
11381
|
+
});
|
|
11382
|
+
}
|
|
11383
|
+
/** A single mark toggle (bold/italic/…) wired to the editor via Plate's mark hooks. */
|
|
11384
|
+
function MarkToggle({ nodeType, label, children }) {
|
|
11385
|
+
const { props } = useMarkToolbarButton(useMarkToolbarButtonState({ nodeType }));
|
|
11386
|
+
return /* @__PURE__ */ jsx(ToolbarToggle, {
|
|
11387
|
+
label,
|
|
11388
|
+
pressed: props.pressed,
|
|
11389
|
+
onMouseDown: props.onMouseDown,
|
|
11390
|
+
onClick: props.onClick,
|
|
11391
|
+
children
|
|
11392
|
+
});
|
|
11393
|
+
}
|
|
11394
|
+
/** A list toggle (bulleted/numbered) wired to the editor via Plate's list hooks. */
|
|
11395
|
+
function ListToggle({ listStyleType, label, children }) {
|
|
11396
|
+
const { props } = useListToolbarButton(useListToolbarButtonState({ nodeType: listStyleType }));
|
|
11397
|
+
return /* @__PURE__ */ jsx(ToolbarToggle, {
|
|
11398
|
+
label,
|
|
11399
|
+
pressed: props.pressed,
|
|
11400
|
+
onMouseDown: props.onMouseDown,
|
|
11401
|
+
onClick: props.onClick,
|
|
11402
|
+
children
|
|
11403
|
+
});
|
|
11404
|
+
}
|
|
11405
|
+
/**
|
|
11406
|
+
* Link control. Opens the same floating link card shown on click / Cmd+K (insert form
|
|
11407
|
+
* when the caret is not on a link, edit card when it is) rather than a bespoke popover,
|
|
11408
|
+
* so link editing is consistent everywhere. Wired via Plate's link toolbar hooks.
|
|
11409
|
+
*/
|
|
11410
|
+
function LinkToggle({ label }) {
|
|
11411
|
+
const { props } = useLinkToolbarButton(useLinkToolbarButtonState());
|
|
11412
|
+
return /* @__PURE__ */ jsx(ToolbarToggle, {
|
|
11413
|
+
label,
|
|
11414
|
+
pressed: props.pressed,
|
|
11415
|
+
onMouseDown: props.onMouseDown,
|
|
11416
|
+
onClick: props.onClick,
|
|
11417
|
+
children: /* @__PURE__ */ jsx(Link, {})
|
|
11418
|
+
});
|
|
11419
|
+
}
|
|
11420
|
+
/**
|
|
11421
|
+
* The control row shared by {@link RichTextareaToolbar} (the static, addon-mounted
|
|
11422
|
+
* toolbar) and `RichTextareaFloatingToolbar` (the selection toolbar). Internal to the
|
|
11423
|
+
* package - not exported from `src/index.ts` - so the two toolbars cannot drift apart.
|
|
11424
|
+
* Renders no wrapper: the caller owns the `role="toolbar"` element and its surface.
|
|
11425
|
+
*/
|
|
11426
|
+
function RichTextareaToolbarControls() {
|
|
11427
|
+
const t = useDsTranslation("ds");
|
|
11428
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11429
|
+
/* @__PURE__ */ jsx(MarkToggle, {
|
|
11430
|
+
nodeType: KEYS.bold,
|
|
11431
|
+
label: t("richTextarea.bold"),
|
|
11432
|
+
children: /* @__PURE__ */ jsx(Bold, {})
|
|
11433
|
+
}),
|
|
11434
|
+
/* @__PURE__ */ jsx(MarkToggle, {
|
|
11435
|
+
nodeType: KEYS.italic,
|
|
11436
|
+
label: t("richTextarea.italic"),
|
|
11437
|
+
children: /* @__PURE__ */ jsx(Italic, {})
|
|
11438
|
+
}),
|
|
11439
|
+
/* @__PURE__ */ jsx(MarkToggle, {
|
|
11440
|
+
nodeType: KEYS.underline,
|
|
11441
|
+
label: t("richTextarea.underline"),
|
|
11442
|
+
children: /* @__PURE__ */ jsx(Underline, {})
|
|
11443
|
+
}),
|
|
11444
|
+
/* @__PURE__ */ jsx(MarkToggle, {
|
|
11445
|
+
nodeType: KEYS.strikethrough,
|
|
11446
|
+
label: t("richTextarea.strikethrough"),
|
|
11447
|
+
children: /* @__PURE__ */ jsx(Strikethrough, {})
|
|
11448
|
+
}),
|
|
11449
|
+
/* @__PURE__ */ jsx(MarkToggle, {
|
|
11450
|
+
nodeType: KEYS.code,
|
|
11451
|
+
label: t("richTextarea.inlineCode"),
|
|
11452
|
+
children: /* @__PURE__ */ jsx(Code, {})
|
|
11453
|
+
}),
|
|
11454
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
11455
|
+
orientation: "vertical",
|
|
11456
|
+
className: "mx-1 h-5"
|
|
11457
|
+
}),
|
|
11458
|
+
/* @__PURE__ */ jsx(ListToggle, {
|
|
11459
|
+
listStyleType: ListStyleType.Disc,
|
|
11460
|
+
label: t("richTextarea.bulletedList"),
|
|
11461
|
+
children: /* @__PURE__ */ jsx(List$1, {})
|
|
11462
|
+
}),
|
|
11463
|
+
/* @__PURE__ */ jsx(ListToggle, {
|
|
11464
|
+
listStyleType: ListStyleType.Decimal,
|
|
11465
|
+
label: t("richTextarea.numberedList"),
|
|
11466
|
+
children: /* @__PURE__ */ jsx(ListOrdered, {})
|
|
11467
|
+
}),
|
|
11468
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
11469
|
+
orientation: "vertical",
|
|
11470
|
+
className: "mx-1 h-5"
|
|
11471
|
+
}),
|
|
11472
|
+
/* @__PURE__ */ jsx(LinkToggle, { label: t("richTextarea.link") })
|
|
11473
|
+
] });
|
|
11474
|
+
}
|
|
11475
|
+
RichTextareaToolbarControls.displayName = "RichTextareaToolbarControls";
|
|
11476
|
+
/**
|
|
11477
|
+
* Formatting toolbar for a {@link RichTextareaRoot} with `formatting`. Renders DS
|
|
11478
|
+
* `Toggle`s wired to the editor: bold / italic / underline / strikethrough / inline
|
|
11479
|
+
* code, bulleted / numbered lists, and a link button that opens the floating link
|
|
11480
|
+
* card (the same card shown on click / Cmd+K). Must render inside a
|
|
11481
|
+
* `RichTextareaRoot` (it reads the editor from the Plate provider) — typically in an
|
|
11482
|
+
* `InputGroupAddon align="block-start"`.
|
|
11483
|
+
*
|
|
11484
|
+
* @example
|
|
11485
|
+
* ```tsx
|
|
11486
|
+
* <RichTextareaRoot formatting>
|
|
11487
|
+
* <InputGroup>
|
|
11488
|
+
* <InputGroupAddon align="block-start"><RichTextareaToolbar /></InputGroupAddon>
|
|
11489
|
+
* <RichTextareaContent bare />
|
|
11490
|
+
* </InputGroup>
|
|
11491
|
+
* </RichTextareaRoot>
|
|
11492
|
+
* ```
|
|
11493
|
+
*/
|
|
11494
|
+
const RichTextareaToolbar = React.forwardRef((componentProps, forwardRef) => {
|
|
11495
|
+
const { className, ...props } = componentProps;
|
|
11496
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11497
|
+
ref: forwardRef,
|
|
11498
|
+
"data-slot": "rich-textarea-toolbar",
|
|
11499
|
+
role: "toolbar",
|
|
11500
|
+
className: cn("flex items-center gap-0.5", className),
|
|
11501
|
+
...props,
|
|
11502
|
+
children: /* @__PURE__ */ jsx(RichTextareaToolbarControls, {})
|
|
11503
|
+
});
|
|
11504
|
+
});
|
|
11505
|
+
RichTextareaToolbar.displayName = "RichTextareaToolbar";
|
|
11506
|
+
//#endregion
|
|
11507
|
+
//#region src/components/rich-textarea-floating-toolbar.tsx
|
|
11508
|
+
const floatingToolbarClassName = "z-50 flex max-w-[80vw] items-center gap-0.5 overflow-x-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none print:hidden";
|
|
11509
|
+
const floatingOptions = {
|
|
11510
|
+
strategy: "fixed",
|
|
11511
|
+
placement: "top",
|
|
11512
|
+
middleware: [
|
|
11513
|
+
offset(8),
|
|
11514
|
+
flip({
|
|
11515
|
+
fallbackPlacements: [
|
|
11516
|
+
"top-start",
|
|
11517
|
+
"top-end",
|
|
11518
|
+
"bottom-start",
|
|
11519
|
+
"bottom-end"
|
|
11520
|
+
],
|
|
11521
|
+
padding: 12
|
|
11522
|
+
}),
|
|
11523
|
+
shift({ padding: 8 })
|
|
11524
|
+
]
|
|
11525
|
+
};
|
|
11526
|
+
/**
|
|
11527
|
+
* Floating formatting toolbar for a {@link RichTextarea} with `formatting` and
|
|
11528
|
+
* `floatingToolbar`. Appears over the current text selection and carries the same
|
|
11529
|
+
* controls as {@link RichTextareaToolbar} (marks, lists, link).
|
|
11530
|
+
*
|
|
11531
|
+
* Mounted by an internal plugin via `render.afterEditable`, so it is never composed
|
|
11532
|
+
* manually and takes no props. It renders nothing when the selection is collapsed or
|
|
11533
|
+
* empty, while the mouse is down, when another editor has focus, when the editor is
|
|
11534
|
+
* read-only (`disabled`), or while the floating link card is open.
|
|
11535
|
+
*/
|
|
11536
|
+
function RichTextareaFloatingToolbar() {
|
|
11537
|
+
const editorId = useEditorId();
|
|
11538
|
+
const focusedEditorId = useEventEditorValue("focus");
|
|
11539
|
+
const isLinkToolbarOpen = usePluginOption(LinkPlugin, "isOpen", editorId);
|
|
11540
|
+
const floatingToolbarState = useFloatingToolbarState({
|
|
11541
|
+
editorId,
|
|
11542
|
+
focusedEditorId,
|
|
11543
|
+
hideToolbar: isLinkToolbarOpen,
|
|
11544
|
+
floatingOptions
|
|
11545
|
+
});
|
|
11546
|
+
const { clickOutsideRef, hidden, props, ref: floatingRef } = useFloatingToolbar(floatingToolbarState);
|
|
11547
|
+
if (hidden) return null;
|
|
11548
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11549
|
+
ref: clickOutsideRef,
|
|
11550
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
11551
|
+
ref: floatingRef,
|
|
11552
|
+
"data-slot": "rich-textarea-floating-toolbar",
|
|
11553
|
+
role: "toolbar",
|
|
11554
|
+
className: floatingToolbarClassName,
|
|
11555
|
+
...props,
|
|
11556
|
+
children: /* @__PURE__ */ jsx(RichTextareaToolbarControls, {})
|
|
11557
|
+
})
|
|
11558
|
+
});
|
|
11559
|
+
}
|
|
11560
|
+
RichTextareaFloatingToolbar.displayName = "RichTextareaFloatingToolbar";
|
|
11561
|
+
//#endregion
|
|
11562
|
+
//#region src/components/rich-textarea-link-toolbar.tsx
|
|
11563
|
+
const floatingCardClassName = "z-50 w-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none";
|
|
11564
|
+
const floatingFieldClassName = "placeholder:text-muted-foreground flex h-8 w-full rounded-md border-none bg-transparent px-1.5 py-1 text-sm outline-none";
|
|
11565
|
+
/** Opens the current link in a new tab; re-reads the href on every selection change. */
|
|
11566
|
+
function LinkOpenButton() {
|
|
11567
|
+
const editor = useEditorRef();
|
|
11568
|
+
const t = useDsTranslation("ds");
|
|
11569
|
+
useEditorSelection();
|
|
11570
|
+
const entry = editor.api.node({ match: { type: editor.getType(KEYS.link) } });
|
|
11571
|
+
const attributes = entry ? getLinkAttributes(editor, entry[0]) : {};
|
|
11572
|
+
return /* @__PURE__ */ jsx("a", {
|
|
11573
|
+
...attributes,
|
|
11574
|
+
className: buttonVariants({
|
|
11575
|
+
size: "sm",
|
|
11576
|
+
variant: "ghost"
|
|
11577
|
+
}),
|
|
11578
|
+
onMouseOver: (event) => event.stopPropagation(),
|
|
11579
|
+
"aria-label": t("richTextarea.linkOpen"),
|
|
11580
|
+
target: "_blank",
|
|
11581
|
+
rel: "noreferrer",
|
|
11582
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { className: "size-4" })
|
|
11583
|
+
});
|
|
11584
|
+
}
|
|
11585
|
+
/**
|
|
11586
|
+
* Floating link UI for a {@link RichTextarea} with `formatting`. Mounted by the
|
|
11587
|
+
* `LinkPlugin` via `render.afterEditable`, so it is not composed manually (it takes no
|
|
11588
|
+
* props). It shows:
|
|
11589
|
+
*
|
|
11590
|
+
* - an insert form (URL + text to display) when creating a link (Cmd/Ctrl+K), and
|
|
11591
|
+
* - an edit card (Edit link / open in new tab / remove) when the caret is on a link,
|
|
11592
|
+
* which swaps to the same URL + text form once "Edit link" is pressed.
|
|
11593
|
+
*
|
|
11594
|
+
* Renders nothing when neither form is active.
|
|
11595
|
+
*/
|
|
11596
|
+
function RichTextareaLinkToolbar() {
|
|
11597
|
+
const t = useDsTranslation("ds");
|
|
11598
|
+
const readOnly = useEditorReadOnly();
|
|
11599
|
+
const floatingOptions = {
|
|
11600
|
+
strategy: "fixed",
|
|
11601
|
+
placement: "bottom-start",
|
|
11602
|
+
middleware: [
|
|
11603
|
+
offset(8),
|
|
11604
|
+
flip({
|
|
11605
|
+
fallbackPlacements: [
|
|
11606
|
+
"bottom-end",
|
|
11607
|
+
"top-start",
|
|
11608
|
+
"top-end"
|
|
11609
|
+
],
|
|
11610
|
+
padding: 12
|
|
11611
|
+
}),
|
|
11612
|
+
shift({ padding: 8 })
|
|
11613
|
+
]
|
|
11614
|
+
};
|
|
11615
|
+
const insertState = useFloatingLinkInsertState({ floatingOptions });
|
|
11616
|
+
const { hidden, props: insertProps, ref: insertRef, textInputProps } = useFloatingLinkInsert(insertState);
|
|
11617
|
+
const editState = useFloatingLinkEditState({ floatingOptions });
|
|
11618
|
+
const { editButtonProps, props: editProps, ref: editRef, unlinkButtonProps } = useFloatingLinkEdit(editState);
|
|
11619
|
+
if (hidden || readOnly) return null;
|
|
11620
|
+
const form = /* @__PURE__ */ jsxs("div", {
|
|
11621
|
+
className: "flex w-[330px] flex-col",
|
|
11622
|
+
children: [
|
|
11623
|
+
/* @__PURE__ */ jsxs("div", {
|
|
11624
|
+
className: "flex items-center",
|
|
11625
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
11626
|
+
className: "text-muted-foreground flex items-center pr-1 pl-2",
|
|
11627
|
+
children: /* @__PURE__ */ jsx(Link, { className: "size-4" })
|
|
11628
|
+
}), /* @__PURE__ */ jsx(FloatingLinkUrlInput, {
|
|
11629
|
+
className: floatingFieldClassName,
|
|
11630
|
+
placeholder: t("richTextarea.linkPlaceholder"),
|
|
11631
|
+
"data-plate-focus": true
|
|
11632
|
+
})]
|
|
11633
|
+
}),
|
|
11634
|
+
/* @__PURE__ */ jsx(Separator, { className: "my-1" }),
|
|
11635
|
+
/* @__PURE__ */ jsxs("div", {
|
|
11636
|
+
className: "flex items-center",
|
|
11637
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
11638
|
+
className: "text-muted-foreground flex items-center pr-1 pl-2",
|
|
11639
|
+
children: /* @__PURE__ */ jsx(Text, { className: "size-4" })
|
|
11640
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
11641
|
+
className: floatingFieldClassName,
|
|
11642
|
+
placeholder: t("richTextarea.linkText"),
|
|
11643
|
+
"data-plate-focus": true,
|
|
11644
|
+
...textInputProps
|
|
11645
|
+
})]
|
|
11646
|
+
})
|
|
11647
|
+
]
|
|
11648
|
+
});
|
|
11649
|
+
const editContent = editState.isEditing ? form : /* @__PURE__ */ jsxs("div", {
|
|
11650
|
+
className: "flex items-center",
|
|
11651
|
+
children: [
|
|
11652
|
+
/* @__PURE__ */ jsx("button", {
|
|
11653
|
+
className: buttonVariants({
|
|
11654
|
+
size: "sm",
|
|
11655
|
+
variant: "ghost"
|
|
11656
|
+
}),
|
|
11657
|
+
type: "button",
|
|
11658
|
+
...editButtonProps,
|
|
11659
|
+
children: t("richTextarea.linkEdit")
|
|
11660
|
+
}),
|
|
11661
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
11662
|
+
orientation: "vertical",
|
|
11663
|
+
className: "mx-1 h-6"
|
|
11664
|
+
}),
|
|
11665
|
+
/* @__PURE__ */ jsx(LinkOpenButton, {}),
|
|
11666
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
11667
|
+
orientation: "vertical",
|
|
11668
|
+
className: "mx-1 h-6"
|
|
11669
|
+
}),
|
|
11670
|
+
/* @__PURE__ */ jsx("button", {
|
|
11671
|
+
className: buttonVariants({
|
|
11672
|
+
size: "sm",
|
|
11673
|
+
variant: "ghost"
|
|
11674
|
+
}),
|
|
11675
|
+
type: "button",
|
|
11676
|
+
"aria-label": t("richTextarea.linkRemove"),
|
|
11677
|
+
...unlinkButtonProps,
|
|
11678
|
+
children: /* @__PURE__ */ jsx(Unlink, { className: "size-4" })
|
|
11679
|
+
})
|
|
11680
|
+
]
|
|
11681
|
+
});
|
|
11682
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
11683
|
+
ref: insertRef,
|
|
11684
|
+
className: floatingCardClassName,
|
|
11685
|
+
...insertProps,
|
|
11686
|
+
children: form
|
|
11687
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
11688
|
+
ref: editRef,
|
|
11689
|
+
className: floatingCardClassName,
|
|
11690
|
+
...editProps,
|
|
11691
|
+
children: editContent
|
|
11692
|
+
})] });
|
|
11693
|
+
}
|
|
11694
|
+
RichTextareaLinkToolbar.displayName = "RichTextareaLinkToolbar";
|
|
11695
|
+
//#endregion
|
|
11696
|
+
//#region src/components/rich-textarea.tsx
|
|
11697
|
+
const RichTextareaContext = React.createContext({
|
|
11698
|
+
mentions: [],
|
|
11699
|
+
tags: [],
|
|
11700
|
+
slashCommands: [],
|
|
11701
|
+
formatting: false,
|
|
11702
|
+
submitOnEnter: true,
|
|
11703
|
+
disabled: false
|
|
11704
|
+
});
|
|
11705
|
+
/**
|
|
11706
|
+
* Splits a `mentions`/`tags` prop (a static array or an async config) into the current
|
|
11707
|
+
* items list plus the async config (if any). `Array.isArray` is the discriminant.
|
|
11708
|
+
*/
|
|
11709
|
+
function normalizeOptionList(prop) {
|
|
11710
|
+
if (prop === void 0) return { items: [] };
|
|
11711
|
+
if (Array.isArray(prop)) return { items: prop };
|
|
11712
|
+
return {
|
|
11713
|
+
items: prop.items,
|
|
11714
|
+
async: prop
|
|
11715
|
+
};
|
|
11716
|
+
}
|
|
11717
|
+
/**
|
|
11718
|
+
* Reconstructs one line of plain text into inline nodes, turning `#tag` / `@mention` tokens
|
|
11719
|
+
* that match a known option (by label, longest-first, on a word boundary) back into pills.
|
|
11720
|
+
* Mirrors what buildPayload emits (`#value` / `@value`), so a persisted `plainText` note
|
|
11721
|
+
* reloads with its pills intact. Text and pills are interleaved so inline void nodes always
|
|
11722
|
+
* have text siblings (valid Slate structure).
|
|
11723
|
+
*/
|
|
11724
|
+
function parseInlineTokens(line, mentions, tags) {
|
|
11725
|
+
const byTrigger = {
|
|
11726
|
+
"#": [...tags].sort((a, b) => b.label.length - a.label.length),
|
|
11727
|
+
"@": [...mentions].sort((a, b) => b.label.length - a.label.length)
|
|
11728
|
+
};
|
|
11729
|
+
const children = [];
|
|
11730
|
+
let buffer = "";
|
|
11731
|
+
let i = 0;
|
|
11732
|
+
while (i < line.length) {
|
|
11733
|
+
const ch = line[i];
|
|
11734
|
+
const opts = (i === 0 || /\s/.test(line[i - 1])) && (ch === "#" || ch === "@") ? byTrigger[ch] : void 0;
|
|
11735
|
+
const rest = opts ? line.slice(i + 1) : "";
|
|
11736
|
+
const option = opts?.find((o) => {
|
|
11737
|
+
if (!o.label || !rest.startsWith(o.label)) return false;
|
|
11738
|
+
const after = rest[o.label.length];
|
|
11739
|
+
return after === void 0 || !/[A-Za-z0-9]/.test(after);
|
|
11740
|
+
});
|
|
11741
|
+
if (option) {
|
|
11742
|
+
children.push({ text: buffer });
|
|
11743
|
+
buffer = "";
|
|
11744
|
+
children.push({
|
|
11745
|
+
type: ch === "#" ? "tag" : "mention",
|
|
11746
|
+
value: option.label,
|
|
11747
|
+
key: option.id,
|
|
11748
|
+
children: [{ text: "" }]
|
|
11749
|
+
});
|
|
11750
|
+
i += 1 + option.label.length;
|
|
11751
|
+
continue;
|
|
11752
|
+
}
|
|
11753
|
+
buffer += ch;
|
|
11754
|
+
i++;
|
|
11755
|
+
}
|
|
11756
|
+
children.push({ text: buffer });
|
|
11757
|
+
return children;
|
|
11758
|
+
}
|
|
11759
|
+
/**
|
|
11760
|
+
* Builds the initial editor `Value` from the `value` prop. A plain-text string is split on
|
|
11761
|
+
* newlines into paragraph blocks, with `#tag`/`@mention` tokens reparsed into pills (see
|
|
11762
|
+
* parseInlineTokens); a JSON AST is used as-is.
|
|
11763
|
+
*/
|
|
11764
|
+
function toInitialValue(value, mentions, tags) {
|
|
11765
|
+
if (value === void 0) return [{
|
|
11766
|
+
type: "p",
|
|
11767
|
+
children: [{ text: "" }]
|
|
11768
|
+
}];
|
|
11769
|
+
if (typeof value === "string") return value.split("\n").map((line) => ({
|
|
11770
|
+
type: "p",
|
|
11771
|
+
children: parseInlineTokens(line, mentions, tags)
|
|
11772
|
+
}));
|
|
11773
|
+
return value;
|
|
11774
|
+
}
|
|
11775
|
+
/**
|
|
11776
|
+
* Plain-text of one node, including mention/tag labels. `editor.api.string` only walks
|
|
11777
|
+
* text children, but mention and tag nodes are void with empty text and keep their label
|
|
11778
|
+
* on `value`, so it would drop the `@mention`/`#tag` text the user sees.
|
|
11779
|
+
*/
|
|
11780
|
+
function nodeToPlainText(node) {
|
|
11781
|
+
if (typeof node.text === "string") return node.text;
|
|
11782
|
+
if (node.type === "mention") return `@${node.value ?? ""}`;
|
|
11783
|
+
if (node.type === "tag") return `#${node.value ?? ""}`;
|
|
11784
|
+
return (node.children ?? []).map(nodeToPlainText).join("");
|
|
11785
|
+
}
|
|
11786
|
+
/** Serializes the editor to the `{ plainText, json, markdown? }` change/submit payload. */
|
|
11787
|
+
function buildPayload(editor, formatting) {
|
|
11788
|
+
const payload = {
|
|
11789
|
+
plainText: editor.children.map(nodeToPlainText).join("\n"),
|
|
11790
|
+
json: editor.children
|
|
11791
|
+
};
|
|
11792
|
+
if (formatting) {
|
|
11793
|
+
const markdown = editor.api.markdown;
|
|
11794
|
+
if (markdown) try {
|
|
11795
|
+
payload.markdown = markdown.serialize();
|
|
11796
|
+
} catch {
|
|
11797
|
+
payload.markdown = void 0;
|
|
11798
|
+
}
|
|
11799
|
+
}
|
|
11800
|
+
return payload;
|
|
11801
|
+
}
|
|
11802
|
+
/**
|
|
11803
|
+
* Runs the Enter-to-submit pipeline: convert a trailing bare URL to a link (formatting only,
|
|
11804
|
+
* see autolinkTrailingUrl), then emit the payload via `onSubmit`. Shared by the editable's
|
|
11805
|
+
* key handler and the no-match commit path so both submit identically.
|
|
11806
|
+
*/
|
|
11807
|
+
function submitEditor(editor, formatting, onSubmit) {
|
|
11808
|
+
if (formatting) autolinkTrailingUrl(editor);
|
|
11809
|
+
onSubmit?.(buildPayload(editor, formatting));
|
|
11810
|
+
}
|
|
11811
|
+
/**
|
|
11812
|
+
* Links a bare URL sitting at the caret right before submit. The autolink input rules
|
|
11813
|
+
* only fire on space / break / paste, so a URL typed immediately before Enter-to-send
|
|
11814
|
+
* (`https://example.com` with no trailing space) would otherwise submit as plain text
|
|
11815
|
+
* with no link node in `json`. Mirrors Plate's break-variant autolink; best-effort.
|
|
11816
|
+
*/
|
|
11817
|
+
function autolinkTrailingUrl(editor) {
|
|
11818
|
+
try {
|
|
11819
|
+
const { selection } = editor;
|
|
11820
|
+
if (!selection || !editor.api.isCollapsed()) return;
|
|
11821
|
+
if (editor.api.some({
|
|
11822
|
+
at: selection,
|
|
11823
|
+
match: { type: editor.getType(KEYS.link) }
|
|
11824
|
+
})) return;
|
|
11825
|
+
const blockRange = editor.api.range("start", selection);
|
|
11826
|
+
if (!blockRange) return;
|
|
11827
|
+
const token = (editor.api.string(blockRange).split(/\s+/).pop() ?? "").trim();
|
|
11828
|
+
if (!token || !validateUrl(editor, token)) return;
|
|
11829
|
+
const startPoint = editor.api.before(selection, {
|
|
11830
|
+
distance: token.length,
|
|
11831
|
+
unit: "character"
|
|
11832
|
+
});
|
|
11833
|
+
if (!startPoint) return;
|
|
11834
|
+
editor.tf.select({
|
|
11835
|
+
anchor: startPoint,
|
|
11836
|
+
focus: selection.anchor
|
|
11837
|
+
});
|
|
11838
|
+
upsertLink(editor, { url: token });
|
|
11839
|
+
editor.tf.collapse({ edge: "end" });
|
|
11840
|
+
} catch {}
|
|
11841
|
+
}
|
|
11842
|
+
/**
|
|
11843
|
+
* Renders an inserted `@mention` as a non-editable, name-only pill. Slack-style: the
|
|
11844
|
+
* avatar is shown in the menu (to disambiguate people while choosing), but the inserted
|
|
11845
|
+
* pill is just the styled name, so mentions read cleanly inline.
|
|
11846
|
+
*/
|
|
11847
|
+
function MentionElement(props) {
|
|
11848
|
+
const { element } = props;
|
|
11849
|
+
const { mentions } = React.useContext(RichTextareaContext);
|
|
11850
|
+
const selected = useSelected();
|
|
11851
|
+
const focused = useFocused();
|
|
11852
|
+
const readOnly = useReadOnly();
|
|
11853
|
+
const stored = element;
|
|
11854
|
+
const option = mentions.find((m) => m.id === stored.key) ?? mentions.find((m) => m.label === element.value);
|
|
11855
|
+
const color = stored.color ?? option?.color;
|
|
11856
|
+
const label = String(element.value ?? "");
|
|
11857
|
+
return /* @__PURE__ */ jsxs(PlateElement, {
|
|
11858
|
+
...props,
|
|
11859
|
+
as: "span",
|
|
11860
|
+
attributes: {
|
|
11861
|
+
...props.attributes,
|
|
11862
|
+
contentEditable: false,
|
|
11863
|
+
draggable: true
|
|
11864
|
+
},
|
|
11865
|
+
children: [/* @__PURE__ */ jsx(Chip, {
|
|
11866
|
+
color,
|
|
11867
|
+
className: cn("align-middle", !readOnly && "cursor-pointer", selected && focused && "ring-2 ring-ring"),
|
|
11868
|
+
children: `@${label}`
|
|
11869
|
+
}), props.children]
|
|
11870
|
+
});
|
|
11871
|
+
}
|
|
11872
|
+
const onSelectMention = getMentionOnSelectItem();
|
|
11873
|
+
/**
|
|
11874
|
+
* Inserts an async-selected mention node directly. The mention plugin's own
|
|
11875
|
+
* `tf.insert.mention` destructures only `{ key, value }`, so it would drop avatar/color;
|
|
11876
|
+
* inserting the node here persists them so the pill stays self-describing after the
|
|
11877
|
+
* loaded page changes or the note is reloaded from `json`. Mirrors `insertTag` and the
|
|
11878
|
+
* plugin's move + trailing-space (matching `insertSpaceAfterMention`).
|
|
11879
|
+
*/
|
|
11880
|
+
function insertMentionNode(editor, option) {
|
|
11881
|
+
editor.tf.insertNodes({
|
|
11882
|
+
children: [{ text: "" }],
|
|
11883
|
+
type: "mention",
|
|
11884
|
+
value: option.label,
|
|
11885
|
+
key: option.id,
|
|
11886
|
+
...option.avatar ? { avatar: option.avatar } : {},
|
|
11887
|
+
...option.color ? { color: option.color } : {}
|
|
11888
|
+
});
|
|
11889
|
+
editor.tf.move({ unit: "offset" });
|
|
11890
|
+
const path = editor.api.block()?.[1];
|
|
11891
|
+
if (editor.selection && path && editor.api.isEnd(editor.selection.anchor, path)) editor.tf.insertText(" ");
|
|
11892
|
+
}
|
|
11893
|
+
/**
|
|
11894
|
+
* The `@` autocomplete input. With a static `mentions` array it filters client-side;
|
|
11895
|
+
* with a {@link RichTextareaAsyncList} it disables the internal filter, surfaces the
|
|
11896
|
+
* query via `onSearch`, renders the `loadingState` (skeletons / spinner row), paginates
|
|
11897
|
+
* via a scroll sentinel, and silently dismisses on no match (no empty row by default).
|
|
11898
|
+
*/
|
|
11899
|
+
function MentionInputElement(props) {
|
|
11900
|
+
const { editor, element } = props;
|
|
11901
|
+
const { mentions, mentionsAsync, submitOnEnter, formatting, onSubmit } = React.useContext(RichTextareaContext);
|
|
11902
|
+
const initialQuery = element.query ?? "";
|
|
11903
|
+
const [search, setSearch] = React.useState(initialQuery);
|
|
11904
|
+
const t = useDsTranslation("ds");
|
|
11905
|
+
const onSearchRef = React.useRef(mentionsAsync?.onSearch);
|
|
11906
|
+
onSearchRef.current = mentionsAsync?.onSearch;
|
|
11907
|
+
React.useEffect(() => {
|
|
11908
|
+
onSearchRef.current?.(search);
|
|
11909
|
+
}, [search]);
|
|
11910
|
+
const loadingState = mentionsAsync?.loadingState;
|
|
11911
|
+
const noMatch = !!mentionsAsync && !(loadingState === "loading" || loadingState === "filtering" || loadingState === "loadingMore") && search.length > 0 && mentions.length === 0;
|
|
11912
|
+
return /* @__PURE__ */ jsxs(PlateElement, {
|
|
11913
|
+
...props,
|
|
11914
|
+
as: "span",
|
|
11915
|
+
children: [
|
|
11916
|
+
/* @__PURE__ */ jsxs(InlineCombobox, {
|
|
11917
|
+
value: search,
|
|
11918
|
+
element,
|
|
11919
|
+
setValue: setSearch,
|
|
11920
|
+
showTrigger: false,
|
|
11921
|
+
trigger: "@",
|
|
11922
|
+
filter: mentionsAsync ? false : void 0,
|
|
11923
|
+
loadingState,
|
|
11924
|
+
initialInputValue: initialQuery || void 0,
|
|
11925
|
+
onNoMatchEnter: () => submitOnEnter ? submitEditor(editor, formatting, onSubmit) : editor.tf.insertBreak(),
|
|
11926
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
11927
|
+
className: "inline-flex items-center align-middle text-sm",
|
|
11928
|
+
children: ["@", /* @__PURE__ */ jsx(InlineComboboxInput, {})]
|
|
11929
|
+
}), /* @__PURE__ */ jsx(InlineComboboxContent, { children: loadingState === "loading" ? /* @__PURE__ */ jsx(InlineComboboxSkeleton, { count: mentionsAsync?.skeletonCount }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11930
|
+
/* @__PURE__ */ jsx(InlineComboboxGroup, { children: mentions.map((m) => /* @__PURE__ */ jsxs(InlineComboboxItem, {
|
|
11931
|
+
value: m.label,
|
|
11932
|
+
onClick: () => mentionsAsync ? insertMentionNode(editor, m) : onSelectMention(editor, {
|
|
11933
|
+
key: m.id,
|
|
11934
|
+
text: m.label
|
|
11935
|
+
}, search),
|
|
11936
|
+
children: [m.avatar ? /* @__PURE__ */ jsxs(Avatar, {
|
|
11937
|
+
size: "xs",
|
|
11938
|
+
className: "mr-2 size-5",
|
|
11939
|
+
children: [/* @__PURE__ */ jsx(AvatarImage, {
|
|
11940
|
+
src: m.avatar,
|
|
11941
|
+
alt: m.label
|
|
11942
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, { children: m.label.slice(0, 1) })]
|
|
11943
|
+
}) : null, m.label]
|
|
11944
|
+
}, m.id)) }),
|
|
11945
|
+
loadingState === "loadingMore" ? /* @__PURE__ */ jsx(InlineComboboxSpinnerRow, {}) : null,
|
|
11946
|
+
mentionsAsync?.onFetchMore && mentionsAsync.hasMore ? /* @__PURE__ */ jsx(InlineComboboxFetchSentinel, {
|
|
11947
|
+
onFetchMore: mentionsAsync.onFetchMore,
|
|
11948
|
+
resetKey: mentions.map((m) => m.id).join("|")
|
|
11949
|
+
}) : null
|
|
11950
|
+
] }) })]
|
|
11951
|
+
}),
|
|
11952
|
+
mentionsAsync ? /* @__PURE__ */ jsx("span", {
|
|
11953
|
+
role: "status",
|
|
11954
|
+
"aria-live": "polite",
|
|
11955
|
+
contentEditable: false,
|
|
11956
|
+
className: "sr-only",
|
|
11957
|
+
children: noMatch ? t("richTextarea.noResults") : ""
|
|
11958
|
+
}) : null,
|
|
11959
|
+
props.children
|
|
11960
|
+
]
|
|
11961
|
+
});
|
|
11962
|
+
}
|
|
11963
|
+
const BaseTagInputPlugin = createSlatePlugin({
|
|
11964
|
+
key: "tag_input",
|
|
11965
|
+
node: {
|
|
11966
|
+
isElement: true,
|
|
11967
|
+
isInline: true,
|
|
11968
|
+
isVoid: true,
|
|
11969
|
+
type: "tag_input"
|
|
11970
|
+
}
|
|
11971
|
+
});
|
|
11972
|
+
const BaseTagPlugin = createTSlatePlugin({
|
|
11973
|
+
key: "tag",
|
|
11974
|
+
node: {
|
|
11975
|
+
isElement: true,
|
|
11976
|
+
isInline: true,
|
|
11977
|
+
isMarkableVoid: true,
|
|
11978
|
+
isVoid: true,
|
|
11979
|
+
type: "tag"
|
|
11980
|
+
},
|
|
11981
|
+
options: {
|
|
11982
|
+
trigger: "#",
|
|
11983
|
+
triggerPreviousCharPattern: /^\s?$/,
|
|
11984
|
+
createComboboxInput: (trigger) => ({
|
|
11985
|
+
children: [{ text: "" }],
|
|
11986
|
+
trigger,
|
|
11987
|
+
type: "tag_input"
|
|
11988
|
+
})
|
|
11989
|
+
},
|
|
11990
|
+
plugins: [BaseTagInputPlugin]
|
|
11991
|
+
}).overrideEditor(withTriggerCombobox);
|
|
11992
|
+
const TagPluginBase = toPlatePlugin(BaseTagPlugin);
|
|
11993
|
+
const TagInputPluginBase = toPlatePlugin(BaseTagInputPlugin);
|
|
11994
|
+
/** Renders an inserted `#tag` as a non-editable DS {@link Badge} pill. */
|
|
11995
|
+
function TagElement(props) {
|
|
11996
|
+
const { element } = props;
|
|
11997
|
+
const { tags } = React.useContext(RichTextareaContext);
|
|
11998
|
+
const selected = useSelected();
|
|
11999
|
+
const focused = useFocused();
|
|
12000
|
+
const readOnly = useReadOnly();
|
|
12001
|
+
const stored = element;
|
|
12002
|
+
const option = tags.find((t) => t.id === stored.key) ?? tags.find((t) => t.label === element.value);
|
|
12003
|
+
const appearance = stored.color != null || stored.tone != null || stored.legacyColor != null ? stored : option;
|
|
12004
|
+
return /* @__PURE__ */ jsxs(PlateElement, {
|
|
12005
|
+
...props,
|
|
12006
|
+
as: "span",
|
|
12007
|
+
attributes: {
|
|
12008
|
+
...props.attributes,
|
|
12009
|
+
contentEditable: false,
|
|
12010
|
+
draggable: true
|
|
12011
|
+
},
|
|
12012
|
+
children: [/* @__PURE__ */ jsx(Badge, {
|
|
12013
|
+
color: appearance?.color,
|
|
12014
|
+
tone: appearance?.tone,
|
|
12015
|
+
legacyColor: appearance?.legacyColor,
|
|
12016
|
+
className: cn("align-middle", !readOnly && "cursor-pointer", selected && focused && "ring-2 ring-ring"),
|
|
12017
|
+
children: `#${element.value}`
|
|
12018
|
+
}), props.children]
|
|
12019
|
+
});
|
|
12020
|
+
}
|
|
12021
|
+
/**
|
|
12022
|
+
* The `#` autocomplete input. Tags are select-only (no free-text creation): with a static
|
|
12023
|
+
* `tags` array it filters client-side; with a {@link RichTextareaAsyncList} it disables the
|
|
12024
|
+
* internal filter, surfaces the query via `onSearch`, renders the `loadingState`, and paginates
|
|
12025
|
+
* via a scroll sentinel. Like mentions, an unmatched `#query` stays plain text (Enter commits
|
|
12026
|
+
* and submits it).
|
|
12027
|
+
*/
|
|
12028
|
+
function TagInputElement(props) {
|
|
12029
|
+
const { editor, element } = props;
|
|
12030
|
+
const { tags, tagsAsync, submitOnEnter, formatting, onSubmit } = React.useContext(RichTextareaContext);
|
|
12031
|
+
const initialQuery = element.query ?? "";
|
|
12032
|
+
const [search, setSearch] = React.useState(initialQuery);
|
|
12033
|
+
const t = useDsTranslation("ds");
|
|
12034
|
+
const onSearchRef = React.useRef(tagsAsync?.onSearch);
|
|
12035
|
+
onSearchRef.current = tagsAsync?.onSearch;
|
|
12036
|
+
React.useEffect(() => {
|
|
12037
|
+
onSearchRef.current?.(search);
|
|
12038
|
+
}, [search]);
|
|
12039
|
+
const loadingState = tagsAsync?.loadingState;
|
|
12040
|
+
const noMatch = !!tagsAsync && !(loadingState === "loading" || loadingState === "filtering" || loadingState === "loadingMore") && search.length > 0 && tags.length === 0;
|
|
12041
|
+
const insertTag = (tag) => {
|
|
12042
|
+
editor.tf.insertNodes({
|
|
12043
|
+
children: [{ text: "" }],
|
|
12044
|
+
type: "tag",
|
|
12045
|
+
value: tag.label,
|
|
12046
|
+
key: tag.id,
|
|
12047
|
+
...tag.color ? { color: tag.color } : {},
|
|
12048
|
+
...tag.tone ? { tone: tag.tone } : {},
|
|
12049
|
+
...tag.legacyColor ? { legacyColor: tag.legacyColor } : {}
|
|
12050
|
+
});
|
|
12051
|
+
editor.tf.move({ unit: "offset" });
|
|
12052
|
+
const path = editor.api.block()?.[1];
|
|
12053
|
+
if (editor.selection && path && editor.api.isEnd(editor.selection.anchor, path)) editor.tf.insertText(" ");
|
|
12054
|
+
};
|
|
12055
|
+
return /* @__PURE__ */ jsxs(PlateElement, {
|
|
12056
|
+
...props,
|
|
12057
|
+
as: "span",
|
|
12058
|
+
children: [
|
|
12059
|
+
/* @__PURE__ */ jsxs(InlineCombobox, {
|
|
12060
|
+
value: search,
|
|
12061
|
+
element,
|
|
12062
|
+
setValue: setSearch,
|
|
12063
|
+
showTrigger: false,
|
|
12064
|
+
trigger: "#",
|
|
12065
|
+
filter: tagsAsync ? false : void 0,
|
|
12066
|
+
loadingState,
|
|
12067
|
+
initialInputValue: initialQuery || void 0,
|
|
12068
|
+
onNoMatchEnter: () => submitOnEnter ? submitEditor(editor, formatting, onSubmit) : editor.tf.insertBreak(),
|
|
12069
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
12070
|
+
className: "inline-flex items-center align-middle text-sm",
|
|
12071
|
+
children: ["#", /* @__PURE__ */ jsx(InlineComboboxInput, {})]
|
|
12072
|
+
}), /* @__PURE__ */ jsx(InlineComboboxContent, { children: loadingState === "loading" ? /* @__PURE__ */ jsx(InlineComboboxSkeleton, { count: tagsAsync?.skeletonCount }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12073
|
+
/* @__PURE__ */ jsx(InlineComboboxGroup, { children: tags.map((tag) => /* @__PURE__ */ jsx(InlineComboboxItem, {
|
|
12074
|
+
value: tag.label,
|
|
12075
|
+
onClick: () => insertTag(tag),
|
|
12076
|
+
children: /* @__PURE__ */ jsx(Badge, {
|
|
12077
|
+
color: tag.color,
|
|
12078
|
+
tone: tag.tone,
|
|
12079
|
+
legacyColor: tag.legacyColor,
|
|
12080
|
+
children: tag.label
|
|
12081
|
+
})
|
|
12082
|
+
}, tag.id)) }),
|
|
12083
|
+
loadingState === "loadingMore" ? /* @__PURE__ */ jsx(InlineComboboxSpinnerRow, {}) : null,
|
|
12084
|
+
tagsAsync?.onFetchMore && tagsAsync.hasMore ? /* @__PURE__ */ jsx(InlineComboboxFetchSentinel, {
|
|
12085
|
+
onFetchMore: tagsAsync.onFetchMore,
|
|
12086
|
+
resetKey: tags.map((t) => t.id).join("|")
|
|
12087
|
+
}) : null
|
|
12088
|
+
] }) })]
|
|
12089
|
+
}),
|
|
12090
|
+
tagsAsync ? /* @__PURE__ */ jsx("span", {
|
|
12091
|
+
role: "status",
|
|
12092
|
+
"aria-live": "polite",
|
|
12093
|
+
contentEditable: false,
|
|
12094
|
+
className: "sr-only",
|
|
12095
|
+
children: noMatch ? t("richTextarea.noResults") : ""
|
|
12096
|
+
}) : null,
|
|
12097
|
+
props.children
|
|
12098
|
+
]
|
|
12099
|
+
});
|
|
12100
|
+
}
|
|
12101
|
+
/** The `/` command menu: lists `slashCommands`; selecting runs `onSelect` (no node inserted). */
|
|
12102
|
+
function SlashInputElement(props) {
|
|
12103
|
+
const { editor, element } = props;
|
|
12104
|
+
const { slashCommands } = React.useContext(RichTextareaContext);
|
|
12105
|
+
const t = useDsTranslation("ds");
|
|
12106
|
+
return /* @__PURE__ */ jsxs(PlateElement, {
|
|
12107
|
+
...props,
|
|
12108
|
+
as: "span",
|
|
12109
|
+
children: [/* @__PURE__ */ jsxs(InlineCombobox, {
|
|
12110
|
+
element,
|
|
12111
|
+
trigger: "/",
|
|
12112
|
+
children: [/* @__PURE__ */ jsx(InlineComboboxInput, {}), /* @__PURE__ */ jsxs(InlineComboboxContent, { children: [/* @__PURE__ */ jsx(InlineComboboxEmpty, { children: t("richTextarea.slashNoCommands") }), /* @__PURE__ */ jsx(InlineComboboxGroup, { children: slashCommands.map((command) => /* @__PURE__ */ jsxs(InlineComboboxItem, {
|
|
12113
|
+
value: command.label,
|
|
12114
|
+
className: "h-auto py-1.5",
|
|
12115
|
+
onClick: () => command.onSelect?.(editor),
|
|
12116
|
+
children: [command.icon ? /* @__PURE__ */ jsx(ItemMedia, { children: command.icon }) : null, /* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, { children: command.label }), command.description ? /* @__PURE__ */ jsx(ItemDescription, { children: command.description }) : null] })]
|
|
12117
|
+
}, command.id)) })] })]
|
|
12118
|
+
}), props.children]
|
|
12119
|
+
});
|
|
12120
|
+
}
|
|
12121
|
+
/**
|
|
12122
|
+
* Renders a link node as a styled inline `<a>` (LinkPlugin ships no default component).
|
|
12123
|
+
* Uses `linkStyle` (DS color + underline) rather than `anchorVariants`, which is
|
|
12124
|
+
* `inline-flex` for icon composition and would break the whitespace flow of an inline
|
|
12125
|
+
* text link (collapsing the space before it and doubling it after).
|
|
12126
|
+
*/
|
|
12127
|
+
function LinkElement(props) {
|
|
12128
|
+
const { editor, element } = props;
|
|
12129
|
+
return /* @__PURE__ */ jsx(PlateElement, {
|
|
12130
|
+
...props,
|
|
12131
|
+
as: "a",
|
|
12132
|
+
className: cn(linkStyle, "cursor-pointer font-medium transition-colors hover:text-primary/80"),
|
|
12133
|
+
attributes: {
|
|
12134
|
+
...props.attributes,
|
|
12135
|
+
...getLinkAttributes(editor, element),
|
|
12136
|
+
rel: "noreferrer",
|
|
12137
|
+
target: "_blank"
|
|
12138
|
+
},
|
|
12139
|
+
children: props.children
|
|
12140
|
+
});
|
|
12141
|
+
}
|
|
12142
|
+
/**
|
|
12143
|
+
* Plugins registered when `formatting` is on: basic marks (bold/italic/underline/
|
|
12144
|
+
* strikethrough/code), lists (bulleted/numbered), link, and Markdown serialization.
|
|
12145
|
+
*
|
|
12146
|
+
* `MarkdownPlugin` is configured with `remark-gfm` so strikethrough serializes as
|
|
12147
|
+
* `~~...~~`, and underline is a `plainMark` because Markdown has no underline syntax
|
|
12148
|
+
* (without this it serializes to an MDX `<u>` node the default stringifier throws on,
|
|
12149
|
+
* which previously crashed `onValueChange` for any strikethrough/underline mark).
|
|
12150
|
+
*/
|
|
12151
|
+
const SAFE_LINK_SCHEME = /^(https?|mailto|tel):/i;
|
|
12152
|
+
/**
|
|
12153
|
+
* Normalizes a user-entered link (from the floating link form) Slack-style: keep a value
|
|
12154
|
+
* that already has a safe scheme (`http(s)`/`mailto`/`tel`); otherwise strip any scheme it
|
|
12155
|
+
* has - including dangerous ones like `javascript:` - and prepend `http://`. This makes
|
|
12156
|
+
* the form forgiving (`google.com`, `example` and typo'd schemes all become links) while
|
|
12157
|
+
* never emitting an unsafe href. Empty input stays empty.
|
|
12158
|
+
*/
|
|
12159
|
+
function normalizeLinkInput(url) {
|
|
12160
|
+
const trimmed = (url ?? "").trim();
|
|
12161
|
+
if (!trimmed) return "";
|
|
12162
|
+
if (SAFE_LINK_SCHEME.test(trimmed)) return trimmed;
|
|
12163
|
+
return `http://${trimmed.replace(/^[a-z][a-z0-9+.-]*:\/*/i, "")}`;
|
|
12164
|
+
}
|
|
12165
|
+
const formattingPlugins = [
|
|
12166
|
+
BasicMarksPlugin.configurePlugin(BoldPlugin, { inputRules: [BoldRules.markdown()] }).configurePlugin(ItalicPlugin, { inputRules: [ItalicRules.markdown(), ItalicRules.markdown({ variant: "_" })] }).configurePlugin(StrikethroughPlugin, { inputRules: [StrikethroughRules.markdown()] }).configurePlugin(CodePlugin, { inputRules: [CodeRules.markdown()] }),
|
|
12167
|
+
IndentPlugin,
|
|
12168
|
+
ListPlugin,
|
|
12169
|
+
LinkPlugin.configure({
|
|
12170
|
+
options: {
|
|
12171
|
+
forceSubmit: true,
|
|
12172
|
+
transformInput: normalizeLinkInput
|
|
12173
|
+
},
|
|
12174
|
+
inputRules: [
|
|
12175
|
+
LinkRules.markdown(),
|
|
12176
|
+
LinkRules.autolink({ variant: "paste" }),
|
|
12177
|
+
LinkRules.autolink({ variant: "space" }),
|
|
12178
|
+
LinkRules.autolink({ variant: "break" })
|
|
12179
|
+
],
|
|
12180
|
+
render: {
|
|
12181
|
+
node: LinkElement,
|
|
12182
|
+
afterEditable: () => /* @__PURE__ */ jsx(RichTextareaLinkToolbar, {})
|
|
12183
|
+
}
|
|
12184
|
+
}),
|
|
12185
|
+
MarkdownPlugin.configure({ options: {
|
|
12186
|
+
remarkPlugins: [remarkGfm],
|
|
12187
|
+
plainMarks: [KEYS.underline]
|
|
12188
|
+
} })
|
|
12189
|
+
];
|
|
12190
|
+
/**
|
|
12191
|
+
* Mounts the floating selection toolbar. A plugin rather than a composed child so the
|
|
12192
|
+
* all-in-one `RichTextarea` (which exposes no slot inside the Plate provider) gets it
|
|
12193
|
+
* too. `afterEditable` accumulates across plugins, so this coexists with the floating
|
|
12194
|
+
* link card `LinkPlugin` renders at the same position.
|
|
12195
|
+
*/
|
|
12196
|
+
const FloatingToolbarPlugin = createPlatePlugin({
|
|
12197
|
+
key: "richTextareaFloatingToolbar",
|
|
12198
|
+
render: { afterEditable: () => /* @__PURE__ */ jsx(RichTextareaFloatingToolbar, {}) }
|
|
12199
|
+
});
|
|
12200
|
+
/**
|
|
12201
|
+
* Re-opens the `@`/`#` menu when the user types next to a trigger token that was already
|
|
12202
|
+
* committed to plain text - e.g. after blurring or pressing Escape, which turns the
|
|
12203
|
+
* in-progress `@query` back into text. Plate's `withTriggerCombobox` only opens the menu
|
|
12204
|
+
* when the trigger CHARACTER is typed, so without this, typing beside a bare `@ada` never
|
|
12205
|
+
* reopens it. On a matching keystroke we replace the committed `trigger + query` run with a
|
|
12206
|
+
* fresh combobox input node seeded with the query (plus the just-typed char), so the menu
|
|
12207
|
+
* resumes where it left off.
|
|
12208
|
+
*
|
|
12209
|
+
* Limitations (by design): the query must be a single space-free token (mirrors how you
|
|
12210
|
+
* keep typing a mention); a committed token whose query already contains a space is left as
|
|
12211
|
+
* text. The preceding character must be whitespace or a boundary (so `email@x` is untouched).
|
|
12212
|
+
*/
|
|
12213
|
+
function createRetriggerComboboxPlugin(hasMentions, hasTags) {
|
|
12214
|
+
return createSlatePlugin({ key: "retrigger_combobox" }).overrideEditor(({ editor, tf: { insertText } }) => ({ transforms: { insertText(text, options) {
|
|
12215
|
+
const isEnabled = (trigger) => trigger === "@" && hasMentions || trigger === "#" && hasTags;
|
|
12216
|
+
const { selection } = editor;
|
|
12217
|
+
if (options?.at || !selection || !editor.api.isCollapsed() || text.length !== 1 || /[\s@#]/.test(text)) return insertText(text, options);
|
|
12218
|
+
const { anchor } = selection;
|
|
12219
|
+
const textBefore = editor.api.string({
|
|
12220
|
+
anchor: {
|
|
12221
|
+
path: anchor.path,
|
|
12222
|
+
offset: 0
|
|
12223
|
+
},
|
|
12224
|
+
focus: anchor
|
|
12225
|
+
}) ?? "";
|
|
12226
|
+
const match = /([@#])([^\s@#]*)$/.exec(textBefore);
|
|
12227
|
+
if (!match || !isEnabled(match[1])) return insertText(text, options);
|
|
12228
|
+
const leafText = (editor.api.node(anchor.path)?.[0])?.text ?? "";
|
|
12229
|
+
if (/^[^\s@#]/.test(leafText.slice(anchor.offset))) return insertText(text, options);
|
|
12230
|
+
const [token, trigger, query] = match;
|
|
12231
|
+
const tokenStart = editor.api.before(anchor, {
|
|
12232
|
+
distance: token.length,
|
|
12233
|
+
unit: "character"
|
|
12234
|
+
});
|
|
12235
|
+
if (!tokenStart) return insertText(text, options);
|
|
12236
|
+
const beforeRange = editor.api.range("before", tokenStart);
|
|
12237
|
+
const beforeChar = beforeRange ? editor.api.string(beforeRange) ?? "" : "";
|
|
12238
|
+
if (!/^\s?$/.test(beforeChar)) return insertText(text, options);
|
|
12239
|
+
editor.tf.delete({ at: {
|
|
12240
|
+
anchor: tokenStart,
|
|
12241
|
+
focus: anchor
|
|
12242
|
+
} });
|
|
12243
|
+
editor.tf.insertNodes({
|
|
12244
|
+
children: [{ text: "" }],
|
|
12245
|
+
type: trigger === "@" ? KEYS.mentionInput : "tag_input",
|
|
12246
|
+
trigger,
|
|
12247
|
+
query: query + text
|
|
12248
|
+
}, options);
|
|
12249
|
+
} } }));
|
|
12250
|
+
}
|
|
12251
|
+
/**
|
|
12252
|
+
* Owns the editor and the `<Plate>` provider for a composed RichTextarea. Renders no
|
|
12253
|
+
* DOM of its own — wrap your layout as children so a sibling {@link RichTextareaToolbar}
|
|
12254
|
+
* (which must live inside the Plate provider) can control the editor. For the simple,
|
|
12255
|
+
* all-in-one case use {@link RichTextarea} instead.
|
|
12256
|
+
*
|
|
12257
|
+
* @example
|
|
12258
|
+
* ```tsx
|
|
12259
|
+
* <RichTextareaRoot formatting mentions={mentions} onValueChange={handleChange}>
|
|
12260
|
+
* <InputGroup>
|
|
12261
|
+
* <InputGroupAddon align="block-start"><RichTextareaToolbar /></InputGroupAddon>
|
|
12262
|
+
* <RichTextareaContent bare />
|
|
12263
|
+
* </InputGroup>
|
|
12264
|
+
* </RichTextareaRoot>
|
|
12265
|
+
* ```
|
|
12266
|
+
*/
|
|
12267
|
+
function RichTextareaRoot(componentProps) {
|
|
12268
|
+
const { defaultValue, onValueChange, onSubmit, placeholder, disabled = false, submitOnEnter = true, mentions, slashCommands, tags, formatting = false, floatingToolbar = false, children } = componentProps;
|
|
12269
|
+
const [hasMentions] = React.useState(() => mentions !== void 0);
|
|
12270
|
+
const [hasTags] = React.useState(() => tags !== void 0);
|
|
12271
|
+
const [hasSlashCommands] = React.useState(() => slashCommands !== void 0);
|
|
12272
|
+
const [isFormatting] = React.useState(() => formatting);
|
|
12273
|
+
const [hasFloatingToolbar] = React.useState(() => floatingToolbar);
|
|
12274
|
+
const { items: mentionItems, async: mentionsAsync } = normalizeOptionList(mentions);
|
|
12275
|
+
const { items: tagItems, async: tagsAsync } = normalizeOptionList(tags);
|
|
12276
|
+
const plugins = React.useMemo(() => {
|
|
12277
|
+
const list = [];
|
|
12278
|
+
if (hasMentions) list.push(MentionPlugin.configure({ options: { insertSpaceAfterMention: true } }).withComponent(MentionElement), MentionInputPlugin.withComponent(MentionInputElement));
|
|
12279
|
+
if (hasTags) list.push(TagPluginBase.withComponent(TagElement), TagInputPluginBase.withComponent(TagInputElement));
|
|
12280
|
+
if (hasMentions || hasTags) list.push(toPlatePlugin(createRetriggerComboboxPlugin(hasMentions, hasTags)));
|
|
12281
|
+
if (hasSlashCommands) list.push(SlashPlugin, SlashInputPlugin.withComponent(SlashInputElement));
|
|
12282
|
+
if (isFormatting) {
|
|
12283
|
+
list.push(...formattingPlugins);
|
|
12284
|
+
if (hasFloatingToolbar) list.push(FloatingToolbarPlugin);
|
|
12285
|
+
}
|
|
12286
|
+
return list;
|
|
12287
|
+
}, [
|
|
12288
|
+
hasMentions,
|
|
12289
|
+
hasTags,
|
|
12290
|
+
hasSlashCommands,
|
|
12291
|
+
isFormatting,
|
|
12292
|
+
hasFloatingToolbar
|
|
12293
|
+
]);
|
|
12294
|
+
const editor = usePlateEditor({
|
|
12295
|
+
plugins,
|
|
12296
|
+
value: isFormatting && typeof defaultValue === "string" ? (ed) => ed.api.markdown?.deserialize(defaultValue) ?? toInitialValue(defaultValue, mentionItems, tagItems) : toInitialValue(defaultValue, mentionItems, tagItems)
|
|
12297
|
+
}, [plugins]);
|
|
12298
|
+
const contextValue = React.useMemo(() => ({
|
|
12299
|
+
mentions: mentionItems,
|
|
12300
|
+
tags: tagItems,
|
|
12301
|
+
slashCommands: slashCommands ?? [],
|
|
12302
|
+
mentionsAsync,
|
|
12303
|
+
tagsAsync,
|
|
12304
|
+
formatting: isFormatting,
|
|
12305
|
+
submitOnEnter,
|
|
12306
|
+
disabled,
|
|
12307
|
+
placeholder,
|
|
12308
|
+
onSubmit
|
|
12309
|
+
}), [
|
|
12310
|
+
mentionItems,
|
|
12311
|
+
tagItems,
|
|
12312
|
+
slashCommands,
|
|
12313
|
+
mentionsAsync,
|
|
12314
|
+
tagsAsync,
|
|
12315
|
+
isFormatting,
|
|
12316
|
+
submitOnEnter,
|
|
12317
|
+
disabled,
|
|
12318
|
+
placeholder,
|
|
12319
|
+
onSubmit
|
|
12320
|
+
]);
|
|
12321
|
+
return /* @__PURE__ */ jsx(RichTextareaContext.Provider, {
|
|
12322
|
+
value: contextValue,
|
|
12323
|
+
children: /* @__PURE__ */ jsx(Plate, {
|
|
12324
|
+
editor,
|
|
12325
|
+
readOnly: disabled,
|
|
12326
|
+
onValueChange: () => onValueChange?.(buildPayload(editor, isFormatting)),
|
|
12327
|
+
children
|
|
12328
|
+
})
|
|
12329
|
+
});
|
|
12330
|
+
}
|
|
12331
|
+
RichTextareaRoot.displayName = "RichTextareaRoot";
|
|
12332
|
+
/**
|
|
12333
|
+
* The editable surface of a composed RichTextarea. Must render inside a
|
|
12334
|
+
* {@link RichTextareaRoot}. Use `bare` when placing it inside an `InputGroup`.
|
|
12335
|
+
*/
|
|
12336
|
+
const RichTextareaContent = React.forwardRef((componentProps, forwardRef) => {
|
|
12337
|
+
const { bare = false, className, "aria-label": ariaLabel } = componentProps;
|
|
12338
|
+
const { formatting, submitOnEnter, disabled, placeholder, onSubmit } = React.useContext(RichTextareaContext);
|
|
12339
|
+
const editor = useEditorRef();
|
|
12340
|
+
const handleKeyDown = (event) => {
|
|
12341
|
+
if (disabled) return;
|
|
12342
|
+
if (event.key !== "Enter") return;
|
|
12343
|
+
if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;
|
|
12344
|
+
if (editor.api.some({
|
|
12345
|
+
at: [],
|
|
12346
|
+
match: (node) => typeof node.type === "string" && node.type.endsWith("_input")
|
|
12347
|
+
})) return;
|
|
12348
|
+
if (formatting && editor.getOption(LinkPlugin, "isOpen", editor.id)) return;
|
|
12349
|
+
if (event.shiftKey) {
|
|
12350
|
+
event.preventDefault();
|
|
12351
|
+
editor.tf.insertBreak();
|
|
12352
|
+
return;
|
|
12353
|
+
}
|
|
12354
|
+
if (!submitOnEnter) return;
|
|
12355
|
+
event.preventDefault();
|
|
12356
|
+
submitEditor(editor, formatting, onSubmit);
|
|
12357
|
+
};
|
|
12358
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12359
|
+
"data-slot": "rich-textarea",
|
|
12360
|
+
"data-testid": "rich-textarea",
|
|
12361
|
+
"data-multiline": bare ? "true" : void 0,
|
|
12362
|
+
className: cn("flex max-h-60 min-h-20 w-full flex-col overflow-y-auto px-3 py-2 text-base transition-[color,box-shadow] md:text-sm", bare ? "flex-1 border-0 bg-transparent shadow-none" : "border-input focus-within:border-ring focus-within:ring-ring/50 dark:bg-input/30 rounded-md border bg-background shadow-xs focus-within:ring-3", disabled && "cursor-not-allowed", disabled && !bare && "opacity-50 bg-input/50 dark:bg-input/80", className),
|
|
12363
|
+
children: /* @__PURE__ */ jsx(PlateContent, {
|
|
12364
|
+
ref: forwardRef,
|
|
12365
|
+
"data-slot": bare ? "input-group-control" : void 0,
|
|
12366
|
+
"aria-label": ariaLabel,
|
|
12367
|
+
className: "placeholder:text-muted-foreground flex-1 outline-none [&_[data-slate-placeholder]]:text-muted-foreground [&_ol]:!pl-6 [&_ul]:!pl-6 [&_ol]:my-1 [&_ul]:my-1 [&_code]:rounded-sm [&_code]:border [&_code]:border-border [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]",
|
|
12368
|
+
placeholder,
|
|
12369
|
+
readOnly: disabled,
|
|
12370
|
+
disabled,
|
|
12371
|
+
"aria-disabled": disabled,
|
|
12372
|
+
onKeyDown: handleKeyDown
|
|
12373
|
+
})
|
|
12374
|
+
});
|
|
12375
|
+
});
|
|
12376
|
+
RichTextareaContent.displayName = "RichTextareaContent";
|
|
12377
|
+
/**
|
|
12378
|
+
* Chat/comment-style rich input built on Plate.js, styled to match the DS
|
|
12379
|
+
* `Textarea`. Supports `@mention` autocomplete, `#tag` colored pills, and
|
|
12380
|
+
* `/slash` command menus. Enter submits (configurable); Shift+Enter adds a newline.
|
|
12381
|
+
*
|
|
12382
|
+
* All-in-one wrapper around {@link RichTextareaRoot} + {@link RichTextareaContent};
|
|
12383
|
+
* for a consumer-composed toolbar, use those directly.
|
|
12384
|
+
*
|
|
12385
|
+
* @example
|
|
12386
|
+
* ```tsx
|
|
12387
|
+
* <RichTextarea
|
|
12388
|
+
* placeholder="Leave a comment…"
|
|
12389
|
+
* mentions={[{ id: '1', label: 'Ada Lovelace' }]}
|
|
12390
|
+
* onSubmit={({ plainText }) => console.log(plainText)}
|
|
12391
|
+
* />
|
|
12392
|
+
* ```
|
|
12393
|
+
*/
|
|
12394
|
+
const RichTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
12395
|
+
const { bare, className, "aria-label": ariaLabel, ...rootProps } = componentProps;
|
|
12396
|
+
return /* @__PURE__ */ jsx(RichTextareaRoot, {
|
|
12397
|
+
...rootProps,
|
|
12398
|
+
children: /* @__PURE__ */ jsx(RichTextareaContent, {
|
|
12399
|
+
ref: forwardRef,
|
|
12400
|
+
bare,
|
|
12401
|
+
className,
|
|
12402
|
+
"aria-label": ariaLabel
|
|
12403
|
+
})
|
|
12404
|
+
});
|
|
12405
|
+
});
|
|
12406
|
+
RichTextarea.displayName = "RichTextarea";
|
|
12407
|
+
/**
|
|
12408
|
+
* `RichTextarea` pre-configured as the borderless control inside an `InputGroup`
|
|
12409
|
+
* (the `bare` variant). Compose `InputGroupAddon`s around it — e.g. an attachments
|
|
12410
|
+
* row (`align="block-start"`) and a toolbar (`align="block-end"`) — to build a
|
|
12411
|
+
* chat/agent composer. Lives here (not in `input-group.tsx`) so Plate.js stays out
|
|
12412
|
+
* of `InputGroup`'s import graph.
|
|
12413
|
+
*
|
|
12414
|
+
* @example
|
|
12415
|
+
* ```tsx
|
|
12416
|
+
* <InputGroup>
|
|
12417
|
+
* <InputGroupAddon align="block-start">…attachments…</InputGroupAddon>
|
|
12418
|
+
* <InputGroupRichTextarea mentions={mentions} placeholder="Ask anything…" />
|
|
12419
|
+
* <InputGroupAddon align="block-end">…toolbar…</InputGroupAddon>
|
|
12420
|
+
* </InputGroup>
|
|
12421
|
+
* ```
|
|
12422
|
+
*/
|
|
12423
|
+
const InputGroupRichTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
12424
|
+
return /* @__PURE__ */ jsx(RichTextarea, {
|
|
12425
|
+
ref: forwardRef,
|
|
12426
|
+
bare: true,
|
|
12427
|
+
...componentProps
|
|
12428
|
+
});
|
|
12429
|
+
});
|
|
12430
|
+
InputGroupRichTextarea.displayName = "InputGroupRichTextarea";
|
|
10993
12431
|
//#endregion
|
|
10994
12432
|
//#region src/components/sheet.tsx
|
|
10995
12433
|
/**
|
|
@@ -11144,7 +12582,6 @@ const SheetDescription = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11144
12582
|
});
|
|
11145
12583
|
});
|
|
11146
12584
|
SheetDescription.displayName = "SheetDescription";
|
|
11147
|
-
|
|
11148
12585
|
//#endregion
|
|
11149
12586
|
//#region src/components/tooltip.tsx
|
|
11150
12587
|
/**
|
|
@@ -11244,7 +12681,8 @@ const TooltipContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11244
12681
|
alignOffset,
|
|
11245
12682
|
side,
|
|
11246
12683
|
sideOffset,
|
|
11247
|
-
|
|
12684
|
+
"data-slot": "tooltip-positioner",
|
|
12685
|
+
className: "isolate z-popup",
|
|
11248
12686
|
children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, {
|
|
11249
12687
|
ref: forwardRef,
|
|
11250
12688
|
"data-slot": "tooltip-content",
|
|
@@ -11256,14 +12694,13 @@ const TooltipContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11256
12694
|
});
|
|
11257
12695
|
});
|
|
11258
12696
|
TooltipContent.displayName = "TooltipContent";
|
|
11259
|
-
|
|
11260
12697
|
//#endregion
|
|
11261
12698
|
//#region src/hooks/use-mobile.ts
|
|
11262
12699
|
const MOBILE_BREAKPOINT = 768;
|
|
11263
12700
|
function useIsMobile() {
|
|
11264
12701
|
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
11265
12702
|
React.useEffect(() => {
|
|
11266
|
-
const mql = window.matchMedia(`(max-width:
|
|
12703
|
+
const mql = window.matchMedia(`(max-width: 767px)`);
|
|
11267
12704
|
const onChange = () => {
|
|
11268
12705
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
11269
12706
|
};
|
|
@@ -11273,11 +12710,10 @@ function useIsMobile() {
|
|
|
11273
12710
|
}, []);
|
|
11274
12711
|
return !!isMobile;
|
|
11275
12712
|
}
|
|
11276
|
-
|
|
11277
12713
|
//#endregion
|
|
11278
12714
|
//#region src/components/sidebar.tsx
|
|
11279
12715
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
11280
|
-
const SIDEBAR_COOKIE_MAX_AGE =
|
|
12716
|
+
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
11281
12717
|
const SIDEBAR_WIDTH = "16rem";
|
|
11282
12718
|
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
11283
12719
|
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
@@ -11333,7 +12769,7 @@ const SidebarProvider = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11333
12769
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
11334
12770
|
}, [setOpenProp, open]);
|
|
11335
12771
|
const toggleSidebar = React.useCallback(() => {
|
|
11336
|
-
return isMobile ? setOpenMobile((open
|
|
12772
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
11337
12773
|
}, [
|
|
11338
12774
|
isMobile,
|
|
11339
12775
|
setOpen,
|
|
@@ -11840,7 +13276,6 @@ const SidebarMenuSubButton = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11840
13276
|
});
|
|
11841
13277
|
});
|
|
11842
13278
|
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
11843
|
-
|
|
11844
13279
|
//#endregion
|
|
11845
13280
|
//#region src/components/slider.tsx
|
|
11846
13281
|
/**
|
|
@@ -11894,7 +13329,6 @@ const Slider = React.forwardRef((componentProps, forwardRef) => {
|
|
|
11894
13329
|
});
|
|
11895
13330
|
});
|
|
11896
13331
|
Slider.displayName = "Slider";
|
|
11897
|
-
|
|
11898
13332
|
//#endregion
|
|
11899
13333
|
//#region src/components/sonner.tsx
|
|
11900
13334
|
/**
|
|
@@ -11940,7 +13374,6 @@ const Toaster = (componentProps) => {
|
|
|
11940
13374
|
...props
|
|
11941
13375
|
});
|
|
11942
13376
|
};
|
|
11943
|
-
|
|
11944
13377
|
//#endregion
|
|
11945
13378
|
//#region src/components/stepper.tsx
|
|
11946
13379
|
const StepperContext = React.createContext(void 0);
|
|
@@ -12021,10 +13454,9 @@ const StepperProgress = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12021
13454
|
...props,
|
|
12022
13455
|
children: ids.map((id) => {
|
|
12023
13456
|
const idx = getIndex(id);
|
|
12024
|
-
const state = idx < currentIndex ? "completed" : idx === currentIndex ? "active" : "inactive";
|
|
12025
13457
|
return /* @__PURE__ */ jsx("span", {
|
|
12026
13458
|
"data-slot": "stepper-progress-segment",
|
|
12027
|
-
"data-state":
|
|
13459
|
+
"data-state": idx < currentIndex ? "completed" : idx === currentIndex ? "active" : "inactive",
|
|
12028
13460
|
className: "bg-muted h-1.5 flex-1 rounded-full transition-colors duration-300 data-[state=active]:bg-primary data-[state=completed]:bg-primary"
|
|
12029
13461
|
}, id);
|
|
12030
13462
|
})
|
|
@@ -12090,7 +13522,6 @@ const StepperContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12090
13522
|
});
|
|
12091
13523
|
});
|
|
12092
13524
|
StepperContent.displayName = "StepperContent";
|
|
12093
|
-
|
|
12094
13525
|
//#endregion
|
|
12095
13526
|
//#region src/components/switch.tsx
|
|
12096
13527
|
/**
|
|
@@ -12116,7 +13547,6 @@ const Switch = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12116
13547
|
});
|
|
12117
13548
|
});
|
|
12118
13549
|
Switch.displayName = "Switch";
|
|
12119
|
-
|
|
12120
13550
|
//#endregion
|
|
12121
13551
|
//#region src/components/tabs.tsx
|
|
12122
13552
|
/**
|
|
@@ -12189,60 +13619,6 @@ const TabsContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12189
13619
|
});
|
|
12190
13620
|
});
|
|
12191
13621
|
TabsContent.displayName = "TabsContent";
|
|
12192
|
-
|
|
12193
|
-
//#endregion
|
|
12194
|
-
//#region src/components/toggle.tsx
|
|
12195
|
-
/**
|
|
12196
|
-
* Class-variance-authority variants for {@link Toggle}: `variant` (`default` | `outline`)
|
|
12197
|
-
* and `size` (`default` | `sm` | `lg`).
|
|
12198
|
-
*/
|
|
12199
|
-
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-sm text-foreground font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 data-disabled:pointer-events-none data-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
12200
|
-
variants: {
|
|
12201
|
-
variant: {
|
|
12202
|
-
default: "bg-transparent",
|
|
12203
|
-
outline: "border border-input bg-background"
|
|
12204
|
-
},
|
|
12205
|
-
size: {
|
|
12206
|
-
default: "h-8 min-w-8 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
12207
|
-
sm: "h-6 min-w-6 px-1.5 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
12208
|
-
lg: "h-10 min-w-10 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
|
|
12209
|
-
},
|
|
12210
|
-
pressedColor: {
|
|
12211
|
-
highContrast: "data-pressed:bg-secondary data-pressed:text-secondary-foreground data-pressed:hover:bg-secondary data-pressed:hover:text-secondary-foreground",
|
|
12212
|
-
lowContrast: "data-pressed:bg-muted data-pressed:text-muted-foreground data-pressed:hover:bg-muted data-pressed:hover:text-muted-foreground"
|
|
12213
|
-
}
|
|
12214
|
-
},
|
|
12215
|
-
defaultVariants: {
|
|
12216
|
-
variant: "default",
|
|
12217
|
-
size: "default",
|
|
12218
|
-
pressedColor: "highContrast"
|
|
12219
|
-
}
|
|
12220
|
-
});
|
|
12221
|
-
/**
|
|
12222
|
-
* A two-state button that can be pressed on or off, wrapping Base UI's `Toggle`.
|
|
12223
|
-
* Renders a `<button aria-pressed>` styled via {@link toggleVariants}.
|
|
12224
|
-
*
|
|
12225
|
-
* @example
|
|
12226
|
-
* ```tsx
|
|
12227
|
-
* <Toggle aria-label="Bold">B</Toggle>
|
|
12228
|
-
* ```
|
|
12229
|
-
*/
|
|
12230
|
-
const Toggle = React.forwardRef((componentProps, forwardRef) => {
|
|
12231
|
-
const { className, variant = "default", size = "default", pressedColor = "highContrast", ...props } = componentProps;
|
|
12232
|
-
return /* @__PURE__ */ jsx(Toggle$1, {
|
|
12233
|
-
ref: forwardRef,
|
|
12234
|
-
"data-slot": "toggle",
|
|
12235
|
-
className: cn(toggleVariants({
|
|
12236
|
-
variant,
|
|
12237
|
-
size,
|
|
12238
|
-
pressedColor,
|
|
12239
|
-
className
|
|
12240
|
-
})),
|
|
12241
|
-
...props
|
|
12242
|
-
});
|
|
12243
|
-
});
|
|
12244
|
-
Toggle.displayName = "Toggle";
|
|
12245
|
-
|
|
12246
13622
|
//#endregion
|
|
12247
13623
|
//#region src/components/toggle-group.tsx
|
|
12248
13624
|
const ToggleGroupContext = React.createContext({
|
|
@@ -12313,7 +13689,6 @@ const ToggleGroupItem = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12313
13689
|
});
|
|
12314
13690
|
});
|
|
12315
13691
|
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
12316
|
-
|
|
12317
13692
|
//#endregion
|
|
12318
13693
|
//#region src/components/ds-i18n-provider.tsx
|
|
12319
13694
|
/**
|
|
@@ -12354,7 +13729,6 @@ function syncDsLanguage(instance) {
|
|
|
12354
13729
|
instance.on("languageChanged", handler);
|
|
12355
13730
|
return () => instance.off("languageChanged", handler);
|
|
12356
13731
|
}
|
|
12357
|
-
|
|
12358
13732
|
//#endregion
|
|
12359
13733
|
//#region src/hooks/use-audio-gauge.ts
|
|
12360
13734
|
/**
|
|
@@ -12428,6 +13802,5 @@ function useAudioGauge(options = {}) {
|
|
|
12428
13802
|
error
|
|
12429
13803
|
};
|
|
12430
13804
|
}
|
|
12431
|
-
|
|
12432
13805
|
//#endregion
|
|
12433
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Anchor, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger, Audio, AudioPlayerBar, AudioPlayerButton, AudioPlayerCurrentTime, AudioPlayerDuration, AudioPlayerManager, AudioPlayerRow, AudioPlayerSkip, AudioPlayerSpeed, AudioPlayerTime, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD, Calendar, CalendarDayButton, CalendarDropdown, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxBody, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CounterBadge, CountryFlag, DataCombobox, DataTable, DataTree, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBackdrop, DrawerBar, DrawerClose, DrawerContent, DrawerCreateHandle, DrawerDescription, DrawerFooter, DrawerHeader, DrawerMenu, DrawerMenuCheckboxItem, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, DrawerMenuSeparator, DrawerMenuTrigger, DrawerPanel, DrawerPopup, DrawerPortal, DrawerPrimitive, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, DropdownMenu, DropdownMenuAddon, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneActions, DropzoneContent, DropzoneDescription, DropzoneIcon, DropzoneTitle, DropzoneTrigger, DsI18nProvider, EmojiPicker, EmojiPickerCategories, EmojiPickerContent, EmojiPickerTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FAB, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLabelAside, FieldLabelInfo, FieldLabelRow, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Gauge, HoverCard, HoverCardContent, HoverCardTrigger, InlineEditInput, InlineEditMultiselect, InlineEditMultiselectChip, InlineEditMultiselectChips, InlineEditMultiselectContent, InlineEditMultiselectItem, InlineEditMultiselectTrigger, InlineEditMultiselectValue, InlineEditSelect, InlineEditSelectContent, InlineEditSelectItem, InlineEditSelectTrigger, InlineEditSelectValue, InlineEditTextarea, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, NotificationQueueProvider, NotificationSlot, NumericInput, NumericInputControl, NumericInputDecrement, NumericInputIncrement, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SUPPORTED_LANGUAGES, ScrollArea, ScrollAreaPrimitive, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, StepperContent, StepperCounter, StepperPanel, StepperProgress, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, TreeDragLine, TreeItem, TreeItemLabel, alertVariants, anchorVariants, bannerVariants, buttonGroupVariants, buttonVariants, cn, counterBadgeVariants, detectInitialLanguage, fabVariants, isInsideCalendarDropdown, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useAudioPlayer, useAudioPlayerTime, useComboboxAnchor, useDsLocale, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
|
|
13806
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Anchor, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger, Audio, AudioPlayerBar, AudioPlayerButton, AudioPlayerCurrentTime, AudioPlayerDuration, AudioPlayerManager, AudioPlayerRow, AudioPlayerSkip, AudioPlayerSpeed, AudioPlayerTime, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD, Calendar, CalendarDayButton, CalendarDropdown, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxBody, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CounterBadge, CountryFlag, DataCombobox, DataTable, DataTree, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBackdrop, DrawerBar, DrawerClose, DrawerContent, DrawerCreateHandle, DrawerDescription, DrawerFooter, DrawerHeader, DrawerMenu, DrawerMenuCheckboxItem, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, DrawerMenuSeparator, DrawerMenuTrigger, DrawerPanel, DrawerPopup, DrawerPortal, DrawerPrimitive, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, DropdownMenu, DropdownMenuAddon, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneActions, DropzoneContent, DropzoneDescription, DropzoneIcon, DropzoneTitle, DropzoneTrigger, DsI18nProvider, EmojiPicker, EmojiPickerCategories, EmojiPickerContent, EmojiPickerTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FAB, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLabelAside, FieldLabelInfo, FieldLabelRow, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Gauge, HoverCard, HoverCardContent, HoverCardTrigger, InlineEditInput, InlineEditMultiselect, InlineEditMultiselectChip, InlineEditMultiselectChips, InlineEditMultiselectContent, InlineEditMultiselectItem, InlineEditMultiselectTrigger, InlineEditMultiselectValue, InlineEditSelect, InlineEditSelectContent, InlineEditSelectItem, InlineEditSelectTrigger, InlineEditSelectValue, InlineEditTextarea, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupRichTextarea, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, NotificationQueueProvider, NotificationSlot, NumericInput, NumericInputControl, NumericInputDecrement, NumericInputIncrement, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, RichTextarea, RichTextareaContent, RichTextareaRoot, RichTextareaToolbar, SUPPORTED_LANGUAGES, ScrollArea, ScrollAreaPrimitive, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, StepperContent, StepperCounter, StepperPanel, StepperProgress, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, TreeDragLine, TreeItem, TreeItemLabel, alertVariants, anchorVariants, bannerVariants, buttonGroupVariants, buttonVariants, cn, counterBadgeVariants, detectInitialLanguage, fabVariants, isInsideCalendarDropdown, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useAudioPlayer, useAudioPlayerTime, useComboboxAnchor, useDsLocale, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
|