@lilydesignsystem/svelte-headless 0.6.1 → 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 +453 -0
- 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 +2 -3
- 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/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 +3 -1
- package/dist/components/ConvertFromDiv/ConvertFromDiv.svelte +0 -1
- package/dist/components/ConvertFromUnitDiv/ConvertFromUnitDiv.svelte +0 -1
- package/dist/components/ConvertFromValueDiv/ConvertFromValueDiv.svelte +0 -1
- package/dist/components/ConvertIntoDiv/ConvertIntoDiv.svelte +0 -1
- package/dist/components/ConvertIntoUnitDiv/ConvertIntoUnitDiv.svelte +0 -1
- package/dist/components/ConvertIntoValueDiv/ConvertIntoValueDiv.svelte +0 -1
- 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 +2 -2
- 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/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 +0 -2
- 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/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/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/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 +26 -0
- package/dist/index.js +26 -0
- package/index.md +4 -4
- package/package.json +5 -5
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
// - WAI-ARIA Menu Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/menu/
|
|
53
53
|
|
|
54
54
|
import type { Snippet } from "svelte";
|
|
55
|
+
import { popoverState, toggleOpened } from "../Popover/popover.js";
|
|
55
56
|
|
|
56
57
|
let {
|
|
57
58
|
class: className = "",
|
|
@@ -75,8 +76,7 @@
|
|
|
75
76
|
// When the menu opens, focus the first menuitem.
|
|
76
77
|
$effect(() => {
|
|
77
78
|
if (open && menuRef) {
|
|
78
|
-
const firstItem =
|
|
79
|
-
menuRef.querySelector<HTMLElement>("[role='menuitem']");
|
|
79
|
+
const firstItem = menuRef.querySelector<HTMLElement>("[role='menuitem']");
|
|
80
80
|
firstItem?.focus();
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -84,9 +84,7 @@
|
|
|
84
84
|
// Keyboard navigation within the menu.
|
|
85
85
|
function onkeydown(event: KeyboardEvent) {
|
|
86
86
|
if (!menuRef) return;
|
|
87
|
-
const items = Array.from(
|
|
88
|
-
menuRef.querySelectorAll<HTMLElement>("[role='menuitem']"),
|
|
89
|
-
);
|
|
87
|
+
const items = Array.from(menuRef.querySelectorAll<HTMLElement>("[role='menuitem']"));
|
|
90
88
|
const current = document.activeElement as HTMLElement;
|
|
91
89
|
const index = items.indexOf(current);
|
|
92
90
|
|
|
@@ -122,15 +120,19 @@
|
|
|
122
120
|
}
|
|
123
121
|
</script>
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{
|
|
123
|
+
<!-- popover="auto": there is no declarative trigger (a right-click or long-press opens it), so popoverState shows it
|
|
124
|
+
with showPopover() when `open` turns true, in the top layer; light dismiss and Escape come from the browser and the
|
|
125
|
+
toggle event writes `open` back. Positioning at the pointer stays the consumer's CSS. -->
|
|
126
|
+
<div
|
|
127
|
+
class={`context-menu ${className}`}
|
|
128
|
+
role="menu"
|
|
129
|
+
aria-label={label}
|
|
130
|
+
popover="auto"
|
|
131
|
+
bind:this={menuRef}
|
|
132
|
+
use:popoverState={open}
|
|
133
|
+
ontoggle={(event) => (open = toggleOpened(event))}
|
|
134
|
+
{onkeydown}
|
|
135
|
+
{...restProps}
|
|
136
|
+
>
|
|
137
|
+
{@render children?.()}
|
|
138
|
+
</div>
|
|
@@ -3,49 +3,56 @@
|
|
|
3
3
|
//
|
|
4
4
|
// A help button that opens a popover with explanatory content. Renders a
|
|
5
5
|
// wrapper `<div>` containing a `<button>` trigger (aria-haspopup="dialog",
|
|
6
|
-
// aria-expanded, aria-controls) and a `<div role="dialog">`
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// aria-expanded, aria-controls) and a `<div role="dialog" popover="auto">`
|
|
7
|
+
// panel. The trigger opens and closes the panel through the native Popover
|
|
8
|
+
// API with command="toggle-popover" commandfor={panelId} (and popovertarget
|
|
9
|
+
// for engines before command/commandfor), so open, Escape and light dismiss
|
|
10
|
+
// need no script; the panel's `toggle` event keeps `expanded` in step. Where
|
|
11
|
+
// the Popover API is missing (jsdom, old engines) the trigger's click toggles
|
|
12
|
+
// `expanded` and the panel's `hidden` attribute instead.
|
|
9
13
|
//
|
|
10
14
|
// Props:
|
|
11
15
|
// class — string, optional. CSS class appended to the base class.
|
|
12
|
-
// label — string, REQUIRED. aria-label for the trigger button.
|
|
13
|
-
//
|
|
14
|
-
//
|
|
16
|
+
// label — string, REQUIRED. aria-label for the trigger button (its accessible name).
|
|
17
|
+
// triggerLabel — string, REQUIRED. Visible text of the trigger, such as "?" or "؟".
|
|
18
|
+
// No default: the glyph is the consumer's, per script and locale. Pass "" when
|
|
19
|
+
// the consumer's CSS draws an icon instead.
|
|
20
|
+
// expanded — boolean, default false, bindable. Whether the popover is open;
|
|
21
|
+
// set by the browser's toggle (trigger, Escape, light dismiss).
|
|
22
|
+
// onclick — (event: MouseEvent) => void, optional. Trigger click handler;
|
|
23
|
+
// call event.preventDefault() to stop the trigger toggling the panel.
|
|
15
24
|
// children — Snippet, optional. Popover content.
|
|
16
25
|
//
|
|
17
26
|
// Syntax:
|
|
18
|
-
// <ContextualHelp label="Help"
|
|
27
|
+
// <ContextualHelp label="Help" triggerLabel="?" bind:expanded>
|
|
19
28
|
// <p>Help content</p>
|
|
20
29
|
// </ContextualHelp>
|
|
21
30
|
//
|
|
31
|
+
// Keyboard:
|
|
32
|
+
// - Enter / Space on the trigger toggles the panel
|
|
33
|
+
// - Escape closes the panel (browser, Popover API)
|
|
34
|
+
//
|
|
22
35
|
// Accessibility:
|
|
23
36
|
// - Trigger: aria-haspopup="dialog", aria-expanded, aria-controls
|
|
24
|
-
// - Panel: role="dialog", id matched by aria-controls
|
|
37
|
+
// - Panel: role="dialog", id matched by aria-controls and commandfor
|
|
25
38
|
//
|
|
26
39
|
// Internationalization:
|
|
27
|
-
// - All user-facing strings via props
|
|
40
|
+
// - All user-facing strings via props: label (accessible name) and
|
|
41
|
+
// triggerLabel (visible glyph or text)
|
|
28
42
|
//
|
|
29
43
|
// References:
|
|
30
44
|
// - Adobe Spectrum ContextualHelp: https://spectrum.adobe.com/page/contextual-help/
|
|
31
45
|
// - WAI-ARIA Dialog Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
46
|
+
// - HTML command and commandfor: https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-command
|
|
32
47
|
|
|
33
48
|
import type { Snippet } from "svelte";
|
|
34
|
-
|
|
35
|
-
function makeId(prefix: string): string {
|
|
36
|
-
if (
|
|
37
|
-
typeof crypto !== "undefined" &&
|
|
38
|
-
typeof crypto.randomUUID === "function"
|
|
39
|
-
) {
|
|
40
|
-
return `${prefix}-${crypto.randomUUID()}`;
|
|
41
|
-
}
|
|
42
|
-
return `${prefix}-${Math.random().toString(36).slice(2, 11)}`;
|
|
43
|
-
}
|
|
49
|
+
import { popoverState, popoverSupported, toggleOpened } from "../Popover/popover.js";
|
|
44
50
|
|
|
45
51
|
let {
|
|
46
52
|
class: className = "",
|
|
47
53
|
label,
|
|
48
|
-
|
|
54
|
+
triggerLabel,
|
|
55
|
+
expanded = $bindable(false),
|
|
49
56
|
onclick = undefined,
|
|
50
57
|
children = undefined,
|
|
51
58
|
...restProps
|
|
@@ -53,7 +60,9 @@
|
|
|
53
60
|
class?: string;
|
|
54
61
|
/** Accessible label for the trigger (REQUIRED) */
|
|
55
62
|
label: string;
|
|
56
|
-
/**
|
|
63
|
+
/** Visible text of the trigger, such as "?" (REQUIRED; no default) */
|
|
64
|
+
triggerLabel: string;
|
|
65
|
+
/** Whether the popover is open. Bindable. */
|
|
57
66
|
expanded?: boolean;
|
|
58
67
|
/** Trigger click handler */
|
|
59
68
|
onclick?: (event: MouseEvent) => void;
|
|
@@ -62,11 +71,25 @@
|
|
|
62
71
|
[key: string]: unknown;
|
|
63
72
|
} = $props();
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
// Hydration-stable: the server and the client agree on it, so commandfor still names the panel.
|
|
75
|
+
const uid = $props.id();
|
|
76
|
+
const panelId = `contextual-help-panel-${uid}`;
|
|
77
|
+
let panel: HTMLDivElement | undefined = $state();
|
|
78
|
+
|
|
79
|
+
function toggle(event: MouseEvent) {
|
|
80
|
+
onclick?.(event);
|
|
81
|
+
if (event.defaultPrevented) return;
|
|
82
|
+
// With the Popover API the browser toggles the panel (command / popovertarget) and the toggle event
|
|
83
|
+
// updates `expanded`; without it, toggle here.
|
|
84
|
+
if (panel && !popoverSupported(panel)) expanded = !expanded;
|
|
85
|
+
}
|
|
66
86
|
</script>
|
|
67
87
|
|
|
68
88
|
<!-- ContextualHelp.svelte -->
|
|
69
|
-
<div
|
|
89
|
+
<div
|
|
90
|
+
class={`contextual-help ${className}`}
|
|
91
|
+
{...restProps}
|
|
92
|
+
>
|
|
70
93
|
<button
|
|
71
94
|
class="contextual-help-trigger"
|
|
72
95
|
type="button"
|
|
@@ -74,13 +97,19 @@
|
|
|
74
97
|
aria-haspopup="dialog"
|
|
75
98
|
aria-expanded={expanded}
|
|
76
99
|
aria-controls={panelId}
|
|
77
|
-
|
|
78
|
-
|
|
100
|
+
command="toggle-popover"
|
|
101
|
+
commandfor={panelId}
|
|
102
|
+
popovertarget={panelId}
|
|
103
|
+
onclick={toggle}>{triggerLabel}</button
|
|
104
|
+
>
|
|
79
105
|
<div
|
|
106
|
+
bind:this={panel}
|
|
80
107
|
class="contextual-help-panel"
|
|
81
108
|
id={panelId}
|
|
82
109
|
role="dialog"
|
|
83
|
-
|
|
110
|
+
popover="auto"
|
|
111
|
+
use:popoverState={expanded}
|
|
112
|
+
ontoggle={(event) => (expanded = toggleOpened(event))}
|
|
84
113
|
>
|
|
85
114
|
{#if children}
|
|
86
115
|
{@render children?.()}
|
|
@@ -3,7 +3,9 @@ type $$ComponentProps = {
|
|
|
3
3
|
class?: string;
|
|
4
4
|
/** Accessible label for the trigger (REQUIRED) */
|
|
5
5
|
label: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Visible text of the trigger, such as "?" (REQUIRED; no default) */
|
|
7
|
+
triggerLabel: string;
|
|
8
|
+
/** Whether the popover is open. Bindable. */
|
|
7
9
|
expanded?: boolean;
|
|
8
10
|
/** Trigger click handler */
|
|
9
11
|
onclick?: (event: MouseEvent) => void;
|
|
@@ -11,6 +13,6 @@ type $$ComponentProps = {
|
|
|
11
13
|
children?: Snippet;
|
|
12
14
|
[key: string]: unknown;
|
|
13
15
|
};
|
|
14
|
-
declare const ContextualHelp: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
declare const ContextualHelp: import("svelte").Component<$$ComponentProps, {}, "expanded">;
|
|
15
17
|
type ContextualHelp = ReturnType<typeof ContextualHelp>;
|
|
16
18
|
export default ContextualHelp;
|
|
@@ -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;
|
|
@@ -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, {}, "">;
|