@iamsaroj/smart-ui 0.2.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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/calendar-engine/agenda-view.d.ts +8 -0
- package/dist/calendar-engine/agenda-view.d.ts.map +1 -0
- package/dist/calendar-engine/agenda-view.js +26 -0
- package/dist/calendar-engine/agenda-view.js.map +1 -0
- package/dist/calendar-engine/booking.d.ts +13 -0
- package/dist/calendar-engine/booking.d.ts.map +1 -0
- package/dist/calendar-engine/booking.js +45 -0
- package/dist/calendar-engine/booking.js.map +1 -0
- package/dist/calendar-engine/calendar-utils.d.ts +74 -0
- package/dist/calendar-engine/calendar-utils.d.ts.map +1 -0
- package/dist/calendar-engine/calendar-utils.js +221 -0
- package/dist/calendar-engine/calendar-utils.js.map +1 -0
- package/dist/calendar-engine/calendar.d.ts +62 -0
- package/dist/calendar-engine/calendar.d.ts.map +1 -0
- package/dist/calendar-engine/calendar.js +81 -0
- package/dist/calendar-engine/calendar.js.map +1 -0
- package/dist/calendar-engine/event-color.d.ts +20 -0
- package/dist/calendar-engine/event-color.d.ts.map +1 -0
- package/dist/calendar-engine/event-color.js +59 -0
- package/dist/calendar-engine/event-color.js.map +1 -0
- package/dist/calendar-engine/index.d.ts +11 -0
- package/dist/calendar-engine/index.d.ts.map +1 -0
- package/dist/calendar-engine/index.js +6 -0
- package/dist/calendar-engine/index.js.map +1 -0
- package/dist/calendar-engine/month-view.d.ts +10 -0
- package/dist/calendar-engine/month-view.d.ts.map +1 -0
- package/dist/calendar-engine/month-view.js +72 -0
- package/dist/calendar-engine/month-view.js.map +1 -0
- package/dist/calendar-engine/recurrence.d.ts +47 -0
- package/dist/calendar-engine/recurrence.d.ts.map +1 -0
- package/dist/calendar-engine/recurrence.js +209 -0
- package/dist/calendar-engine/recurrence.js.map +1 -0
- package/dist/calendar-engine/shared.d.ts +72 -0
- package/dist/calendar-engine/shared.d.ts.map +1 -0
- package/dist/calendar-engine/shared.js +34 -0
- package/dist/calendar-engine/shared.js.map +1 -0
- package/dist/calendar-engine/time-grid-view.d.ts +13 -0
- package/dist/calendar-engine/time-grid-view.d.ts.map +1 -0
- package/dist/calendar-engine/time-grid-view.js +203 -0
- package/dist/calendar-engine/time-grid-view.js.map +1 -0
- package/dist/calendar-engine/types.d.ts +138 -0
- package/dist/calendar-engine/types.d.ts.map +1 -0
- package/dist/calendar-engine/types.js +2 -0
- package/dist/calendar-engine/types.js.map +1 -0
- package/dist/calendar-engine/use-calendar.d.ts +7 -0
- package/dist/calendar-engine/use-calendar.d.ts.map +1 -0
- package/dist/calendar-engine/use-calendar.js +25 -0
- package/dist/calendar-engine/use-calendar.js.map +1 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +10 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +19 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +18 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +20 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +7 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar.d.ts +12 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +11 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +8 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +33 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +23 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +9 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +34 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +11 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +77 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +12 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +11 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +29 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +94 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.d.ts +45 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +133 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +8 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +6 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +7 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +35 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +45 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command.d.ts +20 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +18 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.d.ts +30 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +22 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +12 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +44 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-picker.d.ts +33 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker.js +29 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +18 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +18 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +14 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +15 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +30 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +22 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +8 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +19 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +46 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.d.ts +12 -0
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +16 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +6 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/kbd.d.ts +5 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +6 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +5 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/menubar.d.ts +30 -0
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +24 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +12 -0
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +18 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +13 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +12 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +8 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +10 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +9 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +8 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +16 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +6 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +15 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +18 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +64 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +224 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +5 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +13 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +4 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +25 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +7 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +12 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +23 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +4 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +5 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.d.ts +11 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +22 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +25 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +10 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/data-grid/action-column-cell.d.ts +41 -0
- package/dist/data-grid/action-column-cell.d.ts.map +1 -0
- package/dist/data-grid/action-column-cell.js +114 -0
- package/dist/data-grid/action-column-cell.js.map +1 -0
- package/dist/data-grid/action-column.d.ts +144 -0
- package/dist/data-grid/action-column.d.ts.map +1 -0
- package/dist/data-grid/action-column.js +156 -0
- package/dist/data-grid/action-column.js.map +1 -0
- package/dist/data-grid/create-page-fetcher.d.ts +57 -0
- package/dist/data-grid/create-page-fetcher.d.ts.map +1 -0
- package/dist/data-grid/create-page-fetcher.js +41 -0
- package/dist/data-grid/create-page-fetcher.js.map +1 -0
- package/dist/data-grid/data-grid.d.ts +65 -0
- package/dist/data-grid/data-grid.d.ts.map +1 -0
- package/dist/data-grid/data-grid.js +95 -0
- package/dist/data-grid/data-grid.js.map +1 -0
- package/dist/data-grid/empty-state.d.ts +13 -0
- package/dist/data-grid/empty-state.d.ts.map +1 -0
- package/dist/data-grid/empty-state.js +6 -0
- package/dist/data-grid/empty-state.js.map +1 -0
- package/dist/data-grid/formula-guard.d.ts +22 -0
- package/dist/data-grid/formula-guard.d.ts.map +1 -0
- package/dist/data-grid/formula-guard.js +28 -0
- package/dist/data-grid/formula-guard.js.map +1 -0
- package/dist/data-grid/grid-internals.d.ts +16 -0
- package/dist/data-grid/grid-internals.d.ts.map +1 -0
- package/dist/data-grid/grid-internals.js +73 -0
- package/dist/data-grid/grid-internals.js.map +1 -0
- package/dist/data-grid/grid-theme.d.ts +8 -0
- package/dist/data-grid/grid-theme.d.ts.map +1 -0
- package/dist/data-grid/grid-theme.js +23 -0
- package/dist/data-grid/grid-theme.js.map +1 -0
- package/dist/data-grid/grid-toolbar.d.ts +40 -0
- package/dist/data-grid/grid-toolbar.d.ts.map +1 -0
- package/dist/data-grid/grid-toolbar.js +13 -0
- package/dist/data-grid/grid-toolbar.js.map +1 -0
- package/dist/data-grid/index.d.ts +10 -0
- package/dist/data-grid/index.d.ts.map +1 -0
- package/dist/data-grid/index.js +9 -0
- package/dist/data-grid/index.js.map +1 -0
- package/dist/data-grid/pagination.d.ts +146 -0
- package/dist/data-grid/pagination.d.ts.map +1 -0
- package/dist/data-grid/pagination.js +128 -0
- package/dist/data-grid/pagination.js.map +1 -0
- package/dist/data-grid/server-data-grid.d.ts +109 -0
- package/dist/data-grid/server-data-grid.d.ts.map +1 -0
- package/dist/data-grid/server-data-grid.js +240 -0
- package/dist/data-grid/server-data-grid.js.map +1 -0
- package/dist/data-grid/server-grid-internals.d.ts +79 -0
- package/dist/data-grid/server-grid-internals.d.ts.map +1 -0
- package/dist/data-grid/server-grid-internals.js +137 -0
- package/dist/data-grid/server-grid-internals.js.map +1 -0
- package/dist/data-grid/use-action-column.d.ts +22 -0
- package/dist/data-grid/use-action-column.d.ts.map +1 -0
- package/dist/data-grid/use-action-column.js +63 -0
- package/dist/data-grid/use-action-column.js.map +1 -0
- package/dist/data-grid/use-server-grid-selection.d.ts +35 -0
- package/dist/data-grid/use-server-grid-selection.d.ts.map +1 -0
- package/dist/data-grid/use-server-grid-selection.js +81 -0
- package/dist/data-grid/use-server-grid-selection.js.map +1 -0
- package/dist/form-engine/base.d.ts +19 -0
- package/dist/form-engine/base.d.ts.map +1 -0
- package/dist/form-engine/base.js +2 -0
- package/dist/form-engine/base.js.map +1 -0
- package/dist/form-engine/field-registry.d.ts +285 -0
- package/dist/form-engine/field-registry.d.ts.map +1 -0
- package/dist/form-engine/field-registry.js +306 -0
- package/dist/form-engine/field-registry.js.map +1 -0
- package/dist/form-engine/field-types.d.ts +201 -0
- package/dist/form-engine/field-types.d.ts.map +1 -0
- package/dist/form-engine/field-types.js +14 -0
- package/dist/form-engine/field-types.js.map +1 -0
- package/dist/form-engine/index.d.ts +20 -0
- package/dist/form-engine/index.d.ts.map +1 -0
- package/dist/form-engine/index.js +21 -0
- package/dist/form-engine/index.js.map +1 -0
- package/dist/form-engine/smart-checkbox-field.d.ts +5 -0
- package/dist/form-engine/smart-checkbox-field.d.ts.map +1 -0
- package/dist/form-engine/smart-checkbox-field.js +9 -0
- package/dist/form-engine/smart-checkbox-field.js.map +1 -0
- package/dist/form-engine/smart-checkbox-group-field.d.ts +10 -0
- package/dist/form-engine/smart-checkbox-group-field.d.ts.map +1 -0
- package/dist/form-engine/smart-checkbox-group-field.js +5 -0
- package/dist/form-engine/smart-checkbox-group-field.js.map +1 -0
- package/dist/form-engine/smart-combobox-field.d.ts +11 -0
- package/dist/form-engine/smart-combobox-field.d.ts.map +1 -0
- package/dist/form-engine/smart-combobox-field.js +5 -0
- package/dist/form-engine/smart-combobox-field.js.map +1 -0
- package/dist/form-engine/smart-date-field.d.ts +8 -0
- package/dist/form-engine/smart-date-field.d.ts.map +1 -0
- package/dist/form-engine/smart-date-field.js +17 -0
- package/dist/form-engine/smart-date-field.js.map +1 -0
- package/dist/form-engine/smart-date-range-field.d.ts +15 -0
- package/dist/form-engine/smart-date-range-field.d.ts.map +1 -0
- package/dist/form-engine/smart-date-range-field.js +25 -0
- package/dist/form-engine/smart-date-range-field.js.map +1 -0
- package/dist/form-engine/smart-datetime-field.d.ts +12 -0
- package/dist/form-engine/smart-datetime-field.d.ts.map +1 -0
- package/dist/form-engine/smart-datetime-field.js +12 -0
- package/dist/form-engine/smart-datetime-field.js.map +1 -0
- package/dist/form-engine/smart-form-internals.d.ts +14 -0
- package/dist/form-engine/smart-form-internals.d.ts.map +1 -0
- package/dist/form-engine/smart-form-internals.js +64 -0
- package/dist/form-engine/smart-form-internals.js.map +1 -0
- package/dist/form-engine/smart-form.d.ts +55 -0
- package/dist/form-engine/smart-form.d.ts.map +1 -0
- package/dist/form-engine/smart-form.js +229 -0
- package/dist/form-engine/smart-form.js.map +1 -0
- package/dist/form-engine/smart-input-field.d.ts +9 -0
- package/dist/form-engine/smart-input-field.d.ts.map +1 -0
- package/dist/form-engine/smart-input-field.js +5 -0
- package/dist/form-engine/smart-input-field.js.map +1 -0
- package/dist/form-engine/smart-month-field.d.ts +8 -0
- package/dist/form-engine/smart-month-field.d.ts.map +1 -0
- package/dist/form-engine/smart-month-field.js +12 -0
- package/dist/form-engine/smart-month-field.js.map +1 -0
- package/dist/form-engine/smart-multi-select-field.d.ts +11 -0
- package/dist/form-engine/smart-multi-select-field.d.ts.map +1 -0
- package/dist/form-engine/smart-multi-select-field.js +5 -0
- package/dist/form-engine/smart-multi-select-field.js.map +1 -0
- package/dist/form-engine/smart-number-field.d.ts +22 -0
- package/dist/form-engine/smart-number-field.d.ts.map +1 -0
- package/dist/form-engine/smart-number-field.js +115 -0
- package/dist/form-engine/smart-number-field.js.map +1 -0
- package/dist/form-engine/smart-password-field.d.ts +7 -0
- package/dist/form-engine/smart-password-field.d.ts.map +1 -0
- package/dist/form-engine/smart-password-field.js +5 -0
- package/dist/form-engine/smart-password-field.js.map +1 -0
- package/dist/form-engine/smart-radio-group-field.d.ts +10 -0
- package/dist/form-engine/smart-radio-group-field.d.ts.map +1 -0
- package/dist/form-engine/smart-radio-group-field.js +5 -0
- package/dist/form-engine/smart-radio-group-field.js.map +1 -0
- package/dist/form-engine/smart-segmented-field.d.ts +9 -0
- package/dist/form-engine/smart-segmented-field.d.ts.map +1 -0
- package/dist/form-engine/smart-segmented-field.js +5 -0
- package/dist/form-engine/smart-segmented-field.js.map +1 -0
- package/dist/form-engine/smart-select-field.d.ts +10 -0
- package/dist/form-engine/smart-select-field.d.ts.map +1 -0
- package/dist/form-engine/smart-select-field.js +5 -0
- package/dist/form-engine/smart-select-field.js.map +1 -0
- package/dist/form-engine/smart-slug-field.d.ts +12 -0
- package/dist/form-engine/smart-slug-field.d.ts.map +1 -0
- package/dist/form-engine/smart-slug-field.js +14 -0
- package/dist/form-engine/smart-slug-field.js.map +1 -0
- package/dist/form-engine/smart-switch-field.d.ts +5 -0
- package/dist/form-engine/smart-switch-field.d.ts.map +1 -0
- package/dist/form-engine/smart-switch-field.js +9 -0
- package/dist/form-engine/smart-switch-field.js.map +1 -0
- package/dist/form-engine/smart-tel-field.d.ts +7 -0
- package/dist/form-engine/smart-tel-field.d.ts.map +1 -0
- package/dist/form-engine/smart-tel-field.js +6 -0
- package/dist/form-engine/smart-tel-field.js.map +1 -0
- package/dist/form-engine/smart-text-editor-field.d.ts +15 -0
- package/dist/form-engine/smart-text-editor-field.d.ts.map +1 -0
- package/dist/form-engine/smart-text-editor-field.js +5 -0
- package/dist/form-engine/smart-text-editor-field.js.map +1 -0
- package/dist/form-engine/smart-textarea-field.d.ts +8 -0
- package/dist/form-engine/smart-textarea-field.d.ts.map +1 -0
- package/dist/form-engine/smart-textarea-field.js +5 -0
- package/dist/form-engine/smart-textarea-field.js.map +1 -0
- package/dist/form-engine/smart-time-field.d.ts +10 -0
- package/dist/form-engine/smart-time-field.d.ts.map +1 -0
- package/dist/form-engine/smart-time-field.js +5 -0
- package/dist/form-engine/smart-time-field.js.map +1 -0
- package/dist/form-engine/smart-time-range-field.d.ts +13 -0
- package/dist/form-engine/smart-time-range-field.d.ts.map +1 -0
- package/dist/form-engine/smart-time-range-field.js +5 -0
- package/dist/form-engine/smart-time-range-field.js.map +1 -0
- package/dist/form-engine/smart-year-field.d.ts +8 -0
- package/dist/form-engine/smart-year-field.d.ts.map +1 -0
- package/dist/form-engine/smart-year-field.js +5 -0
- package/dist/form-engine/smart-year-field.js.map +1 -0
- package/dist/form-engine/smart-yesno-field.d.ts +12 -0
- package/dist/form-engine/smart-yesno-field.d.ts.map +1 -0
- package/dist/form-engine/smart-yesno-field.js +14 -0
- package/dist/form-engine/smart-yesno-field.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +17 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/lexical-text-editor/SmartTextEditor.d.ts +61 -0
- package/dist/lexical-text-editor/SmartTextEditor.d.ts.map +1 -0
- package/dist/lexical-text-editor/SmartTextEditor.js +145 -0
- package/dist/lexical-text-editor/SmartTextEditor.js.map +1 -0
- package/dist/lexical-text-editor/editor-nodes.d.ts +3 -0
- package/dist/lexical-text-editor/editor-nodes.d.ts.map +1 -0
- package/dist/lexical-text-editor/editor-nodes.js +25 -0
- package/dist/lexical-text-editor/editor-nodes.js.map +1 -0
- package/dist/lexical-text-editor/editor-theme.d.ts +3 -0
- package/dist/lexical-text-editor/editor-theme.d.ts.map +1 -0
- package/dist/lexical-text-editor/editor-theme.js +78 -0
- package/dist/lexical-text-editor/editor-theme.js.map +1 -0
- package/dist/lexical-text-editor/index.d.ts +8 -0
- package/dist/lexical-text-editor/index.d.ts.map +1 -0
- package/dist/lexical-text-editor/index.js +6 -0
- package/dist/lexical-text-editor/index.js.map +1 -0
- package/dist/lexical-text-editor/nodes/image-node.d.ts +41 -0
- package/dist/lexical-text-editor/nodes/image-node.d.ts.map +1 -0
- package/dist/lexical-text-editor/nodes/image-node.js +89 -0
- package/dist/lexical-text-editor/nodes/image-node.js.map +1 -0
- package/dist/lexical-text-editor/nodes/page-break-node.d.ts +25 -0
- package/dist/lexical-text-editor/nodes/page-break-node.d.ts.map +1 -0
- package/dist/lexical-text-editor/nodes/page-break-node.js +84 -0
- package/dist/lexical-text-editor/nodes/page-break-node.js.map +1 -0
- package/dist/lexical-text-editor/plugins/auto-link-plugin.d.ts +3 -0
- package/dist/lexical-text-editor/plugins/auto-link-plugin.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/auto-link-plugin.js +12 -0
- package/dist/lexical-text-editor/plugins/auto-link-plugin.js.map +1 -0
- package/dist/lexical-text-editor/plugins/code-highlight-plugin.d.ts +6 -0
- package/dist/lexical-text-editor/plugins/code-highlight-plugin.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/code-highlight-plugin.js +14 -0
- package/dist/lexical-text-editor/plugins/code-highlight-plugin.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/align-menu.d.ts +7 -0
- package/dist/lexical-text-editor/plugins/toolbar/align-menu.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/align-menu.js +8 -0
- package/dist/lexical-text-editor/plugins/toolbar/align-menu.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/block-format-menu.d.ts +20 -0
- package/dist/lexical-text-editor/plugins/toolbar/block-format-menu.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/block-format-menu.js +78 -0
- package/dist/lexical-text-editor/plugins/toolbar/block-format-menu.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/constants.d.ts +36 -0
- package/dist/lexical-text-editor/plugins/toolbar/constants.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/constants.js +67 -0
- package/dist/lexical-text-editor/plugins/toolbar/constants.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/inline-marks.d.ts +14 -0
- package/dist/lexical-text-editor/plugins/toolbar/inline-marks.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/inline-marks.js +129 -0
- package/dist/lexical-text-editor/plugins/toolbar/inline-marks.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/insert-menu.d.ts +8 -0
- package/dist/lexical-text-editor/plugins/toolbar/insert-menu.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/insert-menu.js +87 -0
- package/dist/lexical-text-editor/plugins/toolbar/insert-menu.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/link-editor.d.ts +11 -0
- package/dist/lexical-text-editor/plugins/toolbar/link-editor.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/link-editor.js +51 -0
- package/dist/lexical-text-editor/plugins/toolbar/link-editor.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/primitives.d.ts +39 -0
- package/dist/lexical-text-editor/plugins/toolbar/primitives.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/primitives.js +47 -0
- package/dist/lexical-text-editor/plugins/toolbar/primitives.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-insert-commands.d.ts +9 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-insert-commands.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-insert-commands.js +29 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-insert-commands.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-toolbar-state.d.ts +30 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-toolbar-state.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-toolbar-state.js +128 -0
- package/dist/lexical-text-editor/plugins/toolbar/use-toolbar-state.js.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar-plugin.d.ts +8 -0
- package/dist/lexical-text-editor/plugins/toolbar-plugin.d.ts.map +1 -0
- package/dist/lexical-text-editor/plugins/toolbar-plugin.js +51 -0
- package/dist/lexical-text-editor/plugins/toolbar-plugin.js.map +1 -0
- package/dist/lexical-text-editor/sanitize.d.ts +24 -0
- package/dist/lexical-text-editor/sanitize.d.ts.map +1 -0
- package/dist/lexical-text-editor/sanitize.js +140 -0
- package/dist/lexical-text-editor/sanitize.js.map +1 -0
- package/dist/lib/format.d.ts +17 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +40 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/leading-space.d.ts +28 -0
- package/dist/lib/leading-space.d.ts.map +1 -0
- package/dist/lib/leading-space.js +34 -0
- package/dist/lib/leading-space.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +4 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/xlsx.d.ts +80 -0
- package/dist/lib/xlsx.d.ts.map +1 -0
- package/dist/lib/xlsx.js +377 -0
- package/dist/lib/xlsx.js.map +1 -0
- package/dist/search-engine/build-query.d.ts +29 -0
- package/dist/search-engine/build-query.d.ts.map +1 -0
- package/dist/search-engine/build-query.js +51 -0
- package/dist/search-engine/build-query.js.map +1 -0
- package/dist/search-engine/index.d.ts +15 -0
- package/dist/search-engine/index.d.ts.map +1 -0
- package/dist/search-engine/index.js +13 -0
- package/dist/search-engine/index.js.map +1 -0
- package/dist/search-engine/smart-search-form.d.ts +92 -0
- package/dist/search-engine/smart-search-form.d.ts.map +1 -0
- package/dist/search-engine/smart-search-form.js +136 -0
- package/dist/search-engine/smart-search-form.js.map +1 -0
- package/dist/search-engine/types.d.ts +40 -0
- package/dist/search-engine/types.d.ts.map +1 -0
- package/dist/search-engine/types.js +11 -0
- package/dist/search-engine/types.js.map +1 -0
- package/dist/smart-components/buttons/action-button.d.ts +66 -0
- package/dist/smart-components/buttons/action-button.d.ts.map +1 -0
- package/dist/smart-components/buttons/action-button.js +79 -0
- package/dist/smart-components/buttons/action-button.js.map +1 -0
- package/dist/smart-components/buttons/action-buttons.d.ts +122 -0
- package/dist/smart-components/buttons/action-buttons.d.ts.map +1 -0
- package/dist/smart-components/buttons/action-buttons.js +42 -0
- package/dist/smart-components/buttons/action-buttons.js.map +1 -0
- package/dist/smart-components/buttons/action-config.d.ts +181 -0
- package/dist/smart-components/buttons/action-config.d.ts.map +1 -0
- package/dist/smart-components/buttons/action-config.js +128 -0
- package/dist/smart-components/buttons/action-config.js.map +1 -0
- package/dist/smart-components/buttons/index.d.ts +4 -0
- package/dist/smart-components/buttons/index.d.ts.map +1 -0
- package/dist/smart-components/buttons/index.js +7 -0
- package/dist/smart-components/buttons/index.js.map +1 -0
- package/dist/smart-components/loading-overlay.d.ts +16 -0
- package/dist/smart-components/loading-overlay.d.ts.map +1 -0
- package/dist/smart-components/loading-overlay.js +13 -0
- package/dist/smart-components/loading-overlay.js.map +1 -0
- package/dist/smart-components/page/index.d.ts +19 -0
- package/dist/smart-components/page/index.d.ts.map +1 -0
- package/dist/smart-components/page/index.js +33 -0
- package/dist/smart-components/page/index.js.map +1 -0
- package/dist/smart-components/page/layouts/page-states.d.ts +17 -0
- package/dist/smart-components/page/layouts/page-states.d.ts.map +1 -0
- package/dist/smart-components/page/layouts/page-states.js +12 -0
- package/dist/smart-components/page/layouts/page-states.js.map +1 -0
- package/dist/smart-components/page/layouts/slot-buckets.d.ts +21 -0
- package/dist/smart-components/page/layouts/slot-buckets.d.ts.map +1 -0
- package/dist/smart-components/page/layouts/slot-buckets.js +2 -0
- package/dist/smart-components/page/layouts/slot-buckets.js.map +1 -0
- package/dist/smart-components/page/layouts/split-layout.d.ts +13 -0
- package/dist/smart-components/page/layouts/split-layout.d.ts.map +1 -0
- package/dist/smart-components/page/layouts/split-layout.js +14 -0
- package/dist/smart-components/page/layouts/split-layout.js.map +1 -0
- package/dist/smart-components/page/layouts/standard-layout.d.ts +18 -0
- package/dist/smart-components/page/layouts/standard-layout.d.ts.map +1 -0
- package/dist/smart-components/page/layouts/standard-layout.js +61 -0
- package/dist/smart-components/page/layouts/standard-layout.js.map +1 -0
- package/dist/smart-components/page/page-context.d.ts +51 -0
- package/dist/smart-components/page/page-context.d.ts.map +1 -0
- package/dist/smart-components/page/page-context.js +21 -0
- package/dist/smart-components/page/page-context.js.map +1 -0
- package/dist/smart-components/page/slot.d.ts +19 -0
- package/dist/smart-components/page/slot.d.ts.map +1 -0
- package/dist/smart-components/page/slot.js +18 -0
- package/dist/smart-components/page/slot.js.map +1 -0
- package/dist/smart-components/page/smart-grid-area.d.ts +75 -0
- package/dist/smart-components/page/smart-grid-area.d.ts.map +1 -0
- package/dist/smart-components/page/smart-grid-area.js +61 -0
- package/dist/smart-components/page/smart-grid-area.js.map +1 -0
- package/dist/smart-components/page/smart-page-container.d.ts +66 -0
- package/dist/smart-components/page/smart-page-container.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-container.js +93 -0
- package/dist/smart-components/page/smart-page-container.js.map +1 -0
- package/dist/smart-components/page/smart-page-content.d.ts +70 -0
- package/dist/smart-components/page/smart-page-content.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-content.js +78 -0
- package/dist/smart-components/page/smart-page-content.js.map +1 -0
- package/dist/smart-components/page/smart-page-empty.d.ts +47 -0
- package/dist/smart-components/page/smart-page-empty.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-empty.js +37 -0
- package/dist/smart-components/page/smart-page-empty.js.map +1 -0
- package/dist/smart-components/page/smart-page-error.d.ts +59 -0
- package/dist/smart-components/page/smart-page-error.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-error.js +45 -0
- package/dist/smart-components/page/smart-page-error.js.map +1 -0
- package/dist/smart-components/page/smart-page-filters.d.ts +38 -0
- package/dist/smart-components/page/smart-page-filters.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-filters.js +33 -0
- package/dist/smart-components/page/smart-page-filters.js.map +1 -0
- package/dist/smart-components/page/smart-page-footer.d.ts +49 -0
- package/dist/smart-components/page/smart-page-footer.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-footer.js +49 -0
- package/dist/smart-components/page/smart-page-footer.js.map +1 -0
- package/dist/smart-components/page/smart-page-header.d.ts +145 -0
- package/dist/smart-components/page/smart-page-header.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-header.js +129 -0
- package/dist/smart-components/page/smart-page-header.js.map +1 -0
- package/dist/smart-components/page/smart-page-hero.d.ts +43 -0
- package/dist/smart-components/page/smart-page-hero.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-hero.js +42 -0
- package/dist/smart-components/page/smart-page-hero.js.map +1 -0
- package/dist/smart-components/page/smart-page-loading.d.ts +31 -0
- package/dist/smart-components/page/smart-page-loading.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-loading.js +29 -0
- package/dist/smart-components/page/smart-page-loading.js.map +1 -0
- package/dist/smart-components/page/smart-page-search.d.ts +39 -0
- package/dist/smart-components/page/smart-page-search.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-search.js +38 -0
- package/dist/smart-components/page/smart-page-search.js.map +1 -0
- package/dist/smart-components/page/smart-page-section.d.ts +55 -0
- package/dist/smart-components/page/smart-page-section.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-section.js +41 -0
- package/dist/smart-components/page/smart-page-section.js.map +1 -0
- package/dist/smart-components/page/smart-page-status-bar.d.ts +34 -0
- package/dist/smart-components/page/smart-page-status-bar.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-status-bar.js +33 -0
- package/dist/smart-components/page/smart-page-status-bar.js.map +1 -0
- package/dist/smart-components/page/smart-page-tabs.d.ts +93 -0
- package/dist/smart-components/page/smart-page-tabs.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page-tabs.js +87 -0
- package/dist/smart-components/page/smart-page-tabs.js.map +1 -0
- package/dist/smart-components/page/smart-page.d.ts +141 -0
- package/dist/smart-components/page/smart-page.d.ts.map +1 -0
- package/dist/smart-components/page/smart-page.js +295 -0
- package/dist/smart-components/page/smart-page.js.map +1 -0
- package/dist/smart-components/page/smart-sidebar.d.ts +70 -0
- package/dist/smart-components/page/smart-sidebar.d.ts.map +1 -0
- package/dist/smart-components/page/smart-sidebar.js +54 -0
- package/dist/smart-components/page/smart-sidebar.js.map +1 -0
- package/dist/smart-components/page/smart-toolbar.d.ts +40 -0
- package/dist/smart-components/page/smart-toolbar.d.ts.map +1 -0
- package/dist/smart-components/page/smart-toolbar.js +39 -0
- package/dist/smart-components/page/smart-toolbar.js.map +1 -0
- package/dist/smart-components/search-input.d.ts +20 -0
- package/dist/smart-components/search-input.d.ts.map +1 -0
- package/dist/smart-components/search-input.js +12 -0
- package/dist/smart-components/search-input.js.map +1 -0
- package/dist/smart-components/smart-accordion.d.ts +53 -0
- package/dist/smart-components/smart-accordion.d.ts.map +1 -0
- package/dist/smart-components/smart-accordion.js +33 -0
- package/dist/smart-components/smart-accordion.js.map +1 -0
- package/dist/smart-components/smart-alert.d.ts +44 -0
- package/dist/smart-components/smart-alert.d.ts.map +1 -0
- package/dist/smart-components/smart-alert.js +27 -0
- package/dist/smart-components/smart-alert.js.map +1 -0
- package/dist/smart-components/smart-avatar.d.ts +3 -0
- package/dist/smart-components/smart-avatar.d.ts.map +1 -0
- package/dist/smart-components/smart-avatar.js +4 -0
- package/dist/smart-components/smart-avatar.js.map +1 -0
- package/dist/smart-components/smart-badge.d.ts +28 -0
- package/dist/smart-components/smart-badge.d.ts.map +1 -0
- package/dist/smart-components/smart-badge.js +24 -0
- package/dist/smart-components/smart-badge.js.map +1 -0
- package/dist/smart-components/smart-breadcrumb.d.ts +43 -0
- package/dist/smart-components/smart-breadcrumb.d.ts.map +1 -0
- package/dist/smart-components/smart-breadcrumb.js +37 -0
- package/dist/smart-components/smart-breadcrumb.js.map +1 -0
- package/dist/smart-components/smart-button.d.ts +22 -0
- package/dist/smart-components/smart-button.d.ts.map +1 -0
- package/dist/smart-components/smart-button.js +15 -0
- package/dist/smart-components/smart-button.js.map +1 -0
- package/dist/smart-components/smart-calendar.d.ts +78 -0
- package/dist/smart-components/smart-calendar.d.ts.map +1 -0
- package/dist/smart-components/smart-calendar.js +45 -0
- package/dist/smart-components/smart-calendar.js.map +1 -0
- package/dist/smart-components/smart-card.d.ts +55 -0
- package/dist/smart-components/smart-card.d.ts.map +1 -0
- package/dist/smart-components/smart-card.js +37 -0
- package/dist/smart-components/smart-card.js.map +1 -0
- package/dist/smart-components/smart-checkbox-group.d.ts +48 -0
- package/dist/smart-components/smart-checkbox-group.d.ts.map +1 -0
- package/dist/smart-components/smart-checkbox-group.js +48 -0
- package/dist/smart-components/smart-checkbox-group.js.map +1 -0
- package/dist/smart-components/smart-checkbox.d.ts +34 -0
- package/dist/smart-components/smart-checkbox.d.ts.map +1 -0
- package/dist/smart-components/smart-checkbox.js +34 -0
- package/dist/smart-components/smart-checkbox.js.map +1 -0
- package/dist/smart-components/smart-combobox.d.ts +36 -0
- package/dist/smart-components/smart-combobox.d.ts.map +1 -0
- package/dist/smart-components/smart-combobox.js +32 -0
- package/dist/smart-components/smart-combobox.js.map +1 -0
- package/dist/smart-components/smart-confirm-dialog.d.ts +63 -0
- package/dist/smart-components/smart-confirm-dialog.d.ts.map +1 -0
- package/dist/smart-components/smart-confirm-dialog.js +45 -0
- package/dist/smart-components/smart-confirm-dialog.js.map +1 -0
- package/dist/smart-components/smart-context-menu.d.ts +58 -0
- package/dist/smart-components/smart-context-menu.d.ts.map +1 -0
- package/dist/smart-components/smart-context-menu.js +38 -0
- package/dist/smart-components/smart-context-menu.js.map +1 -0
- package/dist/smart-components/smart-date-picker.d.ts +99 -0
- package/dist/smart-components/smart-date-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-date-picker.js +78 -0
- package/dist/smart-components/smart-date-picker.js.map +1 -0
- package/dist/smart-components/smart-date-range-picker.d.ts +37 -0
- package/dist/smart-components/smart-date-range-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-date-range-picker.js +38 -0
- package/dist/smart-components/smart-date-range-picker.js.map +1 -0
- package/dist/smart-components/smart-dialog.d.ts +75 -0
- package/dist/smart-components/smart-dialog.d.ts.map +1 -0
- package/dist/smart-components/smart-dialog.js +61 -0
- package/dist/smart-components/smart-dialog.js.map +1 -0
- package/dist/smart-components/smart-drawer.d.ts +48 -0
- package/dist/smart-components/smart-drawer.d.ts.map +1 -0
- package/dist/smart-components/smart-drawer.js +32 -0
- package/dist/smart-components/smart-drawer.js.map +1 -0
- package/dist/smart-components/smart-field.d.ts +47 -0
- package/dist/smart-components/smart-field.d.ts.map +1 -0
- package/dist/smart-components/smart-field.js +44 -0
- package/dist/smart-components/smart-field.js.map +1 -0
- package/dist/smart-components/smart-input-group.d.ts +60 -0
- package/dist/smart-components/smart-input-group.d.ts.map +1 -0
- package/dist/smart-components/smart-input-group.js +40 -0
- package/dist/smart-components/smart-input-group.js.map +1 -0
- package/dist/smart-components/smart-input.d.ts +46 -0
- package/dist/smart-components/smart-input.d.ts.map +1 -0
- package/dist/smart-components/smart-input.js +36 -0
- package/dist/smart-components/smart-input.js.map +1 -0
- package/dist/smart-components/smart-label.d.ts +22 -0
- package/dist/smart-components/smart-label.d.ts.map +1 -0
- package/dist/smart-components/smart-label.js +17 -0
- package/dist/smart-components/smart-label.js.map +1 -0
- package/dist/smart-components/smart-month-picker.d.ts +30 -0
- package/dist/smart-components/smart-month-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-month-picker.js +53 -0
- package/dist/smart-components/smart-month-picker.js.map +1 -0
- package/dist/smart-components/smart-multi-select.d.ts +38 -0
- package/dist/smart-components/smart-multi-select.d.ts.map +1 -0
- package/dist/smart-components/smart-multi-select.js +56 -0
- package/dist/smart-components/smart-multi-select.js.map +1 -0
- package/dist/smart-components/smart-native-select.d.ts +45 -0
- package/dist/smart-components/smart-native-select.d.ts.map +1 -0
- package/dist/smart-components/smart-native-select.js +33 -0
- package/dist/smart-components/smart-native-select.js.map +1 -0
- package/dist/smart-components/smart-nav-sidebar.d.ts +47 -0
- package/dist/smart-components/smart-nav-sidebar.d.ts.map +1 -0
- package/dist/smart-components/smart-nav-sidebar.js +37 -0
- package/dist/smart-components/smart-nav-sidebar.js.map +1 -0
- package/dist/smart-components/smart-password-input.d.ts +31 -0
- package/dist/smart-components/smart-password-input.d.ts.map +1 -0
- package/dist/smart-components/smart-password-input.js +30 -0
- package/dist/smart-components/smart-password-input.js.map +1 -0
- package/dist/smart-components/smart-radio-group.d.ts +58 -0
- package/dist/smart-components/smart-radio-group.d.ts.map +1 -0
- package/dist/smart-components/smart-radio-group.js +49 -0
- package/dist/smart-components/smart-radio-group.js.map +1 -0
- package/dist/smart-components/smart-segmented.d.ts +33 -0
- package/dist/smart-components/smart-segmented.d.ts.map +1 -0
- package/dist/smart-components/smart-segmented.js +25 -0
- package/dist/smart-components/smart-segmented.js.map +1 -0
- package/dist/smart-components/smart-select.d.ts +71 -0
- package/dist/smart-components/smart-select.d.ts.map +1 -0
- package/dist/smart-components/smart-select.js +44 -0
- package/dist/smart-components/smart-select.js.map +1 -0
- package/dist/smart-components/smart-separator.d.ts +3 -0
- package/dist/smart-components/smart-separator.d.ts.map +1 -0
- package/dist/smart-components/smart-separator.js +4 -0
- package/dist/smart-components/smart-separator.js.map +1 -0
- package/dist/smart-components/smart-sheet.d.ts +79 -0
- package/dist/smart-components/smart-sheet.d.ts.map +1 -0
- package/dist/smart-components/smart-sheet.js +47 -0
- package/dist/smart-components/smart-sheet.js.map +1 -0
- package/dist/smart-components/smart-stat-card.d.ts +47 -0
- package/dist/smart-components/smart-stat-card.d.ts.map +1 -0
- package/dist/smart-components/smart-stat-card.js +35 -0
- package/dist/smart-components/smart-stat-card.js.map +1 -0
- package/dist/smart-components/smart-stepper.d.ts +24 -0
- package/dist/smart-components/smart-stepper.d.ts.map +1 -0
- package/dist/smart-components/smart-stepper.js +24 -0
- package/dist/smart-components/smart-stepper.js.map +1 -0
- package/dist/smart-components/smart-switch.d.ts +34 -0
- package/dist/smart-components/smart-switch.d.ts.map +1 -0
- package/dist/smart-components/smart-switch.js +34 -0
- package/dist/smart-components/smart-switch.js.map +1 -0
- package/dist/smart-components/smart-textarea.d.ts +38 -0
- package/dist/smart-components/smart-textarea.d.ts.map +1 -0
- package/dist/smart-components/smart-textarea.js +28 -0
- package/dist/smart-components/smart-textarea.js.map +1 -0
- package/dist/smart-components/smart-time-picker.d.ts +59 -0
- package/dist/smart-components/smart-time-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-time-picker.js +129 -0
- package/dist/smart-components/smart-time-picker.js.map +1 -0
- package/dist/smart-components/smart-time-range-picker.d.ts +39 -0
- package/dist/smart-components/smart-time-range-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-time-range-picker.js +26 -0
- package/dist/smart-components/smart-time-range-picker.js.map +1 -0
- package/dist/smart-components/smart-toaster.d.ts +10 -0
- package/dist/smart-components/smart-toaster.d.ts.map +1 -0
- package/dist/smart-components/smart-toaster.js +21 -0
- package/dist/smart-components/smart-toaster.js.map +1 -0
- package/dist/smart-components/smart-year-picker.d.ts +29 -0
- package/dist/smart-components/smart-year-picker.d.ts.map +1 -0
- package/dist/smart-components/smart-year-picker.js +43 -0
- package/dist/smart-components/smart-year-picker.js.map +1 -0
- package/dist/smart-components/spinner.d.ts +10 -0
- package/dist/smart-components/spinner.d.ts.map +1 -0
- package/dist/smart-components/spinner.js +5 -0
- package/dist/smart-components/spinner.js.map +1 -0
- package/dist/transfer-list-engine/index.d.ts +5 -0
- package/dist/transfer-list-engine/index.d.ts.map +1 -0
- package/dist/transfer-list-engine/index.js +3 -0
- package/dist/transfer-list-engine/index.js.map +1 -0
- package/dist/transfer-list-engine/transfer-list.d.ts +53 -0
- package/dist/transfer-list-engine/transfer-list.d.ts.map +1 -0
- package/dist/transfer-list-engine/transfer-list.js +190 -0
- package/dist/transfer-list-engine/transfer-list.js.map +1 -0
- package/dist/transfer-list-engine/transfer-utils.d.ts +30 -0
- package/dist/transfer-list-engine/transfer-utils.d.ts.map +1 -0
- package/dist/transfer-list-engine/transfer-utils.js +69 -0
- package/dist/transfer-list-engine/transfer-utils.js.map +1 -0
- package/dist/transfer-list-engine/types.d.ts +51 -0
- package/dist/transfer-list-engine/types.d.ts.map +1 -0
- package/dist/transfer-list-engine/types.js +2 -0
- package/dist/transfer-list-engine/types.js.map +1 -0
- package/dist/tree-engine/index.d.ts +6 -0
- package/dist/tree-engine/index.d.ts.map +1 -0
- package/dist/tree-engine/index.js +3 -0
- package/dist/tree-engine/index.js.map +1 -0
- package/dist/tree-engine/tree-utils.d.ts +84 -0
- package/dist/tree-engine/tree-utils.d.ts.map +1 -0
- package/dist/tree-engine/tree-utils.js +271 -0
- package/dist/tree-engine/tree-utils.js.map +1 -0
- package/dist/tree-engine/tree.d.ts +98 -0
- package/dist/tree-engine/tree.d.ts.map +1 -0
- package/dist/tree-engine/tree.js +430 -0
- package/dist/tree-engine/tree.js.map +1 -0
- package/dist/tree-engine/types.d.ts +85 -0
- package/dist/tree-engine/types.d.ts.map +1 -0
- package/dist/tree-engine/types.js +2 -0
- package/dist/tree-engine/types.js.map +1 -0
- package/dist/tree-engine/use-tree.d.ts +12 -0
- package/dist/tree-engine/use-tree.d.ts.map +1 -0
- package/dist/tree-engine/use-tree.js +34 -0
- package/dist/tree-engine/use-tree.js.map +1 -0
- package/package.json +158 -0
- package/src/styles/globals.css +161 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, } from "lexical";
|
|
4
|
+
import { $insertNodeToNearestRoot, mergeRegister } from "@lexical/utils";
|
|
5
|
+
import { $createImageNode, INSERT_IMAGE_COMMAND } from "../../nodes/image-node";
|
|
6
|
+
import { $createPageBreakNode, INSERT_PAGE_BREAK_COMMAND, } from "../../nodes/page-break-node";
|
|
7
|
+
/**
|
|
8
|
+
* Registers the block-level insert commands the {@link InsertMenu} dispatches.
|
|
9
|
+
* Uses `$insertNodeToNearestRoot` (not `$insertNodes`) so block-level decorators
|
|
10
|
+
* land at the root — same as the Lexical playground. Co-located with the insert
|
|
11
|
+
* menu that triggers them.
|
|
12
|
+
*/
|
|
13
|
+
export const useRegisterInsertCommands = (editor) => {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
return mergeRegister(editor.registerCommand(INSERT_IMAGE_COMMAND, ({ src, alt, maxWidth }) => {
|
|
16
|
+
const node = $createImageNode({ src, alt, maxWidth });
|
|
17
|
+
$insertNodeToNearestRoot(node);
|
|
18
|
+
return true;
|
|
19
|
+
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(INSERT_PAGE_BREAK_COMMAND, () => {
|
|
20
|
+
const selection = $getSelection();
|
|
21
|
+
if (!$isRangeSelection(selection))
|
|
22
|
+
return false;
|
|
23
|
+
const node = $createPageBreakNode();
|
|
24
|
+
$insertNodeToNearestRoot(node);
|
|
25
|
+
return true;
|
|
26
|
+
}, COMMAND_PRIORITY_EDITOR));
|
|
27
|
+
}, [editor]);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=use-insert-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-insert-commands.js","sourceRoot":"","sources":["../../../../src/lexical-text-editor/plugins/toolbar/use-insert-commands.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GAExB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAExE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAqB,EAAE,EAAE;IACjE,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,aAAa,CAClB,MAAM,CAAC,eAAe,CACpB,oBAAoB,EACpB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA;YACrD,wBAAwB,CAAC,IAAI,CAAC,CAAA;YAC9B,OAAO,IAAI,CAAA;QACb,CAAC,EACD,uBAAuB,CACxB,EACD,MAAM,CAAC,eAAe,CACpB,yBAAyB,EACzB,GAAG,EAAE;YACH,MAAM,SAAS,GAAG,aAAa,EAAE,CAAA;YACjC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;gBAAE,OAAO,KAAK,CAAA;YAC/C,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAA;YACnC,wBAAwB,CAAC,IAAI,CAAC,CAAA;YAC9B,OAAO,IAAI,CAAA;QACb,CAAC,EACD,uBAAuB,CACxB,CACF,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ElementFormatType, type LexicalEditor, type NodeKey } from "lexical";
|
|
2
|
+
import type { BlockType } from "./constants";
|
|
3
|
+
/** Everything the toolbar derives from the current selection / editor state. */
|
|
4
|
+
export interface ToolbarState {
|
|
5
|
+
canUndo: boolean;
|
|
6
|
+
canRedo: boolean;
|
|
7
|
+
blockType: BlockType;
|
|
8
|
+
selectedElementKey: NodeKey | null;
|
|
9
|
+
codeLanguage: string;
|
|
10
|
+
fontSize: string;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
isBold: boolean;
|
|
13
|
+
isItalic: boolean;
|
|
14
|
+
isUnderline: boolean;
|
|
15
|
+
isStrikethrough: boolean;
|
|
16
|
+
isCode: boolean;
|
|
17
|
+
isSuperscript: boolean;
|
|
18
|
+
isSubscript: boolean;
|
|
19
|
+
isHighlight: boolean;
|
|
20
|
+
elementFormat: ElementFormatType;
|
|
21
|
+
isLink: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes to the editor and returns the selection-derived toolbar state.
|
|
25
|
+
* Reads on every selection change and editor update — the single source that
|
|
26
|
+
* every toolbar section renders its active/enabled state from. Extracted from
|
|
27
|
+
* `ToolbarPlugin` so the sections stay presentational.
|
|
28
|
+
*/
|
|
29
|
+
export declare const useToolbarState: (editor: LexicalEditor) => ToolbarState;
|
|
30
|
+
//# sourceMappingURL=use-toolbar-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toolbar-state.d.ts","sourceRoot":"","sources":["../../../../src/lexical-text-editor/plugins/toolbar/use-toolbar-state.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,OAAO,EAEb,MAAM,SAAS,CAAA;AAYhB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAU5C,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,kBAAkB,EAAE,OAAO,GAAG,IAAI,CAAA;IAClC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,iBAAiB,CAAA;IAChC,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,aAAa,KAAG,YAoIvD,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, COMMAND_PRIORITY_CRITICAL, SELECTION_CHANGE_COMMAND, } from "lexical";
|
|
4
|
+
import { $isHeadingNode } from "@lexical/rich-text";
|
|
5
|
+
import { $isListNode, ListNode } from "@lexical/list";
|
|
6
|
+
import { $isLinkNode } from "@lexical/link";
|
|
7
|
+
import { $isCodeNode } from "@lexical/code";
|
|
8
|
+
import { $getSelectionStyleValueForProperty } from "@lexical/selection";
|
|
9
|
+
import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, } from "@lexical/utils";
|
|
10
|
+
/** The anchor/focus node the selection resolves to, or `null` for a non-range. */
|
|
11
|
+
const getSelectedNode = (selection) => {
|
|
12
|
+
if (!$isRangeSelection(selection))
|
|
13
|
+
return null;
|
|
14
|
+
const anchor = selection.anchor.getNode();
|
|
15
|
+
const focus = selection.focus.getNode();
|
|
16
|
+
return anchor === focus ? anchor : selection.isBackward() ? focus : anchor;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Subscribes to the editor and returns the selection-derived toolbar state.
|
|
20
|
+
* Reads on every selection change and editor update — the single source that
|
|
21
|
+
* every toolbar section renders its active/enabled state from. Extracted from
|
|
22
|
+
* `ToolbarPlugin` so the sections stay presentational.
|
|
23
|
+
*/
|
|
24
|
+
export const useToolbarState = (editor) => {
|
|
25
|
+
const [canUndo, setCanUndo] = useState(false);
|
|
26
|
+
const [canRedo, setCanRedo] = useState(false);
|
|
27
|
+
const [blockType, setBlockType] = useState("paragraph");
|
|
28
|
+
const [selectedElementKey, setSelectedElementKey] = useState(null);
|
|
29
|
+
const [codeLanguage, setCodeLanguage] = useState("");
|
|
30
|
+
const [fontSize, setFontSize] = useState("");
|
|
31
|
+
const [fontFamily, setFontFamily] = useState("");
|
|
32
|
+
const [isBold, setIsBold] = useState(false);
|
|
33
|
+
const [isItalic, setIsItalic] = useState(false);
|
|
34
|
+
const [isUnderline, setIsUnderline] = useState(false);
|
|
35
|
+
const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
36
|
+
const [isCode, setIsCode] = useState(false);
|
|
37
|
+
const [isSuperscript, setIsSuperscript] = useState(false);
|
|
38
|
+
const [isSubscript, setIsSubscript] = useState(false);
|
|
39
|
+
const [isHighlight, setIsHighlight] = useState(false);
|
|
40
|
+
const [elementFormat, setElementFormat] = useState("left");
|
|
41
|
+
const [isLink, setIsLink] = useState(false);
|
|
42
|
+
const $updateToolbar = useCallback(() => {
|
|
43
|
+
const selection = $getSelection();
|
|
44
|
+
if (!$isRangeSelection(selection))
|
|
45
|
+
return;
|
|
46
|
+
setIsBold(selection.hasFormat("bold"));
|
|
47
|
+
setIsItalic(selection.hasFormat("italic"));
|
|
48
|
+
setIsUnderline(selection.hasFormat("underline"));
|
|
49
|
+
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
50
|
+
setIsCode(selection.hasFormat("code"));
|
|
51
|
+
setIsSuperscript(selection.hasFormat("superscript"));
|
|
52
|
+
setIsSubscript(selection.hasFormat("subscript"));
|
|
53
|
+
setIsHighlight(selection.hasFormat("highlight"));
|
|
54
|
+
setFontSize($getSelectionStyleValueForProperty(selection, "font-size", ""));
|
|
55
|
+
setFontFamily($getSelectionStyleValueForProperty(selection, "font-family", ""));
|
|
56
|
+
const node = getSelectedNode(selection);
|
|
57
|
+
if (node) {
|
|
58
|
+
const parent = node.getParent();
|
|
59
|
+
setIsLink($isLinkNode(parent) || $isLinkNode(node));
|
|
60
|
+
}
|
|
61
|
+
const anchorNode = selection.anchor.getNode();
|
|
62
|
+
let element = anchorNode.getKey() === "root"
|
|
63
|
+
? anchorNode
|
|
64
|
+
: $findMatchingParent(anchorNode, (e) => {
|
|
65
|
+
const p = e.getParent();
|
|
66
|
+
return p !== null && $isRootOrShadowRoot(p);
|
|
67
|
+
});
|
|
68
|
+
if (element === null)
|
|
69
|
+
element = anchorNode.getTopLevelElementOrThrow();
|
|
70
|
+
setSelectedElementKey(element.getKey());
|
|
71
|
+
if ($isListNode(element)) {
|
|
72
|
+
const parentList = $getNearestNodeOfType(anchorNode, ListNode);
|
|
73
|
+
const listType = parentList
|
|
74
|
+
? parentList.getListType()
|
|
75
|
+
: element.getListType();
|
|
76
|
+
setBlockType(listType === "bullet"
|
|
77
|
+
? "bullet"
|
|
78
|
+
: listType === "check"
|
|
79
|
+
? "check"
|
|
80
|
+
: "number");
|
|
81
|
+
}
|
|
82
|
+
else if ($isHeadingNode(element)) {
|
|
83
|
+
setBlockType(element.getTag());
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
setBlockType(element.getType());
|
|
87
|
+
if ($isCodeNode(element)) {
|
|
88
|
+
setCodeLanguage(element.getLanguage() || "");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const anchorParent = selection.anchor.getNode().getParent();
|
|
92
|
+
setElementFormat(anchorParent?.getFormatType?.() ?? "left");
|
|
93
|
+
}, []);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
return mergeRegister(editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
96
|
+
$updateToolbar();
|
|
97
|
+
return false;
|
|
98
|
+
}, COMMAND_PRIORITY_CRITICAL), editor.registerCommand(CAN_UNDO_COMMAND, (p) => {
|
|
99
|
+
setCanUndo(p);
|
|
100
|
+
return false;
|
|
101
|
+
}, COMMAND_PRIORITY_CRITICAL), editor.registerCommand(CAN_REDO_COMMAND, (p) => {
|
|
102
|
+
setCanRedo(p);
|
|
103
|
+
return false;
|
|
104
|
+
}, COMMAND_PRIORITY_CRITICAL), editor.registerUpdateListener(({ editorState }) => {
|
|
105
|
+
editorState.read(() => $updateToolbar());
|
|
106
|
+
}));
|
|
107
|
+
}, [editor, $updateToolbar]);
|
|
108
|
+
return {
|
|
109
|
+
canUndo,
|
|
110
|
+
canRedo,
|
|
111
|
+
blockType,
|
|
112
|
+
selectedElementKey,
|
|
113
|
+
codeLanguage,
|
|
114
|
+
fontSize,
|
|
115
|
+
fontFamily,
|
|
116
|
+
isBold,
|
|
117
|
+
isItalic,
|
|
118
|
+
isUnderline,
|
|
119
|
+
isStrikethrough,
|
|
120
|
+
isCode,
|
|
121
|
+
isSuperscript,
|
|
122
|
+
isSubscript,
|
|
123
|
+
isHighlight,
|
|
124
|
+
elementFormat,
|
|
125
|
+
isLink,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=use-toolbar-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toolbar-state.js","sourceRoot":"","sources":["../../../../src/lexical-text-editor/plugins/toolbar/use-toolbar-state.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EAIzB,wBAAwB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,MAAM,gBAAgB,CAAA;AAIvB,kFAAkF;AAClF,MAAM,eAAe,GAAG,CAAC,SAA2C,EAAE,EAAE;IACtE,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,EAA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AAC,CAAC,CAAA;IAE5B,OAAO;QACL,OAAO;QACP,OAAO;QACP,SAAS;QACT,kBAAkB;QAClB,YAAY;QACZ,QAAQ;QACR,UAAU;QACV,MAAM;QACN,QAAQ;QACR,WAAW;QACX,eAAe;QACf,MAAM;QACN,aAAa;QACb,WAAW;QACX,WAAW;QACX,aAAa;QACb,MAAM;KACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rich-text editor toolbar. A thin composition layer: it reads the
|
|
3
|
+
* selection-derived state from {@link useToolbarState}, owns the single
|
|
4
|
+
* open-menu + history-command wiring, and lays out the section components
|
|
5
|
+
* (`toolbar/*`). Each section owns its own commands and internal state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ToolbarPlugin: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=toolbar-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-plugin.d.ts","sourceRoot":"","sources":["../../../src/lexical-text-editor/plugins/toolbar-plugin.tsx"],"names":[],"mappings":"AA4BA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,+CAuHzB,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { $getSelection, $isRangeSelection, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, REDO_COMMAND, UNDO_COMMAND, } from "lexical";
|
|
5
|
+
import { $patchStyleText } from "@lexical/selection";
|
|
6
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
7
|
+
import { Eraser, Indent, Outdent, Redo2, Undo2 } from "lucide-react";
|
|
8
|
+
import { ALL_TEXT_FORMATS } from "./toolbar/constants";
|
|
9
|
+
import { ToolbarButton, ToolbarSeparator } from "./toolbar/primitives";
|
|
10
|
+
import { useToolbarState } from "./toolbar/use-toolbar-state";
|
|
11
|
+
import { useRegisterInsertCommands } from "./toolbar/use-insert-commands";
|
|
12
|
+
import { BlockFormatMenu, CodeLanguageControl, } from "./toolbar/block-format-menu";
|
|
13
|
+
import { InlineMarks } from "./toolbar/inline-marks";
|
|
14
|
+
import { InsertMenu } from "./toolbar/insert-menu";
|
|
15
|
+
import { AlignControls } from "./toolbar/align-menu";
|
|
16
|
+
import { LinkEditor } from "./toolbar/link-editor";
|
|
17
|
+
/**
|
|
18
|
+
* The rich-text editor toolbar. A thin composition layer: it reads the
|
|
19
|
+
* selection-derived state from {@link useToolbarState}, owns the single
|
|
20
|
+
* open-menu + history-command wiring, and lays out the section components
|
|
21
|
+
* (`toolbar/*`). Each section owns its own commands and internal state.
|
|
22
|
+
*/
|
|
23
|
+
export const ToolbarPlugin = () => {
|
|
24
|
+
const [editor] = useLexicalComposerContext();
|
|
25
|
+
const state = useToolbarState(editor);
|
|
26
|
+
useRegisterInsertCommands(editor);
|
|
27
|
+
const [openMenu, setOpenMenu] = useState(null);
|
|
28
|
+
const toggleMenu = useCallback((name) => setOpenMenu((prev) => (prev === name ? null : name)), []);
|
|
29
|
+
const closeMenu = useCallback(() => setOpenMenu(null), []);
|
|
30
|
+
const menu = { openMenu, toggleMenu, closeMenu };
|
|
31
|
+
const clearFormatting = useCallback(() => {
|
|
32
|
+
editor.update(() => {
|
|
33
|
+
const selection = $getSelection();
|
|
34
|
+
if (!$isRangeSelection(selection))
|
|
35
|
+
return;
|
|
36
|
+
ALL_TEXT_FORMATS.forEach((fmt) => {
|
|
37
|
+
if (selection.hasFormat(fmt))
|
|
38
|
+
selection.formatText(fmt);
|
|
39
|
+
});
|
|
40
|
+
$patchStyleText(selection, {
|
|
41
|
+
"font-size": null,
|
|
42
|
+
"font-family": null,
|
|
43
|
+
color: null,
|
|
44
|
+
"background-color": null,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}, [editor]);
|
|
48
|
+
const isCodeBlock = state.blockType === "code";
|
|
49
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border bg-muted/30 px-2 py-1", onMouseDown: (e) => e.preventDefault(), children: [_jsx(ToolbarButton, { title: "Undo (Ctrl+Z)", disabled: !state.canUndo, onClick: () => editor.dispatchCommand(UNDO_COMMAND, undefined), children: _jsx(Undo2, {}) }), _jsx(ToolbarButton, { title: "Redo (Ctrl+Y)", disabled: !state.canRedo, onClick: () => editor.dispatchCommand(REDO_COMMAND, undefined), children: _jsx(Redo2, {}) }), _jsx(ToolbarSeparator, {}), _jsx(BlockFormatMenu, { editor: editor, blockType: state.blockType, menu: menu }), isCodeBlock ? (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(CodeLanguageControl, { editor: editor, language: state.codeLanguage, elementKey: state.selectedElementKey, menu: menu })] })) : (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(InlineMarks, { editor: editor, state: state, menu: menu })] })), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { title: "Clear formatting", onClick: clearFormatting, children: _jsx(Eraser, {}) }), _jsx(ToolbarButton, { title: "Outdent", onClick: () => editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined), children: _jsx(Outdent, {}) }), _jsx(ToolbarButton, { title: "Indent", onClick: () => editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined), children: _jsx(Indent, {}) }), _jsx(ToolbarSeparator, {}), _jsx(InsertMenu, { editor: editor, menu: menu }), _jsx(ToolbarSeparator, {}), _jsx(AlignControls, { editor: editor, elementFormat: state.elementFormat }), _jsx(ToolbarSeparator, {}), _jsx(LinkEditor, { editor: editor, isLink: state.isLink })] }));
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=toolbar-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-plugin.js","sourceRoot":"","sources":["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,sBAAsB,EAAE,SAAS,CAAC,YAG3D,KAAC,MAAM,KAAG,GACI,EAEhB,KAAC,gBAAgB,KAAG,EAGpB,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAI,EAE1C,KAAC,gBAAgB,KAAG,EAGpB,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,GAAI,EAErE,KAAC,gBAAgB,KAAG,EAGpB,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAI,IAChD,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitize an HTML string produced by (or destined for) {@link SmartTextEditor}
|
|
4
|
+
* in `"html"` mode. Strips scripts, event handlers, and unsafe URLs while
|
|
5
|
+
* preserving legitimate editor output unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sanitizeEditorHtml: (html: string) => string;
|
|
8
|
+
/** Props for {@link SafeEditorHtml}. */
|
|
9
|
+
export interface SafeEditorHtmlProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "dangerouslySetInnerHTML"> {
|
|
10
|
+
/** The stored editor HTML to sanitize and render. */
|
|
11
|
+
html: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Render stored {@link SmartTextEditor} HTML safely. Sanitizes with
|
|
15
|
+
* {@link sanitizeEditorHtml} and is the **only** place in the library that uses
|
|
16
|
+
* `dangerouslySetInnerHTML`. Extra props spread onto the wrapping `<div>`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <SafeEditorHtml html={storedHtml} className="prose" />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const SafeEditorHtml: ({ html, ...divProps }: SafeEditorHtmlProps) => React.JSX.Element;
|
|
24
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/lexical-text-editor/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgH9B;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MASjD,CAAA;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,yBAAyB,CAC1B;IACC,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,uBAG5B,mBAAmB,KAAG,KAAK,CAAC,GAAG,CAAC,OAMlC,CAAA"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import DOMPurify from "dompurify";
|
|
3
|
+
/**
|
|
4
|
+
* HTML sanitization for {@link SmartTextEditor}'s `"html"` format.
|
|
5
|
+
*
|
|
6
|
+
* The editor round-trips **raw HTML** — it parses an initial HTML value with
|
|
7
|
+
* `$generateNodesFromDOM` and emits HTML via `$generateHtmlFromNodes`. Any app
|
|
8
|
+
* that persists that HTML and later renders it back is exposed to **stored
|
|
9
|
+
* XSS** unless the HTML is sanitized. This module is the library's answer to
|
|
10
|
+
* that contract:
|
|
11
|
+
*
|
|
12
|
+
* - {@link sanitizeEditorHtml} — a DOMPurify pass with an allow-list scoped to
|
|
13
|
+
* exactly what the editor's node set can produce (headings, lists, links,
|
|
14
|
+
* images, code blocks, tables, `<hr>`/page-break markup, inline formatting).
|
|
15
|
+
* It is applied to **inbound** HTML inside `SmartTextEditor` automatically.
|
|
16
|
+
* - {@link SafeEditorHtml} — a component for rendering stored editor HTML back
|
|
17
|
+
* out. This is the **only** sanctioned `dangerouslySetInnerHTML` site.
|
|
18
|
+
*
|
|
19
|
+
* Links are hardened: every `<a>` is forced to `rel="noopener noreferrer
|
|
20
|
+
* nofollow"` and `target="_blank"`, and `javascript:`/`data:` (non-image) URLs
|
|
21
|
+
* are dropped by DOMPurify's URI policy.
|
|
22
|
+
*/
|
|
23
|
+
/** Tags the editor's node set can emit. Everything else is stripped. */
|
|
24
|
+
const ALLOWED_TAGS = [
|
|
25
|
+
// block text
|
|
26
|
+
"p",
|
|
27
|
+
"br",
|
|
28
|
+
"blockquote",
|
|
29
|
+
"h1",
|
|
30
|
+
"h2",
|
|
31
|
+
"h3",
|
|
32
|
+
"h4",
|
|
33
|
+
"h5",
|
|
34
|
+
"h6",
|
|
35
|
+
// lists (incl. Lexical check lists, which are <li> with classes)
|
|
36
|
+
"ul",
|
|
37
|
+
"ol",
|
|
38
|
+
"li",
|
|
39
|
+
// links
|
|
40
|
+
"a",
|
|
41
|
+
// inline formatting
|
|
42
|
+
"strong",
|
|
43
|
+
"b",
|
|
44
|
+
"em",
|
|
45
|
+
"i",
|
|
46
|
+
"u",
|
|
47
|
+
"s",
|
|
48
|
+
"sub",
|
|
49
|
+
"sup",
|
|
50
|
+
"span",
|
|
51
|
+
"mark",
|
|
52
|
+
// code
|
|
53
|
+
"code",
|
|
54
|
+
"pre",
|
|
55
|
+
// media / rules
|
|
56
|
+
"img",
|
|
57
|
+
"hr",
|
|
58
|
+
// tables
|
|
59
|
+
"table",
|
|
60
|
+
"thead",
|
|
61
|
+
"tbody",
|
|
62
|
+
"tfoot",
|
|
63
|
+
"tr",
|
|
64
|
+
"td",
|
|
65
|
+
"th",
|
|
66
|
+
"colgroup",
|
|
67
|
+
"col",
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Attributes the editor emits. `style`/`class` carry Lexical's formatting
|
|
71
|
+
* (text color, alignment, code-highlight token classes, image `max-width`, the
|
|
72
|
+
* page-break rule). DOMPurify still sanitizes `style` values (drops `url()`
|
|
73
|
+
* javascript / expressions) and the URI policy still guards `href`/`src`.
|
|
74
|
+
*/
|
|
75
|
+
const ALLOWED_ATTR = [
|
|
76
|
+
"href",
|
|
77
|
+
"target",
|
|
78
|
+
"rel",
|
|
79
|
+
"src",
|
|
80
|
+
"alt",
|
|
81
|
+
"title",
|
|
82
|
+
"dir",
|
|
83
|
+
"class",
|
|
84
|
+
"style",
|
|
85
|
+
"colspan",
|
|
86
|
+
"rowspan",
|
|
87
|
+
"width",
|
|
88
|
+
"height",
|
|
89
|
+
"start",
|
|
90
|
+
"type",
|
|
91
|
+
"value",
|
|
92
|
+
"data-lexical-page-break",
|
|
93
|
+
];
|
|
94
|
+
let hookRegistered = false;
|
|
95
|
+
/** Force link hardening once — DOMPurify hooks are process-global. */
|
|
96
|
+
const ensureLinkHardeningHook = () => {
|
|
97
|
+
if (hookRegistered)
|
|
98
|
+
return;
|
|
99
|
+
hookRegistered = true;
|
|
100
|
+
DOMPurify.addHook("afterSanitizeAttributes", (node) => {
|
|
101
|
+
if (node.nodeName === "A" && node instanceof Element) {
|
|
102
|
+
// Only harden real links; DOMPurify has already dropped unsafe hrefs.
|
|
103
|
+
node.setAttribute("rel", "noopener noreferrer nofollow");
|
|
104
|
+
node.setAttribute("target", "_blank");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Sanitize an HTML string produced by (or destined for) {@link SmartTextEditor}
|
|
110
|
+
* in `"html"` mode. Strips scripts, event handlers, and unsafe URLs while
|
|
111
|
+
* preserving legitimate editor output unchanged.
|
|
112
|
+
*/
|
|
113
|
+
export const sanitizeEditorHtml = (html) => {
|
|
114
|
+
ensureLinkHardeningHook();
|
|
115
|
+
return DOMPurify.sanitize(html, {
|
|
116
|
+
ALLOWED_TAGS,
|
|
117
|
+
ALLOWED_ATTR,
|
|
118
|
+
// `<img>` permits `data:` URIs by DOMPurify's default policy (the editor's
|
|
119
|
+
// ImageNode can embed them); `javascript:` stays blocked everywhere.
|
|
120
|
+
ALLOW_DATA_ATTR: false,
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Render stored {@link SmartTextEditor} HTML safely. Sanitizes with
|
|
125
|
+
* {@link sanitizeEditorHtml} and is the **only** place in the library that uses
|
|
126
|
+
* `dangerouslySetInnerHTML`. Extra props spread onto the wrapping `<div>`.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```tsx
|
|
130
|
+
* <SafeEditorHtml html={storedHtml} className="prose" />
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export const SafeEditorHtml = ({ html, ...divProps }) => {
|
|
134
|
+
const clean = React.useMemo(() => sanitizeEditorHtml(html), [html]);
|
|
135
|
+
return React.createElement("div", {
|
|
136
|
+
...divProps,
|
|
137
|
+
dangerouslySetInnerHTML: { __html: clean },
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../src/lexical-text-editor/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wEAAwE;AACxE,MAAM,YAAY,GAAG;IACnB,aAAa;IACb,GAAG;IACH,IAAI;IACJ,YAAY;IACZ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,iEAAiE;IACjE,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,GAAG;IACH,oBAAoB;IACpB,QAAQ;IACR,GAAG;IACH,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,gBAAgB;IAChB,KAAK;I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EAAqB,EAAE;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACnE,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;QAChC,GAAG,QAAQ;QACX,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;KAC3C,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small, dependency-free formatting helpers shared across data-display and
|
|
3
|
+
* dashboard components. Pure functions — straightforward to unit test.
|
|
4
|
+
*/
|
|
5
|
+
/** Format a number with locale-aware grouping (e.g. `1234567` → `"1,234,567"`). */
|
|
6
|
+
export declare const formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string;
|
|
7
|
+
/** Format a number as currency (defaults to USD). */
|
|
8
|
+
export declare const formatCurrency: (value: number, currency?: string, locale?: string) => string;
|
|
9
|
+
/** Compact notation for large numbers (e.g. `12500` → `"12.5K"`). */
|
|
10
|
+
export declare const formatCompact: (value: number) => string;
|
|
11
|
+
/** Format a 0–1 ratio (or arbitrary number) as a percentage string. */
|
|
12
|
+
export declare const formatPercent: (value: number, fractionDigits?: number) => string;
|
|
13
|
+
/** Truncate a string to `maxLength`, appending an ellipsis when shortened. */
|
|
14
|
+
export declare const truncate: (value: string, maxLength: number) => string;
|
|
15
|
+
/** Build initials from a name (e.g. `"Ada Lovelace"` → `"AL"`). */
|
|
16
|
+
export declare const getInitials: (name: string, maxChars?: number) => string;
|
|
17
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mFAAmF;AACnF,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,UAAU,IAAI,CAAC,mBAAmB,KACjC,MAAiE,CAAA;AAEpE,qDAAqD;AACrD,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,iBAAgB,EAChB,SAAS,MAAM,KACd,MAKe,CAAA;AAElB,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAI5B,CAAA;AAElB,uEAAuE;AACvE,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,uBAAkB,KAAG,MAKhD,CAAA;AAElB,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,WAAW,MAAM,KAAG,MAG3D,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,iBAAY,KAAG,MASxD,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small, dependency-free formatting helpers shared across data-display and
|
|
3
|
+
* dashboard components. Pure functions — straightforward to unit test.
|
|
4
|
+
*/
|
|
5
|
+
/** Format a number with locale-aware grouping (e.g. `1234567` → `"1,234,567"`). */
|
|
6
|
+
export const formatNumber = (value, options) => new Intl.NumberFormat(undefined, options).format(value);
|
|
7
|
+
/** Format a number as currency (defaults to USD). */
|
|
8
|
+
export const formatCurrency = (value, currency = "USD", locale) => new Intl.NumberFormat(locale, {
|
|
9
|
+
style: "currency",
|
|
10
|
+
currency,
|
|
11
|
+
maximumFractionDigits: 2,
|
|
12
|
+
}).format(value);
|
|
13
|
+
/** Compact notation for large numbers (e.g. `12500` → `"12.5K"`). */
|
|
14
|
+
export const formatCompact = (value) => new Intl.NumberFormat(undefined, {
|
|
15
|
+
notation: "compact",
|
|
16
|
+
maximumFractionDigits: 1,
|
|
17
|
+
}).format(value);
|
|
18
|
+
/** Format a 0–1 ratio (or arbitrary number) as a percentage string. */
|
|
19
|
+
export const formatPercent = (value, fractionDigits = 1) => new Intl.NumberFormat(undefined, {
|
|
20
|
+
style: "percent",
|
|
21
|
+
minimumFractionDigits: fractionDigits,
|
|
22
|
+
maximumFractionDigits: fractionDigits,
|
|
23
|
+
}).format(value);
|
|
24
|
+
/** Truncate a string to `maxLength`, appending an ellipsis when shortened. */
|
|
25
|
+
export const truncate = (value, maxLength) => {
|
|
26
|
+
if (value.length <= maxLength)
|
|
27
|
+
return value;
|
|
28
|
+
return `${value.slice(0, Math.max(0, maxLength - 1)).trimEnd()}…`;
|
|
29
|
+
};
|
|
30
|
+
/** Build initials from a name (e.g. `"Ada Lovelace"` → `"AL"`). */
|
|
31
|
+
export const getInitials = (name, maxChars = 2) => {
|
|
32
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
33
|
+
if (parts.length === 0)
|
|
34
|
+
return "";
|
|
35
|
+
return parts
|
|
36
|
+
.slice(0, maxChars)
|
|
37
|
+
.map((part) => part.charAt(0).toUpperCase())
|
|
38
|
+
.join("");
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAa,EACb,OAAkC,EAC1B,EAAE,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAEpE,qDAAqD;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAa,EACb,QAAQ,GAAG,KAAK,EAChB,MAAe,EACP,EAAE,CACV,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;IAC5B,KAAK,EAAE,UAAU;IACjB,QAAQ;IACR,qBAAqB,EAAE,CAAC;CACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAElB,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa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AAE,CAAC,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Guard that keeps input-like controls from *starting* with whitespace: the
|
|
4
|
+
* Space key is ignored while the caret sits at the very start of the value
|
|
5
|
+
* (a held, auto-repeating space bar stays blocked because the caret never
|
|
6
|
+
* moves), and leading whitespace that arrives another way — paste, drop,
|
|
7
|
+
* autofill — is stripped before `onChange` sees it. Once a real first
|
|
8
|
+
* character exists, spaces behave normally.
|
|
9
|
+
*/
|
|
10
|
+
type TextControl = HTMLInputElement | HTMLTextAreaElement;
|
|
11
|
+
export interface LeadingSpaceGuardHandlers<T extends TextControl> {
|
|
12
|
+
onKeyDown?: React.KeyboardEventHandler<T>;
|
|
13
|
+
onChange?: React.ChangeEventHandler<T>;
|
|
14
|
+
}
|
|
15
|
+
/** Removes the leading whitespace a guarded value may not begin with. */
|
|
16
|
+
export declare const stripLeadingSpaces: (value: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Wraps a control's `onKeyDown`/`onChange` with the leading-space guard.
|
|
19
|
+
* Pass `allowLeadingSpace: true` to opt out — the handlers are returned
|
|
20
|
+
* untouched.
|
|
21
|
+
*
|
|
22
|
+
* Note: input types without selection support (`email`, `number`) report the
|
|
23
|
+
* caret as `null`, which the guard treats as position 0 — every space is
|
|
24
|
+
* blocked there, matching what those types accept anyway.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withLeadingSpaceGuard<T extends TextControl>({ onKeyDown, onChange }: LeadingSpaceGuardHandlers<T>, allowLeadingSpace?: boolean): LeadingSpaceGuardHandlers<T>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=leading-space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leading-space.d.ts","sourceRoot":"","sources":["../../src/lib/leading-space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC;;;;;;;GAOG;AAEH,KAAK,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AAEzD,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,WAAW;IAC9D,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAA;CACvC;AAED,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,WAA8B,CAAA;AAE9E;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,WAAW,EACzD,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,yBAAyB,CAAC,CAAC,CAAC,EACrD,iBAAiB,CAAC,EAAE,OAAO,GAC1B,yBAAyB,CAAC,CAAC,CAAC,CAoB9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Removes the leading whitespace a guarded value may not begin with. */
|
|
2
|
+
export const stripLeadingSpaces = (value) => value.replace(/^\s+/, "");
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a control's `onKeyDown`/`onChange` with the leading-space guard.
|
|
5
|
+
* Pass `allowLeadingSpace: true` to opt out — the handlers are returned
|
|
6
|
+
* untouched.
|
|
7
|
+
*
|
|
8
|
+
* Note: input types without selection support (`email`, `number`) report the
|
|
9
|
+
* caret as `null`, which the guard treats as position 0 — every space is
|
|
10
|
+
* blocked there, matching what those types accept anyway.
|
|
11
|
+
*/
|
|
12
|
+
export function withLeadingSpaceGuard({ onKeyDown, onChange }, allowLeadingSpace) {
|
|
13
|
+
if (allowLeadingSpace)
|
|
14
|
+
return { onKeyDown, onChange };
|
|
15
|
+
return {
|
|
16
|
+
onKeyDown: (e) => {
|
|
17
|
+
// Block only when the space would become the first character: the caret
|
|
18
|
+
// (or the start of a selection about to be replaced) is at position 0.
|
|
19
|
+
if (e.key === " " && (e.currentTarget.selectionStart ?? 0) === 0) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onKeyDown?.(e);
|
|
24
|
+
},
|
|
25
|
+
onChange: (e) => {
|
|
26
|
+
const value = e.currentTarget.value;
|
|
27
|
+
const stripped = stripLeadingSpaces(value);
|
|
28
|
+
if (stripped !== value)
|
|
29
|
+
e.currentTarget.value = stripped;
|
|
30
|
+
onChange?.(e);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=leading-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leading-space.js","sourceRoot":"","sources":["../../src/lib/leading-space.ts"],"names":[],"mappings":"AAkBA,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,EAAE,SAAS,EAAE,QAAQ,EAAgC,EACrD,iBAA2B;IAE3B,IAAI,iBAAiB;QAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;IAErD,OAAO;QACL,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACf,wEAAwE;YACxE,uEAAuE;YACvE,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,cAAc,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjE,CAAC,CAAC,cAAc,EAAE,CAAA;gBAClB,OAAM;YACR,CAAC;YACD,SAAS,EAAE,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;QACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,KAAK,CAAA;YACnC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAA;YAC1C,IAAI,QAAQ,KAAK,KAAK;gBAAE,CAAC,CAAC,aAAa,CAAC,KAAK,GAAG,QAAQ,CAAA;YACxD,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C,eAAO,MAAM,EAAE,GAAI,GAAG,QAAQ,UAAU,EAAE,WAA0B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA"}
|