@sveltia/ui 0.2.3 → 0.2.5
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 +4 -1
- package/package/components/composite/calendar.svelte.d.ts +1 -1
- package/package/components/composite/checkbox-group.svelte +4 -4
- package/package/components/composite/combobox.svelte +11 -8
- package/package/components/composite/combobox.svelte.d.ts +5 -5
- package/package/components/composite/disclosure.svelte +3 -3
- package/package/components/composite/disclosure.svelte.d.ts +1 -1
- package/package/components/composite/grid.svelte +2 -2
- package/package/components/composite/grid.svelte.d.ts +1 -1
- package/package/components/composite/listbox.svelte +4 -4
- package/package/components/composite/listbox.svelte.d.ts +2 -2
- package/package/components/composite/menu-item-group.svelte +1 -1
- package/package/components/composite/menu.svelte +3 -3
- package/package/components/composite/menu.svelte.d.ts +2 -2
- package/package/components/composite/{radio-button-group.svelte → radio-group.svelte} +11 -10
- package/package/components/composite/radio-group.svelte.d.ts +40 -0
- package/package/components/composite/select-button-group.svelte +4 -4
- package/package/components/composite/select-button-group.svelte.d.ts +3 -3
- package/package/components/composite/select.svelte +2 -2
- package/package/components/composite/select.svelte.d.ts +1 -1
- package/package/components/composite/tab-list.svelte +4 -4
- package/package/components/composite/tab-list.svelte.d.ts +2 -2
- package/package/components/core/button.svelte +12 -13
- package/package/components/core/button.svelte.d.ts +10 -10
- package/package/components/core/checkbox.svelte +40 -21
- package/package/components/core/checkbox.svelte.d.ts +4 -2
- package/package/components/core/dialog.svelte +14 -4
- package/package/components/core/dialog.svelte.d.ts +3 -3
- package/package/components/core/drawer.svelte +13 -3
- package/package/components/core/drawer.svelte.d.ts +1 -1
- package/package/components/core/grid-cell.svelte +1 -2
- package/package/components/core/group.svelte +1 -1
- package/package/components/core/icon.svelte +1 -1
- package/package/components/core/menu-button.svelte +3 -3
- package/package/components/core/menu-button.svelte.d.ts +3 -3
- package/package/components/core/menu-item-checkbox.svelte +1 -1
- package/package/components/core/menu-item-radio.svelte +1 -1
- package/package/components/core/number-input.svelte +19 -9
- package/package/components/core/number-input.svelte.d.ts +1 -1
- package/package/components/core/option.svelte +1 -1
- package/package/components/core/password-input.svelte +3 -3
- package/package/components/core/password-input.svelte.d.ts +1 -1
- package/package/components/core/{radio-button.svelte → radio.svelte} +45 -20
- package/package/components/core/radio.svelte.d.ts +41 -0
- package/package/components/core/row-group.svelte +1 -2
- package/package/components/core/row.svelte +1 -2
- package/package/components/core/search-bar.svelte +2 -2
- package/package/components/core/select-button.svelte +3 -3
- package/package/components/core/select-button.svelte.d.ts +2 -2
- package/package/components/core/separator.svelte +2 -1
- package/package/components/core/separator.svelte.d.ts +2 -2
- package/package/components/core/slider.svelte +54 -18
- package/package/components/core/spacer.svelte +2 -2
- package/package/components/core/switch.svelte +3 -3
- package/package/components/core/switch.svelte.d.ts +1 -1
- package/package/components/core/tab-panel.svelte +2 -3
- package/package/components/core/tab-panel.svelte.d.ts +1 -1
- package/package/components/core/tab.svelte +2 -2
- package/package/components/core/tab.svelte.d.ts +1 -1
- package/package/components/core/text-area.svelte +7 -7
- package/package/components/core/text-area.svelte.d.ts +2 -2
- package/package/components/core/text-input.svelte +7 -7
- package/package/components/core/text-input.svelte.d.ts +5 -5
- package/package/components/core/toolbar.svelte +2 -3
- package/package/components/core/toolbar.svelte.d.ts +1 -1
- package/package/components/editor/markdown.svelte +1 -1
- package/package/components/editor/markdown.svelte.d.ts +1 -1
- package/package/components/helpers/group.d.ts +1 -37
- package/package/components/helpers/group.js +26 -19
- package/package/components/helpers/popup.d.ts +1 -2
- package/package/components/helpers/popup.js +18 -8
- package/package/components/helpers/util.js +6 -0
- package/package/components/util/app-shell.svelte +15 -6
- package/package/components/util/misc.js +0 -2
- package/package/components/util/popup.svelte +14 -4
- package/package/components/util/popup.svelte.d.ts +10 -10
- package/package/components/util/portal.svelte +1 -1
- package/package/index.d.ts +6 -3
- package/package/index.js +47 -2
- package/package/styles/variables.scss +8 -5
- package/package/typedef.d.ts +1 -0
- package/package/typedef.js +4 -0
- package/package.json +30 -32
- package/package/components/composite/radio-button-group.svelte.d.ts +0 -36
- package/package/components/core/radio-button.svelte.d.ts +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#radio
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
import { getRandomId } from '../helpers/util';
|
|
@@ -10,21 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
17
17
|
export { className as class };
|
|
18
18
|
|
|
19
|
-
/** @type {
|
|
19
|
+
/** @type {string} */
|
|
20
20
|
export let name = '';
|
|
21
21
|
|
|
22
|
-
/** @type {
|
|
22
|
+
/** @type {string?} */
|
|
23
|
+
export let label = undefined;
|
|
24
|
+
|
|
25
|
+
/** @type {string?} */
|
|
23
26
|
export let value = undefined;
|
|
24
27
|
|
|
25
|
-
/** @type {
|
|
28
|
+
/** @type {boolean} */
|
|
26
29
|
export let selected = false;
|
|
27
30
|
|
|
31
|
+
/** @type {boolean} */
|
|
32
|
+
export let disabled = false;
|
|
33
|
+
|
|
28
34
|
const id = getRandomId('checkbox');
|
|
29
35
|
/** @type {Button} */
|
|
30
36
|
let buttonComponent;
|
|
@@ -36,32 +42,41 @@
|
|
|
36
42
|
|
|
37
43
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
38
44
|
<span
|
|
39
|
-
class="sui radio
|
|
45
|
+
class="sui radio {className}"
|
|
40
46
|
on:click={(event) => {
|
|
41
|
-
if (!event.target.matches('button')) {
|
|
47
|
+
if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
|
|
42
48
|
buttonComponent.element.click();
|
|
43
49
|
}
|
|
44
50
|
}}
|
|
45
51
|
>
|
|
46
52
|
<Button
|
|
47
53
|
{id}
|
|
54
|
+
{disabled}
|
|
55
|
+
{name}
|
|
56
|
+
{value}
|
|
48
57
|
role="radio"
|
|
49
58
|
aria-checked={selected}
|
|
50
59
|
aria-labelledby="{id}-label"
|
|
51
60
|
bind:this={buttonComponent}
|
|
52
61
|
on:click={(event) => {
|
|
53
62
|
event.preventDefault();
|
|
54
|
-
selected =
|
|
63
|
+
selected = true;
|
|
55
64
|
}}
|
|
56
65
|
>
|
|
57
66
|
<Icon slot="start-icon" name="circle" />
|
|
58
67
|
</Button>
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
68
|
+
{#if $$slots.default || label}
|
|
69
|
+
<label id="{id}-label">
|
|
70
|
+
{#if $$slots.default}
|
|
71
|
+
<slot />
|
|
72
|
+
{:else}
|
|
73
|
+
{label}
|
|
74
|
+
{/if}
|
|
75
|
+
</label>
|
|
76
|
+
{/if}
|
|
62
77
|
</span>
|
|
63
78
|
|
|
64
|
-
<style>.radio
|
|
79
|
+
<style>.radio {
|
|
65
80
|
display: inline-flex;
|
|
66
81
|
align-items: center;
|
|
67
82
|
gap: 8px;
|
|
@@ -70,24 +85,34 @@
|
|
|
70
85
|
-webkit-user-select: none;
|
|
71
86
|
user-select: none;
|
|
72
87
|
}
|
|
73
|
-
.radio
|
|
88
|
+
.radio.disabled {
|
|
89
|
+
cursor: default;
|
|
90
|
+
}
|
|
91
|
+
.radio.disabled label {
|
|
92
|
+
color: var(--disabled-foreground-color);
|
|
93
|
+
}
|
|
94
|
+
.radio :global(button) {
|
|
74
95
|
justify-content: center;
|
|
75
96
|
overflow: hidden;
|
|
76
97
|
border-width: 2px;
|
|
77
|
-
border-color: var(--control-border-color);
|
|
98
|
+
border-color: var(--primary-control-border-color);
|
|
78
99
|
border-radius: 24px;
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
100
|
+
width: 20px;
|
|
101
|
+
height: 20px;
|
|
81
102
|
color: var(--primary-accent-color-lighter);
|
|
82
103
|
transition: all 200ms;
|
|
83
104
|
}
|
|
84
|
-
.radio
|
|
85
|
-
font-size:
|
|
105
|
+
.radio :global(button) :global(.icon) {
|
|
106
|
+
font-size: 14px;
|
|
86
107
|
font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 48;
|
|
87
108
|
}
|
|
88
|
-
.radio
|
|
109
|
+
.radio :global(button[aria-checked="true"]) {
|
|
110
|
+
border-color: var(--primary-accent-color-lighter);
|
|
89
111
|
color: var(--primary-accent-color-lighter);
|
|
90
112
|
}
|
|
91
|
-
.radio
|
|
113
|
+
.radio :global(button[aria-checked="false"]) {
|
|
92
114
|
color: transparent;
|
|
115
|
+
}
|
|
116
|
+
.radio label {
|
|
117
|
+
cursor: inherit;
|
|
93
118
|
}</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} RadioProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} RadioEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} RadioSlots */
|
|
4
|
+
/**
|
|
5
|
+
* @see https://w3c.github.io/aria/#radio
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
7
|
+
*/
|
|
8
|
+
export default class Radio extends SvelteComponentTyped<{
|
|
9
|
+
label?: string;
|
|
10
|
+
class?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
}, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {
|
|
18
|
+
default: {};
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export type RadioProps = typeof __propDef.props;
|
|
22
|
+
export type RadioEvents = typeof __propDef.events;
|
|
23
|
+
export type RadioSlots = typeof __propDef.slots;
|
|
24
|
+
import { SvelteComponentTyped } from "svelte";
|
|
25
|
+
declare const __propDef: {
|
|
26
|
+
props: {
|
|
27
|
+
label?: string | null;
|
|
28
|
+
class?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
name?: string;
|
|
31
|
+
value?: string | null;
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
};
|
|
34
|
+
events: {
|
|
35
|
+
[evt: string]: CustomEvent<any>;
|
|
36
|
+
};
|
|
37
|
+
slots: {
|
|
38
|
+
default: {};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* CSS class name on the button.
|
|
15
|
-
* @type {
|
|
15
|
+
* @type {string}
|
|
16
16
|
*/
|
|
17
17
|
let className = '';
|
|
18
18
|
|
|
19
19
|
export { className as class };
|
|
20
20
|
|
|
21
|
-
/** @type {
|
|
21
|
+
/** @type {import('svelte').SvelteComponent} */
|
|
22
22
|
let input;
|
|
23
23
|
|
|
24
24
|
export let value = '';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
A variant of `<
|
|
3
|
+
A variant of `<Radio>`, looking like a normal button.
|
|
4
4
|
@see https://w3c.github.io/aria/#radio
|
|
5
|
-
@see https://
|
|
5
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import Button from './button.svelte';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CSS class name on the button.
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
let className = '';
|
|
15
15
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SelectButtonEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SelectButtonSlots */
|
|
4
4
|
/**
|
|
5
|
-
* A variant of `<
|
|
5
|
+
* A variant of `<Radio>`, looking like a normal button.
|
|
6
6
|
* @see https://w3c.github.io/aria/#radio
|
|
7
|
-
* @see https://
|
|
7
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
8
8
|
*/
|
|
9
9
|
export default class SelectButton extends SvelteComponentTyped<{
|
|
10
10
|
[x: string]: any;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
@see https://w3c.github.io/aria/#separator
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
|
+
/** @type {('horizontal' | 'vertical')} */
|
|
6
7
|
export let orientation = 'horizontal';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* CSS class name on the button.
|
|
10
|
-
* @type {
|
|
11
|
+
* @type {string}
|
|
11
12
|
*/
|
|
12
13
|
let className = '';
|
|
13
14
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/** @see https://w3c.github.io/aria/#separator */
|
|
5
5
|
export default class Separator extends SvelteComponentTyped<{
|
|
6
6
|
class?: string;
|
|
7
|
-
orientation?:
|
|
7
|
+
orientation?: "horizontal" | "vertical";
|
|
8
8
|
}, {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
}, {}> {
|
|
@@ -16,7 +16,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
18
|
class?: string;
|
|
19
|
-
orientation?:
|
|
19
|
+
orientation?: ('horizontal' | 'vertical');
|
|
20
20
|
};
|
|
21
21
|
events: {
|
|
22
22
|
[evt: string]: CustomEvent<any>;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CSS class name on the button.
|
|
13
|
-
* @type {
|
|
13
|
+
* @type {string}
|
|
14
14
|
*/
|
|
15
15
|
let className = '';
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
$: multiThumb = !!values;
|
|
29
29
|
|
|
30
30
|
const dispatch = createEventDispatcher();
|
|
31
|
-
/** @type {
|
|
31
|
+
/** @type {HTMLElement?} */
|
|
32
32
|
let base = undefined;
|
|
33
33
|
let barWidth = 0;
|
|
34
34
|
let positionList = [];
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
let dragging = false;
|
|
40
40
|
let targetValueIndex = 0;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {number} diff
|
|
45
|
+
*/
|
|
42
46
|
const dragSlider = (diff) => {
|
|
43
47
|
if (diff >= 0 && diff <= barWidth) {
|
|
44
48
|
const fromIndex = positionList.findLastIndex((s) => s <= diff);
|
|
@@ -58,18 +62,19 @@
|
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
sliderPositions[targetValueIndex] = positionList[index];
|
|
62
|
-
|
|
63
65
|
if (multiThumb) {
|
|
64
66
|
values[targetValueIndex] = valueList[index];
|
|
65
|
-
dispatch('change', { values });
|
|
66
67
|
} else {
|
|
67
68
|
value = valueList[index];
|
|
68
|
-
dispatch('change', { value });
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {KeyboardEvent} event `keydown` event.
|
|
76
|
+
* @param {number} [valueIndex]
|
|
77
|
+
*/
|
|
73
78
|
const onKeyDown = (event, valueIndex = 0) => {
|
|
74
79
|
const { key, shiftKey, altKey, ctrlKey, metaKey } = event;
|
|
75
80
|
|
|
@@ -106,18 +111,19 @@
|
|
|
106
111
|
return;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
sliderPositions[valueIndex] = positionList[index];
|
|
110
|
-
|
|
111
114
|
if (multiThumb) {
|
|
112
115
|
values[valueIndex] = valueList[index];
|
|
113
|
-
dispatch('change', { values });
|
|
114
116
|
} else {
|
|
115
117
|
value = valueList[index];
|
|
116
|
-
dispatch('change', { value });
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
};
|
|
120
121
|
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param {MouseEvent} event `mousedown` event.
|
|
125
|
+
* @param {number} [valueIndex]
|
|
126
|
+
*/
|
|
121
127
|
const onMouseDown = (event, valueIndex = 0) => {
|
|
122
128
|
const { clientX, screenX } = event;
|
|
123
129
|
|
|
@@ -127,15 +133,32 @@
|
|
|
127
133
|
targetValueIndex = valueIndex;
|
|
128
134
|
};
|
|
129
135
|
|
|
136
|
+
/**
|
|
137
|
+
*
|
|
138
|
+
* @param {MouseEvent} event `mousemove` event.
|
|
139
|
+
*/
|
|
130
140
|
const onMouseMove = (event) => {
|
|
131
141
|
if (dragging) {
|
|
132
142
|
dragSlider(startX + (event.screenX - startScreenX));
|
|
133
143
|
}
|
|
134
144
|
};
|
|
135
145
|
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
const onMouseUp = () => {
|
|
150
|
+
if (dragging) {
|
|
151
|
+
dragging = false;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param {MouseEvent} event `click` event.
|
|
158
|
+
*/
|
|
136
159
|
const onClick = (event) => {
|
|
137
160
|
if (!multiThumb && !dragging) {
|
|
138
|
-
dragSlider(event.layerX);
|
|
161
|
+
dragSlider(/** @type {any} */ (event).layerX);
|
|
139
162
|
}
|
|
140
163
|
|
|
141
164
|
if (dragging) {
|
|
@@ -143,6 +166,20 @@
|
|
|
143
166
|
}
|
|
144
167
|
};
|
|
145
168
|
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
const onValueChange = () => {
|
|
173
|
+
if (multiThumb) {
|
|
174
|
+
sliderPositions[0] = positionList[valueList.indexOf(values[0])];
|
|
175
|
+
sliderPositions[1] = positionList[valueList.indexOf(values[1])];
|
|
176
|
+
dispatch('change', { values });
|
|
177
|
+
} else {
|
|
178
|
+
sliderPositions[0] = positionList[valueList.indexOf(value)];
|
|
179
|
+
dispatch('change', { value });
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
146
183
|
onMount(() => {
|
|
147
184
|
barWidth = base.clientWidth;
|
|
148
185
|
|
|
@@ -152,17 +189,16 @@
|
|
|
152
189
|
valueList = new Array(stepCount).fill(0).map((_, index) => index * step + min, 10);
|
|
153
190
|
positionList = new Array(stepCount).fill(0).map((_, index) => index * stepWidth);
|
|
154
191
|
|
|
155
|
-
|
|
156
|
-
sliderPositions[0] = positionList[valueList.indexOf(values[0])];
|
|
157
|
-
sliderPositions[1] = positionList[valueList.indexOf(values[1])];
|
|
158
|
-
} else {
|
|
159
|
-
sliderPositions[0] = positionList[valueList.indexOf(value)];
|
|
160
|
-
}
|
|
192
|
+
onValueChange();
|
|
161
193
|
});
|
|
194
|
+
|
|
195
|
+
// @ts-ignore Arguments are triggers
|
|
196
|
+
$: onValueChange(value, values);
|
|
162
197
|
</script>
|
|
163
198
|
|
|
164
199
|
<svelte:body
|
|
165
200
|
on:mousemove={onMouseMove}
|
|
201
|
+
on:mouseup={onMouseUp}
|
|
166
202
|
on:click={() => {
|
|
167
203
|
dragging = false;
|
|
168
204
|
}}
|
|
@@ -240,7 +276,7 @@
|
|
|
240
276
|
width: var(--slider-base-width, 200px);
|
|
241
277
|
height: 8px;
|
|
242
278
|
border-radius: 8px;
|
|
243
|
-
background-color: var(--control-border-color);
|
|
279
|
+
background-color: var(--secondary-control-border-color);
|
|
244
280
|
}
|
|
245
281
|
|
|
246
282
|
.bar {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#switch
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/switch/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
/**
|
|
8
8
|
* CSS class name on the button.
|
|
9
|
-
* @type {
|
|
9
|
+
* @type {string}
|
|
10
10
|
*/
|
|
11
11
|
let className = '';
|
|
12
12
|
|
|
@@ -69,7 +69,7 @@ span {
|
|
|
69
69
|
padding: 2px;
|
|
70
70
|
display: inline-block;
|
|
71
71
|
border-radius: 16px;
|
|
72
|
-
background-color: var(--control-border-color);
|
|
72
|
+
background-color: var(--secondary-control-border-color);
|
|
73
73
|
transition: all 200ms;
|
|
74
74
|
}
|
|
75
75
|
span:hover {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SwitchSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#switch
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/switch/
|
|
7
7
|
*/
|
|
8
8
|
export default class Switch extends SvelteComponentTyped<{
|
|
9
9
|
label?: string;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#tabpanel
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
/**
|
|
8
8
|
* CSS class name on the button.
|
|
9
|
-
* @type {
|
|
9
|
+
* @type {string}
|
|
10
10
|
*/
|
|
11
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
12
11
|
let className = '';
|
|
13
12
|
|
|
14
13
|
export { className as class };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TabPanelSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#tabpanel
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
7
7
|
*/
|
|
8
8
|
export default class TabPanel extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
@see https://w3c.github.io/aria/#tab
|
|
4
|
-
@see https://
|
|
4
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
import Button from './button.svelte';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* CSS class name on the button.
|
|
11
|
-
* @type {
|
|
11
|
+
* @type {string}
|
|
12
12
|
*/
|
|
13
13
|
let className = '';
|
|
14
14
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TabSlots */
|
|
4
4
|
/**
|
|
5
5
|
* @see https://w3c.github.io/aria/#tab
|
|
6
|
-
* @see https://
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
7
7
|
*/
|
|
8
8
|
export default class Tab extends SvelteComponentTyped<{
|
|
9
9
|
[x: string]: any;
|
|
@@ -9,26 +9,25 @@
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CSS class name on the button.
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {string}
|
|
13
13
|
*/
|
|
14
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
15
14
|
let className = '';
|
|
16
15
|
|
|
17
16
|
export { className as class };
|
|
18
17
|
|
|
19
|
-
/** @type {
|
|
18
|
+
/** @type {HTMLTextAreaElement?} */
|
|
20
19
|
export let element = undefined;
|
|
21
20
|
|
|
22
21
|
export let name = '';
|
|
23
22
|
|
|
24
|
-
/** @type {
|
|
23
|
+
/** @type {string?} */
|
|
25
24
|
export let value = undefined;
|
|
26
25
|
|
|
27
26
|
export let autoResize = false;
|
|
28
27
|
|
|
29
|
-
/** @type {
|
|
28
|
+
/** @type {string?} */
|
|
30
29
|
let height;
|
|
31
|
-
/** @type {
|
|
30
|
+
/** @type {HTMLElement?} */
|
|
32
31
|
let outer = undefined;
|
|
33
32
|
let resizing = false;
|
|
34
33
|
let lastWidth = 0;
|
|
@@ -51,6 +50,7 @@
|
|
|
51
50
|
*/
|
|
52
51
|
$: {
|
|
53
52
|
if (autoResize) {
|
|
53
|
+
// @ts-ignore
|
|
54
54
|
resizeTextarea(value);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -101,7 +101,7 @@ textarea {
|
|
|
101
101
|
display: block;
|
|
102
102
|
margin: 0;
|
|
103
103
|
border-width: 1px;
|
|
104
|
-
border-color: var(--control-border-color);
|
|
104
|
+
border-color: var(--secondary-control-border-color);
|
|
105
105
|
border-radius: var(--input--medium--border-radius);
|
|
106
106
|
background-color: var(--control-background-color);
|
|
107
107
|
padding: 8px;
|
|
@@ -40,9 +40,9 @@ declare const __propDef: {
|
|
|
40
40
|
props: {
|
|
41
41
|
[x: string]: any;
|
|
42
42
|
class?: string;
|
|
43
|
-
element?:
|
|
43
|
+
element?: HTMLTextAreaElement | null;
|
|
44
44
|
name?: string;
|
|
45
|
-
value?:
|
|
45
|
+
value?: string | null;
|
|
46
46
|
autoResize?: boolean;
|
|
47
47
|
};
|
|
48
48
|
events: {
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CSS class name on the button.
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
let className = '';
|
|
15
15
|
|
|
16
16
|
export { className as class };
|
|
17
17
|
|
|
18
|
-
/** @type {
|
|
18
|
+
/** @type {HTMLInputElement?} */
|
|
19
19
|
export let element = undefined;
|
|
20
20
|
|
|
21
21
|
/** @type {('textbox'|'searchbox'|'combobox'|'spinbutton')} */
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
export let name = '';
|
|
32
32
|
|
|
33
|
-
/** @type {(
|
|
33
|
+
/** @type {(string | number | undefined)} */
|
|
34
34
|
export let value = undefined;
|
|
35
35
|
|
|
36
36
|
const id = getRandomId('input');
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
{role}
|
|
53
53
|
name={name || undefined}
|
|
54
54
|
tabindex={disabled ? -1 : 0}
|
|
55
|
-
{readOnly}
|
|
55
|
+
readOnly={readOnly ? true : undefined}
|
|
56
56
|
aria-readonly={readOnly ? true : undefined}
|
|
57
57
|
{disabled}
|
|
58
58
|
aria-disabled={disabled ? true : undefined}
|
|
@@ -84,7 +84,7 @@ input {
|
|
|
84
84
|
display: inline-block;
|
|
85
85
|
flex: auto;
|
|
86
86
|
border-width: 1px;
|
|
87
|
-
border-color: var(--control-border-color);
|
|
87
|
+
border-color: var(--secondary-control-border-color);
|
|
88
88
|
border-radius: var(--input--medium--border-radius);
|
|
89
89
|
padding: 0 8px;
|
|
90
90
|
min-width: 0;
|
|
@@ -101,7 +101,7 @@ input:focus {
|
|
|
101
101
|
}
|
|
102
102
|
input:read-only {
|
|
103
103
|
color: var(--tertiary-foreground-color);
|
|
104
|
-
border-color: var(--control-border-color) !important;
|
|
104
|
+
border-color: var(--secondary-control-border-color) !important;
|
|
105
105
|
}
|
|
106
106
|
input:disabled {
|
|
107
107
|
background-color: var(--disabled-background-color);
|
|
@@ -115,7 +115,7 @@ input ~ :global(button) {
|
|
|
115
115
|
flex: none;
|
|
116
116
|
margin-left: -1px;
|
|
117
117
|
border-width: 1px;
|
|
118
|
-
border-color: var(--control-border-color);
|
|
118
|
+
border-color: var(--secondary-control-border-color);
|
|
119
119
|
height: var(--input--medium--height);
|
|
120
120
|
aspect-ratio: 1/1;
|
|
121
121
|
}
|