@human-kit/ui 1.0.0-beta.4 → 1.0.0-beta.6
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 +19 -17
- package/dist/accordion/README.md +3 -3
- package/dist/accordion/types.d.ts +37 -23
- package/dist/autocomplete/README.md +6 -7
- package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
- package/dist/autocomplete/empty/autocomplete-empty.svelte.d.ts +1 -1
- package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
- package/dist/autocomplete/input/autocomplete-input.svelte.d.ts +3 -3
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +2 -2
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte.d.ts +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +2 -2
- package/dist/autocomplete/root/autocomplete.svelte +7 -7
- package/dist/autocomplete/root/autocomplete.svelte.d.ts +7 -7
- package/dist/autocomplete/status/autocomplete-status.svelte +1 -1
- package/dist/autocomplete/status/autocomplete-status.svelte.d.ts +1 -1
- package/dist/button/README.md +1 -1
- package/dist/button/root/button-root.svelte +15 -10
- package/dist/button/root/button-root.svelte.d.ts +15 -10
- package/dist/calendar/README.md +3 -3
- package/dist/calendar/grid-header/calendar-grid-header.svelte +3 -4
- package/dist/calendar/grid-header/calendar-grid-header.svelte.d.ts +3 -4
- package/dist/calendar/root/calendar-root.svelte +8 -2
- package/dist/calendar/root/calendar-root.svelte.d.ts +8 -2
- package/dist/calendar/trigger-next/README.md +1 -1
- package/dist/calendar/trigger-previous/README.md +1 -1
- package/dist/checkbox/README.md +1 -1
- package/dist/checkbox/indicator/README.md +1 -1
- package/dist/checkbox/root/README.md +2 -2
- package/dist/checkbox/root/checkbox-root.svelte +12 -10
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +12 -10
- package/dist/clock/README.md +3 -3
- package/dist/clock/axis/README.md +1 -1
- package/dist/clock/root/README.md +1 -1
- package/dist/clock/wheel-column/clock-wheel-column.svelte +1 -1
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +1 -1
- package/dist/collapsible/README.md +3 -3
- package/dist/collapsible/types.d.ts +10 -7
- package/dist/combobox/README.md +2 -2
- package/dist/combobox/button/README.md +6 -6
- package/dist/combobox/input/README.md +1 -1
- package/dist/combobox/input/combobox-input.svelte +3 -3
- package/dist/combobox/input/combobox-input.svelte.d.ts +3 -3
- package/dist/combobox/item/combobox-listboxitem.svelte +4 -2
- package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +4 -2
- package/dist/combobox/item-indicator/README.md +1 -1
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte +2 -2
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte.d.ts +2 -2
- package/dist/combobox/list/combobox-listbox.svelte +11 -8
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +11 -8
- package/dist/combobox/popover/README.md +1 -1
- package/dist/combobox/root/README.md +24 -24
- package/dist/combobox/root/combobox.svelte +26 -17
- package/dist/combobox/root/combobox.svelte.d.ts +26 -17
- package/dist/combobox/status/README.md +1 -1
- package/dist/combobox/status/combobox-status.svelte +1 -1
- package/dist/combobox/status/combobox-status.svelte.d.ts +1 -1
- package/dist/combobox/tag/README.md +1 -1
- package/dist/combobox/tag/combobox-tag.svelte +1 -1
- package/dist/combobox/tag/combobox-tag.svelte.d.ts +1 -1
- package/dist/combobox/tag-remove/README.md +1 -1
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte +4 -5
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +4 -5
- package/dist/combobox/tags/README.md +1 -1
- package/dist/combobox/tags/combobox-tags.svelte +11 -11
- package/dist/combobox/tags/combobox-tags.svelte.d.ts +11 -11
- package/dist/combobox/trigger/README.md +7 -7
- package/dist/datepicker/README.md +4 -4
- package/dist/datepicker/input/date-picker-input.svelte +3 -4
- package/dist/datepicker/input/date-picker-input.svelte.d.ts +3 -4
- package/dist/datepicker/root/date-picker-root.svelte +1 -1
- package/dist/datepicker/trigger/README.md +1 -1
- package/dist/daterangepicker/README.md +3 -3
- package/dist/daterangepicker/input/date-range-picker-input.svelte +3 -4
- package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +3 -4
- package/dist/dialog/README.md +1 -1
- package/dist/dialog/close/dialog-close.svelte +3 -3
- package/dist/dialog/close/dialog-close.svelte.d.ts +3 -3
- package/dist/dialog/content/dialog-content.svelte +4 -4
- package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
- package/dist/dialog/description/dialog-description.svelte +3 -3
- package/dist/dialog/description/dialog-description.svelte.d.ts +3 -3
- package/dist/dialog/overlay/dialog-overlay.svelte +1 -1
- package/dist/dialog/overlay/dialog-overlay.svelte.d.ts +1 -1
- package/dist/dialog/portal/dialog-portal.svelte +1 -1
- package/dist/dialog/portal/dialog-portal.svelte.d.ts +1 -1
- package/dist/dialog/root/README.md +1 -1
- package/dist/dialog/root/dialog-root.svelte +36 -11
- package/dist/dialog/root/dialog-root.svelte.d.ts +11 -9
- package/dist/dialog/title/dialog-title.svelte +3 -3
- package/dist/dialog/title/dialog-title.svelte.d.ts +3 -3
- package/dist/dialog/trigger/README.md +1 -1
- package/dist/drawer/README.md +3 -3
- package/dist/drawer/body/drawer-body.svelte +2 -2
- package/dist/drawer/body/drawer-body.svelte.d.ts +2 -2
- package/dist/drawer/close/drawer-close.svelte +3 -3
- package/dist/drawer/close/drawer-close.svelte.d.ts +3 -3
- package/dist/drawer/content/drawer-content.svelte +12 -9
- package/dist/drawer/content/drawer-content.svelte.d.ts +12 -9
- package/dist/drawer/description/drawer-description.svelte +3 -3
- package/dist/drawer/description/drawer-description.svelte.d.ts +3 -3
- package/dist/drawer/indent/drawer-indent-background.svelte +1 -1
- package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +1 -1
- package/dist/drawer/indent/drawer-indent.svelte +2 -2
- package/dist/drawer/indent/drawer-indent.svelte.d.ts +2 -2
- package/dist/drawer/overlay/drawer-overlay.svelte +1 -1
- package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +1 -1
- package/dist/drawer/portal/drawer-portal.svelte +1 -1
- package/dist/drawer/portal/drawer-portal.svelte.d.ts +1 -1
- package/dist/drawer/root/context.d.ts +1 -1
- package/dist/drawer/root/drawer-root.svelte +25 -23
- package/dist/drawer/root/drawer-root.svelte.d.ts +25 -23
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +3 -3
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +3 -3
- package/dist/drawer/title/drawer-title.svelte +3 -3
- package/dist/drawer/title/drawer-title.svelte.d.ts +3 -3
- package/dist/drawer/trigger/drawer-trigger.svelte +6 -6
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +6 -6
- package/dist/drawer/viewport/drawer-viewport.svelte +2 -2
- package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +2 -2
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +1 -1
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +1 -1
- package/dist/dropzone/README.md +4 -6
- package/dist/input/input.svelte +6 -6
- package/dist/input/input.svelte.d.ts +6 -6
- package/dist/listbox/README.md +3 -10
- package/dist/listbox/item/listbox-item.svelte +24 -15
- package/dist/listbox/item/listbox-item.svelte.d.ts +24 -15
- package/dist/listbox/root/README.md +1 -1
- package/dist/listbox/root/context.d.ts +1 -1
- package/dist/listbox/root/listbox.svelte +50 -38
- package/dist/listbox/root/listbox.svelte.d.ts +50 -38
- package/dist/locale-provider/README.md +1 -6
- package/dist/menu/README.md +6 -15
- package/dist/menu/content/menu-content.svelte +14 -10
- package/dist/menu/content/menu-content.svelte.d.ts +14 -10
- package/dist/menu/context-trigger/menu-context-trigger.svelte +8 -9
- package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +8 -9
- package/dist/menu/group/menu-group-label.svelte +1 -1
- package/dist/menu/group/menu-group-label.svelte.d.ts +1 -1
- package/dist/menu/item/menu-item.svelte +11 -8
- package/dist/menu/item/menu-item.svelte.d.ts +11 -8
- package/dist/menu/overlay/menu-overlay.svelte +1 -1
- package/dist/menu/overlay/menu-overlay.svelte.d.ts +1 -1
- package/dist/menu/root/context.d.ts +6 -3
- package/dist/menu/root/menu-root.svelte +14 -8
- package/dist/menu/root/menu-root.svelte.d.ts +14 -8
- package/dist/menu/root/menu-state.svelte.d.ts +1 -1
- package/dist/menu/separator/menu-separator.svelte +1 -1
- package/dist/menu/separator/menu-separator.svelte.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-root.svelte +10 -7
- package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +10 -7
- package/dist/numberfield/root/README.md +1 -1
- package/dist/numberfield/scrub-area-cursor/README.md +1 -1
- package/dist/popover/README.md +1 -1
- package/dist/popover/content/popover-content.svelte +19 -14
- package/dist/popover/content/popover-content.svelte.d.ts +19 -14
- package/dist/popover/overlay/popover-overlay.svelte +1 -1
- package/dist/popover/overlay/popover-overlay.svelte.d.ts +1 -1
- package/dist/popover/root/README.md +1 -1
- package/dist/popover/root/popover-root.svelte +13 -10
- package/dist/popover/root/popover-root.svelte.d.ts +13 -10
- package/dist/popover/trigger/README.md +1 -1
- package/dist/primitives/floating.d.ts +3 -3
- package/dist/primitives/scroll-lock.js +37 -8
- package/dist/switch/root/README.md +2 -2
- package/dist/switch/root/switch-root.svelte +23 -18
- package/dist/switch/root/switch-root.svelte.d.ts +23 -18
- package/dist/switch/thumb/switch-thumb.svelte +1 -1
- package/dist/switch/thumb/switch-thumb.svelte.d.ts +1 -1
- package/dist/table/README.md +15 -10
- package/dist/table/checkbox-indicator/README.md +1 -1
- package/dist/table/column-resizer/README.md +2 -2
- package/dist/table/root/README.md +1 -1
- package/dist/table/sort-trigger/README.md +1 -1
- package/dist/table/types.d.ts +21 -20
- package/dist/tabs/types.d.ts +6 -6
- package/dist/timepicker/README.md +3 -2
- package/dist/timepicker/input/README.md +1 -1
- package/dist/timepicker/input/time-picker-input.svelte +58 -5
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +10 -1
- package/dist/timepicker/root/README.md +1 -1
- package/dist/timepicker/trigger/README.md +1 -1
- package/dist/toggle/README.md +1 -1
- package/dist/toggle-group/README.md +6 -0
- package/dist/toggle-group/root/context.svelte.d.ts +1 -1
- package/dist/toggle-group/root/context.svelte.js +20 -11
- package/dist/toggle-group/root/toggle-group-root.svelte +20 -15
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte +13 -0
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte.d.ts +7 -0
- package/dist/toggle-group/types.d.ts +9 -9
- package/dist/transfer-list/README.md +6 -17
- package/dist/transfer-list/item/transfer-list-item.svelte +4 -4
- package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +4 -4
- package/dist/transfer-list/list/transfer-list-list.svelte +12 -12
- package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +12 -12
- package/dist/transfer-list/move/transfer-list-move-button.svelte +4 -4
- package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +4 -4
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte +3 -3
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +3 -3
- package/dist/transfer-list/root/transfer-list-root.svelte +23 -20
- package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +23 -20
- package/dist/transfer-list/status/transfer-list-status.svelte +1 -1
- package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +1 -1
- package/dist/tree/README.md +3 -3
- package/dist/tree/checkbox-indicator/README.md +1 -1
- package/dist/tree/root/README.md +1 -1
- package/dist/tree/types.d.ts +19 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# @human-kit/ui
|
|
2
2
|
|
|
3
|
-
Accessible
|
|
3
|
+
Accessible UI components for **Svelte 5**.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
The components use Svelte 5 runes and have full types. The package is native
|
|
6
|
+
ESM, and each component has a subpath export, thus your bundler includes only
|
|
7
|
+
the components that you import.
|
|
7
8
|
|
|
8
9
|
**[Documentation and live demos → ui.human-kit.com](https://ui.human-kit.com)**
|
|
9
10
|
|
|
@@ -25,7 +26,7 @@ Svelte 5 is a peer dependency:
|
|
|
25
26
|
|
|
26
27
|
## Usage
|
|
27
28
|
|
|
28
|
-
Import from the package
|
|
29
|
+
Import from the root of the package:
|
|
29
30
|
|
|
30
31
|
```svelte
|
|
31
32
|
<script lang="ts">
|
|
@@ -33,7 +34,7 @@ Import from the package root:
|
|
|
33
34
|
</script>
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
For the smallest bundle, import one component from its subpath:
|
|
37
38
|
|
|
38
39
|
```svelte
|
|
39
40
|
<script lang="ts">
|
|
@@ -51,18 +52,18 @@ Or import a single component via its subpath for the leanest bundle:
|
|
|
51
52
|
| Date & time | `Calendar`, `Clock`, `DatePicker`, `DateRangePicker`, `TimePicker` |
|
|
52
53
|
| Layout | `Accordion`, `Collapsible`, `Tabs`, `Table`, `Tree`, `OverflowRow` |
|
|
53
54
|
| Actions | `Button` |
|
|
54
|
-
| Utilities | `LocaleProvider`, primitives, and the `cn` class
|
|
55
|
+
| Utilities | `LocaleProvider`, primitives, and the `cn` class function |
|
|
55
56
|
|
|
56
|
-
Each component
|
|
57
|
-
`@human-kit/ui/calendar`).
|
|
57
|
+
Each component also has a subpath export, for example `@human-kit/ui/calendar`.
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Styles
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`data
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
The components are headless: they have no CSS, and they do not need a CSS
|
|
62
|
+
framework. Each part accepts a `class` attribute. Each part also shows its state
|
|
63
|
+
in `data-*` attributes, for example `data-state`, `data-disabled`,
|
|
64
|
+
`data-focus-visible`, and `data-pressed`. Thus you can write the styles in plain
|
|
65
|
+
CSS, in Tailwind, or in a different tool. Each component page in the
|
|
66
|
+
documentation gives the full list of the data attributes.
|
|
66
67
|
|
|
67
68
|
```svelte
|
|
68
69
|
<Button.Root class="rounded-md bg-black px-3 py-1.5 text-white data-[pressed]:opacity-80">
|
|
@@ -70,13 +71,14 @@ docs lists its full data-attribute contract.
|
|
|
70
71
|
</Button.Root>
|
|
71
72
|
```
|
|
72
73
|
|
|
73
|
-
The
|
|
74
|
-
|
|
74
|
+
The library has one dependency at run time:
|
|
75
|
+
[`@floating-ui/dom`](https://floating-ui.com). Only the components that put an
|
|
76
|
+
element against an anchor use it.
|
|
75
77
|
|
|
76
78
|
## Requirements
|
|
77
79
|
|
|
78
80
|
- Svelte `^5.0.0`
|
|
79
|
-
- Node.js 20
|
|
81
|
+
- Node.js version 20 or later
|
|
80
82
|
|
|
81
83
|
## License
|
|
82
84
|
|
package/dist/accordion/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
`Accordion` is a headless disclosure
|
|
5
|
+
`Accordion` is a headless disclosure component: a vertical or horizontal stack of sections that open and close. It has roving focus and disabled items. One section can be open, or more than one. You can control the open state, or the component can control it.
|
|
6
6
|
|
|
7
7
|
## Anatomy
|
|
8
8
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
- Provide a unique `value` on every `Accordion.Item`. The matching `Header`, `Trigger` and `Panel` read it from the item context, so you only declare it once.
|
|
36
36
|
- Use `value` / `onChange` for controlled state and `defaultValue` for uncontrolled state. Both are arrays of open item values.
|
|
37
|
-
- Set `selectionMode="multiple"` to
|
|
37
|
+
- Set `selectionMode="multiple"` to let more than one panel stay open. The default is `"single"`.
|
|
38
38
|
- Use `disallowEmptySelection` to keep at least one panel open.
|
|
39
39
|
- Use `disabled` on `Accordion.Item` to disable a single item, or `disabled` on `Accordion.Root` to disable the whole accordion.
|
|
40
40
|
- Use `orientation="horizontal"` to switch the arrow-key navigation axis.
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
- `Accordion.Trigger` renders button semantics with `aria-expanded` and `aria-controls`.
|
|
49
49
|
- `Accordion.Panel` renders `role="region"` and `aria-labelledby` pointing at its trigger, and is `hidden` + `inert` while collapsed. Set `region={false}` on panels of large accordions (the APG recommends avoiding `region` landmarks beyond roughly six panels) so assistive-technology landmark lists are not flooded.
|
|
50
50
|
- Arrow keys move focus between triggers, Home/End jump to the first or last enabled trigger, and focus wraps at the ends unless `loop={false}`.
|
|
51
|
-
- Enter
|
|
51
|
+
- The `Enter` key and the `Space` key open and close the panel with the focus, like a native button.
|
|
@@ -3,72 +3,86 @@ import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
|
3
3
|
import type { AccordionContext, AccordionOrientation, AccordionSelectionMode, AccordionValue } from './root/context.svelte';
|
|
4
4
|
export type { AccordionContext, AccordionOrientation, AccordionSelectionMode, AccordionValue } from './root/context.svelte';
|
|
5
5
|
export type AccordionRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The list of the values of the open items. By default it goes in the two directions: use
|
|
8
|
+
* `bind:value`.
|
|
9
|
+
*/
|
|
7
10
|
value?: AccordionValue[];
|
|
8
|
-
/**
|
|
11
|
+
/** The values of the items that are open at the start, for when you give no `value`. */
|
|
9
12
|
defaultValue?: AccordionValue[];
|
|
10
13
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the new value
|
|
14
|
-
* needs the write-back
|
|
14
|
+
* Give your own code full control of the state. The component stops to write back to `value`, and
|
|
15
|
+
* it reports only through `onChange`. Thus the parent can refuse a change: the parent does not
|
|
16
|
+
* send the new value down. The default is off, because `bind:value` is the usual case and it
|
|
17
|
+
* needs the write-back.
|
|
15
18
|
*/
|
|
16
19
|
controlledValue?: boolean;
|
|
17
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The component calls it with the new list of the open item values, after the user opens or
|
|
22
|
+
* closes a panel.
|
|
23
|
+
*/
|
|
18
24
|
onChange?: (value: AccordionValue[]) => void;
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The number of panels that can be open together: one with `'single'`, or more than one with
|
|
27
|
+
* `'multiple'`.
|
|
28
|
+
*/
|
|
20
29
|
selectionMode?: AccordionSelectionMode;
|
|
21
30
|
/** Disables every item in the accordion. */
|
|
22
31
|
disabled?: boolean;
|
|
23
|
-
/**
|
|
32
|
+
/** The axis of the arrow keys between the triggers. */
|
|
24
33
|
orientation?: AccordionOrientation;
|
|
25
|
-
/** Keeps
|
|
34
|
+
/** Keeps one panel open at all times. */
|
|
26
35
|
disallowEmptySelection?: boolean;
|
|
27
|
-
/**
|
|
36
|
+
/** At the first trigger and at the last trigger, the focus goes to the opposite end. */
|
|
28
37
|
loop?: boolean;
|
|
29
38
|
children?: Snippet;
|
|
30
39
|
class?: string;
|
|
31
40
|
id?: string;
|
|
32
|
-
/**
|
|
41
|
+
/** A bindable reference to the root element. */
|
|
33
42
|
element?: HTMLDivElement | null;
|
|
34
|
-
/**
|
|
43
|
+
/** An accordion context that your own code makes, for a complex composition. */
|
|
35
44
|
context?: AccordionContext;
|
|
36
45
|
};
|
|
37
46
|
export type AccordionItemProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
|
|
38
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The unique value of the item. The Header, the Trigger, and the Panel read it from the context.
|
|
49
|
+
*/
|
|
39
50
|
value: AccordionValue;
|
|
40
51
|
/** Disables this item only. */
|
|
41
52
|
disabled?: boolean;
|
|
42
53
|
children?: Snippet;
|
|
43
54
|
class?: string;
|
|
44
|
-
/**
|
|
55
|
+
/** A bindable reference to the item element. */
|
|
45
56
|
element?: HTMLDivElement | null;
|
|
46
57
|
};
|
|
47
58
|
export type AccordionHeaderProps = Omit<HTMLAttributes<HTMLHeadingElement>, 'children' | 'class'> & {
|
|
48
|
-
/**
|
|
59
|
+
/** The heading level of the element, to agree with the headings around it. */
|
|
49
60
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
50
61
|
children?: Snippet;
|
|
51
62
|
class?: string;
|
|
52
|
-
/**
|
|
63
|
+
/** A bindable reference to the heading element. */
|
|
53
64
|
element?: HTMLHeadingElement | null;
|
|
54
65
|
};
|
|
55
66
|
export type AccordionTriggerProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'type' | 'disabled' | 'role' | 'aria-expanded' | 'aria-controls'> & {
|
|
56
67
|
children?: Snippet;
|
|
57
68
|
class?: string;
|
|
58
|
-
/**
|
|
69
|
+
/** A bindable reference to the trigger button. */
|
|
59
70
|
element?: HTMLButtonElement | null;
|
|
60
71
|
};
|
|
61
72
|
export type AccordionPanelProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'role' | 'hidden' | 'aria-labelledby'> & {
|
|
62
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Keep the closed panel in the DOM, and hidden. Without it, the panel leaves the DOM after the
|
|
75
|
+
* exit animation.
|
|
76
|
+
*/
|
|
63
77
|
forceMount?: boolean;
|
|
64
78
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
79
|
+
* Makes the panel a `role="region"` landmark. The default is `true`. In an accordion with many
|
|
80
|
+
* items, set it to `false`. Above approximately six panels, the APG recommends no `region`,
|
|
81
|
+
* because too many landmarks make the landmark list difficult to use.
|
|
68
82
|
*/
|
|
69
83
|
region?: boolean;
|
|
70
84
|
children?: Snippet;
|
|
71
85
|
class?: string;
|
|
72
|
-
/**
|
|
86
|
+
/** A bindable reference to the panel element. */
|
|
73
87
|
element?: HTMLDivElement | null;
|
|
74
88
|
};
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
`Autocomplete` is
|
|
6
|
-
`ListBox`.
|
|
7
|
-
virtual focus through the list
|
|
8
|
-
in the input.
|
|
5
|
+
`Autocomplete` is a list that the user always sees and can filter: a search input above a
|
|
6
|
+
`ListBox`. When the user types, the component filters the items locally. The arrow keys
|
|
7
|
+
move a virtual focus through the list with `aria-activedescendant`, and the DOM focus
|
|
8
|
+
stays in the input. A `ComboBox` has a popover and an open state. An `Autocomplete` has
|
|
9
|
+
**neither**.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
and `onChange` to `Autocomplete.List`, exactly like a plain `ListBox`. The
|
|
12
|
-
Autocomplete only owns the search query, filtering and virtual focus.
|
|
11
|
+
The inner list holds the selection. Put `selectionMode`, `value`, `defaultValue`, and `onChange` on `Autocomplete.List`, like a plain `ListBox`. The Autocomplete controls only the search text, the filter, and the virtual focus.
|
|
13
12
|
|
|
14
13
|
## Usage guidelines
|
|
15
14
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Autocomplete.Empty - Rendered when no items match the current query.
|
|
8
8
|
*/
|
|
9
9
|
type AutocompleteEmptyProps = {
|
|
10
|
-
/**
|
|
10
|
+
/** The content while the list is empty. The default is "No results". */
|
|
11
11
|
children?: Snippet;
|
|
12
12
|
class?: string;
|
|
13
13
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
@@ -4,7 +4,7 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
4
4
|
* Autocomplete.Empty - Rendered when no items match the current query.
|
|
5
5
|
*/
|
|
6
6
|
type AutocompleteEmptyProps = {
|
|
7
|
-
/**
|
|
7
|
+
/** The content while the list is empty. The default is "No results". */
|
|
8
8
|
children?: Snippet;
|
|
9
9
|
class?: string;
|
|
10
10
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
} from '../../primitives/input-modality';
|
|
9
9
|
|
|
10
10
|
type AutocompleteInputProps = HTMLInputAttributes & {
|
|
11
|
-
/**
|
|
11
|
+
/** The accessible name of the input. */
|
|
12
12
|
'aria-label'?: string;
|
|
13
|
-
/**
|
|
13
|
+
/** The id of the element that gives this input its name. */
|
|
14
14
|
'aria-labelledby'?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** The id of the element that describes this input, for example the instructions. */
|
|
16
16
|
'aria-describedby'?: string;
|
|
17
17
|
class?: string;
|
|
18
18
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
type AutocompleteInputProps = HTMLInputAttributes & {
|
|
3
|
-
/**
|
|
3
|
+
/** The accessible name of the input. */
|
|
4
4
|
'aria-label'?: string;
|
|
5
|
-
/**
|
|
5
|
+
/** The id of the element that gives this input its name. */
|
|
6
6
|
'aria-labelledby'?: string;
|
|
7
|
-
/**
|
|
7
|
+
/** The id of the element that describes this input, for example the instructions. */
|
|
8
8
|
'aria-describedby'?: string;
|
|
9
9
|
class?: string;
|
|
10
10
|
};
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* Must be used inside Autocomplete.Item. Only renders when the item is selected.
|
|
14
14
|
*/
|
|
15
15
|
type AutocompleteItemIndicatorProps = {
|
|
16
|
-
/**
|
|
16
|
+
/** The content while the item is selected. The default is a check mark icon. */
|
|
17
17
|
children?: Snippet;
|
|
18
|
-
/**
|
|
18
|
+
/** Keeps the indicator in the DOM, for each selection state. */
|
|
19
19
|
forceMount?: boolean;
|
|
20
20
|
class?: string;
|
|
21
21
|
} & Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'children'>;
|
|
@@ -5,9 +5,9 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
5
5
|
* Must be used inside Autocomplete.Item. Only renders when the item is selected.
|
|
6
6
|
*/
|
|
7
7
|
type AutocompleteItemIndicatorProps = {
|
|
8
|
-
/**
|
|
8
|
+
/** The content while the item is selected. The default is a check mark icon. */
|
|
9
9
|
children?: Snippet;
|
|
10
|
-
/**
|
|
10
|
+
/** Keeps the indicator in the DOM, for each selection state. */
|
|
11
11
|
forceMount?: boolean;
|
|
12
12
|
class?: string;
|
|
13
13
|
} & Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'children'>;
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
| 'children'
|
|
23
23
|
| 'emptyPlaceholder'
|
|
24
24
|
> & {
|
|
25
|
-
/**
|
|
25
|
+
/** The items, for a list that the component makes from an array. */
|
|
26
26
|
items?: Iterable<T>;
|
|
27
|
-
/**
|
|
27
|
+
/** The content of the list. From an array of items, it receives one item. */
|
|
28
28
|
children?: Snippet<[T]> | Snippet;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -29,9 +29,9 @@ declare function $$render<T extends object = object>(): {
|
|
|
29
29
|
context?: ListBoxContext;
|
|
30
30
|
element?: HTMLElement;
|
|
31
31
|
}, "children" | "id" | "element" | "context" | "disableFocusHandling" | "emptyPlaceholder" | "items"> & {
|
|
32
|
-
/**
|
|
32
|
+
/** The items, for a list that the component makes from an array. */
|
|
33
33
|
items?: Iterable<T>;
|
|
34
|
-
/**
|
|
34
|
+
/** The content of the list. From an array of items, it receives one item. */
|
|
35
35
|
children?: Snippet<[T]> | Snippet;
|
|
36
36
|
};
|
|
37
37
|
exports: {};
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
import { useVirtualFocus } from '../../hooks/use-virtual-focus.svelte';
|
|
12
12
|
|
|
13
13
|
type AutocompleteProps = {
|
|
14
|
-
/**
|
|
14
|
+
/** A stable id, from which the component makes its internal ARIA ids. Give one on a server. */
|
|
15
15
|
id?: string;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
readonly?: boolean;
|
|
18
|
-
/**
|
|
18
|
+
/** The search text. You can bind it with `bind:inputValue`. */
|
|
19
19
|
inputValue?: string;
|
|
20
|
-
/**
|
|
20
|
+
/** The search text at the start, for when the component controls the state. */
|
|
21
21
|
defaultInputValue?: string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* The local filter function. The default compares the text and ignores the letter case. Set it
|
|
24
|
+
* to `null` to stop the local filter, for example when a server sends the filtered results.
|
|
25
25
|
*/
|
|
26
26
|
filter?: AutocompleteFilter | null;
|
|
27
|
-
/**
|
|
27
|
+
/** Highlights the first item that agrees with the search text, each time that text changes. */
|
|
28
28
|
autoHighlight?: boolean;
|
|
29
|
-
/**
|
|
29
|
+
/** The component calls it when the search text changes. */
|
|
30
30
|
onInputChange?: (value: string) => void;
|
|
31
31
|
children?: Snippet;
|
|
32
32
|
class?: string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import { type AutocompleteFilter } from './context';
|
|
3
3
|
type AutocompleteProps = {
|
|
4
|
-
/**
|
|
4
|
+
/** A stable id, from which the component makes its internal ARIA ids. Give one on a server. */
|
|
5
5
|
id?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
readonly?: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/** The search text. You can bind it with `bind:inputValue`. */
|
|
9
9
|
inputValue?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** The search text at the start, for when the component controls the state. */
|
|
11
11
|
defaultInputValue?: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The local filter function. The default compares the text and ignores the letter case. Set it
|
|
14
|
+
* to `null` to stop the local filter, for example when a server sends the filtered results.
|
|
15
15
|
*/
|
|
16
16
|
filter?: AutocompleteFilter | null;
|
|
17
|
-
/**
|
|
17
|
+
/** Highlights the first item that agrees with the search text, each time that text changes. */
|
|
18
18
|
autoHighlight?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** The component calls it when the search text changes. */
|
|
20
20
|
onInputChange?: (value: string) => void;
|
|
21
21
|
children?: Snippet;
|
|
22
22
|
class?: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* of available results to screen readers as the query changes.
|
|
7
7
|
*/
|
|
8
8
|
type AutocompleteStatusProps = {
|
|
9
|
-
/**
|
|
9
|
+
/** Makes the announced message from the number of the items that the user sees. */
|
|
10
10
|
formatMessage?: (count: number) => string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* of available results to screen readers as the query changes.
|
|
4
4
|
*/
|
|
5
5
|
type AutocompleteStatusProps = {
|
|
6
|
-
/**
|
|
6
|
+
/** Makes the announced message from the number of the items that the user sees. */
|
|
7
7
|
formatMessage?: (count: number) => string;
|
|
8
8
|
};
|
|
9
9
|
declare const AutocompleteStatus: import("svelte").Component<AutocompleteStatusProps, {}, "">;
|
package/dist/button/README.md
CHANGED
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
|
|
45
45
|
## Notes
|
|
46
46
|
|
|
47
|
-
-
|
|
47
|
+
- If the type is `submit` and `pending` is true, the component makes the element with the type `button`. Thus the form does not submit.
|
|
48
48
|
- Pending does not serialize `data-disabled`; it is represented by `data-pending`.
|
|
@@ -20,26 +20,31 @@
|
|
|
20
20
|
HTMLButtonAttributes,
|
|
21
21
|
'children' | 'class' | 'disabled' | 'aria-disabled'
|
|
22
22
|
> & {
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The content. As a snippet with one argument, it receives the live render state: hovered,
|
|
25
|
+
* pressed, focused, and pending.
|
|
26
|
+
*/
|
|
24
27
|
children?: Snippet<[ButtonRenderState]> | Snippet;
|
|
25
28
|
class?: string;
|
|
26
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Keeps the button focusable, but stops the activation. It announces the pending state politely.
|
|
31
|
+
*/
|
|
27
32
|
pending?: boolean | null;
|
|
28
33
|
/** Disables the button natively. */
|
|
29
34
|
disabled?: boolean | null;
|
|
30
35
|
/**
|
|
31
|
-
* Keeps a disabled button in the tab order
|
|
32
|
-
*
|
|
36
|
+
* Keeps a disabled button in the tab order. The button gets `aria-disabled` and not the native
|
|
37
|
+
* attribute. The component still stops the activation.
|
|
33
38
|
*
|
|
34
|
-
*
|
|
35
|
-
* transfer list, a toolbar that
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* Use it for a control that is unavailable more often than available. The move buttons of a
|
|
40
|
+
* transfer list are one example, and a toolbar that obeys a selection is another. If you disable
|
|
41
|
+
* those natively, a keyboard user does not find them, and the tab order changes while the user
|
|
42
|
+
* works. `pending` says "busy". This says "not applicable".
|
|
38
43
|
*/
|
|
39
44
|
focusableWhenDisabled?: boolean | null;
|
|
40
|
-
/**
|
|
45
|
+
/** A bindable reference to the button element. */
|
|
41
46
|
element?: HTMLButtonElement | null;
|
|
42
|
-
/**
|
|
47
|
+
/** Replaces the pressed state that the component holds. */
|
|
43
48
|
pressed?: boolean;
|
|
44
49
|
};
|
|
45
50
|
|
|
@@ -9,26 +9,31 @@ export type ButtonRenderState = {
|
|
|
9
9
|
pending: boolean;
|
|
10
10
|
};
|
|
11
11
|
type ButtonRootProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'disabled' | 'aria-disabled'> & {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The content. As a snippet with one argument, it receives the live render state: hovered,
|
|
14
|
+
* pressed, focused, and pending.
|
|
15
|
+
*/
|
|
13
16
|
children?: Snippet<[ButtonRenderState]> | Snippet;
|
|
14
17
|
class?: string;
|
|
15
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Keeps the button focusable, but stops the activation. It announces the pending state politely.
|
|
20
|
+
*/
|
|
16
21
|
pending?: boolean | null;
|
|
17
22
|
/** Disables the button natively. */
|
|
18
23
|
disabled?: boolean | null;
|
|
19
24
|
/**
|
|
20
|
-
* Keeps a disabled button in the tab order
|
|
21
|
-
*
|
|
25
|
+
* Keeps a disabled button in the tab order. The button gets `aria-disabled` and not the native
|
|
26
|
+
* attribute. The component still stops the activation.
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
* transfer list, a toolbar that
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* Use it for a control that is unavailable more often than available. The move buttons of a
|
|
29
|
+
* transfer list are one example, and a toolbar that obeys a selection is another. If you disable
|
|
30
|
+
* those natively, a keyboard user does not find them, and the tab order changes while the user
|
|
31
|
+
* works. `pending` says "busy". This says "not applicable".
|
|
27
32
|
*/
|
|
28
33
|
focusableWhenDisabled?: boolean | null;
|
|
29
|
-
/**
|
|
34
|
+
/** A bindable reference to the button element. */
|
|
30
35
|
element?: HTMLButtonElement | null;
|
|
31
|
-
/**
|
|
36
|
+
/** Replaces the pressed state that the component holds. */
|
|
32
37
|
pressed?: boolean;
|
|
33
38
|
};
|
|
34
39
|
declare const ButtonRoot: import("svelte").Component<ButtonRootProps, {}, "element">;
|
package/dist/calendar/README.md
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
- In controlled mode, use `value` with `onChange`; in uncontrolled mode, use `defaultValue`.
|
|
12
12
|
- In `single` mode, `value/defaultValue` is `YYYY-MM-DD`.
|
|
13
13
|
- In `range` mode, `value/defaultValue` is `{ start?: 'YYYY-MM-DD', end?: 'YYYY-MM-DD' }`.
|
|
14
|
-
- `visibleMonths`
|
|
14
|
+
- `visibleMonths` sets the number of the months, and it changes how far the triggers move.
|
|
15
15
|
- `showOutsideDays` controls whether days outside the current month are shown; default is `false`.
|
|
16
16
|
- `isDateUnavailable` marks specific days as non-focusable and non-selectable.
|
|
17
17
|
- Use `LocaleProvider` to localize month/day labels and first day of week.
|
|
18
18
|
- Use `firstDayOfWeek` to override the locale-specified first day of the week.
|
|
19
|
-
- Use `monthHeadingStyle="month-year"` on `Calendar.Root` to
|
|
19
|
+
- Use `monthHeadingStyle="month-year"` on `Calendar.Root` to make the heading in two parts: the month and the year. An example is `May 2026`, in place of one string from the locale.
|
|
20
20
|
- Use `weekdayStyle="narrow" | "short" | "long"` on `Calendar.Grid` to control weekday header labels.
|
|
21
21
|
- Keyboard navigation uses `Arrow` keys for day/week movement and `Home/End` for month edges.
|
|
22
22
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
## Internal Notes
|
|
40
40
|
|
|
41
|
-
- `PageUp
|
|
41
|
+
- The `PageUp` key and the `PageDown` key keep the day number when they cross a month. The new month can have no day that takes the focus, while a range is not complete. The focus then goes to the last available day of the current month. The `Home` key and the `End` key do the same.
|
|
42
42
|
- In `selectionMode="range"`, the first click starts the range (`start`) and the second click confirms it (`end`), with automatic normalization for reversed selection order.
|
|
43
43
|
- In `selectionMode="range"`, hover updates a live preview before confirmation.
|
|
44
44
|
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
type CalendarGridHeaderProps = {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* `weekdayStyle
|
|
11
|
-
*
|
|
12
|
-
* Wednesday in some locales).
|
|
9
|
+
* Your own content for a header cell. It receives the weekday name in the length of
|
|
10
|
+
* `weekdayStyle`, and also the long weekday name. Use the long name as the accessible name when
|
|
11
|
+
* the short one is narrow. In some locales, "M" is the narrow name of Monday and of Wednesday.
|
|
13
12
|
*/
|
|
14
13
|
children?: Snippet<[string, string]>;
|
|
15
14
|
class?: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
type CalendarGridHeaderProps = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `weekdayStyle
|
|
6
|
-
*
|
|
7
|
-
* Wednesday in some locales).
|
|
4
|
+
* Your own content for a header cell. It receives the weekday name in the length of
|
|
5
|
+
* `weekdayStyle`, and also the long weekday name. Use the long name as the accessible name when
|
|
6
|
+
* the short one is narrow. In some locales, "M" is the narrow name of Monday and of Wednesday.
|
|
8
7
|
*/
|
|
9
8
|
children?: Snippet<[string, string]>;
|
|
10
9
|
class?: string;
|
|
@@ -42,9 +42,15 @@
|
|
|
42
42
|
showOutsideDays?: boolean;
|
|
43
43
|
firstDayOfWeek?: CalendarFirstDayOfWeek;
|
|
44
44
|
monthHeadingStyle?: CalendarMonthHeadingStyle;
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The first date that the user can select (`YYYY-MM-DD`). A date before it is unavailable, and
|
|
47
|
+
* the triggers and the focus stop at this limit.
|
|
48
|
+
*/
|
|
46
49
|
minValue?: CalendarDateValue;
|
|
47
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The last date that the user can select (`YYYY-MM-DD`). A date after it is unavailable, and the
|
|
52
|
+
* triggers and the focus stop at this limit.
|
|
53
|
+
*/
|
|
48
54
|
maxValue?: CalendarDateValue;
|
|
49
55
|
isDateUnavailable?: (date: string) => boolean;
|
|
50
56
|
disabled?: boolean;
|