@nqmcreative/ui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -34
- package/cli/index.mjs +67 -30
- package/dist/core/calendar.d.ts +3 -0
- package/dist/core/calendar.js +36 -0
- package/dist/core/dialog.svelte.d.ts +14 -0
- package/dist/core/dialog.svelte.js +23 -0
- package/dist/core/files.d.ts +35 -0
- package/dist/core/files.js +62 -0
- package/dist/core/index.d.ts +37 -0
- package/dist/core/index.js +35 -0
- package/dist/core/list.svelte.d.ts +41 -0
- package/dist/core/list.svelte.js +77 -0
- package/dist/core/number.d.ts +7 -0
- package/dist/core/number.js +17 -0
- package/dist/core/pagination.d.ts +6 -0
- package/dist/core/pagination.js +21 -0
- package/dist/core/password.d.ts +8 -0
- package/dist/core/password.js +23 -0
- package/dist/core/table.d.ts +22 -0
- package/dist/core/table.js +41 -0
- package/dist/core/theme.svelte.d.ts +16 -0
- package/dist/core/theme.svelte.js +34 -0
- package/dist/core/trigger.d.ts +35 -0
- package/dist/core/trigger.js +77 -0
- package/dist/index.d.ts +11 -103
- package/dist/index.js +11 -75
- package/dist/{components → styles/matte}/AccordionItem.svelte +1 -1
- package/dist/{components → styles/matte}/AccordionItem.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Alert.svelte +8 -2
- package/dist/{components → styles/matte}/Alert.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Avatar.svelte +1 -1
- package/dist/{components → styles/matte}/Avatar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Badge.svelte +8 -3
- package/dist/{components → styles/matte}/Badge.svelte.d.ts +1 -3
- package/dist/{components → styles/matte}/Breadcrumb.svelte +2 -2
- package/dist/{components → styles/matte}/Breadcrumb.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Button.svelte +1 -1
- package/dist/{components → styles/matte}/Button.svelte.d.ts +1 -1
- package/dist/styles/matte/CTASection.svelte +76 -0
- package/dist/styles/matte/CTASection.svelte.d.ts +18 -0
- package/dist/{components → styles/matte}/Calendar.svelte +7 -17
- package/dist/{components → styles/matte}/Calendar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Card.svelte +1 -1
- package/dist/{components → styles/matte}/Card.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Checkbox.svelte +1 -1
- package/dist/{components → styles/matte}/Checkbox.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/CheckboxGroup.svelte +1 -1
- package/dist/{components → styles/matte}/CheckboxGroup.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Combobox.svelte +31 -42
- package/dist/{components → styles/matte}/Combobox.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/CommandPalette.svelte +26 -41
- package/dist/{components → styles/matte}/CommandPalette.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/ConfirmDialog.svelte +2 -2
- package/dist/{components → styles/matte}/ConfirmDialog.svelte.d.ts +2 -2
- package/dist/{components → styles/matte}/ContextMenu.svelte +5 -7
- package/dist/{components → styles/matte}/DatePicker.svelte +7 -11
- package/dist/{components → styles/matte}/DatePicker.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Drawer.svelte +4 -7
- package/dist/{components → styles/matte}/Dropdown.svelte +18 -36
- package/dist/{components → styles/matte}/Dropdown.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Dropzone.svelte +11 -43
- package/dist/{components → styles/matte}/Dropzone.svelte.d.ts +2 -5
- package/dist/{components → styles/matte}/EmptyState.svelte +1 -1
- package/dist/{components → styles/matte}/EmptyState.svelte.d.ts +1 -1
- package/dist/styles/matte/FeatureCard.svelte +58 -0
- package/dist/styles/matte/FeatureCard.svelte.d.ts +16 -0
- package/dist/styles/matte/FeatureGrid.svelte +62 -0
- package/dist/styles/matte/FeatureGrid.svelte.d.ts +16 -0
- package/dist/{components → styles/matte}/Footer.svelte +1 -1
- package/dist/{components → styles/matte}/Footer.svelte.d.ts +1 -1
- package/dist/styles/matte/HeroSection.svelte +80 -0
- package/dist/styles/matte/HeroSection.svelte.d.ts +21 -0
- package/dist/{components → styles/matte}/Input.svelte +1 -1
- package/dist/{components → styles/matte}/Input.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Link.svelte +1 -1
- package/dist/{components → styles/matte}/Link.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/LocaleProvider.svelte +1 -1
- package/dist/{components → styles/matte}/LocaleProvider.svelte.d.ts +1 -1
- package/dist/styles/matte/LogoCloud.svelte +61 -0
- package/dist/styles/matte/LogoCloud.svelte.d.ts +19 -0
- package/dist/{components → styles/matte}/MenuItem.svelte +1 -1
- package/dist/{components → styles/matte}/MenuItem.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Modal.svelte +4 -7
- package/dist/{components → styles/matte}/MultiSelect.svelte +18 -37
- package/dist/{components → styles/matte}/MultiSelect.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Navbar.svelte +2 -2
- package/dist/{components → styles/matte}/Navbar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/NumberInput.svelte +4 -8
- package/dist/{components → styles/matte}/NumberInput.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Pagination.svelte +4 -15
- package/dist/{components → styles/matte}/Pagination.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/PasswordInput.svelte +4 -13
- package/dist/{components → styles/matte}/PasswordInput.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Popover.svelte +16 -41
- package/dist/{components → styles/matte}/Popover.svelte.d.ts +1 -1
- package/dist/styles/matte/PricingCard.svelte +107 -0
- package/dist/styles/matte/PricingCard.svelte.d.ts +25 -0
- package/dist/{components → styles/matte}/Progress.svelte +3 -2
- package/dist/{components → styles/matte}/Progress.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Radio.svelte +1 -1
- package/dist/{components → styles/matte}/Radio.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/RadioGroup.svelte +1 -1
- package/dist/{components → styles/matte}/RadioGroup.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/SegmentedControl.svelte +1 -1
- package/dist/{components → styles/matte}/SegmentedControl.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Select.svelte +1 -1
- package/dist/{components → styles/matte}/Select.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Sidebar.svelte +2 -2
- package/dist/{components → styles/matte}/Sidebar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Slider.svelte +3 -2
- package/dist/{components → styles/matte}/Slider.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Spinner.svelte +2 -2
- package/dist/{components → styles/matte}/Spinner.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Stat.svelte +1 -1
- package/dist/{components → styles/matte}/Stat.svelte.d.ts +1 -1
- package/dist/styles/matte/StatsBand.svelte +57 -0
- package/dist/styles/matte/StatsBand.svelte.d.ts +20 -0
- package/dist/{components → styles/matte}/Steps.svelte +1 -1
- package/dist/{components → styles/matte}/Steps.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Switch.svelte +1 -1
- package/dist/{components → styles/matte}/Switch.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Table.svelte +6 -28
- package/dist/{components → styles/matte}/Table.svelte.d.ts +2 -6
- package/dist/{components → styles/matte}/Tabs.svelte +8 -1
- package/dist/{components → styles/matte}/Tabs.svelte.d.ts +1 -1
- package/dist/styles/matte/Testimonial.svelte +67 -0
- package/dist/styles/matte/Testimonial.svelte.d.ts +19 -0
- package/dist/{components → styles/matte}/Textarea.svelte +1 -1
- package/dist/{components → styles/matte}/Textarea.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/ThemeToggle.svelte +14 -27
- package/dist/{components → styles/matte}/ThemeToggle.svelte.d.ts +2 -6
- package/dist/{components → styles/matte}/Toaster.svelte +4 -4
- package/dist/styles/matte/index.d.ts +109 -0
- package/dist/styles/matte/index.js +83 -0
- package/dist/styles/paper/Accordion.svelte +17 -0
- package/dist/styles/paper/Accordion.svelte.d.ts +8 -0
- package/dist/styles/paper/AccordionItem.svelte +46 -0
- package/dist/styles/paper/AccordionItem.svelte.d.ts +14 -0
- package/dist/styles/paper/Alert.svelte +99 -0
- package/dist/styles/paper/Alert.svelte.d.ts +18 -0
- package/dist/styles/paper/Avatar.svelte +60 -0
- package/dist/styles/paper/Avatar.svelte.d.ts +16 -0
- package/dist/styles/paper/AvatarGroup.svelte +17 -0
- package/dist/styles/paper/AvatarGroup.svelte.d.ts +8 -0
- package/dist/styles/paper/Badge.svelte +58 -0
- package/dist/styles/paper/Badge.svelte.d.ts +16 -0
- package/dist/styles/paper/Breadcrumb.svelte +49 -0
- package/dist/styles/paper/Breadcrumb.svelte.d.ts +14 -0
- package/dist/styles/paper/Button.svelte +96 -0
- package/dist/styles/paper/Button.svelte.d.ts +21 -0
- package/dist/styles/paper/CTASection.svelte +76 -0
- package/dist/styles/paper/CTASection.svelte.d.ts +18 -0
- package/dist/styles/paper/Calendar.svelte +202 -0
- package/dist/styles/paper/Calendar.svelte.d.ts +22 -0
- package/dist/styles/paper/Card.svelte +78 -0
- package/dist/styles/paper/Card.svelte.d.ts +21 -0
- package/dist/styles/paper/Checkbox.svelte +75 -0
- package/dist/styles/paper/Checkbox.svelte.d.ts +15 -0
- package/dist/styles/paper/CheckboxGroup.svelte +111 -0
- package/dist/styles/paper/CheckboxGroup.svelte.d.ts +30 -0
- package/dist/styles/paper/Combobox.svelte +266 -0
- package/dist/styles/paper/Combobox.svelte.d.ts +29 -0
- package/dist/styles/paper/CommandPalette.svelte +209 -0
- package/dist/styles/paper/CommandPalette.svelte.d.ts +32 -0
- package/dist/styles/paper/ConfirmDialog.svelte +97 -0
- package/dist/styles/paper/ConfirmDialog.svelte.d.ts +22 -0
- package/dist/styles/paper/ContextMenu.svelte +88 -0
- package/dist/styles/paper/ContextMenu.svelte.d.ts +15 -0
- package/dist/styles/paper/DatePicker.svelte +192 -0
- package/dist/styles/paper/DatePicker.svelte.d.ts +23 -0
- package/dist/styles/paper/Divider.svelte +30 -0
- package/dist/styles/paper/Divider.svelte.d.ts +10 -0
- package/dist/styles/paper/Drawer.svelte +165 -0
- package/dist/styles/paper/Drawer.svelte.d.ts +20 -0
- package/dist/styles/paper/Dropdown.svelte +94 -0
- package/dist/styles/paper/Dropdown.svelte.d.ts +23 -0
- package/dist/styles/paper/Dropzone.svelte +210 -0
- package/dist/styles/paper/Dropzone.svelte.d.ts +29 -0
- package/dist/styles/paper/EmptyState.svelte +71 -0
- package/dist/styles/paper/EmptyState.svelte.d.ts +18 -0
- package/dist/styles/paper/FeatureCard.svelte +58 -0
- package/dist/styles/paper/FeatureCard.svelte.d.ts +16 -0
- package/dist/styles/paper/FeatureGrid.svelte +62 -0
- package/dist/styles/paper/FeatureGrid.svelte.d.ts +16 -0
- package/dist/styles/paper/Field.svelte +42 -0
- package/dist/styles/paper/Field.svelte.d.ts +16 -0
- package/dist/styles/paper/Footer.svelte +91 -0
- package/dist/styles/paper/Footer.svelte.d.ts +25 -0
- package/dist/styles/paper/HeroSection.svelte +86 -0
- package/dist/styles/paper/HeroSection.svelte.d.ts +21 -0
- package/dist/styles/paper/Input.svelte +60 -0
- package/dist/styles/paper/Input.svelte.d.ts +18 -0
- package/dist/styles/paper/InputGroup.svelte +20 -0
- package/dist/styles/paper/InputGroup.svelte.d.ts +11 -0
- package/dist/styles/paper/Kbd.svelte +17 -0
- package/dist/styles/paper/Kbd.svelte.d.ts +8 -0
- package/dist/styles/paper/Label.svelte +16 -0
- package/dist/styles/paper/Label.svelte.d.ts +9 -0
- package/dist/styles/paper/Link.svelte +44 -0
- package/dist/styles/paper/Link.svelte.d.ts +16 -0
- package/dist/styles/paper/LocaleProvider.svelte +24 -0
- package/dist/styles/paper/LocaleProvider.svelte.d.ts +10 -0
- package/dist/styles/paper/LogoCloud.svelte +61 -0
- package/dist/styles/paper/LogoCloud.svelte.d.ts +19 -0
- package/dist/styles/paper/MenuItem.svelte +64 -0
- package/dist/styles/paper/MenuItem.svelte.d.ts +18 -0
- package/dist/styles/paper/MenuSeparator.svelte +22 -0
- package/dist/styles/paper/MenuSeparator.svelte.d.ts +8 -0
- package/dist/styles/paper/Modal.svelte +118 -0
- package/dist/styles/paper/Modal.svelte.d.ts +21 -0
- package/dist/styles/paper/MultiSelect.svelte +287 -0
- package/dist/styles/paper/MultiSelect.svelte.d.ts +31 -0
- package/dist/styles/paper/Navbar.svelte +201 -0
- package/dist/styles/paper/Navbar.svelte.d.ts +33 -0
- package/dist/styles/paper/NumberInput.svelte +96 -0
- package/dist/styles/paper/NumberInput.svelte.d.ts +15 -0
- package/dist/styles/paper/Pagination.svelte +83 -0
- package/dist/styles/paper/Pagination.svelte.d.ts +15 -0
- package/dist/styles/paper/PasswordInput.svelte +100 -0
- package/dist/styles/paper/PasswordInput.svelte.d.ts +12 -0
- package/dist/styles/paper/Popover.svelte +89 -0
- package/dist/styles/paper/Popover.svelte.d.ts +19 -0
- package/dist/styles/paper/PricingCard.svelte +108 -0
- package/dist/styles/paper/PricingCard.svelte.d.ts +25 -0
- package/dist/styles/paper/Progress.svelte +59 -0
- package/dist/styles/paper/Progress.svelte.d.ts +17 -0
- package/dist/styles/paper/Radio.svelte +55 -0
- package/dist/styles/paper/Radio.svelte.d.ts +15 -0
- package/dist/styles/paper/RadioGroup.svelte +95 -0
- package/dist/styles/paper/RadioGroup.svelte.d.ts +27 -0
- package/dist/styles/paper/SegmentedControl.svelte +88 -0
- package/dist/styles/paper/SegmentedControl.svelte.d.ts +25 -0
- package/dist/styles/paper/Select.svelte +61 -0
- package/dist/styles/paper/Select.svelte.d.ts +20 -0
- package/dist/styles/paper/Sidebar.svelte +206 -0
- package/dist/styles/paper/Sidebar.svelte.d.ts +36 -0
- package/dist/styles/paper/Skeleton.svelte +46 -0
- package/dist/styles/paper/Skeleton.svelte.d.ts +13 -0
- package/dist/styles/paper/Slider.svelte +80 -0
- package/dist/styles/paper/Slider.svelte.d.ts +19 -0
- package/dist/styles/paper/Spinner.svelte +34 -0
- package/dist/styles/paper/Spinner.svelte.d.ts +13 -0
- package/dist/styles/paper/Stat.svelte +51 -0
- package/dist/styles/paper/Stat.svelte.d.ts +16 -0
- package/dist/styles/paper/StatsBand.svelte +63 -0
- package/dist/styles/paper/StatsBand.svelte.d.ts +20 -0
- package/dist/styles/paper/Steps.svelte +141 -0
- package/dist/styles/paper/Steps.svelte.d.ts +24 -0
- package/dist/styles/paper/Switch.svelte +64 -0
- package/dist/styles/paper/Switch.svelte.d.ts +14 -0
- package/dist/styles/paper/Table.svelte +217 -0
- package/dist/styles/paper/Table.svelte.d.ts +66 -0
- package/dist/styles/paper/Tabs.svelte +102 -0
- package/dist/styles/paper/Tabs.svelte.d.ts +23 -0
- package/dist/styles/paper/Testimonial.svelte +64 -0
- package/dist/styles/paper/Testimonial.svelte.d.ts +19 -0
- package/dist/styles/paper/Textarea.svelte +54 -0
- package/dist/styles/paper/Textarea.svelte.d.ts +12 -0
- package/dist/styles/paper/ThemeToggle.svelte +130 -0
- package/dist/styles/paper/ThemeToggle.svelte.d.ts +16 -0
- package/dist/styles/paper/Toaster.svelte +132 -0
- package/dist/styles/paper/Toaster.svelte.d.ts +8 -0
- package/dist/styles/paper/Tooltip.svelte +33 -0
- package/dist/styles/paper/Tooltip.svelte.d.ts +12 -0
- package/dist/styles/paper/fonts.css +46 -0
- package/dist/styles/paper/index.d.ts +109 -0
- package/dist/styles/paper/index.js +83 -0
- package/dist/styles/paper/theme.css +222 -0
- package/package.json +531 -201
- package/registry.json +658 -339
- /package/dist/{actions → core/actions}/anchor.d.ts +0 -0
- /package/dist/{actions → core/actions}/anchor.js +0 -0
- /package/dist/{actions → core/actions}/dismissable.d.ts +0 -0
- /package/dist/{actions → core/actions}/dismissable.js +0 -0
- /package/dist/{date.d.ts → core/date.d.ts} +0 -0
- /package/dist/{date.js → core/date.js} +0 -0
- /package/dist/{locale.svelte.d.ts → core/locale.svelte.d.ts} +0 -0
- /package/dist/{locale.svelte.js → core/locale.svelte.js} +0 -0
- /package/dist/{toast.svelte.d.ts → core/toast.svelte.d.ts} +0 -0
- /package/dist/{toast.svelte.js → core/toast.svelte.js} +0 -0
- /package/dist/{tones.d.ts → core/tones.d.ts} +0 -0
- /package/dist/{tones.js → core/tones.js} +0 -0
- /package/dist/{components → styles/matte}/Accordion.svelte +0 -0
- /package/dist/{components → styles/matte}/Accordion.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/AvatarGroup.svelte +0 -0
- /package/dist/{components → styles/matte}/AvatarGroup.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/ContextMenu.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Divider.svelte +0 -0
- /package/dist/{components → styles/matte}/Divider.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Drawer.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Field.svelte +0 -0
- /package/dist/{components → styles/matte}/Field.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/InputGroup.svelte +0 -0
- /package/dist/{components → styles/matte}/InputGroup.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Kbd.svelte +0 -0
- /package/dist/{components → styles/matte}/Kbd.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Label.svelte +0 -0
- /package/dist/{components → styles/matte}/Label.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/MenuSeparator.svelte +0 -0
- /package/dist/{components → styles/matte}/MenuSeparator.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Modal.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Skeleton.svelte +0 -0
- /package/dist/{components → styles/matte}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Toaster.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Tooltip.svelte +0 -0
- /package/dist/{components → styles/matte}/Tooltip.svelte.d.ts +0 -0
- /package/dist/{fonts.css → styles/matte/fonts.css} +0 -0
- /package/dist/{theme.css → styles/matte/theme.css} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nqmcreative/ui/core — everything the styles share.
|
|
3
|
+
*
|
|
4
|
+
* Behaviour, not looks: focus containment, keyboard navigation, date maths,
|
|
5
|
+
* file validation, the toast queue, the locale strings. Nothing in here
|
|
6
|
+
* renders anything, and nothing in here knows which style is being used.
|
|
7
|
+
*
|
|
8
|
+
* Styles are free to ignore any of it — but there is no `matte` version of a
|
|
9
|
+
* focus trap, so none of them should have to write one.
|
|
10
|
+
*/
|
|
11
|
+
/* --- tones --- */
|
|
12
|
+
export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText } from './tones.js';
|
|
13
|
+
/* --- actions --- */
|
|
14
|
+
export { anchored } from './actions/anchor.js';
|
|
15
|
+
export { clickOutside, focusTrap, focusable, navigateList, portal } from './actions/dismissable.js';
|
|
16
|
+
/* --- overlays --- */
|
|
17
|
+
export { syncDialog, isBackdropClick } from './dialog.svelte.js';
|
|
18
|
+
export { popupTrigger, describeTrigger, menuItems, HOVER_GRACE } from './trigger.js';
|
|
19
|
+
/* --- lists --- */
|
|
20
|
+
export { ListCursor, groupItems, matchQuery, revealIndex } from './list.svelte.js';
|
|
21
|
+
/* --- data --- */
|
|
22
|
+
export { nextSort, sortRows, toggleKey } from './table.js';
|
|
23
|
+
export { pageRange } from './pagination.js';
|
|
24
|
+
export { sortFiles, matchesAccept, formatSize } from './files.js';
|
|
25
|
+
export { passwordScore } from './password.js';
|
|
26
|
+
export { clampToStep, percentOf, stepDecimals } from './number.js';
|
|
27
|
+
/* --- dates --- */
|
|
28
|
+
export { toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from './date.js';
|
|
29
|
+
export { calendarKeyMove, dateHint } from './calendar.js';
|
|
30
|
+
/* --- toast --- */
|
|
31
|
+
export { toast } from './toast.svelte.js';
|
|
32
|
+
/* --- theme --- */
|
|
33
|
+
export { applyTheme, storedTheme, persistTheme, nextTheme } from './theme.svelte.js';
|
|
34
|
+
/* --- locale --- */
|
|
35
|
+
export { locale, setLocale, provideLocale, useLocale, enUS, idID, LocaleStore } from './locale.svelte.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The list machinery behind every "type to filter, arrow to choose" control —
|
|
3
|
+
* Combobox, MultiSelect, CommandPalette.
|
|
4
|
+
*
|
|
5
|
+
* All three want the same four things: match a query, bundle the matches under
|
|
6
|
+
* their group headings, flatten them back into one indexable run, and move an
|
|
7
|
+
* active cursor over that run while skipping disabled entries. None of it has
|
|
8
|
+
* an opinion about how a row looks, so all of it lives here.
|
|
9
|
+
*/
|
|
10
|
+
export interface ListItem {
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Items sharing a group are rendered under one heading. */
|
|
13
|
+
group?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Case-insensitive substring match over whichever fields a control cares about. */
|
|
16
|
+
export declare function matchQuery<T>(items: T[], query: string, haystack: (item: T) => string): T[];
|
|
17
|
+
/**
|
|
18
|
+
* Buckets items by `group`, keeping first-seen order for both the groups and
|
|
19
|
+
* the items inside them. Ungrouped items land under `''`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function groupItems<T extends ListItem>(items: T[]): [string, T[]][];
|
|
22
|
+
/**
|
|
23
|
+
* An active-item cursor over a list that changes as the user types.
|
|
24
|
+
*
|
|
25
|
+
* `items` is a getter rather than an array so the cursor always reads the
|
|
26
|
+
* current matches — the caller keeps ownership of the filtering.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ListCursor<T extends ListItem> {
|
|
29
|
+
#private;
|
|
30
|
+
/** Index into the flattened list. */
|
|
31
|
+
index: number;
|
|
32
|
+
constructor(items: () => T[]);
|
|
33
|
+
get items(): T[];
|
|
34
|
+
get current(): T | undefined;
|
|
35
|
+
/** Jumps to the first item matching `predicate`, or to the top. */
|
|
36
|
+
reset(predicate?: (item: T) => boolean): void;
|
|
37
|
+
/** Wraps around, skipping disabled entries. */
|
|
38
|
+
move(step: number): void;
|
|
39
|
+
}
|
|
40
|
+
/** Brings the row carrying `data-index` into view without scrolling the page. */
|
|
41
|
+
export declare function revealIndex(container: HTMLElement | null, index: number): void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The list machinery behind every "type to filter, arrow to choose" control —
|
|
3
|
+
* Combobox, MultiSelect, CommandPalette.
|
|
4
|
+
*
|
|
5
|
+
* All three want the same four things: match a query, bundle the matches under
|
|
6
|
+
* their group headings, flatten them back into one indexable run, and move an
|
|
7
|
+
* active cursor over that run while skipping disabled entries. None of it has
|
|
8
|
+
* an opinion about how a row looks, so all of it lives here.
|
|
9
|
+
*/
|
|
10
|
+
/** Case-insensitive substring match over whichever fields a control cares about. */
|
|
11
|
+
export function matchQuery(items, query, haystack) {
|
|
12
|
+
const needle = query.trim().toLowerCase();
|
|
13
|
+
if (!needle)
|
|
14
|
+
return items;
|
|
15
|
+
return items.filter((item) => haystack(item).toLowerCase().includes(needle));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Buckets items by `group`, keeping first-seen order for both the groups and
|
|
19
|
+
* the items inside them. Ungrouped items land under `''`.
|
|
20
|
+
*/
|
|
21
|
+
export function groupItems(items) {
|
|
22
|
+
const out = [];
|
|
23
|
+
for (const item of items) {
|
|
24
|
+
const key = item.group ?? '';
|
|
25
|
+
const bucket = out.find(([name]) => name === key);
|
|
26
|
+
if (bucket)
|
|
27
|
+
bucket[1].push(item);
|
|
28
|
+
else
|
|
29
|
+
out.push([key, [item]]);
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An active-item cursor over a list that changes as the user types.
|
|
35
|
+
*
|
|
36
|
+
* `items` is a getter rather than an array so the cursor always reads the
|
|
37
|
+
* current matches — the caller keeps ownership of the filtering.
|
|
38
|
+
*/
|
|
39
|
+
export class ListCursor {
|
|
40
|
+
#items;
|
|
41
|
+
/** Index into the flattened list. */
|
|
42
|
+
index = $state(0);
|
|
43
|
+
constructor(items) {
|
|
44
|
+
this.#items = items;
|
|
45
|
+
}
|
|
46
|
+
get items() {
|
|
47
|
+
return this.#items();
|
|
48
|
+
}
|
|
49
|
+
get current() {
|
|
50
|
+
return this.items[this.index];
|
|
51
|
+
}
|
|
52
|
+
/** Jumps to the first item matching `predicate`, or to the top. */
|
|
53
|
+
reset(predicate) {
|
|
54
|
+
if (!predicate) {
|
|
55
|
+
this.index = 0;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.index = Math.max(0, this.items.findIndex(predicate));
|
|
59
|
+
}
|
|
60
|
+
/** Wraps around, skipping disabled entries. */
|
|
61
|
+
move(step) {
|
|
62
|
+
const items = this.items;
|
|
63
|
+
if (items.length === 0)
|
|
64
|
+
return;
|
|
65
|
+
let next = this.index;
|
|
66
|
+
for (let i = 0; i < items.length; i++) {
|
|
67
|
+
next = (next + step + items.length) % items.length;
|
|
68
|
+
if (!items[next].disabled)
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
this.index = next;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Brings the row carrying `data-index` into view without scrolling the page. */
|
|
75
|
+
export function revealIndex(container, index) {
|
|
76
|
+
container?.querySelector(`[data-index="${index}"]`)?.scrollIntoView({ block: 'nearest' });
|
|
77
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Numeric helpers shared by the stepper, the slider and the progress bar. */
|
|
2
|
+
/** Decimal places implied by a step, so `0.25` never produces `0.7500000001`. */
|
|
3
|
+
export declare function stepDecimals(step: number): number;
|
|
4
|
+
/** Clamps into range and rounds to the step's precision. */
|
|
5
|
+
export declare function clampToStep(value: number, min: number, max: number, step: number): number;
|
|
6
|
+
/** Position of `value` within `min…max`, as 0–100. */
|
|
7
|
+
export declare function percentOf(value: number, min: number, max: number): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Numeric helpers shared by the stepper, the slider and the progress bar. */
|
|
2
|
+
/** Decimal places implied by a step, so `0.25` never produces `0.7500000001`. */
|
|
3
|
+
export function stepDecimals(step) {
|
|
4
|
+
return (String(step).split('.')[1] ?? '').length;
|
|
5
|
+
}
|
|
6
|
+
/** Clamps into range and rounds to the step's precision. */
|
|
7
|
+
export function clampToStep(value, min, max, step) {
|
|
8
|
+
if (Number.isNaN(value))
|
|
9
|
+
return min === -Infinity ? 0 : min;
|
|
10
|
+
return Number(Math.min(max, Math.max(min, value)).toFixed(stepDecimals(step)));
|
|
11
|
+
}
|
|
12
|
+
/** Position of `value` within `min…max`, as 0–100. */
|
|
13
|
+
export function percentOf(value, min, max) {
|
|
14
|
+
if (max === min)
|
|
15
|
+
return 0;
|
|
16
|
+
return Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100));
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page numbers a pager should show. Collapses long runs to `…` while
|
|
3
|
+
* always keeping the first page, the last page, and `siblings` either side of
|
|
4
|
+
* the current one — so the control never changes width as you walk through it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pageRange(page: number, total: number, siblings?: number): (number | '…')[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page numbers a pager should show. Collapses long runs to `…` while
|
|
3
|
+
* always keeping the first page, the last page, and `siblings` either side of
|
|
4
|
+
* the current one — so the control never changes width as you walk through it.
|
|
5
|
+
*/
|
|
6
|
+
export function pageRange(page, total, siblings = 1) {
|
|
7
|
+
if (total <= 5 + siblings * 2) {
|
|
8
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
9
|
+
}
|
|
10
|
+
const start = Math.max(2, page - siblings);
|
|
11
|
+
const end = Math.min(total - 1, page + siblings);
|
|
12
|
+
const out = [1];
|
|
13
|
+
if (start > 2)
|
|
14
|
+
out.push('…');
|
|
15
|
+
for (let i = start; i <= end; i++)
|
|
16
|
+
out.push(i);
|
|
17
|
+
if (end < total - 1)
|
|
18
|
+
out.push('…');
|
|
19
|
+
out.push(total);
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password strength, 0–4, matching the five labels in the locale.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately simple — length plus character variety. It is a nudge in the
|
|
5
|
+
* form, not a security control, and anything cleverer would need a dictionary
|
|
6
|
+
* this package has no business shipping.
|
|
7
|
+
*/
|
|
8
|
+
export declare function passwordScore(value: string): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password strength, 0–4, matching the five labels in the locale.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately simple — length plus character variety. It is a nudge in the
|
|
5
|
+
* form, not a security control, and anything cleverer would need a dictionary
|
|
6
|
+
* this package has no business shipping.
|
|
7
|
+
*/
|
|
8
|
+
export function passwordScore(value) {
|
|
9
|
+
if (!value)
|
|
10
|
+
return 0;
|
|
11
|
+
let points = 0;
|
|
12
|
+
if (value.length >= 8)
|
|
13
|
+
points++;
|
|
14
|
+
if (value.length >= 12)
|
|
15
|
+
points++;
|
|
16
|
+
if (/[a-z]/.test(value) && /[A-Z]/.test(value))
|
|
17
|
+
points++;
|
|
18
|
+
if (/\d/.test(value))
|
|
19
|
+
points++;
|
|
20
|
+
if (/[^\w\s]/.test(value))
|
|
21
|
+
points++;
|
|
22
|
+
return Math.min(4, points);
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sorting and selection for a data table. Both are pure functions over rows,
|
|
3
|
+
* so a style only has to decide what a header and a checked row look like.
|
|
4
|
+
*/
|
|
5
|
+
export type SortDirection = 'asc' | 'desc';
|
|
6
|
+
export interface TableSort {
|
|
7
|
+
key: string;
|
|
8
|
+
direction: SortDirection;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Clicking a header cycles ascending → descending → unsorted, which is what
|
|
12
|
+
* lets a user get back to the server's original order.
|
|
13
|
+
*/
|
|
14
|
+
export declare function nextSort(current: TableSort | null, key: string): TableSort | null;
|
|
15
|
+
/**
|
|
16
|
+
* Sorts a copy of `rows`. Numbers compare numerically, everything else through
|
|
17
|
+
* `localeCompare` with `numeric`, so `item 2` lands before `item 10`. Nullish
|
|
18
|
+
* values sink to the bottom either way round.
|
|
19
|
+
*/
|
|
20
|
+
export declare function sortRows<T extends Record<string, unknown>>(rows: T[], sort: TableSort | null): T[];
|
|
21
|
+
/** Adds or removes one key, preserving the order the rest were chosen in. */
|
|
22
|
+
export declare function toggleKey(selected: string[], key: string): string[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sorting and selection for a data table. Both are pure functions over rows,
|
|
3
|
+
* so a style only has to decide what a header and a checked row look like.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Clicking a header cycles ascending → descending → unsorted, which is what
|
|
7
|
+
* lets a user get back to the server's original order.
|
|
8
|
+
*/
|
|
9
|
+
export function nextSort(current, key) {
|
|
10
|
+
if (current?.key !== key)
|
|
11
|
+
return { key, direction: 'asc' };
|
|
12
|
+
if (current.direction === 'asc')
|
|
13
|
+
return { key, direction: 'desc' };
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sorts a copy of `rows`. Numbers compare numerically, everything else through
|
|
18
|
+
* `localeCompare` with `numeric`, so `item 2` lands before `item 10`. Nullish
|
|
19
|
+
* values sink to the bottom either way round.
|
|
20
|
+
*/
|
|
21
|
+
export function sortRows(rows, sort) {
|
|
22
|
+
if (!sort)
|
|
23
|
+
return rows;
|
|
24
|
+
const { key, direction } = sort;
|
|
25
|
+
const factor = direction === 'asc' ? 1 : -1;
|
|
26
|
+
return [...rows].sort((a, b) => {
|
|
27
|
+
const x = a[key];
|
|
28
|
+
const y = b[key];
|
|
29
|
+
if (x == null)
|
|
30
|
+
return 1;
|
|
31
|
+
if (y == null)
|
|
32
|
+
return -1;
|
|
33
|
+
if (typeof x === 'number' && typeof y === 'number')
|
|
34
|
+
return (x - y) * factor;
|
|
35
|
+
return String(x).localeCompare(String(y), undefined, { numeric: true }) * factor;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** Adds or removes one key, preserving the order the rest were chosen in. */
|
|
39
|
+
export function toggleKey(selected, key) {
|
|
40
|
+
return selected.includes(key) ? selected.filter((k) => k !== key) : [...selected, key];
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light/dark preference, shared by every style.
|
|
3
|
+
*
|
|
4
|
+
* The classes written here are the ones each style's `theme.css` reads:
|
|
5
|
+
* `.dark` forces dark, `.light` forces light, and neither means "follow the
|
|
6
|
+
* OS". Nothing here knows what a theme looks like — only how it is chosen.
|
|
7
|
+
*/
|
|
8
|
+
export type Theme = 'light' | 'dark' | 'system';
|
|
9
|
+
/** Writes the theme classes `theme.css` reads. Safe to call before mount. */
|
|
10
|
+
export declare function applyTheme(theme: Theme): void;
|
|
11
|
+
/** The stored choice, or `'system'` when the visitor has never picked one. */
|
|
12
|
+
export declare function storedTheme(): Theme;
|
|
13
|
+
/** Persists a choice, clearing the key when it goes back to `'system'`. */
|
|
14
|
+
export declare function persistTheme(theme: Theme): void;
|
|
15
|
+
/** Cycles light → dark → system, the order the one-button toggle uses. */
|
|
16
|
+
export declare function nextTheme(theme: Theme): Theme;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light/dark preference, shared by every style.
|
|
3
|
+
*
|
|
4
|
+
* The classes written here are the ones each style's `theme.css` reads:
|
|
5
|
+
* `.dark` forces dark, `.light` forces light, and neither means "follow the
|
|
6
|
+
* OS". Nothing here knows what a theme looks like — only how it is chosen.
|
|
7
|
+
*/
|
|
8
|
+
const STORAGE_KEY = 'nqm-theme';
|
|
9
|
+
/** Writes the theme classes `theme.css` reads. Safe to call before mount. */
|
|
10
|
+
export function applyTheme(theme) {
|
|
11
|
+
const root = document.documentElement;
|
|
12
|
+
root.classList.toggle('dark', theme === 'dark');
|
|
13
|
+
root.classList.toggle('light', theme === 'light');
|
|
14
|
+
}
|
|
15
|
+
/** The stored choice, or `'system'` when the visitor has never picked one. */
|
|
16
|
+
export function storedTheme() {
|
|
17
|
+
if (typeof localStorage === 'undefined')
|
|
18
|
+
return 'system';
|
|
19
|
+
const saved = localStorage.getItem(STORAGE_KEY);
|
|
20
|
+
return saved === 'light' || saved === 'dark' ? saved : 'system';
|
|
21
|
+
}
|
|
22
|
+
/** Persists a choice, clearing the key when it goes back to `'system'`. */
|
|
23
|
+
export function persistTheme(theme) {
|
|
24
|
+
if (typeof localStorage === 'undefined')
|
|
25
|
+
return;
|
|
26
|
+
if (theme === 'system')
|
|
27
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
28
|
+
else
|
|
29
|
+
localStorage.setItem(STORAGE_KEY, theme);
|
|
30
|
+
}
|
|
31
|
+
/** Cycles light → dark → system, the order the one-button toggle uses. */
|
|
32
|
+
export function nextTheme(theme) {
|
|
33
|
+
return theme === 'light' ? 'dark' : theme === 'dark' ? 'system' : 'light';
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wiring for a popup's trigger.
|
|
3
|
+
*
|
|
4
|
+
* Dropdown and Popover take the trigger as a snippet, so the real control is
|
|
5
|
+
* whatever the consumer passed — a Button, a link, an avatar. Rather than wrap
|
|
6
|
+
* it in another button (which would nest interactive elements and put the ARIA
|
|
7
|
+
* state on the wrong node), these attach to the element that is already there.
|
|
8
|
+
*/
|
|
9
|
+
export interface PopupTriggerOptions {
|
|
10
|
+
/** Flip the popup open/closed. */
|
|
11
|
+
toggle: () => void;
|
|
12
|
+
/** Open it — used by ArrowDown and by hover triggers. */
|
|
13
|
+
open: () => void;
|
|
14
|
+
/** Close it, after the grace period a hover trigger needs. */
|
|
15
|
+
close: () => void;
|
|
16
|
+
/** `'hover'` also responds to focus, for read-only content. */
|
|
17
|
+
on?: 'click' | 'hover';
|
|
18
|
+
/** Open on ArrowDown while closed — menu behaviour. */
|
|
19
|
+
arrowOpens?: boolean;
|
|
20
|
+
/** Whether the popup is currently open, read at event time. */
|
|
21
|
+
isOpen?: () => boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Milliseconds a hover popup stays up after the pointer leaves. */
|
|
24
|
+
export declare const HOVER_GRACE = 120;
|
|
25
|
+
export declare function popupTrigger(node: HTMLElement, options: PopupTriggerOptions): {
|
|
26
|
+
update(next: PopupTriggerOptions): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Puts `aria-haspopup`/`aria-expanded` on the real control inside a trigger
|
|
31
|
+
* wrapper, so screen readers announce the state on the thing being pressed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function describeTrigger(wrapper: HTMLElement | null, kind: 'menu' | 'dialog' | 'listbox', open: boolean): void;
|
|
34
|
+
/** The menu items a roving-focus menu should walk, in DOM order. */
|
|
35
|
+
export declare function menuItems(menu: HTMLElement | null): HTMLElement[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wiring for a popup's trigger.
|
|
3
|
+
*
|
|
4
|
+
* Dropdown and Popover take the trigger as a snippet, so the real control is
|
|
5
|
+
* whatever the consumer passed — a Button, a link, an avatar. Rather than wrap
|
|
6
|
+
* it in another button (which would nest interactive elements and put the ARIA
|
|
7
|
+
* state on the wrong node), these attach to the element that is already there.
|
|
8
|
+
*/
|
|
9
|
+
/** Milliseconds a hover popup stays up after the pointer leaves. */
|
|
10
|
+
export const HOVER_GRACE = 120;
|
|
11
|
+
export function popupTrigger(node, options) {
|
|
12
|
+
let opts = options;
|
|
13
|
+
let timer;
|
|
14
|
+
const onClick = () => opts.toggle();
|
|
15
|
+
const onShow = () => {
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
opts.open();
|
|
18
|
+
};
|
|
19
|
+
const onHide = () => {
|
|
20
|
+
timer = setTimeout(() => opts.close(), HOVER_GRACE);
|
|
21
|
+
};
|
|
22
|
+
const onKeydown = (event) => {
|
|
23
|
+
if (!opts.arrowOpens || event.key !== 'ArrowDown')
|
|
24
|
+
return;
|
|
25
|
+
if (opts.isOpen?.())
|
|
26
|
+
return;
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
opts.open();
|
|
29
|
+
};
|
|
30
|
+
const bind = () => {
|
|
31
|
+
if (opts.on === 'hover') {
|
|
32
|
+
node.addEventListener('pointerenter', onShow);
|
|
33
|
+
node.addEventListener('pointerleave', onHide);
|
|
34
|
+
node.addEventListener('focusin', onShow);
|
|
35
|
+
node.addEventListener('focusout', onHide);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
node.addEventListener('click', onClick);
|
|
39
|
+
node.addEventListener('keydown', onKeydown);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const unbind = () => {
|
|
43
|
+
node.removeEventListener('click', onClick);
|
|
44
|
+
node.removeEventListener('keydown', onKeydown);
|
|
45
|
+
node.removeEventListener('pointerenter', onShow);
|
|
46
|
+
node.removeEventListener('pointerleave', onHide);
|
|
47
|
+
node.removeEventListener('focusin', onShow);
|
|
48
|
+
node.removeEventListener('focusout', onHide);
|
|
49
|
+
};
|
|
50
|
+
bind();
|
|
51
|
+
return {
|
|
52
|
+
update(next) {
|
|
53
|
+
unbind();
|
|
54
|
+
opts = next;
|
|
55
|
+
bind();
|
|
56
|
+
},
|
|
57
|
+
destroy() {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
unbind();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Puts `aria-haspopup`/`aria-expanded` on the real control inside a trigger
|
|
65
|
+
* wrapper, so screen readers announce the state on the thing being pressed.
|
|
66
|
+
*/
|
|
67
|
+
export function describeTrigger(wrapper, kind, open) {
|
|
68
|
+
const control = wrapper?.querySelector('button, a, [role="button"]');
|
|
69
|
+
if (!control)
|
|
70
|
+
return;
|
|
71
|
+
control.setAttribute('aria-haspopup', kind);
|
|
72
|
+
control.setAttribute('aria-expanded', String(open));
|
|
73
|
+
}
|
|
74
|
+
/** The menu items a roving-focus menu should walk, in DOM order. */
|
|
75
|
+
export function menuItems(menu) {
|
|
76
|
+
return menu ? [...menu.querySelectorAll('[role="menuitem"]:not([disabled])')] : [];
|
|
77
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,105 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* `@nqmcreative/ui` has no root export, on purpose.
|
|
3
|
+
*
|
|
4
|
+
* Every component belongs to a style, and a style is a deliberate choice — so
|
|
5
|
+
* it has to be named at the import:
|
|
6
|
+
*
|
|
7
|
+
* import { Button } from '@nqmcreative/ui/matte';
|
|
8
|
+
* import { Button } from '@nqmcreative/ui/paper';
|
|
9
|
+
*
|
|
10
|
+
* A default here would let people pick one by accident and never find out.
|
|
11
|
+
* Shared behaviour lives at `@nqmcreative/ui/core`.
|
|
4
12
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export type { Tone } from './tones.js';
|
|
7
|
-
export { anchored } from './actions/anchor.js';
|
|
8
|
-
export type { Placement, AnchorOptions } from './actions/anchor.js';
|
|
9
|
-
export { clickOutside, focusTrap, focusable, navigateList, portal } from './actions/dismissable.js';
|
|
10
|
-
export type { ClickOutsideOptions, FocusTrapOptions } from './actions/dismissable.js';
|
|
11
|
-
export { toast } from './toast.svelte.js';
|
|
12
|
-
export type { Toast, ToastOptions, ToastAction } from './toast.svelte.js';
|
|
13
|
-
export { locale, setLocale, provideLocale, useLocale, enUS, idID, LocaleStore } from './locale.svelte.js';
|
|
14
|
-
export type { Locale } from './locale.svelte.js';
|
|
15
|
-
export { default as LocaleProvider } from './components/LocaleProvider.svelte';
|
|
16
|
-
export { default as Button } from './components/Button.svelte';
|
|
17
|
-
export type { ButtonVariant, ButtonSize } from './components/Button.svelte';
|
|
18
|
-
export { default as Link } from './components/Link.svelte';
|
|
19
|
-
export { default as Input } from './components/Input.svelte';
|
|
20
|
-
export type { InputSize } from './components/Input.svelte';
|
|
21
|
-
export { default as Textarea } from './components/Textarea.svelte';
|
|
22
|
-
export { default as Select } from './components/Select.svelte';
|
|
23
|
-
export type { SelectOption } from './components/Select.svelte';
|
|
24
|
-
export { default as Checkbox } from './components/Checkbox.svelte';
|
|
25
|
-
export { default as Radio } from './components/Radio.svelte';
|
|
26
|
-
export { default as Switch } from './components/Switch.svelte';
|
|
27
|
-
export type { SwitchSize } from './components/Switch.svelte';
|
|
28
|
-
export { default as Field } from './components/Field.svelte';
|
|
29
|
-
export { default as Label } from './components/Label.svelte';
|
|
30
|
-
export { default as PasswordInput } from './components/PasswordInput.svelte';
|
|
31
|
-
export { default as NumberInput } from './components/NumberInput.svelte';
|
|
32
|
-
export { default as Slider } from './components/Slider.svelte';
|
|
33
|
-
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
|
34
|
-
export type { RadioOption } from './components/RadioGroup.svelte';
|
|
35
|
-
export { default as CheckboxGroup } from './components/CheckboxGroup.svelte';
|
|
36
|
-
export type { CheckboxOption } from './components/CheckboxGroup.svelte';
|
|
37
|
-
export { default as SegmentedControl } from './components/SegmentedControl.svelte';
|
|
38
|
-
export type { SegmentOption, SegmentedSize } from './components/SegmentedControl.svelte';
|
|
39
|
-
export { default as InputGroup } from './components/InputGroup.svelte';
|
|
40
|
-
export { default as Combobox } from './components/Combobox.svelte';
|
|
41
|
-
export type { ComboboxOption } from './components/Combobox.svelte';
|
|
42
|
-
export { default as MultiSelect } from './components/MultiSelect.svelte';
|
|
43
|
-
export type { MultiSelectOption } from './components/MultiSelect.svelte';
|
|
44
|
-
export { default as DatePicker } from './components/DatePicker.svelte';
|
|
45
|
-
export { default as Calendar } from './components/Calendar.svelte';
|
|
46
|
-
export { toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from './date.js';
|
|
47
|
-
export type { DateFormat } from './date.js';
|
|
48
|
-
export { default as Dropzone } from './components/Dropzone.svelte';
|
|
49
|
-
export type { RejectedFile } from './components/Dropzone.svelte';
|
|
50
|
-
export { default as Badge } from './components/Badge.svelte';
|
|
51
|
-
export type { BadgeTone, BadgeVariant, BadgeSize } from './components/Badge.svelte';
|
|
52
|
-
export { default as Avatar } from './components/Avatar.svelte';
|
|
53
|
-
export type { AvatarSize } from './components/Avatar.svelte';
|
|
54
|
-
export { default as AvatarGroup } from './components/AvatarGroup.svelte';
|
|
55
|
-
export { default as Card } from './components/Card.svelte';
|
|
56
|
-
export type { CardVariant } from './components/Card.svelte';
|
|
57
|
-
export { default as Stat } from './components/Stat.svelte';
|
|
58
|
-
export type { StatTrend } from './components/Stat.svelte';
|
|
59
|
-
export { default as Table } from './components/Table.svelte';
|
|
60
|
-
export type { TableColumn, TableSort, SortDirection } from './components/Table.svelte';
|
|
61
|
-
export { default as Kbd } from './components/Kbd.svelte';
|
|
62
|
-
export { default as Alert } from './components/Alert.svelte';
|
|
63
|
-
export type { AlertVariant } from './components/Alert.svelte';
|
|
64
|
-
export { default as Progress } from './components/Progress.svelte';
|
|
65
|
-
export type { ProgressSize } from './components/Progress.svelte';
|
|
66
|
-
export { default as Spinner } from './components/Spinner.svelte';
|
|
67
|
-
export type { SpinnerSize } from './components/Spinner.svelte';
|
|
68
|
-
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
69
|
-
export type { SkeletonVariant } from './components/Skeleton.svelte';
|
|
70
|
-
export { default as EmptyState } from './components/EmptyState.svelte';
|
|
71
|
-
export { default as Toaster } from './components/Toaster.svelte';
|
|
72
|
-
export type { ToasterPosition } from './components/Toaster.svelte';
|
|
73
|
-
export { default as Divider } from './components/Divider.svelte';
|
|
74
|
-
export type { DividerOrientation } from './components/Divider.svelte';
|
|
75
|
-
export { default as Tabs } from './components/Tabs.svelte';
|
|
76
|
-
export type { TabItem, TabsVariant } from './components/Tabs.svelte';
|
|
77
|
-
export { default as Accordion } from './components/Accordion.svelte';
|
|
78
|
-
export { default as AccordionItem } from './components/AccordionItem.svelte';
|
|
79
|
-
export { default as Breadcrumb } from './components/Breadcrumb.svelte';
|
|
80
|
-
export type { BreadcrumbItem } from './components/Breadcrumb.svelte';
|
|
81
|
-
export { default as Pagination } from './components/Pagination.svelte';
|
|
82
|
-
export { default as Steps } from './components/Steps.svelte';
|
|
83
|
-
export type { StepItem } from './components/Steps.svelte';
|
|
84
|
-
export { default as Navbar } from './components/Navbar.svelte';
|
|
85
|
-
export type { NavItem } from './components/Navbar.svelte';
|
|
86
|
-
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
87
|
-
export type { SidebarItem, SidebarSection } from './components/Sidebar.svelte';
|
|
88
|
-
export { default as Footer } from './components/Footer.svelte';
|
|
89
|
-
export type { FooterColumn, FooterLink } from './components/Footer.svelte';
|
|
90
|
-
export { default as Modal } from './components/Modal.svelte';
|
|
91
|
-
export type { ModalSize } from './components/Modal.svelte';
|
|
92
|
-
export { default as Drawer } from './components/Drawer.svelte';
|
|
93
|
-
export type { DrawerSide, DrawerSize } from './components/Drawer.svelte';
|
|
94
|
-
export { default as ConfirmDialog } from './components/ConfirmDialog.svelte';
|
|
95
|
-
export { default as CommandPalette } from './components/CommandPalette.svelte';
|
|
96
|
-
export type { CommandItem } from './components/CommandPalette.svelte';
|
|
97
|
-
export { default as ContextMenu } from './components/ContextMenu.svelte';
|
|
98
|
-
export { default as Dropdown } from './components/Dropdown.svelte';
|
|
99
|
-
export { default as MenuItem } from './components/MenuItem.svelte';
|
|
100
|
-
export { default as MenuSeparator } from './components/MenuSeparator.svelte';
|
|
101
|
-
export { default as Popover } from './components/Popover.svelte';
|
|
102
|
-
export { default as ThemeToggle, applyTheme, storedTheme } from './components/ThemeToggle.svelte';
|
|
103
|
-
export type { Theme } from './components/ThemeToggle.svelte';
|
|
104
|
-
export { default as Tooltip } from './components/Tooltip.svelte';
|
|
105
|
-
export type { TooltipPlacement } from './components/Tooltip.svelte';
|
|
13
|
+
export {};
|