@alfadocs/ui-kit 0.63.0 → 0.65.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/_chunks/{agenda-tray-DA6qj8BL.js → agenda-tray-Bh1KfEOG.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-DBKV27je.js → ai-consent-banner-Btzmk8OH.js} +3 -2
- package/dist/_chunks/{ai-prompt-input-C6sCr1Vi.js → ai-prompt-input-BwEACCPm.js} +3 -3
- package/dist/_chunks/{ai-tools-rail-7tC3GT4h.js → ai-tools-rail-JnlTqfS4.js} +2 -2
- package/dist/_chunks/{alia-sidebar-DlvyXgVC.js → alia-sidebar-CN8pA6c-.js} +7 -7
- package/dist/_chunks/{anamnesis-card-CmkBVAln.js → anamnesis-card-qeLYRG79.js} +2 -2
- package/dist/_chunks/{antenatal-schedule-timeline-CdiqkF05.js → antenatal-schedule-timeline-BfzFjEyb.js} +3 -3
- package/dist/_chunks/{appointment-tray-BwDHhWWC.js → appointment-tray-BQnJEora.js} +2 -2
- package/dist/_chunks/{ar-C68WKG5a.js → ar-Cn5Fq48Z.js} +2 -2
- package/dist/_chunks/{audio-recorder-D6OVfNiZ.js → audio-recorder-DjXLP4aF.js} +3 -3
- package/dist/_chunks/{autocomplete-CDqxB68B.js → autocomplete-CcCFlVf-.js} +4 -4
- package/dist/_chunks/{bishop-score-B9tvgoIq.js → bishop-score-x2fNqbuZ.js} +3 -3
- package/dist/_chunks/{bmi-calculator-DA2NGmVK.js → bmi-calculator-C3roxbqD.js} +2 -2
- package/dist/_chunks/{booking-BUV9fspj.js → booking-L8-YP8BJ.js} +149 -149
- package/dist/_chunks/calendar-B6soK1Yb.js +17 -0
- package/dist/_chunks/{calendar-CkuJIg3s.js → calendar-oYWOCrnf.js} +1 -1
- package/dist/_chunks/{care-plan-card-QmNpGggC.js → care-plan-card-D42WD4-T.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-Cnra7vUc.js → care-plan-entry-card-BukNI7Uy.js} +2 -2
- package/dist/_chunks/{carousel.agent-DrX96W-1.js → carousel.agent-vt21A_el.js} +2 -2
- package/dist/_chunks/{chat-input-CFwc7JxL.js → chat-input-B5zjNEUN.js} +2 -2
- package/dist/_chunks/{chat-message-Dm8U2RY1.js → chat-message-3V54YipB.js} +2 -2
- package/dist/_chunks/{code-block-HoddNOKJ.js → code-block-BBWHhIc8.js} +2 -2
- package/dist/_chunks/{contact-profile-card-DvvVfAA2.js → contact-profile-card-CCeJmjbd.js} +2 -2
- package/dist/_chunks/{cycle-calculator-C_t1Hs8V.js → cycle-calculator-DrVXbIB4.js} +4 -4
- package/dist/_chunks/{date-picker-BfHblqwA.js → date-picker-oGg5BnXL.js} +12 -11
- package/dist/_chunks/{date-picker-variants-CXEAx3O_.js → date-picker-variants-DAcSLTua.js} +358 -372
- package/dist/_chunks/{date-range-picker-hcAMs1wO.js → date-range-picker-C5BWfH_T.js} +34 -25
- package/dist/_chunks/{date-time-picker-H-3Pwqlb.js → date-time-picker-Ze1My59T.js} +18 -17
- package/dist/_chunks/{de-DK4A9_a8.js → de-CrJs4ZsX.js} +2 -2
- package/dist/_chunks/{description-list-BEbK2g93.js → description-list-gkNGWk5G.js} +2 -2
- package/dist/_chunks/{due-date-calculator-Q8MIwEVV.js → due-date-calculator-D4K1BnE2.js} +4 -4
- package/dist/_chunks/{editable-currency-cell-renderer-D5C5tCfu.js → editable-currency-cell-renderer-CFqQc56y.js} +305 -295
- package/dist/_chunks/editor-overlay-wYm22wZK.js +88 -0
- package/dist/_chunks/{el-B29HXhG5.js → el-DHdMOIhL.js} +6 -6
- package/dist/_chunks/{es-BOwPVwWn.js → es-DCATCfqo.js} +2 -2
- package/dist/_chunks/{fetal-weight-D1a6BmM-.js → fetal-weight-B_pBjlO7.js} +2 -2
- package/dist/_chunks/{fiscal-code-input-BZ0FxwUl.js → fiscal-code-input-DPtqluVb.js} +2 -2
- package/dist/_chunks/{fr-DoDBtn0T.js → fr-BfGEMshF.js} +2 -2
- package/dist/_chunks/{freemium-paywall-gHGA44dW.js → freemium-paywall-CkWjv3o6.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-AkNFfZYs.js → gestational-age-calculator-BETQAVkA.js} +7 -7
- package/dist/_chunks/{hcg-doubling-Dg0Hr7ey.js → hcg-doubling-8zXCJgAQ.js} +3 -3
- package/dist/_chunks/{header-Ce1Br27u.js → header-CNszv2WQ.js} +2 -2
- package/dist/_chunks/{header-settings-D5Z2B_Yz.js → header-settings-CNOqIhoW.js} +3 -3
- package/dist/_chunks/{hi-DGByrKby.js → hi-CBFRXEIm.js} +2 -2
- package/dist/_chunks/icon-button-LqoiKcUN.js +78 -0
- package/dist/_chunks/{insert-result-C1SYdueh.js → insert-result-DIAG3ltJ.js} +115 -136
- package/dist/_chunks/{isSameWeek-B1odL2vR.js → isSameWeek-I3DfXUp1.js} +2 -2
- package/dist/_chunks/{it-B16rEecm.js → it-nz6vAKwG.js} +7 -7
- package/dist/_chunks/{ja-B0viOgft.js → ja-DQcqdAEJ.js} +2 -2
- package/dist/_chunks/{key-value-pair-CkQIb9EG.js → key-value-pair-BrgbMfbF.js} +2 -2
- package/dist/_chunks/{locale-picker-D99UyZVJ.js → locale-picker-C9JmBht3.js} +3 -3
- package/dist/_chunks/{marketplace-app-shell-C4OYAC22.js → marketplace-app-shell-BXfRMiRk.js} +4 -4
- package/dist/_chunks/{message-card-Dvl1TgaN.js → message-card-Bgcvfj6-.js} +2 -2
- package/dist/_chunks/{message-tray-Dl6GQaaV.js → message-tray-saAVMeHP.js} +3 -3
- package/dist/_chunks/{multi-select-DOLO3K_z.js → multi-select-BcPylvHR.js} +100 -90
- package/dist/_chunks/{nl-cBxEX2QU.js → nl-L5SuDjyl.js} +2 -2
- package/dist/_chunks/{notification-card-CObnGdJu.js → notification-card-BiESdm8q.js} +2 -2
- package/dist/_chunks/{notification-tray-BWHDIjgd.js → notification-tray-DlgenTEe.js} +3 -3
- package/dist/_chunks/{patient-search-CArmRKeg.js → patient-search-Bw9ONucF.js} +2 -2
- package/dist/_chunks/{patient-shell-Coarf346.js → patient-shell-CF_qon7C.js} +3 -3
- package/dist/_chunks/{patient-summary-card-BnTqxcTr.js → patient-summary-card-Bgso0p_l.js} +2 -2
- package/dist/_chunks/{payment-form-DJ9vnzrT.js → payment-form-nXocS_MX.js} +11 -4
- package/dist/_chunks/{payment-request-card-B_lyobd0.js → payment-request-card-DBz3hVDz.js} +3 -3
- package/dist/_chunks/{pdf-viewer-chMpwpA4.js → pdf-viewer-GsfNqeeT.js} +3 -3
- package/dist/_chunks/{periodontal-chart-card-BYs9hax1.js → periodontal-chart-card-AYyHtU9K.js} +2 -2
- package/dist/_chunks/phone-input-DVXhNlIl.js +563 -0
- package/dist/_chunks/{pl-DtS08ioY.js → pl-YAn5z2wR.js} +3 -3
- package/dist/_chunks/{popover-Devce-tT.js → popover-DTbfAuR0.js} +2 -2
- package/dist/_chunks/{practice-results-CtfciF2v.js → practice-results-CVAgY2RZ.js} +3 -3
- package/dist/_chunks/{pregnancy-dating-Dg6dTe1p.js → pregnancy-dating-BuzLTwjy.js} +7 -7
- package/dist/_chunks/{pregnancy-weight-gain-DI7X-0JX.js → pregnancy-weight-gain-aicn7qs7.js} +2 -2
- package/dist/_chunks/{privacy-lock-BN3L-alb.js → privacy-lock-C7JyMf0y.js} +2 -2
- package/dist/_chunks/{product-hub-panel-CkfZBA3t.js → product-hub-panel-CAXDFeGP.js} +2 -2
- package/dist/_chunks/{pt-yFXs1VvH.js → pt-D9xdT5KQ.js} +6 -6
- package/dist/_chunks/{public-header.agent-CYQK6T6F.js → public-header.agent-BOhJgZEU.js} +3 -3
- package/dist/_chunks/{reviews-panel-CPrXu5TX.js → reviews-panel-DBktKm7i.js} +2 -2
- package/dist/_chunks/rich-text-editor-u36FqSWz.js +1190 -0
- package/dist/_chunks/{ro-DsCzSrzR.js → ro-Cp--52bT.js} +2 -2
- package/dist/_chunks/{ru-DgDxL0pc.js → ru-BM8eX_Zz.js} +3 -3
- package/dist/_chunks/{search-bar-CvN_S0jW.js → search-bar-SY2BcV2N.js} +2 -2
- package/dist/_chunks/{search-input-D3aMvi4l.js → search-input-DbxrnHkW.js} +3 -3
- package/dist/_chunks/{select-hsCaJSX3.js → select-CEtRcon5.js} +46 -45
- package/dist/_chunks/{sheet-xbzu4YiY.js → sheet-taJer-Ha.js} +2 -2
- package/dist/_chunks/{sign-document--nr5cxsB.js → sign-document-CdAiHiCh.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-BpAjVmsI.js → sign-in-with-alfadocs-button-LppxjlFt.js} +2 -2
- package/dist/_chunks/{signature-field-DbhbpLha.js → signature-field-Dy1JRjzE.js} +10 -3
- package/dist/_chunks/{slot-grid-BlHHP9Qy.js → slot-grid-FsqumOaS.js} +2 -2
- package/dist/_chunks/smart-date-CWikAqZx.js +114 -0
- package/dist/_chunks/{social-sign-in-button-uJYLM366.js → social-sign-in-button-dlpPI5l7.js} +2 -2
- package/dist/_chunks/{spinner-OjQNn8oN.js → spinner-hbwuKwMf.js} +10 -10
- package/dist/_chunks/{sq-DHlCYN67.js → sq-XRpr0r49.js} +6 -6
- package/dist/_chunks/{streaming-text-CfhDqtIT.js → streaming-text-BB9mvK4m.js} +2 -2
- package/dist/_chunks/subDays-BcYv1Lxi.js +8 -0
- package/dist/_chunks/{sv-O0QaQs_s.js → sv-Z3APomE8.js} +2 -2
- package/dist/_chunks/{tabs-BpPYVme_.js → tabs-BIQ0ew1T.js} +2 -2
- package/dist/_chunks/{task-tray-Cb_hK4yb.js → task-tray-CAncV-QQ.js} +2 -2
- package/dist/_chunks/{theme-toggle-DAW7uC0B.js → theme-toggle-DETmSu_h.js} +2 -2
- package/dist/_chunks/{toast.agent-B0MCsvdZ.js → toast.agent-vuLRRn2a.js} +2 -2
- package/dist/_chunks/tooth-scheme-BIx1O2aJ.js +1257 -0
- package/dist/_chunks/{tr-BmNDRuio.js → tr-e0-P4FON.js} +2 -2
- package/dist/_chunks/{transcript-panel-B4HiC7ed.js → transcript-panel-CLHmv83g.js} +2 -2
- package/dist/_chunks/type-DZ5OMRA2.js +28 -0
- package/dist/_chunks/{unit-converter-3sINXO3m.js → unit-converter-CHN2cZ4b.js} +3 -3
- package/dist/_chunks/{wallet-pay-button-DuDPBlCO.js → wallet-pay-button--dnR6NfJ.js} +2 -2
- package/dist/_chunks/{workflow-map-BJDUNYlX.js → workflow-map-BX3JY1Bu.js} +3 -3
- package/dist/_chunks/{zh-CN-CgVJZEzz.js → zh-CN-B-igM5gY.js} +3 -3
- package/dist/agent-catalog.json +72 -4
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/ai-tools-rail/index.js +1 -1
- package/dist/components/anamnesis-card/index.js +1 -1
- package/dist/components/appointment-card/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/components/chat-message/index.js +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/description-list/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/editor-overlay/editor-overlay.d.ts +19 -0
- package/dist/components/editor-overlay/index.d.ts +3 -0
- package/dist/components/editor-overlay/index.js +5 -0
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/fiscal-code-input/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/header/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/key-value-pair/index.js +1 -1
- package/dist/components/locale-picker/index.js +1 -1
- package/dist/components/message-card/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/notification-card/index.js +1 -1
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/phone-input/index.js +1 -1
- package/dist/components/phone-input/phone-input.d.ts +9 -0
- package/dist/components/popover/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/privacy-lock/index.js +1 -1
- package/dist/components/product-hub-tray/index.js +1 -1
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/rich-text-editor/editor-toolbar.d.ts +16 -0
- package/dist/components/rich-text-editor/help-me-write-overlay.d.ts +25 -0
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +43 -0
- package/dist/components/search-bar/index.js +1 -1
- package/dist/components/search-input/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/sheet/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/signature-field/index.js +1 -1
- package/dist/components/slot-grid/index.js +1 -1
- package/dist/components/smart-date/index.d.ts +3 -0
- package/dist/components/smart-date/index.js +5 -0
- package/dist/components/smart-date/smart-date.d.ts +32 -0
- package/dist/components/social-sign-in-button/index.js +1 -1
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/streaming-text/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/toast/index.js +1 -1
- package/dist/components/tooth-scheme/index.d.ts +2 -2
- package/dist/components/tooth-scheme/index.js +22 -15
- package/dist/components/tooth-scheme/tooth-data.d.ts +79 -18
- package/dist/components/tooth-scheme/tooth-scheme.agent.d.ts +2 -0
- package/dist/components/tooth-scheme/tooth-scheme.d.ts +48 -1
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/wallet-pay-button/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +61 -0
- package/dist/i18n/locales/ar.js +63 -2
- package/dist/i18n/locales/de.d.ts +61 -0
- package/dist/i18n/locales/de.js +63 -2
- package/dist/i18n/locales/el.d.ts +61 -0
- package/dist/i18n/locales/el.js +63 -2
- package/dist/i18n/locales/en.d.ts +61 -0
- package/dist/i18n/locales/en.js +67 -2
- package/dist/i18n/locales/es.d.ts +61 -0
- package/dist/i18n/locales/es.js +63 -2
- package/dist/i18n/locales/fr.d.ts +61 -0
- package/dist/i18n/locales/fr.js +63 -2
- package/dist/i18n/locales/hi.d.ts +61 -0
- package/dist/i18n/locales/hi.js +63 -2
- package/dist/i18n/locales/it.d.ts +61 -0
- package/dist/i18n/locales/it.js +63 -2
- package/dist/i18n/locales/ja.d.ts +61 -0
- package/dist/i18n/locales/ja.js +63 -2
- package/dist/i18n/locales/nl.d.ts +61 -0
- package/dist/i18n/locales/nl.js +63 -2
- package/dist/i18n/locales/pl.d.ts +61 -0
- package/dist/i18n/locales/pl.js +63 -2
- package/dist/i18n/locales/pt.d.ts +61 -0
- package/dist/i18n/locales/pt.js +63 -2
- package/dist/i18n/locales/ro.d.ts +61 -0
- package/dist/i18n/locales/ro.js +63 -2
- package/dist/i18n/locales/ru.d.ts +61 -0
- package/dist/i18n/locales/ru.js +63 -2
- package/dist/i18n/locales/sq.d.ts +61 -0
- package/dist/i18n/locales/sq.js +63 -2
- package/dist/i18n/locales/sv.d.ts +61 -0
- package/dist/i18n/locales/sv.js +63 -2
- package/dist/i18n/locales/tr.d.ts +61 -0
- package/dist/i18n/locales/tr.js +63 -2
- package/dist/i18n/locales/zh.d.ts +61 -0
- package/dist/i18n/locales/zh.js +63 -2
- package/dist/index.js +511 -500
- package/dist/locales/ar.json +63 -2
- package/dist/locales/de.json +63 -2
- package/dist/locales/el.json +63 -2
- package/dist/locales/en.json +63 -2
- package/dist/locales/es.json +63 -2
- package/dist/locales/fr.json +63 -2
- package/dist/locales/hi.json +63 -2
- package/dist/locales/it.json +63 -2
- package/dist/locales/ja.json +63 -2
- package/dist/locales/nl.json +63 -2
- package/dist/locales/pl.json +63 -2
- package/dist/locales/pt.json +63 -2
- package/dist/locales/ro.json +63 -2
- package/dist/locales/ru.json +63 -2
- package/dist/locales/sq.json +63 -2
- package/dist/locales/sv.json +63 -2
- package/dist/locales/tr.json +63 -2
- package/dist/locales/zh.json +63 -2
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +36 -22
- package/package.json +10 -1
- package/dist/_chunks/icon-button-CKEOrN37.js +0 -70
- package/dist/_chunks/phone-input-DfZbPPvh.js +0 -525
- package/dist/_chunks/rich-text-editor-B03qM22-.js +0 -334
- package/dist/_chunks/subDays-Bs00akhK.js +0 -8
- package/dist/_chunks/tooth-scheme-CxlsLjfN.js +0 -753
|
@@ -0,0 +1,1190 @@
|
|
|
1
|
+
import { jsx as e, jsxs as w, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
+
import { useId as he, useState as _, useRef as x, useCallback as f, useEffect as P, forwardRef as De, useMemo as Se, useImperativeHandle as Be } from "react";
|
|
3
|
+
import { c as ke } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as xe } from "react-i18next";
|
|
5
|
+
import { SafeHtml as Ve, sanitiseHtml as Fe } from "../safe-html/index.js";
|
|
6
|
+
import { u as We } from "./registry-nPAVE19X.js";
|
|
7
|
+
import { I } from "./icon-button-LqoiKcUN.js";
|
|
8
|
+
import { S as Ge } from "./spinner-hbwuKwMf.js";
|
|
9
|
+
import { T as Qe } from "./text-area-BIx0tZ05.js";
|
|
10
|
+
import { E as Ze } from "./editor-overlay-wYm22wZK.js";
|
|
11
|
+
import { R as Je } from "./rotate-ccw-BWANpitO.js";
|
|
12
|
+
import { C as Xe } from "./check-DPdL_Sm7.js";
|
|
13
|
+
import { S as pe } from "./square-CZoGU14v.js";
|
|
14
|
+
import { M as ve } from "./mic-B4Gog3Gi.js";
|
|
15
|
+
import { S as Ye } from "./send-CySZIRPJ.js";
|
|
16
|
+
import { S as ye } from "./sparkles-CuYXqQLg.js";
|
|
17
|
+
import { P as me } from "./popover-DTbfAuR0.js";
|
|
18
|
+
import { D as A } from "./dropdown-menu-DwwPovMZ.js";
|
|
19
|
+
import { T as Ue, I as Ke } from "./type-DZ5OMRA2.js";
|
|
20
|
+
import { c as C } from "./createLucideIcon-CrFbzy84.js";
|
|
21
|
+
/**
|
|
22
|
+
* @license lucide-react v1.8.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
const et = [
|
|
28
|
+
[
|
|
29
|
+
"path",
|
|
30
|
+
{ d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
|
|
31
|
+
]
|
|
32
|
+
], tt = C("bold", et);
|
|
33
|
+
/**
|
|
34
|
+
* @license lucide-react v1.8.0 - ISC
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the ISC license.
|
|
37
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/
|
|
39
|
+
const rt = [
|
|
40
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
41
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
42
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
43
|
+
["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
|
|
44
|
+
], ot = C("heading-2", rt);
|
|
45
|
+
/**
|
|
46
|
+
* @license lucide-react v1.8.0 - ISC
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the ISC license.
|
|
49
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/
|
|
51
|
+
const at = [
|
|
52
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
53
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
54
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
55
|
+
["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
|
|
56
|
+
["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
|
|
57
|
+
], nt = C("heading-3", at);
|
|
58
|
+
/**
|
|
59
|
+
* @license lucide-react v1.8.0 - ISC
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the ISC license.
|
|
62
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/
|
|
64
|
+
const it = [
|
|
65
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
66
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
67
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
68
|
+
], lt = C("italic", it);
|
|
69
|
+
/**
|
|
70
|
+
* @license lucide-react v1.8.0 - ISC
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the ISC license.
|
|
73
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
+
*/
|
|
75
|
+
const st = [
|
|
76
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
77
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
78
|
+
], dt = C("link", st);
|
|
79
|
+
/**
|
|
80
|
+
* @license lucide-react v1.8.0 - ISC
|
|
81
|
+
*
|
|
82
|
+
* This source code is licensed under the ISC license.
|
|
83
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/
|
|
85
|
+
const ct = [
|
|
86
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
87
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
88
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
89
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
90
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
91
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
92
|
+
], ut = C("list-ordered", ct);
|
|
93
|
+
/**
|
|
94
|
+
* @license lucide-react v1.8.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/
|
|
99
|
+
const mt = [
|
|
100
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
101
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
102
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
103
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
104
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
105
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
106
|
+
], ft = C("list", mt);
|
|
107
|
+
/**
|
|
108
|
+
* @license lucide-react v1.8.0 - ISC
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the ISC license.
|
|
111
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/
|
|
113
|
+
const gt = [["path", { d: "M5 12h14", key: "1ays0h" }]], bt = C("minus", gt);
|
|
114
|
+
/**
|
|
115
|
+
* @license lucide-react v1.8.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/
|
|
120
|
+
const ht = [
|
|
121
|
+
[
|
|
122
|
+
"path",
|
|
123
|
+
{
|
|
124
|
+
d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
|
|
125
|
+
key: "e79jfc"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
|
|
129
|
+
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
|
|
130
|
+
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
|
|
131
|
+
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
|
|
132
|
+
], pt = C("palette", ht);
|
|
133
|
+
/**
|
|
134
|
+
* @license lucide-react v1.8.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/
|
|
139
|
+
const vt = [
|
|
140
|
+
["path", { d: "M13 4v16", key: "8vvj80" }],
|
|
141
|
+
["path", { d: "M17 4v16", key: "7dpous" }],
|
|
142
|
+
["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
|
|
143
|
+
], yt = C("pilcrow", vt);
|
|
144
|
+
/**
|
|
145
|
+
* @license lucide-react v1.8.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/
|
|
150
|
+
const kt = [
|
|
151
|
+
[
|
|
152
|
+
"path",
|
|
153
|
+
{
|
|
154
|
+
d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
155
|
+
key: "rib7q0"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
[
|
|
159
|
+
"path",
|
|
160
|
+
{
|
|
161
|
+
d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
162
|
+
key: "1ymkrd"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
], xt = C("quote", kt);
|
|
166
|
+
/**
|
|
167
|
+
* @license lucide-react v1.8.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/
|
|
172
|
+
const wt = [
|
|
173
|
+
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
174
|
+
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
175
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
176
|
+
], Ct = C("strikethrough", wt);
|
|
177
|
+
/**
|
|
178
|
+
* @license lucide-react v1.8.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/
|
|
183
|
+
const Mt = [
|
|
184
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
185
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
186
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
187
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
188
|
+
], zt = C("table", Mt), Nt = {
|
|
189
|
+
id: "rich-text-editor",
|
|
190
|
+
capabilities: ["edit_inline"],
|
|
191
|
+
state: {
|
|
192
|
+
html: {
|
|
193
|
+
type: "string",
|
|
194
|
+
description: "Sanitised HTML representation of the editor content.",
|
|
195
|
+
read: (o) => o.getHTML()
|
|
196
|
+
},
|
|
197
|
+
text: {
|
|
198
|
+
type: "string",
|
|
199
|
+
description: "Plain-text content of the editor (tags stripped).",
|
|
200
|
+
read: (o) => o.getText()
|
|
201
|
+
},
|
|
202
|
+
markdown: {
|
|
203
|
+
type: "string",
|
|
204
|
+
description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
|
|
205
|
+
read: (o) => o.getMarkdown()
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
actions: {
|
|
209
|
+
set_content: {
|
|
210
|
+
safety: "destructive",
|
|
211
|
+
argsType: "{ html: string }",
|
|
212
|
+
description: "Replace the editor content. Loses unsaved input.",
|
|
213
|
+
invoke: (o, n) => {
|
|
214
|
+
o.setContent(n.html);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
insert_at_cursor: {
|
|
218
|
+
safety: "destructive",
|
|
219
|
+
argsType: "{ content: string; asHtml?: boolean }",
|
|
220
|
+
description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
|
|
221
|
+
invoke: (o, n) => {
|
|
222
|
+
o.insertAtCursor(n.content, { asHtml: n.asHtml });
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
apply_format: {
|
|
226
|
+
safety: "destructive",
|
|
227
|
+
argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
|
|
228
|
+
description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
|
|
229
|
+
invoke: (o, n) => {
|
|
230
|
+
o.applyFormat(n.format);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
clear: {
|
|
234
|
+
safety: "destructive",
|
|
235
|
+
description: "Empty the editor. Loses unsaved input.",
|
|
236
|
+
invoke: (o) => {
|
|
237
|
+
o.clear();
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
focus: {
|
|
241
|
+
safety: "read",
|
|
242
|
+
description: "Move keyboard focus to the editor surface.",
|
|
243
|
+
invoke: (o) => {
|
|
244
|
+
o.focus();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
domHooks: {
|
|
249
|
+
root: { attr: "data-component", value: "rich-text-editor" },
|
|
250
|
+
instanceId: {
|
|
251
|
+
attr: "data-component-id",
|
|
252
|
+
sourceProp: "id",
|
|
253
|
+
description: "Sourced from the id prop."
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}, Rt = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", St = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", Tt = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]", Te = [
|
|
257
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
258
|
+
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
259
|
+
"ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
|
|
260
|
+
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
|
|
261
|
+
].join(" ");
|
|
262
|
+
function _e(o, n) {
|
|
263
|
+
return n ? o ? /\s$/.test(o) ? `${o}${n}` : `${o} ${n}` : n : o;
|
|
264
|
+
}
|
|
265
|
+
function _t({
|
|
266
|
+
open: o,
|
|
267
|
+
onClose: n,
|
|
268
|
+
onRequestAiDraft: g,
|
|
269
|
+
onInsert: L,
|
|
270
|
+
previewAsHtml: Q = !0,
|
|
271
|
+
privacyNotice: j,
|
|
272
|
+
onDictate: l
|
|
273
|
+
}) {
|
|
274
|
+
const { t: b } = xe(), R = he(), s = he(), [h, p] = _(""), [k, Z] = _(!1), [D, B] = _(!1), [S, J] = _(null), V = x(null), [u, ne] = _(!1), [M, F] = _(""), E = x(null), W = f(() => {
|
|
275
|
+
var i;
|
|
276
|
+
(i = E.current) == null || i.abort();
|
|
277
|
+
}, []), m = f(() => {
|
|
278
|
+
if (!l) return;
|
|
279
|
+
const i = new AbortController();
|
|
280
|
+
E.current = i, ne(!0), F(""), l({
|
|
281
|
+
signal: i.signal,
|
|
282
|
+
onPartialTranscript: (d) => {
|
|
283
|
+
i.signal.aborted || F(d);
|
|
284
|
+
},
|
|
285
|
+
onFinalTranscript: (d) => {
|
|
286
|
+
if (i.signal.aborted) return;
|
|
287
|
+
const G = d.trim();
|
|
288
|
+
F(""), G && p((N) => _e(N, G));
|
|
289
|
+
}
|
|
290
|
+
}).catch(() => {
|
|
291
|
+
}).finally(() => {
|
|
292
|
+
F(""), E.current === i && (E.current = null, ne(!1));
|
|
293
|
+
});
|
|
294
|
+
}, [l]), z = f(() => {
|
|
295
|
+
u ? W() : m();
|
|
296
|
+
}, [u, m, W]);
|
|
297
|
+
P(() => {
|
|
298
|
+
var i, d;
|
|
299
|
+
o ? (p(""), Z(!1), B(!1), J(null), F("")) : ((i = V.current) == null || i.abort(), V.current = null, (d = E.current) == null || d.abort());
|
|
300
|
+
}, [o]), P(
|
|
301
|
+
() => () => {
|
|
302
|
+
var i, d;
|
|
303
|
+
(i = V.current) == null || i.abort(), (d = E.current) == null || d.abort();
|
|
304
|
+
},
|
|
305
|
+
[]
|
|
306
|
+
);
|
|
307
|
+
const $ = f(() => {
|
|
308
|
+
var G;
|
|
309
|
+
const i = h.trim();
|
|
310
|
+
if (!i || k) return;
|
|
311
|
+
W(), (G = V.current) == null || G.abort();
|
|
312
|
+
const d = new AbortController();
|
|
313
|
+
V.current = d, B(!1), Z(!0), g({ prompt: i, signal: d.signal }).then((N) => {
|
|
314
|
+
d.signal.aborted || (J(N), Z(!1));
|
|
315
|
+
}).catch((N) => {
|
|
316
|
+
d.signal.aborted || N && typeof N == "object" && "name" in N && N.name === "AbortError" || (B(!0), Z(!1));
|
|
317
|
+
});
|
|
318
|
+
}, [h, k, g, W]), U = f(() => {
|
|
319
|
+
S != null && (L(S), n());
|
|
320
|
+
}, [S, L, n]), ie = S != null, K = u ? _e(h, M) : h;
|
|
321
|
+
return /* @__PURE__ */ e(
|
|
322
|
+
Ze,
|
|
323
|
+
{
|
|
324
|
+
open: o,
|
|
325
|
+
onClose: n,
|
|
326
|
+
title: /* @__PURE__ */ w("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
327
|
+
/* @__PURE__ */ e(ye, { "aria-hidden": "true", className: "ds:size-4" }),
|
|
328
|
+
b("editor.ai.dialogTitle")
|
|
329
|
+
] }),
|
|
330
|
+
ariaLabel: b("editor.ai.dialogTitle"),
|
|
331
|
+
children: ie ? /* @__PURE__ */ w("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
|
|
332
|
+
/* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: Q ? /* @__PURE__ */ e(
|
|
333
|
+
Ve,
|
|
334
|
+
{
|
|
335
|
+
html: S,
|
|
336
|
+
profile: "rich-text",
|
|
337
|
+
className: Te,
|
|
338
|
+
tabIndex: 0,
|
|
339
|
+
"aria-label": b("editor.ai.dialogTitle")
|
|
340
|
+
}
|
|
341
|
+
) : (
|
|
342
|
+
// Focusable so a keyboard user can scroll a long draft preview
|
|
343
|
+
// (mirrors the SafeHtml preview branch above). The lint rule's
|
|
344
|
+
// tabIndex allowlist doesn't cover a scrollable, non-interactive
|
|
345
|
+
// text region.
|
|
346
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
347
|
+
/* @__PURE__ */ e("p", { className: Te, tabIndex: 0, children: S })
|
|
348
|
+
) }),
|
|
349
|
+
/* @__PURE__ */ e(
|
|
350
|
+
I,
|
|
351
|
+
{
|
|
352
|
+
size: "sm",
|
|
353
|
+
intent: "ghost",
|
|
354
|
+
className: "ds:rounded-full",
|
|
355
|
+
icon: /* @__PURE__ */ e(Je, {}),
|
|
356
|
+
"aria-label": b("editor.ai.retry"),
|
|
357
|
+
onClick: () => J(null)
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ e(
|
|
361
|
+
I,
|
|
362
|
+
{
|
|
363
|
+
size: "sm",
|
|
364
|
+
intent: "primary",
|
|
365
|
+
className: "ds:rounded-full",
|
|
366
|
+
icon: /* @__PURE__ */ e(Xe, {}),
|
|
367
|
+
"aria-label": b("common.confirm"),
|
|
368
|
+
onClick: U
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] }) : /* @__PURE__ */ w(Pe, { children: [
|
|
372
|
+
/* @__PURE__ */ w("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
|
|
373
|
+
/* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
|
|
374
|
+
Qe,
|
|
375
|
+
{
|
|
376
|
+
id: R,
|
|
377
|
+
size: "md",
|
|
378
|
+
value: K,
|
|
379
|
+
onChange: (i) => p(i.target.value),
|
|
380
|
+
placeholder: b("editor.ai.promptPlaceholder"),
|
|
381
|
+
"aria-label": b("editor.ai.promptLabel"),
|
|
382
|
+
autoResize: !0,
|
|
383
|
+
minRows: 1,
|
|
384
|
+
maxRows: 3,
|
|
385
|
+
readOnly: u,
|
|
386
|
+
tone: D ? "error" : "default",
|
|
387
|
+
"aria-describedby": D ? s : void 0
|
|
388
|
+
}
|
|
389
|
+
) }),
|
|
390
|
+
l ? /* @__PURE__ */ e(
|
|
391
|
+
I,
|
|
392
|
+
{
|
|
393
|
+
size: "sm",
|
|
394
|
+
intent: "ghost",
|
|
395
|
+
className: u ? Rt : void 0,
|
|
396
|
+
icon: u ? /* @__PURE__ */ e(pe, { className: "ds:fill-current" }) : /* @__PURE__ */ e(ve, {}),
|
|
397
|
+
"aria-pressed": u,
|
|
398
|
+
"aria-label": b(u ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
399
|
+
onClick: z
|
|
400
|
+
}
|
|
401
|
+
) : null,
|
|
402
|
+
/* @__PURE__ */ e(
|
|
403
|
+
I,
|
|
404
|
+
{
|
|
405
|
+
size: "sm",
|
|
406
|
+
intent: "primary",
|
|
407
|
+
icon: k ? /* @__PURE__ */ e(Ge, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(Ye, {}),
|
|
408
|
+
className: "ds:rounded-full",
|
|
409
|
+
disabled: k || !h.trim(),
|
|
410
|
+
"aria-busy": k || void 0,
|
|
411
|
+
"aria-label": b("editor.ai.generate"),
|
|
412
|
+
onClick: $
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
] }),
|
|
416
|
+
D ? /* @__PURE__ */ e("p", { id: s, role: "alert", className: Tt, children: b("editor.ai.error") }) : j ? /* @__PURE__ */ e("p", { className: St, children: j }) : null
|
|
417
|
+
] })
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
const It = {
|
|
422
|
+
bold: {
|
|
423
|
+
id: "bold",
|
|
424
|
+
icon: /* @__PURE__ */ e(tt, {}),
|
|
425
|
+
label: ["editor.bold", "Bold"],
|
|
426
|
+
command: ["module.inline.format", { tag: "b" }],
|
|
427
|
+
toggle: "bold"
|
|
428
|
+
},
|
|
429
|
+
italic: {
|
|
430
|
+
id: "italic",
|
|
431
|
+
icon: /* @__PURE__ */ e(lt, {}),
|
|
432
|
+
label: ["editor.italic", "Italic"],
|
|
433
|
+
command: ["module.inline.format", { tag: "i" }],
|
|
434
|
+
toggle: "italic"
|
|
435
|
+
},
|
|
436
|
+
strike: {
|
|
437
|
+
id: "strike",
|
|
438
|
+
icon: /* @__PURE__ */ e(Ct, {}),
|
|
439
|
+
label: ["editor.strike", "Strikethrough"],
|
|
440
|
+
command: ["module.inline.format", { tag: "del" }],
|
|
441
|
+
toggle: "strike"
|
|
442
|
+
},
|
|
443
|
+
ul: {
|
|
444
|
+
id: "ul",
|
|
445
|
+
icon: /* @__PURE__ */ e(ft, {}),
|
|
446
|
+
label: ["editor.list.bullet", "Bulleted list"],
|
|
447
|
+
command: ["module.list.toggle", "ul"],
|
|
448
|
+
toggle: "ul"
|
|
449
|
+
},
|
|
450
|
+
ol: {
|
|
451
|
+
id: "ol",
|
|
452
|
+
icon: /* @__PURE__ */ e(ut, {}),
|
|
453
|
+
label: ["editor.list.ordered", "Numbered list"],
|
|
454
|
+
command: ["module.list.toggle", "ol"],
|
|
455
|
+
toggle: "ol"
|
|
456
|
+
},
|
|
457
|
+
link: {
|
|
458
|
+
id: "link",
|
|
459
|
+
icon: /* @__PURE__ */ e(dt, {}),
|
|
460
|
+
label: ["editor.link.insert", "Insert link"],
|
|
461
|
+
command: ["module.link.open"]
|
|
462
|
+
},
|
|
463
|
+
rule: {
|
|
464
|
+
id: "rule",
|
|
465
|
+
icon: /* @__PURE__ */ e(bt, {}),
|
|
466
|
+
label: ["editor.horizontalRule", "Horizontal rule"],
|
|
467
|
+
command: ["module.line.insert"]
|
|
468
|
+
}
|
|
469
|
+
}, Ht = [
|
|
470
|
+
{
|
|
471
|
+
id: "paragraph",
|
|
472
|
+
tag: "p",
|
|
473
|
+
icon: /* @__PURE__ */ e(yt, {}),
|
|
474
|
+
label: ["editor.paragraph", "Paragraph"]
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
id: "h2",
|
|
478
|
+
tag: "h2",
|
|
479
|
+
icon: /* @__PURE__ */ e(ot, {}),
|
|
480
|
+
label: ["editor.heading2", "Heading 2"]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
id: "h3",
|
|
484
|
+
tag: "h3",
|
|
485
|
+
icon: /* @__PURE__ */ e(nt, {}),
|
|
486
|
+
label: ["editor.heading3", "Heading 3"]
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
id: "quote",
|
|
490
|
+
tag: "blockquote",
|
|
491
|
+
icon: /* @__PURE__ */ e(xt, {}),
|
|
492
|
+
label: ["editor.quote", "Quote"]
|
|
493
|
+
}
|
|
494
|
+
], At = {
|
|
495
|
+
minimal: ["bold", "italic", "link"],
|
|
496
|
+
standard: ["format", "bold", "italic", "strike", "ul", "ol", "link"],
|
|
497
|
+
full: ["format", "bold", "italic", "strike", "ul", "ol", "link", "rule"]
|
|
498
|
+
}, Lt = [
|
|
499
|
+
{
|
|
500
|
+
token: "--foreground",
|
|
501
|
+
bg: "ds:bg-[var(--foreground)]",
|
|
502
|
+
label: ["editor.color.default", "Default"]
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
token: "--color-violet-700",
|
|
506
|
+
bg: "ds:bg-[var(--color-violet-700)]",
|
|
507
|
+
label: ["editor.color.violet", "Violet"]
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
token: "--color-magenta-700",
|
|
511
|
+
bg: "ds:bg-[var(--color-magenta-700)]",
|
|
512
|
+
label: ["editor.color.magenta", "Magenta"]
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
token: "--color-blue-700",
|
|
516
|
+
bg: "ds:bg-[var(--color-blue-700)]",
|
|
517
|
+
label: ["editor.color.blue", "Blue"]
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
token: "--color-green-700",
|
|
521
|
+
bg: "ds:bg-[var(--color-green-700)]",
|
|
522
|
+
label: ["editor.color.green", "Green"]
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
token: "--color-orange-700",
|
|
526
|
+
bg: "ds:bg-[var(--color-orange-700)]",
|
|
527
|
+
label: ["editor.color.orange", "Orange"]
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
token: "--color-red-700",
|
|
531
|
+
bg: "ds:bg-[var(--color-red-700)]",
|
|
532
|
+
label: ["editor.color.red", "Red"]
|
|
533
|
+
}
|
|
534
|
+
], Et = [
|
|
535
|
+
{
|
|
536
|
+
id: "rowAbove",
|
|
537
|
+
command: "plugin.table.addRowAbove",
|
|
538
|
+
label: ["editor.table.rowAbove", "Add row above"]
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
id: "rowBelow",
|
|
542
|
+
command: "plugin.table.addRowBelow",
|
|
543
|
+
label: ["editor.table.rowBelow", "Add row below"]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: "colLeft",
|
|
547
|
+
command: "plugin.table.addColumnLeft",
|
|
548
|
+
label: ["editor.table.columnLeft", "Add column left"]
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
id: "colRight",
|
|
552
|
+
command: "plugin.table.addColumnRight",
|
|
553
|
+
label: ["editor.table.columnRight", "Add column right"]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
id: "deleteRow",
|
|
557
|
+
command: "plugin.table.deleteRow",
|
|
558
|
+
label: ["editor.table.deleteRow", "Delete row"]
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
id: "deleteColumn",
|
|
562
|
+
command: "plugin.table.deleteColumn",
|
|
563
|
+
label: ["editor.table.deleteColumn", "Delete column"]
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
id: "deleteTable",
|
|
567
|
+
command: "plugin.table.deleteTable",
|
|
568
|
+
label: ["editor.table.deleteTable", "Delete table"]
|
|
569
|
+
}
|
|
570
|
+
], $t = ke(
|
|
571
|
+
[
|
|
572
|
+
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
573
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
574
|
+
"ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
|
|
575
|
+
"ds:shadow-[var(--shadow-md)]"
|
|
576
|
+
].join(" ")
|
|
577
|
+
), qt = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", jt = "ds:size-6 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color-mix(in_srgb,var(--foreground)_15%,transparent)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:[outline-offset:var(--focus-ring-offset)]";
|
|
578
|
+
function Ot(o) {
|
|
579
|
+
return typeof window > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(o).trim();
|
|
580
|
+
}
|
|
581
|
+
function Pt({
|
|
582
|
+
run: o,
|
|
583
|
+
active: n,
|
|
584
|
+
preset: g,
|
|
585
|
+
enableColor: L = !1,
|
|
586
|
+
enableImage: Q = !1,
|
|
587
|
+
enableTable: j = !1
|
|
588
|
+
}) {
|
|
589
|
+
const { t: l } = xe(), b = L || Q || j, R = (s) => s.preventDefault();
|
|
590
|
+
return /* @__PURE__ */ w(
|
|
591
|
+
"div",
|
|
592
|
+
{
|
|
593
|
+
role: "toolbar",
|
|
594
|
+
"aria-label": l("editor.toolbarLabel"),
|
|
595
|
+
className: $t(),
|
|
596
|
+
"data-component": "editor-toolbar",
|
|
597
|
+
children: [
|
|
598
|
+
At[g].map((s) => {
|
|
599
|
+
if (s === "format")
|
|
600
|
+
return /* @__PURE__ */ w(A.Root, { children: [
|
|
601
|
+
/* @__PURE__ */ e(A.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
602
|
+
I,
|
|
603
|
+
{
|
|
604
|
+
size: "sm",
|
|
605
|
+
intent: "ghost",
|
|
606
|
+
icon: /* @__PURE__ */ e(Ue, {}),
|
|
607
|
+
"aria-label": l("editor.format", "Paragraph style"),
|
|
608
|
+
onMouseDown: R
|
|
609
|
+
}
|
|
610
|
+
) }),
|
|
611
|
+
/* @__PURE__ */ e(A.Content, { align: "start", children: Ht.map((p) => /* @__PURE__ */ e(
|
|
612
|
+
A.Item,
|
|
613
|
+
{
|
|
614
|
+
startIcon: p.icon,
|
|
615
|
+
onSelect: () => o("module.block.format", { tag: p.tag }),
|
|
616
|
+
children: l(p.label[0], p.label[1])
|
|
617
|
+
},
|
|
618
|
+
p.id
|
|
619
|
+
)) })
|
|
620
|
+
] }, "format");
|
|
621
|
+
const h = It[s];
|
|
622
|
+
return /* @__PURE__ */ e(
|
|
623
|
+
I,
|
|
624
|
+
{
|
|
625
|
+
size: "sm",
|
|
626
|
+
intent: "ghost",
|
|
627
|
+
icon: h.icon,
|
|
628
|
+
"aria-label": l(h.label[0], h.label[1]),
|
|
629
|
+
"aria-pressed": h.toggle ? n.has(h.toggle) : void 0,
|
|
630
|
+
onMouseDown: R,
|
|
631
|
+
onClick: () => o(...h.command)
|
|
632
|
+
},
|
|
633
|
+
h.id
|
|
634
|
+
);
|
|
635
|
+
}),
|
|
636
|
+
b ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: qt }) : null,
|
|
637
|
+
L ? /* @__PURE__ */ w(me, { children: [
|
|
638
|
+
/* @__PURE__ */ e(me.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
639
|
+
I,
|
|
640
|
+
{
|
|
641
|
+
size: "sm",
|
|
642
|
+
intent: "ghost",
|
|
643
|
+
icon: /* @__PURE__ */ e(pt, {}),
|
|
644
|
+
"aria-label": l("editor.textColor", "Text colour"),
|
|
645
|
+
onMouseDown: R
|
|
646
|
+
}
|
|
647
|
+
) }),
|
|
648
|
+
/* @__PURE__ */ w(me.Content, { side: "bottom", align: "start", children: [
|
|
649
|
+
/* @__PURE__ */ e(me.Heading, { children: l("editor.textColor", "Text colour") }),
|
|
650
|
+
/* @__PURE__ */ e("div", { className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)]", children: Lt.map((s) => /* @__PURE__ */ e(
|
|
651
|
+
"button",
|
|
652
|
+
{
|
|
653
|
+
type: "button",
|
|
654
|
+
"aria-label": l(s.label[0], s.label[1]),
|
|
655
|
+
className: `${jt} ${s.bg}`,
|
|
656
|
+
onMouseDown: R,
|
|
657
|
+
onClick: () => o("plugin.fontcolor.set", {
|
|
658
|
+
rule: "color",
|
|
659
|
+
value: Ot(s.token)
|
|
660
|
+
})
|
|
661
|
+
},
|
|
662
|
+
s.token
|
|
663
|
+
)) }),
|
|
664
|
+
/* @__PURE__ */ e(
|
|
665
|
+
"button",
|
|
666
|
+
{
|
|
667
|
+
type: "button",
|
|
668
|
+
className: "ds:mt-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)] ds:underline",
|
|
669
|
+
onMouseDown: R,
|
|
670
|
+
onClick: () => o("plugin.fontcolor.remove", { rule: "color" }),
|
|
671
|
+
children: l("editor.color.remove", "Remove colour")
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
] })
|
|
675
|
+
] }) : null,
|
|
676
|
+
Q ? /* @__PURE__ */ e(
|
|
677
|
+
I,
|
|
678
|
+
{
|
|
679
|
+
size: "sm",
|
|
680
|
+
intent: "ghost",
|
|
681
|
+
icon: /* @__PURE__ */ e(Ke, {}),
|
|
682
|
+
"aria-label": l("editor.image.insert", "Insert image"),
|
|
683
|
+
onMouseDown: R,
|
|
684
|
+
onClick: () => o("module.image.open")
|
|
685
|
+
}
|
|
686
|
+
) : null,
|
|
687
|
+
j ? /* @__PURE__ */ w(A.Root, { children: [
|
|
688
|
+
/* @__PURE__ */ e(A.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
689
|
+
I,
|
|
690
|
+
{
|
|
691
|
+
size: "sm",
|
|
692
|
+
intent: "ghost",
|
|
693
|
+
icon: /* @__PURE__ */ e(zt, {}),
|
|
694
|
+
"aria-label": l("editor.table.insert", "Insert table"),
|
|
695
|
+
onMouseDown: R
|
|
696
|
+
}
|
|
697
|
+
) }),
|
|
698
|
+
/* @__PURE__ */ w(A.Content, { align: "start", children: [
|
|
699
|
+
/* @__PURE__ */ e(A.Item, { onSelect: () => o("plugin.table.insert"), children: l("editor.table.insert", "Insert table") }),
|
|
700
|
+
/* @__PURE__ */ e(A.Separator, {}),
|
|
701
|
+
Et.map((s) => /* @__PURE__ */ e(A.Item, { onSelect: () => o(s.command), children: l(s.label[0], s.label[1]) }, s.id))
|
|
702
|
+
] })
|
|
703
|
+
] }) : null
|
|
704
|
+
]
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
function O(o) {
|
|
709
|
+
return Fe(o, "rich-text");
|
|
710
|
+
}
|
|
711
|
+
function be(o = "") {
|
|
712
|
+
const n = String(o).trim();
|
|
713
|
+
if (n === "" || n === "<p><br></p>" || n === "<p> </p>")
|
|
714
|
+
return "";
|
|
715
|
+
const g = n.replace(/<br\s*\/?>/gi, "").replace(/ /gi, "").replace(/<[^>]+>/g, "").trim();
|
|
716
|
+
return g === "" && /<img\b[^>]*>/i.test(n) ? n : g === "" ? "" : n;
|
|
717
|
+
}
|
|
718
|
+
function Dt(o) {
|
|
719
|
+
return o.replace(
|
|
720
|
+
/<img(?![^>]*\sloading=)([^>]*)>/gi,
|
|
721
|
+
'<img loading="lazy"$1>'
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
function Bt(o) {
|
|
725
|
+
if (o) return o;
|
|
726
|
+
if (typeof window > "u") return null;
|
|
727
|
+
const n = window;
|
|
728
|
+
return n.$R ?? n.Redactor ?? null;
|
|
729
|
+
}
|
|
730
|
+
const Vt = {
|
|
731
|
+
bold: ["module.inline.format", { tag: "b" }],
|
|
732
|
+
italic: ["module.inline.format", { tag: "i" }],
|
|
733
|
+
strikethrough: ["module.inline.format", { tag: "del" }],
|
|
734
|
+
bulletedList: ["module.list.toggle", "ul"],
|
|
735
|
+
numberedList: ["module.list.toggle", "ol"],
|
|
736
|
+
heading: ["module.block.format", { tag: "h2" }],
|
|
737
|
+
quote: ["module.block.format", { tag: "blockquote" }],
|
|
738
|
+
paragraph: ["module.block.format", { tag: "p" }]
|
|
739
|
+
}, Ft = {
|
|
740
|
+
zh: "zh_cn",
|
|
741
|
+
pt: "pt_br"
|
|
742
|
+
};
|
|
743
|
+
function Wt(o) {
|
|
744
|
+
const n = o.split("-")[0];
|
|
745
|
+
return Ft[n] ?? n ?? "en";
|
|
746
|
+
}
|
|
747
|
+
const Gt = ke(
|
|
748
|
+
"redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
|
|
749
|
+
), Qt = ke(
|
|
750
|
+
[
|
|
751
|
+
"ds:block ds:[inline-size:100%]",
|
|
752
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
753
|
+
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
754
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
755
|
+
"ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
|
|
756
|
+
"ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
|
|
757
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
758
|
+
"ds:focus-visible:outline-solid",
|
|
759
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
760
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
761
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
762
|
+
].join(" ")
|
|
763
|
+
), He = [
|
|
764
|
+
"ds:inline-flex ds:items-center ds:justify-center",
|
|
765
|
+
"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
|
|
766
|
+
"ds:text-[color:var(--primary-foreground)]",
|
|
767
|
+
"ds:transition-colors",
|
|
768
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
769
|
+
"ds:focus-visible:outline-solid",
|
|
770
|
+
"ds:focus-visible:outline-[var(--primary-foreground)]",
|
|
771
|
+
"ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
|
|
772
|
+
].join(" "), Ie = `${He} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, Zt = `${He} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`, Jt = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", Xt = De(
|
|
773
|
+
({
|
|
774
|
+
id: o,
|
|
775
|
+
defaultValue: n,
|
|
776
|
+
value: g,
|
|
777
|
+
onChange: L,
|
|
778
|
+
toolbar: Q = "standard",
|
|
779
|
+
placeholder: j,
|
|
780
|
+
readOnly: l = !1,
|
|
781
|
+
ariaLabel: b,
|
|
782
|
+
minHeight: R,
|
|
783
|
+
className: s,
|
|
784
|
+
redactor: h,
|
|
785
|
+
options: p,
|
|
786
|
+
plugins: k,
|
|
787
|
+
lang: Z,
|
|
788
|
+
imageUploadUrl: D,
|
|
789
|
+
onKeyDown: B,
|
|
790
|
+
onRequestAiDraft: S,
|
|
791
|
+
aiDraftFormat: J = "html",
|
|
792
|
+
aiPrivacyNotice: V,
|
|
793
|
+
onDictate: u
|
|
794
|
+
}, ne) => {
|
|
795
|
+
const { t: M, i18n: F } = xe(), E = he(), W = Se(
|
|
796
|
+
() => `rte-${E.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
797
|
+
[E]
|
|
798
|
+
), m = `#${W}`, z = x(null), $ = x(null), U = x(!1), ie = x(l), K = x(null), [i, d] = _(!1), [G, N] = _(!1), [Ae, Le] = _(
|
|
799
|
+
() => /* @__PURE__ */ new Set()
|
|
800
|
+
), ee = x(null), T = x(L), le = x(B);
|
|
801
|
+
P(() => {
|
|
802
|
+
T.current = L, le.current = B;
|
|
803
|
+
}, [L, B]);
|
|
804
|
+
const Ee = x(
|
|
805
|
+
(() => {
|
|
806
|
+
const t = g ?? n ?? "";
|
|
807
|
+
return t ? O(t) : "";
|
|
808
|
+
})()
|
|
809
|
+
), te = f(() => {
|
|
810
|
+
var r;
|
|
811
|
+
const t = $.current;
|
|
812
|
+
if (t)
|
|
813
|
+
try {
|
|
814
|
+
const a = t(m, "source.getCode");
|
|
815
|
+
if (typeof a == "string") return a;
|
|
816
|
+
} catch {
|
|
817
|
+
}
|
|
818
|
+
return ((r = z.current) == null ? void 0 : r.value) ?? "";
|
|
819
|
+
}, [m]), q = f(
|
|
820
|
+
(t, ...r) => {
|
|
821
|
+
const a = $.current;
|
|
822
|
+
if (!a) return !1;
|
|
823
|
+
const v = ie.current;
|
|
824
|
+
if (v)
|
|
825
|
+
try {
|
|
826
|
+
a(m, "disableReadOnly");
|
|
827
|
+
} catch {
|
|
828
|
+
}
|
|
829
|
+
try {
|
|
830
|
+
return a(m, t, ...r), !0;
|
|
831
|
+
} catch {
|
|
832
|
+
return !1;
|
|
833
|
+
} finally {
|
|
834
|
+
if (v)
|
|
835
|
+
try {
|
|
836
|
+
a(m, "enableReadOnly");
|
|
837
|
+
} catch {
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
[m]
|
|
842
|
+
), re = f(
|
|
843
|
+
(t, r) => {
|
|
844
|
+
var ae;
|
|
845
|
+
const a = (r == null ? void 0 : r.asHtml) ?? !0, v = a ? O(t) : t;
|
|
846
|
+
if (q(a ? "insertion.insertHtml" : "insertion.insertText", v)) return;
|
|
847
|
+
const c = z.current;
|
|
848
|
+
if (!c) return;
|
|
849
|
+
const X = c.selectionStart ?? c.value.length, Y = c.selectionEnd ?? c.value.length;
|
|
850
|
+
c.value = c.value.slice(0, X) + v + c.value.slice(Y);
|
|
851
|
+
const ue = X + v.length;
|
|
852
|
+
try {
|
|
853
|
+
c.setSelectionRange(ue, ue);
|
|
854
|
+
} catch {
|
|
855
|
+
}
|
|
856
|
+
(ae = T.current) == null || ae.call(T, { html: O(c.value), markdown: "" });
|
|
857
|
+
},
|
|
858
|
+
[q]
|
|
859
|
+
), se = f(() => {
|
|
860
|
+
var v;
|
|
861
|
+
const t = (v = K.current) == null ? void 0 : v.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, a = /* @__PURE__ */ new Set();
|
|
862
|
+
if (t && r && r.anchorNode && t.contains(r.anchorNode) && typeof document.queryCommandState == "function")
|
|
863
|
+
try {
|
|
864
|
+
document.queryCommandState("bold") && a.add("bold"), document.queryCommandState("italic") && a.add("italic"), document.queryCommandState("strikeThrough") && a.add("strike"), document.queryCommandState("insertUnorderedList") && a.add("ul"), document.queryCommandState("insertOrderedList") && a.add("ol");
|
|
865
|
+
const y = String(
|
|
866
|
+
document.queryCommandValue("formatBlock") || ""
|
|
867
|
+
).toLowerCase();
|
|
868
|
+
/^h[1-6]$/.test(y) ? a.add("heading") : y === "blockquote" && a.add("quote");
|
|
869
|
+
} catch {
|
|
870
|
+
}
|
|
871
|
+
Le(
|
|
872
|
+
(y) => y.size === a.size && [...a].every((c) => y.has(c)) ? y : a
|
|
873
|
+
);
|
|
874
|
+
}, []), fe = f(
|
|
875
|
+
(t, ...r) => {
|
|
876
|
+
q(t, ...r), typeof window < "u" ? window.requestAnimationFrame(() => se()) : se();
|
|
877
|
+
},
|
|
878
|
+
[q, se]
|
|
879
|
+
), oe = x(null), de = x(null), [H, we] = _(!1), [$e, Ce] = _(!1), ce = f(() => {
|
|
880
|
+
const t = de.current;
|
|
881
|
+
t != null && t.parentNode && t.parentNode.removeChild(t), de.current = null;
|
|
882
|
+
}, []), Me = f((t) => {
|
|
883
|
+
var v;
|
|
884
|
+
const r = (v = K.current) == null ? void 0 : v.querySelector(
|
|
885
|
+
".redactor-in"
|
|
886
|
+
);
|
|
887
|
+
if (!r) return;
|
|
888
|
+
let a = de.current;
|
|
889
|
+
if (!a || !r.contains(a)) {
|
|
890
|
+
a = document.createElement("span"), a.setAttribute("data-rte-interim", ""), a.setAttribute("contenteditable", "false");
|
|
891
|
+
const y = window.getSelection();
|
|
892
|
+
if (y && y.rangeCount > 0 && r.contains(y.anchorNode)) {
|
|
893
|
+
const c = y.getRangeAt(0);
|
|
894
|
+
c.collapse(!1), c.insertNode(a);
|
|
895
|
+
} else
|
|
896
|
+
r.appendChild(a);
|
|
897
|
+
de.current = a;
|
|
898
|
+
}
|
|
899
|
+
a.textContent = t;
|
|
900
|
+
}, []), ze = f(() => {
|
|
901
|
+
var t;
|
|
902
|
+
(t = oe.current) == null || t.abort();
|
|
903
|
+
}, []), Ne = f(() => {
|
|
904
|
+
if (!u) return;
|
|
905
|
+
const t = new AbortController();
|
|
906
|
+
oe.current = t, Ce(!1), we(!0), ce(), u({
|
|
907
|
+
signal: t.signal,
|
|
908
|
+
// Interim text shows live in the editor (grey + caret); each final
|
|
909
|
+
// replaces it with committed text at the caret.
|
|
910
|
+
onPartialTranscript: (r) => {
|
|
911
|
+
t.signal.aborted || Me(r);
|
|
912
|
+
},
|
|
913
|
+
onFinalTranscript: (r) => {
|
|
914
|
+
if (t.signal.aborted) return;
|
|
915
|
+
ce();
|
|
916
|
+
const a = r.trim();
|
|
917
|
+
a && re(`${a} `, { asHtml: !1 });
|
|
918
|
+
}
|
|
919
|
+
}).catch((r) => {
|
|
920
|
+
t.signal.aborted || r && typeof r == "object" && "name" in r && r.name === "AbortError" || Ce(!0);
|
|
921
|
+
}).finally(() => {
|
|
922
|
+
ce(), oe.current === t && (oe.current = null, we(!1));
|
|
923
|
+
});
|
|
924
|
+
}, [u, re, ce, Me]), Re = f(() => {
|
|
925
|
+
H ? ze() : Ne();
|
|
926
|
+
}, [H, Ne, ze]);
|
|
927
|
+
P(() => () => {
|
|
928
|
+
var t;
|
|
929
|
+
return (t = oe.current) == null ? void 0 : t.abort();
|
|
930
|
+
}, []), P(() => {
|
|
931
|
+
const t = z.current;
|
|
932
|
+
if (!t) return;
|
|
933
|
+
t.value = Ee.current;
|
|
934
|
+
const r = Bt(h);
|
|
935
|
+
if (!r) {
|
|
936
|
+
d(!0);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
$.current = r;
|
|
940
|
+
const a = {
|
|
941
|
+
lang: Z ?? Wt(F.language || "en"),
|
|
942
|
+
// The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
|
|
943
|
+
// via the command API, so Redactor's native toolbar is suppressed.
|
|
944
|
+
toolbar: !1,
|
|
945
|
+
plugins: k ?? [],
|
|
946
|
+
placeholder: j ?? M("editor.placeholder"),
|
|
947
|
+
toolbarFixed: !1,
|
|
948
|
+
// Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
|
|
949
|
+
shortcodes: !1,
|
|
950
|
+
imageEditable: !1,
|
|
951
|
+
imageResizable: !0
|
|
952
|
+
}, v = D ? { imageUpload: D } : {}, y = (p == null ? void 0 : p.callbacks) ?? {}, c = {
|
|
953
|
+
...a,
|
|
954
|
+
...v,
|
|
955
|
+
...p ?? {},
|
|
956
|
+
// Re-pin safety-critical keys LAST so consumer `options` can't override
|
|
957
|
+
// the sanitising change handler, re-enable image editing, or turn off
|
|
958
|
+
// drag-resize (platform re-pins both image flags — RedactorWysiwyg.js:115-116).
|
|
959
|
+
imageEditable: !1,
|
|
960
|
+
imageResizable: !0,
|
|
961
|
+
callbacks: {
|
|
962
|
+
...y,
|
|
963
|
+
changed(X) {
|
|
964
|
+
const Y = be(Dt(X)), ue = O(Y);
|
|
965
|
+
U.current = !0, T.current && (ee.current && clearTimeout(ee.current), ee.current = setTimeout(() => {
|
|
966
|
+
var ae;
|
|
967
|
+
(ae = T.current) == null || ae.call(T, { html: ue, markdown: "" });
|
|
968
|
+
}, 100));
|
|
969
|
+
},
|
|
970
|
+
keydown(X) {
|
|
971
|
+
var Y;
|
|
972
|
+
(Y = le.current) == null || Y.call(le, X);
|
|
973
|
+
},
|
|
974
|
+
observe() {
|
|
975
|
+
se();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
try {
|
|
980
|
+
if (r(m, c), l)
|
|
981
|
+
try {
|
|
982
|
+
r(m, "enableReadOnly");
|
|
983
|
+
} catch {
|
|
984
|
+
}
|
|
985
|
+
} catch {
|
|
986
|
+
d(!0);
|
|
987
|
+
}
|
|
988
|
+
return () => {
|
|
989
|
+
ee.current && clearTimeout(ee.current);
|
|
990
|
+
try {
|
|
991
|
+
r(m, "destroy");
|
|
992
|
+
} catch {
|
|
993
|
+
}
|
|
994
|
+
$.current = null;
|
|
995
|
+
};
|
|
996
|
+
}, []), P(() => {
|
|
997
|
+
if (!$.current || g === void 0) return;
|
|
998
|
+
if (U.current) {
|
|
999
|
+
U.current = !1;
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
const t = O(be(g));
|
|
1003
|
+
be(te()) !== t && q("source.setCode", t);
|
|
1004
|
+
}, [g, te, q]), P(() => {
|
|
1005
|
+
ie.current = l;
|
|
1006
|
+
const t = $.current;
|
|
1007
|
+
if (t)
|
|
1008
|
+
try {
|
|
1009
|
+
t(m, l ? "enableReadOnly" : "disableReadOnly");
|
|
1010
|
+
} catch {
|
|
1011
|
+
}
|
|
1012
|
+
}, [l, m]), P(() => {
|
|
1013
|
+
if (!i || g === void 0) return;
|
|
1014
|
+
const t = z.current;
|
|
1015
|
+
if (!t) return;
|
|
1016
|
+
const r = O(g);
|
|
1017
|
+
t.value !== r && document.activeElement !== t && (t.value = r);
|
|
1018
|
+
}, [i, g]);
|
|
1019
|
+
const ge = Se(
|
|
1020
|
+
() => ({
|
|
1021
|
+
getHTML() {
|
|
1022
|
+
return te();
|
|
1023
|
+
},
|
|
1024
|
+
getText() {
|
|
1025
|
+
return te().replace(/<[^>]*>/g, " ").replace(/ /gi, " ").replace(/\s+/g, " ").trim();
|
|
1026
|
+
},
|
|
1027
|
+
getMarkdown() {
|
|
1028
|
+
return "";
|
|
1029
|
+
},
|
|
1030
|
+
setContent(t) {
|
|
1031
|
+
const r = O(t);
|
|
1032
|
+
q("source.setCode", r) || z.current && (z.current.value = r);
|
|
1033
|
+
},
|
|
1034
|
+
insertAtCursor: re,
|
|
1035
|
+
applyFormat(t) {
|
|
1036
|
+
const r = Vt[t];
|
|
1037
|
+
r && fe(...r);
|
|
1038
|
+
},
|
|
1039
|
+
focus() {
|
|
1040
|
+
var r;
|
|
1041
|
+
const t = $.current;
|
|
1042
|
+
if (t)
|
|
1043
|
+
try {
|
|
1044
|
+
t(m, "editor.focus");
|
|
1045
|
+
return;
|
|
1046
|
+
} catch {
|
|
1047
|
+
}
|
|
1048
|
+
(r = z.current) == null || r.focus();
|
|
1049
|
+
},
|
|
1050
|
+
clear() {
|
|
1051
|
+
q("source.setCode", "") || z.current && (z.current.value = "");
|
|
1052
|
+
}
|
|
1053
|
+
}),
|
|
1054
|
+
[m, te, q, re, fe]
|
|
1055
|
+
);
|
|
1056
|
+
Be(ne, () => ge, [ge]), We(Nt, ge, o);
|
|
1057
|
+
const qe = f(
|
|
1058
|
+
(t) => {
|
|
1059
|
+
var r;
|
|
1060
|
+
(r = T.current) == null || r.call(T, {
|
|
1061
|
+
html: O(t.target.value),
|
|
1062
|
+
markdown: ""
|
|
1063
|
+
});
|
|
1064
|
+
},
|
|
1065
|
+
[]
|
|
1066
|
+
), je = b ?? M("editor.regionLabel"), Oe = j ?? M("editor.placeholder");
|
|
1067
|
+
return /* @__PURE__ */ w(
|
|
1068
|
+
"div",
|
|
1069
|
+
{
|
|
1070
|
+
ref: K,
|
|
1071
|
+
className: [Gt(), s].filter(Boolean).join(" "),
|
|
1072
|
+
"data-component": "rich-text-editor",
|
|
1073
|
+
"data-component-id": o,
|
|
1074
|
+
"data-min-height": R,
|
|
1075
|
+
children: [
|
|
1076
|
+
!i && !l ? /* @__PURE__ */ e(
|
|
1077
|
+
Pt,
|
|
1078
|
+
{
|
|
1079
|
+
run: fe,
|
|
1080
|
+
active: Ae,
|
|
1081
|
+
preset: Q,
|
|
1082
|
+
enableColor: (k == null ? void 0 : k.includes("fontcolor")) ?? !1,
|
|
1083
|
+
enableImage: !!D,
|
|
1084
|
+
enableTable: (k == null ? void 0 : k.includes("table")) ?? !1
|
|
1085
|
+
}
|
|
1086
|
+
) : null,
|
|
1087
|
+
/* @__PURE__ */ w("div", { className: "ds:relative", children: [
|
|
1088
|
+
/* @__PURE__ */ e(
|
|
1089
|
+
"textarea",
|
|
1090
|
+
{
|
|
1091
|
+
ref: z,
|
|
1092
|
+
id: W,
|
|
1093
|
+
"aria-label": je,
|
|
1094
|
+
"aria-multiline": "true",
|
|
1095
|
+
placeholder: Oe,
|
|
1096
|
+
onChange: i ? qe : void 0,
|
|
1097
|
+
readOnly: i ? l : void 0,
|
|
1098
|
+
className: i ? Qt() : void 0
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
S && u ? /* @__PURE__ */ w("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10 ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:shadow-[var(--shadow-lg)]", children: [
|
|
1102
|
+
/* @__PURE__ */ e(
|
|
1103
|
+
"button",
|
|
1104
|
+
{
|
|
1105
|
+
type: "button",
|
|
1106
|
+
onClick: Re,
|
|
1107
|
+
"aria-pressed": H,
|
|
1108
|
+
"aria-label": M(H ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
1109
|
+
className: H ? Zt : Ie,
|
|
1110
|
+
children: H ? /* @__PURE__ */ e(
|
|
1111
|
+
pe,
|
|
1112
|
+
{
|
|
1113
|
+
"aria-hidden": "true",
|
|
1114
|
+
className: "ds:size-5 ds:fill-current"
|
|
1115
|
+
}
|
|
1116
|
+
) : /* @__PURE__ */ e(ve, { "aria-hidden": "true", className: "ds:size-5" })
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
/* @__PURE__ */ e(
|
|
1120
|
+
"span",
|
|
1121
|
+
{
|
|
1122
|
+
"aria-hidden": "true",
|
|
1123
|
+
className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
/* @__PURE__ */ e(
|
|
1127
|
+
"button",
|
|
1128
|
+
{
|
|
1129
|
+
type: "button",
|
|
1130
|
+
onClick: () => N(!0),
|
|
1131
|
+
"aria-label": M("editor.ai.helpMeWrite"),
|
|
1132
|
+
className: Ie,
|
|
1133
|
+
children: /* @__PURE__ */ e(ye, { "aria-hidden": "true", className: "ds:size-5" })
|
|
1134
|
+
}
|
|
1135
|
+
)
|
|
1136
|
+
] }) : u ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
|
|
1137
|
+
I,
|
|
1138
|
+
{
|
|
1139
|
+
size: "lg",
|
|
1140
|
+
intent: "primary",
|
|
1141
|
+
icon: H ? /* @__PURE__ */ e(pe, { className: "ds:fill-current" }) : /* @__PURE__ */ e(ve, {}),
|
|
1142
|
+
"aria-pressed": H,
|
|
1143
|
+
"aria-label": M(H ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
1144
|
+
onClick: Re,
|
|
1145
|
+
className: H ? `${Jt} ds:rounded-full ds:shadow-[var(--shadow-lg)]` : "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
|
|
1146
|
+
}
|
|
1147
|
+
) }) : S ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
|
|
1148
|
+
I,
|
|
1149
|
+
{
|
|
1150
|
+
size: "lg",
|
|
1151
|
+
intent: "primary",
|
|
1152
|
+
icon: /* @__PURE__ */ e(ye, {}),
|
|
1153
|
+
"aria-label": M("editor.ai.helpMeWrite"),
|
|
1154
|
+
onClick: () => N(!0),
|
|
1155
|
+
className: "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
|
|
1156
|
+
}
|
|
1157
|
+
) }) : null,
|
|
1158
|
+
S ? /* @__PURE__ */ e(
|
|
1159
|
+
_t,
|
|
1160
|
+
{
|
|
1161
|
+
open: G,
|
|
1162
|
+
onClose: () => N(!1),
|
|
1163
|
+
onRequestAiDraft: S,
|
|
1164
|
+
onInsert: (t) => re(t, { asHtml: J !== "text" }),
|
|
1165
|
+
previewAsHtml: J !== "text",
|
|
1166
|
+
privacyNotice: V,
|
|
1167
|
+
onDictate: u
|
|
1168
|
+
}
|
|
1169
|
+
) : null
|
|
1170
|
+
] }),
|
|
1171
|
+
u && $e ? /* @__PURE__ */ e(
|
|
1172
|
+
"p",
|
|
1173
|
+
{
|
|
1174
|
+
role: "alert",
|
|
1175
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
1176
|
+
children: M("editor.ai.dictationError")
|
|
1177
|
+
}
|
|
1178
|
+
) : null
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
);
|
|
1184
|
+
Xt.displayName = "RichTextEditor";
|
|
1185
|
+
export {
|
|
1186
|
+
Xt as R,
|
|
1187
|
+
Nt as r,
|
|
1188
|
+
Gt as w
|
|
1189
|
+
};
|
|
1190
|
+
//# sourceMappingURL=rich-text-editor-u36FqSWz.js.map
|