@sveltia/ui 0.91.0 → 0.92.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/dist/components/bottom-navigation/bottom-navigation.svelte +3 -9
- package/dist/components/bottom-navigation/bottom-navigation.svelte.d.ts +4 -39
- package/dist/components/button/button-group.svelte +2 -4
- package/dist/components/button/button-group.svelte.d.ts +3 -19
- package/dist/components/button/select-button-group.svelte +2 -13
- package/dist/components/button/select-button-group.svelte.d.ts +5 -67
- package/dist/components/calendar/calendar.d.ts +9 -0
- package/dist/components/calendar/calendar.js +43 -0
- package/dist/components/calendar/calendar.svelte +26 -27
- package/dist/components/checkbox/checkbox-group.svelte +2 -8
- package/dist/components/checkbox/checkbox-group.svelte.d.ts +4 -39
- package/dist/components/dialog/alert-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/confirmation-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/dialog.svelte +6 -7
- package/dist/components/dialog/dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/prompt-dialog.svelte +2 -2
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +2 -3
- package/dist/components/disclosure/disclosure.svelte +14 -16
- package/dist/components/disclosure/disclosure.svelte.d.ts +4 -38
- package/dist/components/drawer/drawer.svelte +22 -39
- package/dist/components/drawer/drawer.svelte.d.ts +3 -24
- package/dist/components/grid/grid-body.svelte +2 -3
- package/dist/components/grid/grid-body.svelte.d.ts +3 -18
- package/dist/components/grid/grid-cell.svelte +2 -8
- package/dist/components/grid/grid-cell.svelte.d.ts +3 -22
- package/dist/components/grid/grid-col-header.svelte +2 -4
- package/dist/components/grid/grid-col-header.svelte.d.ts +3 -19
- package/dist/components/grid/grid-foot.svelte +4 -9
- package/dist/components/grid/grid-foot.svelte.d.ts +3 -22
- package/dist/components/grid/grid-head.svelte +4 -9
- package/dist/components/grid/grid-head.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row-header.svelte +2 -8
- package/dist/components/grid/grid-row-header.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row.svelte +4 -5
- package/dist/components/grid/grid-row.svelte.d.ts +3 -19
- package/dist/components/grid/grid.d.ts +10 -0
- package/dist/components/grid/grid.js +11 -0
- package/dist/components/grid/grid.svelte +6 -7
- package/dist/components/grid/grid.svelte.d.ts +5 -21
- package/dist/components/listbox/listbox.svelte +34 -15
- package/dist/components/listbox/listbox.svelte.d.ts +5 -69
- package/dist/components/listbox/option-group.svelte +2 -8
- package/dist/components/listbox/option-group.svelte.d.ts +4 -39
- package/dist/components/listbox/option.svelte +2 -1
- package/dist/components/menu/menu-item-group.svelte +2 -6
- package/dist/components/menu/menu-item-group.svelte.d.ts +3 -22
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu.svelte +2 -8
- package/dist/components/menu/menu.svelte.d.ts +4 -39
- package/dist/components/radio/radio-group.svelte +2 -17
- package/dist/components/radio/radio-group.svelte.d.ts +5 -67
- package/dist/components/radio/radio.svelte +19 -22
- package/dist/components/radio/radio.svelte.d.ts +10 -40
- package/dist/components/resizable-pane/resizable-handle.svelte +42 -49
- package/dist/components/resizable-pane/resizable-pane-group.svelte +44 -58
- package/dist/components/resizable-pane/resizable-pane-group.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/resizable-pane.svelte +2 -5
- package/dist/components/resizable-pane/resizable-pane.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/sizing.d.ts +24 -0
- package/dist/components/resizable-pane/sizing.js +83 -0
- package/dist/components/select/combobox.svelte +35 -39
- package/dist/components/select/select-tags.svelte +3 -13
- package/dist/components/select/select-tags.svelte.d.ts +5 -67
- package/dist/components/slider/slider.d.ts +5 -4
- package/dist/components/slider/slider.js +28 -23
- package/dist/components/slider/slider.svelte +64 -62
- package/dist/components/slider/slider.svelte.d.ts +4 -37
- package/dist/components/switch/switch.svelte +2 -13
- package/dist/components/switch/switch.svelte.d.ts +5 -67
- package/dist/components/table/table-body.svelte +2 -4
- package/dist/components/table/table-body.svelte.d.ts +3 -19
- package/dist/components/table/table-cell.svelte +2 -8
- package/dist/components/table/table-cell.svelte.d.ts +3 -22
- package/dist/components/table/table-col-header.svelte +2 -8
- package/dist/components/table/table-col-header.svelte.d.ts +3 -22
- package/dist/components/table/table-foot.svelte +2 -8
- package/dist/components/table/table-foot.svelte.d.ts +3 -22
- package/dist/components/table/table-head.svelte +2 -8
- package/dist/components/table/table-head.svelte.d.ts +3 -22
- package/dist/components/table/table-part.svelte +2 -4
- package/dist/components/table/table-part.svelte.d.ts +3 -19
- package/dist/components/table/table-row-header.svelte +2 -8
- package/dist/components/table/table-row-header.svelte.d.ts +3 -22
- package/dist/components/table/table-row.svelte +2 -8
- package/dist/components/table/table-row.svelte.d.ts +3 -22
- package/dist/components/table/table.svelte +2 -4
- package/dist/components/table/table.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-box.svelte +2 -4
- package/dist/components/tabs/tab-box.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-list.svelte +2 -7
- package/dist/components/tabs/tab-list.svelte.d.ts +4 -37
- package/dist/components/tabs/tab-panel.svelte +2 -8
- package/dist/components/tabs/tab-panel.svelte.d.ts +3 -22
- package/dist/components/tabs/tab-panels.svelte +2 -8
- package/dist/components/tabs/tab-panels.svelte.d.ts +3 -22
- package/dist/components/text-editor/code-editor.js +14 -7
- package/dist/components/text-editor/code-editor.svelte +14 -22
- package/dist/components/text-editor/code-editor.svelte.d.ts +5 -103
- package/dist/components/text-editor/config.d.ts +73 -0
- package/dist/components/text-editor/config.js +110 -0
- package/dist/components/text-editor/conversion/editor-components.js +4 -4
- package/dist/components/text-editor/conversion/html/export.js +1 -1
- package/dist/components/text-editor/conversion/import.js +32 -26
- package/dist/components/text-editor/conversion/markdown/block-conversion.d.ts +4 -0
- package/dist/components/text-editor/conversion/markdown/block-conversion.js +154 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.d.ts +16 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.js +254 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.d.ts +57 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.js +279 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.d.ts +19 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.js +71 -0
- package/dist/components/text-editor/conversion/markdown/formatting.d.ts +22 -0
- package/dist/components/text-editor/conversion/markdown/formatting.js +451 -0
- package/dist/components/text-editor/conversion/markdown/index.d.ts +10 -0
- package/dist/components/text-editor/conversion/markdown/index.js +55 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.d.ts +2 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.js +229 -0
- package/dist/components/text-editor/conversion/markdown/syntax.d.ts +99 -0
- package/dist/components/text-editor/conversion/markdown/syntax.js +206 -0
- package/dist/components/text-editor/conversion/placeholder-chars.d.ts +43 -0
- package/dist/components/text-editor/conversion/placeholder-chars.js +51 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.d.ts +1 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.js +53 -26
- package/dist/components/text-editor/conversion/transformers/code.d.ts +3 -14
- package/dist/components/text-editor/conversion/transformers/code.js +78 -16
- package/dist/components/text-editor/conversion/transformers/formatted-code.js +3 -18
- package/dist/components/text-editor/conversion/transformers/inline-code.js +3 -1
- package/dist/components/text-editor/conversion/transformers/link.js +3 -1
- package/dist/components/text-editor/conversion/transformers/raw-syntax.d.ts +0 -19
- package/dist/components/text-editor/conversion/transformers/raw-syntax.js +22 -93
- package/dist/components/text-editor/conversion/transformers/table.js +57 -16
- package/dist/components/text-editor/conversion/update.d.ts +19 -2
- package/dist/components/text-editor/conversion/update.js +63 -39
- package/dist/components/text-editor/core.d.ts +12 -51
- package/dist/components/text-editor/core.js +44 -66
- package/dist/components/text-editor/editing/raw-markdown.d.ts +3 -0
- package/dist/components/text-editor/editing/raw-markdown.js +46 -2
- package/dist/components/text-editor/lexical-root.svelte +49 -47
- package/dist/components/text-editor/lexical-root.svelte.d.ts +4 -67
- package/dist/components/text-editor/shiki/{facade.d.ts → engine.d.ts} +8 -8
- package/dist/components/text-editor/shiki/{facade.js → engine.js} +53 -156
- package/dist/components/text-editor/shiki/highlighter.js +5 -5
- package/dist/components/text-editor/shiki/lexical.d.ts +6 -0
- package/dist/components/text-editor/shiki/lexical.js +165 -0
- package/dist/components/text-editor/shiki/preload.js +1 -1
- package/dist/components/text-editor/shiki/source-highlight.svelte.d.ts +15 -0
- package/dist/components/text-editor/shiki/source-highlight.svelte.js +120 -0
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/store.svelte.js +65 -16
- package/dist/components/text-editor/text-editor.svelte +53 -145
- package/dist/components/text-editor/text-editor.svelte.d.ts +5 -103
- package/dist/components/text-editor/toolbar/actions.d.ts +25 -0
- package/dist/components/text-editor/toolbar/actions.js +107 -0
- package/dist/components/text-editor/toolbar/align-menu-button.svelte +16 -14
- package/dist/components/text-editor/toolbar/format-text-button.svelte +26 -24
- package/dist/components/text-editor/toolbar/insert-horizontal-rule-button.svelte +23 -23
- package/dist/components/text-editor/toolbar/insert-item-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +47 -51
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-table-button.svelte +35 -52
- package/dist/components/text-editor/toolbar/table-action-menu.svelte +19 -17
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +16 -4
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte.d.ts +0 -8
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +34 -33
- package/dist/components/text-editor/widgets/emoji-autocomplete.svelte +7 -6
- package/dist/components/text-editor/widgets/floating-link-editor.svelte +19 -32
- package/dist/components/text-editor/widgets/table-cell-menu-button.svelte +28 -32
- package/dist/components/text-field/date-time-input.svelte +7 -8
- package/dist/components/text-field/date-time-input.svelte.d.ts +3 -32
- package/dist/components/text-field/number-input.d.ts +0 -2
- package/dist/components/text-field/number-input.js +25 -25
- package/dist/components/text-field/number-input.svelte +18 -9
- package/dist/components/text-field/number-input.svelte.d.ts +1 -1
- package/dist/components/text-field/text-area.d.ts +2 -0
- package/dist/components/text-field/text-area.js +31 -0
- package/dist/components/text-field/text-area.svelte +12 -25
- package/dist/components/text-field/text-area.svelte.d.ts +5 -67
- package/dist/components/toast/toast.svelte +31 -8
- package/dist/components/toast/toast.svelte.d.ts +6 -6
- package/dist/components/toolbar/toolbar.svelte +2 -7
- package/dist/components/toolbar/toolbar.svelte.d.ts +4 -37
- package/dist/components/tree/tree-item.svelte +2 -6
- package/dist/components/tree/tree-item.svelte.d.ts +3 -22
- package/dist/components/tree/tree.svelte +3 -10
- package/dist/components/tree/tree.svelte.d.ts +4 -39
- package/dist/components/util/group.svelte +2 -7
- package/dist/components/util/group.svelte.d.ts +4 -37
- package/dist/components/util/modal.d.ts +9 -0
- package/dist/components/util/modal.js +30 -0
- package/dist/components/util/modal.svelte +33 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/hu.yaml +176 -0
- package/dist/services/composite-widget.svelte.d.ts +76 -0
- package/dist/services/composite-widget.svelte.js +157 -0
- package/dist/services/focus.d.ts +2 -0
- package/dist/services/focus.js +68 -0
- package/dist/services/group.svelte.d.ts +17 -69
- package/dist/services/group.svelte.js +128 -391
- package/dist/services/label.d.ts +9 -0
- package/dist/services/label.js +22 -0
- package/dist/services/menu.d.ts +8 -0
- package/dist/services/menu.js +237 -0
- package/dist/services/navigation.d.ts +9 -0
- package/dist/services/navigation.js +13 -0
- package/dist/services/number.d.ts +2 -0
- package/dist/services/number.js +27 -0
- package/dist/services/pointer-drag.d.ts +14 -0
- package/dist/services/pointer-drag.js +89 -0
- package/dist/services/popup.svelte.js +123 -103
- package/dist/services/text.d.ts +3 -0
- package/dist/services/text.js +17 -0
- package/dist/services/tree.svelte.d.ts +29 -43
- package/dist/services/tree.svelte.js +58 -105
- package/dist/services/type-ahead.d.ts +10 -1
- package/dist/services/type-ahead.js +56 -34
- package/dist/typedefs.d.ts +103 -4
- package/dist/typedefs.js +60 -4
- package/package.json +2 -2
- package/dist/components/text-editor/conversion/markdown.d.ts +0 -56
- package/dist/components/text-editor/conversion/markdown.js +0 -949
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +0 -28
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte.d.ts +0 -37
- package/dist/components/text-editor/toolbar/insert-component.d.ts +0 -3
- package/dist/components/text-editor/toolbar/insert-component.js +0 -37
|
@@ -6,22 +6,18 @@
|
|
|
6
6
|
import { _ } from '@sveltia/i18n';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @import { CommonEventHandlers } from '../../typedefs.js';
|
|
9
|
+
* @import { CommonEventHandlers, WidgetStateProps } from '../../typedefs.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {object} Props
|
|
14
14
|
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
15
|
-
* @property {boolean} [hidden] Whether to hide the widget. An alias of the `aria-hidden`
|
|
16
|
-
* attribute.
|
|
17
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
18
|
-
* attribute.
|
|
19
15
|
* @property {string} [label] Text label displayed above the group items.
|
|
20
16
|
* @property {string} [title] Deprecated: use `label` instead.
|
|
21
17
|
*/
|
|
22
18
|
|
|
23
19
|
/**
|
|
24
|
-
* @type {CommonEventHandlers & Props & Record<string, any>}
|
|
20
|
+
* @type {CommonEventHandlers & WidgetStateProps & Props & Record<string, any>}
|
|
25
21
|
*/
|
|
26
22
|
let {
|
|
27
23
|
/* eslint-disable prefer-const */
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
export default MenuItemGroup;
|
|
2
2
|
type MenuItemGroup = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & WidgetStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/** A menu item group. */
|
|
7
|
-
declare const MenuItemGroup: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & {
|
|
7
|
+
declare const MenuItemGroup: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & WidgetStateProps & {
|
|
8
8
|
/**
|
|
9
9
|
* The `class` attribute on the wrapper element.
|
|
10
10
|
*/
|
|
11
11
|
class?: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
14
|
-
* attribute.
|
|
15
|
-
*/
|
|
16
|
-
hidden?: boolean | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
19
|
-
* attribute.
|
|
20
|
-
*/
|
|
21
|
-
disabled?: boolean | undefined;
|
|
22
12
|
/**
|
|
23
13
|
* Text label displayed above the group items.
|
|
24
14
|
*/
|
|
@@ -33,16 +23,6 @@ type Props = {
|
|
|
33
23
|
* The `class` attribute on the wrapper element.
|
|
34
24
|
*/
|
|
35
25
|
class?: string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
38
|
-
* attribute.
|
|
39
|
-
*/
|
|
40
|
-
hidden?: boolean | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
43
|
-
* attribute.
|
|
44
|
-
*/
|
|
45
|
-
disabled?: boolean | undefined;
|
|
46
26
|
/**
|
|
47
27
|
* Text label displayed above the group items.
|
|
48
28
|
*/
|
|
@@ -52,3 +32,4 @@ type Props = {
|
|
|
52
32
|
*/
|
|
53
33
|
title?: string | undefined;
|
|
54
34
|
};
|
|
35
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
@@ -161,7 +161,11 @@
|
|
|
161
161
|
{@render _endIcon?.()}
|
|
162
162
|
{/snippet}
|
|
163
163
|
</Button>
|
|
164
|
-
|
|
164
|
+
<!--
|
|
165
|
+
A menu in a popup shares its `<dialog>` with the submenu, while a menu placed directly on the
|
|
166
|
+
page leaves the submenu to open its own
|
|
167
|
+
-->
|
|
168
|
+
{#if hasItems && buttonElement}
|
|
165
169
|
<Popup
|
|
166
170
|
anchor={buttonElement}
|
|
167
171
|
parentDialogElement={dialogElement}
|
|
@@ -8,23 +8,17 @@
|
|
|
8
8
|
import { activateGroup } from '../../services/group.svelte.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @import {
|
|
11
|
+
* @import { ContainerProps, WidgetStateProps } from '../../typedefs.js';
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @typedef {object} Props
|
|
16
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
17
|
-
* @property {boolean} [hidden] Whether to hide the widget. An alias of the `aria-hidden`
|
|
18
|
-
* attribute.
|
|
19
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
20
|
-
* attribute.
|
|
21
16
|
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
22
|
-
* @property {Snippet} [children] Primary slot content.
|
|
23
17
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
24
18
|
*/
|
|
25
19
|
|
|
26
20
|
/**
|
|
27
|
-
* @type {Props & Record<string, any>}
|
|
21
|
+
* @type {ContainerProps & WidgetStateProps & Props & Record<string, any>}
|
|
28
22
|
*/
|
|
29
23
|
let {
|
|
30
24
|
/* eslint-disable prefer-const */
|
|
@@ -1,67 +1,32 @@
|
|
|
1
1
|
export default Menu;
|
|
2
2
|
type Menu = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<ContainerProps & WidgetStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A menu widget.
|
|
8
8
|
* @see https://w3c.github.io/aria/#menu
|
|
9
9
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
|
|
10
10
|
*/
|
|
11
|
-
declare const Menu: import("svelte").Component<{
|
|
12
|
-
/**
|
|
13
|
-
* The `class` attribute on the wrapper element.
|
|
14
|
-
*/
|
|
15
|
-
class?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
18
|
-
* attribute.
|
|
19
|
-
*/
|
|
20
|
-
hidden?: boolean | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
23
|
-
* attribute.
|
|
24
|
-
*/
|
|
25
|
-
disabled?: boolean | undefined;
|
|
11
|
+
declare const Menu: import("svelte").Component<ContainerProps & WidgetStateProps & {
|
|
26
12
|
/**
|
|
27
13
|
* The `aria-label` attribute on the wrapper element.
|
|
28
14
|
*/
|
|
29
15
|
ariaLabel?: string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Primary slot content.
|
|
32
|
-
*/
|
|
33
|
-
children?: Snippet<[]> | undefined;
|
|
34
16
|
/**
|
|
35
17
|
* Custom `Change` event handler.
|
|
36
18
|
*/
|
|
37
19
|
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
38
20
|
} & Record<string, any>, {}, "">;
|
|
39
21
|
type Props = {
|
|
40
|
-
/**
|
|
41
|
-
* The `class` attribute on the wrapper element.
|
|
42
|
-
*/
|
|
43
|
-
class?: string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
46
|
-
* attribute.
|
|
47
|
-
*/
|
|
48
|
-
hidden?: boolean | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
51
|
-
* attribute.
|
|
52
|
-
*/
|
|
53
|
-
disabled?: boolean | undefined;
|
|
54
22
|
/**
|
|
55
23
|
* The `aria-label` attribute on the wrapper element.
|
|
56
24
|
*/
|
|
57
25
|
ariaLabel?: string | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Primary slot content.
|
|
60
|
-
*/
|
|
61
|
-
children?: Snippet<[]> | undefined;
|
|
62
26
|
/**
|
|
63
27
|
* Custom `Change` event handler.
|
|
64
28
|
*/
|
|
65
29
|
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
66
30
|
};
|
|
67
|
-
import type {
|
|
31
|
+
import type { ContainerProps } from '../../typedefs.js';
|
|
32
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
@@ -8,30 +8,19 @@
|
|
|
8
8
|
import { activateGroup } from '../../services/group.svelte.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @import {
|
|
11
|
+
* @import { ContainerProps, FormFieldStateProps, WidgetStateProps } from '../../typedefs.js';
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @typedef {object} Props
|
|
16
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
17
|
-
* @property {boolean} [hidden] Whether to hide the widget.
|
|
18
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
19
|
-
* attribute.
|
|
20
|
-
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
21
|
-
* `aria-readonly` attribute.
|
|
22
|
-
* @property {boolean} [required] Whether to mark the widget required. An alias of the
|
|
23
|
-
* `aria-required` attribute.
|
|
24
|
-
* @property {boolean} [invalid] Whether to mark the widget invalid. An alias of the
|
|
25
|
-
* `aria-invalid` attribute.
|
|
26
16
|
* @property {'horizontal'|'vertical'} [orientation] Orientation of the widget. An alias of the
|
|
27
17
|
* `aria-orientation` attribute.
|
|
28
18
|
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
29
|
-
* @property {Snippet} [children] Primary slot content.
|
|
30
19
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
31
20
|
*/
|
|
32
21
|
|
|
33
22
|
/**
|
|
34
|
-
* @type {Props & Record<string, any>}
|
|
23
|
+
* @type {ContainerProps & WidgetStateProps & FormFieldStateProps & Props & Record<string, any>}
|
|
35
24
|
*/
|
|
36
25
|
let {
|
|
37
26
|
/* eslint-disable prefer-const */
|
|
@@ -44,7 +33,6 @@
|
|
|
44
33
|
orientation = 'horizontal',
|
|
45
34
|
ariaLabel = undefined,
|
|
46
35
|
children,
|
|
47
|
-
onChange,
|
|
48
36
|
...restProps
|
|
49
37
|
/* eslint-enable prefer-const */
|
|
50
38
|
} = $props();
|
|
@@ -63,9 +51,6 @@
|
|
|
63
51
|
aria-invalid={invalid}
|
|
64
52
|
aria-orientation={orientation}
|
|
65
53
|
aria-label={ariaLabel}
|
|
66
|
-
onChange={(/** @type {CustomEvent} */ event) => {
|
|
67
|
-
onChange?.(event);
|
|
68
|
-
}}
|
|
69
54
|
{@attach activateGroup()}
|
|
70
55
|
>
|
|
71
56
|
<div role="none" class="inner" inert={disabled}>
|
|
@@ -1,42 +1,14 @@
|
|
|
1
1
|
export default RadioGroup;
|
|
2
2
|
type RadioGroup = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<ContainerProps & WidgetStateProps & FormFieldStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* The container of `<Radio>`s.
|
|
8
8
|
* @see https://w3c.github.io/aria/#radiogroup
|
|
9
9
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
10
10
|
*/
|
|
11
|
-
declare const RadioGroup: import("svelte").Component<{
|
|
12
|
-
/**
|
|
13
|
-
* The `class` attribute on the wrapper element.
|
|
14
|
-
*/
|
|
15
|
-
class?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Whether to hide the widget.
|
|
18
|
-
*/
|
|
19
|
-
hidden?: boolean | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
22
|
-
* attribute.
|
|
23
|
-
*/
|
|
24
|
-
disabled?: boolean | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to make the widget read-only. An alias of the
|
|
27
|
-
* `aria-readonly` attribute.
|
|
28
|
-
*/
|
|
29
|
-
readonly?: boolean | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to mark the widget required. An alias of the
|
|
32
|
-
* `aria-required` attribute.
|
|
33
|
-
*/
|
|
34
|
-
required?: boolean | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Whether to mark the widget invalid. An alias of the
|
|
37
|
-
* `aria-invalid` attribute.
|
|
38
|
-
*/
|
|
39
|
-
invalid?: boolean | undefined;
|
|
11
|
+
declare const RadioGroup: import("svelte").Component<ContainerProps & WidgetStateProps & FormFieldStateProps & {
|
|
40
12
|
/**
|
|
41
13
|
* Orientation of the widget. An alias of the
|
|
42
14
|
* `aria-orientation` attribute.
|
|
@@ -46,44 +18,12 @@ declare const RadioGroup: import("svelte").Component<{
|
|
|
46
18
|
* The `aria-label` attribute on the wrapper element.
|
|
47
19
|
*/
|
|
48
20
|
ariaLabel?: string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Primary slot content.
|
|
51
|
-
*/
|
|
52
|
-
children?: Snippet<[]> | undefined;
|
|
53
21
|
/**
|
|
54
22
|
* Custom `Change` event handler.
|
|
55
23
|
*/
|
|
56
24
|
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
57
25
|
} & Record<string, any>, {}, "">;
|
|
58
26
|
type Props = {
|
|
59
|
-
/**
|
|
60
|
-
* The `class` attribute on the wrapper element.
|
|
61
|
-
*/
|
|
62
|
-
class?: string | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Whether to hide the widget.
|
|
65
|
-
*/
|
|
66
|
-
hidden?: boolean | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
69
|
-
* attribute.
|
|
70
|
-
*/
|
|
71
|
-
disabled?: boolean | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Whether to make the widget read-only. An alias of the
|
|
74
|
-
* `aria-readonly` attribute.
|
|
75
|
-
*/
|
|
76
|
-
readonly?: boolean | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Whether to mark the widget required. An alias of the
|
|
79
|
-
* `aria-required` attribute.
|
|
80
|
-
*/
|
|
81
|
-
required?: boolean | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Whether to mark the widget invalid. An alias of the
|
|
84
|
-
* `aria-invalid` attribute.
|
|
85
|
-
*/
|
|
86
|
-
invalid?: boolean | undefined;
|
|
87
27
|
/**
|
|
88
28
|
* Orientation of the widget. An alias of the
|
|
89
29
|
* `aria-orientation` attribute.
|
|
@@ -93,13 +33,11 @@ type Props = {
|
|
|
93
33
|
* The `aria-label` attribute on the wrapper element.
|
|
94
34
|
*/
|
|
95
35
|
ariaLabel?: string | undefined;
|
|
96
|
-
/**
|
|
97
|
-
* Primary slot content.
|
|
98
|
-
*/
|
|
99
|
-
children?: Snippet<[]> | undefined;
|
|
100
36
|
/**
|
|
101
37
|
* Custom `Change` event handler.
|
|
102
38
|
*/
|
|
103
39
|
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
104
40
|
};
|
|
105
|
-
import type {
|
|
41
|
+
import type { ContainerProps } from '../../typedefs.js';
|
|
42
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
43
|
+
import type { FormFieldStateProps } from '../../typedefs.js';
|
|
@@ -6,19 +6,17 @@
|
|
|
6
6
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
|
+
import { untrack } from 'svelte';
|
|
9
10
|
import { getToggleLabelAttrs } from '../../services/label.js';
|
|
10
11
|
import Button from '../button/button.svelte';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @import { Snippet } from 'svelte';
|
|
15
|
+
* @import { ContainerProps, WidgetStateProps } from '../../typedefs.js';
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* @typedef {object} Props
|
|
18
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
19
|
-
* @property {boolean} [hidden] Whether to hide the widget.
|
|
20
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
21
|
-
* attribute.
|
|
22
20
|
* @property {boolean} [checked] Whether to check the widget. An alias of the `aria-checked`
|
|
23
21
|
* attribute.
|
|
24
22
|
* @property {string} [name] The `data-name` attribute on the `<button>` element.
|
|
@@ -28,17 +26,17 @@
|
|
|
28
26
|
* @property {string} [label] Text label displayed next to the radio button.
|
|
29
27
|
* @property {string} [ariaLabel] `aria-label` attribute on the `<button>` element, for a radio
|
|
30
28
|
* button without a visible label.
|
|
31
|
-
* @property {
|
|
29
|
+
* @property {any} [group] The two-way bound variable to manage the state of a group of radio
|
|
32
30
|
* buttons. It works in the same way as the [`<input
|
|
33
|
-
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte
|
|
34
|
-
*
|
|
31
|
+
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte: it can hold any
|
|
32
|
+
* type of value, including `undefined` before a choice is made.
|
|
35
33
|
* @property {Snippet} [default] Default slot content.
|
|
36
34
|
* @property {(event: CustomEvent) => void} [onChange] Custom `Change` event handler.
|
|
37
35
|
* @property {(event: CustomEvent) => void} [onSelect] Custom `Select` event handler.
|
|
38
36
|
*/
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
|
-
* @type {Props & Record<string, any>}
|
|
39
|
+
* @type {ContainerProps & WidgetStateProps & Props & Record<string, any>}
|
|
42
40
|
*/
|
|
43
41
|
let {
|
|
44
42
|
/* eslint-disable prefer-const */
|
|
@@ -82,17 +80,19 @@
|
|
|
82
80
|
const isGroupReadOnly = () =>
|
|
83
81
|
!!buttonElement?.closest('[role="radiogroup"]')?.matches('[aria-readonly="true"]');
|
|
84
82
|
|
|
85
|
-
// Sync `checked` with `group` and `value`
|
|
83
|
+
// Sync `checked` with `group` and `value`. An unbound `group` and a bound one that’s still
|
|
84
|
+
// `undefined` read the same, so leave `checked` alone until there’s a choice. Only a change to
|
|
85
|
+
// `group` or `value` triggers the sync, not one to `checked`: without a bound `group`, the one
|
|
86
|
+
// set on a click stays local to this radio button, and must not check it again when the group
|
|
87
|
+
// unchecks it as the arrow keys move.
|
|
86
88
|
$effect(() => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} else if (checked) {
|
|
93
|
-
checked = false;
|
|
89
|
+
const isChecked = group !== undefined && group === value;
|
|
90
|
+
|
|
91
|
+
untrack(() => {
|
|
92
|
+
if (group !== undefined && checked !== isChecked) {
|
|
93
|
+
checked = isChecked;
|
|
94
94
|
}
|
|
95
|
-
}
|
|
95
|
+
});
|
|
96
96
|
});
|
|
97
97
|
</script>
|
|
98
98
|
|
|
@@ -133,10 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
checked = true;
|
|
136
|
-
|
|
137
|
-
if (typeof group === 'string') {
|
|
138
|
-
group = value;
|
|
139
|
-
}
|
|
136
|
+
group = value;
|
|
140
137
|
}}
|
|
141
138
|
onChange={(/** @type {CustomEvent} */ event) => {
|
|
142
139
|
// The group checks and unchecks the radio buttons by itself, as the arrow keys move, so keep
|
|
@@ -144,7 +141,7 @@
|
|
|
144
141
|
// checked and ignore the next click
|
|
145
142
|
checked = event.detail.checked;
|
|
146
143
|
|
|
147
|
-
if (checked
|
|
144
|
+
if (checked) {
|
|
148
145
|
group = value;
|
|
149
146
|
}
|
|
150
147
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Radio;
|
|
2
2
|
type Radio = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<ContainerProps & WidgetStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* The equivalent of the HTML `<input type="radio">` element.
|
|
@@ -9,20 +9,7 @@ type Radio = {
|
|
|
9
9
|
* @see https://w3c.github.io/aria/#radio
|
|
10
10
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
11
11
|
*/
|
|
12
|
-
declare const Radio: import("svelte").Component<{
|
|
13
|
-
/**
|
|
14
|
-
* The `class` attribute on the wrapper element.
|
|
15
|
-
*/
|
|
16
|
-
class?: string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Whether to hide the widget.
|
|
19
|
-
*/
|
|
20
|
-
hidden?: boolean | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
23
|
-
* attribute.
|
|
24
|
-
*/
|
|
25
|
-
disabled?: boolean | undefined;
|
|
12
|
+
declare const Radio: import("svelte").Component<ContainerProps & WidgetStateProps & {
|
|
26
13
|
/**
|
|
27
14
|
* Whether to check the widget. An alias of the `aria-checked`
|
|
28
15
|
* attribute.
|
|
@@ -53,13 +40,10 @@ declare const Radio: import("svelte").Component<{
|
|
|
53
40
|
/**
|
|
54
41
|
* The two-way bound variable to manage the state of a group of radio
|
|
55
42
|
* buttons. It works in the same way as the [`<input
|
|
56
|
-
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte
|
|
57
|
-
|
|
58
|
-
group?: string | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Primary slot content.
|
|
43
|
+
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte: it can hold any
|
|
44
|
+
* type of value, including `undefined` before a choice is made.
|
|
61
45
|
*/
|
|
62
|
-
|
|
46
|
+
group?: any;
|
|
63
47
|
/**
|
|
64
48
|
* Default slot content.
|
|
65
49
|
*/
|
|
@@ -74,19 +58,6 @@ declare const Radio: import("svelte").Component<{
|
|
|
74
58
|
onSelect?: ((event: CustomEvent) => void) | undefined;
|
|
75
59
|
} & Record<string, any>, {}, "group">;
|
|
76
60
|
type Props = {
|
|
77
|
-
/**
|
|
78
|
-
* The `class` attribute on the wrapper element.
|
|
79
|
-
*/
|
|
80
|
-
class?: string | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Whether to hide the widget.
|
|
83
|
-
*/
|
|
84
|
-
hidden?: boolean | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
87
|
-
* attribute.
|
|
88
|
-
*/
|
|
89
|
-
disabled?: boolean | undefined;
|
|
90
61
|
/**
|
|
91
62
|
* Whether to check the widget. An alias of the `aria-checked`
|
|
92
63
|
* attribute.
|
|
@@ -117,13 +88,10 @@ type Props = {
|
|
|
117
88
|
/**
|
|
118
89
|
* The two-way bound variable to manage the state of a group of radio
|
|
119
90
|
* buttons. It works in the same way as the [`<input
|
|
120
|
-
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte
|
|
121
|
-
|
|
122
|
-
group?: string | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* Primary slot content.
|
|
91
|
+
* bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte: it can hold any
|
|
92
|
+
* type of value, including `undefined` before a choice is made.
|
|
125
93
|
*/
|
|
126
|
-
|
|
94
|
+
group?: any;
|
|
127
95
|
/**
|
|
128
96
|
* Default slot content.
|
|
129
97
|
*/
|
|
@@ -137,4 +105,6 @@ type Props = {
|
|
|
137
105
|
*/
|
|
138
106
|
onSelect?: ((event: CustomEvent) => void) | undefined;
|
|
139
107
|
};
|
|
108
|
+
import type { ContainerProps } from '../../typedefs.js';
|
|
109
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
140
110
|
import type { Snippet } from 'svelte';
|