@lilydesignsystem/svelte-headless 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/LICENSE.md +8 -8
- package/README.md +4 -4
- package/dist/components/AccordionLink/AccordionLink.svelte +12 -2
- package/dist/components/AccordionLink/AccordionLink.svelte.d.ts +4 -0
- package/dist/components/ActionBar/ActionBar.svelte +2 -2
- package/dist/components/ActionGroup/ActionGroup.svelte +31 -7
- package/dist/components/ActionGroup/ActionGroup.svelte.d.ts +4 -4
- package/dist/components/AddressographBox/AddressographBox.svelte +5 -1
- package/dist/components/AiLabel/AiLabel.svelte +2 -2
- package/dist/components/Alert/Alert.svelte +1 -3
- package/dist/components/AlertDialog/AlertDialog.svelte +9 -4
- package/dist/components/Answer/Answer.svelte +5 -1
- package/dist/components/AreaChart/AreaChart.svelte +5 -1
- package/dist/components/AsSaudiyahRaqmAlHuwiyahAlWataniyahInput/AsSaudiyahRaqmAlHuwiyahAlWataniyahInput.svelte +55 -0
- package/dist/components/AsSaudiyahRaqmAlHuwiyahAlWataniyahInput/AsSaudiyahRaqmAlHuwiyahAlWataniyahInput.svelte.d.ts +10 -0
- package/dist/components/AsSaudiyahRaqmAlHuwiyahAlWataniyahView/AsSaudiyahRaqmAlHuwiyahAlWataniyahView.svelte +40 -0
- package/dist/components/AsSaudiyahRaqmAlHuwiyahAlWataniyahView/AsSaudiyahRaqmAlHuwiyahAlWataniyahView.svelte.d.ts +8 -0
- package/dist/components/AustraliaTaxFileNumberInput/AustraliaTaxFileNumberInput.svelte +55 -0
- package/dist/components/AustraliaTaxFileNumberInput/AustraliaTaxFileNumberInput.svelte.d.ts +10 -0
- package/dist/components/AustraliaTaxFileNumberView/AustraliaTaxFileNumberView.svelte +40 -0
- package/dist/components/AustraliaTaxFileNumberView/AustraliaTaxFileNumberView.svelte.d.ts +8 -0
- package/dist/components/Autosuggest/Autosuggest.svelte +175 -8
- package/dist/components/Autosuggest/Autosuggest.svelte.d.ts +18 -4
- package/dist/components/AvatarGroup/AvatarGroup.svelte +5 -1
- package/dist/components/BarChart/BarChart.svelte +5 -1
- package/dist/components/BarcodeImage/BarcodeImage.svelte +7 -1
- package/dist/components/BreadcrumbLink/BreadcrumbLink.svelte +12 -2
- package/dist/components/BreadcrumbLink/BreadcrumbLink.svelte.d.ts +4 -0
- package/dist/components/BreadcrumbListItem/BreadcrumbListItem.svelte +3 -3
- package/dist/components/Byline/Byline.svelte +4 -1
- package/dist/components/CandlestickChart/CandlestickChart.svelte +5 -1
- package/dist/components/Caption/Caption.svelte +1 -0
- package/dist/components/CareCard/CareCard.svelte +1 -0
- package/dist/components/Cascader/Cascader.svelte +7 -1
- package/dist/components/ChatComposer/ChatComposer.svelte +6 -3
- package/dist/components/ChatList/ChatList.svelte +6 -2
- package/dist/components/ChatListItem/ChatListItem.svelte +10 -2
- package/dist/components/ChatListItem/ChatListItem.svelte.d.ts +2 -0
- package/dist/components/ChatMessage/ChatMessage.svelte +6 -2
- package/dist/components/ChatNav/ChatNav.svelte +6 -2
- package/dist/components/CheckListItem/CheckListItem.svelte +4 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.svelte +1 -0
- package/dist/components/ChoroplethChart/ChoroplethChart.svelte +5 -1
- package/dist/components/Citation/Citation.svelte +6 -2
- package/dist/components/Coachmark/Coachmark.svelte +20 -10
- package/dist/components/Code/Code.svelte +6 -2
- package/dist/components/CodeBlock/CodeBlock.svelte +6 -2
- package/dist/components/CollectionListItem/CollectionListItem.svelte +1 -1
- package/dist/components/ColombiaCedulaDeCiudadaniaInput/ColombiaCedulaDeCiudadaniaInput.svelte +55 -0
- package/dist/components/ColombiaCedulaDeCiudadaniaInput/ColombiaCedulaDeCiudadaniaInput.svelte.d.ts +10 -0
- package/dist/components/ColombiaCedulaDeCiudadaniaView/ColombiaCedulaDeCiudadaniaView.svelte +40 -0
- package/dist/components/ColombiaCedulaDeCiudadaniaView/ColombiaCedulaDeCiudadaniaView.svelte.d.ts +8 -0
- package/dist/components/ColumnChart/ColumnChart.svelte +5 -1
- package/dist/components/Combobox/Combobox.svelte +11 -9
- package/dist/components/Comment/Comment.svelte +5 -1
- package/dist/components/ComposedChart/ComposedChart.svelte +5 -1
- package/dist/components/ContentsListItem/ContentsListItem.svelte +4 -1
- package/dist/components/ContentsNav/ContentsNav.svelte +56 -36
- package/dist/components/ContextMenu/ContextMenu.svelte +19 -17
- package/dist/components/ContextualHelp/ContextualHelp.svelte +55 -26
- package/dist/components/ContextualHelp/ContextualHelp.svelte.d.ts +4 -2
- package/dist/components/ConvertDiv/ConvertDiv.svelte +31 -0
- package/dist/components/ConvertDiv/ConvertDiv.svelte.d.ts +11 -0
- package/dist/components/ConvertFromDiv/ConvertFromDiv.svelte +25 -0
- package/dist/components/ConvertFromDiv/ConvertFromDiv.svelte.d.ts +9 -0
- package/dist/components/ConvertFromUnitDiv/ConvertFromUnitDiv.svelte +25 -0
- package/dist/components/ConvertFromUnitDiv/ConvertFromUnitDiv.svelte.d.ts +9 -0
- package/dist/components/ConvertFromValueDiv/ConvertFromValueDiv.svelte +25 -0
- package/dist/components/ConvertFromValueDiv/ConvertFromValueDiv.svelte.d.ts +9 -0
- package/dist/components/ConvertIntoDiv/ConvertIntoDiv.svelte +25 -0
- package/dist/components/ConvertIntoDiv/ConvertIntoDiv.svelte.d.ts +9 -0
- package/dist/components/ConvertIntoUnitDiv/ConvertIntoUnitDiv.svelte +25 -0
- package/dist/components/ConvertIntoUnitDiv/ConvertIntoUnitDiv.svelte.d.ts +9 -0
- package/dist/components/ConvertIntoValueDiv/ConvertIntoValueDiv.svelte +25 -0
- package/dist/components/ConvertIntoValueDiv/ConvertIntoValueDiv.svelte.d.ts +9 -0
- package/dist/components/CurrencyInput/CurrencyInput.svelte +61 -8
- package/dist/components/CurrencyInput/CurrencyInput.svelte.d.ts +9 -4
- package/dist/components/DateTimeNowInput/DateTimeNowInput.svelte +18 -16
- package/dist/components/DateTimeNowInput/DateTimeNowInput.svelte.d.ts +3 -3
- package/dist/components/DescriptionList/DescriptionList.svelte +0 -2
- package/dist/components/DescriptionListItem/DescriptionListItem.svelte +0 -2
- package/dist/components/DialGroup/DialGroup.svelte +5 -1
- package/dist/components/Dialog/Dialog.svelte +14 -1
- package/dist/components/Dialog/modal.d.ts +4 -0
- package/dist/components/Dialog/modal.js +47 -0
- package/dist/components/Diff/Diff.svelte +5 -1
- package/dist/components/DigitalObjectIdentifierLink/DigitalObjectIdentifierLink.svelte +16 -7
- package/dist/components/DigitalObjectIdentifierLink/DigitalObjectIdentifierLink.svelte.d.ts +4 -2
- package/dist/components/DocumentList/DocumentList.svelte +0 -1
- package/dist/components/DocumentListItem/DocumentListItem.svelte +0 -2
- package/dist/components/Drawer/Drawer.svelte +35 -12
- package/dist/components/DropdownMenu/DropdownMenu.svelte +27 -16
- package/dist/components/EcuadorCedulaDeIdentidadInput/EcuadorCedulaDeIdentidadInput.svelte +55 -0
- package/dist/components/EcuadorCedulaDeIdentidadInput/EcuadorCedulaDeIdentidadInput.svelte.d.ts +10 -0
- package/dist/components/EcuadorCedulaDeIdentidadView/EcuadorCedulaDeIdentidadView.svelte +40 -0
- package/dist/components/EcuadorCedulaDeIdentidadView/EcuadorCedulaDeIdentidadView.svelte.d.ts +8 -0
- package/dist/components/EireIndividualHealthIdentifierView/EireIndividualHealthIdentifierView.svelte +2 -1
- package/dist/components/EspanaTarjetaSanitariaIndividualView/EspanaTarjetaSanitariaIndividualView.svelte +2 -1
- package/dist/components/Event/Event.svelte +6 -2
- package/dist/components/FeatureCard/FeatureCard.svelte +5 -1
- package/dist/components/FeaturePhoto/FeaturePhoto.svelte +4 -1
- package/dist/components/FileDialog/FileDialog.svelte +7 -1
- package/dist/components/FileTree/FileTree.svelte +20 -5
- package/dist/components/FiveFaceRatingPicker/FiveFaceRatingPicker.svelte +3 -1
- package/dist/components/FiveFaceRatingPickerButton/FiveFaceRatingPickerButton.svelte +2 -2
- package/dist/components/FiveStarRatingPicker/FiveStarRatingPicker.svelte +3 -1
- package/dist/components/FiveStarRatingPickerButton/FiveStarRatingPickerButton.svelte +2 -2
- package/dist/components/FlexStack/FlexStack.svelte +3 -1
- package/dist/components/FloatingPanel/FloatingPanel.svelte +15 -13
- package/dist/components/FunnelChart/FunnelChart.svelte +5 -1
- package/dist/components/GaugeChart/GaugeChart.svelte +5 -1
- package/dist/components/GoToNextSection/GoToNextSection.svelte +2 -3
- package/dist/components/GoToPreviousSection/GoToPreviousSection.svelte +2 -3
- package/dist/components/GoToTop/GoToTop.svelte +0 -2
- package/dist/components/GrailLayoutBottomFooter/GrailLayoutBottomFooter.svelte +4 -1
- package/dist/components/GrailLayoutCenterMain/GrailLayoutCenterMain.svelte +4 -1
- package/dist/components/GrailLayoutLeftAside/GrailLayoutLeftAside.svelte +4 -1
- package/dist/components/GrailLayoutRightAside/GrailLayoutRightAside.svelte +4 -1
- package/dist/components/GrailLayoutTopHeader/GrailLayoutTopHeader.svelte +4 -1
- package/dist/components/GraphicBlock/GraphicBlock.svelte +1 -1
- package/dist/components/Grid/Grid.svelte +12 -3
- package/dist/components/Grid/Grid.svelte.d.ts +2 -0
- package/dist/components/Headline/Headline.svelte +4 -1
- package/dist/components/HeatmapChart/HeatmapChart.svelte +5 -1
- package/dist/components/HeatmapChartWithYearOfDays/HeatmapChartWithYearOfDays.svelte +5 -1
- package/dist/components/Hero/Hero.svelte +6 -2
- package/dist/components/HongKongIdentityCardInput/HongKongIdentityCardInput.svelte +55 -0
- package/dist/components/HongKongIdentityCardInput/HongKongIdentityCardInput.svelte.d.ts +10 -0
- package/dist/components/HongKongIdentityCardView/HongKongIdentityCardView.svelte +40 -0
- package/dist/components/HongKongIdentityCardView/HongKongIdentityCardView.svelte.d.ts +8 -0
- package/dist/components/HorizontalScroller/HorizontalScroller.svelte +1 -0
- package/dist/components/HoverCard/HoverCard.svelte +14 -13
- package/dist/components/IconListItem/IconListItem.svelte +4 -1
- package/dist/components/InputWithMask/InputWithMask.svelte +4 -1
- package/dist/components/IranKodEMelliInput/IranKodEMelliInput.svelte +55 -0
- package/dist/components/IranKodEMelliInput/IranKodEMelliInput.svelte.d.ts +10 -0
- package/dist/components/IranKodEMelliView/IranKodEMelliView.svelte +40 -0
- package/dist/components/IranKodEMelliView/IranKodEMelliView.svelte.d.ts +8 -0
- package/dist/components/Kbd/Kbd.svelte +5 -1
- package/dist/components/KbdShortcut/KbdShortcut.svelte +9 -2
- package/dist/components/LineChart/LineChart.svelte +5 -1
- package/dist/components/Listbox/Listbox.svelte +22 -117
- package/dist/components/Listbox/listbox-machine.d.ts +81 -0
- package/dist/components/Listbox/listbox-machine.js +116 -0
- package/dist/components/Listbox/search-text.d.ts +22 -0
- package/dist/components/Listbox/search-text.js +56 -0
- package/dist/components/Listbox/typeahead.d.ts +19 -0
- package/dist/components/Listbox/typeahead.js +39 -0
- package/dist/components/Loading/Loading.svelte +5 -1
- package/dist/components/MalaysiaKadPengenalanInput/MalaysiaKadPengenalanInput.svelte +55 -0
- package/dist/components/MalaysiaKadPengenalanInput/MalaysiaKadPengenalanInput.svelte.d.ts +10 -0
- package/dist/components/MalaysiaKadPengenalanView/MalaysiaKadPengenalanView.svelte +40 -0
- package/dist/components/MalaysiaKadPengenalanView/MalaysiaKadPengenalanView.svelte.d.ts +8 -0
- package/dist/components/Mark/Mark.svelte +0 -2
- package/dist/components/MentionsInput/MentionsInput.svelte +14 -2
- package/dist/components/Menu/Menu.svelte +1 -3
- package/dist/components/MenuBar/MenuBar.svelte +1 -3
- package/dist/components/MenuGroup/MenuGroup.svelte +6 -1
- package/dist/components/MiddleTruncation/MiddleTruncation.svelte +13 -3
- package/dist/components/MockupBrowser/MockupBrowser.svelte +5 -1
- package/dist/components/MockupLaptop/MockupLaptop.svelte +5 -1
- package/dist/components/MockupPhonePortrait/MockupPhonePortrait.svelte +5 -1
- package/dist/components/MockupShell/MockupShell.svelte +5 -1
- package/dist/components/MockupTabletLandscape/MockupTabletLandscape.svelte +5 -1
- package/dist/components/MockupTabletPortrait/MockupTabletPortrait.svelte +5 -1
- package/dist/components/MockupWatch/MockupWatch.svelte +5 -1
- package/dist/components/MockupWindow/MockupWindow.svelte +5 -1
- package/dist/components/MutuallyExclusive/MutuallyExclusive.svelte +0 -1
- package/dist/components/NavigationMenu/NavigationMenu.svelte +51 -3
- package/dist/components/NavigationMenu/NavigationMenu.svelte.d.ts +4 -0
- package/dist/components/NavigationMenu/overflow-navigation.d.ts +35 -0
- package/dist/components/NavigationMenu/overflow-navigation.js +133 -0
- package/dist/components/NetPromoterScorePicker/NetPromoterScorePicker.svelte +3 -1
- package/dist/components/NetPromoterScorePickerButton/NetPromoterScorePickerButton.svelte +2 -2
- package/dist/components/NigeriaNationalIdentificationNumberInput/NigeriaNationalIdentificationNumberInput.svelte +55 -0
- package/dist/components/NigeriaNationalIdentificationNumberInput/NigeriaNationalIdentificationNumberInput.svelte.d.ts +10 -0
- package/dist/components/NigeriaNationalIdentificationNumberView/NigeriaNationalIdentificationNumberView.svelte +40 -0
- package/dist/components/NigeriaNationalIdentificationNumberView/NigeriaNationalIdentificationNumberView.svelte.d.ts +8 -0
- package/dist/components/Organization/Organization.svelte +6 -2
- package/dist/components/PaginationLink/PaginationLink.svelte +12 -2
- package/dist/components/PaginationLink/PaginationLink.svelte.d.ts +4 -0
- package/dist/components/PakistanComputerizedNationalIdentityCardInput/PakistanComputerizedNationalIdentityCardInput.svelte +55 -0
- package/dist/components/PakistanComputerizedNationalIdentityCardInput/PakistanComputerizedNationalIdentityCardInput.svelte.d.ts +10 -0
- package/dist/components/PakistanComputerizedNationalIdentityCardView/PakistanComputerizedNationalIdentityCardView.svelte +40 -0
- package/dist/components/PakistanComputerizedNationalIdentityCardView/PakistanComputerizedNationalIdentityCardView.svelte.d.ts +8 -0
- package/dist/components/Person/Person.svelte +6 -2
- package/dist/components/PhaseBanner/PhaseBanner.svelte +0 -1
- package/dist/components/Pictogram/Pictogram.svelte +4 -1
- package/dist/components/Picture/Picture.svelte +27 -0
- package/dist/components/Picture/Picture.svelte.d.ts +9 -0
- package/dist/components/PieChart/PieChart.svelte +5 -1
- package/dist/components/Place/Place.svelte +6 -2
- package/dist/components/PopconfirmDialog/PopconfirmDialog.svelte +16 -3
- package/dist/components/Popover/Popover.svelte +39 -24
- package/dist/components/Popover/popover.d.ts +9 -0
- package/dist/components/Popover/popover.js +50 -0
- package/dist/components/Popup/Popup.svelte +40 -25
- package/dist/components/ProductCard/ProductCard.svelte +5 -1
- package/dist/components/ProgressBar/ProgressBar.svelte +0 -1
- package/dist/components/Question/Question.svelte +5 -1
- package/dist/components/RadarChart/RadarChart.svelte +5 -1
- package/dist/components/RedAmberGreenPickerButton/RedAmberGreenPickerButton.svelte +2 -2
- package/dist/components/RedOrangeYellowGreenBluePickerButton/RedOrangeYellowGreenBluePickerButton.svelte +2 -2
- package/dist/components/RelatedContent/RelatedContent.svelte +0 -1
- package/dist/components/Resizable/Resizable.svelte +1 -0
- package/dist/components/RingChart/RingChart.svelte +5 -1
- package/dist/components/SankeyChart/SankeyChart.svelte +5 -1
- package/dist/components/ScatterChart/ScatterChart.svelte +5 -1
- package/dist/components/ScreenReaderSpan/ScreenReaderSpan.svelte +6 -2
- package/dist/components/ScrollArea/ScrollArea.svelte +1 -0
- package/dist/components/ScrollBar/ScrollBar.svelte +78 -16
- package/dist/components/ScrollBar/ScrollBar.svelte.d.ts +13 -1
- package/dist/components/Scroller/Scroller.svelte +4 -1
- package/dist/components/ScrollerBase/ScrollerBase.svelte +1 -1
- package/dist/components/SectionLink/SectionLink.svelte +0 -2
- package/dist/components/SectionList/SectionList.svelte +0 -2
- package/dist/components/SectionListItem/SectionListItem.svelte +1 -3
- package/dist/components/SectionNav/SectionNav.svelte +0 -1
- package/dist/components/Separator/Separator.svelte +1 -0
- package/dist/components/Sheet/Sheet.svelte +32 -11
- package/dist/components/ShowMore/ShowMore.svelte +9 -2
- package/dist/components/SlideOutDrawer/SlideOutDrawer.svelte +33 -10
- package/dist/components/SliderButton/SliderButton.svelte +64 -6
- package/dist/components/SliderButton/SliderButton.svelte.d.ts +8 -2
- package/dist/components/SplitButton/SplitButton.svelte +29 -5
- package/dist/components/SplitButton/SplitButton.svelte.d.ts +3 -3
- package/dist/components/SplitView/SplitView.svelte +1 -0
- package/dist/components/Splitter/Splitter.svelte +1 -0
- package/dist/components/StatusLight/StatusLight.svelte +5 -8
- package/dist/components/StepListItem/StepListItem.svelte +3 -3
- package/dist/components/StickyPromoBanner/StickyPromoBanner.svelte +1 -0
- package/dist/components/SunburstChart/SunburstChart.svelte +5 -1
- package/dist/components/SuperBanner/SuperBanner.svelte +5 -1
- package/dist/components/TabBar/TabBar.svelte +1 -3
- package/dist/components/Tag/Tag.svelte +10 -2
- package/dist/components/TaiwanGuominShenfenzhengTongyiBianhaoInput/TaiwanGuominShenfenzhengTongyiBianhaoInput.svelte +55 -0
- package/dist/components/TaiwanGuominShenfenzhengTongyiBianhaoInput/TaiwanGuominShenfenzhengTongyiBianhaoInput.svelte.d.ts +10 -0
- package/dist/components/TaiwanGuominShenfenzhengTongyiBianhaoView/TaiwanGuominShenfenzhengTongyiBianhaoView.svelte +40 -0
- package/dist/components/TaiwanGuominShenfenzhengTongyiBianhaoView/TaiwanGuominShenfenzhengTongyiBianhaoView.svelte.d.ts +8 -0
- package/dist/components/TaskBar/TaskBar.svelte +1 -3
- package/dist/components/TextAreaInput/TextAreaInput.svelte +1 -2
- package/dist/components/TextAreaInputWithCharacterCounter/TextAreaInputWithCharacterCounter.svelte +4 -3
- package/dist/components/ThemeProvider/ThemeProvider.svelte +3 -3
- package/dist/components/Tile/Tile.svelte +5 -1
- package/dist/components/TimeoutDialog/TimeoutDialog.svelte +14 -1
- package/dist/components/TimerButton/TimerButton.svelte +55 -7
- package/dist/components/TimerButton/TimerButton.svelte.d.ts +9 -3
- package/dist/components/ToolBar/ToolBar.svelte +1 -3
- package/dist/components/ToolCallError/ToolCallError.svelte +0 -1
- package/dist/components/ToolCallName/ToolCallName.svelte +0 -2
- package/dist/components/Tooltip/Tooltip.svelte +14 -12
- package/dist/components/Tour/Tour.svelte +5 -4
- package/dist/components/TourList/TourList.svelte +10 -9
- package/dist/components/TourList/TourList.svelte.d.ts +2 -0
- package/dist/components/TourListItem/TourListItem.svelte +2 -2
- package/dist/components/TransferList/TransferList.svelte +8 -2
- package/dist/components/TreeLink/TreeLink.svelte +12 -2
- package/dist/components/TreeLink/TreeLink.svelte.d.ts +4 -0
- package/dist/components/TreeList/TreeList.svelte +3 -3
- package/dist/components/TreeListItem/TreeListItem.svelte +9 -1
- package/dist/components/TreeMenu/TreeMenu.svelte +40 -1
- package/dist/components/TreeSelect/TreeSelect.svelte +10 -3
- package/dist/components/TuaisceartEireannHealthAndCareNumberView/TuaisceartEireannHealthAndCareNumberView.svelte +2 -1
- package/dist/components/UruguayCedulaDeIdentidadInput/UruguayCedulaDeIdentidadInput.svelte +55 -0
- package/dist/components/UruguayCedulaDeIdentidadInput/UruguayCedulaDeIdentidadInput.svelte.d.ts +10 -0
- package/dist/components/UruguayCedulaDeIdentidadView/UruguayCedulaDeIdentidadView.svelte +40 -0
- package/dist/components/UruguayCedulaDeIdentidadView/UruguayCedulaDeIdentidadView.svelte.d.ts +8 -0
- package/dist/components/VideoPlayer/VideoPlayer.svelte +6 -2
- package/dist/components/VietNamCanCuocCongDanInput/VietNamCanCuocCongDanInput.svelte +55 -0
- package/dist/components/VietNamCanCuocCongDanInput/VietNamCanCuocCongDanInput.svelte.d.ts +10 -0
- package/dist/components/VietNamCanCuocCongDanView/VietNamCanCuocCongDanView.svelte +40 -0
- package/dist/components/VietNamCanCuocCongDanView/VietNamCanCuocCongDanView.svelte.d.ts +8 -0
- package/dist/components/Visible/Visible.svelte +1 -1
- package/dist/components/WarningText/WarningText.svelte +48 -0
- package/dist/components/WarningText/WarningText.svelte.d.ts +13 -0
- package/dist/components/WheelPicker/WheelPicker.svelte +18 -4
- package/dist/components/WheelPicker/wheel-picker.js +18 -3
- package/dist/index.d.ts +33 -0
- package/dist/index.js +33 -0
- package/index.md +4 -4
- package/package.json +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The content. */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const ConvertFromUnitDiv: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ConvertFromUnitDiv = ReturnType<typeof ConvertFromUnitDiv>;
|
|
9
|
+
export default ConvertFromUnitDiv;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// ConvertFromValueDiv component
|
|
3
|
+
//
|
|
4
|
+
// A headless part of ConvertDiv: the value to convert from, such as a text input holding the number of dollars. Contract: a plain <div> with the base class and children.
|
|
5
|
+
// Converts nothing and carries no strings of its own; the consumer supplies the controls.
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className = "",
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: {
|
|
13
|
+
/** The content. */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- ConvertFromValueDiv.svelte -->
|
|
20
|
+
<div
|
|
21
|
+
class={`convert-from-value-div ${className}`}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The content. */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const ConvertFromValueDiv: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ConvertFromValueDiv = ReturnType<typeof ConvertFromValueDiv>;
|
|
9
|
+
export default ConvertFromValueDiv;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// ConvertIntoDiv component
|
|
3
|
+
//
|
|
4
|
+
// A headless part of ConvertDiv: the target side of a conversion, holding the value and unit to convert into. Contract: a plain <div> with the base class and children.
|
|
5
|
+
// Converts nothing and carries no strings of its own; the consumer supplies the controls.
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className = "",
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: {
|
|
13
|
+
/** The content. */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- ConvertIntoDiv.svelte -->
|
|
20
|
+
<div
|
|
21
|
+
class={`convert-into-div ${className}`}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The content. */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const ConvertIntoDiv: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ConvertIntoDiv = ReturnType<typeof ConvertIntoDiv>;
|
|
9
|
+
export default ConvertIntoDiv;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// ConvertIntoUnitDiv component
|
|
3
|
+
//
|
|
4
|
+
// A headless part of ConvertDiv: the unit to convert into, such as a select box of currencies or lengths. Contract: a plain <div> with the base class and children.
|
|
5
|
+
// Converts nothing and carries no strings of its own; the consumer supplies the controls.
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className = "",
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: {
|
|
13
|
+
/** The content. */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- ConvertIntoUnitDiv.svelte -->
|
|
20
|
+
<div
|
|
21
|
+
class={`convert-into-unit-div ${className}`}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The content. */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const ConvertIntoUnitDiv: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ConvertIntoUnitDiv = ReturnType<typeof ConvertIntoUnitDiv>;
|
|
9
|
+
export default ConvertIntoUnitDiv;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// ConvertIntoValueDiv component
|
|
3
|
+
//
|
|
4
|
+
// A headless part of ConvertDiv: the converted value, such as a text input showing the number of euros. Contract: a plain <div> with the base class and children.
|
|
5
|
+
// Converts nothing and carries no strings of its own; the consumer supplies the controls.
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className = "",
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: {
|
|
13
|
+
/** The content. */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- ConvertIntoValueDiv.svelte -->
|
|
20
|
+
<div
|
|
21
|
+
class={`convert-into-value-div ${className}`}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The content. */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const ConvertIntoValueDiv: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ConvertIntoValueDiv = ReturnType<typeof ConvertIntoValueDiv>;
|
|
9
|
+
export default ConvertIntoValueDiv;
|
|
@@ -1,18 +1,71 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
// CurrencyInput component
|
|
3
|
+
//
|
|
4
|
+
// A currency input rendered as a native <input type="text" inputmode="decimal">.
|
|
5
|
+
// The component does not format the displayed value; formatting
|
|
6
|
+
// (Intl.NumberFormat, separators, currency symbol placement) is the consumer's
|
|
7
|
+
// responsibility. currencyCode is exposed as data-currency-code so the
|
|
8
|
+
// consumer can pass it to Intl.NumberFormat. It is REQUIRED and never
|
|
9
|
+
// defaulted: the component does not pick a currency.
|
|
10
|
+
//
|
|
11
|
+
// Props:
|
|
12
|
+
// class — string, optional. CSS class name.
|
|
13
|
+
// label — string, required. Accessible name via aria-label.
|
|
14
|
+
// value — number | undefined, bindable. Parsed numeric value.
|
|
15
|
+
// currencyCode — string, required, no default. ISO 4217 currency code.
|
|
16
|
+
// min, max — number, optional. Constraints, not enforced clamping.
|
|
17
|
+
// required, disabled — boolean, default false.
|
|
18
|
+
// ...restProps — spread onto the <input>.
|
|
19
|
+
//
|
|
20
|
+
// Claude rules:
|
|
21
|
+
// - Headless: no CSS, no styles; no locale formatting baked in
|
|
22
|
+
// - Never default currencyCode (AGENTS/internationalization.md)
|
|
23
|
+
|
|
3
24
|
let {
|
|
4
25
|
class: className = "",
|
|
5
|
-
label
|
|
6
|
-
|
|
26
|
+
label,
|
|
27
|
+
value = $bindable(undefined),
|
|
28
|
+
currencyCode,
|
|
29
|
+
min = undefined,
|
|
30
|
+
max = undefined,
|
|
31
|
+
required = false,
|
|
32
|
+
disabled = false,
|
|
7
33
|
...restProps
|
|
8
34
|
}: {
|
|
9
|
-
|
|
10
|
-
|
|
35
|
+
class?: string;
|
|
36
|
+
label: string;
|
|
37
|
+
value?: number | undefined;
|
|
38
|
+
currencyCode: string;
|
|
39
|
+
min?: number;
|
|
40
|
+
max?: number;
|
|
41
|
+
required?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
11
43
|
[key: string]: unknown;
|
|
12
44
|
} = $props();
|
|
45
|
+
|
|
46
|
+
function oninput(event: Event) {
|
|
47
|
+
const raw = (event.currentTarget as HTMLInputElement).value.trim();
|
|
48
|
+
if (raw === "") {
|
|
49
|
+
value = undefined;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const parsed = Number(raw);
|
|
53
|
+
value = Number.isNaN(parsed) ? undefined : parsed;
|
|
54
|
+
}
|
|
13
55
|
</script>
|
|
14
56
|
|
|
15
57
|
<!-- CurrencyInput.svelte -->
|
|
16
|
-
<
|
|
17
|
-
{
|
|
18
|
-
|
|
58
|
+
<input
|
|
59
|
+
class={`currency-input ${className}`}
|
|
60
|
+
type="text"
|
|
61
|
+
inputmode="decimal"
|
|
62
|
+
aria-label={label}
|
|
63
|
+
data-currency-code={currencyCode}
|
|
64
|
+
value={value === undefined ? "" : String(value)}
|
|
65
|
+
{min}
|
|
66
|
+
{max}
|
|
67
|
+
{required}
|
|
68
|
+
{disabled}
|
|
69
|
+
{oninput}
|
|
70
|
+
{...restProps}
|
|
71
|
+
/>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
1
|
type $$ComponentProps = {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
class?: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value?: number | undefined;
|
|
5
|
+
currencyCode: string;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
5
10
|
[key: string]: unknown;
|
|
6
11
|
};
|
|
7
|
-
declare const CurrencyInput: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
declare const CurrencyInput: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
8
13
|
type CurrencyInput = ReturnType<typeof CurrencyInput>;
|
|
9
14
|
export default CurrencyInput;
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
// Props:
|
|
11
11
|
// className — string, optional. CSS class name.
|
|
12
12
|
// label — string, required. Accessible name for the wrapper group via aria-label.
|
|
13
|
-
// dateLabel — string,
|
|
14
|
-
// timeLabel — string,
|
|
15
|
-
// nowLabel — string,
|
|
13
|
+
// dateLabel — string, required. Accessible name for the date input via aria-label.
|
|
14
|
+
// timeLabel — string, required. Accessible name for the time input via aria-label.
|
|
15
|
+
// nowLabel — string, required. Accessible label and text for the "Now" button.
|
|
16
|
+
// The three come from the locale-translations packs: {...dateTimeNowInputLabels(pack)}.
|
|
16
17
|
// dateValue — string, default "". Bindable date string (format: YYYY-MM-DD).
|
|
17
18
|
// timeValue — string, default "". Bindable time string (format: HH:mm).
|
|
18
19
|
// required — boolean, default false. Whether the inputs are required.
|
|
@@ -20,17 +21,17 @@
|
|
|
20
21
|
// ...restProps — additional HTML attributes spread onto the wrapper <div>.
|
|
21
22
|
//
|
|
22
23
|
// Syntax:
|
|
23
|
-
// <DateTimeNowInput label="Event time" bind:dateValue bind:timeValue />
|
|
24
|
+
// <DateTimeNowInput label="Event time" dateLabel="Date" timeLabel="Time" nowLabel="Now" bind:dateValue bind:timeValue />
|
|
24
25
|
//
|
|
25
26
|
// Examples:
|
|
26
|
-
// <!--
|
|
27
|
-
// <DateTimeNowInput label="
|
|
27
|
+
// <!-- Labels from a locale pack (@lilydesignsystem/svelte-locale-translations) -->
|
|
28
|
+
// <DateTimeNowInput label="Heure de l'événement" {...dateTimeNowInputLabels(fr)} bind:dateValue bind:timeValue />
|
|
28
29
|
//
|
|
29
|
-
// <!--
|
|
30
|
-
// <DateTimeNowInput label="
|
|
30
|
+
// <!-- Labels written by hand -->
|
|
31
|
+
// <DateTimeNowInput label="Event time" dateLabel="Date" timeLabel="Time" nowLabel="Now" bind:dateValue bind:timeValue />
|
|
31
32
|
//
|
|
32
33
|
// <!-- Required and disabled -->
|
|
33
|
-
// <DateTimeNowInput label="Appointment" bind:dateValue bind:timeValue required disabled={isLocked} />
|
|
34
|
+
// <DateTimeNowInput label="Appointment" {...labels} bind:dateValue bind:timeValue required disabled={isLocked} />
|
|
34
35
|
//
|
|
35
36
|
// Keyboard:
|
|
36
37
|
// - Tab: Moves focus between the date input, time input, and "Now" button
|
|
@@ -45,7 +46,8 @@
|
|
|
45
46
|
//
|
|
46
47
|
// Internationalization:
|
|
47
48
|
// - The label, dateLabel, timeLabel, and nowLabel props are the only user-facing strings
|
|
48
|
-
// -
|
|
49
|
+
// - No default labels: a missing one leaves its control unnamed rather than in English.
|
|
50
|
+
// dateTimeNowInputLabels(pack) from the locale-translations package gives all three in 64 locales.
|
|
49
51
|
// - No other hardcoded user-facing strings
|
|
50
52
|
//
|
|
51
53
|
// Claude rules:
|
|
@@ -59,9 +61,9 @@
|
|
|
59
61
|
let {
|
|
60
62
|
class: className = "",
|
|
61
63
|
label,
|
|
62
|
-
dateLabel
|
|
63
|
-
timeLabel
|
|
64
|
-
nowLabel
|
|
64
|
+
dateLabel,
|
|
65
|
+
timeLabel,
|
|
66
|
+
nowLabel,
|
|
65
67
|
dateValue = $bindable(""),
|
|
66
68
|
timeValue = $bindable(""),
|
|
67
69
|
required = false,
|
|
@@ -69,9 +71,9 @@
|
|
|
69
71
|
...restProps
|
|
70
72
|
}: {
|
|
71
73
|
label: string;
|
|
72
|
-
dateLabel
|
|
73
|
-
timeLabel
|
|
74
|
-
nowLabel
|
|
74
|
+
dateLabel: string;
|
|
75
|
+
timeLabel: string;
|
|
76
|
+
nowLabel: string;
|
|
75
77
|
dateValue?: string;
|
|
76
78
|
timeValue?: string;
|
|
77
79
|
required?: boolean;
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
// - WAI-ARIA dialog role: https://www.w3.org/TR/wai-aria-1.2/#dialog
|
|
55
55
|
|
|
56
56
|
import type { Snippet } from "svelte";
|
|
57
|
+
import { modalDialog } from "./modal.js";
|
|
57
58
|
|
|
58
59
|
let {
|
|
59
60
|
class: className = "",
|
|
@@ -80,17 +81,29 @@
|
|
|
80
81
|
open = false;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
function oncancel(event: Event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
open = false;
|
|
87
|
+
}
|
|
88
|
+
function onclose() {
|
|
89
|
+
open = false;
|
|
90
|
+
}
|
|
83
91
|
</script>
|
|
84
92
|
|
|
85
93
|
<!-- Dialog.svelte -->
|
|
86
94
|
{#if open}
|
|
95
|
+
<!-- A modal dialog is opened by `showModal()` (see modal.ts), so the `open` attribute is only rendered for a
|
|
96
|
+
non-modal one; the keydown and cancel handlers keep `open` in step with a native Escape or `<form method="dialog">`. -->
|
|
87
97
|
<dialog
|
|
88
98
|
class={`dialog ${className}`}
|
|
89
|
-
open
|
|
99
|
+
open={modal ? undefined : true}
|
|
90
100
|
tabindex="-1"
|
|
91
101
|
aria-label={label}
|
|
92
102
|
aria-modal={modal || undefined}
|
|
103
|
+
use:modalDialog={modal}
|
|
93
104
|
{onkeydown}
|
|
105
|
+
{oncancel}
|
|
106
|
+
{onclose}
|
|
94
107
|
{...restProps}
|
|
95
108
|
>
|
|
96
109
|
{@render children?.()}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Show a <dialog> as a real modal, or as a plain open dialog.
|
|
2
|
+
//
|
|
3
|
+
// A modal dialog is opened with `showModal()`: the browser puts it in the top layer, makes the rest of the page
|
|
4
|
+
// inert (no pointer, no keyboard, no assistive-technology access behind it), traps Tab inside it, moves focus to
|
|
5
|
+
// it and returns focus to the opener when it closes. Setting the `open` attribute does none of that, so a dialog
|
|
6
|
+
// that only sets `open` and says `aria-modal="true"` claims a modality it does not have.
|
|
7
|
+
//
|
|
8
|
+
// Where `showModal` is missing (jsdom, very old browsers) the dialog falls back to the `open` attribute, which
|
|
9
|
+
// keeps it visible and testable. Used as `use:modalDialog={modal}`.
|
|
10
|
+
export function modalDialog(node, enabled) {
|
|
11
|
+
let modal = enabled;
|
|
12
|
+
// Where focus was when the dialog opened. A native close() would hand focus back there, but Svelte takes the element
|
|
13
|
+
// out of the page before this action's cleanup runs, so by then the browser can no longer do it: we do.
|
|
14
|
+
const opener = typeof document === "undefined" ? null : document.activeElement;
|
|
15
|
+
function show() {
|
|
16
|
+
if (node.open)
|
|
17
|
+
return;
|
|
18
|
+
if (modal && typeof node.showModal === "function")
|
|
19
|
+
node.showModal();
|
|
20
|
+
else
|
|
21
|
+
node.setAttribute("open", "");
|
|
22
|
+
}
|
|
23
|
+
function hide() {
|
|
24
|
+
if (!node.open)
|
|
25
|
+
return;
|
|
26
|
+
if (typeof node.close === "function")
|
|
27
|
+
node.close();
|
|
28
|
+
else
|
|
29
|
+
node.removeAttribute("open");
|
|
30
|
+
}
|
|
31
|
+
show();
|
|
32
|
+
return {
|
|
33
|
+
update(next) {
|
|
34
|
+
if (next === modal)
|
|
35
|
+
return;
|
|
36
|
+
// Modal and non-modal are different openings: close the old one and open the new one.
|
|
37
|
+
hide();
|
|
38
|
+
modal = next;
|
|
39
|
+
show();
|
|
40
|
+
},
|
|
41
|
+
destroy() {
|
|
42
|
+
hide();
|
|
43
|
+
if (opener && opener !== document.body && opener.isConnected)
|
|
44
|
+
opener.focus();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
// DigitalObjectIdentifierLink: a link to a Digital Object Identifier through the https://doi.org/ resolver.
|
|
3
|
+
// The display text is the consumer's children, or the DOI itself when none is given.
|
|
2
4
|
import type { Snippet } from "svelte";
|
|
3
5
|
let {
|
|
4
6
|
class: className = "",
|
|
5
|
-
|
|
6
|
-
children,
|
|
7
|
+
doi,
|
|
8
|
+
children = undefined,
|
|
7
9
|
...restProps
|
|
8
10
|
}: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
/** The Digital Object Identifier, e.g. "10.1000/xyz123". */
|
|
12
|
+
doi: string;
|
|
13
|
+
/** Link display text; the DOI when omitted. */
|
|
14
|
+
children?: Snippet;
|
|
11
15
|
[key: string]: unknown;
|
|
12
16
|
} = $props();
|
|
13
17
|
</script>
|
|
14
18
|
|
|
15
19
|
<!-- DigitalObjectIdentifierLink.svelte -->
|
|
16
|
-
<
|
|
17
|
-
{
|
|
18
|
-
|
|
20
|
+
<a
|
|
21
|
+
class={`digital-object-identifier-link ${className}`}
|
|
22
|
+
href={`https://doi.org/${doi}`}
|
|
23
|
+
rel="noopener noreferrer"
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{#if children}{@render children()}{:else}{doi}{/if}
|
|
27
|
+
</a>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** The Digital Object Identifier, e.g. "10.1000/xyz123". */
|
|
4
|
+
doi: string;
|
|
5
|
+
/** Link display text; the DOI when omitted. */
|
|
6
|
+
children?: Snippet;
|
|
5
7
|
[key: string]: unknown;
|
|
6
8
|
};
|
|
7
9
|
declare const DigitalObjectIdentifierLink: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Drawer component
|
|
3
3
|
//
|
|
4
4
|
// A panel that slides in from an edge of the viewport, typically used for
|
|
5
|
-
// navigation menus, filters, or supplementary content.
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// navigation menus, filters, or supplementary content. It is modal: while open
|
|
6
|
+
// it renders a native <dialog> opened with showModal() (see ../Dialog/modal.ts),
|
|
7
|
+
// so the browser puts it in the top layer, makes the page behind it inert,
|
|
8
|
+
// traps Tab inside it and, on close, focus returns to the element that opened
|
|
9
|
+
// it. The side prop indicates which edge via a data-side attribute for
|
|
10
|
+
// consumer positioning and animation styles.
|
|
9
11
|
//
|
|
10
12
|
// Props:
|
|
11
13
|
// className — string, optional. CSS class name.
|
|
@@ -13,7 +15,7 @@
|
|
|
13
15
|
// label — string, required. Accessible name for the drawer.
|
|
14
16
|
// side — "left" | "right" | "top" | "bottom", default "left". Edge the drawer enters from.
|
|
15
17
|
// children — Snippet, required. Drawer content.
|
|
16
|
-
// ...restProps — additional HTML attributes spread onto the <
|
|
18
|
+
// ...restProps — additional HTML attributes spread onto the <dialog>.
|
|
17
19
|
//
|
|
18
20
|
// Syntax:
|
|
19
21
|
// <Drawer label="Nav" bind:open side="left">Content</Drawer>
|
|
@@ -30,13 +32,15 @@
|
|
|
30
32
|
// </Drawer>
|
|
31
33
|
//
|
|
32
34
|
// Keyboard:
|
|
33
|
-
// - Escape: closes the drawer by setting open to false
|
|
35
|
+
// - Escape: closes the drawer by setting open to false (also the native cancel event)
|
|
36
|
+
// - Tab: stays inside the drawer while it is open (showModal() makes the page inert)
|
|
34
37
|
//
|
|
35
38
|
// Accessibility:
|
|
36
|
-
// - role="dialog"
|
|
39
|
+
// - role="dialog" provided natively by the <dialog> element
|
|
37
40
|
// - aria-label provides the accessible name
|
|
38
|
-
// - aria-modal="true"
|
|
39
|
-
// -
|
|
41
|
+
// - aria-modal="true" is true: showModal() makes the rest of the page inert
|
|
42
|
+
// - focus moves into the drawer on open and returns to the opener on close
|
|
43
|
+
// - tabindex="-1" lets the drawer itself take focus when it has no focusable child
|
|
40
44
|
// - data-side attribute conveys position for consumer styling
|
|
41
45
|
//
|
|
42
46
|
// Internationalization:
|
|
@@ -46,12 +50,15 @@
|
|
|
46
50
|
// - Headless: no CSS, no styles — consumer provides all styling
|
|
47
51
|
// - Uses $bindable() on open for two-way state binding
|
|
48
52
|
// - Drawer is removed from DOM when open is false
|
|
53
|
+
// - Opened with showModal() via ../Dialog/modal.ts; where showModal is missing (jsdom) it falls back to
|
|
54
|
+
// the open attribute
|
|
49
55
|
// - Consumer uses data-side for positioning CSS
|
|
50
56
|
//
|
|
51
57
|
// References:
|
|
52
58
|
// - WAI-ARIA Dialog Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
53
59
|
|
|
54
60
|
import type { Snippet } from "svelte";
|
|
61
|
+
import { modalDialog } from "../Dialog/modal.js";
|
|
55
62
|
|
|
56
63
|
let {
|
|
57
64
|
class: className = "",
|
|
@@ -78,20 +85,36 @@
|
|
|
78
85
|
open = false;
|
|
79
86
|
}
|
|
80
87
|
}
|
|
88
|
+
function oncancel(event: Event) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
open = false;
|
|
91
|
+
}
|
|
92
|
+
function onclose() {
|
|
93
|
+
open = false;
|
|
94
|
+
}
|
|
95
|
+
// Open as a real modal, then make sure focus is inside: showModal() already moves it in a browser, the
|
|
96
|
+
// open-attribute fallback does not.
|
|
97
|
+
function modal(node: HTMLDialogElement) {
|
|
98
|
+
const action = modalDialog(node, true);
|
|
99
|
+
if (!node.contains(document.activeElement)) node.focus();
|
|
100
|
+
return action;
|
|
101
|
+
}
|
|
81
102
|
</script>
|
|
82
103
|
|
|
83
104
|
{#if open}
|
|
84
105
|
<!-- Drawer.svelte -->
|
|
85
|
-
<
|
|
106
|
+
<dialog
|
|
86
107
|
class={`drawer ${className}`}
|
|
87
|
-
role="dialog"
|
|
88
108
|
tabindex="-1"
|
|
89
109
|
aria-label={label}
|
|
90
110
|
aria-modal="true"
|
|
91
111
|
data-side={side}
|
|
112
|
+
use:modal
|
|
92
113
|
{onkeydown}
|
|
114
|
+
{oncancel}
|
|
115
|
+
{onclose}
|
|
93
116
|
{...restProps}
|
|
94
117
|
>
|
|
95
118
|
{@render children?.()}
|
|
96
|
-
</
|
|
119
|
+
</dialog>
|
|
97
120
|
{/if}
|