@nqmcreative/ui 0.1.1 → 0.2.1
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 +83 -33
- 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
package/dist/index.js
CHANGED
|
@@ -1,77 +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
|
-
|
|
6
|
-
export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText } from './tones.js';
|
|
7
|
-
/* --- behaviour (actions + stores) --- */
|
|
8
|
-
export { anchored } from './actions/anchor.js';
|
|
9
|
-
export { clickOutside, focusTrap, focusable, navigateList, portal } from './actions/dismissable.js';
|
|
10
|
-
export { toast } from './toast.svelte.js';
|
|
11
|
-
/* --- locale --- */
|
|
12
|
-
export { locale, setLocale, provideLocale, useLocale, enUS, idID, LocaleStore } from './locale.svelte.js';
|
|
13
|
-
export { default as LocaleProvider } from './components/LocaleProvider.svelte';
|
|
14
|
-
/* --- actions --- */
|
|
15
|
-
export { default as Button } from './components/Button.svelte';
|
|
16
|
-
export { default as Link } from './components/Link.svelte';
|
|
17
|
-
/* --- forms --- */
|
|
18
|
-
export { default as Input } from './components/Input.svelte';
|
|
19
|
-
export { default as Textarea } from './components/Textarea.svelte';
|
|
20
|
-
export { default as Select } from './components/Select.svelte';
|
|
21
|
-
export { default as Checkbox } from './components/Checkbox.svelte';
|
|
22
|
-
export { default as Radio } from './components/Radio.svelte';
|
|
23
|
-
export { default as Switch } from './components/Switch.svelte';
|
|
24
|
-
export { default as Field } from './components/Field.svelte';
|
|
25
|
-
export { default as Label } from './components/Label.svelte';
|
|
26
|
-
export { default as PasswordInput } from './components/PasswordInput.svelte';
|
|
27
|
-
export { default as NumberInput } from './components/NumberInput.svelte';
|
|
28
|
-
export { default as Slider } from './components/Slider.svelte';
|
|
29
|
-
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
|
30
|
-
export { default as CheckboxGroup } from './components/CheckboxGroup.svelte';
|
|
31
|
-
export { default as SegmentedControl } from './components/SegmentedControl.svelte';
|
|
32
|
-
export { default as InputGroup } from './components/InputGroup.svelte';
|
|
33
|
-
export { default as Combobox } from './components/Combobox.svelte';
|
|
34
|
-
export { default as MultiSelect } from './components/MultiSelect.svelte';
|
|
35
|
-
export { default as DatePicker } from './components/DatePicker.svelte';
|
|
36
|
-
export { default as Calendar } from './components/Calendar.svelte';
|
|
37
|
-
export { toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from './date.js';
|
|
38
|
-
export { default as Dropzone } from './components/Dropzone.svelte';
|
|
39
|
-
/* --- data display --- */
|
|
40
|
-
export { default as Badge } from './components/Badge.svelte';
|
|
41
|
-
export { default as Avatar } from './components/Avatar.svelte';
|
|
42
|
-
export { default as AvatarGroup } from './components/AvatarGroup.svelte';
|
|
43
|
-
export { default as Card } from './components/Card.svelte';
|
|
44
|
-
export { default as Stat } from './components/Stat.svelte';
|
|
45
|
-
export { default as Table } from './components/Table.svelte';
|
|
46
|
-
export { default as Kbd } from './components/Kbd.svelte';
|
|
47
|
-
/* --- feedback --- */
|
|
48
|
-
export { default as Alert } from './components/Alert.svelte';
|
|
49
|
-
export { default as Progress } from './components/Progress.svelte';
|
|
50
|
-
export { default as Spinner } from './components/Spinner.svelte';
|
|
51
|
-
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
52
|
-
export { default as EmptyState } from './components/EmptyState.svelte';
|
|
53
|
-
export { default as Toaster } from './components/Toaster.svelte';
|
|
54
|
-
/* --- layout & navigation --- */
|
|
55
|
-
export { default as Divider } from './components/Divider.svelte';
|
|
56
|
-
export { default as Tabs } from './components/Tabs.svelte';
|
|
57
|
-
export { default as Accordion } from './components/Accordion.svelte';
|
|
58
|
-
export { default as AccordionItem } from './components/AccordionItem.svelte';
|
|
59
|
-
export { default as Breadcrumb } from './components/Breadcrumb.svelte';
|
|
60
|
-
export { default as Pagination } from './components/Pagination.svelte';
|
|
61
|
-
export { default as Steps } from './components/Steps.svelte';
|
|
62
|
-
/* --- app shell --- */
|
|
63
|
-
export { default as Navbar } from './components/Navbar.svelte';
|
|
64
|
-
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
65
|
-
export { default as Footer } from './components/Footer.svelte';
|
|
66
|
-
/* --- overlay --- */
|
|
67
|
-
export { default as Modal } from './components/Modal.svelte';
|
|
68
|
-
export { default as Drawer } from './components/Drawer.svelte';
|
|
69
|
-
export { default as ConfirmDialog } from './components/ConfirmDialog.svelte';
|
|
70
|
-
export { default as CommandPalette } from './components/CommandPalette.svelte';
|
|
71
|
-
export { default as ContextMenu } from './components/ContextMenu.svelte';
|
|
72
|
-
export { default as Dropdown } from './components/Dropdown.svelte';
|
|
73
|
-
export { default as MenuItem } from './components/MenuItem.svelte';
|
|
74
|
-
export { default as MenuSeparator } from './components/MenuSeparator.svelte';
|
|
75
|
-
export { default as Popover } from './components/Popover.svelte';
|
|
76
|
-
export { default as ThemeToggle, applyTheme, storedTheme } from './components/ThemeToggle.svelte';
|
|
77
|
-
export { default as Tooltip } from './components/Tooltip.svelte';
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import { toneText, type Tone } from '
|
|
4
|
+
import { toneText, type Tone } from '../../core/tones.js';
|
|
5
5
|
|
|
6
6
|
interface Props extends HTMLAttributes<HTMLDetailsElement> {
|
|
7
7
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
4
|
interface Props extends HTMLAttributes<HTMLDetailsElement> {
|
|
5
5
|
title: string;
|
|
6
6
|
open?: boolean;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
toneBorder,
|
|
6
|
+
toneBorderSoft,
|
|
7
|
+
toneSurface,
|
|
8
|
+
toneText,
|
|
9
|
+
type Tone
|
|
10
|
+
} from '../../core/tones.js';
|
|
11
|
+
import { useLocale } from '../../core/locale.svelte.js';
|
|
6
12
|
|
|
7
13
|
export type AlertVariant = 'soft' | 'outline' | 'accent';
|
|
8
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
4
|
export type AlertVariant = 'soft' | 'outline' | 'accent';
|
|
5
5
|
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
tone?: Tone;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import { type Tone } from '
|
|
2
|
+
import { type Tone } from '../../core/tones.js';
|
|
3
3
|
export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
4
|
interface Props extends HTMLAttributes<HTMLSpanElement> {
|
|
5
5
|
src?: string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
toneBorderSoft,
|
|
6
|
+
toneFill,
|
|
7
|
+
toneSoft,
|
|
8
|
+
toneSolid,
|
|
9
|
+
toneText,
|
|
10
|
+
type Tone
|
|
11
|
+
} from '../../core/tones.js';
|
|
5
12
|
|
|
6
|
-
/** @deprecated use `Tone` — kept so existing `tone="brand" | "neutral"` still type-checks. */
|
|
7
|
-
export type BadgeTone = Tone;
|
|
8
13
|
export type BadgeVariant = 'soft' | 'solid' | 'outline';
|
|
9
14
|
export type BadgeSize = 'sm' | 'md';
|
|
10
15
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
4
|
-
/** @deprecated use `Tone` — kept so existing `tone="brand" | "neutral"` still type-checks. */
|
|
5
|
-
export type BadgeTone = Tone;
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
6
4
|
export type BadgeVariant = 'soft' | 'solid' | 'outline';
|
|
7
5
|
export type BadgeSize = 'sm' | 'md';
|
|
8
6
|
interface Props extends HTMLAttributes<HTMLSpanElement> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { toneHoverText, type Tone } from '
|
|
4
|
-
import { useLocale } from '
|
|
3
|
+
import { toneHoverText, type Tone } from '../../core/tones.js';
|
|
4
|
+
import { useLocale } from '../../core/locale.svelte.js';
|
|
5
5
|
|
|
6
6
|
export interface BreadcrumbItem {
|
|
7
7
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
4
|
export type ButtonVariant = 'solid' | 'soft' | 'outline' | 'ghost' | 'link' | 'primary';
|
|
5
5
|
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
6
6
|
interface Props extends HTMLButtonAttributes {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { toneBorderSoft, toneSolid, toneSurface, type Tone } from '../../core/tones.js';
|
|
5
|
+
|
|
6
|
+
export type CTAVariant = 'tinted' | 'solid' | 'outline';
|
|
7
|
+
|
|
8
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
tone?: Tone;
|
|
12
|
+
variant?: CTAVariant;
|
|
13
|
+
/** Side by side on wide screens instead of stacked and centred. */
|
|
14
|
+
inline?: boolean;
|
|
15
|
+
/** The buttons. */
|
|
16
|
+
actions?: Snippet;
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
tone = 'brand',
|
|
24
|
+
variant = 'tinted',
|
|
25
|
+
inline = false,
|
|
26
|
+
actions,
|
|
27
|
+
class: className = '',
|
|
28
|
+
children,
|
|
29
|
+
...rest
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
const variants = $derived({
|
|
33
|
+
tinted: `${toneSurface[tone]} border ${toneBorderSoft[tone]}`,
|
|
34
|
+
solid: toneSolid[tone],
|
|
35
|
+
outline: `bg-bg border ${toneBorderSoft[tone]}`
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const onSolid = $derived(variant === 'solid');
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<section class="w-full px-6 py-16 {className}" {...rest}>
|
|
42
|
+
<div
|
|
43
|
+
class="mx-auto flex w-full max-w-6xl gap-8 p-10 sm:p-14 {variants[variant]}
|
|
44
|
+
{inline
|
|
45
|
+
? 'flex-col lg:flex-row lg:items-center lg:justify-between'
|
|
46
|
+
: 'flex-col items-center text-center'}"
|
|
47
|
+
>
|
|
48
|
+
<div class="flex min-w-0 flex-col gap-3 {inline ? '' : 'items-center'}">
|
|
49
|
+
<h2
|
|
50
|
+
class="max-w-2xl font-heading text-3xl font-medium tracking-tight text-balance {onSolid
|
|
51
|
+
? 'text-text-inverse'
|
|
52
|
+
: 'text-text'}"
|
|
53
|
+
>
|
|
54
|
+
{title}
|
|
55
|
+
</h2>
|
|
56
|
+
{#if description}
|
|
57
|
+
<p
|
|
58
|
+
class="max-w-xl font-sans leading-relaxed text-pretty {onSolid
|
|
59
|
+
? 'text-text-inverse/80'
|
|
60
|
+
: 'text-text-secondary'}"
|
|
61
|
+
>
|
|
62
|
+
{description}
|
|
63
|
+
</p>
|
|
64
|
+
{/if}
|
|
65
|
+
{#if children}
|
|
66
|
+
{@render children()}
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
{#if actions}
|
|
71
|
+
<div class="flex shrink-0 flex-wrap items-center gap-3 {inline ? '' : 'justify-center'}">
|
|
72
|
+
{@render actions()}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
</section>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
|
+
export type CTAVariant = 'tinted' | 'solid' | 'outline';
|
|
5
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
tone?: Tone;
|
|
9
|
+
variant?: CTAVariant;
|
|
10
|
+
/** Side by side on wide screens instead of stacked and centred. */
|
|
11
|
+
inline?: boolean;
|
|
12
|
+
/** The buttons. */
|
|
13
|
+
actions?: Snippet;
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
}
|
|
16
|
+
declare const CTASection: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type CTASection = ReturnType<typeof CTASection>;
|
|
18
|
+
export default CTASection;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
addDays,
|
|
4
3
|
addMonths,
|
|
5
4
|
fromISO,
|
|
6
5
|
isOutOfRange,
|
|
@@ -10,9 +9,10 @@
|
|
|
10
9
|
toISO,
|
|
11
10
|
today,
|
|
12
11
|
weekdayNames
|
|
13
|
-
} from '
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
} from '../../core/date.js';
|
|
13
|
+
import { calendarKeyMove } from '../../core/calendar.js';
|
|
14
|
+
import { useLocale } from '../../core/locale.svelte.js';
|
|
15
|
+
import { focusRing, toneFill, toneRing, toneText, type Tone } from '../../core/tones.js';
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
/** Bindable `YYYY-MM-DD`, or `''` for nothing selected. */
|
|
@@ -91,20 +91,10 @@
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
function onKeydown(event: KeyboardEvent) {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
ArrowRight: () => addDays(focused, 1),
|
|
97
|
-
ArrowUp: () => addDays(focused, -7),
|
|
98
|
-
ArrowDown: () => addDays(focused, 7),
|
|
99
|
-
Home: () => addDays(focused, -((focused.getDay() - weekStart + 7) % 7)),
|
|
100
|
-
End: () => addDays(focused, 6 - ((focused.getDay() - weekStart + 7) % 7)),
|
|
101
|
-
PageUp: () => addMonths(focused, event.shiftKey ? -12 : -1),
|
|
102
|
-
PageDown: () => addMonths(focused, event.shiftKey ? 12 : 1)
|
|
103
|
-
};
|
|
104
|
-
const move = moves[event.key];
|
|
105
|
-
if (move) {
|
|
94
|
+
const next = calendarKeyMove(event.key, focused, weekStart, event.shiftKey);
|
|
95
|
+
if (next) {
|
|
106
96
|
event.preventDefault();
|
|
107
|
-
moveFocus(
|
|
97
|
+
moveFocus(next);
|
|
108
98
|
return;
|
|
109
99
|
}
|
|
110
100
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import { toneBorderLeft, toneHoverBorder, toneSurface, type Tone } from '
|
|
4
|
+
import { toneBorderLeft, toneHoverBorder, toneSurface, type Tone } from '../../core/tones.js';
|
|
5
5
|
|
|
6
6
|
export type CardVariant = 'outline' | 'filled' | 'tinted';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
4
|
export type CardVariant = 'outline' | 'filled' | 'tinted';
|
|
5
5
|
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
variant?: CardVariant;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
-
import { peerFocusRing, tonePeerChecked, tonePeerFocus, type Tone } from '
|
|
4
|
+
import { peerFocusRing, tonePeerChecked, tonePeerFocus, type Tone } from '../../core/tones.js';
|
|
5
5
|
|
|
6
6
|
interface Props extends Omit<HTMLInputAttributes, 'type' | 'size'> {
|
|
7
7
|
checked?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
import { type Tone } from '
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
4
|
interface Props extends Omit<HTMLInputAttributes, 'type' | 'size'> {
|
|
5
5
|
checked?: boolean;
|
|
6
6
|
/** Renders the dash state — visual only, `checked` stays false. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLFieldsetAttributes } from 'svelte/elements';
|
|
4
4
|
import Checkbox from './Checkbox.svelte';
|
|
5
|
-
import type { Tone } from '
|
|
5
|
+
import type { Tone } from '../../core/tones.js';
|
|
6
6
|
|
|
7
7
|
export interface CheckboxOption {
|
|
8
8
|
value: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { anchored } from '
|
|
3
|
-
import { clickOutside, portal } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { anchored } from '../../core/actions/anchor.js';
|
|
3
|
+
import { clickOutside, portal } from '../../core/actions/dismissable.js';
|
|
4
|
+
import { ListCursor, groupItems, matchQuery, revealIndex } from '../../core/list.svelte.js';
|
|
5
|
+
import { toneFocusWithinBorder, toneSoft, toneText, type Tone } from '../../core/tones.js';
|
|
6
|
+
import { useLocale } from '../../core/locale.svelte.js';
|
|
6
7
|
|
|
7
8
|
export interface ComboboxOption {
|
|
8
9
|
value: string;
|
|
@@ -50,45 +51,35 @@
|
|
|
50
51
|
|
|
51
52
|
let open = $state(false);
|
|
52
53
|
let query = $state('');
|
|
53
|
-
let active = $state(0);
|
|
54
54
|
let wrapper: HTMLElement | null = $state(null);
|
|
55
55
|
let inputEl: HTMLInputElement | null = $state(null);
|
|
56
56
|
let listEl: HTMLElement | null = $state(null);
|
|
57
57
|
|
|
58
58
|
const selected = $derived(options.find((option) => option.value === value));
|
|
59
59
|
|
|
60
|
-
const matches = $derived
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return options.filter(
|
|
64
|
-
(option) =>
|
|
65
|
-
option.label.toLowerCase().includes(needle) ||
|
|
66
|
-
option.description?.toLowerCase().includes(needle)
|
|
67
|
-
);
|
|
68
|
-
});
|
|
60
|
+
const matches = $derived(
|
|
61
|
+
matchQuery(options, query, (option) => `${option.label} ${option.description ?? ''}`)
|
|
62
|
+
);
|
|
69
63
|
|
|
70
64
|
/** Options in render order, grouped when any option declares a `group`. */
|
|
71
|
-
const groups = $derived
|
|
72
|
-
const out: [string, ComboboxOption[]][] = [];
|
|
73
|
-
for (const option of matches) {
|
|
74
|
-
const key = option.group ?? '';
|
|
75
|
-
const bucket = out.find(([name]) => name === key);
|
|
76
|
-
if (bucket) bucket[1].push(option);
|
|
77
|
-
else out.push([key, [option]]);
|
|
78
|
-
}
|
|
79
|
-
return out;
|
|
80
|
-
});
|
|
81
|
-
|
|
65
|
+
const groups = $derived(groupItems(matches));
|
|
82
66
|
const flat = $derived(groups.flatMap(([, items]) => items));
|
|
83
67
|
|
|
68
|
+
const cursor = new ListCursor(() => flat);
|
|
69
|
+
const active = $derived(cursor.index);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Set while we hand focus back to the field after a choice. Focusing fires
|
|
73
|
+
* `focus` synchronously, and this field opens on focus — without the guard,
|
|
74
|
+
* picking an option would immediately reopen the list it just closed.
|
|
75
|
+
*/
|
|
76
|
+
let restoring = false;
|
|
77
|
+
|
|
84
78
|
function openList() {
|
|
85
|
-
if (disabled || open) return;
|
|
79
|
+
if (disabled || open || restoring) return;
|
|
86
80
|
open = true;
|
|
87
81
|
query = '';
|
|
88
|
-
|
|
89
|
-
0,
|
|
90
|
-
flat.findIndex((option) => option.value === value)
|
|
91
|
-
);
|
|
82
|
+
cursor.reset((option) => option.value === value);
|
|
92
83
|
}
|
|
93
84
|
|
|
94
85
|
function choose(option: ComboboxOption) {
|
|
@@ -97,7 +88,9 @@
|
|
|
97
88
|
onchange?.(option.value);
|
|
98
89
|
open = false;
|
|
99
90
|
query = '';
|
|
91
|
+
restoring = true;
|
|
100
92
|
inputEl?.focus();
|
|
93
|
+
restoring = false;
|
|
101
94
|
}
|
|
102
95
|
|
|
103
96
|
function clear(event: MouseEvent) {
|
|
@@ -105,18 +98,14 @@
|
|
|
105
98
|
value = '';
|
|
106
99
|
query = '';
|
|
107
100
|
onchange?.('');
|
|
101
|
+
restoring = true;
|
|
108
102
|
inputEl?.focus();
|
|
103
|
+
restoring = false;
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
function move(step: number) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
for (let i = 0; i < flat.length; i++) {
|
|
115
|
-
next = (next + step + flat.length) % flat.length;
|
|
116
|
-
if (!flat[next].disabled) break;
|
|
117
|
-
}
|
|
118
|
-
active = next;
|
|
119
|
-
listEl?.querySelector(`[data-index="${next}"]`)?.scrollIntoView({ block: 'nearest' });
|
|
107
|
+
cursor.move(step);
|
|
108
|
+
revealIndex(listEl, cursor.index);
|
|
120
109
|
}
|
|
121
110
|
|
|
122
111
|
function onKeydown(event: KeyboardEvent) {
|
|
@@ -131,9 +120,9 @@
|
|
|
131
120
|
if (open) move(-1);
|
|
132
121
|
break;
|
|
133
122
|
case 'Enter':
|
|
134
|
-
if (open &&
|
|
123
|
+
if (open && cursor.current) {
|
|
135
124
|
event.preventDefault();
|
|
136
|
-
choose(
|
|
125
|
+
choose(cursor.current);
|
|
137
126
|
}
|
|
138
127
|
break;
|
|
139
128
|
case 'Escape':
|
|
@@ -173,7 +162,7 @@
|
|
|
173
162
|
oninput={(event) => {
|
|
174
163
|
query = event.currentTarget.value;
|
|
175
164
|
open = true;
|
|
176
|
-
|
|
165
|
+
cursor.index = 0;
|
|
177
166
|
}}
|
|
178
167
|
onfocus={openList}
|
|
179
168
|
onkeydown={onKeydown}
|
|
@@ -239,7 +228,7 @@
|
|
|
239
228
|
aria-selected={option.value === value}
|
|
240
229
|
aria-disabled={option.disabled}
|
|
241
230
|
onclick={() => choose(option)}
|
|
242
|
-
onpointermove={() => (
|
|
231
|
+
onpointermove={() => (cursor.index = index)}
|
|
243
232
|
class="flex cursor-pointer flex-col gap-0.5 px-3 py-2 text-[14px] transition-colors duration-100
|
|
244
233
|
{option.disabled ? 'pointer-events-none opacity-40' : ''}
|
|
245
234
|
{index === active ? toneSoft[tone] : 'text-text-secondary'}"
|