@krak-stack/registry 0.10.19 → 0.11.1
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/CHANGELOG.md +105 -0
- package/README.md +28 -7
- package/dist/components/agent/index.d.ts +454 -0
- package/dist/components/agent/react.d.ts +55 -0
- package/dist/components/agent/react.js +2594 -0
- package/dist/components/agent/schema.d.ts +55 -0
- package/dist/components/animated-list/classes.d.ts +9 -0
- package/dist/components/animated-list/html.d.ts +11 -0
- package/dist/components/animated-list/html.js +533 -0
- package/dist/components/animated-list/index.d.ts +205 -0
- package/dist/components/animated-list/react.d.ts +11 -0
- package/dist/components/animated-list/react.js +711 -0
- package/dist/components/animated-list/schema.d.ts +44 -0
- package/dist/components/animated-number/html.d.ts +19 -0
- package/dist/components/animated-number/html.js +101 -0
- package/dist/components/animated-number/index.d.ts +80 -0
- package/dist/components/{ui/animated-number.d.ts → animated-number/react.d.ts} +2 -7
- package/dist/components/animated-number/react.js +278 -0
- package/dist/components/animated-number/schema.d.ts +9 -0
- package/dist/components/app-brand/classes.d.ts +11 -0
- package/dist/components/app-brand/html.d.ts +26 -0
- package/dist/components/app-brand/html.js +78 -0
- package/dist/components/app-brand/react.d.ts +12 -0
- package/dist/components/app-brand/react.js +86 -0
- package/dist/components/app-brand/schema.d.ts +36 -0
- package/dist/components/app-switcher/classes.d.ts +15 -0
- package/dist/components/app-switcher/html.d.ts +72 -0
- package/dist/components/app-switcher/html.js +327 -0
- package/dist/components/app-switcher/index.d.ts +47 -0
- package/dist/components/app-switcher/react.d.ts +12 -0
- package/dist/components/{ui/app-switcher.js → app-switcher/react.js} +84 -15
- package/dist/components/app-switcher/schema.d.ts +39 -0
- package/dist/components/async-action-button/classes.d.ts +11 -0
- package/dist/components/async-action-button/html.d.ts +46 -0
- package/dist/components/async-action-button/html.js +266 -0
- package/dist/components/async-action-button/index.d.ts +73 -0
- package/dist/components/async-action-button/react.d.ts +10 -0
- package/dist/components/async-action-button/react.js +378 -0
- package/dist/components/async-action-button/schema.d.ts +28 -0
- package/dist/{services/events/client/audit-log-table.d.ts → components/audit-log-table/react.d.ts} +2 -2
- package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js} +2195 -918
- package/dist/components/auto-height/html.d.ts +8 -0
- package/dist/components/auto-height/html.js +81 -0
- package/dist/components/auto-height/index.d.ts +2 -0
- package/dist/components/{ui/auto-height.d.ts → auto-height/react.d.ts} +2 -4
- package/dist/components/auto-height/react.js +75 -0
- package/dist/components/auto-height/schema.d.ts +7 -0
- package/dist/components/bulk-list-input/classes.d.ts +7 -0
- package/dist/components/bulk-list-input/html.d.ts +41 -0
- package/dist/components/bulk-list-input/html.js +265 -0
- package/dist/components/bulk-list-input/index.d.ts +76 -0
- package/dist/components/bulk-list-input/react.d.ts +12 -0
- package/dist/components/{ui/bulk-list-input.js → bulk-list-input/react.js} +71 -4
- package/dist/components/bulk-list-input/schema.d.ts +33 -0
- package/dist/components/choice-cards/classes.d.ts +19 -0
- package/dist/components/choice-cards/html.d.ts +76 -0
- package/dist/components/choice-cards/html.js +237 -0
- package/dist/components/choice-cards/index.d.ts +1 -0
- package/dist/components/choice-cards/react.d.ts +21 -0
- package/dist/components/{ui/choice-cards.js → choice-cards/react.js} +29 -10
- package/dist/components/choice-cards/schema.d.ts +100 -0
- package/dist/components/code-block/classes.d.ts +13 -0
- package/dist/components/code-block/html.d.ts +21 -0
- package/dist/components/code-block/html.js +381 -0
- package/dist/components/code-block/index.d.ts +4 -0
- package/dist/components/code-block/react.d.ts +4 -0
- package/dist/components/code-block/react.js +493 -0
- package/dist/components/code-block/schema.d.ts +29 -0
- package/dist/components/color-input/classes.d.ts +9 -0
- package/dist/components/color-input/html.d.ts +48 -0
- package/dist/components/color-input/html.js +187 -0
- package/dist/components/color-input/index.d.ts +88 -0
- package/dist/components/color-input/react.d.ts +7 -0
- package/dist/components/{ui/color-picker.js → color-input/react.js} +165 -233
- package/dist/components/color-input/schema.d.ts +40 -0
- package/dist/components/copy-button/html.d.ts +48 -0
- package/dist/components/copy-button/html.js +266 -0
- package/dist/components/copy-button/index.d.ts +73 -0
- package/dist/components/copy-button/react.d.ts +12 -0
- package/dist/components/copy-button/react.js +388 -0
- package/dist/components/copy-button/schema.d.ts +37 -0
- package/dist/components/copy-value/html.d.ts +37 -0
- package/dist/components/copy-value/html.js +426 -0
- package/dist/components/copy-value/index.d.ts +57 -0
- package/dist/components/copy-value/react.d.ts +9 -0
- package/dist/components/copy-value/react.js +682 -0
- package/dist/components/copy-value/schema.d.ts +45 -0
- package/dist/components/cron-input/classes.d.ts +25 -0
- package/dist/components/cron-input/html.d.ts +36 -0
- package/dist/components/cron-input/html.js +204 -0
- package/dist/components/cron-input/index.d.ts +59 -0
- package/dist/components/cron-input/react.d.ts +7 -0
- package/dist/components/{ui/cron-expression-editor.js → cron-input/react.js} +126 -54
- package/dist/components/cron-input/schema.d.ts +24 -0
- package/dist/components/danger-confirmation/classes.d.ts +7 -0
- package/dist/components/danger-confirmation/html.d.ts +39 -0
- package/dist/components/danger-confirmation/html.js +227 -0
- package/dist/components/danger-confirmation/index.d.ts +113 -0
- package/dist/components/{ui/danger-confirmation.d.ts → danger-confirmation/react.d.ts} +3 -12
- package/dist/components/danger-confirmation/react.js +550 -0
- package/dist/components/danger-confirmation/schema.d.ts +34 -0
- package/dist/components/data-table/classes.d.ts +63 -0
- package/dist/components/data-table/html.d.ts +1938 -0
- package/dist/components/data-table/html.js +2682 -0
- package/dist/components/data-table/index.d.ts +2686 -0
- package/dist/components/data-table/react.d.ts +578 -0
- package/dist/components/{ui/data-table.js → data-table/react.js} +2189 -906
- package/dist/components/data-table/schema.d.ts +3012 -0
- package/dist/components/date-input/classes.d.ts +17 -0
- package/dist/components/date-input/html.d.ts +60 -0
- package/dist/components/date-input/html.js +418 -0
- package/dist/components/date-input/index.d.ts +91 -0
- package/dist/components/date-input/react.d.ts +10 -0
- package/dist/components/{ui/date-picker.js → date-input/react.js} +233 -79
- package/dist/components/date-input/schema.d.ts +41 -0
- package/dist/components/editable-text/classes.d.ts +17 -0
- package/dist/components/editable-text/html.d.ts +51 -0
- package/dist/components/editable-text/html.js +370 -0
- package/dist/components/editable-text/index.d.ts +143 -0
- package/dist/components/editable-text/react.d.ts +6 -0
- package/dist/components/editable-text/react.js +499 -0
- package/dist/components/editable-text/schema.d.ts +31 -0
- package/dist/components/editing-locale-switcher/classes.d.ts +7 -0
- package/dist/components/editing-locale-switcher/html.d.ts +27 -0
- package/dist/components/editing-locale-switcher/html.js +250 -0
- package/dist/components/editing-locale-switcher/index.d.ts +52 -0
- package/dist/components/editing-locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/editing-locale-switcher.js → editing-locale-switcher/react.js} +70 -17
- package/dist/components/editing-locale-switcher/schema.d.ts +16 -0
- package/dist/components/{ui/effect-form.d.ts → effect-form/react.d.ts} +2 -2
- package/dist/components/{ui/effect-form.js → effect-form/react.js} +309 -83
- package/dist/components/effectcn/alert-dialog.d.ts +13 -0
- package/dist/components/effectcn/button.d.ts +31 -0
- package/dist/components/effectcn/calendar.d.ts +12 -0
- package/dist/components/effectcn/checkbox.d.ts +10 -0
- package/dist/components/effectcn/combobox.d.ts +25 -0
- package/dist/components/effectcn/dialog.d.ts +19 -0
- package/dist/components/effectcn/field.d.ts +11 -0
- package/dist/components/effectcn/file-drop.d.ts +8 -0
- package/dist/components/effectcn/input.d.ts +26 -0
- package/dist/components/effectcn/menu.d.ts +85 -0
- package/dist/components/effectcn/menubar.d.ts +8 -0
- package/dist/components/effectcn/popover.d.ts +18 -0
- package/dist/components/effectcn/scroll-area.d.ts +12 -0
- package/dist/components/effectcn/select.d.ts +68 -0
- package/dist/components/effectcn/toast.d.ts +29 -0
- package/dist/components/email-composer/index.d.ts +229 -0
- package/dist/components/email-composer/labels.d.ts +12 -0
- package/dist/components/email-composer/react.d.ts +5 -0
- package/dist/components/email-composer/react.js +1354 -0
- package/dist/components/email-composer/schema.d.ts +42 -0
- package/dist/components/email-editor/classes.d.ts +21 -0
- package/dist/components/email-editor/html.d.ts +360 -0
- package/dist/components/email-editor/html.js +1706 -0
- package/dist/components/email-editor/index.d.ts +693 -0
- package/dist/components/{ui/email-editor.d.ts → email-editor/labels.d.ts} +1 -19
- package/dist/components/email-editor/legacy-editor.html.d.ts +160 -0
- package/dist/components/email-editor/react.d.ts +11 -0
- package/dist/components/{ui/email-editor.js → email-editor/react.js} +1057 -712
- package/dist/components/email-editor/schema.d.ts +162 -0
- package/dist/components/error-component/classes.d.ts +7 -0
- package/dist/components/error-component/html.d.ts +120 -0
- package/dist/components/error-component/html.js +346 -0
- package/dist/components/error-component/index.d.ts +69 -0
- package/dist/components/error-component/react.d.ts +8 -0
- package/dist/components/error-component/react.js +744 -0
- package/dist/components/error-component/schema.d.ts +56 -0
- package/dist/components/file-input/classes.d.ts +7 -0
- package/dist/components/file-input/html.d.ts +95 -0
- package/dist/components/file-input/html.js +368 -0
- package/dist/components/file-input/index.d.ts +99 -0
- package/dist/components/file-input/react.d.ts +11 -0
- package/dist/components/{ui/file-picker.js → file-input/react.js} +122 -19
- package/dist/components/file-input/schema.d.ts +37 -0
- package/dist/components/{ui/form.d.ts → form/react.d.ts} +4 -4
- package/dist/components/{ui/form.js → form/react.js} +314 -84
- package/dist/components/icon-input/html.d.ts +55 -0
- package/dist/components/icon-input/html.js +538 -0
- package/dist/components/icon-input/index.d.ts +143 -0
- package/dist/components/icon-input/react.d.ts +6 -0
- package/dist/components/{ui/icon-input.js → icon-input/react.js} +459 -89
- package/dist/components/icon-input/schema.d.ts +23 -0
- package/dist/components/image-crop-editor/classes.d.ts +19 -0
- package/dist/components/image-crop-editor/html.d.ts +66 -0
- package/dist/components/image-crop-editor/html.js +561 -0
- package/dist/components/image-crop-editor/index.d.ts +183 -0
- package/dist/components/image-crop-editor/react.d.ts +8 -0
- package/dist/components/image-crop-editor/react.js +802 -0
- package/dist/components/image-crop-editor/schema.d.ts +54 -0
- package/dist/components/krakstack-provider/html.d.ts +17 -0
- package/dist/components/krakstack-provider/html.js +37 -0
- package/dist/components/krakstack-provider/index.d.ts +7 -0
- package/dist/components/krakstack-provider/react.d.ts +8 -0
- package/dist/components/{ui/krakstack-provider.js → krakstack-provider/react.js} +14 -5
- package/dist/components/krakstack-provider/schema.d.ts +6 -0
- package/dist/components/loading/classes.d.ts +5 -0
- package/dist/components/loading/html.d.ts +18 -0
- package/dist/components/loading/html.js +166 -0
- package/dist/components/loading/index.d.ts +6 -0
- package/dist/components/loading/react.d.ts +4 -0
- package/dist/components/loading/react.js +51 -0
- package/dist/components/loading/schema.d.ts +23 -0
- package/dist/components/locale-switcher/html.d.ts +22 -0
- package/dist/components/locale-switcher/html.js +264 -0
- package/dist/components/locale-switcher/index.d.ts +50 -0
- package/dist/components/locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/locale-switcher.js → locale-switcher/react.js} +55 -22
- package/dist/components/locale-switcher/schema.d.ts +12 -0
- package/dist/components/map-menu/classes.d.ts +13 -0
- package/dist/components/map-menu/google-maps.d.ts +80 -0
- package/dist/components/map-menu/google-viewport.d.ts +7 -0
- package/dist/components/map-menu/html.d.ts +274 -0
- package/dist/components/map-menu/html.js +934 -0
- package/dist/components/map-menu/index.d.ts +246 -0
- package/dist/components/map-menu/map.d.ts +47 -0
- package/dist/components/map-menu/react.d.ts +40 -0
- package/dist/components/{ui/map-menu.js → map-menu/react.js} +502 -141
- package/dist/components/map-menu/schema.d.ts +132 -0
- package/dist/components/markdown/classes.d.ts +1 -0
- package/dist/components/markdown/html.d.ts +23 -0
- package/dist/components/markdown/html.js +510 -0
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/react.d.ts +3 -0
- package/dist/components/markdown/react.js +546 -0
- package/dist/components/markdown/schema.d.ts +20 -0
- package/dist/components/notification-menu/classes.d.ts +11 -0
- package/dist/components/notification-menu/html.d.ts +67 -0
- package/dist/components/notification-menu/html.js +425 -0
- package/dist/components/notification-menu/index.d.ts +132 -0
- package/dist/components/notification-menu/react.d.ts +57 -0
- package/dist/components/notification-menu/react.js +829 -0
- package/dist/components/notification-menu/schema.d.ts +59 -0
- package/dist/components/pagination/classes.d.ts +19 -0
- package/dist/components/pagination/html.d.ts +49 -0
- package/dist/components/pagination/html.js +387 -0
- package/dist/components/pagination/index.d.ts +109 -0
- package/dist/components/pagination/react.d.ts +9 -0
- package/dist/components/{ui/pagination.js → pagination/react.js} +130 -30
- package/dist/components/pagination/schema.d.ts +36 -0
- package/dist/components/phone-number-input/classes.d.ts +17 -0
- package/dist/components/phone-number-input/html.d.ts +52 -0
- package/dist/components/phone-number-input/html.js +655 -0
- package/dist/components/phone-number-input/index.d.ts +59 -0
- package/dist/components/phone-number-input/react.d.ts +11 -0
- package/dist/components/{ui/phone-number-input.js → phone-number-input/react.js} +368 -138
- package/dist/components/phone-number-input/schema.d.ts +31 -0
- package/dist/components/presence-transition/html.d.ts +13 -0
- package/dist/components/presence-transition/html.js +128 -0
- package/dist/components/presence-transition/index.d.ts +57 -0
- package/dist/components/{ui/presence-transition.d.ts → presence-transition/react.d.ts} +3 -5
- package/dist/components/presence-transition/react.js +293 -0
- package/dist/components/presence-transition/schema.d.ts +7 -0
- package/dist/components/registry-previews/component-example.d.ts +31 -0
- package/dist/components/registry-previews/component-example.js +679 -0
- package/dist/components/registry-previews/html-preview.d.ts +17 -0
- package/dist/components/registry-previews/html-preview.js +83 -0
- package/dist/components/rich-text-editor/classes.d.ts +15 -0
- package/dist/components/rich-text-editor/engine.d.ts +9 -0
- package/dist/components/rich-text-editor/html.d.ts +246 -0
- package/dist/components/rich-text-editor/html.js +830 -0
- package/dist/components/rich-text-editor/index.d.ts +453 -0
- package/dist/components/rich-text-editor/labels.d.ts +42 -0
- package/dist/components/rich-text-editor/react.d.ts +19 -0
- package/dist/components/rich-text-editor/react.js +1175 -0
- package/dist/components/rich-text-editor/schema.d.ts +116 -0
- package/dist/components/search-menu/classes.d.ts +9 -0
- package/dist/components/search-menu/html.d.ts +127 -0
- package/dist/components/search-menu/html.js +432 -0
- package/dist/components/search-menu/index.d.ts +85 -0
- package/dist/components/search-menu/react.d.ts +18 -0
- package/dist/components/{ui/search-menu.js → search-menu/react.js} +290 -31
- package/dist/components/search-menu/schema.d.ts +78 -0
- package/dist/components/select-with-custom-input/classes.d.ts +17 -0
- package/dist/components/select-with-custom-input/html.d.ts +60 -0
- package/dist/components/select-with-custom-input/html.js +238 -0
- package/dist/components/select-with-custom-input/index.d.ts +114 -0
- package/dist/components/select-with-custom-input/react.d.ts +7 -0
- package/dist/components/{ui/select-with-custom-input.js → select-with-custom-input/react.js} +134 -29
- package/dist/components/select-with-custom-input/schema.d.ts +54 -0
- package/dist/components/sidebar-layout/classes.d.ts +21 -0
- package/dist/components/sidebar-layout/html.d.ts +97 -0
- package/dist/components/sidebar-layout/html.js +361 -0
- package/dist/components/sidebar-layout/index.d.ts +57 -0
- package/dist/components/sidebar-layout/react.d.ts +30 -0
- package/dist/components/{ui/sidebar-layout.js → sidebar-layout/react.js} +353 -39
- package/dist/components/sidebar-layout/schema.d.ts +54 -0
- package/dist/components/stats-card/classes.d.ts +11 -0
- package/dist/components/stats-card/html.d.ts +15 -0
- package/dist/components/stats-card/html.js +55 -0
- package/dist/components/stats-card/react.d.ts +7 -0
- package/dist/components/{ui/stats-card.js → stats-card/react.js} +19 -15
- package/dist/components/stats-card/schema.d.ts +14 -0
- package/dist/components/stepper/classes.d.ts +39 -0
- package/dist/components/stepper/html.d.ts +107 -0
- package/dist/components/stepper/html.js +397 -0
- package/dist/components/stepper/index.d.ts +83 -0
- package/dist/components/stepper/react.d.ts +17 -0
- package/dist/components/{ui/stepper.js → stepper/react.js} +120 -21
- package/dist/components/stepper/schema.d.ts +52 -0
- package/dist/components/support/classes.d.ts +55 -0
- package/dist/components/support/form.d.ts +19 -0
- package/dist/components/support/html.d.ts +266 -0
- package/dist/components/support/html.js +604 -0
- package/dist/components/support/index.d.ts +226 -0
- package/dist/components/support/multipart.d.ts +21 -0
- package/dist/components/support/react.d.ts +54 -0
- package/dist/components/support/react.js +1252 -0
- package/dist/components/support/schema.d.ts +69 -0
- package/dist/components/support.d.ts +1 -66
- package/dist/components/theme-switcher/html.d.ts +28 -0
- package/dist/components/theme-switcher/html.js +288 -0
- package/dist/components/theme-switcher/index.d.ts +59 -0
- package/dist/components/{ui/theme-switcher.d.ts → theme-switcher/react.d.ts} +4 -12
- package/dist/components/{ui/theme-switcher.js → theme-switcher/react.js} +69 -35
- package/dist/components/theme-switcher/schema.d.ts +33 -0
- package/dist/components/time-input/classes.d.ts +23 -0
- package/dist/components/time-input/html.d.ts +75 -0
- package/dist/components/time-input/html.js +571 -0
- package/dist/components/time-input/index.d.ts +164 -0
- package/dist/components/time-input/react.d.ts +7 -0
- package/dist/components/{ui/time-picker.js → time-input/react.js} +286 -114
- package/dist/components/time-input/schema.d.ts +96 -0
- package/dist/components/timezone-input/classes.d.ts +13 -0
- package/dist/components/timezone-input/html.d.ts +58 -0
- package/dist/components/timezone-input/html.js +804 -0
- package/dist/components/timezone-input/index.d.ts +170 -0
- package/dist/components/timezone-input/react.d.ts +9 -0
- package/dist/components/{ui/timezone-select.js → timezone-input/react.js} +493 -106
- package/dist/components/timezone-input/schema.d.ts +43 -0
- package/dist/components/toast/classes.d.ts +7 -0
- package/dist/components/toast/html.d.ts +34 -0
- package/dist/components/toast/html.js +280 -0
- package/dist/components/toast/index.d.ts +10 -0
- package/dist/components/toast/react.d.ts +9 -0
- package/dist/components/{ui/toast.js → toast/react.js} +35 -15
- package/dist/components/toast/schema.d.ts +24 -0
- package/dist/{services/events/client/tracking-notice.d.ts → components/tracking-notice/react.d.ts} +7 -1
- package/dist/{services/events/client/tracking-notice.js → components/tracking-notice/react.js} +13 -7
- package/dist/components/ui/animated-list.d.ts +1 -21
- package/dist/components/ui/app-brand.d.ts +1 -33
- package/dist/components/ui/async-action-button.d.ts +1 -17
- package/dist/components/ui/code-block.d.ts +1 -14
- package/dist/components/ui/copy-button.d.ts +1 -21
- package/dist/components/ui/data-table.d.ts +1 -584
- package/dist/components/ui/krakstack-provider.d.ts +1 -9
- package/dist/components/ui/loading.d.ts +1 -13
- package/dist/components/ui/pagination.d.ts +1 -47
- package/dist/components/ui/rich-text-editor.d.ts +1 -70
- package/dist/components/ui/search-menu.d.ts +1 -36
- package/dist/components/ui/select.js +159 -0
- package/dist/components/ui/sidebar-layout.d.ts +1 -40
- package/dist/components/ui/virtualized-combobox.d.ts +1 -59
- package/dist/components/unsaved-changes-guard/html.d.ts +34 -0
- package/dist/components/unsaved-changes-guard/html.js +172 -0
- package/dist/components/unsaved-changes-guard/index.d.ts +56 -0
- package/dist/components/unsaved-changes-guard/react.d.ts +4 -0
- package/dist/components/{ui/unsaved-changes-guard.js → unsaved-changes-guard/react.js} +74 -11
- package/dist/components/unsaved-changes-guard/schema.d.ts +37 -0
- package/dist/components/upload-attachment/classes.d.ts +11 -0
- package/dist/components/upload-attachment/html.d.ts +84 -0
- package/dist/components/upload-attachment/html.js +312 -0
- package/dist/components/upload-attachment/index.d.ts +72 -0
- package/dist/components/upload-attachment/react.d.ts +9 -0
- package/dist/components/{ui/upload-attachment.js → upload-attachment/react.js} +114 -17
- package/dist/components/upload-attachment/schema.d.ts +53 -0
- package/dist/components/virtualized-combobox/classes.d.ts +7 -0
- package/dist/components/virtualized-combobox/html.d.ts +97 -0
- package/dist/components/virtualized-combobox/html.js +310 -0
- package/dist/components/virtualized-combobox/index.d.ts +182 -0
- package/dist/components/virtualized-combobox/react.d.ts +31 -0
- package/dist/components/{ui/virtualized-combobox.js → virtualized-combobox/react.js} +160 -40
- package/dist/components/virtualized-combobox/schema.d.ts +92 -0
- package/dist/components/webhook-delivery-table/html.d.ts +216 -0
- package/dist/components/webhook-delivery-table/html.js +3008 -0
- package/dist/components/webhook-delivery-table/index.d.ts +405 -0
- package/dist/components/webhook-delivery-table/react.d.ts +13 -0
- package/dist/{services/webhooks/client/delivery-table.js → components/webhook-delivery-table/react.js} +2475 -956
- package/dist/components/webhook-delivery-table/schema.d.ts +134 -0
- package/dist/lib/docs.d.ts +17 -1
- package/dist/lib/docs.integrations.server.js +358 -73
- package/dist/lib/docs.js +861 -293
- package/dist/lib/docs.server.js +342 -57
- package/dist/lib/documentation-toolkit.d.ts +4 -4
- package/dist/lib/documentation-toolkit.js +354 -69
- package/dist/lib/effect-ui-adapter/model-runtime.d.ts +17 -0
- package/dist/lib/effect-ui-adapter/use-model.d.ts +9 -0
- package/dist/lib/effectcn-form.d.ts +3 -0
- package/dist/lib/effectcn-form.js +54 -0
- package/dist/lib/email-composer/index.d.ts +12 -0
- package/dist/lib/email-composer/index.js +110 -0
- package/dist/lib/email-composer/schema.d.ts +14 -0
- package/dist/lib/email-composer/schema.js +13 -0
- package/dist/lib/email-document/legacy-rich-text/editor.d.ts +70 -0
- package/dist/lib/email-document/legacy-rich-text/model.d.ts +19 -0
- package/dist/lib/email-document/legacy-rich-text/schema.d.ts +65 -0
- package/dist/lib/email-document/legacy-rich-text/tiptap.d.ts +39 -0
- package/dist/lib/email-document/model.d.ts +1 -1
- package/dist/lib/email-document/model.js +2 -2
- package/dist/lib/email-document/render.js +2 -2
- package/dist/lib/email-document/schema.js +1 -1
- package/dist/lib/httpapi-toolkit.d.ts +1 -1
- package/dist/lib/lucide-effect.d.ts +39 -0
- package/dist/lib/markdown/content.d.ts +1 -12
- package/dist/lib/rich-text/model.d.ts +5 -19
- package/dist/lib/rich-text/model.js +79 -111
- package/dist/lib/rich-text/schema.d.ts +5 -55
- package/dist/lib/rich-text/schema.js +17 -36
- package/dist/lib/rich-text/tiptap.d.ts +12 -0
- package/dist/lib/webfetch-toolkit.d.ts +1 -1
- package/dist/services/agent/client/index.js +695 -179
- package/dist/services/agent/client/widget.d.ts +1 -55
- package/dist/services/notification/client/index.js +138 -27
- package/dist/services/notification/client/notification-menu.d.ts +1 -85
- package/dist/services/notification/public.js +138 -27
- package/dist/services/opentelemetry/browser.js +15 -9
- package/dist/services/webhooks/index.d.ts +4 -3
- package/package.json +199 -137
- package/dist/components/support-dialog.js +0 -881
- package/dist/components/support.js +0 -881
- package/dist/components/ui/animated-list.js +0 -414
- package/dist/components/ui/animated-number.js +0 -75
- package/dist/components/ui/app-brand.js +0 -126
- package/dist/components/ui/app-switcher.d.ts +0 -26
- package/dist/components/ui/async-action-button.js +0 -149
- package/dist/components/ui/auto-height.js +0 -86
- package/dist/components/ui/bulk-list-input.d.ts +0 -25
- package/dist/components/ui/choice-cards.d.ts +0 -33
- package/dist/components/ui/code-block.js +0 -221
- package/dist/components/ui/color-picker.d.ts +0 -31
- package/dist/components/ui/copy-button.js +0 -138
- package/dist/components/ui/copy-value.d.ts +0 -24
- package/dist/components/ui/copy-value.js +0 -352
- package/dist/components/ui/cron-expression-editor.d.ts +0 -16
- package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
- package/dist/components/ui/danger-confirmation.js +0 -398
- package/dist/components/ui/date-picker.d.ts +0 -33
- package/dist/components/ui/date-picker.schema.d.ts +0 -9
- package/dist/components/ui/editable-text.d.ts +0 -19
- package/dist/components/ui/editable-text.js +0 -341
- package/dist/components/ui/editing-locale-switcher.d.ts +0 -11
- package/dist/components/ui/error-component.d.ts +0 -34
- package/dist/components/ui/error-component.js +0 -387
- package/dist/components/ui/file-picker.d.ts +0 -37
- package/dist/components/ui/icon-input.d.ts +0 -58
- package/dist/components/ui/image-crop-editor.d.ts +0 -41
- package/dist/components/ui/image-crop-editor.js +0 -417
- package/dist/components/ui/loading.js +0 -39
- package/dist/components/ui/locale-switcher.d.ts +0 -11
- package/dist/components/ui/map-menu-map.d.ts +0 -115
- package/dist/components/ui/map-menu.d.ts +0 -87
- package/dist/components/ui/phone-number-input.d.ts +0 -22
- package/dist/components/ui/phone-number-input.schema.d.ts +0 -7
- package/dist/components/ui/presence-transition.js +0 -94
- package/dist/components/ui/rich-text-editor.js +0 -1135
- package/dist/components/ui/select-with-custom-input.d.ts +0 -36
- package/dist/components/ui/stats-card.d.ts +0 -12
- package/dist/components/ui/stepper.d.ts +0 -37
- package/dist/components/ui/time-picker.d.ts +0 -50
- package/dist/components/ui/time-picker.schema.d.ts +0 -28
- package/dist/components/ui/timezone-select.d.ts +0 -57
- package/dist/components/ui/timezone-select.schema.d.ts +0 -9
- package/dist/components/ui/toast.d.ts +0 -18
- package/dist/components/ui/unsaved-changes-guard.d.ts +0 -16
- package/dist/components/ui/upload-attachment.d.ts +0 -39
- package/dist/lib/rich-text/dom.d.ts +0 -40
- package/dist/services/notification/persistence/drizzle.d.ts +0 -868
- package/dist/services/notification/persistence/drizzle.js +0 -214
- package/dist/services/notification/persistence/index.d.ts +0 -2
- package/dist/services/notification/persistence/index.js +0 -227
- package/dist/services/notification/persistence/schema.d.ts +0 -143
- package/dist/services/notification/persistence/schema.js +0 -118
- package/dist/services/webhooks/client/delivery-table.d.ts +0 -62
|
@@ -1,1135 +0,0 @@
|
|
|
1
|
-
// ../../src/components/ui/rich-text-editor.tsx
|
|
2
|
-
import { Schema as Schema4 } from "effect";
|
|
3
|
-
import {
|
|
4
|
-
useEffect,
|
|
5
|
-
useEffectEvent,
|
|
6
|
-
useId,
|
|
7
|
-
useRef,
|
|
8
|
-
useState
|
|
9
|
-
} from "react";
|
|
10
|
-
import {
|
|
11
|
-
Bold,
|
|
12
|
-
Italic,
|
|
13
|
-
Underline,
|
|
14
|
-
Undo2,
|
|
15
|
-
Redo2,
|
|
16
|
-
Link2,
|
|
17
|
-
Unlink,
|
|
18
|
-
Braces,
|
|
19
|
-
ChevronDown
|
|
20
|
-
} from "lucide-react";
|
|
21
|
-
|
|
22
|
-
// ../../src/components/ui/button.tsx
|
|
23
|
-
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
24
|
-
import { cva } from "class-variance-authority";
|
|
25
|
-
|
|
26
|
-
// ../../src/lib/utils.ts
|
|
27
|
-
import { cn } from "cn";
|
|
28
|
-
|
|
29
|
-
// ../../src/components/ui/button.tsx
|
|
30
|
-
import { jsx } from "react/jsx-runtime";
|
|
31
|
-
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
32
|
-
variants: {
|
|
33
|
-
variant: {
|
|
34
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
35
|
-
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
36
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
37
|
-
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
38
|
-
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
39
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
40
|
-
},
|
|
41
|
-
size: {
|
|
42
|
-
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
43
|
-
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
44
|
-
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
45
|
-
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
46
|
-
icon: "size-9",
|
|
47
|
-
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
48
|
-
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
49
|
-
"icon-lg": "size-10"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
defaultVariants: {
|
|
53
|
-
variant: "default",
|
|
54
|
-
size: "default"
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
function Button({
|
|
58
|
-
className,
|
|
59
|
-
variant = "default",
|
|
60
|
-
size = "default",
|
|
61
|
-
...props
|
|
62
|
-
}) {
|
|
63
|
-
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
64
|
-
"data-slot": "button",
|
|
65
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
66
|
-
...props
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ../../src/components/ui/input.tsx
|
|
71
|
-
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
72
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
73
|
-
function Input({ className, type, ...props }) {
|
|
74
|
-
return /* @__PURE__ */ jsx2(InputPrimitive, {
|
|
75
|
-
type,
|
|
76
|
-
"data-slot": "input",
|
|
77
|
-
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
78
|
-
...props
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ../../src/components/ui/select.tsx
|
|
83
|
-
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
84
|
-
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
|
|
85
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
86
|
-
"use client";
|
|
87
|
-
var Select = SelectPrimitive.Root;
|
|
88
|
-
function SelectValue({ className, ...props }) {
|
|
89
|
-
return /* @__PURE__ */ jsx3(SelectPrimitive.Value, {
|
|
90
|
-
"data-slot": "select-value",
|
|
91
|
-
className: cn("flex flex-1 text-left", className),
|
|
92
|
-
...props
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function SelectTrigger({
|
|
96
|
-
className,
|
|
97
|
-
size = "default",
|
|
98
|
-
children,
|
|
99
|
-
...props
|
|
100
|
-
}) {
|
|
101
|
-
return /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
102
|
-
"data-slot": "select-trigger",
|
|
103
|
-
"data-size": size,
|
|
104
|
-
className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
105
|
-
...props,
|
|
106
|
-
children: [
|
|
107
|
-
children,
|
|
108
|
-
/* @__PURE__ */ jsx3(SelectPrimitive.Icon, {
|
|
109
|
-
render: /* @__PURE__ */ jsx3(ChevronDownIcon, {
|
|
110
|
-
className: "text-muted-foreground pointer-events-none size-4"
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function SelectContent({
|
|
117
|
-
className,
|
|
118
|
-
children,
|
|
119
|
-
side = "bottom",
|
|
120
|
-
sideOffset = 4,
|
|
121
|
-
align = "center",
|
|
122
|
-
alignOffset = 0,
|
|
123
|
-
alignItemWithTrigger = true,
|
|
124
|
-
...props
|
|
125
|
-
}) {
|
|
126
|
-
return /* @__PURE__ */ jsx3(SelectPrimitive.Portal, {
|
|
127
|
-
children: /* @__PURE__ */ jsx3(SelectPrimitive.Positioner, {
|
|
128
|
-
side,
|
|
129
|
-
sideOffset,
|
|
130
|
-
align,
|
|
131
|
-
alignOffset,
|
|
132
|
-
alignItemWithTrigger,
|
|
133
|
-
className: "isolate z-50",
|
|
134
|
-
children: /* @__PURE__ */ jsxs(SelectPrimitive.Popup, {
|
|
135
|
-
"data-slot": "select-content",
|
|
136
|
-
"data-align-trigger": alignItemWithTrigger,
|
|
137
|
-
className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
138
|
-
...props,
|
|
139
|
-
children: [
|
|
140
|
-
/* @__PURE__ */ jsx3(SelectScrollUpButton, {}),
|
|
141
|
-
/* @__PURE__ */ jsx3(SelectPrimitive.List, {
|
|
142
|
-
children
|
|
143
|
-
}),
|
|
144
|
-
/* @__PURE__ */ jsx3(SelectScrollDownButton, {})
|
|
145
|
-
]
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
function SelectItem({
|
|
151
|
-
className,
|
|
152
|
-
children,
|
|
153
|
-
...props
|
|
154
|
-
}) {
|
|
155
|
-
return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
156
|
-
"data-slot": "select-item",
|
|
157
|
-
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
158
|
-
...props,
|
|
159
|
-
children: [
|
|
160
|
-
/* @__PURE__ */ jsx3(SelectPrimitive.ItemText, {
|
|
161
|
-
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
162
|
-
children
|
|
163
|
-
}),
|
|
164
|
-
/* @__PURE__ */ jsx3(SelectPrimitive.ItemIndicator, {
|
|
165
|
-
render: /* @__PURE__ */ jsx3("span", {
|
|
166
|
-
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
167
|
-
}),
|
|
168
|
-
children: /* @__PURE__ */ jsx3(CheckIcon, {
|
|
169
|
-
className: "pointer-events-none"
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function SelectScrollUpButton({
|
|
176
|
-
className,
|
|
177
|
-
...props
|
|
178
|
-
}) {
|
|
179
|
-
return /* @__PURE__ */ jsx3(SelectPrimitive.ScrollUpArrow, {
|
|
180
|
-
"data-slot": "select-scroll-up-button",
|
|
181
|
-
className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
182
|
-
...props,
|
|
183
|
-
children: /* @__PURE__ */ jsx3(ChevronUpIcon, {})
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
function SelectScrollDownButton({
|
|
187
|
-
className,
|
|
188
|
-
...props
|
|
189
|
-
}) {
|
|
190
|
-
return /* @__PURE__ */ jsx3(SelectPrimitive.ScrollDownArrow, {
|
|
191
|
-
"data-slot": "select-scroll-down-button",
|
|
192
|
-
className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
193
|
-
...props,
|
|
194
|
-
children: /* @__PURE__ */ jsx3(ChevronDownIcon, {})
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// ../../src/components/ui/dropdown-menu.tsx
|
|
199
|
-
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
200
|
-
import { ChevronRightIcon, CheckIcon as CheckIcon2 } from "lucide-react";
|
|
201
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
202
|
-
function DropdownMenu({ ...props }) {
|
|
203
|
-
return /* @__PURE__ */ jsx4(MenuPrimitive.Root, {
|
|
204
|
-
"data-slot": "dropdown-menu",
|
|
205
|
-
...props
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
209
|
-
return /* @__PURE__ */ jsx4(MenuPrimitive.Trigger, {
|
|
210
|
-
"data-slot": "dropdown-menu-trigger",
|
|
211
|
-
...props
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function DropdownMenuContent({
|
|
215
|
-
align = "start",
|
|
216
|
-
alignOffset = 0,
|
|
217
|
-
side = "bottom",
|
|
218
|
-
sideOffset = 4,
|
|
219
|
-
className,
|
|
220
|
-
...props
|
|
221
|
-
}) {
|
|
222
|
-
return /* @__PURE__ */ jsx4(MenuPrimitive.Portal, {
|
|
223
|
-
children: /* @__PURE__ */ jsx4(MenuPrimitive.Positioner, {
|
|
224
|
-
className: "isolate z-50 outline-none",
|
|
225
|
-
align,
|
|
226
|
-
alignOffset,
|
|
227
|
-
side,
|
|
228
|
-
sideOffset,
|
|
229
|
-
children: /* @__PURE__ */ jsx4(MenuPrimitive.Popup, {
|
|
230
|
-
"data-slot": "dropdown-menu-content",
|
|
231
|
-
className: cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
232
|
-
...props
|
|
233
|
-
})
|
|
234
|
-
})
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function DropdownMenuItem({
|
|
238
|
-
className,
|
|
239
|
-
inset,
|
|
240
|
-
variant = "default",
|
|
241
|
-
...props
|
|
242
|
-
}) {
|
|
243
|
-
return /* @__PURE__ */ jsx4(MenuPrimitive.Item, {
|
|
244
|
-
"data-slot": "dropdown-menu-item",
|
|
245
|
-
"data-inset": inset,
|
|
246
|
-
"data-variant": variant,
|
|
247
|
-
className: cn("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
248
|
-
...props
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// ../../src/components/ui/rich-text-editor.tsx
|
|
253
|
-
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
254
|
-
|
|
255
|
-
// ../../src/lib/rich-text/schema.ts
|
|
256
|
-
import { Schema } from "effect";
|
|
257
|
-
var RichTextLink = Schema.String.check(Schema.isMaxLength(2000), Schema.makeFilter((value) => {
|
|
258
|
-
if (/[\s\p{Cc}\\{}]/u.test(value))
|
|
259
|
-
return false;
|
|
260
|
-
const url = URL.parse(value);
|
|
261
|
-
return url !== null && ["https:", "mailto:"].includes(url.protocol) && !url.username && !url.password;
|
|
262
|
-
})).annotate({ identifier: "RichTextLink" });
|
|
263
|
-
var RichTextMarks = Schema.Struct({
|
|
264
|
-
bold: Schema.optional(Schema.Boolean),
|
|
265
|
-
italic: Schema.optional(Schema.Boolean),
|
|
266
|
-
underline: Schema.optional(Schema.Boolean),
|
|
267
|
-
href: Schema.optional(RichTextLink)
|
|
268
|
-
}).annotate({ identifier: "RichTextMarks" });
|
|
269
|
-
var RichTextInline = Schema.Union([
|
|
270
|
-
Schema.Struct({
|
|
271
|
-
type: Schema.Literal("text"),
|
|
272
|
-
text: Schema.String.check(Schema.isMaxLength(20000)),
|
|
273
|
-
marks: Schema.optional(RichTextMarks)
|
|
274
|
-
}),
|
|
275
|
-
Schema.Struct({
|
|
276
|
-
type: Schema.Literal("variable"),
|
|
277
|
-
key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
|
|
278
|
-
marks: Schema.optional(RichTextMarks)
|
|
279
|
-
})
|
|
280
|
-
]).annotate({ identifier: "RichTextInline" });
|
|
281
|
-
var RichTextBlockKind = Schema.Literals([
|
|
282
|
-
"paragraph",
|
|
283
|
-
"heading",
|
|
284
|
-
"bullet",
|
|
285
|
-
"numbered"
|
|
286
|
-
]).annotate({ identifier: "RichTextBlockKind" });
|
|
287
|
-
var RichTextDocument = Schema.Struct({
|
|
288
|
-
version: Schema.Literal(1),
|
|
289
|
-
blocks: Schema.Array(Schema.Struct({
|
|
290
|
-
type: RichTextBlockKind,
|
|
291
|
-
content: Schema.Array(RichTextInline).check(Schema.isMaxLength(2000))
|
|
292
|
-
})).check(Schema.isMinLength(1), Schema.isMaxLength(100))
|
|
293
|
-
}).check(Schema.makeFilter((value) => value.blocks.reduce((size, block) => size + block.content.reduce((count, inline) => count + (inline.type === "text" ? inline.text.length : 1), 0), 0) <= 20000)).annotate({ identifier: "RichTextDocument" });
|
|
294
|
-
var RichTextVariable = Schema.Struct({
|
|
295
|
-
key: Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
|
|
296
|
-
label: Schema.String,
|
|
297
|
-
type: Schema.Literals(["text", "url"]),
|
|
298
|
-
sample: Schema.String
|
|
299
|
-
}).annotate({ identifier: "RichTextVariable" });
|
|
300
|
-
|
|
301
|
-
// ../../src/lib/rich-text/model.ts
|
|
302
|
-
import { Schema as Schema2 } from "effect";
|
|
303
|
-
var sameMarks = Schema2.toEquivalence(RichTextMarks);
|
|
304
|
-
var emptyRichText = () => ({
|
|
305
|
-
version: 1,
|
|
306
|
-
blocks: [{ type: "paragraph", content: [] }]
|
|
307
|
-
});
|
|
308
|
-
var richTextPlainText = (value, variables) => value.blocks.map((block) => block.content.map((inline) => inline.type === "text" ? inline.text : variables?.[inline.key] ?? `{{${inline.key}}}`).join("")).join(`
|
|
309
|
-
`);
|
|
310
|
-
var units = (value) => value.blocks.flatMap((block, index) => [
|
|
311
|
-
...index ? [{ type: "break", next: block.type }] : [],
|
|
312
|
-
...block.content.flatMap((inline) => inline.type === "text" ? inline.text.split("").map((text) => ({ ...inline, text })) : [inline])
|
|
313
|
-
]);
|
|
314
|
-
var fromUnits = (content, first) => {
|
|
315
|
-
const blocks = [{ type: first, content: [] }];
|
|
316
|
-
for (const unit of content) {
|
|
317
|
-
if (unit.type === "break") {
|
|
318
|
-
blocks.push({ type: unit.next, content: [] });
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
const target = blocks.at(-1);
|
|
322
|
-
if (!target)
|
|
323
|
-
continue;
|
|
324
|
-
const previous = target.content.at(-1);
|
|
325
|
-
if (unit.type === "text" && previous?.type === "text" && sameMarks(previous.marks ?? {}, unit.marks ?? {})) {
|
|
326
|
-
target.content[target.content.length - 1] = {
|
|
327
|
-
...previous,
|
|
328
|
-
text: previous.text + unit.text
|
|
329
|
-
};
|
|
330
|
-
} else
|
|
331
|
-
target.content.push(unit);
|
|
332
|
-
}
|
|
333
|
-
return { version: 1, blocks };
|
|
334
|
-
};
|
|
335
|
-
var replaceRichText = (value, selection, inserted) => {
|
|
336
|
-
const content = units(value);
|
|
337
|
-
const from = Math.max(0, Math.min(selection.from, content.length));
|
|
338
|
-
const to = Math.max(from, Math.min(selection.to, content.length));
|
|
339
|
-
const additions = inserted.type === "text" ? inserted.text.replace(/\r\n?/g, `
|
|
340
|
-
`).split("").map((text) => text === `
|
|
341
|
-
` ? { type: "break", next: "paragraph" } : { type: "text", text, marks: inserted.marks }) : [inserted];
|
|
342
|
-
const next = fromUnits([...content.slice(0, from), ...additions, ...content.slice(to)], value.blocks[0]?.type ?? "paragraph");
|
|
343
|
-
const position = from + additions.length;
|
|
344
|
-
return { value: next, selection: { from: position, to: position } };
|
|
345
|
-
};
|
|
346
|
-
var formatRichText = (value, selection, mark, setting) => fromUnits(units(value).map((unit, index) => {
|
|
347
|
-
if (unit.type === "break" || index < selection.from || index >= selection.to)
|
|
348
|
-
return unit;
|
|
349
|
-
const marks = { ...unit.marks, [mark]: setting };
|
|
350
|
-
return { ...unit, marks };
|
|
351
|
-
}), value.blocks[0]?.type ?? "paragraph");
|
|
352
|
-
var setRichTextBlock = (value, selection, type) => {
|
|
353
|
-
let offset = 0;
|
|
354
|
-
return {
|
|
355
|
-
...value,
|
|
356
|
-
blocks: value.blocks.map((block) => {
|
|
357
|
-
const start = offset;
|
|
358
|
-
offset += block.content.reduce((size, inline) => size + (inline.type === "text" ? inline.text.length : 1), 0) + 1;
|
|
359
|
-
return selection.from < offset && selection.to >= start ? { ...block, type } : block;
|
|
360
|
-
})
|
|
361
|
-
};
|
|
362
|
-
};
|
|
363
|
-
var richTextMarksAt = (value, position) => {
|
|
364
|
-
const content = units(value);
|
|
365
|
-
const unit = content[Math.max(0, position - 1)];
|
|
366
|
-
return unit && unit.type !== "break" ? unit.marks ?? {} : {};
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
// ../../src/lib/rich-text/dom.ts
|
|
370
|
-
import { Option, Schema as Schema3 } from "effect";
|
|
371
|
-
var blocks = new Set(["P", "DIV", "H1", "H2", "H3", "LI"]);
|
|
372
|
-
var sameMarks2 = Schema3.toEquivalence(RichTextMarks);
|
|
373
|
-
var pointAfter = (node) => ({
|
|
374
|
-
node: node.parentNode ?? node,
|
|
375
|
-
offset: Array.from(node.parentNode?.childNodes ?? []).indexOf(node) + 1
|
|
376
|
-
});
|
|
377
|
-
var readRichTextDOM = (root) => {
|
|
378
|
-
const result = [];
|
|
379
|
-
const points = [{ node: root, offset: 0 }];
|
|
380
|
-
let current;
|
|
381
|
-
const begin = (type, point) => {
|
|
382
|
-
if (current)
|
|
383
|
-
result.push(current);
|
|
384
|
-
if (result.length)
|
|
385
|
-
points.push(point);
|
|
386
|
-
else
|
|
387
|
-
points[0] = point;
|
|
388
|
-
current = { type, content: [] };
|
|
389
|
-
};
|
|
390
|
-
const append = (inline, point) => {
|
|
391
|
-
if (!current)
|
|
392
|
-
begin("paragraph", point);
|
|
393
|
-
const previous = current?.content.at(-1);
|
|
394
|
-
if (inline.type === "text" && previous?.type === "text" && sameMarks2(inline.marks ?? {}, previous.marks ?? {})) {
|
|
395
|
-
if (current)
|
|
396
|
-
current.content[current.content.length - 1] = {
|
|
397
|
-
...previous,
|
|
398
|
-
text: previous.text + inline.text
|
|
399
|
-
};
|
|
400
|
-
} else
|
|
401
|
-
current?.content.push(inline);
|
|
402
|
-
points.push(point);
|
|
403
|
-
};
|
|
404
|
-
const visit = (node, inherited = {}, kind = "paragraph") => {
|
|
405
|
-
if (node instanceof Text) {
|
|
406
|
-
if (!current)
|
|
407
|
-
begin(kind, { node, offset: 0 });
|
|
408
|
-
for (let index = 0;index < node.data.length; index++)
|
|
409
|
-
append({ type: "text", text: node.data[index] ?? "", marks: inherited }, { node, offset: index + 1 });
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (!(node instanceof HTMLElement) || ["SCRIPT", "STYLE", "IFRAME"].includes(node.tagName))
|
|
413
|
-
return;
|
|
414
|
-
const key = node.dataset.richVariable;
|
|
415
|
-
if (key) {
|
|
416
|
-
const variable = { type: "variable", key, marks: inherited };
|
|
417
|
-
append(variable, pointAfter(node));
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
const href = node.getAttribute("href");
|
|
421
|
-
const marks = {
|
|
422
|
-
bold: inherited.bold,
|
|
423
|
-
italic: inherited.italic,
|
|
424
|
-
underline: inherited.underline,
|
|
425
|
-
href: inherited.href
|
|
426
|
-
};
|
|
427
|
-
if (["B", "STRONG"].includes(node.tagName) || node.style.fontWeight === "700")
|
|
428
|
-
marks.bold = true;
|
|
429
|
-
if (["I", "EM"].includes(node.tagName) || node.style.fontStyle === "italic")
|
|
430
|
-
marks.italic = true;
|
|
431
|
-
if (node.tagName === "U" || node.style.textDecoration.includes("underline"))
|
|
432
|
-
marks.underline = true;
|
|
433
|
-
if (href && Schema3.is(RichTextLink)(href))
|
|
434
|
-
marks.href = href;
|
|
435
|
-
const type = node.dataset.richKind === "bullet" ? "bullet" : node.dataset.richKind === "numbered" ? "numbered" : /^H[123]$/.test(node.tagName) ? "heading" : node.tagName === "LI" ? node.parentElement?.tagName === "OL" ? "numbered" : "bullet" : kind;
|
|
436
|
-
const isBlock = blocks.has(node.tagName);
|
|
437
|
-
const container = isBlock && [...node.children].some((child) => blocks.has(child.tagName));
|
|
438
|
-
if (isBlock && !container)
|
|
439
|
-
begin(type, { node, offset: 0 });
|
|
440
|
-
if (node.tagName === "BR") {
|
|
441
|
-
if (node.nextSibling)
|
|
442
|
-
begin(kind, pointAfter(node));
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
for (const child of node.childNodes)
|
|
446
|
-
visit(child, marks, type);
|
|
447
|
-
};
|
|
448
|
-
for (const child of root.childNodes)
|
|
449
|
-
visit(child);
|
|
450
|
-
if (current)
|
|
451
|
-
result.push(current);
|
|
452
|
-
const value = Option.getOrUndefined(Schema3.decodeOption(RichTextDocument)({
|
|
453
|
-
version: 1,
|
|
454
|
-
blocks: result.length ? result : emptyRichText().blocks
|
|
455
|
-
}));
|
|
456
|
-
return { value, points };
|
|
457
|
-
};
|
|
458
|
-
var readEditorSelection = (root, points) => {
|
|
459
|
-
const selection = root.ownerDocument.getSelection();
|
|
460
|
-
if (!selection?.anchorNode || !selection.focusNode || !root.contains(selection.anchorNode) || !root.contains(selection.focusNode))
|
|
461
|
-
return;
|
|
462
|
-
const position = (node, offset) => {
|
|
463
|
-
const range = root.ownerDocument.createRange();
|
|
464
|
-
range.setStart(node, offset);
|
|
465
|
-
range.collapse(true);
|
|
466
|
-
let result = 0;
|
|
467
|
-
points.forEach((point, index) => {
|
|
468
|
-
if (root.contains(point.node) && range.comparePoint(point.node, point.offset) <= 0)
|
|
469
|
-
result = index;
|
|
470
|
-
});
|
|
471
|
-
return result;
|
|
472
|
-
};
|
|
473
|
-
const anchor = position(selection.anchorNode, selection.anchorOffset);
|
|
474
|
-
const focus = position(selection.focusNode, selection.focusOffset);
|
|
475
|
-
return { from: Math.min(anchor, focus), to: Math.max(anchor, focus) };
|
|
476
|
-
};
|
|
477
|
-
var restoreRichTextSelection = (root, selection) => {
|
|
478
|
-
const { points } = readRichTextDOM(root);
|
|
479
|
-
const start = points[Math.min(selection.from, points.length - 1)];
|
|
480
|
-
const end = points[Math.min(selection.to, points.length - 1)];
|
|
481
|
-
if (!start || !end)
|
|
482
|
-
return;
|
|
483
|
-
const range = root.ownerDocument.createRange();
|
|
484
|
-
range.setStart(start.node, start.offset);
|
|
485
|
-
range.setEnd(end.node, end.offset);
|
|
486
|
-
root.ownerDocument.getSelection()?.removeAllRanges();
|
|
487
|
-
root.ownerDocument.getSelection()?.addRange(range);
|
|
488
|
-
};
|
|
489
|
-
var writeRichTextDOM = (root, value, variables) => {
|
|
490
|
-
const children = value.blocks.map((block) => {
|
|
491
|
-
const paragraph = root.ownerDocument.createElement(block.type === "heading" ? "h2" : "div");
|
|
492
|
-
if (block.type === "heading")
|
|
493
|
-
paragraph.style.cssText = "font-size:1.4em;font-weight:700";
|
|
494
|
-
if (block.type === "bullet" || block.type === "numbered") {
|
|
495
|
-
paragraph.dataset.richKind = block.type;
|
|
496
|
-
paragraph.style.cssText = `display:list-item;margin-left:1.5em;list-style-type:${block.type === "bullet" ? "disc" : "decimal"}`;
|
|
497
|
-
}
|
|
498
|
-
for (const inline of block.content) {
|
|
499
|
-
const span = root.ownerDocument.createElement(inline.marks?.href ? "a" : "span");
|
|
500
|
-
if (inline.type === "variable") {
|
|
501
|
-
span.dataset.richVariable = inline.key;
|
|
502
|
-
span.contentEditable = "false";
|
|
503
|
-
span.textContent = `{{${variables.find((item) => item.key === inline.key)?.label ?? inline.key}}}`;
|
|
504
|
-
span.className = "mx-0.5 inline-block rounded bg-indigo-50 px-1 font-mono text-[0.85em] text-indigo-800";
|
|
505
|
-
} else
|
|
506
|
-
span.textContent = inline.text;
|
|
507
|
-
if (inline.marks?.bold)
|
|
508
|
-
span.style.fontWeight = "700";
|
|
509
|
-
if (inline.marks?.italic)
|
|
510
|
-
span.style.fontStyle = "italic";
|
|
511
|
-
if (inline.marks?.underline)
|
|
512
|
-
span.style.textDecoration = "underline";
|
|
513
|
-
if (inline.marks?.href) {
|
|
514
|
-
span.setAttribute("href", inline.marks.href);
|
|
515
|
-
span.style.textDecoration = "underline";
|
|
516
|
-
}
|
|
517
|
-
paragraph.append(span);
|
|
518
|
-
}
|
|
519
|
-
if (!block.content.length)
|
|
520
|
-
paragraph.append(root.ownerDocument.createElement("br"));
|
|
521
|
-
return paragraph;
|
|
522
|
-
});
|
|
523
|
-
root.replaceChildren(...children);
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
// ../../src/components/ui/rich-text-editor.tsx
|
|
527
|
-
import { jsx as jsx5, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
528
|
-
var labels = {
|
|
529
|
-
en: {
|
|
530
|
-
bold: "Bold",
|
|
531
|
-
italic: "Italic",
|
|
532
|
-
underline: "Underline",
|
|
533
|
-
undo: "Undo",
|
|
534
|
-
redo: "Redo",
|
|
535
|
-
link: "Link",
|
|
536
|
-
unlink: "Remove link",
|
|
537
|
-
linkUrl: "Link URL",
|
|
538
|
-
apply: "Apply link",
|
|
539
|
-
variable: "Insert variable",
|
|
540
|
-
paragraph: "Paragraph",
|
|
541
|
-
heading: "Heading",
|
|
542
|
-
bullet: "Bulleted list",
|
|
543
|
-
numbered: "Numbered list",
|
|
544
|
-
toolbar: "Text formatting",
|
|
545
|
-
invalid: "The content is too long or contains an unsupported value.",
|
|
546
|
-
invalidLink: "Enter an HTTPS or mailto link.",
|
|
547
|
-
cancel: "Cancel"
|
|
548
|
-
},
|
|
549
|
-
fr: {
|
|
550
|
-
bold: "Gras",
|
|
551
|
-
italic: "Italique",
|
|
552
|
-
underline: "Souligné",
|
|
553
|
-
undo: "Annuler",
|
|
554
|
-
redo: "Rétablir",
|
|
555
|
-
link: "Lien",
|
|
556
|
-
unlink: "Retirer le lien",
|
|
557
|
-
linkUrl: "URL du lien",
|
|
558
|
-
apply: "Appliquer le lien",
|
|
559
|
-
variable: "Insérer une variable",
|
|
560
|
-
paragraph: "Paragraphe",
|
|
561
|
-
heading: "Titre",
|
|
562
|
-
bullet: "Liste à puces",
|
|
563
|
-
numbered: "Liste numérotée",
|
|
564
|
-
toolbar: "Mise en forme",
|
|
565
|
-
invalid: "Le contenu est trop long ou contient une valeur non prise en charge.",
|
|
566
|
-
invalidLink: "Saisissez un lien HTTPS ou mailto.",
|
|
567
|
-
cancel: "Annuler"
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
var equivalent = Schema4.toEquivalence(RichTextDocument);
|
|
571
|
-
var ToolButton = ({
|
|
572
|
-
label,
|
|
573
|
-
children,
|
|
574
|
-
onClick,
|
|
575
|
-
pressed,
|
|
576
|
-
disabled
|
|
577
|
-
}) => /* @__PURE__ */ jsx5(Button, {
|
|
578
|
-
type: "button",
|
|
579
|
-
size: "icon-sm",
|
|
580
|
-
variant: pressed ? "secondary" : "ghost",
|
|
581
|
-
"aria-label": label,
|
|
582
|
-
title: label,
|
|
583
|
-
"aria-pressed": pressed,
|
|
584
|
-
disabled,
|
|
585
|
-
onPointerDown: (event) => event.preventDefault(),
|
|
586
|
-
onClick,
|
|
587
|
-
children
|
|
588
|
-
});
|
|
589
|
-
var inlineContent = (inline, variables, values) => {
|
|
590
|
-
let content = inline.type === "text" ? inline.text : values?.[inline.key] ?? /* @__PURE__ */ jsx5("span", {
|
|
591
|
-
contentEditable: false,
|
|
592
|
-
"data-rich-variable": inline.key,
|
|
593
|
-
className: "inline-block rounded bg-indigo-50 px-1.5 font-mono text-[0.85em] text-indigo-800 select-all",
|
|
594
|
-
children: `{{${variables.find((variable) => variable.key === inline.key)?.label ?? inline.key}}}`
|
|
595
|
-
});
|
|
596
|
-
if (inline.marks?.bold)
|
|
597
|
-
content = /* @__PURE__ */ jsx5("strong", {
|
|
598
|
-
children: content
|
|
599
|
-
});
|
|
600
|
-
if (inline.marks?.italic)
|
|
601
|
-
content = /* @__PURE__ */ jsx5("em", {
|
|
602
|
-
children: content
|
|
603
|
-
});
|
|
604
|
-
if (inline.marks?.underline)
|
|
605
|
-
content = /* @__PURE__ */ jsx5("u", {
|
|
606
|
-
children: content
|
|
607
|
-
});
|
|
608
|
-
if (inline.marks?.href)
|
|
609
|
-
content = /* @__PURE__ */ jsx5("a", {
|
|
610
|
-
href: inline.marks.href,
|
|
611
|
-
className: "underline",
|
|
612
|
-
children: content
|
|
613
|
-
});
|
|
614
|
-
return content;
|
|
615
|
-
};
|
|
616
|
-
var RichTextContent = ({
|
|
617
|
-
value,
|
|
618
|
-
variables = [],
|
|
619
|
-
values
|
|
620
|
-
}) => /* @__PURE__ */ jsx5(Fragment, {
|
|
621
|
-
children: value.blocks.map((block, index) => {
|
|
622
|
-
const content = block.content.map((inline, key) => /* @__PURE__ */ jsx5("span", {
|
|
623
|
-
children: inlineContent(inline, variables, values)
|
|
624
|
-
}, key));
|
|
625
|
-
if (block.type === "heading")
|
|
626
|
-
return /* @__PURE__ */ jsx5("h2", {
|
|
627
|
-
className: "text-xl font-semibold",
|
|
628
|
-
children: content.length ? content : /* @__PURE__ */ jsx5("br", {})
|
|
629
|
-
}, index);
|
|
630
|
-
return /* @__PURE__ */ jsx5("div", {
|
|
631
|
-
"data-rich-kind": block.type,
|
|
632
|
-
style: block.type === "bullet" || block.type === "numbered" ? {
|
|
633
|
-
display: "list-item",
|
|
634
|
-
marginLeft: "1.5em",
|
|
635
|
-
listStyleType: block.type === "bullet" ? "disc" : "decimal"
|
|
636
|
-
} : undefined,
|
|
637
|
-
children: content.length ? content : /* @__PURE__ */ jsx5("br", {})
|
|
638
|
-
}, index);
|
|
639
|
-
})
|
|
640
|
-
});
|
|
641
|
-
var RichTextEditor = ({
|
|
642
|
-
value,
|
|
643
|
-
onChange,
|
|
644
|
-
label,
|
|
645
|
-
variables = [],
|
|
646
|
-
disabled,
|
|
647
|
-
locale: override,
|
|
648
|
-
messages,
|
|
649
|
-
className,
|
|
650
|
-
contentStyle,
|
|
651
|
-
singleLine = false,
|
|
652
|
-
maxLength
|
|
653
|
-
}) => {
|
|
654
|
-
const locale = useKrakstackLocale(override);
|
|
655
|
-
const copy = {
|
|
656
|
-
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
657
|
-
...messages?.[locale.split("-")[0] ?? locale],
|
|
658
|
-
...messages?.[locale]
|
|
659
|
-
};
|
|
660
|
-
const root = useRef(null);
|
|
661
|
-
const model = useRef(value);
|
|
662
|
-
const composing = useRef(false);
|
|
663
|
-
const selected = useRef({ from: 0, to: 0 });
|
|
664
|
-
const history = useRef([
|
|
665
|
-
{ value, selection: { from: 0, to: 0 } }
|
|
666
|
-
]);
|
|
667
|
-
const cursor = useRef(0);
|
|
668
|
-
const [marks, setMarks] = useState({});
|
|
669
|
-
const pendingMarks = useRef(null);
|
|
670
|
-
const [error, setError] = useState(false);
|
|
671
|
-
const [linkOpen, setLinkOpen] = useState(false);
|
|
672
|
-
const [link, setLink] = useState("");
|
|
673
|
-
const [linkError, setLinkError] = useState(false);
|
|
674
|
-
const [revision, setRevision] = useState(0);
|
|
675
|
-
const [historyState, setHistoryState] = useState({
|
|
676
|
-
undo: false,
|
|
677
|
-
redo: false
|
|
678
|
-
});
|
|
679
|
-
const id = useId();
|
|
680
|
-
const [initial] = useState(() => /* @__PURE__ */ jsx5(RichTextContent, {
|
|
681
|
-
value,
|
|
682
|
-
variables
|
|
683
|
-
}));
|
|
684
|
-
const selection = () => {
|
|
685
|
-
const element = root.current;
|
|
686
|
-
if (!element)
|
|
687
|
-
return selected.current;
|
|
688
|
-
const next = readEditorSelection(element, readRichTextDOM(element).points);
|
|
689
|
-
if (next)
|
|
690
|
-
selected.current = next;
|
|
691
|
-
return selected.current;
|
|
692
|
-
};
|
|
693
|
-
const focusEditor = () => {
|
|
694
|
-
const element = root.current;
|
|
695
|
-
if (element) {
|
|
696
|
-
element.focus();
|
|
697
|
-
restoreRichTextSelection(element, selected.current);
|
|
698
|
-
}
|
|
699
|
-
return false;
|
|
700
|
-
};
|
|
701
|
-
const commit = (next, range, write = true, record = true) => {
|
|
702
|
-
const element = root.current;
|
|
703
|
-
if (!element || disabled)
|
|
704
|
-
return;
|
|
705
|
-
const original = next;
|
|
706
|
-
if (singleLine) {
|
|
707
|
-
next = {
|
|
708
|
-
version: 1,
|
|
709
|
-
blocks: [
|
|
710
|
-
{
|
|
711
|
-
type: "paragraph",
|
|
712
|
-
content: next.blocks.flatMap((block, index) => [
|
|
713
|
-
...index ? [{ type: "text", text: " " }] : [],
|
|
714
|
-
...block.content.map((inline) => inline.type === "variable" ? { type: "variable", key: inline.key } : {
|
|
715
|
-
type: "text",
|
|
716
|
-
text: inline.text.replace(/[\r\n]+/g, " ")
|
|
717
|
-
})
|
|
718
|
-
])
|
|
719
|
-
}
|
|
720
|
-
]
|
|
721
|
-
};
|
|
722
|
-
if (!equivalent(original, next))
|
|
723
|
-
write = true;
|
|
724
|
-
}
|
|
725
|
-
if (!Schema4.is(RichTextDocument)(next) || maxLength !== undefined && richTextPlainText(next).length > maxLength) {
|
|
726
|
-
setError(true);
|
|
727
|
-
writeRichTextDOM(element, model.current, variables);
|
|
728
|
-
element.focus();
|
|
729
|
-
restoreRichTextSelection(element, selected.current);
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
setError(false);
|
|
733
|
-
if (record && !equivalent(model.current, next)) {
|
|
734
|
-
history.current[cursor.current] = {
|
|
735
|
-
value: model.current,
|
|
736
|
-
selection: selected.current
|
|
737
|
-
};
|
|
738
|
-
history.current = [
|
|
739
|
-
...history.current.slice(0, cursor.current + 1),
|
|
740
|
-
{ value: next, selection: range }
|
|
741
|
-
].slice(-100);
|
|
742
|
-
cursor.current = history.current.length - 1;
|
|
743
|
-
}
|
|
744
|
-
model.current = next;
|
|
745
|
-
selected.current = range;
|
|
746
|
-
if (write) {
|
|
747
|
-
writeRichTextDOM(element, next, variables);
|
|
748
|
-
element.focus();
|
|
749
|
-
restoreRichTextSelection(element, range);
|
|
750
|
-
}
|
|
751
|
-
setRevision((current) => current + 1);
|
|
752
|
-
setHistoryState({
|
|
753
|
-
undo: cursor.current > 0,
|
|
754
|
-
redo: cursor.current < history.current.length - 1
|
|
755
|
-
});
|
|
756
|
-
onChange(next);
|
|
757
|
-
};
|
|
758
|
-
const travel = (direction) => {
|
|
759
|
-
const index = Math.max(0, Math.min(history.current.length - 1, cursor.current + direction));
|
|
760
|
-
const snapshot = history.current[index];
|
|
761
|
-
if (!snapshot || index === cursor.current)
|
|
762
|
-
return;
|
|
763
|
-
cursor.current = index;
|
|
764
|
-
pendingMarks.current = null;
|
|
765
|
-
commit(snapshot.value, snapshot.selection, true, false);
|
|
766
|
-
};
|
|
767
|
-
const insert = (inline) => {
|
|
768
|
-
const result = replaceRichText(model.current, selection(), inline);
|
|
769
|
-
commit(result.value, result.selection);
|
|
770
|
-
};
|
|
771
|
-
const format = (mark) => {
|
|
772
|
-
const range = selection();
|
|
773
|
-
const next = {
|
|
774
|
-
...pendingMarks.current ?? richTextMarksAt(model.current, range.to),
|
|
775
|
-
[mark]: !marks[mark]
|
|
776
|
-
};
|
|
777
|
-
setMarks(next);
|
|
778
|
-
if (range.from === range.to) {
|
|
779
|
-
pendingMarks.current = next;
|
|
780
|
-
root.current?.focus();
|
|
781
|
-
} else
|
|
782
|
-
commit(formatRichText(model.current, range, mark, next[mark]), range);
|
|
783
|
-
};
|
|
784
|
-
const syncInput = () => {
|
|
785
|
-
const element = root.current;
|
|
786
|
-
if (!element || composing.current)
|
|
787
|
-
return;
|
|
788
|
-
const parsed = readRichTextDOM(element);
|
|
789
|
-
const range = readEditorSelection(element, parsed.points) ?? selected.current;
|
|
790
|
-
if (parsed.value)
|
|
791
|
-
commit(parsed.value, range, false);
|
|
792
|
-
else {
|
|
793
|
-
setError(true);
|
|
794
|
-
writeRichTextDOM(element, model.current, variables);
|
|
795
|
-
restoreRichTextSelection(element, selected.current);
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
const beforeInput = useEffectEvent((event) => {
|
|
799
|
-
if (disabled || composing.current || event.isComposing)
|
|
800
|
-
return;
|
|
801
|
-
if (event.inputType === "historyUndo" || event.inputType === "historyRedo") {
|
|
802
|
-
event.preventDefault();
|
|
803
|
-
travel(event.inputType === "historyUndo" ? -1 : 1);
|
|
804
|
-
} else if (["insertText", "insertParagraph", "insertLineBreak"].includes(event.inputType)) {
|
|
805
|
-
event.preventDefault();
|
|
806
|
-
if (singleLine && event.inputType !== "insertText")
|
|
807
|
-
return;
|
|
808
|
-
const range = selection();
|
|
809
|
-
insert({
|
|
810
|
-
type: "text",
|
|
811
|
-
text: event.inputType === "insertText" ? event.data ?? "" : `
|
|
812
|
-
`,
|
|
813
|
-
marks: pendingMarks.current ?? richTextMarksAt(model.current, range.to)
|
|
814
|
-
});
|
|
815
|
-
} else if (event.inputType === "formatBold" || event.inputType === "formatItalic" || event.inputType === "formatUnderline") {
|
|
816
|
-
event.preventDefault();
|
|
817
|
-
if (!singleLine)
|
|
818
|
-
format(event.inputType === "formatBold" ? "bold" : event.inputType === "formatItalic" ? "italic" : "underline");
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
useEffect(() => {
|
|
822
|
-
const element = root.current;
|
|
823
|
-
if (!element)
|
|
824
|
-
return;
|
|
825
|
-
const listener = (event) => beforeInput(event);
|
|
826
|
-
element.addEventListener("beforeinput", listener);
|
|
827
|
-
return () => element.removeEventListener("beforeinput", listener);
|
|
828
|
-
}, []);
|
|
829
|
-
const remember = useEffectEvent(() => {
|
|
830
|
-
const element = root.current;
|
|
831
|
-
if (!element || document.activeElement !== element || composing.current)
|
|
832
|
-
return;
|
|
833
|
-
const previous = selected.current;
|
|
834
|
-
const range = selection();
|
|
835
|
-
if (previous.from !== range.from || previous.to !== range.to)
|
|
836
|
-
pendingMarks.current = null;
|
|
837
|
-
setMarks(pendingMarks.current ?? richTextMarksAt(model.current, range.to));
|
|
838
|
-
});
|
|
839
|
-
useEffect(() => {
|
|
840
|
-
document.addEventListener("selectionchange", remember);
|
|
841
|
-
return () => document.removeEventListener("selectionchange", remember);
|
|
842
|
-
}, []);
|
|
843
|
-
useEffect(() => {
|
|
844
|
-
const element = root.current;
|
|
845
|
-
if (!element || composing.current)
|
|
846
|
-
return;
|
|
847
|
-
if (!equivalent(model.current, value)) {
|
|
848
|
-
model.current = value;
|
|
849
|
-
history.current = [{ value, selection: { from: 0, to: 0 } }];
|
|
850
|
-
cursor.current = 0;
|
|
851
|
-
selected.current = { from: 0, to: 0 };
|
|
852
|
-
writeRichTextDOM(element, value, variables);
|
|
853
|
-
setRevision((current) => current + 1);
|
|
854
|
-
setHistoryState({ undo: false, redo: false });
|
|
855
|
-
}
|
|
856
|
-
}, [value, variables]);
|
|
857
|
-
return /* @__PURE__ */ jsxs3("div", {
|
|
858
|
-
"data-slot": "rich-text-editor",
|
|
859
|
-
className: `bg-background text-foreground overflow-hidden rounded-xl border ${className ?? ""}`,
|
|
860
|
-
"data-revision": revision,
|
|
861
|
-
children: [
|
|
862
|
-
/* @__PURE__ */ jsxs3("div", {
|
|
863
|
-
role: "group",
|
|
864
|
-
"aria-label": copy.toolbar,
|
|
865
|
-
className: "bg-muted/30 flex flex-wrap items-center gap-1 border-b p-2",
|
|
866
|
-
children: [
|
|
867
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
868
|
-
label: copy.undo,
|
|
869
|
-
disabled: disabled || !historyState.undo,
|
|
870
|
-
onClick: () => travel(-1),
|
|
871
|
-
children: /* @__PURE__ */ jsx5(Undo2, {})
|
|
872
|
-
}),
|
|
873
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
874
|
-
label: copy.redo,
|
|
875
|
-
disabled: disabled || !historyState.redo,
|
|
876
|
-
onClick: () => travel(1),
|
|
877
|
-
children: /* @__PURE__ */ jsx5(Redo2, {})
|
|
878
|
-
}),
|
|
879
|
-
!singleLine ? /* @__PURE__ */ jsxs3(Fragment, {
|
|
880
|
-
children: [
|
|
881
|
-
/* @__PURE__ */ jsx5("span", {
|
|
882
|
-
className: "mx-1 h-5 border-l",
|
|
883
|
-
"aria-hidden": true
|
|
884
|
-
}),
|
|
885
|
-
/* @__PURE__ */ jsxs3(Select, {
|
|
886
|
-
disabled,
|
|
887
|
-
defaultValue: "paragraph",
|
|
888
|
-
items: [
|
|
889
|
-
{ value: "paragraph", label: copy.paragraph },
|
|
890
|
-
{ value: "heading", label: copy.heading },
|
|
891
|
-
{ value: "bullet", label: copy.bullet },
|
|
892
|
-
{ value: "numbered", label: copy.numbered }
|
|
893
|
-
],
|
|
894
|
-
onOpenChange: (open) => {
|
|
895
|
-
if (open)
|
|
896
|
-
selection();
|
|
897
|
-
},
|
|
898
|
-
onValueChange: (value) => {
|
|
899
|
-
const type = Schema4.decodeUnknownSync(RichTextBlockKind)(value);
|
|
900
|
-
const range = selection();
|
|
901
|
-
commit(setRichTextBlock(model.current, range, type), range);
|
|
902
|
-
},
|
|
903
|
-
children: [
|
|
904
|
-
/* @__PURE__ */ jsx5(SelectTrigger, {
|
|
905
|
-
size: "sm",
|
|
906
|
-
"aria-label": copy.paragraph,
|
|
907
|
-
className: "max-w-40 text-xs",
|
|
908
|
-
onPointerDown: selection,
|
|
909
|
-
onFocus: selection,
|
|
910
|
-
children: /* @__PURE__ */ jsx5(SelectValue, {})
|
|
911
|
-
}),
|
|
912
|
-
/* @__PURE__ */ jsxs3(SelectContent, {
|
|
913
|
-
align: "start",
|
|
914
|
-
alignItemWithTrigger: false,
|
|
915
|
-
finalFocus: focusEditor,
|
|
916
|
-
children: [
|
|
917
|
-
/* @__PURE__ */ jsx5(SelectItem, {
|
|
918
|
-
value: "paragraph",
|
|
919
|
-
children: copy.paragraph
|
|
920
|
-
}),
|
|
921
|
-
/* @__PURE__ */ jsx5(SelectItem, {
|
|
922
|
-
value: "heading",
|
|
923
|
-
children: copy.heading
|
|
924
|
-
}),
|
|
925
|
-
/* @__PURE__ */ jsx5(SelectItem, {
|
|
926
|
-
value: "bullet",
|
|
927
|
-
children: copy.bullet
|
|
928
|
-
}),
|
|
929
|
-
/* @__PURE__ */ jsx5(SelectItem, {
|
|
930
|
-
value: "numbered",
|
|
931
|
-
children: copy.numbered
|
|
932
|
-
})
|
|
933
|
-
]
|
|
934
|
-
})
|
|
935
|
-
]
|
|
936
|
-
}),
|
|
937
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
938
|
-
label: copy.bold,
|
|
939
|
-
disabled,
|
|
940
|
-
pressed: !!marks.bold,
|
|
941
|
-
onClick: () => format("bold"),
|
|
942
|
-
children: /* @__PURE__ */ jsx5(Bold, {})
|
|
943
|
-
}),
|
|
944
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
945
|
-
label: copy.italic,
|
|
946
|
-
disabled,
|
|
947
|
-
pressed: !!marks.italic,
|
|
948
|
-
onClick: () => format("italic"),
|
|
949
|
-
children: /* @__PURE__ */ jsx5(Italic, {})
|
|
950
|
-
}),
|
|
951
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
952
|
-
label: copy.underline,
|
|
953
|
-
disabled,
|
|
954
|
-
pressed: !!marks.underline,
|
|
955
|
-
onClick: () => format("underline"),
|
|
956
|
-
children: /* @__PURE__ */ jsx5(Underline, {})
|
|
957
|
-
}),
|
|
958
|
-
/* @__PURE__ */ jsx5(ToolButton, {
|
|
959
|
-
label: copy.link,
|
|
960
|
-
disabled,
|
|
961
|
-
pressed: linkOpen || !!marks.href,
|
|
962
|
-
onClick: () => {
|
|
963
|
-
selection();
|
|
964
|
-
setLink(marks.href ?? "");
|
|
965
|
-
setLinkError(false);
|
|
966
|
-
setLinkOpen(!linkOpen);
|
|
967
|
-
},
|
|
968
|
-
children: /* @__PURE__ */ jsx5(Link2, {})
|
|
969
|
-
})
|
|
970
|
-
]
|
|
971
|
-
}) : null,
|
|
972
|
-
variables.length ? /* @__PURE__ */ jsxs3(DropdownMenu, {
|
|
973
|
-
onOpenChange: (open) => {
|
|
974
|
-
if (open)
|
|
975
|
-
selection();
|
|
976
|
-
},
|
|
977
|
-
children: [
|
|
978
|
-
/* @__PURE__ */ jsxs3(DropdownMenuTrigger, {
|
|
979
|
-
disabled,
|
|
980
|
-
onPointerDown: selection,
|
|
981
|
-
onFocus: selection,
|
|
982
|
-
render: /* @__PURE__ */ jsx5(Button, {
|
|
983
|
-
type: "button",
|
|
984
|
-
variant: "outline",
|
|
985
|
-
size: "sm",
|
|
986
|
-
className: "ml-auto text-xs"
|
|
987
|
-
}),
|
|
988
|
-
children: [
|
|
989
|
-
/* @__PURE__ */ jsx5(Braces, {
|
|
990
|
-
className: "size-3.5",
|
|
991
|
-
"aria-hidden": true
|
|
992
|
-
}),
|
|
993
|
-
copy.variable,
|
|
994
|
-
/* @__PURE__ */ jsx5(ChevronDown, {
|
|
995
|
-
className: "size-3.5",
|
|
996
|
-
"aria-hidden": true
|
|
997
|
-
})
|
|
998
|
-
]
|
|
999
|
-
}),
|
|
1000
|
-
/* @__PURE__ */ jsx5(DropdownMenuContent, {
|
|
1001
|
-
align: "end",
|
|
1002
|
-
finalFocus: focusEditor,
|
|
1003
|
-
children: variables.map((variable) => /* @__PURE__ */ jsx5(DropdownMenuItem, {
|
|
1004
|
-
onClick: () => insert({ type: "variable", key: variable.key }),
|
|
1005
|
-
children: variable.label
|
|
1006
|
-
}, variable.key))
|
|
1007
|
-
})
|
|
1008
|
-
]
|
|
1009
|
-
}) : null
|
|
1010
|
-
]
|
|
1011
|
-
}),
|
|
1012
|
-
linkOpen ? /* @__PURE__ */ jsxs3("div", {
|
|
1013
|
-
className: "flex flex-wrap items-end gap-2 border-b p-3",
|
|
1014
|
-
children: [
|
|
1015
|
-
/* @__PURE__ */ jsxs3("label", {
|
|
1016
|
-
className: "grid min-w-0 flex-1 gap-1 text-xs",
|
|
1017
|
-
children: [
|
|
1018
|
-
copy.linkUrl,
|
|
1019
|
-
/* @__PURE__ */ jsx5(Input, {
|
|
1020
|
-
value: link,
|
|
1021
|
-
"aria-invalid": linkError,
|
|
1022
|
-
placeholder: "https://",
|
|
1023
|
-
onChange: (event) => setLink(event.target.value)
|
|
1024
|
-
})
|
|
1025
|
-
]
|
|
1026
|
-
}),
|
|
1027
|
-
/* @__PURE__ */ jsx5(Button, {
|
|
1028
|
-
type: "button",
|
|
1029
|
-
size: "sm",
|
|
1030
|
-
disabled,
|
|
1031
|
-
onClick: () => {
|
|
1032
|
-
if (!Schema4.is(RichTextLink)(link)) {
|
|
1033
|
-
setLinkError(true);
|
|
1034
|
-
return;
|
|
1035
|
-
}
|
|
1036
|
-
commit(formatRichText(model.current, selected.current, "href", link), selected.current);
|
|
1037
|
-
setLinkOpen(false);
|
|
1038
|
-
},
|
|
1039
|
-
children: copy.apply
|
|
1040
|
-
}),
|
|
1041
|
-
marks.href ? /* @__PURE__ */ jsxs3(Button, {
|
|
1042
|
-
type: "button",
|
|
1043
|
-
size: "sm",
|
|
1044
|
-
variant: "outline",
|
|
1045
|
-
disabled,
|
|
1046
|
-
onClick: () => {
|
|
1047
|
-
commit(formatRichText(model.current, selected.current, "href", undefined), selected.current);
|
|
1048
|
-
setLinkOpen(false);
|
|
1049
|
-
setLinkError(false);
|
|
1050
|
-
},
|
|
1051
|
-
children: [
|
|
1052
|
-
/* @__PURE__ */ jsx5(Unlink, {
|
|
1053
|
-
"aria-hidden": true
|
|
1054
|
-
}),
|
|
1055
|
-
copy.unlink
|
|
1056
|
-
]
|
|
1057
|
-
}) : null,
|
|
1058
|
-
/* @__PURE__ */ jsx5(Button, {
|
|
1059
|
-
type: "button",
|
|
1060
|
-
size: "sm",
|
|
1061
|
-
variant: "ghost",
|
|
1062
|
-
onClick: () => setLinkOpen(false),
|
|
1063
|
-
children: copy.cancel
|
|
1064
|
-
}),
|
|
1065
|
-
linkError ? /* @__PURE__ */ jsx5("p", {
|
|
1066
|
-
role: "alert",
|
|
1067
|
-
className: "text-destructive w-full text-xs",
|
|
1068
|
-
children: copy.invalidLink
|
|
1069
|
-
}) : null
|
|
1070
|
-
]
|
|
1071
|
-
}) : null,
|
|
1072
|
-
/* @__PURE__ */ jsx5("div", {
|
|
1073
|
-
ref: root,
|
|
1074
|
-
style: contentStyle,
|
|
1075
|
-
role: "textbox",
|
|
1076
|
-
"aria-label": label,
|
|
1077
|
-
"aria-multiline": !singleLine,
|
|
1078
|
-
"aria-disabled": disabled,
|
|
1079
|
-
"aria-describedby": error ? `${id}-error` : undefined,
|
|
1080
|
-
contentEditable: !disabled,
|
|
1081
|
-
suppressContentEditableWarning: true,
|
|
1082
|
-
className: `focus-visible:ring-ring ${singleLine ? "min-h-10" : "min-h-32"} px-4 py-3 text-sm leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-inset [&>div]:min-h-[1.5em]`,
|
|
1083
|
-
onInput: syncInput,
|
|
1084
|
-
onKeyUp: selection,
|
|
1085
|
-
onPointerUp: selection,
|
|
1086
|
-
onBlur: selection,
|
|
1087
|
-
onCompositionStart: () => {
|
|
1088
|
-
composing.current = true;
|
|
1089
|
-
},
|
|
1090
|
-
onCompositionEnd: () => {
|
|
1091
|
-
composing.current = false;
|
|
1092
|
-
syncInput();
|
|
1093
|
-
},
|
|
1094
|
-
onPaste: (event) => {
|
|
1095
|
-
event.preventDefault();
|
|
1096
|
-
const text = event.clipboardData.getData("text/plain");
|
|
1097
|
-
insert({
|
|
1098
|
-
type: "text",
|
|
1099
|
-
text: singleLine ? text.replace(/[\r\n]+/g, " ") : text
|
|
1100
|
-
});
|
|
1101
|
-
},
|
|
1102
|
-
onDrop: (event) => event.preventDefault(),
|
|
1103
|
-
onClick: (event) => {
|
|
1104
|
-
if (event.target instanceof HTMLElement && event.target.closest("a"))
|
|
1105
|
-
event.preventDefault();
|
|
1106
|
-
},
|
|
1107
|
-
onKeyDown: (event) => {
|
|
1108
|
-
if (event.nativeEvent.isComposing)
|
|
1109
|
-
return;
|
|
1110
|
-
if ((event.ctrlKey || event.metaKey) && !event.altKey) {
|
|
1111
|
-
const key = event.key.toLowerCase();
|
|
1112
|
-
if (["b", "i", "u", "z", "y"].includes(key)) {
|
|
1113
|
-
event.preventDefault();
|
|
1114
|
-
if (key === "z" || key === "y")
|
|
1115
|
-
travel(key === "y" || event.shiftKey ? 1 : -1);
|
|
1116
|
-
else if (!singleLine)
|
|
1117
|
-
format(key === "b" ? "bold" : key === "i" ? "italic" : "underline");
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
},
|
|
1121
|
-
children: initial
|
|
1122
|
-
}),
|
|
1123
|
-
error ? /* @__PURE__ */ jsx5("p", {
|
|
1124
|
-
id: `${id}-error`,
|
|
1125
|
-
role: "alert",
|
|
1126
|
-
className: "text-destructive px-4 pb-3 text-xs",
|
|
1127
|
-
children: copy.invalid
|
|
1128
|
-
}) : null
|
|
1129
|
-
]
|
|
1130
|
-
});
|
|
1131
|
-
};
|
|
1132
|
-
export {
|
|
1133
|
-
RichTextContent,
|
|
1134
|
-
RichTextEditor
|
|
1135
|
-
};
|