@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
|
@@ -27,7 +27,10 @@
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<!-- Headline.svelte -->
|
|
30
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
class={`headline ${className}`}
|
|
32
|
+
{...restProps}
|
|
33
|
+
>
|
|
31
34
|
{#if level === 1}
|
|
32
35
|
<h1 class="headline-heading">{@render children?.()}</h1>
|
|
33
36
|
{:else if level === 2}
|
|
@@ -52,7 +52,11 @@
|
|
|
52
52
|
class={`heatmap-chart ${className}`}
|
|
53
53
|
{...restProps}
|
|
54
54
|
>
|
|
55
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
class="heatmap-chart-graphic"
|
|
57
|
+
role="img"
|
|
58
|
+
aria-label={label}
|
|
59
|
+
>
|
|
56
60
|
{@render children?.()}
|
|
57
61
|
</div>
|
|
58
62
|
{#if dataTable}
|
|
@@ -63,7 +63,11 @@
|
|
|
63
63
|
data-week-start={weekStart}
|
|
64
64
|
{...restProps}
|
|
65
65
|
>
|
|
66
|
-
<div
|
|
66
|
+
<div
|
|
67
|
+
class="heatmap-chart-with-year-of-days-graphic"
|
|
68
|
+
role="img"
|
|
69
|
+
aria-label={label}
|
|
70
|
+
>
|
|
67
71
|
{@render children?.()}
|
|
68
72
|
</div>
|
|
69
73
|
{#if dataTable}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// HongKongIdentityCardInput component
|
|
3
|
+
//
|
|
4
|
+
// A headless input for entering Hong Kong's Identity Card Number.
|
|
5
|
+
// Format: One or two letters, six digits and a check digit in parentheses, such as A123456(3). The check digit is 0 to 9 or A. Each letter counts as A=10 to Z=35, and a single letter is preceded by a space counted as 36; the eight values are multiplied by 9,8,7,6,5,4,3,2 and summed, and the check digit is 11 minus the sum's Modulus-11 remainder (0 when the remainder is 0, and A when the result is 10).
|
|
6
|
+
//
|
|
7
|
+
// Props:
|
|
8
|
+
// className — string, optional. CSS class name.
|
|
9
|
+
// label — string, required. Accessible label for screen readers via aria-label.
|
|
10
|
+
// value — string, default "". Bindable input value; supports bind:value.
|
|
11
|
+
// required — boolean, default false. Whether the input is required for form submission.
|
|
12
|
+
// disabled — boolean, default false. Whether the input is disabled.
|
|
13
|
+
// ...restProps — additional HTML attributes spread onto the <input>.
|
|
14
|
+
//
|
|
15
|
+
// Syntax:
|
|
16
|
+
// <HongKongIdentityCardInput label="Hong Kong Identity Card Number" bind:value />
|
|
17
|
+
//
|
|
18
|
+
// Accessibility:
|
|
19
|
+
// - aria-label provides the accessible name for screen readers
|
|
20
|
+
// - autocomplete="off" protects sensitive identifiers
|
|
21
|
+
// - required and disabled states are conveyed to assistive technology
|
|
22
|
+
//
|
|
23
|
+
// Internationalization:
|
|
24
|
+
// - The label prop externalizes user-facing text for translation
|
|
25
|
+
//
|
|
26
|
+
// References:
|
|
27
|
+
// - https://en.wikipedia.org/wiki/Hong_Kong_identity_card
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
class: className = "",
|
|
31
|
+
label,
|
|
32
|
+
value = $bindable(""),
|
|
33
|
+
required = false,
|
|
34
|
+
disabled = false,
|
|
35
|
+
...restProps
|
|
36
|
+
}: {
|
|
37
|
+
label: string;
|
|
38
|
+
value?: string;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
} = $props();
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- HongKongIdentityCardInput.svelte -->
|
|
46
|
+
<input
|
|
47
|
+
class={`hong-kong-identity-card-input ${className}`}
|
|
48
|
+
type="text"
|
|
49
|
+
aria-label={label}
|
|
50
|
+
autocomplete="off"
|
|
51
|
+
bind:value
|
|
52
|
+
{required}
|
|
53
|
+
{disabled}
|
|
54
|
+
{...restProps}
|
|
55
|
+
/>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const HongKongIdentityCardInput: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
9
|
+
type HongKongIdentityCardInput = ReturnType<typeof HongKongIdentityCardInput>;
|
|
10
|
+
export default HongKongIdentityCardInput;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// HongKongIdentityCardView component
|
|
3
|
+
//
|
|
4
|
+
// A headless display component for showing Hong Kong's
|
|
5
|
+
// Hong Kong Identity Card Number in a read-only format.
|
|
6
|
+
// Format: One or two letters, six digits and a check digit in parentheses, such as A123456(3). The check digit is 0 to 9 or A. Each letter counts as A=10 to Z=35, and a single letter is preceded by a space counted as 36; the eight values are multiplied by 9,8,7,6,5,4,3,2 and summed, and the check digit is 11 minus the sum's Modulus-11 remainder (0 when the remainder is 0, and A when the result is 10).
|
|
7
|
+
//
|
|
8
|
+
// Props:
|
|
9
|
+
// className — string, optional. CSS class name.
|
|
10
|
+
// label — string, required. Accessible label for screen readers via aria-label.
|
|
11
|
+
// value — string, default "". The identifier string to display.
|
|
12
|
+
// ...restProps — additional HTML attributes spread onto the <span>.
|
|
13
|
+
//
|
|
14
|
+
// Syntax:
|
|
15
|
+
// <HongKongIdentityCardView label="Hong Kong Identity Card Number" value={value} />
|
|
16
|
+
//
|
|
17
|
+
// Accessibility:
|
|
18
|
+
// - aria-label provides the accessible name so screen readers announce the purpose
|
|
19
|
+
//
|
|
20
|
+
// References:
|
|
21
|
+
// - https://en.wikipedia.org/wiki/Hong_Kong_identity_card
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
class: className = "",
|
|
25
|
+
label,
|
|
26
|
+
value = "",
|
|
27
|
+
...restProps
|
|
28
|
+
}: {
|
|
29
|
+
label: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
} = $props();
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<!-- HongKongIdentityCardView.svelte -->
|
|
36
|
+
<span
|
|
37
|
+
class={`hong-kong-identity-card-view ${className}`}
|
|
38
|
+
aria-label={label}
|
|
39
|
+
{...restProps}>{value}</span
|
|
40
|
+
>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
declare const HongKongIdentityCardView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type HongKongIdentityCardView = ReturnType<typeof HongKongIdentityCardView>;
|
|
8
|
+
export default HongKongIdentityCardView;
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<!-- HorizontalScroller.svelte -->
|
|
44
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex (a scrollable region must be keyboard-focusable (axe scrollable-region-focusable)) -->
|
|
44
45
|
<div
|
|
45
46
|
bind:this={scrollerEl}
|
|
46
47
|
class={`horizontal-scroller ${className}`}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// HoverCard component
|
|
3
3
|
//
|
|
4
4
|
// A hover card that displays supplementary content when triggered, typically by a
|
|
5
|
-
// hover or focus interaction on a trigger element. It
|
|
5
|
+
// hover or focus interaction on a trigger element. It renders a popover="manual" container
|
|
6
6
|
// with role="tooltip" when the open prop is true. Useful for user profile previews,
|
|
7
7
|
// link previews, contextual help, or any popover-style content.
|
|
8
8
|
//
|
|
@@ -44,14 +44,15 @@
|
|
|
44
44
|
// - Headless: no CSS, no styles — consumer provides all styling and positioning
|
|
45
45
|
// - Uses $bindable(false) for two-way binding on the open prop
|
|
46
46
|
// - Consumer is responsible for managing hover/focus events on the trigger element
|
|
47
|
-
// -
|
|
48
|
-
//
|
|
47
|
+
// - Native first: popover="manual" (top layer) opened and closed by the `open` state through ./Popover/popover.ts; where the Popover API is missing (jsdom, older browsers) it falls back to the `hidden` attribute. Placement is the theme's CSS (anchor positioning); light dismiss and Escape stay the consumer's.
|
|
49
48
|
// References:
|
|
50
49
|
// - WAI-ARIA tooltip role: https://www.w3.org/TR/wai-aria-1.2/#tooltip
|
|
51
50
|
// - WAI-ARIA Tooltip Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
|
|
52
51
|
|
|
53
52
|
import type { Snippet } from "svelte";
|
|
54
53
|
|
|
54
|
+
import { popoverState } from "../Popover/popover.js";
|
|
55
|
+
|
|
55
56
|
let {
|
|
56
57
|
class: className = "",
|
|
57
58
|
label,
|
|
@@ -67,13 +68,13 @@
|
|
|
67
68
|
</script>
|
|
68
69
|
|
|
69
70
|
<!-- HoverCard.svelte -->
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
<div
|
|
72
|
+
class={`hover-card ${className}`}
|
|
73
|
+
role="tooltip"
|
|
74
|
+
popover="manual"
|
|
75
|
+
use:popoverState={open}
|
|
76
|
+
aria-label={label}
|
|
77
|
+
{...restProps}
|
|
78
|
+
>
|
|
79
|
+
{@render children?.()}
|
|
80
|
+
</div>
|
|
@@ -65,7 +65,10 @@
|
|
|
65
65
|
data-mask={mask}
|
|
66
66
|
{...restProps}
|
|
67
67
|
>
|
|
68
|
-
<span
|
|
68
|
+
<span
|
|
69
|
+
class="input-with-mask-display"
|
|
70
|
+
aria-hidden="true">{mask}</span
|
|
71
|
+
>
|
|
69
72
|
<input
|
|
70
73
|
class="input-with-mask-control"
|
|
71
74
|
type="text"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// IranKodEMelliInput component
|
|
3
|
+
//
|
|
4
|
+
// A headless input for entering Iran's National Code (Kod-e Melli).
|
|
5
|
+
// Format: Ten digits whose last digit is a check digit. The first nine digits are multiplied by 10,9,8,7,6,5,4,3,2 and summed; with r the sum's Modulus-11 remainder, the check digit is r when r is less than 2, otherwise 11 minus r. A number whose ten digits are all the same is never valid.
|
|
6
|
+
//
|
|
7
|
+
// Props:
|
|
8
|
+
// className — string, optional. CSS class name.
|
|
9
|
+
// label — string, required. Accessible label for screen readers via aria-label.
|
|
10
|
+
// value — string, default "". Bindable input value; supports bind:value.
|
|
11
|
+
// required — boolean, default false. Whether the input is required for form submission.
|
|
12
|
+
// disabled — boolean, default false. Whether the input is disabled.
|
|
13
|
+
// ...restProps — additional HTML attributes spread onto the <input>.
|
|
14
|
+
//
|
|
15
|
+
// Syntax:
|
|
16
|
+
// <IranKodEMelliInput label="National Code (Kod-e Melli)" bind:value />
|
|
17
|
+
//
|
|
18
|
+
// Accessibility:
|
|
19
|
+
// - aria-label provides the accessible name for screen readers
|
|
20
|
+
// - autocomplete="off" protects sensitive identifiers
|
|
21
|
+
// - required and disabled states are conveyed to assistive technology
|
|
22
|
+
//
|
|
23
|
+
// Internationalization:
|
|
24
|
+
// - The label prop externalizes user-facing text for translation
|
|
25
|
+
//
|
|
26
|
+
// References:
|
|
27
|
+
// - https://en.wikipedia.org/wiki/Iranian_identity_card
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
class: className = "",
|
|
31
|
+
label,
|
|
32
|
+
value = $bindable(""),
|
|
33
|
+
required = false,
|
|
34
|
+
disabled = false,
|
|
35
|
+
...restProps
|
|
36
|
+
}: {
|
|
37
|
+
label: string;
|
|
38
|
+
value?: string;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
} = $props();
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- IranKodEMelliInput.svelte -->
|
|
46
|
+
<input
|
|
47
|
+
class={`iran-kod-e-melli-input ${className}`}
|
|
48
|
+
type="text"
|
|
49
|
+
aria-label={label}
|
|
50
|
+
autocomplete="off"
|
|
51
|
+
bind:value
|
|
52
|
+
{required}
|
|
53
|
+
{disabled}
|
|
54
|
+
{...restProps}
|
|
55
|
+
/>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const IranKodEMelliInput: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
9
|
+
type IranKodEMelliInput = ReturnType<typeof IranKodEMelliInput>;
|
|
10
|
+
export default IranKodEMelliInput;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// IranKodEMelliView component
|
|
3
|
+
//
|
|
4
|
+
// A headless display component for showing Iran's
|
|
5
|
+
// National Code (Kod-e Melli) in a read-only format.
|
|
6
|
+
// Format: Ten digits whose last digit is a check digit. The first nine digits are multiplied by 10,9,8,7,6,5,4,3,2 and summed; with r the sum's Modulus-11 remainder, the check digit is r when r is less than 2, otherwise 11 minus r. A number whose ten digits are all the same is never valid.
|
|
7
|
+
//
|
|
8
|
+
// Props:
|
|
9
|
+
// className — string, optional. CSS class name.
|
|
10
|
+
// label — string, required. Accessible label for screen readers via aria-label.
|
|
11
|
+
// value — string, default "". The identifier string to display.
|
|
12
|
+
// ...restProps — additional HTML attributes spread onto the <span>.
|
|
13
|
+
//
|
|
14
|
+
// Syntax:
|
|
15
|
+
// <IranKodEMelliView label="National Code (Kod-e Melli)" value={value} />
|
|
16
|
+
//
|
|
17
|
+
// Accessibility:
|
|
18
|
+
// - aria-label provides the accessible name so screen readers announce the purpose
|
|
19
|
+
//
|
|
20
|
+
// References:
|
|
21
|
+
// - https://en.wikipedia.org/wiki/Iranian_identity_card
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
class: className = "",
|
|
25
|
+
label,
|
|
26
|
+
value = "",
|
|
27
|
+
...restProps
|
|
28
|
+
}: {
|
|
29
|
+
label: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
} = $props();
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<!-- IranKodEMelliView.svelte -->
|
|
36
|
+
<span
|
|
37
|
+
class={`iran-kod-e-melli-view ${className}`}
|
|
38
|
+
aria-label={label}
|
|
39
|
+
{...restProps}>{value}</span
|
|
40
|
+
>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
declare const IranKodEMelliView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type IranKodEMelliView = ReturnType<typeof IranKodEMelliView>;
|
|
8
|
+
export default IranKodEMelliView;
|
|
@@ -42,8 +42,15 @@
|
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<!-- KbdShortcut.svelte -->
|
|
45
|
-
<kbd
|
|
45
|
+
<kbd
|
|
46
|
+
class={`kbd-shortcut ${className}`}
|
|
47
|
+
aria-label={label}
|
|
48
|
+
{...restProps}
|
|
49
|
+
>
|
|
46
50
|
{#each keys as key, i (i)}
|
|
47
|
-
{#if i > 0}<span
|
|
51
|
+
{#if i > 0}<span
|
|
52
|
+
class="kbd-shortcut-separator"
|
|
53
|
+
aria-hidden="true">{separator}</span
|
|
54
|
+
>{/if}<kbd class="kbd-shortcut-key">{key}</kbd>
|
|
48
55
|
{/each}
|
|
49
56
|
</kbd>
|
|
@@ -52,7 +52,11 @@
|
|
|
52
52
|
class={`line-chart ${className}`}
|
|
53
53
|
{...restProps}
|
|
54
54
|
>
|
|
55
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
class="line-chart-graphic"
|
|
57
|
+
role="img"
|
|
58
|
+
aria-label={label}
|
|
59
|
+
>
|
|
56
60
|
{@render children?.()}
|
|
57
61
|
</div>
|
|
58
62
|
{#if dataTable}
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
// - WAI-ARIA Listbox Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
|
|
106
106
|
|
|
107
107
|
import type { Snippet } from "svelte";
|
|
108
|
+
import { initialListboxState, listboxKeydown } from "./listbox-machine";
|
|
108
109
|
|
|
109
110
|
let {
|
|
110
111
|
class: className = "",
|
|
@@ -153,129 +154,33 @@
|
|
|
153
154
|
[key: string]: unknown;
|
|
154
155
|
} = $props();
|
|
155
156
|
|
|
157
|
+
// Every keyboard decision lives in the framework-free machine (shared/listbox-machine.ts, copied here by
|
|
158
|
+
// bin/sync-shared-modules); this component only reads the DOM and applies the transition it returns.
|
|
156
159
|
function options(): HTMLElement[] {
|
|
157
160
|
return ref ? Array.from(ref.querySelectorAll<HTMLElement>("[role='option']")) : [];
|
|
158
161
|
}
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
// roving-focus (default, unchanged): real DOM focus per option, wraps.
|
|
162
|
-
// ---------------------------------------------------------------
|
|
163
|
-
|
|
164
|
-
function onRovingFocusKeydown(event: KeyboardEvent) {
|
|
165
|
-
const opts = options();
|
|
166
|
-
const current = document.activeElement as HTMLElement;
|
|
167
|
-
const index = opts.indexOf(current);
|
|
168
|
-
switch (event.key) {
|
|
169
|
-
case "ArrowDown": {
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
const next = index < opts.length - 1 ? index + 1 : 0;
|
|
172
|
-
opts[next]?.focus();
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
case "ArrowUp": {
|
|
176
|
-
event.preventDefault();
|
|
177
|
-
const prev = index > 0 ? index - 1 : opts.length - 1;
|
|
178
|
-
opts[prev]?.focus();
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
case "Home": {
|
|
182
|
-
event.preventDefault();
|
|
183
|
-
opts[0]?.focus();
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
case "End": {
|
|
187
|
-
event.preventDefault();
|
|
188
|
-
opts[opts.length - 1]?.focus();
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// ---------------------------------------------------------------
|
|
195
|
-
// active-descendant (opt-in): virtual cursor, clamp/wrap, typeahead, paging.
|
|
196
|
-
// ---------------------------------------------------------------
|
|
197
|
-
|
|
198
|
-
let typeaheadBuffer = "";
|
|
199
|
-
let typeaheadTimer: ReturnType<typeof setTimeout> | undefined;
|
|
200
|
-
|
|
201
|
-
function moveActive(delta: number) {
|
|
202
|
-
const count = options().length;
|
|
203
|
-
if (count === 0) return;
|
|
204
|
-
const next = activeIndex + delta;
|
|
205
|
-
activeIndex = clamp ? Math.min(Math.max(next, 0), count - 1) : ((next % count) + count) % count;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function runTypeahead(char: string) {
|
|
209
|
-
const opts = options();
|
|
210
|
-
if (opts.length === 0) return;
|
|
211
|
-
const lower = char.toLowerCase();
|
|
212
|
-
const sameCharRun = typeaheadBuffer === "" || [...typeaheadBuffer].every((c) => c === lower);
|
|
213
|
-
typeaheadBuffer += lower;
|
|
214
|
-
clearTimeout(typeaheadTimer);
|
|
215
|
-
typeaheadTimer = setTimeout(() => (typeaheadBuffer = ""), 500);
|
|
216
|
-
const query = sameCharRun ? lower : typeaheadBuffer;
|
|
217
|
-
const anchor = activeIndex < 0 ? 0 : activeIndex;
|
|
218
|
-
const start = sameCharRun ? anchor + 1 : anchor;
|
|
219
|
-
for (let n = 0; n < opts.length; n++) {
|
|
220
|
-
const i = (start + n) % opts.length;
|
|
221
|
-
if ((opts[i].textContent ?? "").trim().toLowerCase().startsWith(query)) {
|
|
222
|
-
activeIndex = i;
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function onActiveDescendantKeydown(event: KeyboardEvent) {
|
|
229
|
-
switch (event.key) {
|
|
230
|
-
case "ArrowDown":
|
|
231
|
-
event.preventDefault();
|
|
232
|
-
moveActive(1);
|
|
233
|
-
break;
|
|
234
|
-
case "ArrowUp":
|
|
235
|
-
event.preventDefault();
|
|
236
|
-
moveActive(-1);
|
|
237
|
-
break;
|
|
238
|
-
case "Home":
|
|
239
|
-
event.preventDefault();
|
|
240
|
-
activeIndex = options().length ? 0 : -1;
|
|
241
|
-
break;
|
|
242
|
-
case "End":
|
|
243
|
-
event.preventDefault();
|
|
244
|
-
activeIndex = options().length - 1;
|
|
245
|
-
break;
|
|
246
|
-
case "PageDown":
|
|
247
|
-
event.preventDefault();
|
|
248
|
-
moveActive(pageSize);
|
|
249
|
-
break;
|
|
250
|
-
case "PageUp":
|
|
251
|
-
event.preventDefault();
|
|
252
|
-
moveActive(-pageSize);
|
|
253
|
-
break;
|
|
254
|
-
case "Enter":
|
|
255
|
-
case " ":
|
|
256
|
-
event.preventDefault();
|
|
257
|
-
if (activeIndex >= 0) onActivate?.(activeIndex);
|
|
258
|
-
break;
|
|
259
|
-
case "Escape":
|
|
260
|
-
event.preventDefault();
|
|
261
|
-
onEscape?.();
|
|
262
|
-
break;
|
|
263
|
-
case "Tab":
|
|
264
|
-
// Not prevented: the consumer's onTabOut (e.g. moving focus to a
|
|
265
|
-
// trigger button) runs first, so the browser's default Tab
|
|
266
|
-
// proceeds from wherever focus ends up, not from this element.
|
|
267
|
-
onTabOut?.(event);
|
|
268
|
-
break;
|
|
269
|
-
default:
|
|
270
|
-
if (typeahead && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
271
|
-
runTypeahead(event.key);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
163
|
+
let typeaheadState = initialListboxState().typeahead;
|
|
275
164
|
|
|
276
165
|
function onkeydown(event: KeyboardEvent) {
|
|
277
|
-
|
|
278
|
-
|
|
166
|
+
const opts = options();
|
|
167
|
+
const t = listboxKeydown(
|
|
168
|
+
{ activeIndex, typeahead: typeaheadState },
|
|
169
|
+
event,
|
|
170
|
+
{
|
|
171
|
+
labels: opts.map((option) => (option.textContent ?? "").trim()),
|
|
172
|
+
focusedIndex: opts.indexOf(document.activeElement as HTMLElement),
|
|
173
|
+
now: Date.now(),
|
|
174
|
+
},
|
|
175
|
+
{ navigation, clamp, typeahead, pageSize },
|
|
176
|
+
);
|
|
177
|
+
typeaheadState = t.state.typeahead;
|
|
178
|
+
if (t.preventDefault) event.preventDefault();
|
|
179
|
+
if (t.focus !== undefined) opts[t.focus]?.focus();
|
|
180
|
+
if (t.setActiveIndex !== undefined) activeIndex = t.setActiveIndex;
|
|
181
|
+
if (t.activate !== undefined) onActivate?.(t.activate);
|
|
182
|
+
if (t.escape) onEscape?.();
|
|
183
|
+
if (t.tabOut) onTabOut?.(event); // never prevented: Tab proceeds from wherever onTabOut leaves focus
|
|
279
184
|
}
|
|
280
185
|
|
|
281
186
|
const activeId = $derived.by(() => {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The listbox behaviour core: one framework-free transition function that every library's Listbox binds with a thin
|
|
3
|
+
* adapter (spec/competitive-position item 3). Pure, so the whole WAI-ARIA APG listbox keyboard contract is unit-tested
|
|
4
|
+
* without a browser.
|
|
5
|
+
*
|
|
6
|
+
* The adapter owns the DOM: it reads the options' labels and which option has focus, calls `listboxKeydown`, then
|
|
7
|
+
* applies the returned transition (prevent the default, move focus, set the active index, call the consumer's
|
|
8
|
+
* callbacks). The machine owns every decision.
|
|
9
|
+
*
|
|
10
|
+
* Two navigation models, as the Listbox components document them:
|
|
11
|
+
*
|
|
12
|
+
* "roving-focus" (default): real focus moves between the options. ArrowDown/ArrowUp wrap; Home/End jump. No
|
|
13
|
+
* typeahead, paging or activation.
|
|
14
|
+
*
|
|
15
|
+
* "active-descendant": the root keeps focus and a virtual cursor (`activeIndex`) moves. ArrowDown/ArrowUp wrap, or
|
|
16
|
+
* clamp when `clamp` is set; Home/End jump; PageUp/PageDown move by `pageSize`, wrapping or clamping like the
|
|
17
|
+
* arrows; printable characters run typeahead when `typeahead` is set; Enter/Space activate the active option;
|
|
18
|
+
* Escape and Tab are reported so the consumer decides what they do (Tab is never prevented).
|
|
19
|
+
*
|
|
20
|
+
* Selection is the consumer's: the machine reports activation and the consumer sets `aria-selected`. Disabled options
|
|
21
|
+
* are not skipped, matching the components this machine was extracted from.
|
|
22
|
+
*/
|
|
23
|
+
import { type TypeaheadState } from "./typeahead";
|
|
24
|
+
export type ListboxNavigation = "roving-focus" | "active-descendant";
|
|
25
|
+
/** Typeahead prefix lifetime: a pause this long starts a new prefix. The Listbox components have always used 500 ms. */
|
|
26
|
+
export declare const LISTBOX_TYPEAHEAD_RESET_MS = 500;
|
|
27
|
+
/** The component props the machine reads. Every field is optional and defaults as the components do. */
|
|
28
|
+
export interface ListboxConfig {
|
|
29
|
+
navigation?: ListboxNavigation;
|
|
30
|
+
/** Arrows and paging clamp at the ends instead of wrapping (active-descendant only). */
|
|
31
|
+
clamp?: boolean;
|
|
32
|
+
/** Printable characters move the cursor (active-descendant only). */
|
|
33
|
+
typeahead?: boolean;
|
|
34
|
+
/** PageUp/PageDown step (active-descendant only). Default 10. */
|
|
35
|
+
pageSize?: number;
|
|
36
|
+
/** Typeahead reset pause in milliseconds. Default `LISTBOX_TYPEAHEAD_RESET_MS`. */
|
|
37
|
+
typeaheadResetMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/** The machine's state: the virtual cursor (-1 = none) and the typeahead prefix. */
|
|
40
|
+
export interface ListboxState {
|
|
41
|
+
activeIndex: number;
|
|
42
|
+
typeahead: TypeaheadState;
|
|
43
|
+
}
|
|
44
|
+
/** The parts of a keyboard event the machine reads. A DOM, React or Svelte KeyboardEvent fits. */
|
|
45
|
+
export interface ListboxKey {
|
|
46
|
+
key: string;
|
|
47
|
+
ctrlKey?: boolean;
|
|
48
|
+
altKey?: boolean;
|
|
49
|
+
metaKey?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** What the adapter reads from the DOM at the moment of the key press. */
|
|
52
|
+
export interface ListboxContext {
|
|
53
|
+
/** Each option's text, trimmed, in document order. Its length is the option count. */
|
|
54
|
+
labels: readonly string[];
|
|
55
|
+
/** The option that has real focus, or -1 (roving-focus only). */
|
|
56
|
+
focusedIndex?: number;
|
|
57
|
+
/** The time of the key press in milliseconds (for typeahead). */
|
|
58
|
+
now?: number;
|
|
59
|
+
}
|
|
60
|
+
/** What the adapter must do. Absent fields mean "nothing". */
|
|
61
|
+
export interface ListboxTransition {
|
|
62
|
+
state: ListboxState;
|
|
63
|
+
/** Call `event.preventDefault()`. */
|
|
64
|
+
preventDefault: boolean;
|
|
65
|
+
/** Set the active index to this value (and notify the consumer), even when it is unchanged. */
|
|
66
|
+
setActiveIndex?: number;
|
|
67
|
+
/** Move real focus to the option at this index (roving-focus). */
|
|
68
|
+
focus?: number;
|
|
69
|
+
/** Call the consumer's onActivate with this index. */
|
|
70
|
+
activate?: number;
|
|
71
|
+
/** Call the consumer's onEscape. */
|
|
72
|
+
escape?: boolean;
|
|
73
|
+
/** Call the consumer's onTabOut, before the browser handles Tab. */
|
|
74
|
+
tabOut?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** A fresh state with the cursor at `activeIndex`. */
|
|
77
|
+
export declare function initialListboxState(activeIndex?: number): ListboxState;
|
|
78
|
+
/** `index` moved by `delta` among `count` options, clamped to the ends or wrapped. `count` must be positive. */
|
|
79
|
+
export declare function stepListboxIndex(index: number, delta: number, count: number, clamp: boolean): number;
|
|
80
|
+
/** The transition for one key press. Never mutates `state`. */
|
|
81
|
+
export declare function listboxKeydown(state: ListboxState, event: ListboxKey, context: ListboxContext, config?: ListboxConfig): ListboxTransition;
|