@sveltia/ui 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/components/composite/calendar.svelte +239 -0
- package/package/components/composite/calendar.svelte.d.ts +27 -0
- package/package/components/composite/checkbox-group.svelte +43 -0
- package/package/components/composite/checkbox-group.svelte.d.ts +34 -0
- package/package/components/composite/combobox.svelte +208 -0
- package/package/components/composite/combobox.svelte.d.ts +47 -0
- package/package/components/composite/disclosure.svelte +60 -0
- package/package/components/composite/disclosure.svelte.d.ts +35 -0
- package/package/components/composite/grid.svelte +24 -0
- package/package/components/composite/grid.svelte.d.ts +31 -0
- package/package/components/composite/listbox.svelte +63 -0
- package/package/components/composite/listbox.svelte.d.ts +52 -0
- package/package/components/composite/menu-item-group.svelte +31 -0
- package/package/components/composite/menu-item-group.svelte.d.ts +33 -0
- package/package/components/composite/menu.svelte +44 -0
- package/package/components/composite/menu.svelte.d.ts +41 -0
- package/package/components/composite/radio-button-group.svelte +45 -0
- package/package/components/composite/radio-button-group.svelte.d.ts +36 -0
- package/package/components/composite/select-button-group.svelte +71 -0
- package/package/components/composite/select-button-group.svelte.d.ts +44 -0
- package/package/components/composite/select.svelte +34 -0
- package/package/components/composite/select.svelte.d.ts +38 -0
- package/package/components/composite/tab-list.svelte +76 -0
- package/package/components/composite/tab-list.svelte.d.ts +55 -0
- package/package/components/core/button.svelte +222 -0
- package/package/components/core/button.svelte.d.ts +109 -0
- package/package/components/core/checkbox.svelte +114 -0
- package/package/components/core/checkbox.svelte.d.ts +45 -0
- package/package/components/core/dialog.svelte +288 -0
- package/package/components/core/dialog.svelte.d.ts +73 -0
- package/package/components/core/drawer.svelte +338 -0
- package/package/components/core/drawer.svelte.d.ts +59 -0
- package/package/components/core/grid-cell.svelte +14 -0
- package/package/components/core/grid-cell.svelte.d.ts +29 -0
- package/package/components/core/group.svelte +31 -0
- package/package/components/core/group.svelte.d.ts +33 -0
- package/package/components/core/icon.svelte +21 -0
- package/package/components/core/icon.svelte.d.ts +27 -0
- package/package/components/core/menu-button.svelte +57 -0
- package/package/components/core/menu-button.svelte.d.ts +46 -0
- package/package/components/core/menu-item-checkbox.svelte +24 -0
- package/package/components/core/menu-item-checkbox.svelte.d.ts +34 -0
- package/package/components/core/menu-item-radio.svelte +19 -0
- package/package/components/core/menu-item-radio.svelte.d.ts +34 -0
- package/package/components/core/menu-item.svelte +113 -0
- package/package/components/core/menu-item.svelte.d.ts +44 -0
- package/package/components/core/number-input.svelte +112 -0
- package/package/components/core/number-input.svelte.d.ts +42 -0
- package/package/components/core/option.svelte +65 -0
- package/package/components/core/option.svelte.d.ts +60 -0
- package/package/components/core/password-input.svelte +81 -0
- package/package/components/core/password-input.svelte.d.ts +36 -0
- package/package/components/core/radio-button.svelte +93 -0
- package/package/components/core/radio-button.svelte.d.ts +37 -0
- package/package/components/core/row-group.svelte +14 -0
- package/package/components/core/row-group.svelte.d.ts +29 -0
- package/package/components/core/row.svelte +14 -0
- package/package/components/core/row.svelte.d.ts +33 -0
- package/package/components/core/search-bar.svelte +91 -0
- package/package/components/core/search-bar.svelte.d.ts +49 -0
- package/package/components/core/select-button.svelte +31 -0
- package/package/components/core/select-button.svelte.d.ts +52 -0
- package/package/components/core/separator.svelte +28 -0
- package/package/components/core/separator.svelte.d.ts +26 -0
- package/package/components/core/slider.svelte +271 -0
- package/package/components/core/slider.svelte.d.ts +51 -0
- package/package/components/core/spacer.svelte +22 -0
- package/package/components/core/spacer.svelte.d.ts +25 -0
- package/package/components/core/switch.svelte +86 -0
- package/package/components/core/switch.svelte.d.ts +37 -0
- package/package/components/core/tab-panel.svelte +23 -0
- package/package/components/core/tab-panel.svelte.d.ts +33 -0
- package/package/components/core/tab.svelte +22 -0
- package/package/components/core/tab.svelte.d.ts +45 -0
- package/package/components/core/text-area.svelte +90 -0
- package/package/components/core/text-area.svelte.d.ts +57 -0
- package/package/components/core/text-input.svelte +146 -0
- package/package/components/core/text-input.svelte.d.ts +71 -0
- package/package/components/core/toolbar.svelte +74 -0
- package/package/components/core/toolbar.svelte.d.ts +35 -0
- package/package/components/editor/markdown.svelte +78 -0
- package/package/components/editor/markdown.svelte.d.ts +25 -0
- package/package/components/helpers/group.d.ts +37 -0
- package/package/components/helpers/group.js +246 -0
- package/package/components/helpers/popup.d.ts +31 -0
- package/package/components/helpers/popup.js +165 -0
- package/package/components/helpers/util.d.ts +1 -0
- package/package/components/helpers/util.js +8 -0
- package/package/components/util/app-shell.svelte +354 -0
- package/package/components/util/app-shell.svelte.d.ts +38 -0
- package/package/components/util/misc.d.ts +2 -0
- package/package/components/util/misc.js +22 -0
- package/package/components/util/popup.svelte +155 -0
- package/package/components/util/popup.svelte.d.ts +53 -0
- package/package/components/util/portal.svelte +34 -0
- package/package/components/util/portal.svelte.d.ts +28 -0
- package/package/index.d.ts +43 -0
- package/package/index.js +68 -0
- package/package/locales/en.d.ts +42 -0
- package/package/locales/en.js +41 -0
- package/package/locales/ja.d.ts +42 -0
- package/package/locales/ja.js +41 -0
- package/package/styles/core.scss +134 -0
- package/package/styles/variables.scss +184 -0
- package/package/typedef.d.ts +0 -0
- package/package/typedef.js +0 -0
- package/package.json +2 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://w3c.github.io/aria/#textbox
|
|
4
|
+
-->
|
|
5
|
+
<script>
|
|
6
|
+
import { _ } from 'svelte-i18n';
|
|
7
|
+
import Button from './button.svelte';
|
|
8
|
+
import Icon from './icon.svelte';
|
|
9
|
+
import TextInput from './text-input.svelte';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CSS class name on the button.
|
|
13
|
+
* @type {String}
|
|
14
|
+
*/
|
|
15
|
+
let className = '';
|
|
16
|
+
|
|
17
|
+
export { className as class };
|
|
18
|
+
|
|
19
|
+
/** @type {(String|undefined)} */
|
|
20
|
+
export let value = undefined;
|
|
21
|
+
|
|
22
|
+
export let disabled = false;
|
|
23
|
+
export let min = undefined;
|
|
24
|
+
export let max = undefined;
|
|
25
|
+
export let step = 1;
|
|
26
|
+
|
|
27
|
+
let component;
|
|
28
|
+
|
|
29
|
+
const decrease = () => {
|
|
30
|
+
if (typeof min === 'number' && Number(value || 0) === min) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
value = String(Number(value || 0) - step);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const increase = () => {
|
|
38
|
+
if (typeof min === 'number' && Number(value || 0) === max) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
value = String(Number(value || 0) + step);
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<div class="sui number-input {className}">
|
|
47
|
+
<TextInput
|
|
48
|
+
bind:this={component}
|
|
49
|
+
bind:value
|
|
50
|
+
{disabled}
|
|
51
|
+
role="spinbutton"
|
|
52
|
+
aria-valuenow={Number(value || 0)}
|
|
53
|
+
aria-invalid={value !== undefined && Number.isNaN(Number(value))}
|
|
54
|
+
{...$$restProps}
|
|
55
|
+
on:keydown={(event) => {
|
|
56
|
+
const { key, ctrlKey, metaKey, altKey, shiftKey } = event;
|
|
57
|
+
|
|
58
|
+
if (key === 'ArrowDown' && !ctrlKey && !metaKey && !altKey && !shiftKey) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
decrease();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (key === 'ArrowUp' && !ctrlKey && !metaKey && !altKey && !shiftKey) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
increase();
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
on:keypress
|
|
69
|
+
on:input
|
|
70
|
+
/>
|
|
71
|
+
<Button
|
|
72
|
+
class="iconic"
|
|
73
|
+
disabled={disabled || Number.isNaN(Number(value))}
|
|
74
|
+
on:click={() => {
|
|
75
|
+
decrease();
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<Icon slot="start-icon" name="arrow_downward" label={$_('_sui.number_input.decrease')} />
|
|
79
|
+
</Button>
|
|
80
|
+
<Button
|
|
81
|
+
class="iconic"
|
|
82
|
+
disabled={disabled || Number.isNaN(Number(value))}
|
|
83
|
+
on:click={() => {
|
|
84
|
+
increase();
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<Icon slot="start-icon" name={'arrow_upward'} label={$_('_sui.number_input.increase')} />
|
|
88
|
+
</Button>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<style>.number-input {
|
|
92
|
+
width: 100%;
|
|
93
|
+
display: inline-flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
}
|
|
96
|
+
.number-input :global(input) {
|
|
97
|
+
border-radius: 4px 0 0 4px;
|
|
98
|
+
}
|
|
99
|
+
.number-input :global(button) {
|
|
100
|
+
flex: none;
|
|
101
|
+
margin-left: -1px;
|
|
102
|
+
border-width: 1px;
|
|
103
|
+
border-color: var(--control-border-color);
|
|
104
|
+
width: 32px;
|
|
105
|
+
height: var(--input--medium--height);
|
|
106
|
+
}
|
|
107
|
+
.number-input :global(button):last-child {
|
|
108
|
+
border-radius: 0 4px 4px 0;
|
|
109
|
+
}
|
|
110
|
+
.number-input :global(button) :global(.icon) {
|
|
111
|
+
font-size: var(--font-size--xx-large);
|
|
112
|
+
}</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} NumberInputProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} NumberInputEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} NumberInputSlots */
|
|
4
|
+
/** @see https://w3c.github.io/aria/#textbox */
|
|
5
|
+
export default class NumberInput extends SvelteComponentTyped<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
class?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
value?: string;
|
|
10
|
+
min?: any;
|
|
11
|
+
max?: any;
|
|
12
|
+
step?: number;
|
|
13
|
+
}, {
|
|
14
|
+
keypress: KeyboardEvent;
|
|
15
|
+
input: Event;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}> {
|
|
19
|
+
}
|
|
20
|
+
export type NumberInputProps = typeof __propDef.props;
|
|
21
|
+
export type NumberInputEvents = typeof __propDef.events;
|
|
22
|
+
export type NumberInputSlots = typeof __propDef.slots;
|
|
23
|
+
import { SvelteComponentTyped } from "svelte";
|
|
24
|
+
declare const __propDef: {
|
|
25
|
+
props: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
class?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
value?: (string | undefined);
|
|
30
|
+
min?: any;
|
|
31
|
+
max?: any;
|
|
32
|
+
step?: number;
|
|
33
|
+
};
|
|
34
|
+
events: {
|
|
35
|
+
keypress: KeyboardEvent;
|
|
36
|
+
input: Event;
|
|
37
|
+
} & {
|
|
38
|
+
[evt: string]: CustomEvent<any>;
|
|
39
|
+
};
|
|
40
|
+
slots: {};
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://w3c.github.io/aria/#option
|
|
4
|
+
-->
|
|
5
|
+
<script>
|
|
6
|
+
import Button from './button.svelte';
|
|
7
|
+
import Icon from './icon.svelte';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CSS class name on the button.
|
|
11
|
+
* @type {String}
|
|
12
|
+
*/
|
|
13
|
+
let className = '';
|
|
14
|
+
|
|
15
|
+
export { className as class };
|
|
16
|
+
|
|
17
|
+
export let label = '';
|
|
18
|
+
export let value = undefined;
|
|
19
|
+
export let selected = false;
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div class="sui option {className}">
|
|
23
|
+
<Button
|
|
24
|
+
role="option"
|
|
25
|
+
aria-selected={selected}
|
|
26
|
+
{label}
|
|
27
|
+
{value}
|
|
28
|
+
data-type={typeof value}
|
|
29
|
+
{...$$restProps}
|
|
30
|
+
on:click
|
|
31
|
+
on:dragover
|
|
32
|
+
on:dragleave
|
|
33
|
+
on:dragend
|
|
34
|
+
on:drop
|
|
35
|
+
>
|
|
36
|
+
{#if selected}
|
|
37
|
+
<Icon class="check" name="check" />
|
|
38
|
+
{/if}
|
|
39
|
+
<slot name="start-icon" slot="start-icon" />
|
|
40
|
+
<slot />
|
|
41
|
+
<slot name="end-icon" slot="end-icon" />
|
|
42
|
+
</Button>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<style>.option {
|
|
46
|
+
display: contents;
|
|
47
|
+
}
|
|
48
|
+
.option :global([role="option"]) {
|
|
49
|
+
flex: none;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
gap: 4px;
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
padding: 0 8px 0 16px;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: var(--option--medium--height);
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
59
|
+
.option :global([role="option"]:hover) {
|
|
60
|
+
color: var(--highlight-foreground-color);
|
|
61
|
+
background-color: var(--highlight-background-color);
|
|
62
|
+
}
|
|
63
|
+
.option :global([role="option"][aria-selected="true"]) :global(.icon) {
|
|
64
|
+
color: var(--primary-accent-color-lighter);
|
|
65
|
+
}</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} OptionProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} OptionEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} OptionSlots */
|
|
4
|
+
/** @see https://w3c.github.io/aria/#option */
|
|
5
|
+
export default class Option extends SvelteComponentTyped<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
label?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
value?: any;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
}, {
|
|
12
|
+
click: MouseEvent;
|
|
13
|
+
dragover: DragEvent;
|
|
14
|
+
dragleave: DragEvent;
|
|
15
|
+
dragend: DragEvent;
|
|
16
|
+
drop: DragEvent;
|
|
17
|
+
} & {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {
|
|
20
|
+
'start-icon': {
|
|
21
|
+
slot: string;
|
|
22
|
+
};
|
|
23
|
+
default: {};
|
|
24
|
+
'end-icon': {
|
|
25
|
+
slot: string;
|
|
26
|
+
};
|
|
27
|
+
}> {
|
|
28
|
+
}
|
|
29
|
+
export type OptionProps = typeof __propDef.props;
|
|
30
|
+
export type OptionEvents = typeof __propDef.events;
|
|
31
|
+
export type OptionSlots = typeof __propDef.slots;
|
|
32
|
+
import { SvelteComponentTyped } from "svelte";
|
|
33
|
+
declare const __propDef: {
|
|
34
|
+
props: {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
label?: string;
|
|
37
|
+
class?: string;
|
|
38
|
+
value?: any;
|
|
39
|
+
selected?: boolean;
|
|
40
|
+
};
|
|
41
|
+
events: {
|
|
42
|
+
click: MouseEvent;
|
|
43
|
+
dragover: DragEvent;
|
|
44
|
+
dragleave: DragEvent;
|
|
45
|
+
dragend: DragEvent;
|
|
46
|
+
drop: DragEvent;
|
|
47
|
+
} & {
|
|
48
|
+
[evt: string]: CustomEvent<any>;
|
|
49
|
+
};
|
|
50
|
+
slots: {
|
|
51
|
+
'start-icon': {
|
|
52
|
+
slot: string;
|
|
53
|
+
};
|
|
54
|
+
default: {};
|
|
55
|
+
'end-icon': {
|
|
56
|
+
slot: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://w3c.github.io/aria/#textbox
|
|
4
|
+
-->
|
|
5
|
+
<script>
|
|
6
|
+
import { _ } from 'svelte-i18n';
|
|
7
|
+
import Button from './button.svelte';
|
|
8
|
+
import Icon from './icon.svelte';
|
|
9
|
+
import TextInput from './text-input.svelte';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CSS class name on the button.
|
|
13
|
+
* @type {String}
|
|
14
|
+
*/
|
|
15
|
+
let className = '';
|
|
16
|
+
|
|
17
|
+
export { className as class };
|
|
18
|
+
|
|
19
|
+
/** @type {(String|undefined)} */
|
|
20
|
+
export let value = undefined;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @type {TextInput}
|
|
24
|
+
*/
|
|
25
|
+
let inputComponent;
|
|
26
|
+
let passwordVisible = false;
|
|
27
|
+
|
|
28
|
+
$: {
|
|
29
|
+
if (inputComponent) {
|
|
30
|
+
inputComponent.element.setAttribute('type', passwordVisible ? 'text' : 'password');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div class="sui password-input {className}">
|
|
36
|
+
<TextInput
|
|
37
|
+
bind:this={inputComponent}
|
|
38
|
+
bind:value
|
|
39
|
+
type="password"
|
|
40
|
+
{...$$restProps}
|
|
41
|
+
on:input
|
|
42
|
+
on:keypress
|
|
43
|
+
on:change
|
|
44
|
+
/>
|
|
45
|
+
<Button
|
|
46
|
+
class="iconic"
|
|
47
|
+
pressed={passwordVisible}
|
|
48
|
+
on:click={() => {
|
|
49
|
+
passwordVisible = !passwordVisible;
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Icon
|
|
53
|
+
slot="start-icon"
|
|
54
|
+
name={passwordVisible ? 'visibility_off' : 'visibility'}
|
|
55
|
+
label={$_('_sui.password_input.show_password')}
|
|
56
|
+
/>
|
|
57
|
+
</Button>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>.password-input {
|
|
61
|
+
width: 100%;
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
.password-input :global(input) {
|
|
66
|
+
border-radius: 4px 0 0 4px;
|
|
67
|
+
}
|
|
68
|
+
.password-input :global(button) {
|
|
69
|
+
flex: none;
|
|
70
|
+
margin-left: -1px;
|
|
71
|
+
border-width: 1px;
|
|
72
|
+
border-color: var(--control-border-color);
|
|
73
|
+
height: var(--input--medium--height);
|
|
74
|
+
aspect-ratio: 1/1;
|
|
75
|
+
}
|
|
76
|
+
.password-input :global(button):last-child {
|
|
77
|
+
border-radius: 0 4px 4px 0;
|
|
78
|
+
}
|
|
79
|
+
.password-input :global(button) :global(.icon) {
|
|
80
|
+
font-size: var(--font-size--xx-large);
|
|
81
|
+
}</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} PasswordInputProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} PasswordInputEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} PasswordInputSlots */
|
|
4
|
+
/** @see https://w3c.github.io/aria/#textbox */
|
|
5
|
+
export default class PasswordInput extends SvelteComponentTyped<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
class?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
}, {
|
|
10
|
+
input: Event;
|
|
11
|
+
keypress: KeyboardEvent;
|
|
12
|
+
change: Event;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
}, {}> {
|
|
16
|
+
}
|
|
17
|
+
export type PasswordInputProps = typeof __propDef.props;
|
|
18
|
+
export type PasswordInputEvents = typeof __propDef.events;
|
|
19
|
+
export type PasswordInputSlots = typeof __propDef.slots;
|
|
20
|
+
import { SvelteComponentTyped } from "svelte";
|
|
21
|
+
declare const __propDef: {
|
|
22
|
+
props: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
class?: string;
|
|
25
|
+
value?: (string | undefined);
|
|
26
|
+
};
|
|
27
|
+
events: {
|
|
28
|
+
input: Event;
|
|
29
|
+
keypress: KeyboardEvent;
|
|
30
|
+
change: Event;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
};
|
|
34
|
+
slots: {};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://w3c.github.io/aria/#radio
|
|
4
|
+
@see https://w3c.github.io/aria-practices/#radiobutton
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
import { getRandomId } from '../helpers/util';
|
|
8
|
+
import Button from './button.svelte';
|
|
9
|
+
import Icon from './icon.svelte';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CSS class name on the button.
|
|
13
|
+
* @type {String}
|
|
14
|
+
*/
|
|
15
|
+
let className = '';
|
|
16
|
+
|
|
17
|
+
export { className as class };
|
|
18
|
+
|
|
19
|
+
/** @type {String} */
|
|
20
|
+
export let name = '';
|
|
21
|
+
|
|
22
|
+
/** @type {(String|undefined)} */
|
|
23
|
+
export let value = undefined;
|
|
24
|
+
|
|
25
|
+
/** @type {Boolean} */
|
|
26
|
+
export let selected = false;
|
|
27
|
+
|
|
28
|
+
const id = getRandomId('checkbox');
|
|
29
|
+
/** @type {Button} */
|
|
30
|
+
let buttonComponent;
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
{#if name && value && selected}
|
|
34
|
+
<input type="hidden" {name} {value} />
|
|
35
|
+
{/if}
|
|
36
|
+
|
|
37
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
38
|
+
<span
|
|
39
|
+
class="sui radio-button {className}"
|
|
40
|
+
on:click={(event) => {
|
|
41
|
+
if (!event.target.matches('button')) {
|
|
42
|
+
buttonComponent.element.click();
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<Button
|
|
47
|
+
{id}
|
|
48
|
+
role="radio"
|
|
49
|
+
aria-checked={selected}
|
|
50
|
+
aria-labelledby="{id}-label"
|
|
51
|
+
bind:this={buttonComponent}
|
|
52
|
+
on:click={(event) => {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
selected = !selected;
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<Icon slot="start-icon" name="circle" />
|
|
58
|
+
</Button>
|
|
59
|
+
<label id="{id}-label">
|
|
60
|
+
<slot />
|
|
61
|
+
</label>
|
|
62
|
+
</span>
|
|
63
|
+
|
|
64
|
+
<style>.radio-button {
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
color: inherit;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
-webkit-user-select: none;
|
|
71
|
+
user-select: none;
|
|
72
|
+
}
|
|
73
|
+
.radio-button :global(button) {
|
|
74
|
+
justify-content: center;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
border-width: 2px;
|
|
77
|
+
border-color: var(--control-border-color);
|
|
78
|
+
border-radius: 24px;
|
|
79
|
+
width: 24px;
|
|
80
|
+
height: 24px;
|
|
81
|
+
color: var(--primary-accent-color-lighter);
|
|
82
|
+
transition: all 200ms;
|
|
83
|
+
}
|
|
84
|
+
.radio-button :global(button) :global(.icon) {
|
|
85
|
+
font-size: var(--font-size--large);
|
|
86
|
+
font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 48;
|
|
87
|
+
}
|
|
88
|
+
.radio-button :global(button[aria-checked="true"]) {
|
|
89
|
+
color: var(--primary-accent-color-lighter);
|
|
90
|
+
}
|
|
91
|
+
.radio-button :global(button[aria-checked="false"]) {
|
|
92
|
+
color: transparent;
|
|
93
|
+
}</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} RadioButtonProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} RadioButtonEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} RadioButtonSlots */
|
|
4
|
+
/**
|
|
5
|
+
* @see https://w3c.github.io/aria/#radio
|
|
6
|
+
* @see https://w3c.github.io/aria-practices/#radiobutton
|
|
7
|
+
*/
|
|
8
|
+
export default class RadioButton extends SvelteComponentTyped<{
|
|
9
|
+
class?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
}, {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
}, {
|
|
16
|
+
default: {};
|
|
17
|
+
}> {
|
|
18
|
+
}
|
|
19
|
+
export type RadioButtonProps = typeof __propDef.props;
|
|
20
|
+
export type RadioButtonEvents = typeof __propDef.events;
|
|
21
|
+
export type RadioButtonSlots = typeof __propDef.slots;
|
|
22
|
+
import { SvelteComponentTyped } from "svelte";
|
|
23
|
+
declare const __propDef: {
|
|
24
|
+
props: {
|
|
25
|
+
class?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
value?: (string | undefined);
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
};
|
|
30
|
+
events: {
|
|
31
|
+
[evt: string]: CustomEvent<any>;
|
|
32
|
+
};
|
|
33
|
+
slots: {
|
|
34
|
+
default: {};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* CSS class name on the button.
|
|
4
|
+
* @type {String}
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line padding-line-between-statements
|
|
7
|
+
let className = 'tbody';
|
|
8
|
+
|
|
9
|
+
export { className as class };
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div role="rowgroup" class="sui row-group {className}" {...$$restProps}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} RowGroupProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} RowGroupEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} RowGroupSlots */
|
|
4
|
+
export default class RowGroup extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
class?: string;
|
|
7
|
+
}, {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
}, {
|
|
10
|
+
default: {};
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
13
|
+
export type RowGroupProps = typeof __propDef.props;
|
|
14
|
+
export type RowGroupEvents = typeof __propDef.events;
|
|
15
|
+
export type RowGroupSlots = typeof __propDef.slots;
|
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
|
17
|
+
declare const __propDef: {
|
|
18
|
+
props: {
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
class?: string;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {
|
|
26
|
+
default: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* CSS class name on the button.
|
|
4
|
+
* @type {String}
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line padding-line-between-statements
|
|
7
|
+
let className = '';
|
|
8
|
+
|
|
9
|
+
export { className as class };
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div role="row" tabindex="0" class="sui row {className}" {...$$restProps} on:click>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} RowProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} RowEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} RowSlots */
|
|
4
|
+
export default class Row extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
class?: string;
|
|
7
|
+
}, {
|
|
8
|
+
click: MouseEvent;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {
|
|
12
|
+
default: {};
|
|
13
|
+
}> {
|
|
14
|
+
}
|
|
15
|
+
export type RowProps = typeof __propDef.props;
|
|
16
|
+
export type RowEvents = typeof __propDef.events;
|
|
17
|
+
export type RowSlots = typeof __propDef.slots;
|
|
18
|
+
import { SvelteComponentTyped } from "svelte";
|
|
19
|
+
declare const __propDef: {
|
|
20
|
+
props: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
class?: string;
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
click: MouseEvent;
|
|
26
|
+
} & {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
};
|
|
29
|
+
slots: {
|
|
30
|
+
default: {};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {};
|