@thomasfosterau/components 0.0.0 → 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 +21 -0
- package/README.md +241 -56
- package/dist/canvas/VectorCanvas.svelte +320 -0
- package/dist/canvas/VectorCanvas.svelte.d.ts +105 -0
- package/dist/canvas/history.d.ts +105 -0
- package/dist/canvas/history.js +147 -0
- package/dist/canvas/index.d.ts +15 -0
- package/dist/canvas/index.js +14 -0
- package/dist/canvas/types.d.ts +91 -0
- package/dist/canvas/types.js +13 -0
- package/dist/canvas/utils.d.ts +66 -0
- package/dist/canvas/utils.js +114 -0
- package/dist/charts/Chart.svelte +300 -0
- package/dist/charts/Chart.svelte.d.ts +50 -0
- package/dist/charts/index.d.ts +11 -0
- package/dist/charts/index.js +10 -0
- package/dist/charts/types.d.ts +28 -0
- package/dist/charts/types.js +6 -0
- package/dist/citations/BookCitation.svelte +53 -0
- package/dist/citations/BookCitation.svelte.d.ts +41 -0
- package/dist/citations/ChapterCitation.svelte +38 -0
- package/dist/citations/ChapterCitation.svelte.d.ts +50 -0
- package/dist/citations/Citation.svelte +47 -0
- package/dist/citations/Citation.svelte.d.ts +24 -0
- package/dist/citations/CreditList.svelte +69 -0
- package/dist/citations/CreditList.svelte.d.ts +47 -0
- package/dist/citations/DOILink.svelte +28 -0
- package/dist/citations/DOILink.svelte.d.ts +19 -0
- package/dist/citations/Footnote.svelte +39 -0
- package/dist/citations/Footnote.svelte.d.ts +17 -0
- package/dist/citations/FootnoteList.svelte +36 -0
- package/dist/citations/FootnoteList.svelte.d.ts +21 -0
- package/dist/citations/ISBNLink.svelte +29 -0
- package/dist/citations/ISBNLink.svelte.d.ts +19 -0
- package/dist/citations/ISSNLink.svelte +29 -0
- package/dist/citations/ISSNLink.svelte.d.ts +19 -0
- package/dist/citations/Publisher.svelte +34 -0
- package/dist/citations/Publisher.svelte.d.ts +14 -0
- package/dist/citations/ReferenceList.svelte +53 -0
- package/dist/citations/ReferenceList.svelte.d.ts +21 -0
- package/dist/citations/ReportCitation.svelte +41 -0
- package/dist/citations/ReportCitation.svelte.d.ts +36 -0
- package/dist/citations/ScholarlyArticleCitation.svelte +64 -0
- package/dist/citations/ScholarlyArticleCitation.svelte.d.ts +41 -0
- package/dist/citations/ThesisCitation.svelte +35 -0
- package/dist/citations/ThesisCitation.svelte.d.ts +29 -0
- package/dist/citations/bibliography.svelte.d.ts +55 -0
- package/dist/citations/bibliography.svelte.js +78 -0
- package/dist/citations/citation.d.ts +71 -0
- package/dist/citations/citation.js +121 -0
- package/dist/citations/csl.d.ts +102 -0
- package/dist/citations/csl.js +20 -0
- package/dist/citations/index.d.ts +31 -0
- package/dist/citations/index.js +36 -0
- package/dist/citations/list-format.d.ts +34 -0
- package/dist/citations/list-format.js +40 -0
- package/dist/context.svelte.d.ts +46 -0
- package/dist/context.svelte.js +51 -0
- package/dist/data/ChatBubble.svelte +48 -0
- package/dist/data/ChatBubble.svelte.d.ts +33 -0
- package/dist/data/DataGrid.svelte +150 -0
- package/dist/data/DataGrid.svelte.d.ts +118 -0
- package/dist/data/DescriptionList.svelte +53 -0
- package/dist/data/DescriptionList.svelte.d.ts +26 -0
- package/dist/data/DescriptionRow.svelte +56 -0
- package/dist/data/DescriptionRow.svelte.d.ts +21 -0
- package/dist/data/DiffText.svelte +29 -0
- package/dist/data/DiffText.svelte.d.ts +19 -0
- package/dist/data/ItemList.svelte +80 -0
- package/dist/data/ItemList.svelte.d.ts +52 -0
- package/dist/data/LinkListItem.svelte +46 -0
- package/dist/data/LinkListItem.svelte.d.ts +21 -0
- package/dist/data/MessageThread.svelte +29 -0
- package/dist/data/MessageThread.svelte.d.ts +17 -0
- package/dist/data/Pagination.svelte +136 -0
- package/dist/data/Pagination.svelte.d.ts +79 -0
- package/dist/data/PaginationFooter.svelte +42 -0
- package/dist/data/PaginationFooter.svelte.d.ts +61 -0
- package/dist/data/ResultCount.svelte +27 -0
- package/dist/data/ResultCount.svelte.d.ts +18 -0
- package/dist/data/Table.svelte +151 -0
- package/dist/data/Table.svelte.d.ts +75 -0
- package/dist/data/TreeList.svelte +41 -0
- package/dist/data/TreeList.svelte.d.ts +17 -0
- package/dist/data/TreeListItem.svelte +29 -0
- package/dist/data/TreeListItem.svelte.d.ts +10 -0
- package/dist/data/description-context.d.ts +39 -0
- package/dist/data/description-context.js +36 -0
- package/dist/data/diff.d.ts +14 -0
- package/dist/data/diff.js +10 -0
- package/dist/data/index.d.ts +37 -0
- package/dist/data/index.js +37 -0
- package/dist/data/list-item.d.ts +30 -0
- package/dist/data/list-item.js +19 -0
- package/dist/data/pagination.d.ts +81 -0
- package/dist/data/pagination.js +79 -0
- package/dist/data/table-types.d.ts +71 -0
- package/dist/data/table-types.js +35 -0
- package/dist/feedback/ConfirmDialog.svelte +79 -0
- package/dist/feedback/ConfirmDialog.svelte.d.ts +82 -0
- package/dist/feedback/Dialog.svelte +47 -0
- package/dist/feedback/Dialog.svelte.d.ts +36 -0
- package/dist/feedback/DialogFrame.svelte +64 -0
- package/dist/feedback/DialogFrame.svelte.d.ts +23 -0
- package/dist/feedback/Drawer.svelte +43 -0
- package/dist/feedback/Drawer.svelte.d.ts +43 -0
- package/dist/feedback/LoadingBoundary.svelte +61 -0
- package/dist/feedback/LoadingBoundary.svelte.d.ts +34 -0
- package/dist/feedback/ProgressBar.svelte +46 -0
- package/dist/feedback/ProgressBar.svelte.d.ts +28 -0
- package/dist/feedback/SegmentBar.svelte +83 -0
- package/dist/feedback/SegmentBar.svelte.d.ts +37 -0
- package/dist/feedback/StatTile.svelte +77 -0
- package/dist/feedback/StatTile.svelte.d.ts +50 -0
- package/dist/feedback/Stats.svelte +18 -0
- package/dist/feedback/Stats.svelte.d.ts +16 -0
- package/dist/feedback/Steps.svelte +72 -0
- package/dist/feedback/Steps.svelte.d.ts +61 -0
- package/dist/feedback/Timeline.svelte +86 -0
- package/dist/feedback/Timeline.svelte.d.ts +55 -0
- package/dist/feedback/Toaster.svelte +78 -0
- package/dist/feedback/Toaster.svelte.d.ts +32 -0
- package/dist/feedback/index.d.ts +34 -0
- package/dist/feedback/index.js +29 -0
- package/dist/feedback/sizes.d.ts +41 -0
- package/dist/feedback/sizes.js +69 -0
- package/dist/feedback/toaster.d.ts +48 -0
- package/dist/feedback/toaster.js +29 -0
- package/dist/fields/Calendar.svelte +60 -0
- package/dist/fields/Calendar.svelte.d.ts +11 -0
- package/dist/fields/CalendarMonths.svelte +86 -0
- package/dist/fields/CalendarMonths.svelte.d.ts +30 -0
- package/dist/fields/Checkbox.svelte +33 -0
- package/dist/fields/Checkbox.svelte.d.ts +30 -0
- package/dist/fields/CheckboxGroup.svelte +41 -0
- package/dist/fields/CheckboxGroup.svelte.d.ts +40 -0
- package/dist/fields/Combobox.svelte +229 -0
- package/dist/fields/Combobox.svelte.d.ts +133 -0
- package/dist/fields/DateField.svelte +37 -0
- package/dist/fields/DateField.svelte.d.ts +20 -0
- package/dist/fields/DateInput.svelte +31 -0
- package/dist/fields/DateInput.svelte.d.ts +35 -0
- package/dist/fields/DatePicker.svelte +47 -0
- package/dist/fields/DatePicker.svelte.d.ts +25 -0
- package/dist/fields/DateRangePicker.svelte +70 -0
- package/dist/fields/DateRangePicker.svelte.d.ts +43 -0
- package/dist/fields/Dropzone.svelte +232 -0
- package/dist/fields/Dropzone.svelte.d.ts +103 -0
- package/dist/fields/FieldErrors.svelte +30 -0
- package/dist/fields/FieldErrors.svelte.d.ts +11 -0
- package/dist/fields/Fieldset.svelte +53 -0
- package/dist/fields/Fieldset.svelte.d.ts +27 -0
- package/dist/fields/FileInput.svelte +68 -0
- package/dist/fields/FileInput.svelte.d.ts +39 -0
- package/dist/fields/FormField.svelte +78 -0
- package/dist/fields/FormField.svelte.d.ts +29 -0
- package/dist/fields/ImageInput.svelte +87 -0
- package/dist/fields/ImageInput.svelte.d.ts +45 -0
- package/dist/fields/MultiSelect.svelte +112 -0
- package/dist/fields/MultiSelect.svelte.d.ts +75 -0
- package/dist/fields/NumberField.svelte +190 -0
- package/dist/fields/NumberField.svelte.d.ts +76 -0
- package/dist/fields/PasswordInput.svelte +95 -0
- package/dist/fields/PasswordInput.svelte.d.ts +58 -0
- package/dist/fields/PickerPopover.svelte +47 -0
- package/dist/fields/PickerPopover.svelte.d.ts +16 -0
- package/dist/fields/PinInput.svelte +83 -0
- package/dist/fields/PinInput.svelte.d.ts +66 -0
- package/dist/fields/PushToggle.svelte +93 -0
- package/dist/fields/PushToggle.svelte.d.ts +55 -0
- package/dist/fields/RadioGroup.svelte +88 -0
- package/dist/fields/RadioGroup.svelte.d.ts +41 -0
- package/dist/fields/RangeCalendar.svelte +51 -0
- package/dist/fields/RangeCalendar.svelte.d.ts +23 -0
- package/dist/fields/Rating.svelte +127 -0
- package/dist/fields/Rating.svelte.d.ts +86 -0
- package/dist/fields/SearchInput.svelte +58 -0
- package/dist/fields/SearchInput.svelte.d.ts +33 -0
- package/dist/fields/SegmentGroup.svelte +91 -0
- package/dist/fields/SegmentGroup.svelte.d.ts +20 -0
- package/dist/fields/Select.svelte +36 -0
- package/dist/fields/Select.svelte.d.ts +35 -0
- package/dist/fields/Slider.svelte +194 -0
- package/dist/fields/Slider.svelte.d.ts +100 -0
- package/dist/fields/TagsInput.svelte +256 -0
- package/dist/fields/TagsInput.svelte.d.ts +102 -0
- package/dist/fields/TextInput.svelte +26 -0
- package/dist/fields/TextInput.svelte.d.ts +36 -0
- package/dist/fields/Textarea.svelte +22 -0
- package/dist/fields/Textarea.svelte.d.ts +31 -0
- package/dist/fields/TimeField.svelte +30 -0
- package/dist/fields/TimeField.svelte.d.ts +19 -0
- package/dist/fields/Toggle.svelte +72 -0
- package/dist/fields/Toggle.svelte.d.ts +38 -0
- package/dist/fields/VideoInput.svelte +35 -0
- package/dist/fields/VideoInput.svelte.d.ts +46 -0
- package/dist/fields/calendar-props.d.ts +119 -0
- package/dist/fields/calendar-props.js +51 -0
- package/dist/fields/dates.d.ts +28 -0
- package/dist/fields/dates.js +26 -0
- package/dist/fields/field-types.d.ts +80 -0
- package/dist/fields/field-types.js +92 -0
- package/dist/fields/file-validation.d.ts +30 -0
- package/dist/fields/file-validation.js +51 -0
- package/dist/fields/index.d.ts +43 -0
- package/dist/fields/index.js +42 -0
- package/dist/fields/latest-search.svelte.d.ts +38 -0
- package/dist/fields/latest-search.svelte.js +85 -0
- package/dist/fields/number-format.d.ts +52 -0
- package/dist/fields/number-format.js +89 -0
- package/dist/fields/segmented-field.d.ts +128 -0
- package/dist/fields/segmented-field.js +52 -0
- package/dist/fields/slider-keys.d.ts +21 -0
- package/dist/fields/slider-keys.js +37 -0
- package/dist/formatting/Countdown.svelte +110 -0
- package/dist/formatting/Countdown.svelte.d.ts +35 -0
- package/dist/formatting/DateTime.svelte +35 -0
- package/dist/formatting/DateTime.svelte.d.ts +26 -0
- package/dist/formatting/Duration.svelte +18 -0
- package/dist/formatting/Duration.svelte.d.ts +20 -0
- package/dist/formatting/FormatList.svelte +31 -0
- package/dist/formatting/FormatList.svelte.d.ts +46 -0
- package/dist/formatting/Highlight.svelte +51 -0
- package/dist/formatting/Highlight.svelte.d.ts +19 -0
- package/dist/formatting/Number.svelte +35 -0
- package/dist/formatting/Number.svelte.d.ts +43 -0
- package/dist/formatting/RelativeTime.svelte +69 -0
- package/dist/formatting/RelativeTime.svelte.d.ts +26 -0
- package/dist/formatting/Year.svelte +39 -0
- package/dist/formatting/Year.svelte.d.ts +21 -0
- package/dist/formatting/duration.d.ts +44 -0
- package/dist/formatting/duration.js +125 -0
- package/dist/formatting/index.d.ts +15 -0
- package/dist/formatting/index.js +17 -0
- package/dist/forms/EntityForm.svelte +185 -0
- package/dist/forms/EntityForm.svelte.d.ts +66 -0
- package/dist/forms/FormActions.svelte +29 -0
- package/dist/forms/FormActions.svelte.d.ts +37 -0
- package/dist/forms/FormErrors.svelte +21 -0
- package/dist/forms/FormErrors.svelte.d.ts +16 -0
- package/dist/forms/HiddenField.svelte +22 -0
- package/dist/forms/HiddenField.svelte.d.ts +11 -0
- package/dist/forms/SearchForm.svelte +43 -0
- package/dist/forms/SearchForm.svelte.d.ts +36 -0
- package/dist/forms/entity-form.d.ts +12 -0
- package/dist/forms/entity-form.js +12 -0
- package/dist/forms/index.d.ts +14 -0
- package/dist/forms/index.js +14 -0
- package/dist/hotkeys/HotkeyBadge.svelte +39 -0
- package/dist/hotkeys/HotkeyBadge.svelte.d.ts +25 -0
- package/dist/hotkeys/HotkeyHelpDialog.svelte +68 -0
- package/dist/hotkeys/HotkeyHelpDialog.svelte.d.ts +35 -0
- package/dist/hotkeys/HotkeyProvider.svelte +92 -0
- package/dist/hotkeys/HotkeyProvider.svelte.d.ts +4 -0
- package/dist/hotkeys/context.svelte.d.ts +47 -0
- package/dist/hotkeys/context.svelte.js +72 -0
- package/dist/hotkeys/index.d.ts +28 -0
- package/dist/hotkeys/index.js +27 -0
- package/dist/hotkeys/match.d.ts +65 -0
- package/dist/hotkeys/match.js +135 -0
- package/dist/hotkeys/registry.svelte.d.ts +55 -0
- package/dist/hotkeys/registry.svelte.js +110 -0
- package/dist/hotkeys/types.d.ts +74 -0
- package/dist/hotkeys/types.js +18 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +37 -0
- package/dist/infobox/Infobox.svelte +79 -0
- package/dist/infobox/Infobox.svelte.d.ts +33 -0
- package/dist/infobox/InfoboxHeader.svelte +35 -0
- package/dist/infobox/InfoboxHeader.svelte.d.ts +18 -0
- package/dist/infobox/InfoboxImage.svelte +38 -0
- package/dist/infobox/InfoboxImage.svelte.d.ts +21 -0
- package/dist/infobox/InfoboxRow.svelte +50 -0
- package/dist/infobox/InfoboxRow.svelte.d.ts +25 -0
- package/dist/infobox/InfoboxSection.svelte +24 -0
- package/dist/infobox/InfoboxSection.svelte.d.ts +12 -0
- package/dist/infobox/index.d.ts +21 -0
- package/dist/infobox/index.js +20 -0
- package/dist/infobox/types.d.ts +86 -0
- package/dist/infobox/types.js +27 -0
- package/dist/layout/AppShell.svelte +50 -0
- package/dist/layout/AppShell.svelte.d.ts +28 -0
- package/dist/layout/Breadcrumbs.svelte +52 -0
- package/dist/layout/Breadcrumbs.svelte.d.ts +18 -0
- package/dist/layout/Cluster.svelte +28 -0
- package/dist/layout/Cluster.svelte.d.ts +27 -0
- package/dist/layout/DetailLayout.svelte +50 -0
- package/dist/layout/DetailLayout.svelte.d.ts +19 -0
- package/dist/layout/FilterBar.svelte +40 -0
- package/dist/layout/FilterBar.svelte.d.ts +12 -0
- package/dist/layout/Fits.svelte +27 -0
- package/dist/layout/Fits.svelte.d.ts +13 -0
- package/dist/layout/Flow.svelte +46 -0
- package/dist/layout/Flow.svelte.d.ts +16 -0
- package/dist/layout/Footer.svelte +32 -0
- package/dist/layout/Footer.svelte.d.ts +12 -0
- package/dist/layout/Grid.svelte +23 -0
- package/dist/layout/Grid.svelte.d.ts +26 -0
- package/dist/layout/HStack.svelte +12 -0
- package/dist/layout/HStack.svelte.d.ts +34 -0
- package/dist/layout/Hero.svelte +76 -0
- package/dist/layout/Hero.svelte.d.ts +36 -0
- package/dist/layout/Main.svelte +30 -0
- package/dist/layout/Main.svelte.d.ts +15 -0
- package/dist/layout/Navbar.svelte +68 -0
- package/dist/layout/Navbar.svelte.d.ts +31 -0
- package/dist/layout/PageHeader.svelte +77 -0
- package/dist/layout/PageHeader.svelte.d.ts +33 -0
- package/dist/layout/Section.svelte +72 -0
- package/dist/layout/Section.svelte.d.ts +40 -0
- package/dist/layout/Sidebar.svelte +54 -0
- package/dist/layout/Sidebar.svelte.d.ts +27 -0
- package/dist/layout/Spacer.svelte +12 -0
- package/dist/layout/Spacer.svelte.d.ts +6 -0
- package/dist/layout/Tabs.svelte +85 -0
- package/dist/layout/Tabs.svelte.d.ts +42 -0
- package/dist/layout/VStack.svelte +12 -0
- package/dist/layout/VStack.svelte.d.ts +29 -0
- package/dist/layout/index.d.ts +38 -0
- package/dist/layout/index.js +38 -0
- package/dist/layout/space.d.ts +44 -0
- package/dist/layout/space.js +76 -0
- package/dist/layout/types.d.ts +52 -0
- package/dist/layout/types.js +27 -0
- package/dist/links/ContextLinks.svelte +28 -0
- package/dist/links/ContextLinks.svelte.d.ts +20 -0
- package/dist/links/EmailLink.svelte +26 -0
- package/dist/links/EmailLink.svelte.d.ts +20 -0
- package/dist/links/index.d.ts +7 -0
- package/dist/links/index.js +7 -0
- package/dist/media/Figure.svelte +26 -0
- package/dist/media/Figure.svelte.d.ts +12 -0
- package/dist/media/Image.svelte +76 -0
- package/dist/media/Image.svelte.d.ts +41 -0
- package/dist/media/Video.svelte +65 -0
- package/dist/media/Video.svelte.d.ts +29 -0
- package/dist/media/image-dimensions.d.ts +28 -0
- package/dist/media/image-dimensions.js +34 -0
- package/dist/media/index.d.ts +10 -0
- package/dist/media/index.js +10 -0
- package/dist/search/CommandPalette.svelte +257 -0
- package/dist/search/CommandPalette.svelte.d.ts +59 -0
- package/dist/search/index.d.ts +13 -0
- package/dist/search/index.js +13 -0
- package/dist/search/types.d.ts +40 -0
- package/dist/search/types.js +20 -0
- package/dist/seo/Head.svelte +190 -0
- package/dist/seo/Head.svelte.d.ts +86 -0
- package/dist/seo/JsonLd.svelte +30 -0
- package/dist/seo/JsonLd.svelte.d.ts +20 -0
- package/dist/seo/index.d.ts +18 -0
- package/dist/seo/index.js +17 -0
- package/dist/seo/json-ld.d.ts +33 -0
- package/dist/seo/json-ld.js +29 -0
- package/dist/seo/og-image.d.ts +72 -0
- package/dist/seo/og-image.js +82 -0
- package/dist/seo/types.d.ts +43 -0
- package/dist/seo/types.js +6 -0
- package/dist/theme.css +161 -0
- package/dist/tips/PopoverTip.svelte +80 -0
- package/dist/tips/PopoverTip.svelte.d.ts +33 -0
- package/dist/tips/Tip.svelte +91 -0
- package/dist/tips/Tip.svelte.d.ts +25 -0
- package/dist/tips/index.d.ts +15 -0
- package/dist/tips/index.js +14 -0
- package/dist/tips/tip-stack.d.ts +26 -0
- package/dist/tips/tip-stack.js +37 -0
- package/dist/tips/tip-store.svelte.d.ts +75 -0
- package/dist/tips/tip-store.svelte.js +158 -0
- package/dist/tips/types.d.ts +46 -0
- package/dist/tips/types.js +6 -0
- package/dist/ui/Accordion.svelte +75 -0
- package/dist/ui/Accordion.svelte.d.ts +50 -0
- package/dist/ui/AccordionItem.svelte +73 -0
- package/dist/ui/AccordionItem.svelte.d.ts +18 -0
- package/dist/ui/Alert.svelte +61 -0
- package/dist/ui/Alert.svelte.d.ts +37 -0
- package/dist/ui/Badge.svelte +39 -0
- package/dist/ui/Badge.svelte.d.ts +32 -0
- package/dist/ui/Button.svelte +44 -0
- package/dist/ui/Button.svelte.d.ts +29 -0
- package/dist/ui/ButtonGroup.svelte +24 -0
- package/dist/ui/ButtonGroup.svelte.d.ts +17 -0
- package/dist/ui/Card.svelte +49 -0
- package/dist/ui/Card.svelte.d.ts +44 -0
- package/dist/ui/Chip.svelte +58 -0
- package/dist/ui/Chip.svelte.d.ts +21 -0
- package/dist/ui/ConfirmButton.svelte +75 -0
- package/dist/ui/ConfirmButton.svelte.d.ts +48 -0
- package/dist/ui/ContextMenu.svelte +75 -0
- package/dist/ui/ContextMenu.svelte.d.ts +25 -0
- package/dist/ui/Disclosure.svelte +46 -0
- package/dist/ui/Disclosure.svelte.d.ts +22 -0
- package/dist/ui/Divider.svelte +47 -0
- package/dist/ui/Divider.svelte.d.ts +28 -0
- package/dist/ui/DropdownMenu.svelte +44 -0
- package/dist/ui/DropdownMenu.svelte.d.ts +30 -0
- package/dist/ui/EmptyState.svelte +37 -0
- package/dist/ui/EmptyState.svelte.d.ts +22 -0
- package/dist/ui/ExternalLink.svelte +38 -0
- package/dist/ui/ExternalLink.svelte.d.ts +34 -0
- package/dist/ui/Heading.svelte +58 -0
- package/dist/ui/Heading.svelte.d.ts +22 -0
- package/dist/ui/Link.svelte +34 -0
- package/dist/ui/Link.svelte.d.ts +20 -0
- package/dist/ui/LinkButton.svelte +51 -0
- package/dist/ui/LinkButton.svelte.d.ts +33 -0
- package/dist/ui/Menu.svelte +24 -0
- package/dist/ui/Menu.svelte.d.ts +13 -0
- package/dist/ui/MenuCheckboxItem.svelte +33 -0
- package/dist/ui/MenuCheckboxItem.svelte.d.ts +20 -0
- package/dist/ui/MenuItem.svelte +73 -0
- package/dist/ui/MenuItem.svelte.d.ts +21 -0
- package/dist/ui/MenuRadioGroup.svelte +25 -0
- package/dist/ui/MenuRadioGroup.svelte.d.ts +20 -0
- package/dist/ui/MenuRadioItem.svelte +20 -0
- package/dist/ui/MenuRadioItem.svelte.d.ts +15 -0
- package/dist/ui/MenuSeparator.svelte +27 -0
- package/dist/ui/MenuSeparator.svelte.d.ts +8 -0
- package/dist/ui/MenuSub.svelte +24 -0
- package/dist/ui/MenuSub.svelte.d.ts +15 -0
- package/dist/ui/Popover.svelte +63 -0
- package/dist/ui/Popover.svelte.d.ts +40 -0
- package/dist/ui/ShareButton.svelte +64 -0
- package/dist/ui/ShareButton.svelte.d.ts +39 -0
- package/dist/ui/Skeleton.svelte +43 -0
- package/dist/ui/Skeleton.svelte.d.ts +22 -0
- package/dist/ui/Spinner.svelte +41 -0
- package/dist/ui/Spinner.svelte.d.ts +35 -0
- package/dist/ui/Stack.svelte +36 -0
- package/dist/ui/Stack.svelte.d.ts +48 -0
- package/dist/ui/ThemeToggle.svelte +65 -0
- package/dist/ui/ThemeToggle.svelte.d.ts +24 -0
- package/dist/ui/ToggleButton.svelte +58 -0
- package/dist/ui/ToggleButton.svelte.d.ts +45 -0
- package/dist/ui/ToggleGroup.svelte +142 -0
- package/dist/ui/ToggleGroup.svelte.d.ts +86 -0
- package/dist/ui/Toolbar.svelte +40 -0
- package/dist/ui/Toolbar.svelte.d.ts +20 -0
- package/dist/ui/ToolbarButton.svelte +29 -0
- package/dist/ui/ToolbarButton.svelte.d.ts +21 -0
- package/dist/ui/ToolbarLink.svelte +21 -0
- package/dist/ui/ToolbarLink.svelte.d.ts +12 -0
- package/dist/ui/ToolbarSeparator.svelte +22 -0
- package/dist/ui/ToolbarSeparator.svelte.d.ts +12 -0
- package/dist/ui/ToolbarToggleGroup.svelte +66 -0
- package/dist/ui/ToolbarToggleGroup.svelte.d.ts +52 -0
- package/dist/ui/Tooltip.svelte +54 -0
- package/dist/ui/Tooltip.svelte.d.ts +35 -0
- package/dist/ui/VisuallyHidden.svelte +23 -0
- package/dist/ui/VisuallyHidden.svelte.d.ts +10 -0
- package/dist/ui/accordion-context.d.ts +26 -0
- package/dist/ui/accordion-context.js +23 -0
- package/dist/ui/colour-token.d.ts +41 -0
- package/dist/ui/colour-token.js +49 -0
- package/dist/ui/context-menu.d.ts +13 -0
- package/dist/ui/context-menu.js +13 -0
- package/dist/ui/index.d.ts +63 -0
- package/dist/ui/index.js +62 -0
- package/dist/ui/menu-context.d.ts +20 -0
- package/dist/ui/menu-context.js +22 -0
- package/dist/ui/menu-parts/CheckboxItemPart.svelte +26 -0
- package/dist/ui/menu-parts/CheckboxItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/ItemPart.svelte +29 -0
- package/dist/ui/menu-parts/ItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/RadioGroupPart.svelte +24 -0
- package/dist/ui/menu-parts/RadioGroupPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/RadioItemPart.svelte +22 -0
- package/dist/ui/menu-parts/RadioItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/SeparatorPart.svelte +16 -0
- package/dist/ui/menu-parts/SeparatorPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/SubPart.svelte +28 -0
- package/dist/ui/menu-parts/SubPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/menu-parts.d.ts +104 -0
- package/dist/ui/menu-parts/menu-parts.js +31 -0
- package/dist/ui/menu-parts/parts.d.ts +12 -0
- package/dist/ui/menu-parts/parts.js +27 -0
- package/dist/ui/slug.d.ts +19 -0
- package/dist/ui/slug.js +25 -0
- package/dist/ui/toggle-classes.d.ts +39 -0
- package/dist/ui/toggle-classes.js +36 -0
- package/dist/ui/tones.d.ts +103 -0
- package/dist/ui/tones.js +240 -0
- package/package.json +41 -25
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
A destructive action behind a modal confirmation, run either as a callback (`onConfirm`) or as a progressive-enhancement POST (`form`).
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
ConfirmDialog — a destructive action behind a modal confirmation, in the two
|
|
6
|
+
shapes the app repos actually needed.
|
|
7
|
+
|
|
8
|
+
**Callback mode** (`onConfirm`) is the client-side one: the promise runs,
|
|
9
|
+
the confirm button goes busy, a rejection is shown inside the still-open
|
|
10
|
+
dialog so the reader can retry or cancel, and a resolution closes it and
|
|
11
|
+
optionally navigates through the components context.
|
|
12
|
+
|
|
13
|
+
**Form mode** (`form`) is the progressive-enhancement one: the confirm
|
|
14
|
+
button is a real `type="submit"` inside a real `<form method="POST">`, so
|
|
15
|
+
the action posts and the server redirects even with scripting off. The SvelteKit `enhance` action is passed IN by the
|
|
16
|
+
app (`enhance: (node) => enhance(node)`); importing `$app/forms` here would
|
|
17
|
+
tie this package to SvelteKit. It is applied as an attachment, so a caller
|
|
18
|
+
that omits it simply gets the unenhanced form.
|
|
19
|
+
|
|
20
|
+
Pass exactly one of the two. With neither, the confirm button does nothing
|
|
21
|
+
— there is no action to take.
|
|
22
|
+
|
|
23
|
+
ARIA contract: `Dialog`'s, plus a failure surfaced as an `Alert` with
|
|
24
|
+
`live="assertive"` inside the dialog (the reader pressed confirm and
|
|
25
|
+
nothing visible happened, so the reason has to interrupt). Both buttons are
|
|
26
|
+
`disabled` while the callback is in flight and the confirm button swaps its
|
|
27
|
+
text to `pendingLabel` rather than emptying itself, so its accessible name
|
|
28
|
+
never disappears mid-press.
|
|
29
|
+
-->
|
|
30
|
+
<script lang="ts">import { getComponentsContext } from "../context.svelte.js";
|
|
31
|
+
import Alert from "../ui/Alert.svelte";
|
|
32
|
+
import Button from "../ui/Button.svelte";
|
|
33
|
+
import Dialog from "./Dialog.svelte";
|
|
34
|
+
let { open = $bindable(false), title, description, confirmLabel = "Delete", cancelLabel = "Cancel", pendingLabel = "Working…", failureMessage = "That didn’t work. Try again.", closeLabel = "Close", tone = "error", size = "md", onConfirm, form, redirectTo, class: className, trigger, children } = $props();
|
|
35
|
+
const context = getComponentsContext();
|
|
36
|
+
let pending = $state(false);
|
|
37
|
+
let errorMessage = $state(undefined);
|
|
38
|
+
const confirm = async () => {
|
|
39
|
+
if (onConfirm === undefined) return;
|
|
40
|
+
pending = true;
|
|
41
|
+
errorMessage = undefined;
|
|
42
|
+
try {
|
|
43
|
+
await onConfirm();
|
|
44
|
+
open = false;
|
|
45
|
+
if (redirectTo !== undefined) await context.navigate(context.href(redirectTo));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
errorMessage = error instanceof Error ? error.message : failureMessage;
|
|
48
|
+
} finally {
|
|
49
|
+
pending = false;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/** The app's `enhance`, as an attachment so omitting it is a no-op. */
|
|
53
|
+
const enhanceForm = (node) => form?.enhance?.(node);
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<Dialog bind:open {title} {description} {closeLabel} {size} class={className} {trigger}>
|
|
57
|
+
{#if children}
|
|
58
|
+
{@render children()}
|
|
59
|
+
{/if}
|
|
60
|
+
{#if errorMessage !== undefined}
|
|
61
|
+
<Alert tone="error" live="assertive">{errorMessage}</Alert>
|
|
62
|
+
{/if}
|
|
63
|
+
|
|
64
|
+
{#snippet actions({ close })}
|
|
65
|
+
<Button variant="ghost" disabled={pending} onclick={close}>{cancelLabel}</Button>
|
|
66
|
+
{#if form === undefined}
|
|
67
|
+
<Button {tone} loading={pending} onclick={confirm}>
|
|
68
|
+
{pending ? pendingLabel : confirmLabel}
|
|
69
|
+
</Button>
|
|
70
|
+
{:else}
|
|
71
|
+
<form method={form.method ?? 'POST'} action={form.action} {@attach enhanceForm}>
|
|
72
|
+
{#each Object.entries(form.fields ?? {}) as [name, value] (name)}
|
|
73
|
+
<input type="hidden" {name} {value} />
|
|
74
|
+
{/each}
|
|
75
|
+
<Button {tone} type="submit">{confirmLabel}</Button>
|
|
76
|
+
</form>
|
|
77
|
+
{/if}
|
|
78
|
+
{/snippet}
|
|
79
|
+
</Dialog>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Tone } from '../ui/tones.ts';
|
|
3
|
+
import type { DialogSize } from './sizes.ts';
|
|
4
|
+
/** A progressive-enhancement POST: the confirm button submits this form. */
|
|
5
|
+
export interface ConfirmForm {
|
|
6
|
+
/** The form's `action` — a SvelteKit named action (`?/delete`) or a path. */
|
|
7
|
+
readonly action: string;
|
|
8
|
+
/** Always `POST`; spelled out because a destructive GET is a bug. */
|
|
9
|
+
readonly method?: 'POST' | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Extra fields to post, rendered as hidden inputs INSIDE the form. They
|
|
12
|
+
* live here rather than in `children` because `children` renders in the
|
|
13
|
+
* dialog body, which is outside the form element.
|
|
14
|
+
*/
|
|
15
|
+
readonly fields?: Readonly<Record<string, string>> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The app's own `use:enhance`, applied to the `<form>` element. Returns
|
|
18
|
+
* its teardown, if it has one. Omit for a plain, unenhanced POST.
|
|
19
|
+
*/
|
|
20
|
+
readonly enhance?: ((form: HTMLFormElement) => void | (() => void)) | undefined;
|
|
21
|
+
}
|
|
22
|
+
interface Props {
|
|
23
|
+
/** Whether the dialog is shown. Bindable. */
|
|
24
|
+
open?: boolean | undefined;
|
|
25
|
+
/** Heading — the dialog's accessible name. */
|
|
26
|
+
title: string;
|
|
27
|
+
/** What confirming does, in the reader's terms. */
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Text of the confirm button.
|
|
31
|
+
* @defaultValue `'Delete'`
|
|
32
|
+
*/
|
|
33
|
+
confirmLabel?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Text of the cancel button.
|
|
36
|
+
* @defaultValue `'Cancel'`
|
|
37
|
+
*/
|
|
38
|
+
cancelLabel?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The confirm button's text while the callback is in flight.
|
|
41
|
+
* @defaultValue `'Working…'`
|
|
42
|
+
*/
|
|
43
|
+
pendingLabel?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Shown when the callback rejects with something that is not an `Error`.
|
|
46
|
+
* @defaultValue `'That didn’t work. Try again.'`
|
|
47
|
+
*/
|
|
48
|
+
failureMessage?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Accessible name of the corner close button.
|
|
51
|
+
* @defaultValue `'Close'`
|
|
52
|
+
*/
|
|
53
|
+
closeLabel?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Colour of the confirm button.
|
|
56
|
+
* @defaultValue `'error'`
|
|
57
|
+
*/
|
|
58
|
+
tone?: Tone | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Width of the dialog.
|
|
61
|
+
* @defaultValue `'md'`
|
|
62
|
+
*/
|
|
63
|
+
size?: DialogSize | undefined;
|
|
64
|
+
/** Client-side confirmation. Mutually exclusive with `form`. */
|
|
65
|
+
onConfirm?: (() => Promise<unknown>) | undefined;
|
|
66
|
+
/** Progressive-enhancement POST. Mutually exclusive with `onConfirm`. */
|
|
67
|
+
form?: ConfirmForm | undefined;
|
|
68
|
+
/** Navigated to through the components context once `onConfirm` resolves. */
|
|
69
|
+
redirectTo?: string | undefined;
|
|
70
|
+
/** Extra classes, merged last. */
|
|
71
|
+
class?: string | undefined;
|
|
72
|
+
/** The opening control — the caller's own element, spreading `props`. */
|
|
73
|
+
trigger?: Snippet<[{
|
|
74
|
+
props: Record<string, unknown>;
|
|
75
|
+
}]> | undefined;
|
|
76
|
+
/** Extra body content: a list of what will be destroyed, a reason field. */
|
|
77
|
+
children?: Snippet<[]> | undefined;
|
|
78
|
+
}
|
|
79
|
+
/** A destructive action behind a modal confirmation, run either as a callback (`onConfirm`) or as a progressive-enhancement POST (`form`). */
|
|
80
|
+
declare const ConfirmDialog: import("svelte").Component<Props, {}, "open">;
|
|
81
|
+
type ConfirmDialog = ReturnType<typeof ConfirmDialog>;
|
|
82
|
+
export default ConfirmDialog;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
A modal on bits-ui’s `Dialog`, wearing daisyUI’s `modal-box`.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
Dialog — a modal on bits-ui's `Dialog`, wearing daisyUI's `modal-box`.
|
|
6
|
+
|
|
7
|
+
ARIA contract: everything that makes a modal a modal is bits-ui's — the
|
|
8
|
+
focus trap, the initial focus move, `aria-modal`, the `aria-labelledby` /
|
|
9
|
+
`aria-describedby` wiring to `Dialog.Title` and `Dialog.Description`,
|
|
10
|
+
Escape and outside-click dismissal, the scroll lock, and returning focus
|
|
11
|
+
to whatever opened it. None of that is re-implemented here, because the
|
|
12
|
+
hand-rolled version is the one that is always subtly wrong: the native
|
|
13
|
+
`<dialog>` the app repos used gets the trap right but leaves the title
|
|
14
|
+
wiring and the focus return to the call site, and every call site did it
|
|
15
|
+
differently.
|
|
16
|
+
|
|
17
|
+
`title` is required: a dialog with no accessible name is announced as
|
|
18
|
+
"dialog" and nothing else. `description` is optional but is what turns
|
|
19
|
+
"Delete garden?" into a sentence an assistive-technology user can act on.
|
|
20
|
+
|
|
21
|
+
`trigger` receives the props to spread, so an existing `Button` keeps its
|
|
22
|
+
own markup and its own accessible name; `actions` receives `close`, so the
|
|
23
|
+
action row's buttons can dismiss without reaching for the bindable `open`.
|
|
24
|
+
|
|
25
|
+
The modal itself is `DialogFrame`, shared with `Drawer`: this file only
|
|
26
|
+
chooses the centred `modal-box`.
|
|
27
|
+
-->
|
|
28
|
+
<script lang="ts">import DialogFrame from "./DialogFrame.svelte";
|
|
29
|
+
import { dialogSize } from "./sizes.js";
|
|
30
|
+
let { open = $bindable(false), title, description, closeLabel = "Close", size = "md", class: className, trigger, actions, children } = $props();
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<DialogFrame
|
|
34
|
+
bind:open
|
|
35
|
+
{title}
|
|
36
|
+
{description}
|
|
37
|
+
{closeLabel}
|
|
38
|
+
{trigger}
|
|
39
|
+
{actions}
|
|
40
|
+
{children}
|
|
41
|
+
layout="modal"
|
|
42
|
+
contentClass={[
|
|
43
|
+
'modal-box fixed top-1/2 left-1/2 z-50 max-h-[calc(100svh-2rem)] w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2',
|
|
44
|
+
dialogSize[size],
|
|
45
|
+
className,
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type DialogSize } from './sizes.ts';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Whether the dialog is shown. Bindable. */
|
|
5
|
+
open?: boolean | undefined;
|
|
6
|
+
/** Heading — the dialog's accessible name. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Supporting line under the heading — the accessible description. */
|
|
9
|
+
description?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Accessible name of the corner close button.
|
|
12
|
+
* @defaultValue `'Close'`
|
|
13
|
+
*/
|
|
14
|
+
closeLabel?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Width step of the `modal-box`.
|
|
17
|
+
* @defaultValue `'md'`
|
|
18
|
+
*/
|
|
19
|
+
size?: DialogSize | undefined;
|
|
20
|
+
/** Extra classes on the `modal-box`. */
|
|
21
|
+
class?: string | undefined;
|
|
22
|
+
/** The opening control — the caller's own element, spreading `props`. */
|
|
23
|
+
trigger?: Snippet<[{
|
|
24
|
+
props: Record<string, unknown>;
|
|
25
|
+
}]> | undefined;
|
|
26
|
+
/** Buttons for the `modal-action` row. */
|
|
27
|
+
actions?: Snippet<[{
|
|
28
|
+
close: () => void;
|
|
29
|
+
}]> | undefined;
|
|
30
|
+
/** The dialog body, under the title and description. */
|
|
31
|
+
children: Snippet<[]>;
|
|
32
|
+
}
|
|
33
|
+
/** A modal on bits-ui’s `Dialog`, wearing daisyUI’s `modal-box`. */
|
|
34
|
+
declare const Dialog: import("svelte").Component<Props, {}, "open">;
|
|
35
|
+
type Dialog = ReturnType<typeof Dialog>;
|
|
36
|
+
export default Dialog;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
The modal body `Dialog` and `Drawer` share; internal, not exported.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
DialogFrame — one implementation of everything that makes a modal a
|
|
6
|
+
modal, on bits-ui's `Dialog`: the trigger, overlay, focus trap and
|
|
7
|
+
return, Escape, scroll lock, the title and description wiring, the
|
|
8
|
+
labelled close button and the `actions({ close })` row. `Dialog` (a
|
|
9
|
+
centred `modal-box`) and `Drawer` (a panel at an edge) differ only in
|
|
10
|
+
`layout` and the content classes they pass, so the two cannot drift on
|
|
11
|
+
focus, dismissal or labelling.
|
|
12
|
+
|
|
13
|
+
`hideTitle` keeps the title as the accessible name but hides it
|
|
14
|
+
visually: a mobile navigation drawer needs a name, not a heading.
|
|
15
|
+
-->
|
|
16
|
+
<script lang="ts">import { X } from "@lucide/svelte";
|
|
17
|
+
import { Dialog } from "bits-ui";
|
|
18
|
+
import Button from "../ui/Button.svelte";
|
|
19
|
+
import VisuallyHidden from "../ui/VisuallyHidden.svelte";
|
|
20
|
+
let { open = $bindable(false), title, description, closeLabel, hideTitle = false, layout, contentClass, trigger, actions, children } = $props();
|
|
21
|
+
const close = () => {
|
|
22
|
+
open = false;
|
|
23
|
+
};
|
|
24
|
+
const sheet = $derived(layout === "sheet");
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Dialog.Root bind:open>
|
|
28
|
+
{#if trigger}
|
|
29
|
+
<Dialog.Trigger>
|
|
30
|
+
{#snippet child({ props })}
|
|
31
|
+
{@render trigger({ props })}
|
|
32
|
+
{/snippet}
|
|
33
|
+
</Dialog.Trigger>
|
|
34
|
+
{/if}
|
|
35
|
+
<Dialog.Portal>
|
|
36
|
+
<!-- daisyUI's `modal-backdrop` is a child of an open `.modal`; this is
|
|
37
|
+
the same scrim as an element bits-ui can animate and dismiss from. -->
|
|
38
|
+
<Dialog.Overlay class="bg-base-300/60 fixed inset-0 z-40" />
|
|
39
|
+
<Dialog.Content class={contentClass}>
|
|
40
|
+
<div class={['flex items-start justify-between gap-4', sheet && 'px-4 pt-4']}>
|
|
41
|
+
<Dialog.Title class={hideTitle ? 'sr-only' : 'text-lg font-semibold'}>{title}</Dialog.Title>
|
|
42
|
+
<Dialog.Close>
|
|
43
|
+
{#snippet child({ props })}
|
|
44
|
+
<Button {...props} variant="ghost" size="sm" class="btn-square -mt-1 -mr-1 ms-auto">
|
|
45
|
+
<X class="size-4" aria-hidden="true" />
|
|
46
|
+
<VisuallyHidden>{closeLabel}</VisuallyHidden>
|
|
47
|
+
</Button>
|
|
48
|
+
{/snippet}
|
|
49
|
+
</Dialog.Close>
|
|
50
|
+
</div>
|
|
51
|
+
{#if description !== undefined}
|
|
52
|
+
<Dialog.Description class={['text-base-content/70 mt-1 text-sm leading-6', sheet && 'px-4']}>
|
|
53
|
+
{description}
|
|
54
|
+
</Dialog.Description>
|
|
55
|
+
{/if}
|
|
56
|
+
<div class={sheet ? 'min-h-0 flex-1 overflow-y-auto p-4' : 'py-4'}>{@render children()}</div>
|
|
57
|
+
{#if actions}
|
|
58
|
+
<div class={sheet ? 'border-base-300 flex justify-end gap-2 border-t p-4' : 'modal-action'}>
|
|
59
|
+
{@render actions({ close })}
|
|
60
|
+
</div>
|
|
61
|
+
{/if}
|
|
62
|
+
</Dialog.Content>
|
|
63
|
+
</Dialog.Portal>
|
|
64
|
+
</Dialog.Root>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
interface Props {
|
|
4
|
+
open?: boolean | undefined;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
closeLabel: string;
|
|
8
|
+
hideTitle?: boolean | undefined;
|
|
9
|
+
/** `modal`: daisyUI `modal-box` flow. `sheet`: a column with a scrolling body and a pinned footer. */
|
|
10
|
+
layout: 'modal' | 'sheet';
|
|
11
|
+
contentClass: ClassValue;
|
|
12
|
+
trigger?: Snippet<[{
|
|
13
|
+
props: Record<string, unknown>;
|
|
14
|
+
}]> | undefined;
|
|
15
|
+
actions?: Snippet<[{
|
|
16
|
+
close: () => void;
|
|
17
|
+
}]> | undefined;
|
|
18
|
+
children: Snippet<[]>;
|
|
19
|
+
}
|
|
20
|
+
/** The modal body `Dialog` and `Drawer` share; internal, not exported. */
|
|
21
|
+
declare const DialogFrame: import("svelte").Component<Props, {}, "open">;
|
|
22
|
+
type DialogFrame = ReturnType<typeof DialogFrame>;
|
|
23
|
+
export default DialogFrame;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
A modal panel that slides in from an edge: a filters sheet, a mobile action sheet, mobile navigation.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
Drawer — `Dialog`'s contract at an edge of the screen. It shares
|
|
6
|
+
`DialogFrame` with `Dialog`, so the focus trap and return, Escape and
|
|
7
|
+
overlay dismissal, scroll lock, `aria-modal`, the title as the accessible
|
|
8
|
+
name and the labelled close button are one implementation.
|
|
9
|
+
|
|
10
|
+
Not daisyUI's `drawer`: that is driven by a hidden checkbox and a
|
|
11
|
+
`<label>` overlay, which gives no focus trap, no focus move or return, no
|
|
12
|
+
Escape, no `aria-modal` and no name, and leaves the page behind it in the
|
|
13
|
+
Tab order. Only daisyUI's look is borrowed here.
|
|
14
|
+
|
|
15
|
+
The panel is a column: the title row, a body that scrolls on its own, and
|
|
16
|
+
an `actions({ close })` footer that stays put. `start` / `end` follow
|
|
17
|
+
the writing direction, so a `start` drawer opens from the right in RTL.
|
|
18
|
+
It does not animate, so there is no motion to reduce; swipe-to-dismiss is
|
|
19
|
+
out of v1.
|
|
20
|
+
-->
|
|
21
|
+
<script lang="ts">import DialogFrame from "./DialogFrame.svelte";
|
|
22
|
+
import { drawerHeight, drawerSide, drawerWidth } from "./sizes.js";
|
|
23
|
+
let { open = $bindable(false), title, description, side = "end", size = "md", closeLabel = "Close", hideTitle = false, class: className, trigger, actions, children } = $props();
|
|
24
|
+
const horizontal = $derived(side === "start" || side === "end");
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<DialogFrame
|
|
28
|
+
bind:open
|
|
29
|
+
{title}
|
|
30
|
+
{description}
|
|
31
|
+
{closeLabel}
|
|
32
|
+
{hideTitle}
|
|
33
|
+
{trigger}
|
|
34
|
+
{actions}
|
|
35
|
+
{children}
|
|
36
|
+
layout="sheet"
|
|
37
|
+
contentClass={[
|
|
38
|
+
'bg-base-100 fixed z-50 flex flex-col shadow-xl outline-none',
|
|
39
|
+
drawerSide[side],
|
|
40
|
+
horizontal ? drawerWidth[size] : drawerHeight[size],
|
|
41
|
+
className,
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type DrawerSide, type DrawerSize } from './sizes.ts';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Whether the drawer is shown. Bindable. */
|
|
5
|
+
open?: boolean | undefined;
|
|
6
|
+
/** Heading — the panel's accessible name. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Supporting line under the heading — the accessible description. */
|
|
9
|
+
description?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The edge the panel enters from.
|
|
12
|
+
* @defaultValue `'end'`
|
|
13
|
+
*/
|
|
14
|
+
side?: DrawerSide | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Width at `start` / `end`, height at `top` / `bottom`.
|
|
17
|
+
* @defaultValue `'md'`
|
|
18
|
+
*/
|
|
19
|
+
size?: DrawerSize | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible name of the corner close button.
|
|
22
|
+
* @defaultValue `'Close'`
|
|
23
|
+
*/
|
|
24
|
+
closeLabel?: string | undefined;
|
|
25
|
+
/** Hide the title visually; it stays the accessible name (mobile navigation). */
|
|
26
|
+
hideTitle?: boolean | undefined;
|
|
27
|
+
/** Extra classes on the panel. */
|
|
28
|
+
class?: string | undefined;
|
|
29
|
+
/** The opening control — the caller's own element, spreading `props`. */
|
|
30
|
+
trigger?: Snippet<[{
|
|
31
|
+
props: Record<string, unknown>;
|
|
32
|
+
}]> | undefined;
|
|
33
|
+
/** A footer row that stays in view; receives `close`. */
|
|
34
|
+
actions?: Snippet<[{
|
|
35
|
+
close: () => void;
|
|
36
|
+
}]> | undefined;
|
|
37
|
+
/** The panel body; it scrolls when long. */
|
|
38
|
+
children: Snippet<[]>;
|
|
39
|
+
}
|
|
40
|
+
/** A modal panel that slides in from an edge: a filters sheet, a mobile action sheet, mobile navigation. */
|
|
41
|
+
declare const Drawer: import("svelte").Component<Props, {}, "open">;
|
|
42
|
+
type Drawer = ReturnType<typeof Drawer>;
|
|
43
|
+
export default Drawer;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
The loading and error chrome around one read.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
LoadingBoundary — the loading and error chrome around one read.
|
|
6
|
+
|
|
7
|
+
The four states exist because "not settled" is two different things, and
|
|
8
|
+
collapsing them is what made every mutation blank its list back to
|
|
9
|
+
"Loading…": `loading` is a FIRST read with nothing to show yet, while
|
|
10
|
+
`refreshing` is a re-fetch over content that is already on screen. Children
|
|
11
|
+
keep rendering through `refreshing` — only a first read or a failure shows
|
|
12
|
+
chrome instead of content.
|
|
13
|
+
|
|
14
|
+
The two `tone`s are the two treatments the app repos had, not a new pair:
|
|
15
|
+
`page` is a route's own read, where the message stands alone under the page
|
|
16
|
+
heading, and `section` is a detail page's secondary read, indented into the
|
|
17
|
+
flow and deliberately quiet so a failed sidebar section degrades on its own
|
|
18
|
+
instead of taking the page with it.
|
|
19
|
+
|
|
20
|
+
ARIA contract: the loading chrome is a polite `role="status"` named by what
|
|
21
|
+
it is loading, so a reader who arrives mid-fetch is told rather than
|
|
22
|
+
finding nothing. During `refreshing` the same announcement is made from a
|
|
23
|
+
visually hidden status, because the content is still there to read. A
|
|
24
|
+
failure is assertive: the reader is waiting for something that is not
|
|
25
|
+
coming.
|
|
26
|
+
-->
|
|
27
|
+
<script lang="ts">import Alert from "../ui/Alert.svelte";
|
|
28
|
+
import VisuallyHidden from "../ui/VisuallyHidden.svelte";
|
|
29
|
+
let { state, loadingLabel = "Loading…", errorLabel = "That didn’t load. Try again.", tone = "page", class: className, loading, failed, children } = $props();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#if state === 'error'}
|
|
33
|
+
{#if failed}
|
|
34
|
+
{@render failed({ message: errorLabel })}
|
|
35
|
+
{:else if tone === 'section'}
|
|
36
|
+
<p role="alert" class={['text-base-content/60 mt-3 text-sm leading-6', className]}>
|
|
37
|
+
{errorLabel}
|
|
38
|
+
</p>
|
|
39
|
+
{:else}
|
|
40
|
+
<Alert tone="error" live="assertive" class={className}>{errorLabel}</Alert>
|
|
41
|
+
{/if}
|
|
42
|
+
{:else if state === 'loading'}
|
|
43
|
+
{#if loading}
|
|
44
|
+
{@render loading()}
|
|
45
|
+
{:else}
|
|
46
|
+
<p
|
|
47
|
+
role="status"
|
|
48
|
+
class={[
|
|
49
|
+
tone === 'section' ? 'text-base-content/50 mt-3 text-sm' : 'text-base-content/50',
|
|
50
|
+
className,
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
53
|
+
{loadingLabel}
|
|
54
|
+
</p>
|
|
55
|
+
{/if}
|
|
56
|
+
{:else}
|
|
57
|
+
{#if state === 'refreshing'}
|
|
58
|
+
<VisuallyHidden role="status">{loadingLabel}</VisuallyHidden>
|
|
59
|
+
{/if}
|
|
60
|
+
{@render children()}
|
|
61
|
+
{/if}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Where the read has got to. */
|
|
4
|
+
state: 'loading' | 'refreshing' | 'error' | 'ready';
|
|
5
|
+
/**
|
|
6
|
+
* Announced, and shown, while the first read is in flight.
|
|
7
|
+
* @defaultValue `'Loading…'`
|
|
8
|
+
*/
|
|
9
|
+
loadingLabel?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The message for a failed read. Every call site has a specific one.
|
|
12
|
+
* @defaultValue `'That didn’t load. Try again.'`
|
|
13
|
+
*/
|
|
14
|
+
errorLabel?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Which of the two established treatments to render.
|
|
17
|
+
* @defaultValue `'page'`
|
|
18
|
+
*/
|
|
19
|
+
tone?: 'page' | 'section' | undefined;
|
|
20
|
+
/** Extra classes, merged last. */
|
|
21
|
+
class?: string | undefined;
|
|
22
|
+
/** Replaces the default loading chrome. */
|
|
23
|
+
loading?: Snippet<[]> | undefined;
|
|
24
|
+
/** Replaces the default error chrome. */
|
|
25
|
+
failed?: Snippet<[{
|
|
26
|
+
message: string;
|
|
27
|
+
}]> | undefined;
|
|
28
|
+
/** The loaded content. Rendered from the first success onwards. */
|
|
29
|
+
children: Snippet<[]>;
|
|
30
|
+
}
|
|
31
|
+
/** The loading and error chrome around one read. */
|
|
32
|
+
declare const LoadingBoundary: import("svelte").Component<Props, {}, "">;
|
|
33
|
+
type LoadingBoundary = ReturnType<typeof LoadingBoundary>;
|
|
34
|
+
export default LoadingBoundary;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
A native `<progress>` in a daisyUI tone.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
ProgressBar — a native `<progress>` in a daisyUI tone.
|
|
6
|
+
|
|
7
|
+
Native rather than a `div role="progressbar"`: the element already carries
|
|
8
|
+
the role, the value semantics and the platform's own indeterminate
|
|
9
|
+
rendering, and no hand-rolled version gets the indeterminate state right.
|
|
10
|
+
|
|
11
|
+
ARIA contract: `label` is the accessible name (a `<progress>` takes no name
|
|
12
|
+
from its contents), and `aria-valuetext` carries the percentage as words so
|
|
13
|
+
a reader hears "62 per cent" rather than "62 of 100". Omitting `value`
|
|
14
|
+
leaves the element indeterminate — no value attribute at all, which is what
|
|
15
|
+
makes the platform animate it — and drops `aria-valuetext` with it. The
|
|
16
|
+
printed percentage beside the bar is `aria-hidden`, because it restates the
|
|
17
|
+
name and value the element already exposes.
|
|
18
|
+
-->
|
|
19
|
+
<script lang="ts">import { getComponentsContext } from "../context.svelte.js";
|
|
20
|
+
import { progressTone } from "../ui/tones.js";
|
|
21
|
+
let { label, value, max = 100, tone = "primary", showValue = false, locales, class: className, ...rest } = $props();
|
|
22
|
+
const context = getComponentsContext();
|
|
23
|
+
const fraction = $derived(value === undefined || max <= 0 ? undefined : Math.min(1, Math.max(0, value / max)));
|
|
24
|
+
// The formatter is built in one `$derived` and applied in another: building
|
|
25
|
+
// an `Intl` formatter is the expensive half, and it must not be redone every
|
|
26
|
+
// time the value ticks.
|
|
27
|
+
const percent = $derived(new Intl.NumberFormat(locales ?? context.locale(), {
|
|
28
|
+
style: "percent",
|
|
29
|
+
maximumFractionDigits: 1
|
|
30
|
+
}));
|
|
31
|
+
const valueText = $derived(fraction === undefined ? undefined : percent.format(fraction));
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div class={['flex items-center gap-3', className]}>
|
|
35
|
+
<progress
|
|
36
|
+
{...rest}
|
|
37
|
+
class={['progress', progressTone[tone]]}
|
|
38
|
+
value={value === undefined ? undefined : Math.min(max, Math.max(0, value))}
|
|
39
|
+
{max}
|
|
40
|
+
aria-label={label}
|
|
41
|
+
aria-valuetext={valueText}
|
|
42
|
+
></progress>
|
|
43
|
+
{#if showValue && valueText !== undefined}
|
|
44
|
+
<span class="w-14 shrink-0 text-right text-sm tabular-nums" aria-hidden="true">{valueText}</span>
|
|
45
|
+
{/if}
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLProgressAttributes } from 'svelte/elements';
|
|
2
|
+
import { type Tone } from '../ui/tones.ts';
|
|
3
|
+
interface Props extends Omit<HTMLProgressAttributes, 'value' | 'max'> {
|
|
4
|
+
/** Accessible name, e.g. `Seeds germinated`. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Current value in `[0, max]`. Omit for an indeterminate bar. */
|
|
7
|
+
value?: number | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The value that means complete.
|
|
10
|
+
* @defaultValue `100`
|
|
11
|
+
*/
|
|
12
|
+
max?: number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Semantic colour.
|
|
15
|
+
* @defaultValue `'primary'`
|
|
16
|
+
*/
|
|
17
|
+
tone?: Tone | undefined;
|
|
18
|
+
/** Print the percentage beside the bar. */
|
|
19
|
+
showValue?: boolean | undefined;
|
|
20
|
+
/** Locale(s) for the percentage. Defaults to the components context's. */
|
|
21
|
+
locales?: string | readonly string[] | undefined;
|
|
22
|
+
/** Extra classes on the wrapper. */
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** A native `<progress>` in a daisyUI tone. */
|
|
26
|
+
declare const ProgressBar: import("svelte").Component<Props, {}, "">;
|
|
27
|
+
type ProgressBar = ReturnType<typeof ProgressBar>;
|
|
28
|
+
export default ProgressBar;
|