@sveltia/ui 0.1.4 → 0.2.0
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.json +23 -12
- package/package/components/composite/calendar.svelte +0 -240
- package/package/components/composite/calendar.svelte.d.ts +0 -20
- package/package/components/composite/checkbox-group.svelte +0 -43
- package/package/components/composite/checkbox-group.svelte.d.ts +0 -24
- package/package/components/composite/combobox.svelte +0 -197
- package/package/components/composite/combobox.svelte.d.ts +0 -32
- package/package/components/composite/disclosure.svelte +0 -60
- package/package/components/composite/disclosure.svelte.d.ts +0 -26
- package/package/components/composite/grid.svelte +0 -24
- package/package/components/composite/grid.svelte.d.ts +0 -22
- package/package/components/composite/listbox.svelte +0 -63
- package/package/components/composite/listbox.svelte.d.ts +0 -39
- package/package/components/composite/menu-item-group.svelte +0 -31
- package/package/components/composite/menu-item-group.svelte.d.ts +0 -23
- package/package/components/composite/menu.svelte +0 -44
- package/package/components/composite/menu.svelte.d.ts +0 -32
- package/package/components/composite/radio-button-group.svelte +0 -45
- package/package/components/composite/radio-button-group.svelte.d.ts +0 -27
- package/package/components/composite/select-button-group.svelte +0 -70
- package/package/components/composite/select-button-group.svelte.d.ts +0 -31
- package/package/components/composite/select.svelte +0 -34
- package/package/components/composite/select.svelte.d.ts +0 -26
- package/package/components/composite/tab-list.svelte +0 -76
- package/package/components/composite/tab-list.svelte.d.ts +0 -42
- package/package/components/core/button.svelte +0 -205
- package/package/components/core/button.svelte.d.ts +0 -78
- package/package/components/core/checkbox.svelte +0 -107
- package/package/components/core/checkbox.svelte.d.ts +0 -30
- package/package/components/core/dialog.svelte +0 -274
- package/package/components/core/dialog.svelte.d.ts +0 -45
- package/package/components/core/grid-cell.svelte +0 -14
- package/package/components/core/grid-cell.svelte.d.ts +0 -21
- package/package/components/core/group.svelte +0 -31
- package/package/components/core/group.svelte.d.ts +0 -23
- package/package/components/core/icon.svelte +0 -21
- package/package/components/core/icon.svelte.d.ts +0 -20
- package/package/components/core/menu-button.svelte +0 -57
- package/package/components/core/menu-button.svelte.d.ts +0 -30
- package/package/components/core/menu-item-checkbox.svelte +0 -24
- package/package/components/core/menu-item-checkbox.svelte.d.ts +0 -24
- package/package/components/core/menu-item-radio.svelte +0 -19
- package/package/components/core/menu-item-radio.svelte.d.ts +0 -24
- package/package/components/core/menu-item.svelte +0 -113
- package/package/components/core/menu-item.svelte.d.ts +0 -29
- package/package/components/core/number-input.svelte +0 -112
- package/package/components/core/number-input.svelte.d.ts +0 -28
- package/package/components/core/option.svelte +0 -59
- package/package/components/core/option.svelte.d.ts +0 -35
- package/package/components/core/password-input.svelte +0 -81
- package/package/components/core/password-input.svelte.d.ts +0 -25
- package/package/components/core/radio-button.svelte +0 -93
- package/package/components/core/radio-button.svelte.d.ts +0 -27
- package/package/components/core/row-group.svelte +0 -14
- package/package/components/core/row-group.svelte.d.ts +0 -21
- package/package/components/core/row.svelte +0 -14
- package/package/components/core/row.svelte.d.ts +0 -23
- package/package/components/core/search-bar.svelte +0 -90
- package/package/components/core/search-bar.svelte.d.ts +0 -35
- package/package/components/core/select-button.svelte +0 -31
- package/package/components/core/select-button.svelte.d.ts +0 -35
- package/package/components/core/separator.svelte +0 -28
- package/package/components/core/separator.svelte.d.ts +0 -20
- package/package/components/core/slider.svelte +0 -270
- package/package/components/core/slider.svelte.d.ts +0 -35
- package/package/components/core/spacer.svelte +0 -22
- package/package/components/core/spacer.svelte.d.ts +0 -19
- package/package/components/core/switch.svelte +0 -80
- package/package/components/core/switch.svelte.d.ts +0 -27
- package/package/components/core/tab-panel.svelte +0 -23
- package/package/components/core/tab-panel.svelte.d.ts +0 -25
- package/package/components/core/tab.svelte +0 -22
- package/package/components/core/tab.svelte.d.ts +0 -31
- package/package/components/core/text-area.svelte +0 -90
- package/package/components/core/text-area.svelte.d.ts +0 -43
- package/package/components/core/text-input.svelte +0 -145
- package/package/components/core/text-input.svelte.d.ts +0 -53
- package/package/components/core/toolbar.svelte +0 -74
- package/package/components/core/toolbar.svelte.d.ts +0 -26
- package/package/components/editor/markdown.svelte +0 -78
- package/package/components/editor/markdown.svelte.d.ts +0 -19
- package/package/components/helpers/group.d.ts +0 -37
- package/package/components/helpers/group.js +0 -246
- package/package/components/helpers/popup.d.ts +0 -26
- package/package/components/helpers/popup.js +0 -146
- package/package/components/helpers/util.d.ts +0 -1
- package/package/components/helpers/util.js +0 -8
- package/package/components/util/app-shell.svelte +0 -284
- package/package/components/util/app-shell.svelte.d.ts +0 -28
- package/package/components/util/misc.d.ts +0 -2
- package/package/components/util/misc.js +0 -22
- package/package/components/util/popup.svelte +0 -131
- package/package/components/util/popup.svelte.d.ts +0 -37
- package/package/components/util/portal.svelte +0 -34
- package/package/components/util/portal.svelte.d.ts +0 -21
- package/package/index.d.ts +0 -41
- package/package/index.js +0 -66
- package/package/locales/en.d.ts +0 -42
- package/package/locales/en.js +0 -41
- package/package/locales/ja.d.ts +0 -42
- package/package/locales/ja.js +0 -41
- package/package/styles/core.scss +0 -134
- package/package/styles/variables.scss +0 -114
- package/package/typedef.d.ts +0 -0
- package/package/typedef.js +0 -0
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
|
|
4
|
-
@see https://w3c.github.io/aria/#slider
|
|
5
|
-
@see https://www.w3.org/WAI/ARIA/apg/patterns/slider/
|
|
6
|
-
@see https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
|
|
7
|
-
-->
|
|
8
|
-
<script>
|
|
9
|
-
import { createEventDispatcher, onMount } from '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
|
-
export let value = 0;
|
|
20
|
-
export let sliderLabel = '';
|
|
21
|
-
export let values = undefined;
|
|
22
|
-
export let sliderLabels = [];
|
|
23
|
-
export let min = 0;
|
|
24
|
-
export let max = 100;
|
|
25
|
-
export let step = 1;
|
|
26
|
-
export let optionLabels = [];
|
|
27
|
-
|
|
28
|
-
$: multiThumb = !!values;
|
|
29
|
-
|
|
30
|
-
const dispatch = createEventDispatcher();
|
|
31
|
-
/** @type {(HTMLElement|undefined)} */
|
|
32
|
-
let base = undefined;
|
|
33
|
-
let barWidth = 0;
|
|
34
|
-
let positionList = [];
|
|
35
|
-
let valueList = [];
|
|
36
|
-
let startX = 0;
|
|
37
|
-
let startScreenX = 0;
|
|
38
|
-
const sliderPositions = [0, 0];
|
|
39
|
-
let dragging = false;
|
|
40
|
-
let targetValueIndex = 0;
|
|
41
|
-
|
|
42
|
-
const dragSlider = (diff) => {
|
|
43
|
-
if (diff >= 0 && diff <= barWidth) {
|
|
44
|
-
const fromIndex = positionList.findLastIndex((s) => s <= diff);
|
|
45
|
-
const toIndex = positionList.findIndex((s) => diff <= s);
|
|
46
|
-
|
|
47
|
-
const index =
|
|
48
|
-
Math.abs(positionList[fromIndex] - diff) < Math.abs(positionList[toIndex] - diff)
|
|
49
|
-
? fromIndex
|
|
50
|
-
: toIndex;
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
sliderPositions[targetValueIndex] === positionList[index] ||
|
|
54
|
-
(multiThumb &&
|
|
55
|
-
((targetValueIndex === 0 && sliderPositions[1] <= positionList[index]) ||
|
|
56
|
-
(targetValueIndex === 1 && sliderPositions[0] >= positionList[index])))
|
|
57
|
-
) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
sliderPositions[targetValueIndex] = positionList[index];
|
|
62
|
-
|
|
63
|
-
if (multiThumb) {
|
|
64
|
-
values[targetValueIndex] = valueList[index];
|
|
65
|
-
dispatch('change', { values });
|
|
66
|
-
} else {
|
|
67
|
-
value = valueList[index];
|
|
68
|
-
dispatch('change', { value });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const onKeyDown = (event, valueIndex = 0) => {
|
|
74
|
-
const { key, shiftKey, altKey, ctrlKey, metaKey } = event;
|
|
75
|
-
|
|
76
|
-
if (shiftKey || altKey || ctrlKey || metaKey) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let index = -1;
|
|
81
|
-
|
|
82
|
-
if (['ArrowDown', 'ArrowLeft'].includes(key)) {
|
|
83
|
-
if (value > min) {
|
|
84
|
-
index = valueList.indexOf(value) - 1;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
event.stopPropagation();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (['ArrowUp', 'ArrowRight'].includes(key)) {
|
|
92
|
-
if (value < max) {
|
|
93
|
-
index = valueList.indexOf(value) + 1;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
event.stopPropagation();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (index > -1) {
|
|
101
|
-
if (
|
|
102
|
-
multiThumb &&
|
|
103
|
-
((targetValueIndex === 0 && sliderPositions[1] <= positionList[index]) ||
|
|
104
|
-
(targetValueIndex === 1 && sliderPositions[0] >= positionList[index]))
|
|
105
|
-
) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
sliderPositions[valueIndex] = positionList[index];
|
|
110
|
-
|
|
111
|
-
if (multiThumb) {
|
|
112
|
-
values[valueIndex] = valueList[index];
|
|
113
|
-
dispatch('change', { values });
|
|
114
|
-
} else {
|
|
115
|
-
value = valueList[index];
|
|
116
|
-
dispatch('change', { value });
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const onMouseDown = (event, valueIndex = 0) => {
|
|
122
|
-
const { clientX, screenX } = event;
|
|
123
|
-
|
|
124
|
-
dragging = true;
|
|
125
|
-
startX = clientX - base.getBoundingClientRect().x;
|
|
126
|
-
startScreenX = screenX;
|
|
127
|
-
targetValueIndex = valueIndex;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const onMouseMove = (event) => {
|
|
131
|
-
if (dragging) {
|
|
132
|
-
dragSlider(startX + (event.screenX - startScreenX));
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const onClick = (event) => {
|
|
137
|
-
if (!multiThumb && !dragging) {
|
|
138
|
-
dragSlider(event.layerX);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (dragging) {
|
|
142
|
-
dragging = false;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
onMount(() => {
|
|
147
|
-
barWidth = base.clientWidth;
|
|
148
|
-
|
|
149
|
-
const stepCount = (max - min) / step + 1;
|
|
150
|
-
const stepWidth = barWidth / (stepCount - 1);
|
|
151
|
-
|
|
152
|
-
valueList = new Array(stepCount).fill(0).map((_, index) => index * step + min, 10);
|
|
153
|
-
positionList = new Array(stepCount).fill(0).map((_, index) => index * stepWidth);
|
|
154
|
-
|
|
155
|
-
if (multiThumb) {
|
|
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
|
-
}
|
|
161
|
-
});
|
|
162
|
-
</script>
|
|
163
|
-
|
|
164
|
-
<svelte:body
|
|
165
|
-
on:mousemove={onMouseMove}
|
|
166
|
-
on:click={() => {
|
|
167
|
-
dragging = false;
|
|
168
|
-
}}
|
|
169
|
-
/>
|
|
170
|
-
|
|
171
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
172
|
-
<div class="sui slider {className}" on:click|preventDefault|stopPropagation>
|
|
173
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
174
|
-
<div
|
|
175
|
-
class="base"
|
|
176
|
-
bind:this={base}
|
|
177
|
-
on:click|preventDefault|stopPropagation={(event) => {
|
|
178
|
-
onClick(event);
|
|
179
|
-
}}
|
|
180
|
-
>
|
|
181
|
-
<div
|
|
182
|
-
class="bar"
|
|
183
|
-
style:left="{multiThumb ? sliderPositions[0] : 0}px"
|
|
184
|
-
style:width="{multiThumb ? sliderPositions[1] - sliderPositions[0] : sliderPositions[0]}px"
|
|
185
|
-
/>
|
|
186
|
-
<div
|
|
187
|
-
role="slider"
|
|
188
|
-
tabindex="0"
|
|
189
|
-
aria-label={multiThumb ? sliderLabels[0] || '' : sliderLabel}
|
|
190
|
-
aria-valuemin={min}
|
|
191
|
-
aria-valuemax={max}
|
|
192
|
-
aria-valuenow={value}
|
|
193
|
-
style:left="{sliderPositions[0]}px"
|
|
194
|
-
on:mousedown={(event) => {
|
|
195
|
-
onMouseDown(event, 0);
|
|
196
|
-
}}
|
|
197
|
-
on:keydown={(event) => {
|
|
198
|
-
onKeyDown(event, 0);
|
|
199
|
-
}}
|
|
200
|
-
/>
|
|
201
|
-
{#if multiThumb}
|
|
202
|
-
<div
|
|
203
|
-
role="slider"
|
|
204
|
-
tabindex="0"
|
|
205
|
-
aria-label={sliderLabels[1] || ''}
|
|
206
|
-
aria-valuemin={min}
|
|
207
|
-
aria-valuemax={max}
|
|
208
|
-
aria-valuenow={value}
|
|
209
|
-
style:left="{sliderPositions[1]}px"
|
|
210
|
-
on:mousedown={(event) => {
|
|
211
|
-
onMouseDown(event, 1);
|
|
212
|
-
}}
|
|
213
|
-
on:keydown={(event) => {
|
|
214
|
-
onKeyDown(event, 1);
|
|
215
|
-
}}
|
|
216
|
-
/>
|
|
217
|
-
{/if}
|
|
218
|
-
{#if optionLabels.length}
|
|
219
|
-
{#each optionLabels as label, index}
|
|
220
|
-
<span
|
|
221
|
-
class="label"
|
|
222
|
-
role="presentation"
|
|
223
|
-
style:left="{(barWidth / (optionLabels.length - 1)) * index}px"
|
|
224
|
-
>
|
|
225
|
-
{label}
|
|
226
|
-
</span>
|
|
227
|
-
{/each}
|
|
228
|
-
{/if}
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
|
|
232
|
-
<style>.slider {
|
|
233
|
-
position: relative;
|
|
234
|
-
display: inline-block;
|
|
235
|
-
padding: 16px;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.base {
|
|
239
|
-
position: relative;
|
|
240
|
-
width: var(--slider-base-width, 200px);
|
|
241
|
-
height: 8px;
|
|
242
|
-
border-radius: 8px;
|
|
243
|
-
background-color: var(--control-border-color);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.bar {
|
|
247
|
-
position: absolute;
|
|
248
|
-
top: 0;
|
|
249
|
-
height: 8px;
|
|
250
|
-
border-radius: 8px;
|
|
251
|
-
background-color: var(--primary-accent-color-lighter);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
[role=slider] {
|
|
255
|
-
position: absolute;
|
|
256
|
-
top: 0;
|
|
257
|
-
border-radius: 8px;
|
|
258
|
-
width: 16px;
|
|
259
|
-
height: 16px;
|
|
260
|
-
background-color: var(--primary-accent-color-foreground);
|
|
261
|
-
cursor: pointer;
|
|
262
|
-
transform: translate(-8px, -4px);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.label {
|
|
266
|
-
position: absolute;
|
|
267
|
-
top: 12px;
|
|
268
|
-
transform: translateX(-50%);
|
|
269
|
-
font-size: 10px;
|
|
270
|
-
}</style>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} SliderProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} SliderEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} SliderSlots */
|
|
4
|
-
/**
|
|
5
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
|
|
6
|
-
* @see https://w3c.github.io/aria/#slider
|
|
7
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/slider/
|
|
8
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
|
|
9
|
-
*/
|
|
10
|
-
export default class Slider {
|
|
11
|
-
}
|
|
12
|
-
export type SliderProps = typeof __propDef.props;
|
|
13
|
-
export type SliderEvents = typeof __propDef.events;
|
|
14
|
-
export type SliderSlots = typeof __propDef.slots;
|
|
15
|
-
declare const __propDef: {
|
|
16
|
-
props: {
|
|
17
|
-
class?: string;
|
|
18
|
-
value?: number;
|
|
19
|
-
min?: number;
|
|
20
|
-
max?: number;
|
|
21
|
-
step?: number;
|
|
22
|
-
sliderLabel?: string;
|
|
23
|
-
values?: any;
|
|
24
|
-
sliderLabels?: any[];
|
|
25
|
-
optionLabels?: any[];
|
|
26
|
-
};
|
|
27
|
-
events: {
|
|
28
|
-
click: MouseEvent;
|
|
29
|
-
change: CustomEvent<any>;
|
|
30
|
-
} & {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
};
|
|
33
|
-
slots: {};
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/**
|
|
3
|
-
* CSS class name on the button.
|
|
4
|
-
* @type {String}
|
|
5
|
-
*/
|
|
6
|
-
let className = '';
|
|
7
|
-
|
|
8
|
-
export { className as class };
|
|
9
|
-
|
|
10
|
-
/** @type {Boolean} */
|
|
11
|
-
export let flex = false;
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<div class="sui spacer {className}" class:flex />
|
|
15
|
-
|
|
16
|
-
<style>.spacer.flex {
|
|
17
|
-
flex: auto;
|
|
18
|
-
}
|
|
19
|
-
.spacer:not(.flex) {
|
|
20
|
-
width: 8px;
|
|
21
|
-
height: 8px;
|
|
22
|
-
}</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} SpacerProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} SpacerEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} SpacerSlots */
|
|
4
|
-
export default class Spacer {
|
|
5
|
-
}
|
|
6
|
-
export type SpacerProps = typeof __propDef.props;
|
|
7
|
-
export type SpacerEvents = typeof __propDef.events;
|
|
8
|
-
export type SpacerSlots = typeof __propDef.slots;
|
|
9
|
-
declare const __propDef: {
|
|
10
|
-
props: {
|
|
11
|
-
class?: string;
|
|
12
|
-
flex?: boolean;
|
|
13
|
-
};
|
|
14
|
-
events: {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
};
|
|
17
|
-
slots: {};
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@see https://w3c.github.io/aria/#switch
|
|
4
|
-
@see https://w3c.github.io/aria-practices/#switch
|
|
5
|
-
-->
|
|
6
|
-
<script>
|
|
7
|
-
/**
|
|
8
|
-
* CSS class name on the button.
|
|
9
|
-
* @type {String}
|
|
10
|
-
*/
|
|
11
|
-
let className = '';
|
|
12
|
-
|
|
13
|
-
export { className as class };
|
|
14
|
-
|
|
15
|
-
export let label = '';
|
|
16
|
-
|
|
17
|
-
export let checked = false;
|
|
18
|
-
|
|
19
|
-
export let disabled = false;
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<label class="sui switch {className}" class:disabled>
|
|
23
|
-
<input type="checkbox" role="switch" bind:checked {disabled} />
|
|
24
|
-
<span />
|
|
25
|
-
{#if label}
|
|
26
|
-
{label}
|
|
27
|
-
{:else}
|
|
28
|
-
<slot />
|
|
29
|
-
{/if}
|
|
30
|
-
</label>
|
|
31
|
-
|
|
32
|
-
<style>label {
|
|
33
|
-
display: inline-flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
gap: 8px;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
-webkit-user-select: none;
|
|
38
|
-
user-select: none;
|
|
39
|
-
}
|
|
40
|
-
label.disabled {
|
|
41
|
-
cursor: default;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
input {
|
|
45
|
-
position: absolute;
|
|
46
|
-
left: -99999px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
input:checked + span {
|
|
50
|
-
background-color: var(--primary-accent-color);
|
|
51
|
-
border-color: transparent;
|
|
52
|
-
}
|
|
53
|
-
input:checked + span::before {
|
|
54
|
-
transform: translateX(22px);
|
|
55
|
-
background-color: var(--primary-accent-color-foreground);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
input:disabled + span {
|
|
59
|
-
opacity: 0.4;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
span {
|
|
63
|
-
position: relative;
|
|
64
|
-
width: 42px;
|
|
65
|
-
height: 20px;
|
|
66
|
-
padding: 2px;
|
|
67
|
-
display: inline-block;
|
|
68
|
-
border-radius: 16px;
|
|
69
|
-
background-color: var(--control-border-color);
|
|
70
|
-
transition: all 200ms;
|
|
71
|
-
}
|
|
72
|
-
span::before {
|
|
73
|
-
display: inline-block;
|
|
74
|
-
width: 16px;
|
|
75
|
-
height: 16px;
|
|
76
|
-
border-radius: 16px;
|
|
77
|
-
background-color: var(--primary-accent-color-foreground);
|
|
78
|
-
transition: all 200ms;
|
|
79
|
-
content: "";
|
|
80
|
-
}</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} SwitchProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} SwitchEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} SwitchSlots */
|
|
4
|
-
/**
|
|
5
|
-
* @see https://w3c.github.io/aria/#switch
|
|
6
|
-
* @see https://w3c.github.io/aria-practices/#switch
|
|
7
|
-
*/
|
|
8
|
-
export default class Switch {
|
|
9
|
-
}
|
|
10
|
-
export type SwitchProps = typeof __propDef.props;
|
|
11
|
-
export type SwitchEvents = typeof __propDef.events;
|
|
12
|
-
export type SwitchSlots = typeof __propDef.slots;
|
|
13
|
-
declare const __propDef: {
|
|
14
|
-
props: {
|
|
15
|
-
label?: string;
|
|
16
|
-
class?: string;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
checked?: boolean;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
};
|
|
23
|
-
slots: {
|
|
24
|
-
default: {};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@see https://w3c.github.io/aria/#tabpanel
|
|
4
|
-
@see https://w3c.github.io/aria-practices/#tabpanel
|
|
5
|
-
-->
|
|
6
|
-
<script>
|
|
7
|
-
/**
|
|
8
|
-
* CSS class name on the button.
|
|
9
|
-
* @type {String}
|
|
10
|
-
*/
|
|
11
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
12
|
-
let className = '';
|
|
13
|
-
|
|
14
|
-
export { className as class };
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div class="sui tabpanel {className}" role="tabpanel" {...$$restProps}>
|
|
18
|
-
<slot />
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<style>.tabpanel[aria-hidden=true], .tabpanel:not([aria-hidden]) {
|
|
22
|
-
display: none;
|
|
23
|
-
}</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} TabPanelProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} TabPanelEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} TabPanelSlots */
|
|
4
|
-
/**
|
|
5
|
-
* @see https://w3c.github.io/aria/#tabpanel
|
|
6
|
-
* @see https://w3c.github.io/aria-practices/#tabpanel
|
|
7
|
-
*/
|
|
8
|
-
export default class TabPanel {
|
|
9
|
-
}
|
|
10
|
-
export type TabPanelProps = typeof __propDef.props;
|
|
11
|
-
export type TabPanelEvents = typeof __propDef.events;
|
|
12
|
-
export type TabPanelSlots = typeof __propDef.slots;
|
|
13
|
-
declare const __propDef: {
|
|
14
|
-
props: {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
class?: string;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {
|
|
22
|
-
default: {};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@see https://w3c.github.io/aria/#tab
|
|
4
|
-
@see https://w3c.github.io/aria-practices/#tabpanel
|
|
5
|
-
-->
|
|
6
|
-
<script>
|
|
7
|
-
import Button from './button.svelte';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* CSS class name on the button.
|
|
11
|
-
* @type {String}
|
|
12
|
-
*/
|
|
13
|
-
let className = '';
|
|
14
|
-
|
|
15
|
-
export { className as class };
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<Button role="tab" class="sui tab {className}" {...$$restProps}>
|
|
19
|
-
<slot name="start-icon" slot="start-icon" />
|
|
20
|
-
<slot />
|
|
21
|
-
<slot name="end-icon" slot="end-icon" />
|
|
22
|
-
</Button>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} TabProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} TabEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} TabSlots */
|
|
4
|
-
/**
|
|
5
|
-
* @see https://w3c.github.io/aria/#tab
|
|
6
|
-
* @see https://w3c.github.io/aria-practices/#tabpanel
|
|
7
|
-
*/
|
|
8
|
-
export default class Tab {
|
|
9
|
-
}
|
|
10
|
-
export type TabProps = typeof __propDef.props;
|
|
11
|
-
export type TabEvents = typeof __propDef.events;
|
|
12
|
-
export type TabSlots = typeof __propDef.slots;
|
|
13
|
-
declare const __propDef: {
|
|
14
|
-
props: {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
class?: string;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {
|
|
22
|
-
'start-icon': {
|
|
23
|
-
slot: string;
|
|
24
|
-
};
|
|
25
|
-
default: {};
|
|
26
|
-
'end-icon': {
|
|
27
|
-
slot: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@see https://w3c.github.io/aria/#textbox
|
|
4
|
-
-->
|
|
5
|
-
<svelte:options accessors={true} />
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
/**
|
|
9
|
-
* CSS class name on the button.
|
|
10
|
-
* @type {String}
|
|
11
|
-
*/
|
|
12
|
-
// eslint-disable-next-line padding-line-between-statements
|
|
13
|
-
let className = '';
|
|
14
|
-
|
|
15
|
-
export { className as class };
|
|
16
|
-
|
|
17
|
-
/** @type {(HTMLTextAreaElement|undefined)} */
|
|
18
|
-
export let element = undefined;
|
|
19
|
-
|
|
20
|
-
export let name = '';
|
|
21
|
-
|
|
22
|
-
/** @type {(String|undefined)} */
|
|
23
|
-
export let value = undefined;
|
|
24
|
-
|
|
25
|
-
export let autoResize = false;
|
|
26
|
-
|
|
27
|
-
/** @type {(String|undefined)} */
|
|
28
|
-
let height;
|
|
29
|
-
|
|
30
|
-
const resizeTextarea = () => {
|
|
31
|
-
height = 'auto';
|
|
32
|
-
|
|
33
|
-
window.requestAnimationFrame(() => {
|
|
34
|
-
height = value && element?.scrollHeight ? `${element.scrollHeight + 4}px` : undefined;
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
$: {
|
|
39
|
-
if (value && autoResize) {
|
|
40
|
-
resizeTextarea();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<div class="sui text-area {className}">
|
|
46
|
-
<textarea
|
|
47
|
-
name={name || undefined}
|
|
48
|
-
{...$$restProps}
|
|
49
|
-
style:height
|
|
50
|
-
bind:this={element}
|
|
51
|
-
on:click
|
|
52
|
-
on:input
|
|
53
|
-
on:keypress
|
|
54
|
-
on:input={() => {
|
|
55
|
-
value = element.value;
|
|
56
|
-
}}>{value}</textarea
|
|
57
|
-
>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<style>.text-area {
|
|
61
|
-
width: 100%;
|
|
62
|
-
display: inline-flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
textarea {
|
|
67
|
-
display: block;
|
|
68
|
-
margin: 0;
|
|
69
|
-
border-width: 1px;
|
|
70
|
-
border-color: var(--control-border-color);
|
|
71
|
-
border-radius: var(--input--medium--border-radius);
|
|
72
|
-
background-color: var(--control-background-color);
|
|
73
|
-
padding: 8px;
|
|
74
|
-
width: 100%;
|
|
75
|
-
min-height: 8em;
|
|
76
|
-
color: inherit;
|
|
77
|
-
font-family: inherit;
|
|
78
|
-
font-size: inherit;
|
|
79
|
-
line-height: 1.75;
|
|
80
|
-
resize: vertical;
|
|
81
|
-
transition: all 200ms;
|
|
82
|
-
}
|
|
83
|
-
textarea:focus {
|
|
84
|
-
border-color: var(--primary-accent-color);
|
|
85
|
-
}
|
|
86
|
-
textarea:disabled {
|
|
87
|
-
background-color: var(--disabled-background-color);
|
|
88
|
-
opacity: 0.4;
|
|
89
|
-
cursor: default;
|
|
90
|
-
}</style>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} TextAreaProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} TextAreaEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} TextAreaSlots */
|
|
4
|
-
/** @see https://w3c.github.io/aria/#textbox */
|
|
5
|
-
export default class TextArea {
|
|
6
|
-
/**accessor*/
|
|
7
|
-
set class(arg: any);
|
|
8
|
-
get class(): any;
|
|
9
|
-
/**accessor*/
|
|
10
|
-
set element(arg: any);
|
|
11
|
-
get element(): any;
|
|
12
|
-
/**accessor*/
|
|
13
|
-
set name(arg: any);
|
|
14
|
-
get name(): any;
|
|
15
|
-
/**accessor*/
|
|
16
|
-
set value(arg: any);
|
|
17
|
-
get value(): any;
|
|
18
|
-
/**accessor*/
|
|
19
|
-
set autoResize(arg: any);
|
|
20
|
-
get autoResize(): any;
|
|
21
|
-
}
|
|
22
|
-
export type TextAreaProps = typeof __propDef.props;
|
|
23
|
-
export type TextAreaEvents = typeof __propDef.events;
|
|
24
|
-
export type TextAreaSlots = typeof __propDef.slots;
|
|
25
|
-
declare const __propDef: {
|
|
26
|
-
props: {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
class?: string;
|
|
29
|
-
element?: (HTMLTextAreaElement | undefined);
|
|
30
|
-
name?: string;
|
|
31
|
-
value?: (string | undefined);
|
|
32
|
-
autoResize?: boolean;
|
|
33
|
-
};
|
|
34
|
-
events: {
|
|
35
|
-
click: MouseEvent;
|
|
36
|
-
input: Event;
|
|
37
|
-
keypress: KeyboardEvent;
|
|
38
|
-
} & {
|
|
39
|
-
[evt: string]: CustomEvent<any>;
|
|
40
|
-
};
|
|
41
|
-
slots: {};
|
|
42
|
-
};
|
|
43
|
-
export {};
|