@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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* feedback — dialogs, toasts, progress and the chrome around a pending read.
|
|
3
|
+
*
|
|
4
|
+
* What these have in common is that they speak to the reader about something
|
|
5
|
+
* that just happened, or is happening now: a confirmation to give, a result
|
|
6
|
+
* to notice, a number to compare, a wait to explain. That makes the live
|
|
7
|
+
* regions and the announcement order the contract — see each component's
|
|
8
|
+
* header comment — rather than the markup.
|
|
9
|
+
*
|
|
10
|
+
* As in `ui/`, every optional prop is declared `T | undefined`: the workspace
|
|
11
|
+
* compiles with `exactOptionalPropertyTypes`, under which `prop?: T` rejects
|
|
12
|
+
* an explicitly passed `undefined`, and these components are composed by
|
|
13
|
+
* callers forwarding their own optional props straight through.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
export { default as ConfirmDialog } from './ConfirmDialog.svelte';
|
|
18
|
+
export { default as Dialog } from './Dialog.svelte';
|
|
19
|
+
export { default as Drawer } from './Drawer.svelte';
|
|
20
|
+
export { default as LoadingBoundary } from './LoadingBoundary.svelte';
|
|
21
|
+
export { default as ProgressBar } from './ProgressBar.svelte';
|
|
22
|
+
export { default as SegmentBar } from './SegmentBar.svelte';
|
|
23
|
+
export { default as StatTile } from './StatTile.svelte';
|
|
24
|
+
export { default as Stats } from './Stats.svelte';
|
|
25
|
+
export { default as Steps } from './Steps.svelte';
|
|
26
|
+
export { default as Timeline } from './Timeline.svelte';
|
|
27
|
+
export { default as Toaster } from './Toaster.svelte';
|
|
28
|
+
export type { ConfirmForm } from './ConfirmDialog.svelte';
|
|
29
|
+
export type { BarSegment } from './SegmentBar.svelte';
|
|
30
|
+
export type { StatDelta } from './StatTile.svelte';
|
|
31
|
+
export type { StepItem, StepState } from './Steps.svelte';
|
|
32
|
+
export type { TimelineDate, TimelineEntry } from './Timeline.svelte';
|
|
33
|
+
export * from './sizes.ts';
|
|
34
|
+
export * from './toaster.ts';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* feedback — dialogs, toasts, progress and the chrome around a pending read.
|
|
3
|
+
*
|
|
4
|
+
* What these have in common is that they speak to the reader about something
|
|
5
|
+
* that just happened, or is happening now: a confirmation to give, a result
|
|
6
|
+
* to notice, a number to compare, a wait to explain. That makes the live
|
|
7
|
+
* regions and the announcement order the contract — see each component's
|
|
8
|
+
* header comment — rather than the markup.
|
|
9
|
+
*
|
|
10
|
+
* As in `ui/`, every optional prop is declared `T | undefined`: the workspace
|
|
11
|
+
* compiles with `exactOptionalPropertyTypes`, under which `prop?: T` rejects
|
|
12
|
+
* an explicitly passed `undefined`, and these components are composed by
|
|
13
|
+
* callers forwarding their own optional props straight through.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
export { default as ConfirmDialog } from './ConfirmDialog.svelte';
|
|
18
|
+
export { default as Dialog } from './Dialog.svelte';
|
|
19
|
+
export { default as Drawer } from './Drawer.svelte';
|
|
20
|
+
export { default as LoadingBoundary } from './LoadingBoundary.svelte';
|
|
21
|
+
export { default as ProgressBar } from './ProgressBar.svelte';
|
|
22
|
+
export { default as SegmentBar } from './SegmentBar.svelte';
|
|
23
|
+
export { default as StatTile } from './StatTile.svelte';
|
|
24
|
+
export { default as Stats } from './Stats.svelte';
|
|
25
|
+
export { default as Steps } from './Steps.svelte';
|
|
26
|
+
export { default as Timeline } from './Timeline.svelte';
|
|
27
|
+
export { default as Toaster } from './Toaster.svelte';
|
|
28
|
+
export * from "./sizes.js";
|
|
29
|
+
export * from "./toaster.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The literal class tables this family looks its variants up in.
|
|
3
|
+
*
|
|
4
|
+
* Tailwind only generates classes it can see verbatim in source, so a
|
|
5
|
+
* template string (`max-w-${size}`, `toast-${position}`) emits nothing at
|
|
6
|
+
* build time. Every step is spelled out once here as a `Record<K, string>`
|
|
7
|
+
* and looked up — the same discipline as `ui/tones.ts`, kept local because
|
|
8
|
+
* these steps are this family's, not the whole library's.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Width steps of a `Dialog`'s `modal-box`. */
|
|
13
|
+
export type DialogSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
+
/** Literal `max-w-*` class per `DialogSize`; a lookup table so Tailwind's scanner sees every class. */
|
|
15
|
+
export declare const dialogSize: Record<DialogSize, string>;
|
|
16
|
+
/** Where a `Toaster` stacks its notifications. */
|
|
17
|
+
export type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
18
|
+
/** Literal daisyUI class per `ToastPosition` for `Toaster`; a lookup table so Tailwind's scanner sees every class. */
|
|
19
|
+
export declare const toastPosition: Record<ToastPosition, string>;
|
|
20
|
+
/** Height steps of a `SegmentBar`. */
|
|
21
|
+
export type BarSize = 'sm' | 'md' | 'lg';
|
|
22
|
+
/** Literal height class per `BarSize`; a lookup table so Tailwind's scanner sees every class. */
|
|
23
|
+
export declare const barSize: Record<BarSize, string>;
|
|
24
|
+
/** How a `Stats` row lays its tiles out. */
|
|
25
|
+
export type StatsOrientation = 'horizontal' | 'vertical' | 'responsive';
|
|
26
|
+
/** Literal daisyUI class per `StatsOrientation` for `Stats`; a lookup table so Tailwind's scanner sees every class. */
|
|
27
|
+
export declare const statsOrientation: Record<StatsOrientation, string>;
|
|
28
|
+
/** How a `Steps` list lays its steps out. */
|
|
29
|
+
export type StepsOrientation = 'horizontal' | 'vertical' | 'responsive';
|
|
30
|
+
/** Literal daisyUI class per `StepsOrientation` for `Steps`; a lookup table so Tailwind's scanner sees every class. */
|
|
31
|
+
export declare const stepsOrientation: Record<StepsOrientation, string>;
|
|
32
|
+
/** The edge a `Drawer` enters from; `start` / `end` follow the writing direction. */
|
|
33
|
+
export type DrawerSide = 'start' | 'end' | 'top' | 'bottom';
|
|
34
|
+
/** Literal placement classes per `DrawerSide`; a lookup table so Tailwind's scanner sees every class. */
|
|
35
|
+
export declare const drawerSide: Record<DrawerSide, string>;
|
|
36
|
+
/** Size steps of a `Drawer`: its width at `start` / `end`, its height at `top` / `bottom`. */
|
|
37
|
+
export type DrawerSize = 'sm' | 'md' | 'lg' | 'full';
|
|
38
|
+
/** Literal width class per `DrawerSize` for a `start` / `end` drawer. */
|
|
39
|
+
export declare const drawerWidth: Record<DrawerSize, string>;
|
|
40
|
+
/** Literal height class per `DrawerSize` for a `top` / `bottom` drawer. */
|
|
41
|
+
export declare const drawerHeight: Record<DrawerSize, string>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The literal class tables this family looks its variants up in.
|
|
3
|
+
*
|
|
4
|
+
* Tailwind only generates classes it can see verbatim in source, so a
|
|
5
|
+
* template string (`max-w-${size}`, `toast-${position}`) emits nothing at
|
|
6
|
+
* build time. Every step is spelled out once here as a `Record<K, string>`
|
|
7
|
+
* and looked up — the same discipline as `ui/tones.ts`, kept local because
|
|
8
|
+
* these steps are this family's, not the whole library's.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Literal `max-w-*` class per `DialogSize`; a lookup table so Tailwind's scanner sees every class. */
|
|
13
|
+
export const dialogSize = {
|
|
14
|
+
sm: 'max-w-sm',
|
|
15
|
+
md: 'max-w-lg',
|
|
16
|
+
lg: 'max-w-2xl',
|
|
17
|
+
xl: 'max-w-4xl',
|
|
18
|
+
};
|
|
19
|
+
/** Literal daisyUI class per `ToastPosition` for `Toaster`; a lookup table so Tailwind's scanner sees every class. */
|
|
20
|
+
export const toastPosition = {
|
|
21
|
+
'top-start': 'toast-top toast-start',
|
|
22
|
+
'top-center': 'toast-top toast-center',
|
|
23
|
+
'top-end': 'toast-top toast-end',
|
|
24
|
+
'bottom-start': 'toast-bottom toast-start',
|
|
25
|
+
'bottom-center': 'toast-bottom toast-center',
|
|
26
|
+
'bottom-end': 'toast-bottom toast-end',
|
|
27
|
+
};
|
|
28
|
+
/** Literal height class per `BarSize`; a lookup table so Tailwind's scanner sees every class. */
|
|
29
|
+
export const barSize = {
|
|
30
|
+
sm: 'h-2',
|
|
31
|
+
md: 'h-4',
|
|
32
|
+
lg: 'h-6',
|
|
33
|
+
};
|
|
34
|
+
/** Literal daisyUI class per `StatsOrientation` for `Stats`; a lookup table so Tailwind's scanner sees every class. */
|
|
35
|
+
export const statsOrientation = {
|
|
36
|
+
horizontal: 'stats-horizontal',
|
|
37
|
+
vertical: 'stats-vertical',
|
|
38
|
+
// Stacked on a phone, in a row from `sm` up — the shape every app's
|
|
39
|
+
// dashboard reached for by hand.
|
|
40
|
+
responsive: 'stats-vertical sm:stats-horizontal',
|
|
41
|
+
};
|
|
42
|
+
/** Literal daisyUI class per `StepsOrientation` for `Steps`; a lookup table so Tailwind's scanner sees every class. */
|
|
43
|
+
export const stepsOrientation = {
|
|
44
|
+
horizontal: 'steps-horizontal',
|
|
45
|
+
vertical: 'steps-vertical',
|
|
46
|
+
// A column on a phone, a row from `sm` up, as `statsOrientation` does.
|
|
47
|
+
responsive: 'steps-vertical sm:steps-horizontal',
|
|
48
|
+
};
|
|
49
|
+
/** Literal placement classes per `DrawerSide`; a lookup table so Tailwind's scanner sees every class. */
|
|
50
|
+
export const drawerSide = {
|
|
51
|
+
start: 'inset-y-0 start-0 h-full max-w-[calc(100vw-2rem)]',
|
|
52
|
+
end: 'inset-y-0 end-0 h-full max-w-[calc(100vw-2rem)]',
|
|
53
|
+
top: 'inset-x-0 top-0 max-h-[85dvh] rounded-b-box',
|
|
54
|
+
bottom: 'inset-x-0 bottom-0 max-h-[85dvh] rounded-t-box',
|
|
55
|
+
};
|
|
56
|
+
/** Literal width class per `DrawerSize` for a `start` / `end` drawer. */
|
|
57
|
+
export const drawerWidth = {
|
|
58
|
+
sm: 'w-72',
|
|
59
|
+
md: 'w-96',
|
|
60
|
+
lg: 'w-[32rem]',
|
|
61
|
+
full: 'w-screen max-w-none',
|
|
62
|
+
};
|
|
63
|
+
/** Literal height class per `DrawerSize` for a `top` / `bottom` drawer. */
|
|
64
|
+
export const drawerHeight = {
|
|
65
|
+
sm: 'h-[33dvh]',
|
|
66
|
+
md: 'h-[50dvh]',
|
|
67
|
+
lg: 'h-[75dvh]',
|
|
68
|
+
full: 'h-dvh max-h-none rounded-none',
|
|
69
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toaster seam: what a toast is, and how anything below a `<Toaster>`
|
|
3
|
+
* reaches the one region on the page.
|
|
4
|
+
*
|
|
5
|
+
* Kept out of `Toaster.svelte` so a module that only wants to *push* a toast
|
|
6
|
+
* — a store, a form helper, another component — imports a `.ts` file rather
|
|
7
|
+
* than pulling a component (and its icons) onto its own path.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import type { StatusTone } from '../ui/tones.ts';
|
|
12
|
+
/** The colour a toast is drawn in; the same four states an `Alert` has. */
|
|
13
|
+
export type ToastTone = StatusTone;
|
|
14
|
+
/** One notification as the `Toaster` holds it, after it has been given an id. */
|
|
15
|
+
export interface Toast {
|
|
16
|
+
/** Assigned by the toaster; unique for the life of the page. */
|
|
17
|
+
readonly id: number;
|
|
18
|
+
/** The line that carries the message. */
|
|
19
|
+
readonly title: string;
|
|
20
|
+
/** Optional second line. */
|
|
21
|
+
readonly description?: string | undefined;
|
|
22
|
+
readonly tone: ToastTone;
|
|
23
|
+
}
|
|
24
|
+
/** What a toast looks like before the toaster has given it an id. */
|
|
25
|
+
export type NewToast = Omit<Toast, 'id' | 'tone'> & {
|
|
26
|
+
readonly tone?: ToastTone | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** What `getToaster()` returns: push a toast or dismiss one. */
|
|
29
|
+
export interface ToasterApi {
|
|
30
|
+
/**
|
|
31
|
+
* Push a toast and return its id. It dismisses itself after `durationMs`
|
|
32
|
+
* (the `<Toaster>`'s own default when omitted); `0` makes it sticky, for a
|
|
33
|
+
* message the reader must act on.
|
|
34
|
+
*/
|
|
35
|
+
add(toast: NewToast, durationMs?: number): number;
|
|
36
|
+
/** Remove a toast early — the dismiss button, or the app itself. */
|
|
37
|
+
dismiss(id: number): void;
|
|
38
|
+
}
|
|
39
|
+
/** Publish the region's API to its descendants. Called by `Toaster`. */
|
|
40
|
+
export declare function setToaster(api: ToasterApi): void;
|
|
41
|
+
/**
|
|
42
|
+
* The nearest `<Toaster>`'s API.
|
|
43
|
+
*
|
|
44
|
+
* Throws when there is no provider: a silently dropped notification is worse
|
|
45
|
+
* than a loud failure in development, and every call site is inside the app's
|
|
46
|
+
* own layout where the provider is mounted once.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getToaster(): ToasterApi;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toaster seam: what a toast is, and how anything below a `<Toaster>`
|
|
3
|
+
* reaches the one region on the page.
|
|
4
|
+
*
|
|
5
|
+
* Kept out of `Toaster.svelte` so a module that only wants to *push* a toast
|
|
6
|
+
* — a store, a form helper, another component — imports a `.ts` file rather
|
|
7
|
+
* than pulling a component (and its icons) onto its own path.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { getContext, setContext } from 'svelte';
|
|
12
|
+
const TOASTER_KEY = Symbol('@thomasfosterau/components:toaster');
|
|
13
|
+
/** Publish the region's API to its descendants. Called by `Toaster`. */
|
|
14
|
+
export function setToaster(api) {
|
|
15
|
+
setContext(TOASTER_KEY, api);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The nearest `<Toaster>`'s API.
|
|
19
|
+
*
|
|
20
|
+
* Throws when there is no provider: a silently dropped notification is worse
|
|
21
|
+
* than a loud failure in development, and every call site is inside the app's
|
|
22
|
+
* own layout where the provider is mounted once.
|
|
23
|
+
*/
|
|
24
|
+
export function getToaster() {
|
|
25
|
+
const api = getContext(TOASTER_KEY);
|
|
26
|
+
if (api === undefined)
|
|
27
|
+
throw new Error('getToaster() was called outside a <Toaster>');
|
|
28
|
+
return api;
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
An inline, always-visible month grid for picking a date, on bits-ui's `Calendar`.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
Calendar — a month (or several side by side) to choose one date from,
|
|
6
|
+
inline rather than in a popover: a booking sidebar, a "sown on" planner, an
|
|
7
|
+
availability view. The popover pickers compose it. `DateInput` (the native
|
|
8
|
+
control) stays the default for a single date on a form; this is for when
|
|
9
|
+
the reader benefits from seeing the month.
|
|
10
|
+
|
|
11
|
+
The value is a `DateValue` from `@internationalized/date`, bits-ui's own
|
|
12
|
+
type: lossless, and it carries its calendar system. Convert at the edge with
|
|
13
|
+
`parseDate('2026-10-23')` and `value.toString()`, both re-exported from the
|
|
14
|
+
`./dates` entry.
|
|
15
|
+
|
|
16
|
+
ARIA contract (APG date-picker grid), from bits-ui: a `role="application"`
|
|
17
|
+
wrapper named by `calendarLabel` and the visible month, one `role="grid"`
|
|
18
|
+
per month, `gridcell`s with `aria-selected` / `aria-disabled`, a roving
|
|
19
|
+
tabindex, and the keys — arrows by day and week, Home / End to the week's
|
|
20
|
+
ends, Page Up / Page Down by month, Enter / Space to select. This file
|
|
21
|
+
adds the labelled previous / next buttons (`previousLabel` / `nextLabel`),
|
|
22
|
+
each grid's name ("October 2026"), a struck-through
|
|
23
|
+
unavailable day, and the `FieldControl` wiring: inside a `FormField` the
|
|
24
|
+
root is `aria-labelledby` the label (`labelId`) and `aria-describedby` the
|
|
25
|
+
hint and errors. `invalid` draws the error border; the `application` role
|
|
26
|
+
does not take `aria-invalid`, so the error text reaches it through
|
|
27
|
+
`describedBy`.
|
|
28
|
+
-->
|
|
29
|
+
<script lang="ts">import { Calendar } from "bits-ui";
|
|
30
|
+
import { getComponentsContext } from "../context.svelte.js";
|
|
31
|
+
import CalendarMonths from "./CalendarMonths.svelte";
|
|
32
|
+
import { calendarRoot } from "./calendar-props.js";
|
|
33
|
+
let { value = $bindable(), month = $bindable(), ...props } = $props();
|
|
34
|
+
const context = getComponentsContext();
|
|
35
|
+
const shared = $derived(calendarRoot(props, context.locale()));
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<Calendar.Root
|
|
39
|
+
{...shared.root}
|
|
40
|
+
type="single"
|
|
41
|
+
bind:placeholder={
|
|
42
|
+
// Unset, bits-ui picks the value's month or today's.
|
|
43
|
+
() => month as DateValue,
|
|
44
|
+
(next: DateValue) => {
|
|
45
|
+
month = next;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
bind:value={
|
|
49
|
+
// bits-ui declares `value?: DateValue` (no `| undefined`) but reads an
|
|
50
|
+
// unset value as `undefined` at runtime; the binding passes it through.
|
|
51
|
+
() => value as DateValue,
|
|
52
|
+
(next: DateValue | undefined) => {
|
|
53
|
+
value = next;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
{#snippet children({ months, weekdays })}
|
|
58
|
+
<CalendarMonths parts={Calendar} {...shared.months} {months} {weekdays} />
|
|
59
|
+
{/snippet}
|
|
60
|
+
</Calendar.Root>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DateValue } from '@internationalized/date';
|
|
2
|
+
import { Calendar } from 'bits-ui';
|
|
3
|
+
import { type CalendarBaseProps } from './calendar-props.ts';
|
|
4
|
+
interface Props extends CalendarBaseProps {
|
|
5
|
+
/** The selected date; `undefined` when none. Bindable. */
|
|
6
|
+
value?: DateValue | undefined;
|
|
7
|
+
}
|
|
8
|
+
/** An inline, always-visible month grid for picking a date, on bits-ui's `Calendar`. */
|
|
9
|
+
declare const Calendar: import("svelte").Component<Props, {}, "value" | "month">;
|
|
10
|
+
type Calendar = ReturnType<typeof Calendar>;
|
|
11
|
+
export default Calendar;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
The header, month grids and day cells `Calendar` and `RangeCalendar` share; internal, not exported.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
CalendarMonths — the body of a bits-ui calendar, written once for both
|
|
6
|
+
roots. `parts` is the bits-ui namespace in use (`Calendar` or
|
|
7
|
+
`RangeCalendar`); both expose the same sub-components with the same props,
|
|
8
|
+
so one template serves both, and the day styling — the part a reader sees
|
|
9
|
+
— cannot drift between the single-date and the range calendar.
|
|
10
|
+
|
|
11
|
+
Each month `<table role="grid">` is named by its own month and year
|
|
12
|
+
("October 2026"), so a two-month calendar's grids are told apart. The
|
|
13
|
+
visible heading is bits-ui's, `aria-hidden` because the month is already
|
|
14
|
+
in the `application`'s name, which bits-ui updates as the reader pages. An unavailable day is struck through as well as
|
|
15
|
+
`aria-disabled`: colour is never the only signal.
|
|
16
|
+
-->
|
|
17
|
+
<script lang="ts">import { DateFormatter, getLocalTimeZone } from "@internationalized/date";
|
|
18
|
+
import { ChevronLeft, ChevronRight } from "@lucide/svelte";
|
|
19
|
+
let { parts, months, weekdays, locale, previousLabel, nextLabel, day } = $props();
|
|
20
|
+
const P = $derived(parts);
|
|
21
|
+
const monthName = $derived(new DateFormatter(locale, {
|
|
22
|
+
month: "long",
|
|
23
|
+
year: "numeric"
|
|
24
|
+
}));
|
|
25
|
+
const nameOf = (month) => monthName.format(month.value.toDate(getLocalTimeZone()));
|
|
26
|
+
// One literal class list (Tailwind scans it as written). Range-middle wins
|
|
27
|
+
// over selected, so a range reads as one band with two solid ends.
|
|
28
|
+
const dayClass = [
|
|
29
|
+
"btn btn-ghost btn-sm btn-square font-normal",
|
|
30
|
+
"data-today:ring-1 data-today:ring-primary data-today:ring-inset",
|
|
31
|
+
"[&[data-selected]:not([data-range-middle])]:bg-primary [&[data-selected]:not([data-range-middle])]:text-primary-content",
|
|
32
|
+
"data-range-middle:bg-primary/15 data-range-middle:rounded-none",
|
|
33
|
+
"data-outside-month:text-base-content/40",
|
|
34
|
+
"data-unavailable:text-base-content/40 data-unavailable:line-through",
|
|
35
|
+
"data-disabled:text-base-content/30 data-disabled:pointer-events-none"
|
|
36
|
+
];
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<P.Header class="flex items-center justify-between gap-2 pb-2">
|
|
40
|
+
<!-- bits-ui writes its own English aria-label after the caller's props, so
|
|
41
|
+
the button is rendered through `child` to put `previousLabel` last. -->
|
|
42
|
+
<P.PrevButton>
|
|
43
|
+
{#snippet child({ props })}
|
|
44
|
+
<button {...props} class="btn btn-ghost btn-sm btn-square" aria-label={previousLabel}>
|
|
45
|
+
<ChevronLeft class="size-4" aria-hidden="true" />
|
|
46
|
+
</button>
|
|
47
|
+
{/snippet}
|
|
48
|
+
</P.PrevButton>
|
|
49
|
+
<P.Heading class="text-sm font-medium" />
|
|
50
|
+
<P.NextButton>
|
|
51
|
+
{#snippet child({ props })}
|
|
52
|
+
<button {...props} class="btn btn-ghost btn-sm btn-square" aria-label={nextLabel}>
|
|
53
|
+
<ChevronRight class="size-4" aria-hidden="true" />
|
|
54
|
+
</button>
|
|
55
|
+
{/snippet}
|
|
56
|
+
</P.NextButton>
|
|
57
|
+
</P.Header>
|
|
58
|
+
<div class="flex flex-col gap-4 sm:flex-row">
|
|
59
|
+
{#each months as month (month.value.toString())}
|
|
60
|
+
<P.Grid class="w-full border-collapse select-none" aria-label={nameOf(month)}>
|
|
61
|
+
<P.GridHead>
|
|
62
|
+
<P.GridRow class="flex">
|
|
63
|
+
{#each weekdays as weekday, index (index)}
|
|
64
|
+
<P.HeadCell class="text-base-content/60 w-8 text-xs font-normal">{weekday}</P.HeadCell>
|
|
65
|
+
{/each}
|
|
66
|
+
</P.GridRow>
|
|
67
|
+
</P.GridHead>
|
|
68
|
+
<P.GridBody>
|
|
69
|
+
{#each month.weeks as week, index (index)}
|
|
70
|
+
<P.GridRow class="flex">
|
|
71
|
+
{#each week as date (date.toString())}
|
|
72
|
+
<P.Cell {date} month={month.value} class="p-0">
|
|
73
|
+
{#snippet children({ selected, unavailable })}
|
|
74
|
+
<P.Day class={dayClass}>
|
|
75
|
+
{date.day}
|
|
76
|
+
{#if day}{@render day({ date, selected, unavailable })}{/if}
|
|
77
|
+
</P.Day>
|
|
78
|
+
{/snippet}
|
|
79
|
+
</P.Cell>
|
|
80
|
+
{/each}
|
|
81
|
+
</P.GridRow>
|
|
82
|
+
{/each}
|
|
83
|
+
</P.GridBody>
|
|
84
|
+
</P.Grid>
|
|
85
|
+
{/each}
|
|
86
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type DateValue } from '@internationalized/date';
|
|
2
|
+
import type { Calendar, DatePicker, DateRangePicker, RangeCalendar } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
/** One month of the calendar, as bits-ui's root snippet hands it over. */
|
|
5
|
+
interface Month {
|
|
6
|
+
readonly value: DateValue;
|
|
7
|
+
readonly weeks: readonly (readonly DateValue[])[];
|
|
8
|
+
}
|
|
9
|
+
/** What the `day` snippet receives for one cell. */
|
|
10
|
+
interface DayState {
|
|
11
|
+
readonly date: DateValue;
|
|
12
|
+
readonly selected: boolean;
|
|
13
|
+
readonly unavailable: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface Props {
|
|
16
|
+
/** The bits-ui namespace whose parts to render. */
|
|
17
|
+
parts: typeof Calendar | typeof RangeCalendar | typeof DatePicker | typeof DateRangePicker;
|
|
18
|
+
months: readonly Month[];
|
|
19
|
+
weekdays: readonly string[];
|
|
20
|
+
/** The resolved single locale. */
|
|
21
|
+
locale: string;
|
|
22
|
+
previousLabel: string;
|
|
23
|
+
nextLabel: string;
|
|
24
|
+
/** Extra decoration inside a day cell. */
|
|
25
|
+
day?: Snippet<[DayState]> | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The header, month grids and day cells `Calendar` and `RangeCalendar` share; internal, not exported. */
|
|
28
|
+
declare const CalendarMonths: import("svelte").Component<Props, {}, "">;
|
|
29
|
+
type CalendarMonths = ReturnType<typeof CalendarMonths>;
|
|
30
|
+
export default CalendarMonths;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
A daisyUI `checkbox` with its label in the same `<label>`, so the whole row is the hit target.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
Checkbox — daisyUI `checkbox` with its label in the same `<label>`, so the
|
|
6
|
+
whole row is the hit target and the input is named without an `id`/`for`
|
|
7
|
+
pair at all.
|
|
8
|
+
|
|
9
|
+
Unlike the text fields this one carries its OWN label: a checkbox's label
|
|
10
|
+
sits beside it rather than above it, and a `FormField` wrapped around a
|
|
11
|
+
single checkbox would put the question in two places. Use `CheckboxGroup`
|
|
12
|
+
(or `Fieldset`) when several checkboxes answer one question.
|
|
13
|
+
|
|
14
|
+
ARIA contract: a native `<input type="checkbox">` wrapped in its `<label>`,
|
|
15
|
+
so `checked` is the state assistive technology reads and Space toggles it
|
|
16
|
+
with no script. `describedBy` and `invalid` tie it to an enclosing group's
|
|
17
|
+
hint and errors when there is one.
|
|
18
|
+
-->
|
|
19
|
+
<script lang="ts">import { checkboxSize } from "./field-types.js";
|
|
20
|
+
let { label, checked = $bindable(false), size = "md", invalid = false, describedBy = "", labelId: _labelId, class: className, ...rest } = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<label class={['label cursor-pointer justify-start gap-3', className]}>
|
|
24
|
+
<input
|
|
25
|
+
{...rest}
|
|
26
|
+
type="checkbox"
|
|
27
|
+
bind:checked
|
|
28
|
+
aria-invalid={invalid ? 'true' : undefined}
|
|
29
|
+
aria-describedby={describedBy === '' ? undefined : describedBy}
|
|
30
|
+
class={['checkbox', checkboxSize[size], invalid && 'checkbox-error']}
|
|
31
|
+
/>
|
|
32
|
+
<span>{label}</span>
|
|
33
|
+
</label>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import { type FieldSize } from './field-types.ts';
|
|
3
|
+
interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'size'> {
|
|
4
|
+
/** Text beside the box; becomes the input's accessible name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Whether the box is ticked. Bindable. */
|
|
7
|
+
checked?: boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* daisyUI size step.
|
|
10
|
+
* @defaultValue `'md'`
|
|
11
|
+
*/
|
|
12
|
+
size?: FieldSize | undefined;
|
|
13
|
+
/** `FieldControl`: the field is in error — sets `aria-invalid` and the error style. */
|
|
14
|
+
invalid?: boolean | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* `FieldControl`: space-separated ids for `aria-describedby`.
|
|
17
|
+
* @defaultValue `''`
|
|
18
|
+
*/
|
|
19
|
+
describedBy?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* `FieldControl`: the visible label's id. Not used — this control is
|
|
22
|
+
* labelable, so the `FormField`'s `<label for>` already names it; taken
|
|
23
|
+
* here so a spread `FieldControl` does not leak it as an attribute.
|
|
24
|
+
*/
|
|
25
|
+
labelId?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** A daisyUI `checkbox` with its label in the same `<label>`, so the whole row is the hit target. */
|
|
28
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
|
|
29
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
30
|
+
export default Checkbox;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
Several checkboxes answering one question, inside one `Fieldset`.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
CheckboxGroup — several checkboxes answering one question, inside one
|
|
6
|
+
`Fieldset`.
|
|
7
|
+
|
|
8
|
+
ARIA contract: the `<legend>` names the group and is repeated as focus moves
|
|
9
|
+
between the boxes; each box is named by its own inline label; the group's
|
|
10
|
+
hint and errors are on the `<fieldset>`, so they are read once for the group
|
|
11
|
+
rather than once per box.
|
|
12
|
+
|
|
13
|
+
`values` is the list of TICKED values, bindable. It is a plain array rather
|
|
14
|
+
than a `Set` because that is what a form's decoded body and a JSON payload
|
|
15
|
+
both look like, and because Svelte's deep reactivity tracks it.
|
|
16
|
+
-->
|
|
17
|
+
<script lang="ts">import Checkbox from "./Checkbox.svelte";
|
|
18
|
+
import Fieldset from "./Fieldset.svelte";
|
|
19
|
+
import { toFieldOptions } from "./field-types.js";
|
|
20
|
+
let { legend, options, values = $bindable([]), name, hint, errors = [], required = false, requiredLabel = "(required)", disabled = false, size = "md", ...rest } = $props();
|
|
21
|
+
const entries = $derived(toFieldOptions(options));
|
|
22
|
+
const invalid = $derived(errors.length > 0);
|
|
23
|
+
const toggle = (value, ticked) => {
|
|
24
|
+
values = ticked ? [...values, value] : values.filter((entry) => entry !== value);
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Fieldset {...rest} {legend} {hint} {errors} {required} {requiredLabel}>
|
|
29
|
+
{#each entries as option (option.value)}
|
|
30
|
+
<Checkbox
|
|
31
|
+
label={option.label}
|
|
32
|
+
{name}
|
|
33
|
+
{size}
|
|
34
|
+
{invalid}
|
|
35
|
+
value={option.value}
|
|
36
|
+
disabled={disabled || option.disabled === true}
|
|
37
|
+
checked={values.includes(option.value)}
|
|
38
|
+
onchange={(event) => toggle(option.value, event.currentTarget.checked)}
|
|
39
|
+
/>
|
|
40
|
+
{/each}
|
|
41
|
+
</Fieldset>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type FieldOptionInput, type FieldSize } from './field-types.ts';
|
|
3
|
+
interface Props extends Omit<HTMLAttributes<HTMLFieldSetElement>, 'children'> {
|
|
4
|
+
/** The question the boxes answer. */
|
|
5
|
+
legend: string;
|
|
6
|
+
/** Full options, or bare strings when value and label are the same. */
|
|
7
|
+
options: readonly FieldOptionInput[];
|
|
8
|
+
/**
|
|
9
|
+
* The ticked values.
|
|
10
|
+
* @defaultValue `[]`
|
|
11
|
+
*/
|
|
12
|
+
values?: string[] | undefined;
|
|
13
|
+
/** Posted field name; every box shares it, as a multi-value field. */
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
/** Guidance rendered under the legend. */
|
|
16
|
+
hint?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Validation messages; any at all marks the group invalid.
|
|
19
|
+
* @defaultValue `[]`
|
|
20
|
+
*/
|
|
21
|
+
errors?: readonly string[] | undefined;
|
|
22
|
+
/** Marks the group required and reads `requiredLabel` after the legend. */
|
|
23
|
+
required?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Read out after the legend when `required`.
|
|
26
|
+
* @defaultValue `'(required)'`
|
|
27
|
+
*/
|
|
28
|
+
requiredLabel?: string | undefined;
|
|
29
|
+
/** Disables every option. */
|
|
30
|
+
disabled?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* daisyUI size step.
|
|
33
|
+
* @defaultValue `'md'`
|
|
34
|
+
*/
|
|
35
|
+
size?: FieldSize | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Several checkboxes answering one question, inside one `Fieldset`. */
|
|
38
|
+
declare const CheckboxGroup: import("svelte").Component<Props, {}, "values">;
|
|
39
|
+
type CheckboxGroup = ReturnType<typeof CheckboxGroup>;
|
|
40
|
+
export default CheckboxGroup;
|