@tryghost/shade 0.0.0-stage → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +142 -2
- package/es/app.js +4 -0
- package/es/assets/images/index.js +2 -0
- package/es/components/layout/error-page.js +40 -0
- package/es/components/layout/error-page.js.map +1 -0
- package/es/components/layout/heading.js +80 -0
- package/es/components/layout/heading.js.map +1 -0
- package/es/components/page-templates/detail-page.js +73 -0
- package/es/components/page-templates/detail-page.js.map +1 -0
- package/es/components/page-templates/large-page-title.js +89 -0
- package/es/components/page-templates/large-page-title.js.map +1 -0
- package/es/components/page-templates/list-page.js +174 -0
- package/es/components/page-templates/list-page.js.map +1 -0
- package/es/components/page-templates/modal-page.js +32 -0
- package/es/components/page-templates/modal-page.js.map +1 -0
- package/es/components/patterns/color-picker.js +328 -0
- package/es/components/patterns/color-picker.js.map +1 -0
- package/es/components/patterns/dirty-confirm-dialog.js +44 -0
- package/es/components/patterns/dirty-confirm-dialog.js.map +1 -0
- package/es/components/patterns/filter-bar-context.js +8 -0
- package/es/components/patterns/filter-bar-context.js.map +1 -0
- package/es/components/patterns/filter-bar.js +67 -0
- package/es/components/patterns/filter-bar.js.map +1 -0
- package/es/components/patterns/filters-helpers.js +415 -0
- package/es/components/patterns/filters-helpers.js.map +1 -0
- package/es/components/patterns/filters.js +1816 -0
- package/es/components/patterns/filters.js.map +1 -0
- package/es/components/patterns/gh-chart.js +152 -0
- package/es/components/patterns/gh-chart.js.map +1 -0
- package/es/components/patterns/image-upload-variants.js +13 -0
- package/es/components/patterns/image-upload-variants.js.map +1 -0
- package/es/components/patterns/image-upload.js +63 -0
- package/es/components/patterns/image-upload.js.map +1 -0
- package/es/components/patterns/kpi-card.js +46 -0
- package/es/components/patterns/kpi-card.js.map +1 -0
- package/es/components/patterns/kpi-tabs.js +61 -0
- package/es/components/patterns/kpi-tabs.js.map +1 -0
- package/es/components/patterns/page-header-large-title.js +13 -0
- package/es/components/patterns/page-header-large-title.js.map +1 -0
- package/es/components/patterns/page-header.js +375 -0
- package/es/components/patterns/page-header.js.map +1 -0
- package/es/components/patterns/setting-group-variants.js +22 -0
- package/es/components/patterns/setting-group-variants.js.map +1 -0
- package/es/components/patterns/setting-group.js +103 -0
- package/es/components/patterns/setting-group.js.map +1 -0
- package/es/components/patterns/settings-modal-variants.js +37 -0
- package/es/components/patterns/settings-modal-variants.js.map +1 -0
- package/es/components/patterns/settings-modal.js +192 -0
- package/es/components/patterns/settings-modal.js.map +1 -0
- package/es/components/patterns/share-modal.js +264 -0
- package/es/components/patterns/share-modal.js.map +1 -0
- package/es/components/patterns/use-dirty-confirmation.js +35 -0
- package/es/components/patterns/use-dirty-confirmation.js.map +1 -0
- package/es/components/patterns/view-bar.js +40 -0
- package/es/components/patterns/view-bar.js.map +1 -0
- package/es/components/primitives/box.js +25 -0
- package/es/components/primitives/box.js.map +1 -0
- package/es/components/primitives/container.js +35 -0
- package/es/components/primitives/container.js.map +1 -0
- package/es/components/primitives/grid.js +26 -0
- package/es/components/primitives/grid.js.map +1 -0
- package/es/components/primitives/index.js +7 -0
- package/es/components/primitives/inline.js +17 -0
- package/es/components/primitives/inline.js.map +1 -0
- package/es/components/primitives/stack.js +17 -0
- package/es/components/primitives/stack.js.map +1 -0
- package/es/components/primitives/text.js +48 -0
- package/es/components/primitives/text.js.map +1 -0
- package/es/components/primitives/types.js +56 -0
- package/es/components/primitives/types.js.map +1 -0
- package/es/components/ui/accordion.js +37 -0
- package/es/components/ui/accordion.js.map +1 -0
- package/es/components/ui/action-list.js +56 -0
- package/es/components/ui/action-list.js.map +1 -0
- package/es/components/ui/alert-dialog.js +80 -0
- package/es/components/ui/alert-dialog.js.map +1 -0
- package/es/components/ui/animated-number.js +14 -0
- package/es/components/ui/animated-number.js.map +1 -0
- package/es/components/ui/avatar.js +52 -0
- package/es/components/ui/avatar.js.map +1 -0
- package/es/components/ui/badge-variants.js +32 -0
- package/es/components/ui/badge-variants.js.map +1 -0
- package/es/components/ui/badge.js +22 -0
- package/es/components/ui/badge.js.map +1 -0
- package/es/components/ui/banner-variants.js +34 -0
- package/es/components/ui/banner-variants.js.map +1 -0
- package/es/components/ui/banner.js +37 -0
- package/es/components/ui/banner.js.map +1 -0
- package/es/components/ui/breadcrumb.js +64 -0
- package/es/components/ui/breadcrumb.js.map +1 -0
- package/es/components/ui/button-variants.js +137 -0
- package/es/components/ui/button-variants.js.map +1 -0
- package/es/components/ui/button.js +35 -0
- package/es/components/ui/button.js.map +1 -0
- package/es/components/ui/calendar.js +119 -0
- package/es/components/ui/calendar.js.map +1 -0
- package/es/components/ui/card-variants.js +13 -0
- package/es/components/ui/card-variants.js.map +1 -0
- package/es/components/ui/card.js +98 -0
- package/es/components/ui/card.js.map +1 -0
- package/es/components/ui/chart.js +188 -0
- package/es/components/ui/chart.js.map +1 -0
- package/es/components/ui/checkbox.js +21 -0
- package/es/components/ui/checkbox.js.map +1 -0
- package/es/components/ui/code-editor-view.js +150 -0
- package/es/components/ui/code-editor-view.js.map +1 -0
- package/es/components/ui/code-editor.js +18 -0
- package/es/components/ui/code-editor.js.map +1 -0
- package/es/components/ui/combobox.js +37 -0
- package/es/components/ui/combobox.js.map +1 -0
- package/es/components/ui/command.js +91 -0
- package/es/components/ui/command.js.map +1 -0
- package/es/components/ui/context-menu.js +82 -0
- package/es/components/ui/context-menu.js.map +1 -0
- package/es/components/ui/copy-field.js +142 -0
- package/es/components/ui/copy-field.js.map +1 -0
- package/es/components/ui/data-list.js +103 -0
- package/es/components/ui/data-list.js.map +1 -0
- package/es/components/ui/dialog.js +49 -0
- package/es/components/ui/dialog.js.map +1 -0
- package/es/components/ui/dropdown-menu.js +86 -0
- package/es/components/ui/dropdown-menu.js.map +1 -0
- package/es/components/ui/dropzone-variants.js +30 -0
- package/es/components/ui/dropzone-variants.js.map +1 -0
- package/es/components/ui/dropzone.js +55 -0
- package/es/components/ui/dropzone.js.map +1 -0
- package/es/components/ui/empty-indicator.js +42 -0
- package/es/components/ui/empty-indicator.js.map +1 -0
- package/es/components/ui/field.js +118 -0
- package/es/components/ui/field.js.map +1 -0
- package/es/components/ui/flag.js +30 -0
- package/es/components/ui/flag.js.map +1 -0
- package/es/components/ui/floating-sidebar-metrics.js +56 -0
- package/es/components/ui/floating-sidebar-metrics.js.map +1 -0
- package/es/components/ui/floating-sidebar.js +522 -0
- package/es/components/ui/floating-sidebar.js.map +1 -0
- package/es/components/ui/form-context.js +25 -0
- package/es/components/ui/form-context.js.map +1 -0
- package/es/components/ui/form.js +75 -0
- package/es/components/ui/form.js.map +1 -0
- package/es/components/ui/hover-card.js +20 -0
- package/es/components/ui/hover-card.js.map +1 -0
- package/es/components/ui/icon.js +2 -0
- package/es/components/ui/image-overlay-button.js +14 -0
- package/es/components/ui/image-overlay-button.js.map +1 -0
- package/es/components/ui/indicator-variants.js +63 -0
- package/es/components/ui/indicator-variants.js.map +1 -0
- package/es/components/ui/indicator.js +26 -0
- package/es/components/ui/indicator.js.map +1 -0
- package/es/components/ui/input-group-variants.js +25 -0
- package/es/components/ui/input-group-variants.js.map +1 -0
- package/es/components/ui/input-group.js +90 -0
- package/es/components/ui/input-group.js.map +1 -0
- package/es/components/ui/input-surface.js +51 -0
- package/es/components/ui/input-surface.js.map +1 -0
- package/es/components/ui/input.js +18 -0
- package/es/components/ui/input.js.map +1 -0
- package/es/components/ui/kbd.js +29 -0
- package/es/components/ui/kbd.js.map +1 -0
- package/es/components/ui/label.js +17 -0
- package/es/components/ui/label.js.map +1 -0
- package/es/components/ui/link.js +30 -0
- package/es/components/ui/link.js.map +1 -0
- package/es/components/ui/loading-indicator.js +50 -0
- package/es/components/ui/loading-indicator.js.map +1 -0
- package/es/components/ui/metric-value.js +39 -0
- package/es/components/ui/metric-value.js.map +1 -0
- package/es/components/ui/multi-select-combobox.js +205 -0
- package/es/components/ui/multi-select-combobox.js.map +1 -0
- package/es/components/ui/navbar.js +41 -0
- package/es/components/ui/navbar.js.map +1 -0
- package/es/components/ui/no-value-label.js +19 -0
- package/es/components/ui/no-value-label.js.map +1 -0
- package/es/components/ui/pagemenu.js +138 -0
- package/es/components/ui/pagemenu.js.map +1 -0
- package/es/components/ui/popover.js +24 -0
- package/es/components/ui/popover.js.map +1 -0
- package/es/components/ui/preview-chrome-variants.js +13 -0
- package/es/components/ui/preview-chrome-variants.js.map +1 -0
- package/es/components/ui/preview-chrome.js +27 -0
- package/es/components/ui/preview-chrome.js.map +1 -0
- package/es/components/ui/radio-group-variants.js +14 -0
- package/es/components/ui/radio-group-variants.js.map +1 -0
- package/es/components/ui/radio-group.js +33 -0
- package/es/components/ui/radio-group.js.map +1 -0
- package/es/components/ui/select-variants.js +45 -0
- package/es/components/ui/select-variants.js.map +1 -0
- package/es/components/ui/select.js +90 -0
- package/es/components/ui/select.js.map +1 -0
- package/es/components/ui/separator.js +17 -0
- package/es/components/ui/separator.js.map +1 -0
- package/es/components/ui/sheet.js +67 -0
- package/es/components/ui/sheet.js.map +1 -0
- package/es/components/ui/sidebar-context.js +12 -0
- package/es/components/ui/sidebar-context.js.map +1 -0
- package/es/components/ui/sidebar.js +384 -0
- package/es/components/ui/sidebar.js.map +1 -0
- package/es/components/ui/simple-pagination.js +68 -0
- package/es/components/ui/simple-pagination.js.map +1 -0
- package/es/components/ui/skeleton.js +77 -0
- package/es/components/ui/skeleton.js.map +1 -0
- package/es/components/ui/sonner.js +29 -0
- package/es/components/ui/sonner.js.map +1 -0
- package/es/components/ui/sortable-list.js +107 -0
- package/es/components/ui/sortable-list.js.map +1 -0
- package/es/components/ui/sticky-footer.js +29 -0
- package/es/components/ui/sticky-footer.js.map +1 -0
- package/es/components/ui/switch.js +34 -0
- package/es/components/ui/switch.js.map +1 -0
- package/es/components/ui/table.js +81 -0
- package/es/components/ui/table.js.map +1 -0
- package/es/components/ui/tabs-variants.js +19 -0
- package/es/components/ui/tabs-variants.js.map +1 -0
- package/es/components/ui/tabs.js +157 -0
- package/es/components/ui/tabs.js.map +1 -0
- package/es/components/ui/textarea.js +17 -0
- package/es/components/ui/textarea.js.map +1 -0
- package/es/components/ui/time-picker.js +28 -0
- package/es/components/ui/time-picker.js.map +1 -0
- package/es/components/ui/toggle-group.js +52 -0
- package/es/components/ui/toggle-group.js.map +1 -0
- package/es/components/ui/toggle-variants.js +34 -0
- package/es/components/ui/toggle-variants.js.map +1 -0
- package/es/components/ui/toggle.js +29 -0
- package/es/components/ui/toggle.js.map +1 -0
- package/es/components/ui/token-field.js +14 -0
- package/es/components/ui/token-field.js.map +1 -0
- package/es/components/ui/tooltip.js +116 -0
- package/es/components/ui/tooltip.js.map +1 -0
- package/es/components/ui/trend-badge.js +77 -0
- package/es/components/ui/trend-badge.js.map +1 -0
- package/es/components.js +79 -0
- package/es/hooks/use-global-dirty-state.js +21 -0
- package/es/hooks/use-global-dirty-state.js.map +1 -0
- package/es/hooks/use-mobile.js +23 -0
- package/es/hooks/use-mobile.js.map +1 -0
- package/es/hooks/use-simple-pagination.js +45 -0
- package/es/hooks/use-simple-pagination.js.map +1 -0
- package/es/icon-BJcGsQ4b.js +185 -0
- package/es/icon-BJcGsQ4b.js.map +1 -0
- package/es/images-CUcakpOD.js +124 -0
- package/es/images-CUcakpOD.js.map +1 -0
- package/es/index.js +113 -0
- package/es/lib/ds-utils.js +214 -0
- package/es/lib/ds-utils.js.map +1 -0
- package/es/lib/overlay-escape.js +13 -0
- package/es/lib/overlay-escape.js.map +1 -0
- package/es/lib/utils.js +2 -0
- package/es/page-templates.js +5 -0
- package/es/patterns.js +19 -0
- package/es/primitives.js +9 -0
- package/es/providers/global-dirty-state-provider.js +25 -0
- package/es/providers/global-dirty-state-provider.js.map +1 -0
- package/es/providers/header-tooltip-provider.js +24 -0
- package/es/providers/header-tooltip-provider.js.map +1 -0
- package/es/providers/shade-context.js +19 -0
- package/es/providers/shade-context.js.map +1 -0
- package/es/providers/shade-provider.js +64 -0
- package/es/providers/shade-provider.js.map +1 -0
- package/es/shade-app.js +28 -0
- package/es/shade-app.js.map +1 -0
- package/es/shade-scope.js +20 -0
- package/es/shade-scope.js.map +1 -0
- package/es/tokens.js +370 -0
- package/es/tokens.js.map +1 -0
- package/es/utils.js +7 -0
- package/package.json +150 -3
- package/preflight.css +422 -0
- package/styles-published.css +2 -0
- package/styles.css +299 -0
- package/tailwind.theme.css +472 -0
- package/theme-variables.css +287 -0
- package/tokens.css +3 -0
- package/types/app.d.ts +6 -0
- package/types/app.d.ts.map +1 -0
- package/types/assets/images/index.d.ts +10 -0
- package/types/assets/images/index.d.ts.map +1 -0
- package/types/components/layout/error-page.d.ts +10 -0
- package/types/components/layout/error-page.d.ts.map +1 -0
- package/types/components/layout/heading.d.ts +29 -0
- package/types/components/layout/heading.d.ts.map +1 -0
- package/types/components/page-templates/detail-page.d.ts +32 -0
- package/types/components/page-templates/detail-page.d.ts.map +1 -0
- package/types/components/page-templates/large-page-title.d.ts +43 -0
- package/types/components/page-templates/large-page-title.d.ts.map +1 -0
- package/types/components/page-templates/list-page.d.ts +44 -0
- package/types/components/page-templates/list-page.d.ts.map +1 -0
- package/types/components/page-templates/modal-page.d.ts +13 -0
- package/types/components/page-templates/modal-page.d.ts.map +1 -0
- package/types/components/patterns/color-picker.d.ts +48 -0
- package/types/components/patterns/color-picker.d.ts.map +1 -0
- package/types/components/patterns/dirty-confirm-dialog.d.ts +16 -0
- package/types/components/patterns/dirty-confirm-dialog.d.ts.map +1 -0
- package/types/components/patterns/filter-bar-context.d.ts +4 -0
- package/types/components/patterns/filter-bar-context.d.ts.map +1 -0
- package/types/components/patterns/filter-bar.d.ts +27 -0
- package/types/components/patterns/filter-bar.d.ts.map +1 -0
- package/types/components/patterns/filters-helpers.d.ts +7 -0
- package/types/components/patterns/filters-helpers.d.ts.map +1 -0
- package/types/components/patterns/filters.d.ts +262 -0
- package/types/components/patterns/filters.d.ts.map +1 -0
- package/types/components/patterns/gh-chart.d.ts +44 -0
- package/types/components/patterns/gh-chart.d.ts.map +1 -0
- package/types/components/patterns/image-upload-variants.d.ts +5 -0
- package/types/components/patterns/image-upload-variants.d.ts.map +1 -0
- package/types/components/patterns/image-upload.d.ts +15 -0
- package/types/components/patterns/image-upload.d.ts.map +1 -0
- package/types/components/patterns/kpi-card.d.ts +12 -0
- package/types/components/patterns/kpi-card.d.ts.map +1 -0
- package/types/components/patterns/kpi-tabs.d.ts +26 -0
- package/types/components/patterns/kpi-tabs.d.ts.map +1 -0
- package/types/components/patterns/page-header-large-title.d.ts +14 -0
- package/types/components/patterns/page-header-large-title.d.ts.map +1 -0
- package/types/components/patterns/page-header.d.ts +99 -0
- package/types/components/patterns/page-header.d.ts.map +1 -0
- package/types/components/patterns/setting-group-variants.d.ts +6 -0
- package/types/components/patterns/setting-group-variants.d.ts.map +1 -0
- package/types/components/patterns/setting-group.d.ts +22 -0
- package/types/components/patterns/setting-group.d.ts.map +1 -0
- package/types/components/patterns/settings-modal-variants.d.ts +8 -0
- package/types/components/patterns/settings-modal-variants.d.ts.map +1 -0
- package/types/components/patterns/settings-modal.d.ts +50 -0
- package/types/components/patterns/settings-modal.d.ts.map +1 -0
- package/types/components/patterns/share-modal.d.ts +56 -0
- package/types/components/patterns/share-modal.d.ts.map +1 -0
- package/types/components/patterns/use-dirty-confirmation.d.ts +3 -0
- package/types/components/patterns/use-dirty-confirmation.d.ts.map +1 -0
- package/types/components/patterns/view-bar.d.ts +13 -0
- package/types/components/patterns/view-bar.d.ts.map +1 -0
- package/types/components/primitives/box.d.ts +12 -0
- package/types/components/primitives/box.d.ts.map +1 -0
- package/types/components/primitives/container.d.ts +11 -0
- package/types/components/primitives/container.d.ts.map +1 -0
- package/types/components/primitives/grid.d.ts +12 -0
- package/types/components/primitives/grid.d.ts.map +1 -0
- package/types/components/primitives/index.d.ts +10 -0
- package/types/components/primitives/index.d.ts.map +1 -0
- package/types/components/primitives/inline.d.ts +13 -0
- package/types/components/primitives/inline.d.ts.map +1 -0
- package/types/components/primitives/stack.d.ts +10 -0
- package/types/components/primitives/stack.d.ts.map +1 -0
- package/types/components/primitives/text.d.ts +18 -0
- package/types/components/primitives/text.d.ts.map +1 -0
- package/types/components/primitives/types.d.ts +10 -0
- package/types/components/primitives/types.d.ts.map +1 -0
- package/types/components/ui/accordion.d.ts +8 -0
- package/types/components/ui/accordion.d.ts.map +1 -0
- package/types/components/ui/action-list.d.ts +21 -0
- package/types/components/ui/action-list.d.ts.map +1 -0
- package/types/components/ui/alert-dialog.d.ts +24 -0
- package/types/components/ui/alert-dialog.d.ts.map +1 -0
- package/types/components/ui/animated-number.d.ts +6 -0
- package/types/components/ui/animated-number.d.ts.map +1 -0
- package/types/components/ui/avatar.d.ts +17 -0
- package/types/components/ui/avatar.d.ts.map +1 -0
- package/types/components/ui/badge-variants.d.ts +7 -0
- package/types/components/ui/badge-variants.d.ts.map +1 -0
- package/types/components/ui/badge.d.ts +9 -0
- package/types/components/ui/badge.d.ts.map +1 -0
- package/types/components/ui/banner-variants.d.ts +6 -0
- package/types/components/ui/banner-variants.d.ts.map +1 -0
- package/types/components/ui/banner.d.ts +24 -0
- package/types/components/ui/banner.d.ts.map +1 -0
- package/types/components/ui/breadcrumb.d.ts +20 -0
- package/types/components/ui/breadcrumb.d.ts.map +1 -0
- package/types/components/ui/button-variants.d.ts +8 -0
- package/types/components/ui/button-variants.d.ts.map +1 -0
- package/types/components/ui/button.d.ts +9 -0
- package/types/components/ui/button.d.ts.map +1 -0
- package/types/components/ui/calendar.d.ts +15 -0
- package/types/components/ui/calendar.d.ts.map +1 -0
- package/types/components/ui/card-variants.d.ts +5 -0
- package/types/components/ui/card-variants.d.ts.map +1 -0
- package/types/components/ui/card.d.ts +16 -0
- package/types/components/ui/card.d.ts.map +1 -0
- package/types/components/ui/chart.d.ts +90 -0
- package/types/components/ui/chart.d.ts.map +1 -0
- package/types/components/ui/checkbox.d.ts +5 -0
- package/types/components/ui/checkbox.d.ts.map +1 -0
- package/types/components/ui/code-editor-view.d.ts +17 -0
- package/types/components/ui/code-editor-view.d.ts.map +1 -0
- package/types/components/ui/code-editor.d.ts +7 -0
- package/types/components/ui/code-editor.d.ts.map +1 -0
- package/types/components/ui/combobox.d.ts +10 -0
- package/types/components/ui/combobox.d.ts.map +1 -0
- package/types/components/ui/command.d.ts +22 -0
- package/types/components/ui/command.d.ts.map +1 -0
- package/types/components/ui/context-menu.d.ts +29 -0
- package/types/components/ui/context-menu.d.ts.map +1 -0
- package/types/components/ui/copy-field.d.ts +19 -0
- package/types/components/ui/copy-field.d.ts.map +1 -0
- package/types/components/ui/data-list.d.ts +53 -0
- package/types/components/ui/data-list.d.ts.map +1 -0
- package/types/components/ui/dialog.d.ts +20 -0
- package/types/components/ui/dialog.d.ts.map +1 -0
- package/types/components/ui/dropdown-menu.d.ts +28 -0
- package/types/components/ui/dropdown-menu.d.ts.map +1 -0
- package/types/components/ui/dropzone-variants.d.ts +7 -0
- package/types/components/ui/dropzone-variants.d.ts.map +1 -0
- package/types/components/ui/dropzone.d.ts +28 -0
- package/types/components/ui/dropzone.d.ts.map +1 -0
- package/types/components/ui/empty-indicator.d.ts +16 -0
- package/types/components/ui/empty-indicator.d.ts.map +1 -0
- package/types/components/ui/field.d.ts +25 -0
- package/types/components/ui/field.d.ts.map +1 -0
- package/types/components/ui/flag.d.ts +11 -0
- package/types/components/ui/flag.d.ts.map +1 -0
- package/types/components/ui/floating-sidebar-metrics.d.ts +54 -0
- package/types/components/ui/floating-sidebar-metrics.d.ts.map +1 -0
- package/types/components/ui/floating-sidebar.d.ts +72 -0
- package/types/components/ui/floating-sidebar.d.ts.map +1 -0
- package/types/components/ui/form-context.d.ts +24 -0
- package/types/components/ui/form-context.d.ts.map +1 -0
- package/types/components/ui/form.d.ts +14 -0
- package/types/components/ui/form.d.ts.map +1 -0
- package/types/components/ui/hover-card.d.ts +7 -0
- package/types/components/ui/hover-card.d.ts.map +1 -0
- package/types/components/ui/icon.d.ts +13 -0
- package/types/components/ui/icon.d.ts.map +1 -0
- package/types/components/ui/image-overlay-button.d.ts +7 -0
- package/types/components/ui/image-overlay-button.d.ts.map +1 -0
- package/types/components/ui/indicator-variants.d.ts +11 -0
- package/types/components/ui/indicator-variants.d.ts.map +1 -0
- package/types/components/ui/indicator.d.ts +9 -0
- package/types/components/ui/indicator.d.ts.map +1 -0
- package/types/components/ui/input-group-variants.d.ts +6 -0
- package/types/components/ui/input-group-variants.d.ts.map +1 -0
- package/types/components/ui/input-group.d.ts +18 -0
- package/types/components/ui/input-group.d.ts.map +1 -0
- package/types/components/ui/input-surface.d.ts +43 -0
- package/types/components/ui/input-surface.d.ts.map +1 -0
- package/types/components/ui/input.d.ts +4 -0
- package/types/components/ui/input.d.ts.map +1 -0
- package/types/components/ui/kbd.d.ts +10 -0
- package/types/components/ui/kbd.d.ts.map +1 -0
- package/types/components/ui/label.d.ts +6 -0
- package/types/components/ui/label.d.ts.map +1 -0
- package/types/components/ui/link.d.ts +15 -0
- package/types/components/ui/link.d.ts.map +1 -0
- package/types/components/ui/loading-indicator.d.ts +12 -0
- package/types/components/ui/loading-indicator.d.ts.map +1 -0
- package/types/components/ui/metric-value.d.ts +16 -0
- package/types/components/ui/metric-value.d.ts.map +1 -0
- package/types/components/ui/multi-select-combobox.d.ts +80 -0
- package/types/components/ui/multi-select-combobox.d.ts.map +1 -0
- package/types/components/ui/navbar.d.ts +18 -0
- package/types/components/ui/navbar.d.ts.map +1 -0
- package/types/components/ui/no-value-label.d.ts +14 -0
- package/types/components/ui/no-value-label.d.ts.map +1 -0
- package/types/components/ui/pagemenu.d.ts +18 -0
- package/types/components/ui/pagemenu.d.ts.map +1 -0
- package/types/components/ui/popover.d.ts +9 -0
- package/types/components/ui/popover.d.ts.map +1 -0
- package/types/components/ui/preview-chrome-variants.d.ts +5 -0
- package/types/components/ui/preview-chrome-variants.d.ts.map +1 -0
- package/types/components/ui/preview-chrome.d.ts +8 -0
- package/types/components/ui/preview-chrome.d.ts.map +1 -0
- package/types/components/ui/radio-group-variants.d.ts +5 -0
- package/types/components/ui/radio-group-variants.d.ts.map +1 -0
- package/types/components/ui/radio-group.d.ts +9 -0
- package/types/components/ui/radio-group.d.ts.map +1 -0
- package/types/components/ui/select-variants.d.ts +7 -0
- package/types/components/ui/select-variants.d.ts.map +1 -0
- package/types/components/ui/select.d.ts +20 -0
- package/types/components/ui/select.d.ts.map +1 -0
- package/types/components/ui/separator.d.ts +5 -0
- package/types/components/ui/separator.d.ts.map +1 -0
- package/types/components/ui/sheet.d.ts +26 -0
- package/types/components/ui/sheet.d.ts.map +1 -0
- package/types/components/ui/sidebar-context.d.ts +15 -0
- package/types/components/ui/sidebar-context.d.ts.map +1 -0
- package/types/components/ui/sidebar.d.ts +56 -0
- package/types/components/ui/sidebar.d.ts.map +1 -0
- package/types/components/ui/simple-pagination.d.ts +16 -0
- package/types/components/ui/simple-pagination.d.ts.map +1 -0
- package/types/components/ui/skeleton.d.ts +15 -0
- package/types/components/ui/skeleton.d.ts.map +1 -0
- package/types/components/ui/sonner.d.ts +5 -0
- package/types/components/ui/sonner.d.ts.map +1 -0
- package/types/components/ui/sortable-list.d.ts +39 -0
- package/types/components/ui/sortable-list.d.ts.map +1 -0
- package/types/components/ui/sticky-footer.d.ts +10 -0
- package/types/components/ui/sticky-footer.d.ts.map +1 -0
- package/types/components/ui/switch.d.ts +11 -0
- package/types/components/ui/switch.d.ts.map +1 -0
- package/types/components/ui/table.d.ts +21 -0
- package/types/components/ui/table.d.ts.map +1 -0
- package/types/components/ui/tabs-variants.d.ts +5 -0
- package/types/components/ui/tabs-variants.d.ts.map +1 -0
- package/types/components/ui/tabs.d.ts +21 -0
- package/types/components/ui/tabs.d.ts.map +1 -0
- package/types/components/ui/textarea.d.ts +4 -0
- package/types/components/ui/textarea.d.ts.map +1 -0
- package/types/components/ui/time-picker.d.ts +11 -0
- package/types/components/ui/time-picker.d.ts.map +1 -0
- package/types/components/ui/toggle-group.d.ts +17 -0
- package/types/components/ui/toggle-group.d.ts.map +1 -0
- package/types/components/ui/toggle-variants.d.ts +8 -0
- package/types/components/ui/toggle-variants.d.ts.map +1 -0
- package/types/components/ui/toggle.d.ts +11 -0
- package/types/components/ui/toggle.d.ts.map +1 -0
- package/types/components/ui/token-field.d.ts +8 -0
- package/types/components/ui/token-field.d.ts.map +1 -0
- package/types/components/ui/tooltip.d.ts +19 -0
- package/types/components/ui/tooltip.d.ts.map +1 -0
- package/types/components/ui/trend-badge.d.ts +13 -0
- package/types/components/ui/trend-badge.d.ts.map +1 -0
- package/types/components.d.ts +81 -0
- package/types/components.d.ts.map +1 -0
- package/types/hooks/use-global-dirty-state.d.ts +12 -0
- package/types/hooks/use-global-dirty-state.d.ts.map +1 -0
- package/types/hooks/use-mobile.d.ts +2 -0
- package/types/hooks/use-mobile.d.ts.map +1 -0
- package/types/hooks/use-simple-pagination.d.ts +45 -0
- package/types/hooks/use-simple-pagination.d.ts.map +1 -0
- package/types/index.d.ts +6 -0
- package/types/index.d.ts.map +1 -0
- package/types/lib/ds-utils.d.ts +36 -0
- package/types/lib/ds-utils.d.ts.map +1 -0
- package/types/lib/overlay-escape.d.ts +8 -0
- package/types/lib/overlay-escape.d.ts.map +1 -0
- package/types/lib/utils.d.ts +2 -0
- package/types/lib/utils.d.ts.map +1 -0
- package/types/page-templates.d.ts +6 -0
- package/types/page-templates.d.ts.map +1 -0
- package/types/patterns.d.ts +23 -0
- package/types/patterns.d.ts.map +1 -0
- package/types/primitives.d.ts +4 -0
- package/types/primitives.d.ts.map +1 -0
- package/types/providers/global-dirty-state-provider.d.ts +5 -0
- package/types/providers/global-dirty-state-provider.d.ts.map +1 -0
- package/types/providers/header-tooltip-provider.d.ts +4 -0
- package/types/providers/header-tooltip-provider.d.ts.map +1 -0
- package/types/providers/shade-context.d.ts +13 -0
- package/types/providers/shade-context.d.ts.map +1 -0
- package/types/providers/shade-provider.d.ts +11 -0
- package/types/providers/shade-provider.d.ts.map +1 -0
- package/types/shade-app.d.ts +17 -0
- package/types/shade-app.d.ts.map +1 -0
- package/types/shade-scope.d.ts +4 -0
- package/types/shade-scope.d.ts.map +1 -0
- package/types/tokens.d.ts +4 -0
- package/types/tokens.d.ts.map +1 -0
- package/types/utils.d.ts +7 -0
- package/types/utils.d.ts.map +1 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { cn } from "../../lib/ds-utils.js";
|
|
2
|
+
import { Grid } from "../primitives/grid.js";
|
|
3
|
+
import { Inline } from "../primitives/inline.js";
|
|
4
|
+
import { Stack } from "../primitives/stack.js";
|
|
5
|
+
import { Text } from "../primitives/text.js";
|
|
6
|
+
import { settingGroupVariants } from "./setting-group-variants.js";
|
|
7
|
+
import * as React$1 from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/patterns/setting-group.tsx
|
|
10
|
+
var SettingGroup = React$1.forwardRef(({ className, variant, highlighted, editing = false, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
11
|
+
ref,
|
|
12
|
+
className: cn(settingGroupVariants({
|
|
13
|
+
variant,
|
|
14
|
+
highlighted,
|
|
15
|
+
className
|
|
16
|
+
})),
|
|
17
|
+
"data-editing": editing,
|
|
18
|
+
...props
|
|
19
|
+
}));
|
|
20
|
+
SettingGroup.displayName = "SettingGroup";
|
|
21
|
+
var SettingGroupHeader = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Inline, {
|
|
22
|
+
ref,
|
|
23
|
+
align: "start",
|
|
24
|
+
as: "div",
|
|
25
|
+
className: cn("relative z-10 w-full", className),
|
|
26
|
+
gap: "lg",
|
|
27
|
+
justify: "between",
|
|
28
|
+
...props
|
|
29
|
+
}));
|
|
30
|
+
SettingGroupHeader.displayName = "SettingGroupHeader";
|
|
31
|
+
var SettingGroupDetails = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Stack, {
|
|
32
|
+
ref,
|
|
33
|
+
className: cn("min-w-0", className),
|
|
34
|
+
gap: "xs",
|
|
35
|
+
...props
|
|
36
|
+
}));
|
|
37
|
+
SettingGroupDetails.displayName = "SettingGroupDetails";
|
|
38
|
+
var SettingGroupTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Text, {
|
|
39
|
+
ref,
|
|
40
|
+
as: "h5",
|
|
41
|
+
className: cn("md:text-lg", className),
|
|
42
|
+
leading: "supertight",
|
|
43
|
+
weight: "semibold",
|
|
44
|
+
...props
|
|
45
|
+
}));
|
|
46
|
+
SettingGroupTitle.displayName = "SettingGroupTitle";
|
|
47
|
+
var SettingGroupDescription = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Text, {
|
|
48
|
+
ref,
|
|
49
|
+
className: cn("mr-5 hidden text-pretty group-data-[editing=false]/setting-group:block md:block", className),
|
|
50
|
+
...props
|
|
51
|
+
}));
|
|
52
|
+
SettingGroupDescription.displayName = "SettingGroupDescription";
|
|
53
|
+
var SettingGroupActions = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
54
|
+
ref,
|
|
55
|
+
className: cn("shrink-0 [&_button]:text-control!", className),
|
|
56
|
+
...props
|
|
57
|
+
}));
|
|
58
|
+
SettingGroupActions.displayName = "SettingGroupActions";
|
|
59
|
+
var SettingGroupContent = React$1.forwardRef(({ children, className, columns = 1, ...props }, ref) => {
|
|
60
|
+
if (columns === 2) return /* @__PURE__ */ jsx(Grid, {
|
|
61
|
+
ref,
|
|
62
|
+
className: cn("grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2", className),
|
|
63
|
+
columns: 1,
|
|
64
|
+
gap: "none",
|
|
65
|
+
...props,
|
|
66
|
+
children
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx(Stack, {
|
|
69
|
+
ref,
|
|
70
|
+
className: cn("gap-y-7", className),
|
|
71
|
+
gap: "none",
|
|
72
|
+
...props,
|
|
73
|
+
children
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
SettingGroupContent.displayName = "SettingGroupContent";
|
|
77
|
+
var SettingGroupValue = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Stack, {
|
|
78
|
+
ref,
|
|
79
|
+
className,
|
|
80
|
+
gap: "none",
|
|
81
|
+
...props
|
|
82
|
+
}));
|
|
83
|
+
SettingGroupValue.displayName = "SettingGroupValue";
|
|
84
|
+
var SettingGroupValueTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Text, {
|
|
85
|
+
ref,
|
|
86
|
+
as: "h6",
|
|
87
|
+
className: cn("text-base", className),
|
|
88
|
+
weight: "semibold",
|
|
89
|
+
...props
|
|
90
|
+
}));
|
|
91
|
+
SettingGroupValueTitle.displayName = "SettingGroupValueTitle";
|
|
92
|
+
var SettingGroupValueContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Inline, {
|
|
93
|
+
ref,
|
|
94
|
+
as: "div",
|
|
95
|
+
className,
|
|
96
|
+
gap: "none",
|
|
97
|
+
...props
|
|
98
|
+
}));
|
|
99
|
+
SettingGroupValueContent.displayName = "SettingGroupValueContent";
|
|
100
|
+
//#endregion
|
|
101
|
+
export { SettingGroup, SettingGroupActions, SettingGroupContent, SettingGroupDescription, SettingGroupDetails, SettingGroupHeader, SettingGroupTitle, SettingGroupValue, SettingGroupValueContent, SettingGroupValueTitle };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=setting-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting-group.js","names":[],"sources":["../../../src/components/patterns/setting-group.tsx"],"sourcesContent":["import * as React from 'react';\nimport { type VariantProps } from 'class-variance-authority';\n\nimport { settingGroupVariants } from '@/components/patterns/setting-group-variants';\nimport { Grid } from '@/components/primitives/grid';\nimport { Inline } from '@/components/primitives/inline';\nimport { Stack } from '@/components/primitives/stack';\nimport { Text } from '@/components/primitives/text';\nimport { cn } from '@/lib/utils';\n\ninterface SettingGroupProps\n extends React.ComponentPropsWithoutRef<'div'>, VariantProps<typeof settingGroupVariants> {\n editing?: boolean;\n}\n\nconst SettingGroup = React.forwardRef<HTMLDivElement, SettingGroupProps>(\n ({ className, variant, highlighted, editing = false, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(settingGroupVariants({ variant, highlighted, className }))}\n data-editing={editing}\n {...props}\n />\n ),\n);\nSettingGroup.displayName = 'SettingGroup';\n\nconst SettingGroupHeader = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<typeof Inline>\n>(({ className, ...props }, ref) => (\n <Inline\n ref={ref}\n align=\"start\"\n as=\"div\"\n className={cn('relative z-10 w-full', className)}\n gap=\"lg\"\n justify=\"between\"\n {...props}\n />\n));\nSettingGroupHeader.displayName = 'SettingGroupHeader';\n\nconst SettingGroupDetails = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<typeof Stack>\n>(({ className, ...props }, ref) => (\n <Stack ref={ref} className={cn('min-w-0', className)} gap=\"xs\" {...props} />\n));\nSettingGroupDetails.displayName = 'SettingGroupDetails';\n\nconst SettingGroupTitle = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<typeof Text>\n>(({ className, ...props }, ref) => (\n <Text\n ref={ref}\n as=\"h5\"\n className={cn('md:text-lg', className)}\n leading=\"supertight\"\n weight=\"semibold\"\n {...props}\n />\n));\nSettingGroupTitle.displayName = 'SettingGroupTitle';\n\nconst SettingGroupDescription = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<typeof Text>\n>(({ className, ...props }, ref) => (\n <Text\n ref={ref}\n className={cn(\n 'mr-5 hidden text-pretty group-data-[editing=false]/setting-group:block md:block',\n className,\n )}\n {...props}\n />\n));\nSettingGroupDescription.displayName = 'SettingGroupDescription';\n\nconst SettingGroupActions = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('shrink-0 [&_button]:text-control!', className)} {...props} />\n ),\n);\nSettingGroupActions.displayName = 'SettingGroupActions';\n\ninterface SettingGroupContentProps extends React.ComponentPropsWithoutRef<'div'> {\n columns?: 1 | 2;\n}\n\nconst SettingGroupContent = React.forwardRef<HTMLDivElement, SettingGroupContentProps>(\n ({ children, className, columns = 1, ...props }, ref) => {\n if (columns === 2) {\n return (\n <Grid\n ref={ref}\n className={cn('grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2', className)}\n columns={1}\n gap=\"none\"\n {...props}\n >\n {children}\n </Grid>\n );\n }\n\n return (\n <Stack ref={ref} className={cn('gap-y-7', className)} gap=\"none\" {...props}>\n {children}\n </Stack>\n );\n },\n);\nSettingGroupContent.displayName = 'SettingGroupContent';\n\nconst SettingGroupValue = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<typeof Stack>\n>(({ className, ...props }, ref) => (\n <Stack ref={ref} className={className} gap=\"none\" {...props} />\n));\nSettingGroupValue.displayName = 'SettingGroupValue';\n\nconst SettingGroupValueTitle = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<typeof Text>\n>(({ className, ...props }, ref) => (\n <Text ref={ref} as=\"h6\" className={cn('text-base', className)} weight=\"semibold\" {...props} />\n));\nSettingGroupValueTitle.displayName = 'SettingGroupValueTitle';\n\nconst SettingGroupValueContent = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<typeof Inline>\n>(({ className, ...props }, ref) => (\n <Inline ref={ref} as=\"div\" className={className} gap=\"none\" {...props} />\n));\nSettingGroupValueContent.displayName = 'SettingGroupValueContent';\n\nexport {\n SettingGroup,\n SettingGroupActions,\n SettingGroupContent,\n SettingGroupDescription,\n SettingGroupDetails,\n SettingGroupHeader,\n SettingGroupTitle,\n SettingGroupValue,\n SettingGroupValueContent,\n SettingGroupValueTitle,\n};\nexport type { SettingGroupContentProps, SettingGroupProps };\n"],"mappings":";;;;;;;;;AAeA,IAAM,eAAe,QAAM,YACxB,EAAE,WAAW,SAAS,aAAa,UAAU,OAAO,GAAG,SAAS,QAC/D,oBAAC,OAAD;CACO;CACL,WAAW,GAAG,qBAAqB;EAAE;EAAS;EAAa;CAAU,CAAC,CAAC;CACvE,gBAAc;CACd,GAAI;AACL,CAAA,CAEL;AACA,aAAa,cAAc;AAE3B,IAAM,qBAAqB,QAAM,YAG9B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,QAAD;CACO;CACL,OAAM;CACN,IAAG;CACH,WAAW,GAAG,wBAAwB,SAAS;CAC/C,KAAI;CACJ,SAAQ;CACR,GAAI;AACL,CAAA,CACF;AACD,mBAAmB,cAAc;AAEjC,IAAM,sBAAsB,QAAM,YAG/B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CAAY;CAAK,WAAW,GAAG,WAAW,SAAS;CAAG,KAAI;CAAK,GAAI;AAAQ,CAAA,CAC5E;AACD,oBAAoB,cAAc;AAElC,IAAM,oBAAoB,QAAM,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACO;CACL,IAAG;CACH,WAAW,GAAG,cAAc,SAAS;CACrC,SAAQ;CACR,QAAO;CACP,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc;AAEhC,IAAM,0BAA0B,QAAM,YAGnC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACO;CACL,WAAW,GACT,mFACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,wBAAwB,cAAc;AAEtC,IAAM,sBAAsB,QAAM,YAC/B,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CAAU;CAAK,WAAW,GAAG,qCAAqC,SAAS;CAAG,GAAI;AAAQ,CAAA,CAE9F;AACA,oBAAoB,cAAc;AAMlC,IAAM,sBAAsB,QAAM,YAC/B,EAAE,UAAU,WAAW,UAAU,GAAG,GAAG,SAAS,QAAQ;CACvD,IAAI,YAAY,GACd,OACE,oBAAC,MAAD;EACO;EACL,WAAW,GAAG,8CAA8C,SAAS;EACrE,SAAS;EACT,KAAI;EACJ,GAAI;EAEH;CACG,CAAA;CAIV,OACE,oBAAC,OAAD;EAAY;EAAK,WAAW,GAAG,WAAW,SAAS;EAAG,KAAI;EAAO,GAAI;EAClE;CACI,CAAA;AAEX,CACF;AACA,oBAAoB,cAAc;AAElC,IAAM,oBAAoB,QAAM,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,OAAD;CAAY;CAAgB;CAAW,KAAI;CAAO,GAAI;AAAQ,CAAA,CAC/D;AACD,kBAAkB,cAAc;AAEhC,IAAM,yBAAyB,QAAM,YAGlC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CAAW;CAAK,IAAG;CAAK,WAAW,GAAG,aAAa,SAAS;CAAG,QAAO;CAAW,GAAI;AAAQ,CAAA,CAC9F;AACD,uBAAuB,cAAc;AAErC,IAAM,2BAA2B,QAAM,YAGpC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,QAAD;CAAa;CAAK,IAAG;CAAiB;CAAW,KAAI;CAAO,GAAI;AAAQ,CAAA,CACzE;AACD,yBAAyB,cAAc"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/patterns/settings-modal-variants.ts
|
|
3
|
+
var settingsModalVariants = cva("relative z-50 flex max-h-full w-full flex-col justify-between overflow-x-hidden bg-background text-foreground", {
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
sm: "max-w-[480px] rounded-lg",
|
|
7
|
+
md: "max-w-[720px] rounded-lg",
|
|
8
|
+
lg: "max-w-[1020px] rounded-lg",
|
|
9
|
+
xl: "max-w-[1240px] rounded-lg",
|
|
10
|
+
full: "h-full rounded-lg",
|
|
11
|
+
bleed: "h-full"
|
|
12
|
+
},
|
|
13
|
+
align: {
|
|
14
|
+
center: "mx-auto",
|
|
15
|
+
left: "mr-auto",
|
|
16
|
+
right: "ml-auto"
|
|
17
|
+
},
|
|
18
|
+
scrolling: {
|
|
19
|
+
true: "overflow-y-auto",
|
|
20
|
+
false: "overflow-y-hidden"
|
|
21
|
+
},
|
|
22
|
+
formSheet: {
|
|
23
|
+
true: "shadow-md",
|
|
24
|
+
false: "shadow-xl"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "md",
|
|
29
|
+
align: "center",
|
|
30
|
+
scrolling: true,
|
|
31
|
+
formSheet: false
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { settingsModalVariants };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=settings-modal-variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-modal-variants.js","names":[],"sources":["../../../src/components/patterns/settings-modal-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst settingsModalVariants = cva(\n 'relative z-50 flex max-h-full w-full flex-col justify-between overflow-x-hidden bg-background text-foreground',\n {\n variants: {\n size: {\n sm: 'max-w-[480px] rounded-lg',\n md: 'max-w-[720px] rounded-lg',\n lg: 'max-w-[1020px] rounded-lg',\n xl: 'max-w-[1240px] rounded-lg',\n full: 'h-full rounded-lg',\n bleed: 'h-full',\n },\n align: {\n center: 'mx-auto',\n left: 'mr-auto',\n right: 'ml-auto',\n },\n scrolling: {\n true: 'overflow-y-auto',\n false: 'overflow-y-hidden',\n },\n formSheet: {\n true: 'shadow-md',\n false: 'shadow-xl',\n },\n },\n defaultVariants: {\n size: 'md',\n align: 'center',\n scrolling: true,\n formSheet: false,\n },\n },\n);\n\nexport { settingsModalVariants };\n"],"mappings":";;AAEA,IAAM,wBAAwB,IAC5B,iHACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,OAAO;EACT;EACA,OAAO;GACL,QAAQ;GACR,MAAM;GACN,OAAO;EACT;EACA,WAAW;GACT,MAAM;GACN,OAAO;EACT;EACA,WAAW;GACT,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,OAAO;EACP,WAAW;EACX,WAAW;CACb;AACF,CACF"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import useGlobalDirtyState from "../../hooks/use-global-dirty-state.js";
|
|
2
|
+
import { cn } from "../../lib/ds-utils.js";
|
|
3
|
+
import { Box } from "../primitives/box.js";
|
|
4
|
+
import { Inline } from "../primitives/inline.js";
|
|
5
|
+
import { Text } from "../primitives/text.js";
|
|
6
|
+
import { Button } from "../ui/button.js";
|
|
7
|
+
import { DirtyConfirmDialog } from "./dirty-confirm-dialog.js";
|
|
8
|
+
import { useDirtyConfirmation } from "./use-dirty-confirmation.js";
|
|
9
|
+
import { settingsModalVariants } from "./settings-modal-variants.js";
|
|
10
|
+
import { LoadingIndicator } from "../ui/loading-indicator.js";
|
|
11
|
+
import { StickyFooter } from "../ui/sticky-footer.js";
|
|
12
|
+
import { X } from "lucide-react";
|
|
13
|
+
import { forwardRef, useEffect, useState } from "react";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
//#region src/components/patterns/settings-modal.tsx
|
|
16
|
+
var MODAL_BACKDROP_CLASSES = "bg-modal-backdrop backdrop-blur-[3px]";
|
|
17
|
+
var backdropPadding = {
|
|
18
|
+
sm: "p-4 md:p-[8vmin]",
|
|
19
|
+
md: "p-4 md:p-[8vmin]",
|
|
20
|
+
lg: "p-4 md:p-[4vmin]",
|
|
21
|
+
xl: "p-4 md:p-[3vmin]",
|
|
22
|
+
full: "p-4 md:p-[3vmin]",
|
|
23
|
+
bleed: ""
|
|
24
|
+
};
|
|
25
|
+
var contentPadding = {
|
|
26
|
+
sm: "p-8",
|
|
27
|
+
md: "p-8",
|
|
28
|
+
lg: "p-7",
|
|
29
|
+
xl: "p-10",
|
|
30
|
+
full: "p-10",
|
|
31
|
+
bleed: "p-10"
|
|
32
|
+
};
|
|
33
|
+
var headerOffsets = {
|
|
34
|
+
sm: "-inset-x-8",
|
|
35
|
+
md: "-inset-x-8",
|
|
36
|
+
lg: "-inset-x-8",
|
|
37
|
+
xl: "-inset-x-10 -top-10",
|
|
38
|
+
full: "-inset-x-10",
|
|
39
|
+
bleed: "-inset-x-10"
|
|
40
|
+
};
|
|
41
|
+
var SettingsModal = forwardRef(({ "aria-label": ariaLabel, className, size = "md", align = "center", width, height, testId, title, okLabel = "OK", okLoading = false, cancelLabel = "Cancel", footer, footerClassName, header, leftButton, buttonsDisabled, okDisabled, padding = true, onOk, okVariant = "default", onCancel, topRightContent, hideXOnMobile = false, onClose, afterClose, children, backDrop = true, backDropClick = true, stickyFooter = false, stickyHeader = false, scrolling = true, dirty = false, animate = true, formSheet = false, enableCMDS = true, allowBackgroundInteraction = false }, ref) => {
|
|
42
|
+
const { setGlobalDirtyState } = useGlobalDirtyState();
|
|
43
|
+
const { confirm, dialogProps } = useDirtyConfirmation();
|
|
44
|
+
const [animationFinished, setAnimationFinished] = useState(false);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
setGlobalDirtyState(dirty);
|
|
47
|
+
}, [dirty, setGlobalDirtyState]);
|
|
48
|
+
const removeModal = () => {
|
|
49
|
+
confirm(dirty, () => {
|
|
50
|
+
onClose();
|
|
51
|
+
afterClose?.();
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const handleEscapeKey = (event) => {
|
|
56
|
+
if (event.key !== "Escape") return;
|
|
57
|
+
const activeElement = document.activeElement;
|
|
58
|
+
if (activeElement?.hasAttribute("data-kg-link-input")) return;
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
if (event.defaultPrevented) return;
|
|
61
|
+
if (activeElement instanceof HTMLElement && document.activeElement === activeElement) activeElement.blur();
|
|
62
|
+
if (onCancel) onCancel();
|
|
63
|
+
else removeModal();
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener("keydown", handleEscapeKey);
|
|
67
|
+
return () => document.removeEventListener("keydown", handleEscapeKey);
|
|
68
|
+
});
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const timeout = setTimeout(() => setAnimationFinished(true), 250);
|
|
71
|
+
return () => clearTimeout(timeout);
|
|
72
|
+
}, []);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!onOk || !enableCMDS) return;
|
|
75
|
+
const handleCMDS = (event) => {
|
|
76
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "s") {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
onOk();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
window.addEventListener("keydown", handleCMDS);
|
|
82
|
+
return () => window.removeEventListener("keydown", handleCMDS);
|
|
83
|
+
}, [enableCMDS, onOk]);
|
|
84
|
+
const paddingClasses = padding ? contentPadding[size] : "p-0";
|
|
85
|
+
const modalClasses = cn(settingsModalVariants({
|
|
86
|
+
size,
|
|
87
|
+
align,
|
|
88
|
+
scrolling,
|
|
89
|
+
formSheet
|
|
90
|
+
}), className, animate && !formSheet && !animationFinished && align === "center" && "animate-modal-in", animate && !formSheet && !animationFinished && align === "right" && "animate-modal-in-from-right", formSheet && !animationFinished && "animate-modal-in-reverse", width === "full" && "w-full", width === "toSidebar" && "w-full max-w-[calc(100dvw_-_280px)] lg:max-w-full min-[1280px]:max-w-[calc(100dvw_-_320px)]", height === "full" && "h-full", allowBackgroundInteraction && "pointer-events-auto");
|
|
91
|
+
const backdropClasses = cn("fixed inset-0 z-[1000] h-[100dvh] w-[100dvw] max-[800px]:pb-20", backdropPadding[size], allowBackgroundInteraction && "pointer-events-none");
|
|
92
|
+
const headerClasses = cn(paddingClasses, "pb-0", headerOffsets[size], topRightContent && topRightContent !== "close" && "flex items-center justify-between gap-5", stickyHeader && "sticky -top-px z-[300] -mb-4 bg-background pb-4");
|
|
93
|
+
const contentClasses = cn(paddingClasses, "py-0", (size === "full" || size === "bleed" || height === "full" || typeof height === "number") && "grow", !scrolling && "min-h-0", footer === false && "pb-0");
|
|
94
|
+
const footerClasses = cn(paddingClasses, "flex w-full items-center justify-between", stickyFooter && "py-6", footerClassName);
|
|
95
|
+
const modalStyles = {
|
|
96
|
+
...typeof width === "number" ? {
|
|
97
|
+
width: "100%",
|
|
98
|
+
maxWidth: `${width}px`
|
|
99
|
+
} : {},
|
|
100
|
+
...typeof height === "number" ? {
|
|
101
|
+
height: "100%",
|
|
102
|
+
maxHeight: `${height}px`
|
|
103
|
+
} : {}
|
|
104
|
+
};
|
|
105
|
+
const handleBackdropClick = (event) => {
|
|
106
|
+
if (event.target === event.currentTarget && backDropClick) removeModal();
|
|
107
|
+
};
|
|
108
|
+
let footerContent;
|
|
109
|
+
if (footer) footerContent = footer;
|
|
110
|
+
else if (footer !== false) footerContent = /* @__PURE__ */ jsxs(Inline, {
|
|
111
|
+
className: footerClasses,
|
|
112
|
+
gap: "none",
|
|
113
|
+
justify: "between",
|
|
114
|
+
children: [/* @__PURE__ */ jsx(Box, { children: leftButton }), /* @__PURE__ */ jsxs(Inline, {
|
|
115
|
+
gap: "md",
|
|
116
|
+
children: [cancelLabel && /* @__PURE__ */ jsx(Button, {
|
|
117
|
+
"data-testid": "cancel-modal",
|
|
118
|
+
disabled: buttonsDisabled,
|
|
119
|
+
type: "button",
|
|
120
|
+
variant: "outline",
|
|
121
|
+
onClick: onCancel || removeModal,
|
|
122
|
+
children: cancelLabel
|
|
123
|
+
}), okLabel && /* @__PURE__ */ jsxs(Button, {
|
|
124
|
+
"data-testid": "ok-modal",
|
|
125
|
+
disabled: buttonsDisabled || okDisabled || okLoading,
|
|
126
|
+
type: "button",
|
|
127
|
+
variant: okVariant,
|
|
128
|
+
onClick: () => void onOk?.(),
|
|
129
|
+
children: [okLoading && /* @__PURE__ */ jsx(LoadingIndicator, { size: "sm" }), okLabel]
|
|
130
|
+
})]
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
if (stickyFooter) footerContent = /* @__PURE__ */ jsx(StickyFooter, {
|
|
134
|
+
height: 84,
|
|
135
|
+
children: footerContent
|
|
136
|
+
});
|
|
137
|
+
const titleContent = title && /* @__PURE__ */ jsx(Text, {
|
|
138
|
+
as: "h3",
|
|
139
|
+
className: "md:text-2xl",
|
|
140
|
+
leading: "heading",
|
|
141
|
+
size: "xl",
|
|
142
|
+
weight: "bold",
|
|
143
|
+
children: title
|
|
144
|
+
});
|
|
145
|
+
const headerContent = topRightContent && topRightContent !== "close" ? /* @__PURE__ */ jsxs(Inline, {
|
|
146
|
+
as: "header",
|
|
147
|
+
className: headerClasses,
|
|
148
|
+
gap: "lg",
|
|
149
|
+
justify: "between",
|
|
150
|
+
children: [titleContent, topRightContent]
|
|
151
|
+
}) : /* @__PURE__ */ jsxs("header", {
|
|
152
|
+
className: headerClasses,
|
|
153
|
+
children: [titleContent, /* @__PURE__ */ jsx(Box, {
|
|
154
|
+
className: cn("absolute top-6 right-6", topRightContent !== "close" && "md:hidden", hideXOnMobile && "hidden"),
|
|
155
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
156
|
+
"aria-label": "Close modal",
|
|
157
|
+
className: "-m-2 opacity-50 hover:opacity-100",
|
|
158
|
+
"data-testid": "close-modal",
|
|
159
|
+
size: "icon",
|
|
160
|
+
type: "button",
|
|
161
|
+
variant: "ghost",
|
|
162
|
+
onClick: removeModal,
|
|
163
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
|
|
168
|
+
className: backdropClasses,
|
|
169
|
+
id: "modal-backdrop",
|
|
170
|
+
onMouseDown: handleBackdropClick,
|
|
171
|
+
children: [/* @__PURE__ */ jsx(Box, { className: cn("pointer-events-none fixed inset-0 z-0", backDrop && !formSheet && MODAL_BACKDROP_CLASSES, formSheet && "bg-form-sheet-backdrop") }), /* @__PURE__ */ jsxs("section", {
|
|
172
|
+
ref,
|
|
173
|
+
"aria-label": ariaLabel,
|
|
174
|
+
className: modalClasses,
|
|
175
|
+
"data-testid": testId,
|
|
176
|
+
style: modalStyles,
|
|
177
|
+
children: [
|
|
178
|
+
header !== false && headerContent,
|
|
179
|
+
/* @__PURE__ */ jsx(Box, {
|
|
180
|
+
className: contentClasses,
|
|
181
|
+
children
|
|
182
|
+
}),
|
|
183
|
+
footerContent
|
|
184
|
+
]
|
|
185
|
+
})]
|
|
186
|
+
}), /* @__PURE__ */ jsx(DirtyConfirmDialog, { ...dialogProps })] });
|
|
187
|
+
});
|
|
188
|
+
SettingsModal.displayName = "SettingsModal";
|
|
189
|
+
//#endregion
|
|
190
|
+
export { SettingsModal };
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=settings-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-modal.js","names":[],"sources":["../../../src/components/patterns/settings-modal.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport React, { forwardRef, useEffect, useState } from 'react';\n\nimport { settingsModalVariants } from '@/components/patterns/settings-modal-variants';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { LoadingIndicator } from '@/components/ui/loading-indicator';\nimport { StickyFooter } from '@/components/ui/sticky-footer';\nimport { Box } from '@/components/primitives/box';\nimport { Inline } from '@/components/primitives/inline';\nimport { Text } from '@/components/primitives/text';\nimport { DirtyConfirmDialog } from '@/components/patterns/dirty-confirm-dialog';\nimport { useDirtyConfirmation } from '@/components/patterns/use-dirty-confirmation';\nimport useGlobalDirtyState from '@/hooks/use-global-dirty-state';\nimport { cn } from '@/lib/utils';\n\n/**\n * Consumer-controlled settings modal shell. Legacy full-page settings dialogs\n * still render through it; new modal flows should use Shade Dialog primitives.\n */\nexport type SettingsModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'bleed';\n\nexport interface SettingsModalProps {\n 'aria-label'?: string;\n className?: string;\n size?: SettingsModalSize;\n width?: 'full' | 'toSidebar' | number;\n height?: 'full' | number;\n align?: 'center' | 'left' | 'right';\n testId?: string;\n title?: React.ReactNode;\n okLabel?: string;\n okVariant?: ButtonProps['variant'];\n okLoading?: boolean;\n cancelLabel?: string;\n leftButton?: React.ReactNode;\n buttonsDisabled?: boolean;\n okDisabled?: boolean;\n footer?: boolean | React.ReactNode;\n /** Extra classes on the default footer's button row, e.g. to constrain its width. */\n footerClassName?: string;\n header?: boolean;\n padding?: boolean;\n /** May be async; the modal fires it without awaiting, so the handler owns its own error handling. */\n onOk?: () => void | Promise<void>;\n onCancel?: () => void;\n topRightContent?: 'close' | React.ReactNode;\n hideXOnMobile?: boolean;\n onClose: () => void;\n afterClose?: () => void;\n children?: React.ReactNode;\n backDrop?: boolean;\n backDropClick?: boolean;\n stickyFooter?: boolean;\n stickyHeader?: boolean;\n scrolling?: boolean;\n dirty?: boolean;\n animate?: boolean;\n formSheet?: boolean;\n enableCMDS?: boolean;\n allowBackgroundInteraction?: boolean;\n}\n\nconst MODAL_BACKDROP_CLASSES = 'bg-modal-backdrop backdrop-blur-[3px]';\n\nconst backdropPadding: Record<SettingsModalSize, string> = {\n sm: 'p-4 md:p-[8vmin]',\n md: 'p-4 md:p-[8vmin]',\n lg: 'p-4 md:p-[4vmin]',\n xl: 'p-4 md:p-[3vmin]',\n full: 'p-4 md:p-[3vmin]',\n bleed: '',\n};\n\nconst contentPadding: Record<SettingsModalSize, string> = {\n sm: 'p-8',\n md: 'p-8',\n lg: 'p-7',\n xl: 'p-10',\n full: 'p-10',\n bleed: 'p-10',\n};\n\nconst headerOffsets: Record<SettingsModalSize, string> = {\n sm: '-inset-x-8',\n md: '-inset-x-8',\n lg: '-inset-x-8',\n xl: '-inset-x-10 -top-10',\n full: '-inset-x-10',\n bleed: '-inset-x-10',\n};\n\nconst SettingsModal = forwardRef<HTMLElement, SettingsModalProps>(\n (\n {\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n align = 'center',\n width,\n height,\n testId,\n title,\n okLabel = 'OK',\n okLoading = false,\n cancelLabel = 'Cancel',\n footer,\n footerClassName,\n header,\n leftButton,\n buttonsDisabled,\n okDisabled,\n padding = true,\n onOk,\n okVariant = 'default',\n onCancel,\n topRightContent,\n hideXOnMobile = false,\n onClose,\n afterClose,\n children,\n backDrop = true,\n backDropClick = true,\n stickyFooter = false,\n stickyHeader = false,\n scrolling = true,\n dirty = false,\n animate = true,\n formSheet = false,\n enableCMDS = true,\n allowBackgroundInteraction = false,\n },\n ref,\n ) => {\n const { setGlobalDirtyState } = useGlobalDirtyState();\n const { confirm, dialogProps } = useDirtyConfirmation();\n const [animationFinished, setAnimationFinished] = useState(false);\n useEffect(() => {\n setGlobalDirtyState(dirty);\n }, [dirty, setGlobalDirtyState]);\n\n const removeModal = () => {\n confirm(dirty, () => {\n onClose();\n afterClose?.();\n });\n };\n\n useEffect(() => {\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return;\n }\n\n const activeElement = document.activeElement;\n if (activeElement?.hasAttribute('data-kg-link-input')) {\n return;\n }\n\n setTimeout(() => {\n // Radix layers may handle Escape from a document listener that\n // was registered after this modal. Wait until propagation is\n // complete before deciding whether the modal should close.\n if (event.defaultPrevented) {\n return;\n }\n\n if (activeElement instanceof HTMLElement && document.activeElement === activeElement) {\n activeElement.blur();\n }\n\n if (onCancel) {\n onCancel();\n } else {\n removeModal();\n }\n });\n };\n\n document.addEventListener('keydown', handleEscapeKey);\n return () => document.removeEventListener('keydown', handleEscapeKey);\n });\n\n useEffect(() => {\n const timeout = setTimeout(() => setAnimationFinished(true), 250);\n return () => clearTimeout(timeout);\n }, []);\n\n useEffect(() => {\n if (!onOk || !enableCMDS) {\n return;\n }\n\n const handleCMDS = (event: KeyboardEvent) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 's') {\n event.preventDefault();\n void onOk();\n }\n };\n\n window.addEventListener('keydown', handleCMDS);\n return () => window.removeEventListener('keydown', handleCMDS);\n }, [enableCMDS, onOk]);\n\n const paddingClasses = padding ? contentPadding[size] : 'p-0';\n const modalClasses = cn(\n settingsModalVariants({ size, align, scrolling, formSheet }),\n className,\n animate && !formSheet && !animationFinished && align === 'center' && 'animate-modal-in',\n animate &&\n !formSheet &&\n !animationFinished &&\n align === 'right' &&\n 'animate-modal-in-from-right',\n formSheet && !animationFinished && 'animate-modal-in-reverse',\n width === 'full' && 'w-full',\n width === 'toSidebar' &&\n 'w-full max-w-[calc(100dvw_-_280px)] lg:max-w-full min-[1280px]:max-w-[calc(100dvw_-_320px)]',\n height === 'full' && 'h-full',\n allowBackgroundInteraction && 'pointer-events-auto',\n );\n const backdropClasses = cn(\n 'fixed inset-0 z-[1000] h-[100dvh] w-[100dvw] max-[800px]:pb-20',\n backdropPadding[size],\n allowBackgroundInteraction && 'pointer-events-none',\n );\n const headerClasses = cn(\n paddingClasses,\n 'pb-0',\n headerOffsets[size],\n topRightContent && topRightContent !== 'close' && 'flex items-center justify-between gap-5',\n stickyHeader && 'sticky -top-px z-[300] -mb-4 bg-background pb-4',\n );\n const contentClasses = cn(\n paddingClasses,\n 'py-0',\n (size === 'full' || size === 'bleed' || height === 'full' || typeof height === 'number') &&\n 'grow',\n !scrolling && 'min-h-0',\n footer === false && 'pb-0',\n );\n const footerClasses = cn(\n paddingClasses,\n 'flex w-full items-center justify-between',\n stickyFooter && 'py-6',\n footerClassName,\n );\n const modalStyles: React.CSSProperties = {\n ...(typeof width === 'number' ? { width: '100%', maxWidth: `${width}px` } : {}),\n ...(typeof height === 'number' ? { height: '100%', maxHeight: `${height}px` } : {}),\n };\n\n const handleBackdropClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && backDropClick) {\n removeModal();\n }\n };\n\n let footerContent: React.ReactNode;\n if (footer) {\n footerContent = footer;\n } else if (footer !== false) {\n footerContent = (\n <Inline className={footerClasses} gap=\"none\" justify=\"between\">\n <Box>{leftButton}</Box>\n <Inline gap=\"md\">\n {cancelLabel && (\n <Button\n data-testid=\"cancel-modal\"\n disabled={buttonsDisabled}\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel || removeModal}\n >\n {cancelLabel}\n </Button>\n )}\n {okLabel && (\n <Button\n data-testid=\"ok-modal\"\n disabled={buttonsDisabled || okDisabled || okLoading}\n type=\"button\"\n variant={okVariant}\n onClick={() => void onOk?.()}\n >\n {okLoading && <LoadingIndicator size=\"sm\" />}\n {okLabel}\n </Button>\n )}\n </Inline>\n </Inline>\n );\n }\n\n if (stickyFooter) {\n footerContent = <StickyFooter height={84}>{footerContent}</StickyFooter>;\n }\n\n const titleContent = title && (\n <Text as=\"h3\" className=\"md:text-2xl\" leading=\"heading\" size=\"xl\" weight=\"bold\">\n {title}\n </Text>\n );\n const headerContent =\n topRightContent && topRightContent !== 'close' ? (\n <Inline as=\"header\" className={headerClasses} gap=\"lg\" justify=\"between\">\n {titleContent}\n {topRightContent}\n </Inline>\n ) : (\n <header className={headerClasses}>\n {titleContent}\n <Box\n className={cn(\n 'absolute top-6 right-6',\n topRightContent !== 'close' && 'md:hidden',\n hideXOnMobile && 'hidden',\n )}\n >\n <Button\n aria-label=\"Close modal\"\n className=\"-m-2 opacity-50 hover:opacity-100\"\n data-testid=\"close-modal\"\n size=\"icon\"\n type=\"button\"\n variant=\"ghost\"\n onClick={removeModal}\n >\n <X />\n </Button>\n </Box>\n </header>\n );\n\n return (\n <>\n <Box className={backdropClasses} id=\"modal-backdrop\" onMouseDown={handleBackdropClick}>\n <Box\n className={cn(\n 'pointer-events-none fixed inset-0 z-0',\n backDrop && !formSheet && MODAL_BACKDROP_CLASSES,\n formSheet && 'bg-form-sheet-backdrop',\n )}\n />\n <section\n ref={ref}\n aria-label={ariaLabel}\n className={modalClasses}\n data-testid={testId}\n style={modalStyles}\n >\n {header !== false && headerContent}\n <Box className={contentClasses}>{children}</Box>\n {footerContent}\n </section>\n </Box>\n <DirtyConfirmDialog {...dialogProps} />\n </>\n );\n },\n);\n\nSettingsModal.displayName = 'SettingsModal';\n\nexport { SettingsModal };\n"],"mappings":"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"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { cn } from "../../lib/ds-utils.js";
|
|
2
|
+
import { useShade } from "../../providers/shade-context.js";
|
|
3
|
+
import { Button } from "../ui/button.js";
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "../ui/dialog.js";
|
|
5
|
+
import { Check, Copy, Link, X } from "lucide-react";
|
|
6
|
+
import React, { useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/patterns/share-modal.tsx
|
|
9
|
+
async function copyTextToClipboard(text) {
|
|
10
|
+
if (navigator.clipboard?.writeText) try {
|
|
11
|
+
await navigator.clipboard.writeText(text);
|
|
12
|
+
return;
|
|
13
|
+
} catch {}
|
|
14
|
+
const textarea = document.createElement("textarea");
|
|
15
|
+
textarea.value = text;
|
|
16
|
+
textarea.setAttribute("readonly", "");
|
|
17
|
+
textarea.style.position = "fixed";
|
|
18
|
+
textarea.style.left = "-9999px";
|
|
19
|
+
textarea.style.top = "0";
|
|
20
|
+
document.body.appendChild(textarea);
|
|
21
|
+
textarea.select();
|
|
22
|
+
document.execCommand("copy");
|
|
23
|
+
document.body.removeChild(textarea);
|
|
24
|
+
}
|
|
25
|
+
function Root(props) {
|
|
26
|
+
return /* @__PURE__ */ jsx(Dialog, { ...props });
|
|
27
|
+
}
|
|
28
|
+
var Trigger = React.forwardRef(({ asChild = true, className, ...props }, ref) => /* @__PURE__ */ jsx(DialogTrigger, {
|
|
29
|
+
ref,
|
|
30
|
+
asChild,
|
|
31
|
+
className: cn("cursor-pointer", className),
|
|
32
|
+
...props
|
|
33
|
+
}));
|
|
34
|
+
Trigger.displayName = "ShareModal.Trigger";
|
|
35
|
+
var Content = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogContent, {
|
|
36
|
+
ref,
|
|
37
|
+
className: cn("max-h-[calc(100vh-16vmin)] max-w-[540px] overflow-y-auto p-8", className),
|
|
38
|
+
...props
|
|
39
|
+
}));
|
|
40
|
+
Content.displayName = "ShareModal.Content";
|
|
41
|
+
function Header({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(DialogHeader, {
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function Title({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(DialogTitle, {
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function Description({ className, ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(DialogDescription, {
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var CloseButton = React.forwardRef(({ children, className, size = "lg", title = "Close", variant = "link", ...props }, ref) => /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
ref,
|
|
61
|
+
className: cn("aspect-square cursor-pointer p-2 text-muted-foreground hover:text-foreground [&_svg]:size-6!", className),
|
|
62
|
+
size,
|
|
63
|
+
title,
|
|
64
|
+
variant,
|
|
65
|
+
...props,
|
|
66
|
+
children: children || /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(X, {
|
|
67
|
+
size: 24,
|
|
68
|
+
strokeWidth: 1
|
|
69
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: "sr-only",
|
|
71
|
+
children: "Close"
|
|
72
|
+
})] })
|
|
73
|
+
}));
|
|
74
|
+
CloseButton.displayName = "ShareModal.CloseButton";
|
|
75
|
+
var Preview = React.forwardRef(({ className, href, rel = "noopener noreferrer", target = "_blank", ...props }, ref) => {
|
|
76
|
+
const { isAdmin7 } = useShade();
|
|
77
|
+
return /* @__PURE__ */ jsx("a", {
|
|
78
|
+
ref,
|
|
79
|
+
className: cn("flex flex-col items-stretch overflow-hidden border transition-all hover:border-muted-foreground/40", isAdmin7 && "rounded-xl", className),
|
|
80
|
+
href,
|
|
81
|
+
rel,
|
|
82
|
+
target,
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
Preview.displayName = "ShareModal.Preview";
|
|
87
|
+
function SocialIcon({ service }) {
|
|
88
|
+
if (service === "threads") return /* @__PURE__ */ jsxs("svg", {
|
|
89
|
+
fill: "none",
|
|
90
|
+
viewBox: "0 0 18 18",
|
|
91
|
+
children: [/* @__PURE__ */ jsx("g", {
|
|
92
|
+
clipPath: "url(#social-threads_svg__clip0_351_18008)",
|
|
93
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
94
|
+
d: "M13.033 8.38a5.924 5.924 0 00-.223-.102c-.13-2.418-1.452-3.802-3.67-3.816h-.03c-1.327 0-2.43.566-3.11 1.597l1.22.837c.507-.77 1.304-.934 1.89-.934h.02c.73.004 1.282.217 1.639.63.26.302.433.72.519 1.245a9.334 9.334 0 00-2.097-.101c-2.109.121-3.465 1.351-3.374 3.06.047.868.478 1.614 1.216 2.1.624.413 1.428.614 2.263.568 1.103-.06 1.969-.48 2.572-1.25.459-.585.749-1.342.877-2.296.526.317.915.735 1.13 1.236.366.854.387 2.255-.756 3.398-1.003 1.002-2.207 1.435-4.028 1.448-2.02-.015-3.547-.663-4.54-1.925-.93-1.182-1.41-2.89-1.428-5.075.018-2.185.498-3.893 1.428-5.075.993-1.262 2.52-1.91 4.54-1.925 2.034.015 3.588.666 4.62 1.934.505.622.886 1.405 1.137 2.317l1.43-.382c-.305-1.122-.784-2.09-1.436-2.892C13.52 1.35 11.587.517 9.096.5h-.01C6.6.517 4.689 1.354 3.404 2.986 2.262 4.44 1.672 6.46 1.652 8.994v.012c.02 2.534.61 4.555 1.752 6.008C4.69 16.646 6.6 17.483 9.086 17.5h.01c2.21-.015 3.768-.594 5.051-1.876 1.68-1.678 1.629-3.78 1.075-5.07-.397-.927-1.154-1.678-2.189-2.175zm-3.816 3.587c-.924.052-1.884-.363-1.932-1.252-.035-.659.47-1.394 1.99-1.482a8.9 8.9 0 01.512-.014c.552 0 1.068.053 1.538.156-.175 2.187-1.203 2.542-2.108 2.592z",
|
|
95
|
+
fill: "currentColor"
|
|
96
|
+
})
|
|
97
|
+
}), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
|
|
98
|
+
id: "social-threads_svg__clip0_351_18008",
|
|
99
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
100
|
+
d: "M0 0h17v17H0z",
|
|
101
|
+
fill: "#fff",
|
|
102
|
+
transform: "translate(.5 .5)"
|
|
103
|
+
})
|
|
104
|
+
}) })]
|
|
105
|
+
});
|
|
106
|
+
if (service === "facebook") return /* @__PURE__ */ jsxs("svg", {
|
|
107
|
+
fill: "none",
|
|
108
|
+
viewBox: "0 0 40 40",
|
|
109
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
110
|
+
d: "M20 40.004c11.046 0 20-8.955 20-20 0-11.046-8.954-20-20-20s-20 8.954-20 20c0 11.045 8.954 20 20 20z",
|
|
111
|
+
fill: "#1977f3"
|
|
112
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
113
|
+
d: "M27.785 25.785l.886-5.782h-5.546V16.25c0-1.58.773-3.125 3.26-3.125h2.522V8.204s-2.29-.39-4.477-.39c-4.568 0-7.555 2.767-7.555 7.781v4.408h-5.08v5.782h5.08v13.976a20.08 20.08 0 003.125.242c1.063 0 2.107-.085 3.125-.242V25.785h4.66z",
|
|
114
|
+
fill: "#fff"
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
if (service === "linkedin") return /* @__PURE__ */ jsxs("svg", {
|
|
118
|
+
fill: "none",
|
|
119
|
+
viewBox: "0 0 16 16",
|
|
120
|
+
children: [/* @__PURE__ */ jsxs("g", {
|
|
121
|
+
clipPath: "url(#social-linkedin_svg__clip0_537_833)",
|
|
122
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
123
|
+
clipRule: "evenodd",
|
|
124
|
+
d: "M1.778 16h12.444c.982 0 1.778-.796 1.778-1.778V1.778C16 .796 15.204 0 14.222 0H1.778C.796 0 0 .796 0 1.778v12.444C0 15.204.796 16 1.778 16z",
|
|
125
|
+
fill: "#007ebb",
|
|
126
|
+
fillRule: "evenodd"
|
|
127
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
128
|
+
clipRule: "evenodd",
|
|
129
|
+
d: "M13.778 13.778h-2.374V9.734c0-1.109-.421-1.729-1.299-1.729-.955 0-1.453.645-1.453 1.729v4.044H6.363V6.074h2.289v1.038s.688-1.273 2.322-1.273c1.634 0 2.804.997 2.804 3.061v4.878zM3.634 5.065c-.78 0-1.411-.636-1.411-1.421s.631-1.422 1.41-1.422c.78 0 1.411.637 1.411 1.422 0 .785-.631 1.421-1.41 1.421zm-1.182 8.713h2.386V6.074H2.452v7.704z",
|
|
130
|
+
fill: "#fff",
|
|
131
|
+
fillRule: "evenodd"
|
|
132
|
+
})]
|
|
133
|
+
}), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
|
|
134
|
+
id: "social-linkedin_svg__clip0_537_833",
|
|
135
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
136
|
+
d: "M0 0h16v16H0z",
|
|
137
|
+
fill: "#fff"
|
|
138
|
+
})
|
|
139
|
+
}) })]
|
|
140
|
+
});
|
|
141
|
+
if (service === "bluesky") return /* @__PURE__ */ jsx("svg", {
|
|
142
|
+
fill: "none",
|
|
143
|
+
viewBox: "0 -33.5 568 568",
|
|
144
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
145
|
+
d: "M123.121 33.664C188.241 82.553 258.281 181.681 284 234.873c25.719-53.192 95.759-152.32 160.879-201.209C491.866-1.612 568-28.906 568 57.946c0 17.346-9.945 145.713-15.778 166.555-20.275 72.453-94.155 90.933-159.875 79.748 114.875 19.551 144.097 84.311 80.986 149.071-119.86 122.992-172.272-30.859-185.702-70.281-2.462-7.227-3.614-10.608-3.631-7.733-.017-2.875-1.169.506-3.631 7.733-13.43 39.422-65.842 193.273-185.702 70.281-63.111-64.76-33.889-129.52 80.986-149.071-65.72 11.185-139.6-7.295-159.875-79.748C9.945 203.659 0 75.292 0 57.946 0-28.906 76.135-1.612 123.121 33.664z",
|
|
146
|
+
fill: "#0085ff"
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
viewBox: "0 0 24 24",
|
|
152
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
153
|
+
d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",
|
|
154
|
+
fill: "currentColor"
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function SocialLinks({ className, layout = "footer", links, shape, variant, ...props }) {
|
|
159
|
+
const { isAdmin7 } = useShade();
|
|
160
|
+
if (layout === "stacked") return /* @__PURE__ */ jsx("div", {
|
|
161
|
+
className: cn("flex gap-2", className),
|
|
162
|
+
...props,
|
|
163
|
+
children: links.map((link) => /* @__PURE__ */ jsx(Button, {
|
|
164
|
+
className: "flex-1",
|
|
165
|
+
id: link.id,
|
|
166
|
+
shape,
|
|
167
|
+
variant: variant ?? "outline",
|
|
168
|
+
asChild: true,
|
|
169
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
170
|
+
"aria-label": link.label,
|
|
171
|
+
href: link.href,
|
|
172
|
+
rel: "noreferrer",
|
|
173
|
+
target: "_blank",
|
|
174
|
+
title: link.title || link.label,
|
|
175
|
+
children: [/* @__PURE__ */ jsx(SocialIcon, { service: link.service }), /* @__PURE__ */ jsx("span", {
|
|
176
|
+
className: "sr-only",
|
|
177
|
+
children: link.label
|
|
178
|
+
})]
|
|
179
|
+
})
|
|
180
|
+
}, link.id ?? link.href))
|
|
181
|
+
});
|
|
182
|
+
return /* @__PURE__ */ jsx("div", {
|
|
183
|
+
className: cn("flex items-center gap-2", className),
|
|
184
|
+
...props,
|
|
185
|
+
children: links.map((link) => isAdmin7 || shape || variant ? /* @__PURE__ */ jsx(Button, {
|
|
186
|
+
className: "w-12 flex-none px-3",
|
|
187
|
+
shape,
|
|
188
|
+
variant: variant ?? "ghost",
|
|
189
|
+
asChild: true,
|
|
190
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
191
|
+
"aria-label": link.label,
|
|
192
|
+
href: link.href,
|
|
193
|
+
id: link.id,
|
|
194
|
+
rel: "noopener noreferrer",
|
|
195
|
+
target: "_blank",
|
|
196
|
+
title: link.title || link.label,
|
|
197
|
+
children: /* @__PURE__ */ jsx(SocialIcon, { service: link.service })
|
|
198
|
+
})
|
|
199
|
+
}, link.id ?? link.href) : /* @__PURE__ */ jsx("a", {
|
|
200
|
+
"aria-label": link.label,
|
|
201
|
+
className: "flex h-(--control-height) flex-1 items-center justify-center rounded-xs bg-muted px-3 hover:bg-muted-foreground/20 sm:w-14 sm:flex-none [&_svg]:h-4",
|
|
202
|
+
href: link.href,
|
|
203
|
+
rel: "noopener noreferrer",
|
|
204
|
+
target: "_blank",
|
|
205
|
+
title: link.title || link.label,
|
|
206
|
+
children: /* @__PURE__ */ jsx(SocialIcon, { service: link.service })
|
|
207
|
+
}, link.id ?? link.href))
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function CopyButton({ children, copyURL, disabled, icon = "link", label = "Copy link", onClick, successLabel = "Copied!", ...props }) {
|
|
211
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
212
|
+
const handleCopyLink = async (event) => {
|
|
213
|
+
onClick?.(event);
|
|
214
|
+
if (event.defaultPrevented) return;
|
|
215
|
+
await copyTextToClipboard(copyURL);
|
|
216
|
+
setIsCopied(true);
|
|
217
|
+
setTimeout(() => setIsCopied(false), 2e3);
|
|
218
|
+
};
|
|
219
|
+
const Icon = icon === "copy" ? Copy : Link;
|
|
220
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
221
|
+
disabled: disabled || !copyURL,
|
|
222
|
+
type: "button",
|
|
223
|
+
onClick: (event) => {
|
|
224
|
+
handleCopyLink(event);
|
|
225
|
+
},
|
|
226
|
+
...props,
|
|
227
|
+
children: children || /* @__PURE__ */ jsxs(Fragment$1, { children: [isCopied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Icon, {}), isCopied ? successLabel : label] })
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function CopyURLBox({ children, className, copyURL, ...props }) {
|
|
231
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
232
|
+
className: cn("flex items-center gap-2 rounded-md border bg-muted p-2", className),
|
|
233
|
+
...props,
|
|
234
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
235
|
+
className: "min-w-0 flex-1 truncate px-2 text-sm",
|
|
236
|
+
children: copyURL
|
|
237
|
+
}), children]
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function Footer({ className, ...props }) {
|
|
241
|
+
const { isAdmin7 } = useShade();
|
|
242
|
+
return /* @__PURE__ */ jsx(DialogFooter, {
|
|
243
|
+
className: cn("justify-between gap-6", isAdmin7 && "gap-8 sm:gap-8", className),
|
|
244
|
+
...props
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
var ShareModal = {
|
|
248
|
+
CloseButton,
|
|
249
|
+
Content,
|
|
250
|
+
CopyButton,
|
|
251
|
+
CopyURLBox,
|
|
252
|
+
Description,
|
|
253
|
+
Footer,
|
|
254
|
+
Header,
|
|
255
|
+
Preview,
|
|
256
|
+
Root,
|
|
257
|
+
SocialLinks,
|
|
258
|
+
Title,
|
|
259
|
+
Trigger
|
|
260
|
+
};
|
|
261
|
+
//#endregion
|
|
262
|
+
export { ShareModal as default };
|
|
263
|
+
|
|
264
|
+
//# sourceMappingURL=share-modal.js.map
|