@fastsprout/reacd-shadcn 0.0.0-stage → 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/LICENSE +201 -0
- package/README.md +28 -2
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/dist/accordion/accordion.adapter.d.ts +2 -0
- package/dist/accordion/accordion.adapter.js +10 -0
- package/dist/action-menu/menu-content.d.ts +5 -0
- package/dist/action-menu/menu-content.js +15 -0
- package/dist/action-menu/menu-items.d.ts +5 -0
- package/dist/action-menu/menu-items.js +46 -0
- package/dist/action-menu/menu-surface.d.ts +7 -0
- package/dist/action-menu/menu-surface.js +15 -0
- package/dist/action-menu/use-menu-frame.d.ts +8 -0
- package/dist/action-menu/use-menu-frame.js +24 -0
- package/dist/alert/alert.adapter.d.ts +2 -0
- package/dist/alert/alert.adapter.js +13 -0
- package/dist/app/app.adapter.d.ts +2 -0
- package/dist/app/app.adapter.js +7 -0
- package/dist/auth-form/auth-form.adapter.d.ts +2 -0
- package/dist/auth-form/auth-form.adapter.js +21 -0
- package/dist/avatar/avatar.adapter.d.ts +2 -0
- package/dist/avatar/avatar.adapter.js +8 -0
- package/dist/avatar-group/avatar-group.adapter.d.ts +2 -0
- package/dist/avatar-group/avatar-group.adapter.js +9 -0
- package/dist/avatar-group/overflow.adapter.d.ts +5 -0
- package/dist/avatar-group/overflow.adapter.js +5 -0
- package/dist/badge/badge.adapter.d.ts +2 -0
- package/dist/badge/badge.adapter.js +9 -0
- package/dist/banner/banner.adapter.d.ts +2 -0
- package/dist/banner/banner.adapter.js +12 -0
- package/dist/blog-post/blog-post.adapter.d.ts +3 -0
- package/dist/blog-post/blog-post.adapter.js +5 -0
- package/dist/blog-posts/blog-posts.adapter.d.ts +3 -0
- package/dist/blog-posts/blog-posts.adapter.js +7 -0
- package/dist/breadcrumb/breadcrumb.adapter.d.ts +2 -0
- package/dist/breadcrumb/breadcrumb.adapter.js +13 -0
- package/dist/button/button.adapter.d.ts +2 -0
- package/dist/button/button.adapter.js +8 -0
- package/dist/calendar/calendar-date.d.ts +7 -0
- package/dist/calendar/calendar-date.js +24 -0
- package/dist/calendar/calendar-day-button.d.ts +2 -0
- package/dist/calendar/calendar-day-button.js +9 -0
- package/dist/calendar/calendar-form-bridge.d.ts +6 -0
- package/dist/calendar/calendar-form-bridge.js +11 -0
- package/dist/calendar/calendar-localization.d.ts +15 -0
- package/dist/calendar/calendar-localization.js +28 -0
- package/dist/calendar/calendar.adapter.d.ts +2 -0
- package/dist/calendar/calendar.adapter.js +47 -0
- package/dist/card/card.adapter.d.ts +2 -0
- package/dist/card/card.adapter.js +13 -0
- package/dist/carousel/carousel-panel.d.ts +7 -0
- package/dist/carousel/carousel-panel.js +8 -0
- package/dist/carousel/carousel.adapter.d.ts +2 -0
- package/dist/carousel/carousel.adapter.js +43 -0
- package/dist/carousel/focus-boundary.d.ts +16 -0
- package/dist/carousel/focus-boundary.js +19 -0
- package/dist/changelog-version/changelog-version.adapter.d.ts +3 -0
- package/dist/changelog-version/changelog-version.adapter.js +5 -0
- package/dist/changelog-versions/changelog-versions.adapter.d.ts +3 -0
- package/dist/changelog-versions/changelog-versions.adapter.js +8 -0
- package/dist/chart/cartesian.d.ts +5 -0
- package/dist/chart/cartesian.js +15 -0
- package/dist/chart/chart-graphic.d.ts +2 -0
- package/dist/chart/chart-graphic.js +14 -0
- package/dist/chart/chart-table.d.ts +2 -0
- package/dist/chart/chart-table.js +6 -0
- package/dist/chart/chart.adapter.d.ts +2 -0
- package/dist/chart/chart.adapter.js +17 -0
- package/dist/chart/legend.d.ts +3 -0
- package/dist/chart/legend.js +14 -0
- package/dist/chart/patterns.d.ts +9 -0
- package/dist/chart/patterns.js +8 -0
- package/dist/chat-attachment/chat-attachment.adapter.d.ts +2 -0
- package/dist/chat-attachment/chat-attachment.adapter.js +12 -0
- package/dist/chat-disclosure/chat-disclosure.d.ts +9 -0
- package/dist/chat-disclosure/chat-disclosure.js +10 -0
- package/dist/chat-message/chat-message.adapter.d.ts +2 -0
- package/dist/chat-message/chat-message.adapter.js +12 -0
- package/dist/chat-messages/chat-messages.adapter.d.ts +2 -0
- package/dist/chat-messages/chat-messages.adapter.js +13 -0
- package/dist/chat-messages/use-follow-latest.d.ts +6 -0
- package/dist/chat-messages/use-follow-latest.js +33 -0
- package/dist/chat-palette/chat-palette.adapter.d.ts +2 -0
- package/dist/chat-palette/chat-palette.adapter.js +4 -0
- package/dist/chat-prompt/chat-prompt.adapter.d.ts +2 -0
- package/dist/chat-prompt/chat-prompt.adapter.js +30 -0
- package/dist/chat-prompt/use-prompt-controls.d.ts +22 -0
- package/dist/chat-prompt/use-prompt-controls.js +69 -0
- package/dist/chat-prompt/use-prompt-escape.d.ts +5 -0
- package/dist/chat-prompt/use-prompt-escape.js +39 -0
- package/dist/chat-prompt-submit/chat-prompt-submit.adapter.d.ts +2 -0
- package/dist/chat-prompt-submit/chat-prompt-submit.adapter.js +14 -0
- package/dist/chat-prompt-submit/prompt-action.d.ts +12 -0
- package/dist/chat-prompt-submit/prompt-action.js +45 -0
- package/dist/chat-reasoning/chat-reasoning.adapter.d.ts +2 -0
- package/dist/chat-reasoning/chat-reasoning.adapter.js +15 -0
- package/dist/chat-reasoning/use-reasoning-disclosure.d.ts +10 -0
- package/dist/chat-reasoning/use-reasoning-disclosure.js +23 -0
- package/dist/chat-shimmer/chat-shimmer.adapter.d.ts +2 -0
- package/dist/chat-shimmer/chat-shimmer.adapter.js +5 -0
- package/dist/chat-tool/chat-tool.adapter.d.ts +2 -0
- package/dist/chat-tool/chat-tool.adapter.js +7 -0
- package/dist/checkbox/checkbox.adapter.d.ts +2 -0
- package/dist/checkbox/checkbox.adapter.js +27 -0
- package/dist/checkbox-group/checkbox-group.adapter.d.ts +2 -0
- package/dist/checkbox-group/checkbox-group.adapter.js +18 -0
- package/dist/chip/chip.adapter.d.ts +2 -0
- package/dist/chip/chip.adapter.js +12 -0
- package/dist/code-editor/code-editor.adapter.d.ts +2 -0
- package/dist/code-editor/code-editor.adapter.js +9 -0
- package/dist/collapsible/collapsible.adapter.d.ts +2 -0
- package/dist/collapsible/collapsible.adapter.js +11 -0
- package/dist/color-mode-avatar/color-mode-avatar.adapter.d.ts +2 -0
- package/dist/color-mode-avatar/color-mode-avatar.adapter.js +6 -0
- package/dist/color-mode-button/color-mode-button.adapter.d.ts +2 -0
- package/dist/color-mode-button/color-mode-button.adapter.js +11 -0
- package/dist/color-mode-image/color-mode-image.adapter.d.ts +2 -0
- package/dist/color-mode-image/color-mode-image.adapter.js +6 -0
- package/dist/color-mode-image/mode-image.d.ts +4 -0
- package/dist/color-mode-image/mode-image.js +8 -0
- package/dist/color-mode-select/color-mode-select.adapter.d.ts +2 -0
- package/dist/color-mode-select/color-mode-select.adapter.js +16 -0
- package/dist/color-mode-switch/color-mode-switch.adapter.d.ts +2 -0
- package/dist/color-mode-switch/color-mode-switch.adapter.js +5 -0
- package/dist/color-picker/color-hex.d.ts +11 -0
- package/dist/color-picker/color-hex.js +57 -0
- package/dist/color-picker/color-picker.adapter.d.ts +2 -0
- package/dist/color-picker/color-picker.adapter.js +20 -0
- package/dist/color-picker/use-color-model.d.ts +6 -0
- package/dist/color-picker/use-color-model.js +18 -0
- package/dist/command-palette/command-palette.adapter.d.ts +2 -0
- package/dist/command-palette/command-palette.adapter.js +44 -0
- package/dist/container/container.adapter.d.ts +2 -0
- package/dist/container/container.adapter.js +4 -0
- package/dist/content-navigation/content-navigation.adapter.d.ts +2 -0
- package/dist/content-navigation/content-navigation.adapter.js +10 -0
- package/dist/content-search/content-search.adapter.d.ts +2 -0
- package/dist/content-search/content-search.adapter.js +27 -0
- package/dist/content-search-button/content-search-button.adapter.d.ts +2 -0
- package/dist/content-search-button/content-search-button.adapter.js +6 -0
- package/dist/content-surround/content-surround.adapter.d.ts +2 -0
- package/dist/content-surround/content-surround.adapter.js +14 -0
- package/dist/content-toc/content-toc.adapter.d.ts +2 -0
- package/dist/content-toc/content-toc.adapter.js +10 -0
- package/dist/context-menu/context-menu.adapter.d.ts +2 -0
- package/dist/context-menu/context-menu.adapter.js +13 -0
- package/dist/context-menu/keyboard-trigger.d.ts +2 -0
- package/dist/context-menu/keyboard-trigger.js +13 -0
- package/dist/dashboard-group/dashboard-group.adapter.d.ts +3 -0
- package/dist/dashboard-group/dashboard-group.adapter.js +54 -0
- package/dist/dashboard-navbar/dashboard-navbar.adapter.d.ts +2 -0
- package/dist/dashboard-navbar/dashboard-navbar.adapter.js +12 -0
- package/dist/dashboard-panel/dashboard-panel.adapter.d.ts +2 -0
- package/dist/dashboard-panel/dashboard-panel.adapter.js +18 -0
- package/dist/dashboard-resize-handle/dashboard-resize-handle.adapter.d.ts +2 -0
- package/dist/dashboard-resize-handle/dashboard-resize-handle.adapter.js +46 -0
- package/dist/dashboard-search/dashboard-search.adapter.d.ts +2 -0
- package/dist/dashboard-search/dashboard-search.adapter.js +24 -0
- package/dist/dashboard-search-button/dashboard-search-button.adapter.d.ts +2 -0
- package/dist/dashboard-search-button/dashboard-search-button.adapter.js +6 -0
- package/dist/dashboard-sidebar/dashboard-sidebar.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar/dashboard-sidebar.adapter.js +19 -0
- package/dist/dashboard-sidebar-collapse/dashboard-sidebar-collapse.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar-collapse/dashboard-sidebar-collapse.adapter.js +22 -0
- package/dist/dashboard-sidebar-toggle/dashboard-sidebar-toggle.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar-toggle/dashboard-sidebar-toggle.adapter.js +22 -0
- package/dist/dashboard-toolbar/dashboard-toolbar.adapter.d.ts +2 -0
- package/dist/dashboard-toolbar/dashboard-toolbar.adapter.js +4 -0
- package/dist/data-table/data-table.adapter.d.ts +2 -0
- package/dist/data-table/data-table.adapter.js +28 -0
- package/dist/data-table/filters.adapter.d.ts +8 -0
- package/dist/data-table/filters.adapter.js +40 -0
- package/dist/data-table/pagination.adapter.d.ts +2 -0
- package/dist/data-table/pagination.adapter.js +21 -0
- package/dist/divider/divider.adapter.d.ts +1 -0
- package/dist/divider/divider.adapter.js +5 -0
- package/dist/drawer/drawer.adapter.d.ts +2 -0
- package/dist/drawer/drawer.adapter.js +14 -0
- package/dist/dropdown-menu/dropdown-menu.adapter.d.ts +2 -0
- package/dist/dropdown-menu/dropdown-menu.adapter.js +14 -0
- package/dist/editor/drag-session.d.ts +7 -0
- package/dist/editor/drag-session.js +41 -0
- package/dist/editor/editor.adapter.d.ts +2 -0
- package/dist/editor/editor.adapter.js +21 -0
- package/dist/editor/publish-edit.d.ts +3 -0
- package/dist/editor/publish-edit.js +12 -0
- package/dist/editor/use-editor-port.d.ts +5 -0
- package/dist/editor/use-editor-port.js +40 -0
- package/dist/editor/use-editor-session.d.ts +14 -0
- package/dist/editor/use-editor-session.js +198 -0
- package/dist/editor-conversion/attribute.d.ts +3 -0
- package/dist/editor-conversion/attribute.js +3 -0
- package/dist/editor-conversion/budget.d.ts +2 -0
- package/dist/editor-conversion/budget.js +61 -0
- package/dist/editor-conversion/from-sdk-block.d.ts +5 -0
- package/dist/editor-conversion/from-sdk-block.js +73 -0
- package/dist/editor-conversion/from-sdk-inline.d.ts +3 -0
- package/dist/editor-conversion/from-sdk-inline.js +57 -0
- package/dist/editor-conversion/from-sdk.d.ts +4 -0
- package/dist/editor-conversion/from-sdk.js +35 -0
- package/dist/editor-conversion/id-allocator.d.ts +2 -0
- package/dist/editor-conversion/id-allocator.js +29 -0
- package/dist/editor-conversion/projection-weight.d.ts +8 -0
- package/dist/editor-conversion/projection-weight.js +124 -0
- package/dist/editor-conversion/text-chunks.d.ts +6 -0
- package/dist/editor-conversion/text-chunks.js +18 -0
- package/dist/editor-conversion/to-sdk.d.ts +3 -0
- package/dist/editor-conversion/to-sdk.js +58 -0
- package/dist/editor-drag-handle/editor-drag-handle.adapter.d.ts +2 -0
- package/dist/editor-drag-handle/editor-drag-handle.adapter.js +54 -0
- package/dist/editor-drag-handle/use-drag-session.d.ts +9 -0
- package/dist/editor-drag-handle/use-drag-session.js +22 -0
- package/dist/editor-emoji-menu/editor-emoji-menu.adapter.d.ts +2 -0
- package/dist/editor-emoji-menu/editor-emoji-menu.adapter.js +9 -0
- package/dist/editor-mention-menu/editor-mention-menu.adapter.d.ts +2 -0
- package/dist/editor-mention-menu/editor-mention-menu.adapter.js +17 -0
- package/dist/editor-menu/lookup-controller.d.ts +24 -0
- package/dist/editor-menu/lookup-controller.js +83 -0
- package/dist/editor-menu/menu-panel.d.ts +10 -0
- package/dist/editor-menu/menu-panel.js +17 -0
- package/dist/editor-menu/menu-plugin.d.ts +3 -0
- package/dist/editor-menu/menu-plugin.js +190 -0
- package/dist/editor-menu/menu-port.d.ts +3 -0
- package/dist/editor-menu/menu-port.js +27 -0
- package/dist/editor-menu/menu-store.d.ts +20 -0
- package/dist/editor-menu/menu-store.js +92 -0
- package/dist/editor-menu/use-editor-menu.d.ts +9 -0
- package/dist/editor-menu/use-editor-menu.js +21 -0
- package/dist/editor-sdk/apply-paste.d.ts +3 -0
- package/dist/editor-sdk/apply-paste.js +12 -0
- package/dist/editor-sdk/atom-data.d.ts +7 -0
- package/dist/editor-sdk/atom-data.js +41 -0
- package/dist/editor-sdk/atoms.d.ts +3 -0
- package/dist/editor-sdk/atoms.js +25 -0
- package/dist/editor-sdk/block-types.d.ts +1 -0
- package/dist/editor-sdk/block-types.js +10 -0
- package/dist/editor-sdk/command-chain.d.ts +3 -0
- package/dist/editor-sdk/command-chain.js +25 -0
- package/dist/editor-sdk/commands.d.ts +5 -0
- package/dist/editor-sdk/commands.js +38 -0
- package/dist/editor-sdk/controlled-selection.d.ts +2 -0
- package/dist/editor-sdk/controlled-selection.js +8 -0
- package/dist/editor-sdk/extensions.d.ts +2 -0
- package/dist/editor-sdk/extensions.js +21 -0
- package/dist/editor-sdk/identity-plugin.d.ts +18 -0
- package/dist/editor-sdk/identity-plugin.js +107 -0
- package/dist/editor-sdk/identity.d.ts +3 -0
- package/dist/editor-sdk/identity.js +28 -0
- package/dist/editor-sdk/plain-paste.d.ts +3 -0
- package/dist/editor-sdk/plain-paste.js +66 -0
- package/dist/editor-sdk/resources.d.ts +5 -0
- package/dist/editor-sdk/resources.js +14 -0
- package/dist/editor-sdk/select-block.d.ts +2 -0
- package/dist/editor-sdk/select-block.js +31 -0
- package/dist/editor-sdk/selection-mapping.d.ts +9 -0
- package/dist/editor-sdk/selection-mapping.js +92 -0
- package/dist/editor-sdk/structural-selection.d.ts +4 -0
- package/dist/editor-sdk/structural-selection.js +21 -0
- package/dist/editor-suggestion-menu/editor-suggestion-menu.adapter.d.ts +2 -0
- package/dist/editor-suggestion-menu/editor-suggestion-menu.adapter.js +13 -0
- package/dist/editor-toolbar/editor-toolbar.adapter.d.ts +2 -0
- package/dist/editor-toolbar/editor-toolbar.adapter.js +38 -0
- package/dist/element/variants.d.ts +5 -0
- package/dist/element/variants.js +5 -0
- package/dist/empty/empty.adapter.d.ts +2 -0
- package/dist/empty/empty.adapter.js +10 -0
- package/dist/error/error.adapter.d.ts +2 -0
- package/dist/error/error.adapter.js +9 -0
- package/dist/field-group/field-group.adapter.d.ts +2 -0
- package/dist/field-group/field-group.adapter.js +5 -0
- package/dist/file-upload/file-upload.adapter.d.ts +2 -0
- package/dist/file-upload/file-upload.adapter.js +60 -0
- package/dist/file-upload/intake-validation.d.ts +8 -0
- package/dist/file-upload/intake-validation.js +48 -0
- package/dist/file-upload/intake.d.ts +36 -0
- package/dist/file-upload/intake.js +112 -0
- package/dist/file-upload/read-file.d.ts +5 -0
- package/dist/file-upload/read-file.js +32 -0
- package/dist/footer/footer.adapter.d.ts +2 -0
- package/dist/footer/footer.adapter.js +4 -0
- package/dist/footer-columns/footer-columns.adapter.d.ts +2 -0
- package/dist/footer-columns/footer-columns.adapter.js +8 -0
- package/dist/form-field/focus-control.d.ts +1 -0
- package/dist/form-field/focus-control.js +21 -0
- package/dist/form-field/form-field.adapter.d.ts +2 -0
- package/dist/form-field/form-field.adapter.js +22 -0
- package/dist/form-menu-shared/request.d.ts +4 -0
- package/dist/form-menu-shared/request.js +14 -0
- package/dist/grid/grid.adapter.d.ts +2 -0
- package/dist/grid/grid.adapter.js +5 -0
- package/dist/h-stack/h-stack.adapter.d.ts +2 -0
- package/dist/h-stack/h-stack.adapter.js +5 -0
- package/dist/header/header-menu.d.ts +7 -0
- package/dist/header/header-menu.js +25 -0
- package/dist/header/header.adapter.d.ts +2 -0
- package/dist/header/header.adapter.js +5 -0
- package/dist/icon/icon-map.d.ts +16 -0
- package/dist/icon/icon-map.js +17 -0
- package/dist/icon/icon.adapter.d.ts +2 -0
- package/dist/icon/icon.adapter.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input/input.adapter.d.ts +2 -0
- package/dist/input/input.adapter.js +34 -0
- package/dist/input/validation-message.d.ts +1 -0
- package/dist/input/validation-message.js +13 -0
- package/dist/input-date/date-control.d.ts +16 -0
- package/dist/input-date/date-control.js +35 -0
- package/dist/input-date/input-date.adapter.d.ts +2 -0
- package/dist/input-date/input-date.adapter.js +36 -0
- package/dist/input-menu/input-menu-form.d.ts +7 -0
- package/dist/input-menu/input-menu-form.js +8 -0
- package/dist/input-menu/input-menu-popup.d.ts +8 -0
- package/dist/input-menu/input-menu-popup.js +13 -0
- package/dist/input-menu/input-menu.adapter.d.ts +2 -0
- package/dist/input-menu/input-menu.adapter.js +74 -0
- package/dist/input-menu/use-input-menu.d.ts +26 -0
- package/dist/input-menu/use-input-menu.js +92 -0
- package/dist/input-number/input-number.adapter.d.ts +2 -0
- package/dist/input-number/input-number.adapter.js +13 -0
- package/dist/input-rating/input-rating.adapter.d.ts +2 -0
- package/dist/input-rating/input-rating.adapter.js +33 -0
- package/dist/input-rating/rating-stars.d.ts +4 -0
- package/dist/input-rating/rating-stars.js +9 -0
- package/dist/input-tags/input-tags.adapter.d.ts +2 -0
- package/dist/input-tags/input-tags.adapter.js +47 -0
- package/dist/input-tags/use-tag-draft.d.ts +9 -0
- package/dist/input-tags/use-tag-draft.js +43 -0
- package/dist/input-time/anchored-time.d.ts +1 -0
- package/dist/input-time/anchored-time.js +5 -0
- package/dist/input-time/draft-validation.d.ts +1 -0
- package/dist/input-time/draft-validation.js +1 -0
- package/dist/input-time/focus-draft.d.ts +1 -0
- package/dist/input-time/focus-draft.js +1 -0
- package/dist/input-time/input-time.adapter.d.ts +2 -0
- package/dist/input-time/input-time.adapter.js +32 -0
- package/dist/input-time/time-control.d.ts +15 -0
- package/dist/input-time/time-control.js +37 -0
- package/dist/input-time/use-time-change.d.ts +10 -0
- package/dist/input-time/use-time-change.js +4 -0
- package/dist/kbd/kbd-key.adapter.d.ts +5 -0
- package/dist/kbd/kbd-key.adapter.js +5 -0
- package/dist/kbd/kbd.adapter.d.ts +2 -0
- package/dist/kbd/kbd.adapter.js +8 -0
- package/dist/listbox/clear-focus.d.ts +1 -0
- package/dist/listbox/clear-focus.js +8 -0
- package/dist/listbox/form-bridge.d.ts +14 -0
- package/dist/listbox/form-bridge.js +34 -0
- package/dist/listbox/listbox.adapter.d.ts +2 -0
- package/dist/listbox/listbox.adapter.js +79 -0
- package/dist/listbox/native-semantics.d.ts +9 -0
- package/dist/listbox/native-semantics.js +33 -0
- package/dist/listbox/selection.d.ts +4 -0
- package/dist/listbox/selection.js +31 -0
- package/dist/listbox/use-listbox-request.d.ts +10 -0
- package/dist/listbox/use-listbox-request.js +73 -0
- package/dist/locale-select/locale-select.adapter.d.ts +2 -0
- package/dist/locale-select/locale-select.adapter.js +15 -0
- package/dist/main/main.adapter.d.ts +2 -0
- package/dist/main/main.adapter.js +7 -0
- package/dist/marquee/marquee.adapter.d.ts +2 -0
- package/dist/marquee/marquee.adapter.js +23 -0
- package/dist/modal/modal.adapter.d.ts +2 -0
- package/dist/modal/modal.adapter.js +30 -0
- package/dist/navigation/navigation.adapter.d.ts +2 -0
- package/dist/navigation/navigation.adapter.js +5 -0
- package/dist/navigation-menu/menu-target.d.ts +4 -0
- package/dist/navigation-menu/menu-target.js +13 -0
- package/dist/navigation-menu/navigation-menu.adapter.d.ts +2 -0
- package/dist/navigation-menu/navigation-menu.adapter.js +16 -0
- package/dist/page-anchors/page-anchors.adapter.d.ts +3 -0
- package/dist/page-anchors/page-anchors.adapter.js +5 -0
- package/dist/page-aside/page-aside.adapter.d.ts +2 -0
- package/dist/page-aside/page-aside.adapter.js +6 -0
- package/dist/page-body/page-body.adapter.d.ts +2 -0
- package/dist/page-body/page-body.adapter.js +4 -0
- package/dist/page-card/page-card.adapter.d.ts +3 -0
- package/dist/page-card/page-card.adapter.js +5 -0
- package/dist/page-columns/page-columns.adapter.d.ts +2 -0
- package/dist/page-columns/page-columns.adapter.js +5 -0
- package/dist/page-cta/page-cta.adapter.d.ts +3 -0
- package/dist/page-cta/page-cta.adapter.js +5 -0
- package/dist/page-feature/page-feature.adapter.d.ts +3 -0
- package/dist/page-feature/page-feature.adapter.js +6 -0
- package/dist/page-grid/page-grid.adapter.d.ts +2 -0
- package/dist/page-grid/page-grid.adapter.js +4 -0
- package/dist/page-header/page-header.adapter.d.ts +3 -0
- package/dist/page-header/page-header.adapter.js +5 -0
- package/dist/page-hero/page-hero.adapter.d.ts +3 -0
- package/dist/page-hero/page-hero.adapter.js +5 -0
- package/dist/page-links/page-links.adapter.d.ts +3 -0
- package/dist/page-links/page-links.adapter.js +5 -0
- package/dist/page-list/page-list.adapter.d.ts +2 -0
- package/dist/page-list/page-list.adapter.js +6 -0
- package/dist/page-logos/page-logos.adapter.d.ts +2 -0
- package/dist/page-logos/page-logos.adapter.js +11 -0
- package/dist/page-section/page-section.adapter.d.ts +3 -0
- package/dist/page-section/page-section.adapter.js +5 -0
- package/dist/pagination/pagination-control.d.ts +13 -0
- package/dist/pagination/pagination-control.js +31 -0
- package/dist/pagination/pagination.adapter.d.ts +2 -0
- package/dist/pagination/pagination.adapter.js +23 -0
- package/dist/panel/use-panel-frame.d.ts +15 -0
- package/dist/panel/use-panel-frame.js +36 -0
- package/dist/pin-input/pin-input.adapter.d.ts +2 -0
- package/dist/pin-input/pin-input.adapter.js +18 -0
- package/dist/pin-input/pin-slots.d.ts +6 -0
- package/dist/pin-input/pin-slots.js +9 -0
- package/dist/popover/popover.adapter.d.ts +2 -0
- package/dist/popover/popover.adapter.js +55 -0
- package/dist/pricing-plan/pricing-plan.adapter.d.ts +3 -0
- package/dist/pricing-plan/pricing-plan.adapter.js +15 -0
- package/dist/pricing-plans/pricing-plans.adapter.d.ts +3 -0
- package/dist/pricing-plans/pricing-plans.adapter.js +8 -0
- package/dist/pricing-table/pricing-table.adapter.d.ts +3 -0
- package/dist/pricing-table/pricing-table.adapter.js +9 -0
- package/dist/progress/progress.adapter.d.ts +2 -0
- package/dist/progress/progress.adapter.js +10 -0
- package/dist/progress-group/progress-group.adapter.d.ts +2 -0
- package/dist/progress-group/progress-group.adapter.js +9 -0
- package/dist/radio-group/radio-group.adapter.d.ts +2 -0
- package/dist/radio-group/radio-group.adapter.js +14 -0
- package/dist/registry/action-menus.d.ts +4 -0
- package/dist/registry/action-menus.js +9 -0
- package/dist/registry/auth-form.d.ts +3 -0
- package/dist/registry/auth-form.js +6 -0
- package/dist/registry/calendar.d.ts +3 -0
- package/dist/registry/calendar.js +6 -0
- package/dist/registry/carousel.d.ts +3 -0
- package/dist/registry/carousel.js +6 -0
- package/dist/registry/chart.d.ts +3 -0
- package/dist/registry/chart.js +4 -0
- package/dist/registry/chat-composer.d.ts +5 -0
- package/dist/registry/chat-composer.js +12 -0
- package/dist/registry/chat-feedback.d.ts +5 -0
- package/dist/registry/chat-feedback.js +12 -0
- package/dist/registry/chat.d.ts +5 -0
- package/dist/registry/chat.js +12 -0
- package/dist/registry/color-mode.d.ts +7 -0
- package/dist/registry/color-mode.js +18 -0
- package/dist/registry/color-picker.d.ts +3 -0
- package/dist/registry/color-picker.js +6 -0
- package/dist/registry/command-palette.d.ts +3 -0
- package/dist/registry/command-palette.js +6 -0
- package/dist/registry/content-outline.d.ts +4 -0
- package/dist/registry/content-outline.js +9 -0
- package/dist/registry/content-search.d.ts +4 -0
- package/dist/registry/content-search.js +9 -0
- package/dist/registry/content.d.ts +26 -0
- package/dist/registry/content.js +75 -0
- package/dist/registry/dashboard.d.ts +12 -0
- package/dist/registry/dashboard.js +33 -0
- package/dist/registry/edge-panels.d.ts +4 -0
- package/dist/registry/edge-panels.js +9 -0
- package/dist/registry/editor-drag-handle.d.ts +3 -0
- package/dist/registry/editor-drag-handle.js +6 -0
- package/dist/registry/editor-menus.d.ts +5 -0
- package/dist/registry/editor-menus.js +12 -0
- package/dist/registry/editor.d.ts +4 -0
- package/dist/registry/editor.js +9 -0
- package/dist/registry/editorial.d.ts +6 -0
- package/dist/registry/editorial.js +15 -0
- package/dist/registry/element.d.ts +3 -0
- package/dist/registry/element.js +4 -0
- package/dist/registry/feedback.d.ts +8 -0
- package/dist/registry/feedback.js +21 -0
- package/dist/registry/fields.d.ts +24 -0
- package/dist/registry/fields.js +69 -0
- package/dist/registry/file-upload.d.ts +3 -0
- package/dist/registry/file-upload.js +6 -0
- package/dist/registry/listbox.d.ts +3 -0
- package/dist/registry/listbox.js +6 -0
- package/dist/registry/marquee.d.ts +3 -0
- package/dist/registry/marquee.js +6 -0
- package/dist/registry/navigation-composition.d.ts +5 -0
- package/dist/registry/navigation-composition.js +12 -0
- package/dist/registry/page-composition.d.ts +7 -0
- package/dist/registry/page-composition.js +18 -0
- package/dist/registry/page-logos.d.ts +3 -0
- package/dist/registry/page-logos.js +6 -0
- package/dist/registry/page-navigation.d.ts +5 -0
- package/dist/registry/page-navigation.js +12 -0
- package/dist/registry/page-presentation.d.ts +7 -0
- package/dist/registry/page-presentation.js +18 -0
- package/dist/registry/pricing.d.ts +5 -0
- package/dist/registry/pricing.js +12 -0
- package/dist/registry/shells.d.ts +10 -0
- package/dist/registry/shells.js +27 -0
- package/dist/registry/sidebar-splitter.d.ts +4 -0
- package/dist/registry/sidebar-splitter.js +9 -0
- package/dist/registry/structure.d.ts +10 -0
- package/dist/registry/structure.js +27 -0
- package/dist/registry/toast.d.ts +3 -0
- package/dist/registry/toast.js +4 -0
- package/dist/scroll-area/scroll-area.adapter.d.ts +2 -0
- package/dist/scroll-area/scroll-area.adapter.js +6 -0
- package/dist/select/display-text.d.ts +2 -0
- package/dist/select/display-text.js +18 -0
- package/dist/select/select-base-content.adapter.d.ts +6 -0
- package/dist/select/select-base-content.adapter.js +16 -0
- package/dist/select/select-content.adapter.d.ts +4 -0
- package/dist/select/select-content.adapter.js +11 -0
- package/dist/select/select-option.d.ts +5 -0
- package/dist/select/select-option.js +6 -0
- package/dist/select/select.adapter.d.ts +2 -0
- package/dist/select/select.adapter.js +47 -0
- package/dist/select/use-select-change.d.ts +2 -0
- package/dist/select/use-select-change.js +29 -0
- package/dist/select-menu/select-menu-form.d.ts +7 -0
- package/dist/select-menu/select-menu-form.js +14 -0
- package/dist/select-menu/select-menu-popup.d.ts +8 -0
- package/dist/select-menu/select-menu-popup.js +39 -0
- package/dist/select-menu/select-menu-root.d.ts +8 -0
- package/dist/select-menu/select-menu-root.js +34 -0
- package/dist/select-menu/select-menu.adapter.d.ts +2 -0
- package/dist/select-menu/select-menu.adapter.js +63 -0
- package/dist/select-menu/use-select-menu.d.ts +22 -0
- package/dist/select-menu/use-select-menu.js +111 -0
- package/dist/separator/separator.adapter.d.ts +2 -0
- package/dist/separator/separator.adapter.js +6 -0
- package/dist/shadcn.adapter.d.ts +2 -0
- package/dist/shadcn.adapter.js +102 -0
- package/dist/sidebar/sidebar.adapter.d.ts +2 -0
- package/dist/sidebar/sidebar.adapter.js +63 -0
- package/dist/skeleton/skeleton.adapter.d.ts +2 -0
- package/dist/skeleton/skeleton.adapter.js +8 -0
- package/dist/slideover/slideover.adapter.d.ts +2 -0
- package/dist/slideover/slideover.adapter.js +14 -0
- package/dist/slider/request-change.d.ts +2 -0
- package/dist/slider/request-change.js +34 -0
- package/dist/slider/slider-thumb.d.ts +7 -0
- package/dist/slider/slider-thumb.js +18 -0
- package/dist/slider/slider.adapter.d.ts +2 -0
- package/dist/slider/slider.adapter.js +36 -0
- package/dist/splitter/splitter.adapter.d.ts +3 -0
- package/dist/splitter/splitter.adapter.js +50 -0
- package/dist/stepper/stepper.adapter.d.ts +2 -0
- package/dist/stepper/stepper.adapter.js +30 -0
- package/dist/styles-contract.d.ts +1 -0
- package/dist/styles-contract.js +1 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +1 -0
- package/dist/submit-button/submit-button.adapter.d.ts +2 -0
- package/dist/submit-button/submit-button.adapter.js +11 -0
- package/dist/surface/surface.adapter.d.ts +2 -0
- package/dist/surface/surface.adapter.js +8 -0
- package/dist/switch/switch.adapter.d.ts +2 -0
- package/dist/switch/switch.adapter.js +26 -0
- package/dist/table/interactive-table.d.ts +2 -0
- package/dist/table/interactive-table.js +24 -0
- package/dist/table/table.adapter.d.ts +2 -0
- package/dist/table/table.adapter.js +14 -0
- package/dist/tabs/tabs.adapter.d.ts +2 -0
- package/dist/tabs/tabs.adapter.js +17 -0
- package/dist/temporal/draft-validity.d.ts +13 -0
- package/dist/temporal/draft-validity.js +18 -0
- package/dist/temporal/focus-incomplete-segment.d.ts +1 -0
- package/dist/temporal/focus-incomplete-segment.js +7 -0
- package/dist/temporal/range-reset-focus.d.ts +1 -0
- package/dist/temporal/range-reset-focus.js +16 -0
- package/dist/temporal/temporal-recovery.d.ts +6 -0
- package/dist/temporal/temporal-recovery.js +4 -0
- package/dist/temporal/use-range-reset.d.ts +6 -0
- package/dist/temporal/use-range-reset.js +55 -0
- package/dist/temporal/use-temporal-change.d.ts +10 -0
- package/dist/temporal/use-temporal-change.js +21 -0
- package/dist/text/text.adapter.d.ts +1 -0
- package/dist/text/text.adapter.js +1 -0
- package/dist/text-area/text-area.adapter.d.ts +2 -0
- package/dist/text-area/text-area.adapter.js +9 -0
- package/dist/textarea/textarea.adapter.d.ts +2 -0
- package/dist/textarea/textarea.adapter.js +40 -0
- package/dist/textarea/use-auto-rows.d.ts +2 -0
- package/dist/textarea/use-auto-rows.js +33 -0
- package/dist/theme/theme.adapter.d.ts +2 -0
- package/dist/theme/theme.adapter.js +23 -0
- package/dist/timeline/timeline.adapter.d.ts +2 -0
- package/dist/timeline/timeline.adapter.js +13 -0
- package/dist/toast/toast-data.d.ts +17 -0
- package/dist/toast/toast-data.js +1 -0
- package/dist/toast/toast-focus.d.ts +12 -0
- package/dist/toast/toast-focus.js +38 -0
- package/dist/toast/toast-provider.d.ts +4 -0
- package/dist/toast/toast-provider.js +11 -0
- package/dist/toast/toast-queue-context.d.ts +24 -0
- package/dist/toast/toast-queue-context.js +8 -0
- package/dist/toast/toast-queue.d.ts +12 -0
- package/dist/toast/toast-queue.js +29 -0
- package/dist/toast/toast-registration.d.ts +9 -0
- package/dist/toast/toast-registration.js +149 -0
- package/dist/toast/toast-viewport.d.ts +1 -0
- package/dist/toast/toast-viewport.js +36 -0
- package/dist/toast/toast.adapter.d.ts +2 -0
- package/dist/toast/toast.adapter.js +14 -0
- package/dist/toggle/toggle.adapter.d.ts +2 -0
- package/dist/toggle/toggle.adapter.js +8 -0
- package/dist/tooltip/tooltip.adapter.d.ts +2 -0
- package/dist/tooltip/tooltip.adapter.js +29 -0
- package/dist/tooltip/use-tooltip-anchor.d.ts +5 -0
- package/dist/tooltip/use-tooltip-anchor.js +36 -0
- package/dist/tree/focus-element.d.ts +1 -0
- package/dist/tree/focus-element.js +4 -0
- package/dist/tree/tree.adapter.d.ts +2 -0
- package/dist/tree/tree.adapter.js +27 -0
- package/dist/tree/use-tree.d.ts +13 -0
- package/dist/tree/use-tree.js +73 -0
- package/dist/user/user.adapter.d.ts +2 -0
- package/dist/user/user.adapter.js +24 -0
- package/dist/v-stack/v-stack.adapter.d.ts +2 -0
- package/dist/v-stack/v-stack.adapter.js +5 -0
- package/dist/vendor/lib/utils.d.ts +2 -0
- package/dist/vendor/lib/utils.js +5 -0
- package/dist/vendor/ui/accordion.d.ts +7 -0
- package/dist/vendor/ui/accordion.js +14 -0
- package/dist/vendor/ui/alert.d.ts +8 -0
- package/dist/vendor/ui/alert.js +22 -0
- package/dist/vendor/ui/badge.d.ts +9 -0
- package/dist/vendor/ui/badge.js +21 -0
- package/dist/vendor/ui/button.d.ts +11 -0
- package/dist/vendor/ui/button.js +33 -0
- package/dist/vendor/ui/card.d.ts +8 -0
- package/dist/vendor/ui/card.js +16 -0
- package/dist/vendor/ui/checkbox.d.ts +4 -0
- package/dist/vendor/ui/checkbox.js +9 -0
- package/dist/vendor/ui/input.d.ts +3 -0
- package/dist/vendor/ui/input.js +8 -0
- package/dist/vendor/ui/label.d.ts +5 -0
- package/dist/vendor/ui/label.js +10 -0
- package/dist/vendor/ui/progress.d.ts +4 -0
- package/dist/vendor/ui/progress.js +8 -0
- package/dist/vendor/ui/select.d.ts +13 -0
- package/dist/vendor/ui/select.js +27 -0
- package/dist/vendor/ui/separator.d.ts +4 -0
- package/dist/vendor/ui/separator.js +8 -0
- package/dist/vendor/ui/slider.d.ts +4 -0
- package/dist/vendor/ui/slider.js +8 -0
- package/dist/vendor/ui/switch.d.ts +4 -0
- package/dist/vendor/ui/switch.js +8 -0
- package/dist/vendor/ui/tabs.d.ts +7 -0
- package/dist/vendor/ui/tabs.js +13 -0
- package/dist/vendor/ui/textarea.d.ts +3 -0
- package/dist/vendor/ui/textarea.js +8 -0
- package/package.json +71 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TemporalRecovery } from './temporal-recovery.js';
|
|
2
|
+
interface TemporalProtection {
|
|
3
|
+
readonly disabled?: boolean | undefined;
|
|
4
|
+
readonly readOnly?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function useTemporalChange<Value>(validate: (value: Value) => boolean, onValueChange: (value: Value) => void, message: string, protection: TemporalProtection, recovery?: TemporalRecovery<Value>): {
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
change: (value: Value) => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export function useTemporalChange(validate, onValueChange, message, protection, recovery) {
|
|
3
|
+
const [failure, setFailure] = useState();
|
|
4
|
+
const recovered = failure !== undefined &&
|
|
5
|
+
recovery !== undefined &&
|
|
6
|
+
failure.basis !== recovery.key &&
|
|
7
|
+
validate(recovery.value);
|
|
8
|
+
if (recovered)
|
|
9
|
+
setFailure(undefined);
|
|
10
|
+
function change(value) {
|
|
11
|
+
if (protection.disabled || protection.readOnly)
|
|
12
|
+
return;
|
|
13
|
+
if (!validate(value)) {
|
|
14
|
+
setFailure({ message, basis: recovery?.key });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setFailure(undefined);
|
|
18
|
+
onValueChange(value);
|
|
19
|
+
}
|
|
20
|
+
return { error: recovered ? undefined : failure?.message, change };
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextSurface as ShadcnText } from '@fastsprout/reacd/adapter-runtime/renderer/text/text.renderer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextSurface as ShadcnText } from '@fastsprout/reacd/adapter-runtime/renderer/text/text.renderer.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { CONTENT_POLICY } from '@fastsprout/reacd/adapter-runtime/core/policy.js';
|
|
4
|
+
import { Textarea } from '../vendor/ui/textarea.js';
|
|
5
|
+
import { Label } from '../vendor/ui/label.js';
|
|
6
|
+
export function ShadcnTextArea({ label, value, onValueChange, rows, ...properties }) {
|
|
7
|
+
const id = useId();
|
|
8
|
+
return (_jsxs("div", { className: "reacd-node reacd-field", children: [_jsx(Label, { htmlFor: id, children: label }), _jsx(Textarea, { ...properties, id: id, value: value, rows: rows ?? CONTENT_POLICY.defaultTextAreaRows, maxLength: CONTENT_POLICY.maxTextLength, onChange: (event) => onValueChange(event.target.value) })] }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { TextareaProps } from '@fastsprout/reacd/adapter-runtime/components/textarea/textarea.props.js';
|
|
2
|
+
export declare function ShadcnTextarea({ label, value, onValueChange, description, name, required, disabled, readOnly, minLength, maxLength, rows, autoResize, maxRows, placeholder, }: TextareaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useRef, useState } from 'react';
|
|
3
|
+
import { TEXTAREA_POLICY } from '@fastsprout/reacd/adapter-runtime/core/textarea-policy.js';
|
|
4
|
+
import { useFieldMetadata } from '@fastsprout/reacd/adapter-runtime/renderer/form-field/field-metadata.js';
|
|
5
|
+
import { Textarea } from '../vendor/ui/textarea.js';
|
|
6
|
+
import { Label } from '../vendor/ui/label.js';
|
|
7
|
+
import { useAutoRows } from './use-auto-rows.js';
|
|
8
|
+
export function ShadcnTextarea({ label, value, onValueChange, description, name, required, disabled, readOnly, minLength, maxLength, rows, autoResize, maxRows, placeholder, }) {
|
|
9
|
+
const id = useId();
|
|
10
|
+
const control = useRef(null);
|
|
11
|
+
const [attempted, setAttempted] = useState(false);
|
|
12
|
+
const metadata = useFieldMetadata({ name, required, disabled }, description ? [`${id}-description`] : []);
|
|
13
|
+
const minimum = minLength ?? TEXTAREA_POLICY.minimumLength;
|
|
14
|
+
const maximum = maxLength ?? TEXTAREA_POLICY.maximumLength;
|
|
15
|
+
const baseRows = rows ?? TEXTAREA_POLICY.defaultRows;
|
|
16
|
+
useAutoRows(control, autoResize, value, baseRows, maxRows ?? TEXTAREA_POLICY.defaultMaxRows);
|
|
17
|
+
const localError = metadata.required && value.length === 0
|
|
18
|
+
? TEXTAREA_POLICY.requiredMessage
|
|
19
|
+
: value.length > 0 && value.length < minimum
|
|
20
|
+
? `${TEXTAREA_POLICY.minimumMessagePrefix} ${minimum} ` +
|
|
21
|
+
TEXTAREA_POLICY.minimumMessageSuffix
|
|
22
|
+
: '';
|
|
23
|
+
const visibleError = attempted ? localError : '';
|
|
24
|
+
const feedback = metadata.error || visibleError;
|
|
25
|
+
const descriptions = [
|
|
26
|
+
...metadata.descriptionIds,
|
|
27
|
+
...(visibleError && !metadata.error ? [`${id}-error`] : []),
|
|
28
|
+
];
|
|
29
|
+
function invalid(event) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
setAttempted(true);
|
|
32
|
+
control.current?.focus();
|
|
33
|
+
}
|
|
34
|
+
return (_jsxs("div", { className: "reacd-node reacd-field reacd-textarea", "data-auto-resize": autoResize || undefined, children: [_jsx(Label, { htmlFor: id, children: label }), description && _jsx("p", { id: `${id}-description`, children: description }), _jsx(Textarea, { ref: control, id: id, value: value, name: metadata.name, placeholder: placeholder, required: metadata.required, disabled: metadata.disabled, readOnly: readOnly, minLength: minimum, maxLength: maximum, rows: baseRows, "aria-invalid": Boolean(feedback) || undefined, "aria-describedby": descriptions.join(' ') || undefined, onInvalid: invalid, onChange: (event) => {
|
|
35
|
+
const next = event.target.value;
|
|
36
|
+
if (!metadata.disabled && !readOnly && next.length <= maximum) {
|
|
37
|
+
onValueChange(next);
|
|
38
|
+
}
|
|
39
|
+
} }), visibleError && !metadata.error && (_jsx("p", { id: `${id}-error`, role: "alert", className: "reacd-field-error", children: visibleError })), _jsx("input", { type: "text", hidden: true, defaultValue: "", required: Boolean(localError), disabled: metadata.disabled, onInvalid: invalid })] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
import { TEXTAREA_POLICY } from '@fastsprout/reacd/adapter-runtime/core/textarea-policy.js';
|
|
3
|
+
function positive(value, fallback) {
|
|
4
|
+
const parsed = Number.parseFloat(value);
|
|
5
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
6
|
+
}
|
|
7
|
+
export function useAutoRows(ref, enabled, value, rows, maxRows) {
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
|
+
const control = ref.current;
|
|
10
|
+
if (!enabled || control === null)
|
|
11
|
+
return;
|
|
12
|
+
const measure = () => {
|
|
13
|
+
control.rows = rows;
|
|
14
|
+
const style = window.getComputedStyle(control);
|
|
15
|
+
const fontSize = positive(style.fontSize, TEXTAREA_POLICY.fallbackFontSizePx);
|
|
16
|
+
const lineHeight = positive(style.lineHeight, fontSize * TEXTAREA_POLICY.fallbackLineHeightRatio);
|
|
17
|
+
const padding = positive(style.paddingTop, 0) + positive(style.paddingBottom, 0);
|
|
18
|
+
// scrollHeight rounds to integer pixels; plain textarea lines are discrete.
|
|
19
|
+
const measured = Math.round((control.scrollHeight - padding) / lineHeight);
|
|
20
|
+
control.rows = Math.max(rows, Math.min(maxRows, measured));
|
|
21
|
+
};
|
|
22
|
+
measure();
|
|
23
|
+
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
|
|
24
|
+
observer?.observe(control);
|
|
25
|
+
window.addEventListener('resize', measure);
|
|
26
|
+
document.fonts?.addEventListener('loadingdone', measure);
|
|
27
|
+
return () => {
|
|
28
|
+
observer?.disconnect();
|
|
29
|
+
window.removeEventListener('resize', measure);
|
|
30
|
+
document.fonts?.removeEventListener('loadingdone', measure);
|
|
31
|
+
};
|
|
32
|
+
}, [ref, enabled, value, rows, maxRows]);
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useMemo } from 'react';
|
|
3
|
+
import { RenderContext } from '@fastsprout/reacd/adapter-runtime/components/shared/port.js';
|
|
4
|
+
import { ThemeVariablesContext } from '@fastsprout/reacd/adapter-runtime/renderer/theme/theme-context.js';
|
|
5
|
+
import { templateVariables } from '@fastsprout/reacd/adapter-runtime/renderer/theme/template-variables.js';
|
|
6
|
+
import { defaultProperties } from '@fastsprout/reacd/adapter-runtime/renderer/theme/default-properties.js';
|
|
7
|
+
export function ShadcnTheme({ children, template, defaults }) {
|
|
8
|
+
const inheritedVariables = useContext(ThemeVariablesContext);
|
|
9
|
+
const inheritedPort = useContext(RenderContext);
|
|
10
|
+
const variables = template === undefined ? inheritedVariables : templateVariables(template);
|
|
11
|
+
const port = useMemo(() => {
|
|
12
|
+
if (inheritedPort === null)
|
|
13
|
+
return null;
|
|
14
|
+
return {
|
|
15
|
+
render(name, properties) {
|
|
16
|
+
const fallback = Object.entries(defaults ?? {}).find(([component]) => component === name)?.[1];
|
|
17
|
+
return inheritedPort.render(name, defaultProperties(properties, fallback));
|
|
18
|
+
},
|
|
19
|
+
report: (issues) => inheritedPort.report(issues),
|
|
20
|
+
};
|
|
21
|
+
}, [inheritedPort, defaults]);
|
|
22
|
+
return (_jsx(ThemeVariablesContext.Provider, { value: variables, children: _jsx(RenderContext.Provider, { value: port, children: _jsx("div", { className: "reacd-node reacd-theme", style: variables, children: children }) }) }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TIMELINE_DEFAULTS, TIMELINE_POLICY, } from '@fastsprout/reacd/adapter-runtime/core/timeline-policy.js';
|
|
3
|
+
import { Button } from '../vendor/ui/button.js';
|
|
4
|
+
export function ShadcnTimeline({ label, items, value, onValueChange, orientation = TIMELINE_DEFAULTS.orientation, reverse = TIMELINE_DEFAULTS.reverse, intent = TIMELINE_DEFAULTS.intent, }) {
|
|
5
|
+
const current = value === undefined ? 0 : items.findIndex((item) => item.id === value);
|
|
6
|
+
const events = items.map((item, index) => ({
|
|
7
|
+
...item,
|
|
8
|
+
status: index < current ? 'completed' : index === current ? 'current' : 'upcoming',
|
|
9
|
+
}));
|
|
10
|
+
if (reverse)
|
|
11
|
+
events.reverse();
|
|
12
|
+
return (_jsx("ol", { className: "reacd-node reacd-timeline", "aria-label": label, "data-slot": "timeline", "data-orientation": orientation, "data-intent": intent, children: events.map((item) => (_jsxs("li", { "data-state": item.status, "aria-current": item.status === 'current' ? 'step' : undefined, children: [_jsx("span", { className: "reacd-timeline-state", children: TIMELINE_POLICY.statuses[item.status] }), item.date !== undefined && (_jsx("span", { className: "reacd-timeline-date", children: item.date })), onValueChange === undefined ? (_jsx("p", { className: "reacd-timeline-title", children: item.title })) : (_jsx(Button, { className: "reacd-button reacd-timeline-title", type: "button", variant: "ghost", disabled: item.disabled, onClick: () => onValueChange(item.id), children: item.title })), item.description !== undefined && (_jsx("p", { className: "reacd-timeline-description", children: item.description }))] }, item.id))) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ToastProps } from '@fastsprout/reacd/adapter-runtime/components/toast/index.js';
|
|
3
|
+
export type ToastFeedback = 'rejected' | 'invalid' | 'actionError';
|
|
4
|
+
export interface ToastData {
|
|
5
|
+
variables: CSSProperties;
|
|
6
|
+
host: HTMLElement | null;
|
|
7
|
+
direction: 'ltr' | 'rtl';
|
|
8
|
+
intent: NonNullable<ToastProps['intent']>;
|
|
9
|
+
description?: string | undefined;
|
|
10
|
+
closeLabel: string;
|
|
11
|
+
requestClose: () => void;
|
|
12
|
+
feedback: ToastFeedback | null;
|
|
13
|
+
action?: {
|
|
14
|
+
label: string;
|
|
15
|
+
execute: () => void;
|
|
16
|
+
} | undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FocusableToast {
|
|
2
|
+
id: string;
|
|
3
|
+
ref?: {
|
|
4
|
+
current: HTMLElement | null;
|
|
5
|
+
} | undefined;
|
|
6
|
+
limited?: boolean | undefined;
|
|
7
|
+
transitionStatus?: 'starting' | 'ending' | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function createToastFocus(): {
|
|
10
|
+
remember(viewport: HTMLElement, origin: EventTarget | null): void;
|
|
11
|
+
close(id: string, records: readonly FocusableToast[], dismiss: () => void): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function createToastFocus() {
|
|
2
|
+
let previous = null;
|
|
3
|
+
return {
|
|
4
|
+
remember(viewport, origin) {
|
|
5
|
+
if (origin instanceof HTMLElement &&
|
|
6
|
+
!viewport.contains(origin) &&
|
|
7
|
+
!origin.hasAttribute('data-base-ui-focus-guard'))
|
|
8
|
+
previous = origin;
|
|
9
|
+
},
|
|
10
|
+
close(id, records, dismiss) {
|
|
11
|
+
const index = records.findIndex((record) => record.id === id);
|
|
12
|
+
const root = records[index]?.ref?.current;
|
|
13
|
+
if (root == null || !root.contains(root.ownerDocument.activeElement)) {
|
|
14
|
+
dismiss();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const ordered = [
|
|
18
|
+
...records.slice(index + 1),
|
|
19
|
+
...records.slice(0, index).reverse(),
|
|
20
|
+
];
|
|
21
|
+
const next = ordered.find((record) => !record.limited &&
|
|
22
|
+
record.transitionStatus !== 'ending' &&
|
|
23
|
+
record.ref?.current?.isConnected);
|
|
24
|
+
const destination = next?.ref?.current;
|
|
25
|
+
dismiss();
|
|
26
|
+
queueMicrotask(() => {
|
|
27
|
+
const document = root.ownerDocument;
|
|
28
|
+
const active = document.activeElement;
|
|
29
|
+
if (active !== document.body && !root.contains(active))
|
|
30
|
+
return;
|
|
31
|
+
if (destination?.isConnected)
|
|
32
|
+
destination.focus();
|
|
33
|
+
else if (previous?.isConnected)
|
|
34
|
+
previous.focus();
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Toast } from '@base-ui/react/toast';
|
|
4
|
+
import { TOAST_POLICY } from '@fastsprout/reacd/adapter-runtime/core/toast-policy.js';
|
|
5
|
+
import { createToastQueue } from './toast-queue.js';
|
|
6
|
+
import { ToastQueueContext } from './toast-queue-context.js';
|
|
7
|
+
import { ShadcnToastViewport } from './toast-viewport.js';
|
|
8
|
+
export function ShadcnToastProvider({ children }) {
|
|
9
|
+
const [queue] = useState(createToastQueue);
|
|
10
|
+
return (_jsx(ToastQueueContext.Provider, { value: queue, children: _jsxs(Toast.Provider, { limit: TOAST_POLICY.maximumVisible, children: [children, _jsx(ShadcnToastViewport, {})] }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ToastQueueContext: import("react").Context<{
|
|
2
|
+
focus: {
|
|
3
|
+
remember(viewport: HTMLElement, origin: EventTarget | null): void;
|
|
4
|
+
close(id: string, records: readonly import("./toast-focus.js").FocusableToast[], dismiss: () => void): void;
|
|
5
|
+
};
|
|
6
|
+
keys: import("jotai").PrimitiveAtom<ReadonlySet<string>> & {
|
|
7
|
+
init: ReadonlySet<string>;
|
|
8
|
+
};
|
|
9
|
+
store: import("jotai").Store;
|
|
10
|
+
reserve(id: string): boolean;
|
|
11
|
+
release(id: string): void;
|
|
12
|
+
} | null>;
|
|
13
|
+
export declare function useToastQueue(): {
|
|
14
|
+
focus: {
|
|
15
|
+
remember(viewport: HTMLElement, origin: EventTarget | null): void;
|
|
16
|
+
close(id: string, records: readonly import("./toast-focus.js").FocusableToast[], dismiss: () => void): void;
|
|
17
|
+
};
|
|
18
|
+
keys: import("jotai").PrimitiveAtom<ReadonlySet<string>> & {
|
|
19
|
+
init: ReadonlySet<string>;
|
|
20
|
+
};
|
|
21
|
+
store: import("jotai").Store;
|
|
22
|
+
reserve(id: string): boolean;
|
|
23
|
+
release(id: string): void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const ToastQueueContext = createContext(null);
|
|
3
|
+
export function useToastQueue() {
|
|
4
|
+
const queue = useContext(ToastQueueContext);
|
|
5
|
+
if (queue === null)
|
|
6
|
+
throw new Error('Toast requires a Surface notification provider.');
|
|
7
|
+
return queue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function createToastQueue(): {
|
|
2
|
+
focus: {
|
|
3
|
+
remember(viewport: HTMLElement, origin: EventTarget | null): void;
|
|
4
|
+
close(id: string, records: readonly import("./toast-focus.js").FocusableToast[], dismiss: () => void): void;
|
|
5
|
+
};
|
|
6
|
+
keys: import("jotai/vanilla").PrimitiveAtom<ReadonlySet<string>> & {
|
|
7
|
+
init: ReadonlySet<string>;
|
|
8
|
+
};
|
|
9
|
+
store: import("jotai/vanilla").Store;
|
|
10
|
+
reserve(id: string): boolean;
|
|
11
|
+
release(id: string): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createToastFocus } from './toast-focus.js';
|
|
2
|
+
import { atom, createStore } from 'jotai/vanilla';
|
|
3
|
+
import { TOAST_POLICY } from '@fastsprout/reacd/adapter-runtime/core/toast-policy.js';
|
|
4
|
+
export function createToastQueue() {
|
|
5
|
+
const keys = atom(new Set());
|
|
6
|
+
const store = createStore();
|
|
7
|
+
return {
|
|
8
|
+
focus: createToastFocus(),
|
|
9
|
+
keys,
|
|
10
|
+
store,
|
|
11
|
+
reserve(id) {
|
|
12
|
+
const active = store.get(keys);
|
|
13
|
+
if (active.has(id))
|
|
14
|
+
return true;
|
|
15
|
+
if (active.size >= TOAST_POLICY.maximumQueued)
|
|
16
|
+
return false;
|
|
17
|
+
store.set(keys, new Set([...active, id]));
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
release(id) {
|
|
21
|
+
const active = store.get(keys);
|
|
22
|
+
if (!active.has(id))
|
|
23
|
+
return;
|
|
24
|
+
const next = new Set(active);
|
|
25
|
+
next.delete(id);
|
|
26
|
+
store.set(keys, next);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ToastProps } from '@fastsprout/reacd/adapter-runtime/components/toast/index.js';
|
|
3
|
+
export declare function ToastRegistration({ id, properties, variables, direction, host, }: {
|
|
4
|
+
id: string;
|
|
5
|
+
properties: ToastProps;
|
|
6
|
+
variables: CSSProperties;
|
|
7
|
+
direction: 'ltr' | 'rtl';
|
|
8
|
+
host: HTMLElement | null;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAtomValue } from 'jotai';
|
|
3
|
+
import { useToastQueue } from './toast-queue-context.js';
|
|
4
|
+
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Toast } from '@base-ui/react/toast';
|
|
6
|
+
import { TOAST_DEFAULTS, TOAST_POLICY, TOAST_DURATIONS, toastDecision, toastTimeout, } from '@fastsprout/reacd/adapter-runtime/core/toast-policy.js';
|
|
7
|
+
export function ToastRegistration({ id, properties, variables, direction, host, }) {
|
|
8
|
+
const { toasts, add, update, close } = Toast.useToastManager();
|
|
9
|
+
const queue = useToastQueue();
|
|
10
|
+
const slots = useAtomValue(queue.keys, { store: queue.store });
|
|
11
|
+
const current = toasts.find((toast) => toast.id === id);
|
|
12
|
+
const full = !slots.has(id) && slots.size >= TOAST_POLICY.maximumQueued;
|
|
13
|
+
const [feedback, setFeedback] = useState(null);
|
|
14
|
+
const [held, setHeld] = useState(false);
|
|
15
|
+
const alive = useRef(false);
|
|
16
|
+
const forwarding = useRef(false);
|
|
17
|
+
const snapshot = useRef(toasts);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
snapshot.current = toasts;
|
|
20
|
+
}, [toasts]);
|
|
21
|
+
const latest = useRef(properties.onOpenChange);
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
latest.current = properties.onOpenChange;
|
|
24
|
+
}, [properties.onOpenChange]);
|
|
25
|
+
const requestClose = useCallback(() => {
|
|
26
|
+
if (!alive.current)
|
|
27
|
+
return;
|
|
28
|
+
setHeld(true);
|
|
29
|
+
let result;
|
|
30
|
+
try {
|
|
31
|
+
result = latest.current(false);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
setFeedback('actionError');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const decision = toastDecision(result);
|
|
38
|
+
if (decision === 'invalid')
|
|
39
|
+
setFeedback('invalid');
|
|
40
|
+
else if (decision === 'veto')
|
|
41
|
+
setFeedback('rejected');
|
|
42
|
+
else {
|
|
43
|
+
forwarding.current = true;
|
|
44
|
+
try {
|
|
45
|
+
close(id);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
forwarding.current = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [close, id]);
|
|
52
|
+
const nativeClose = useCallback(() => {
|
|
53
|
+
if (!forwarding.current)
|
|
54
|
+
requestClose();
|
|
55
|
+
}, [requestClose]);
|
|
56
|
+
const action = useMemo(() => {
|
|
57
|
+
const declared = properties.action;
|
|
58
|
+
if (declared === undefined)
|
|
59
|
+
return undefined;
|
|
60
|
+
return {
|
|
61
|
+
label: declared.label,
|
|
62
|
+
execute: () => {
|
|
63
|
+
let result;
|
|
64
|
+
try {
|
|
65
|
+
result = declared.onPress();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
setFeedback('actionError');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const decision = toastDecision(result);
|
|
72
|
+
if (decision === 'invalid')
|
|
73
|
+
setFeedback('invalid');
|
|
74
|
+
else if (decision === 'veto')
|
|
75
|
+
setFeedback('rejected');
|
|
76
|
+
else {
|
|
77
|
+
setFeedback(null);
|
|
78
|
+
if (properties.closeOnAction ?? TOAST_DEFAULTS.closeOnAction)
|
|
79
|
+
requestClose();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}, [properties.action, properties.closeOnAction, requestClose]);
|
|
84
|
+
const options = useMemo(() => ({
|
|
85
|
+
id,
|
|
86
|
+
title: properties.title,
|
|
87
|
+
description: properties.description,
|
|
88
|
+
type: properties.intent ?? TOAST_DEFAULTS.intent,
|
|
89
|
+
priority: (properties.priority ?? TOAST_DEFAULTS.priority) === 'urgent'
|
|
90
|
+
? 'high'
|
|
91
|
+
: 'low',
|
|
92
|
+
timeout: held || feedback !== null
|
|
93
|
+
? TOAST_DURATIONS.persistent
|
|
94
|
+
: toastTimeout(properties.duration, properties.action !== undefined),
|
|
95
|
+
onClose: nativeClose,
|
|
96
|
+
data: {
|
|
97
|
+
variables,
|
|
98
|
+
direction,
|
|
99
|
+
feedback,
|
|
100
|
+
host,
|
|
101
|
+
intent: properties.intent ?? TOAST_DEFAULTS.intent,
|
|
102
|
+
description: properties.description,
|
|
103
|
+
closeLabel: properties.closeLabel ?? TOAST_DEFAULTS.closeLabel,
|
|
104
|
+
requestClose,
|
|
105
|
+
action,
|
|
106
|
+
},
|
|
107
|
+
}), [
|
|
108
|
+
id,
|
|
109
|
+
properties.title,
|
|
110
|
+
properties.description,
|
|
111
|
+
properties.intent,
|
|
112
|
+
properties.priority,
|
|
113
|
+
properties.duration,
|
|
114
|
+
action,
|
|
115
|
+
properties.action,
|
|
116
|
+
properties.closeLabel,
|
|
117
|
+
held,
|
|
118
|
+
feedback,
|
|
119
|
+
variables,
|
|
120
|
+
direction,
|
|
121
|
+
host,
|
|
122
|
+
requestClose,
|
|
123
|
+
nativeClose,
|
|
124
|
+
]);
|
|
125
|
+
useLayoutEffect(() => {
|
|
126
|
+
alive.current = true;
|
|
127
|
+
return () => {
|
|
128
|
+
alive.current = false;
|
|
129
|
+
queue.focus.close(id, snapshot.current, () => close(id));
|
|
130
|
+
queue.release(id);
|
|
131
|
+
};
|
|
132
|
+
}, [close, id, queue]);
|
|
133
|
+
const present = current !== undefined;
|
|
134
|
+
const phase = current?.transitionStatus;
|
|
135
|
+
const currentTimeout = current?.timeout;
|
|
136
|
+
useLayoutEffect(() => {
|
|
137
|
+
if (full || !queue.reserve(id))
|
|
138
|
+
return;
|
|
139
|
+
if (!present || phase === 'ending')
|
|
140
|
+
add(options);
|
|
141
|
+
else if (currentTimeout !== options.timeout)
|
|
142
|
+
update(id, options);
|
|
143
|
+
else {
|
|
144
|
+
const { timeout: _timeout, ...metadata } = options;
|
|
145
|
+
update(id, metadata);
|
|
146
|
+
}
|
|
147
|
+
}, [queue, full, phase, present, currentTimeout, add, update, id, options]);
|
|
148
|
+
return full ? _jsx("p", { role: "alert", children: TOAST_DEFAULTS.limit }) : null;
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ShadcnToastViewport(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useToastQueue } from './toast-queue-context.js';
|
|
3
|
+
import { ThemeVariablesContext } from '@fastsprout/reacd/adapter-runtime/renderer/theme/theme-context.js';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
import { Toast } from '@base-ui/react/toast';
|
|
6
|
+
import { TOAST_DEFAULTS } from '@fastsprout/reacd/adapter-runtime/core/toast-policy.js';
|
|
7
|
+
import { PortalHostContext } from '@fastsprout/reacd/adapter-runtime/renderer/theme/portal-context.js';
|
|
8
|
+
import { Button } from '../vendor/ui/button.js';
|
|
9
|
+
export function ShadcnToastViewport() {
|
|
10
|
+
const queue = useToastQueue();
|
|
11
|
+
const { toasts } = Toast.useToastManager();
|
|
12
|
+
const fallbackHost = useContext(PortalHostContext);
|
|
13
|
+
const variables = useContext(ThemeVariablesContext);
|
|
14
|
+
const active = toasts.find((toast) => toast.data !== undefined && toast.transitionStatus !== 'ending');
|
|
15
|
+
const host = active?.data?.host ?? fallbackHost;
|
|
16
|
+
if (toasts.length === 0)
|
|
17
|
+
return null;
|
|
18
|
+
return (_jsx(Toast.Portal, { container: host ?? undefined, children: _jsx(Toast.Viewport, { onFocusCapture: (event) => queue.focus.remember(event.currentTarget, event.relatedTarget), style: variables, className: "reacd-root reacd-portal-root reacd-toast-viewport", children: toasts.map((toast) => {
|
|
19
|
+
const data = toast.data;
|
|
20
|
+
if (data === undefined)
|
|
21
|
+
return null;
|
|
22
|
+
const action = data.action;
|
|
23
|
+
return (_jsxs(Toast.Root, { toast: toast, onKeyDown: (event) => {
|
|
24
|
+
if (event.key !== 'Escape')
|
|
25
|
+
return;
|
|
26
|
+
event.preventBaseUIHandler();
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
data.requestClose();
|
|
30
|
+
}, className: "reacd-root reacd-portal-root reacd-toast", "data-intent": data.intent, dir: data.direction, style: data.variables, swipeDirection: data.direction === 'rtl' ? ['down', 'left'] : ['down', 'right'], children: [_jsx("div", { className: "reacd-toast-grip", "aria-hidden": "true", children: _jsx("span", {}) }), _jsxs(Toast.Content, { className: "reacd-toast-content", "data-base-ui-swipe-ignore": true, children: [_jsx(Toast.Title, { className: "reacd-toast-title" }), data.description !== undefined && _jsx(Toast.Description, {}), data.feedback !== null && (_jsx("p", { role: data.feedback === 'rejected' ? 'status' : 'alert', children: TOAST_DEFAULTS[data.feedback] })), _jsxs("div", { className: "reacd-toast-actions", children: [action !== undefined && (_jsx(Toast.Action, { onClick: () => action.execute(), render: _jsx(Button, { className: "reacd-node reacd-button" }), children: action.label })), _jsx(Toast.Close, { onClick: (event) => {
|
|
31
|
+
event.preventBaseUIHandler();
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
data.requestClose();
|
|
34
|
+
}, render: _jsx(Button, { variant: "secondary", className: "reacd-node reacd-button" }), children: data.closeLabel })] })] })] }, toast.id));
|
|
35
|
+
}) }) }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useId } from 'react';
|
|
3
|
+
import { useDirection } from '@radix-ui/react-direction';
|
|
4
|
+
import { PortalActiveContext, PortalHostContext, } from '@fastsprout/reacd/adapter-runtime/renderer/theme/portal-context.js';
|
|
5
|
+
import { ThemeVariablesContext } from '@fastsprout/reacd/adapter-runtime/renderer/theme/theme-context.js';
|
|
6
|
+
import { ToastRegistration } from './toast-registration.js';
|
|
7
|
+
export function ShadcnToast(properties) {
|
|
8
|
+
const id = useId();
|
|
9
|
+
const active = useContext(PortalActiveContext);
|
|
10
|
+
const variables = useContext(ThemeVariablesContext);
|
|
11
|
+
const direction = useDirection();
|
|
12
|
+
const host = useContext(PortalHostContext);
|
|
13
|
+
return properties.open && active ? (_jsx(ToastRegistration, { id: id, properties: properties, variables: variables, direction: direction, host: host })) : null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { Switch } from '../vendor/ui/switch.js';
|
|
4
|
+
import { Label } from '../vendor/ui/label.js';
|
|
5
|
+
export function ShadcnToggle({ label, onCheckedChange, ...properties }) {
|
|
6
|
+
const id = useId();
|
|
7
|
+
return (_jsxs("div", { className: "reacd-node reacd-check reacd-toggle", children: [_jsx(Switch, { id: id, ...properties, onCheckedChange: (next) => onCheckedChange(next) }), _jsx(Label, { htmlFor: id, children: label })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
import { Tooltip } from '@base-ui/react/tooltip';
|
|
4
|
+
import { TOOLTIP_DEFAULTS, TOOLTIP_DELAYS, TOOLTIP_POLICY, } from '@fastsprout/reacd/adapter-runtime/core/tooltip-policy.js';
|
|
5
|
+
import { ThemeVariablesContext } from '@fastsprout/reacd/adapter-runtime/renderer/theme/theme-context.js';
|
|
6
|
+
import { PortalActiveContext, PortalHostContext, } from '@fastsprout/reacd/adapter-runtime/renderer/theme/portal-context.js';
|
|
7
|
+
import { useTooltipAnchor } from './use-tooltip-anchor.js';
|
|
8
|
+
import { useEscapeLayer } from '@fastsprout/reacd/adapter-runtime/renderer/theme/use-escape-layer.js';
|
|
9
|
+
import { KbdKey } from '../kbd/kbd-key.adapter.js';
|
|
10
|
+
export function ShadcnTooltip({ text, children, open, onOpenChange, disabled, shortcuts, placement = TOOLTIP_DEFAULTS.placement, delay = TOOLTIP_DEFAULTS.delay, arrow = TOOLTIP_DEFAULTS.arrow, }) {
|
|
11
|
+
const variables = useContext(ThemeVariablesContext);
|
|
12
|
+
const host = useContext(PortalHostContext);
|
|
13
|
+
const active = useContext(PortalActiveContext);
|
|
14
|
+
const [automaticOpen, setAutomaticOpen] = useState(TOOLTIP_DEFAULTS.open);
|
|
15
|
+
const actualOpen = open ?? automaticOpen;
|
|
16
|
+
const shown = actualOpen && active && !disabled;
|
|
17
|
+
function change(next) {
|
|
18
|
+
setAutomaticOpen(next);
|
|
19
|
+
onOpenChange?.(next);
|
|
20
|
+
}
|
|
21
|
+
useEscapeLayer(shown, () => change(false));
|
|
22
|
+
const { ref: anchorRef, tabIndex } = useTooltipAnchor(children);
|
|
23
|
+
return (_jsxs(Tooltip.Root, { open: actualOpen, disabled: disabled || !active, onOpenChange: change, children: [_jsx(Tooltip.Trigger, { delay: TOOLTIP_DELAYS[delay], render: _jsx("div", { ref: anchorRef }), role: "group", "aria-label": text, tabIndex: disabled ? -1 : tabIndex, className: "reacd-node reacd-tooltip-anchor", "data-slot": "tooltip-trigger", onKeyDown: (event) => {
|
|
24
|
+
if (event.key === 'Escape' && shown) {
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
change(false);
|
|
27
|
+
}
|
|
28
|
+
}, children: children }), _jsx(Tooltip.Portal, { container: host ?? undefined, children: _jsx(Tooltip.Positioner, { side: placement, sideOffset: TOOLTIP_POLICY.sideOffsetPx, collisionPadding: TOOLTIP_POLICY.collisionPaddingPx, style: variables, className: "reacd-root reacd-portal-root reacd-tooltip-positioner", children: _jsxs(Tooltip.Popup, { role: "tooltip", className: "reacd-tooltip-popup", "data-slot": "tooltip-content", children: [_jsxs("div", { className: "reacd-tooltip-body", children: [_jsx("span", { children: text }), shortcuts !== undefined && shortcuts.length > 0 && (_jsx("span", { className: "reacd-tooltip-shortcuts", children: shortcuts.map((key, index) => (_jsx(KbdKey, { display: key, label: key }, index))) }))] }), arrow && _jsx(Tooltip.Arrow, { className: "reacd-tooltip-arrow" })] }) }) })] }));
|
|
29
|
+
}
|