@geoffcox/sterling-svelte 0.0.17 → 0.0.18
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/Checkbox.svelte +11 -6
- package/Checkbox.svelte.d.ts +2 -1
- package/Field.svelte +257 -0
- package/Field.svelte.d.ts +63 -0
- package/Field.types.d.ts +1 -0
- package/Field.types.js +1 -0
- package/Input.svelte +58 -72
- package/Input.svelte.d.ts +8 -3
- package/Label.svelte +5 -6
- package/Label.svelte.d.ts +0 -1
- package/List.svelte +47 -78
- package/List.svelte.d.ts +0 -6
- package/ListItem.svelte +0 -1
- package/Progress.svelte +20 -44
- package/Progress.svelte.d.ts +1 -3
- package/Progress.types.d.ts +1 -1
- package/Radio.svelte +19 -14
- package/Radio.svelte.d.ts +7 -2
- package/Select.svelte +30 -42
- package/Select.svelte.d.ts +1 -5
- package/Slider.svelte +68 -89
- package/Slider.svelte.d.ts +1 -3
- package/Switch.svelte +7 -5
- package/TextArea.svelte +49 -90
- package/TextArea.svelte.d.ts +3 -6
- package/Tree.svelte +12 -40
- package/Tree.svelte.d.ts +0 -1
- package/index.d.ts +3 -1
- package/index.js +2 -1
- package/package.json +3 -2
- package/theme/darkTheme.js +14 -7
- package/theme/lightTheme.js +17 -10
- package/Portal.svelte +0 -14
- package/Portal.svelte.d.ts +0 -21
package/Slider.svelte
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
import { round } from "lodash-es";
|
|
3
|
-
import { v4 as uuid } from "uuid";
|
|
4
|
-
import Label from "./Label.svelte";
|
|
5
3
|
export let value = 0;
|
|
6
4
|
export let min = 0;
|
|
7
5
|
export let max = 100;
|
|
@@ -9,7 +7,6 @@ export let step = void 0;
|
|
|
9
7
|
export let precision = 0;
|
|
10
8
|
export let vertical = false;
|
|
11
9
|
export let disabled = false;
|
|
12
|
-
const inputId = uuid();
|
|
13
10
|
let sliderRef;
|
|
14
11
|
const dispatch = createEventDispatcher();
|
|
15
12
|
const raiseChange = (newValue) => {
|
|
@@ -124,84 +121,62 @@ const onKeyDown = (event) => {
|
|
|
124
121
|
<!-- @component
|
|
125
122
|
Slider lets the user chose a value within a min/max range by dragging a thumb button.
|
|
126
123
|
-->
|
|
127
|
-
<div
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
<div
|
|
125
|
+
aria-disabled={disabled}
|
|
126
|
+
aria-valuemin={0}
|
|
127
|
+
aria-valuenow={value}
|
|
128
|
+
aria-valuemax={max}
|
|
129
|
+
class="sterling-slider"
|
|
130
|
+
class:disabled
|
|
131
|
+
class:horizontal={!vertical}
|
|
132
|
+
class:vertical
|
|
133
|
+
role="slider"
|
|
134
|
+
tabindex={!disabled ? 0 : undefined}
|
|
135
|
+
on:blur
|
|
136
|
+
on:click
|
|
137
|
+
on:dblclick
|
|
138
|
+
on:focus
|
|
139
|
+
on:focusin
|
|
140
|
+
on:focusout
|
|
141
|
+
on:keydown
|
|
142
|
+
on:keydown={onKeyDown}
|
|
143
|
+
on:keypress
|
|
144
|
+
on:keyup
|
|
145
|
+
on:mousedown
|
|
146
|
+
on:mouseenter
|
|
147
|
+
on:mouseleave
|
|
148
|
+
on:mousemove
|
|
149
|
+
on:mouseover
|
|
150
|
+
on:mouseout
|
|
151
|
+
on:mouseup
|
|
152
|
+
on:pointercancel
|
|
153
|
+
on:pointerdown
|
|
154
|
+
on:pointerdown={onPointerDown}
|
|
155
|
+
on:pointerenter
|
|
156
|
+
on:pointerleave
|
|
157
|
+
on:pointermove
|
|
158
|
+
on:pointermove={onPointerMove}
|
|
159
|
+
on:pointerover
|
|
160
|
+
on:pointerout
|
|
161
|
+
on:pointerup
|
|
162
|
+
on:pointerup={onPointerUp}
|
|
163
|
+
on:wheel
|
|
164
|
+
{...$$restProps}
|
|
165
|
+
>
|
|
133
166
|
<div
|
|
134
|
-
class="
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
id={inputId}
|
|
139
|
-
role="slider"
|
|
140
|
-
aria-valuemin={0}
|
|
141
|
-
aria-valuenow={value}
|
|
142
|
-
aria-valuemax={max}
|
|
143
|
-
tabindex={!disabled ? 0 : undefined}
|
|
144
|
-
on:blur
|
|
145
|
-
on:click
|
|
146
|
-
on:dblclick
|
|
147
|
-
on:focus
|
|
148
|
-
on:focusin
|
|
149
|
-
on:focusout
|
|
150
|
-
on:keydown
|
|
151
|
-
on:keydown={onKeyDown}
|
|
152
|
-
on:keypress
|
|
153
|
-
on:keyup
|
|
154
|
-
on:mousedown
|
|
155
|
-
on:mouseenter
|
|
156
|
-
on:mouseleave
|
|
157
|
-
on:mousemove
|
|
158
|
-
on:mouseover
|
|
159
|
-
on:mouseout
|
|
160
|
-
on:mouseup
|
|
161
|
-
on:pointercancel
|
|
162
|
-
on:pointerdown
|
|
163
|
-
on:pointerdown={onPointerDown}
|
|
164
|
-
on:pointerenter
|
|
165
|
-
on:pointerleave
|
|
166
|
-
on:pointermove
|
|
167
|
-
on:pointermove={onPointerMove}
|
|
168
|
-
on:pointerover
|
|
169
|
-
on:pointerout
|
|
170
|
-
on:pointerup
|
|
171
|
-
on:pointerup={onPointerUp}
|
|
172
|
-
on:wheel
|
|
173
|
-
{...$$restProps}
|
|
167
|
+
class="container"
|
|
168
|
+
bind:this={sliderRef}
|
|
169
|
+
bind:clientWidth={sliderWidth}
|
|
170
|
+
bind:clientHeight={sliderHeight}
|
|
174
171
|
>
|
|
175
|
-
<div
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
bind:clientWidth={sliderWidth}
|
|
179
|
-
bind:clientHeight={sliderHeight}
|
|
180
|
-
>
|
|
181
|
-
<div class="track" />
|
|
182
|
-
<div class="fill" style={vertical ? `height: ${valueOffset}px` : `width: ${valueOffset}px`} />
|
|
183
|
-
<div class="thumb" style={vertical ? `bottom: ${valueOffset}px` : `left: ${valueOffset}px`} />
|
|
184
|
-
</div>
|
|
172
|
+
<div class="track" />
|
|
173
|
+
<div class="fill" style={vertical ? `height: ${valueOffset}px` : `width: ${valueOffset}px`} />
|
|
174
|
+
<div class="thumb" style={vertical ? `bottom: ${valueOffset}px` : `left: ${valueOffset}px`} />
|
|
185
175
|
</div>
|
|
186
176
|
</div>
|
|
187
177
|
|
|
188
178
|
<style>
|
|
189
179
|
.sterling-slider {
|
|
190
|
-
display: grid;
|
|
191
|
-
grid-template-columns: 1fr;
|
|
192
|
-
grid-template-rows: auto 1fr;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.sterling-slider.vertical {
|
|
196
|
-
justify-items: center;
|
|
197
|
-
height: 100%;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.sterling-slider > :global(label) {
|
|
201
|
-
font-size: 0.7em;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.slider {
|
|
205
180
|
box-sizing: border-box;
|
|
206
181
|
outline: none;
|
|
207
182
|
padding: 0;
|
|
@@ -210,6 +185,10 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
210
185
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
211
186
|
}
|
|
212
187
|
|
|
188
|
+
.sterling-slider.vertical {
|
|
189
|
+
height: 100%;
|
|
190
|
+
}
|
|
191
|
+
|
|
213
192
|
.container {
|
|
214
193
|
position: relative;
|
|
215
194
|
}
|
|
@@ -249,15 +228,15 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
249
228
|
|
|
250
229
|
/* ----- horizontal ----- */
|
|
251
230
|
|
|
252
|
-
.slider.horizontal {
|
|
231
|
+
.sterling-slider.horizontal {
|
|
253
232
|
height: 2em;
|
|
254
233
|
}
|
|
255
234
|
|
|
256
|
-
.slider.horizontal .container {
|
|
235
|
+
.sterling-slider.horizontal .container {
|
|
257
236
|
margin: 0 0.75em;
|
|
258
237
|
}
|
|
259
238
|
|
|
260
|
-
.slider.horizontal .track {
|
|
239
|
+
.sterling-slider.horizontal .track {
|
|
261
240
|
left: 0;
|
|
262
241
|
right: 0;
|
|
263
242
|
top: 50%;
|
|
@@ -265,27 +244,27 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
265
244
|
transform: translate(0, -50%);
|
|
266
245
|
}
|
|
267
246
|
|
|
268
|
-
.slider.horizontal .fill {
|
|
247
|
+
.sterling-slider.horizontal .fill {
|
|
269
248
|
height: 3px;
|
|
270
249
|
top: 50%;
|
|
271
250
|
transform: translate(0, -50%);
|
|
272
251
|
}
|
|
273
252
|
|
|
274
|
-
.slider.horizontal .thumb {
|
|
253
|
+
.sterling-slider.horizontal .thumb {
|
|
275
254
|
top: 50%;
|
|
276
255
|
transform: translate(-50%, -50%);
|
|
277
256
|
}
|
|
278
257
|
|
|
279
258
|
/* ----- vertical ----- */
|
|
280
259
|
|
|
281
|
-
.slider.vertical {
|
|
260
|
+
.sterling-slider.vertical {
|
|
282
261
|
width: 2em;
|
|
283
262
|
}
|
|
284
|
-
.slider.vertical .container {
|
|
263
|
+
.sterling-slider.vertical .container {
|
|
285
264
|
margin: 0.75em 0;
|
|
286
265
|
}
|
|
287
266
|
|
|
288
|
-
.slider.vertical .track {
|
|
267
|
+
.sterling-slider.vertical .track {
|
|
289
268
|
bottom: 0;
|
|
290
269
|
left: 50%;
|
|
291
270
|
top: 0;
|
|
@@ -293,14 +272,14 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
293
272
|
width: 3px;
|
|
294
273
|
}
|
|
295
274
|
|
|
296
|
-
.slider.vertical .fill {
|
|
275
|
+
.sterling-slider.vertical .fill {
|
|
297
276
|
bottom: 0;
|
|
298
277
|
left: 50%;
|
|
299
278
|
transform: translate(-50%, 0);
|
|
300
279
|
width: 3px;
|
|
301
280
|
}
|
|
302
281
|
|
|
303
|
-
.slider.vertical .thumb {
|
|
282
|
+
.sterling-slider.vertical .thumb {
|
|
304
283
|
left: 50%;
|
|
305
284
|
transform: translate(-50%, 50%);
|
|
306
285
|
}
|
|
@@ -322,7 +301,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
322
301
|
}
|
|
323
302
|
|
|
324
303
|
/* ----- focus ----- */
|
|
325
|
-
.slider:focus-visible {
|
|
304
|
+
.sterling-slider:focus-visible {
|
|
326
305
|
outline-color: var(--stsv-Common__outline-color);
|
|
327
306
|
outline-offset: var(--stsv-Common__outline-offset);
|
|
328
307
|
outline-style: var(--stsv-Common__outline-style);
|
|
@@ -330,15 +309,15 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
330
309
|
}
|
|
331
310
|
/* ----- disabled ----- */
|
|
332
311
|
|
|
333
|
-
.slider.disabled .track {
|
|
312
|
+
.sterling-slider.disabled .track {
|
|
334
313
|
background: var(--stsv-Common__background-color--disabled);
|
|
335
314
|
}
|
|
336
315
|
|
|
337
|
-
.slider.disabled .fill {
|
|
316
|
+
.sterling-slider.disabled .fill {
|
|
338
317
|
background: var(--stsv-Common__color--disabled);
|
|
339
318
|
}
|
|
340
319
|
|
|
341
|
-
.slider.disabled .thumb {
|
|
320
|
+
.sterling-slider.disabled .thumb {
|
|
342
321
|
background-color: var(--stsv-Common__background-color--disabled);
|
|
343
322
|
border-color: var(--stsv-Common__border-color--disabled);
|
|
344
323
|
color: var(--stsv-Common__color--disabled);
|
|
@@ -346,7 +325,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
346
325
|
}
|
|
347
326
|
|
|
348
327
|
@media (prefers-reduced-motion) {
|
|
349
|
-
.slider,
|
|
328
|
+
.sterling-slider,
|
|
350
329
|
.track,
|
|
351
330
|
.fill,
|
|
352
331
|
.thumb {
|
package/Slider.svelte.d.ts
CHANGED
package/Switch.svelte
CHANGED
|
@@ -18,6 +18,8 @@ $:
|
|
|
18
18
|
ratio = vertical ? checked ? 0 : 1 : checked ? 1 : 0;
|
|
19
19
|
$:
|
|
20
20
|
valueOffset = (switchSize - thumbSize) * ratio;
|
|
21
|
+
$:
|
|
22
|
+
console.log({ ratio, valueOffset });
|
|
21
23
|
</script>
|
|
22
24
|
|
|
23
25
|
<!--
|
|
@@ -26,6 +28,9 @@ $:
|
|
|
26
28
|
-->
|
|
27
29
|
<div class="sterling-switch" class:vertical class:disabled>
|
|
28
30
|
<input
|
|
31
|
+
bind:checked
|
|
32
|
+
{disabled}
|
|
33
|
+
id={inputId}
|
|
29
34
|
type="checkbox"
|
|
30
35
|
on:blur
|
|
31
36
|
on:click
|
|
@@ -47,9 +52,6 @@ $:
|
|
|
47
52
|
on:mouseup
|
|
48
53
|
on:toggle
|
|
49
54
|
on:wheel
|
|
50
|
-
bind:checked
|
|
51
|
-
id={inputId}
|
|
52
|
-
{disabled}
|
|
53
55
|
{...$$restProps}
|
|
54
56
|
/>
|
|
55
57
|
<div class="off-label">
|
|
@@ -209,11 +211,11 @@ $:
|
|
|
209
211
|
|
|
210
212
|
.sterling-switch:not(.vertical) .thumb {
|
|
211
213
|
top: calc(-1 * var(--stsv-Button__border-width));
|
|
212
|
-
transform: translateX(calc(var(--
|
|
214
|
+
transform: translateX(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
.sterling-switch.vertical .thumb {
|
|
216
218
|
left: calc(-1 * var(--stsv-Button__border-width));
|
|
217
|
-
transform: translateY(calc(var(--
|
|
219
|
+
transform: translateY(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
|
|
218
220
|
}
|
|
219
221
|
</style>
|
package/TextArea.svelte
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Label from "./Label.svelte";
|
|
3
|
-
export let value;
|
|
1
|
+
<script>export let autoHeight = false;
|
|
4
2
|
export let resize = "none";
|
|
5
|
-
export let
|
|
6
|
-
export let autoHeight = false;
|
|
7
|
-
const inputId = uuid();
|
|
3
|
+
export let value;
|
|
8
4
|
let textAreaRef;
|
|
9
5
|
const autoSetHeight = () => {
|
|
10
6
|
if (autoHeight && textAreaRef) {
|
|
@@ -19,48 +15,41 @@ $:
|
|
|
19
15
|
autoHeight, autoSetHeight();
|
|
20
16
|
</script>
|
|
21
17
|
|
|
22
|
-
<
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
on:wheel
|
|
58
|
-
on:input={onInput}
|
|
59
|
-
{disabled}
|
|
60
|
-
rows="1"
|
|
61
|
-
{...$$restProps}
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
18
|
+
<textarea
|
|
19
|
+
bind:this={textAreaRef}
|
|
20
|
+
class="sterling-text-area"
|
|
21
|
+
rows="1"
|
|
22
|
+
style={`--TextArea__resize: ${resize};`}
|
|
23
|
+
bind:value
|
|
24
|
+
on:blur
|
|
25
|
+
on:click
|
|
26
|
+
on:change
|
|
27
|
+
on:copy
|
|
28
|
+
on:cut
|
|
29
|
+
on:paste
|
|
30
|
+
on:dblclick
|
|
31
|
+
on:focus
|
|
32
|
+
on:focusin
|
|
33
|
+
on:focusout
|
|
34
|
+
on:input
|
|
35
|
+
on:invalid
|
|
36
|
+
on:keydown
|
|
37
|
+
on:keypress
|
|
38
|
+
on:keyup
|
|
39
|
+
on:mousedown
|
|
40
|
+
on:mouseenter
|
|
41
|
+
on:mouseleave
|
|
42
|
+
on:mousemove
|
|
43
|
+
on:mouseover
|
|
44
|
+
on:mouseout
|
|
45
|
+
on:mouseup
|
|
46
|
+
on:select
|
|
47
|
+
on:submit
|
|
48
|
+
on:reset
|
|
49
|
+
on:wheel
|
|
50
|
+
on:input={onInput}
|
|
51
|
+
{...$$restProps}
|
|
52
|
+
/>
|
|
64
53
|
|
|
65
54
|
<style>
|
|
66
55
|
.sterling-text-area {
|
|
@@ -71,15 +60,17 @@ $:
|
|
|
71
60
|
border-width: var(--stsv-Input__border-width);
|
|
72
61
|
box-sizing: border-box;
|
|
73
62
|
color: var(--stsv-Input__color);
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
font: inherit;
|
|
64
|
+
line-height: inherit;
|
|
76
65
|
height: 100%;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
grid-template-rows: 1fr;
|
|
80
|
-
padding: 0;
|
|
66
|
+
outline: none;
|
|
67
|
+
padding: 0.5em;
|
|
81
68
|
margin: 0;
|
|
69
|
+
min-height: 3em;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
resize: var(--TextArea__resize, none);
|
|
82
72
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
73
|
+
width: 100%;
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
.sterling-text-area:hover {
|
|
@@ -88,7 +79,7 @@ $:
|
|
|
88
79
|
color: var(--stsv-Input__color--hover);
|
|
89
80
|
}
|
|
90
81
|
|
|
91
|
-
.sterling-text-area:focus
|
|
82
|
+
.sterling-text-area:focus {
|
|
92
83
|
background-color: var(--stsv-Input__background-color--focus);
|
|
93
84
|
border-color: var(--stsv-Input__border-color--focus);
|
|
94
85
|
color: var(--stsv-Input__color--focus);
|
|
@@ -105,49 +96,17 @@ $:
|
|
|
105
96
|
cursor: not-allowed;
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
background: none;
|
|
110
|
-
box-sizing: border-box;
|
|
111
|
-
color: inherit;
|
|
112
|
-
font: inherit;
|
|
113
|
-
line-height: inherit;
|
|
114
|
-
padding: 0 0.5em 0.5em 0.5em;
|
|
115
|
-
min-height: 3em;
|
|
116
|
-
margin: 0.5em 0 0 0;
|
|
117
|
-
resize: var(--TextArea__resize, none);
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
textarea,
|
|
122
|
-
textarea:hover,
|
|
123
|
-
textarea:focus-within,
|
|
124
|
-
textarea:disabled {
|
|
125
|
-
background-color: transparent;
|
|
126
|
-
border: none;
|
|
127
|
-
outline: none;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
textarea::placeholder {
|
|
99
|
+
.sterling-text-area::placeholder {
|
|
131
100
|
color: var(--stsv-Display__color--faint);
|
|
132
101
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
133
102
|
}
|
|
134
103
|
|
|
135
|
-
|
|
104
|
+
.sterling-text-area:disabled::placeholder {
|
|
136
105
|
color: var(--stsv-Display__color--disabled);
|
|
137
106
|
}
|
|
138
107
|
|
|
139
|
-
.sterling-text-area > :global(label) {
|
|
140
|
-
font-size: 0.7em;
|
|
141
|
-
margin: 0.5em 0 0 0.7em;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.sterling-text-area > :global(label):empty {
|
|
145
|
-
margin: 0;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
108
|
@media (prefers-reduced-motion) {
|
|
149
|
-
.sterling-text-area
|
|
150
|
-
.sterling-text-area textarea::placeholder {
|
|
109
|
+
.sterling-text-area {
|
|
151
110
|
transition: none;
|
|
152
111
|
}
|
|
153
112
|
}
|
package/TextArea.svelte.d.ts
CHANGED
|
@@ -3,10 +3,9 @@ import type { TextAreaResize } from './TextArea.types';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
value: string;
|
|
7
|
-
resize?: TextAreaResize | undefined;
|
|
8
|
-
disabled?: boolean | undefined;
|
|
9
6
|
autoHeight?: boolean | undefined;
|
|
7
|
+
resize?: TextAreaResize | undefined;
|
|
8
|
+
value: string;
|
|
10
9
|
};
|
|
11
10
|
events: {
|
|
12
11
|
blur: FocusEvent;
|
|
@@ -38,9 +37,7 @@ declare const __propDef: {
|
|
|
38
37
|
} & {
|
|
39
38
|
[evt: string]: CustomEvent<any>;
|
|
40
39
|
};
|
|
41
|
-
slots: {
|
|
42
|
-
label: {};
|
|
43
|
-
};
|
|
40
|
+
slots: {};
|
|
44
41
|
};
|
|
45
42
|
export type TextAreaProps = typeof __propDef.props;
|
|
46
43
|
export type TextAreaEvents = typeof __propDef.events;
|
package/Tree.svelte
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<script>import { createKeyborg } from "keyborg";
|
|
2
2
|
import { createEventDispatcher, onMount, setContext } from "svelte";
|
|
3
3
|
import { writable } from "svelte/store";
|
|
4
|
-
import { v4 as uuid } from "uuid";
|
|
5
|
-
import Label from "./Label.svelte";
|
|
6
4
|
import { treeContextKey } from "./Tree.constants";
|
|
7
|
-
const inputId = uuid();
|
|
8
5
|
export let composed = false;
|
|
9
6
|
export let disabled = false;
|
|
10
7
|
export let selectedValue = void 0;
|
|
@@ -58,18 +55,12 @@ onMount(() => {
|
|
|
58
55
|
<div
|
|
59
56
|
aria-disabled={disabled}
|
|
60
57
|
class="sterling-tree"
|
|
61
|
-
class:disabled
|
|
62
58
|
class:composed
|
|
59
|
+
class:disabled
|
|
63
60
|
class:using-keyboard={usingKeyboard}
|
|
61
|
+
role="tree"
|
|
64
62
|
>
|
|
65
|
-
|
|
66
|
-
<Label {disabled} for={inputId}>
|
|
67
|
-
<slot name="label" />
|
|
68
|
-
</Label>
|
|
69
|
-
{/if}
|
|
70
|
-
<div class="tree" role="tree">
|
|
71
|
-
<slot />
|
|
72
|
-
</div>
|
|
63
|
+
<slot />
|
|
73
64
|
</div>
|
|
74
65
|
|
|
75
66
|
<style>
|
|
@@ -81,12 +72,14 @@ onMount(() => {
|
|
|
81
72
|
border-width: var(--stsv-Common__border-width);
|
|
82
73
|
box-sizing: border-box;
|
|
83
74
|
color: var(--stsv-Common__color);
|
|
84
|
-
display:
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
flex-wrap: nowrap;
|
|
87
78
|
height: 100%;
|
|
79
|
+
overflow-x: hidden;
|
|
80
|
+
overflow-y: scroll;
|
|
88
81
|
margin: 0;
|
|
89
|
-
|
|
82
|
+
position: relative;
|
|
90
83
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
91
84
|
}
|
|
92
85
|
|
|
@@ -112,31 +105,10 @@ onMount(() => {
|
|
|
112
105
|
}
|
|
113
106
|
|
|
114
107
|
.sterling-tree.composed,
|
|
115
|
-
.sterling-tree:hover
|
|
116
|
-
.sterling-tree:focus-visible
|
|
117
|
-
.sterling-tree.disabled
|
|
118
|
-
background: none;
|
|
108
|
+
.sterling-tree.composed:hover,
|
|
109
|
+
.sterling-tree.composed.using-keyboard:focus-visible,
|
|
110
|
+
.sterling-tree.composed.disabled {
|
|
119
111
|
border: none;
|
|
120
112
|
outline: none;
|
|
121
113
|
}
|
|
122
|
-
|
|
123
|
-
.sterling-tree > :global(label) {
|
|
124
|
-
font-size: 0.7em;
|
|
125
|
-
margin: 0.5em 0.7em;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.sterling-tree > :global(label):empty {
|
|
129
|
-
margin: 0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.tree {
|
|
133
|
-
display: flex;
|
|
134
|
-
flex-direction: column;
|
|
135
|
-
flex-wrap: nowrap;
|
|
136
|
-
grid-row: 2 / span 1;
|
|
137
|
-
overflow-x: hidden;
|
|
138
|
-
overflow-y: scroll;
|
|
139
|
-
outline: none;
|
|
140
|
-
position: relative;
|
|
141
|
-
}
|
|
142
114
|
</style>
|
package/Tree.svelte.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { neutrals } from './theme/colors';
|
|
|
11
11
|
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
12
12
|
export { menuBarContextKey, menuItemContextKey } from './Menus.constants';
|
|
13
13
|
export type { ButtonVariant, ButtonShape } from './Button.types';
|
|
14
|
+
export type { FieldStatus } from './Field.types';
|
|
14
15
|
export type { ListContext } from './List.types';
|
|
15
16
|
export type { MenuBarContext, MenuItemContext, MenuItemRegistration } from './Menus.types';
|
|
16
17
|
export type { ProgressColorful } from './Progress.types';
|
|
@@ -24,6 +25,7 @@ export { treeContextKey, treeItemContextKey } from './Tree.constants';
|
|
|
24
25
|
import Button from './Button.svelte';
|
|
25
26
|
import Checkbox from './Checkbox.svelte';
|
|
26
27
|
import Dialog from './Dialog.svelte';
|
|
28
|
+
import Field from './Field.svelte';
|
|
27
29
|
import Input from './Input.svelte';
|
|
28
30
|
import Label from './Label.svelte';
|
|
29
31
|
import List from './List.svelte';
|
|
@@ -47,4 +49,4 @@ import Tree from './Tree.svelte';
|
|
|
47
49
|
import TreeChevron from './TreeChevron.svelte';
|
|
48
50
|
import TreeItem from './TreeItem.svelte';
|
|
49
51
|
import TreeItemDisplay from './TreeItemDisplay.svelte';
|
|
50
|
-
export { Button, Checkbox, Dialog, Input, Label, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Progress, Radio, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
|
52
|
+
export { Button, Checkbox, Dialog, Field, Input, Label, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Progress, Radio, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { treeContextKey, treeItemContextKey } from './Tree.constants';
|
|
|
21
21
|
import Button from './Button.svelte';
|
|
22
22
|
import Checkbox from './Checkbox.svelte';
|
|
23
23
|
import Dialog from './Dialog.svelte';
|
|
24
|
+
import Field from './Field.svelte';
|
|
24
25
|
import Input from './Input.svelte';
|
|
25
26
|
import Label from './Label.svelte';
|
|
26
27
|
import List from './List.svelte';
|
|
@@ -44,4 +45,4 @@ import Tree from './Tree.svelte';
|
|
|
44
45
|
import TreeChevron from './TreeChevron.svelte';
|
|
45
46
|
import TreeItem from './TreeItem.svelte';
|
|
46
47
|
import TreeItemDisplay from './TreeItemDisplay.svelte';
|
|
47
|
-
export { Button, Checkbox, Dialog, Input, Label, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Progress, Radio, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
|
48
|
+
export { Button, Checkbox, Dialog, Field, Input, Label, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Progress, Radio, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"author": "Geoff Cox",
|
|
5
5
|
"description": "A modern, accessible, and lightweight component library for Svelte.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
"./Button.types": "./Button.types.js",
|
|
56
56
|
"./Checkbox.svelte": "./Checkbox.svelte",
|
|
57
57
|
"./Dialog.svelte": "./Dialog.svelte",
|
|
58
|
+
"./Field.svelte": "./Field.svelte",
|
|
59
|
+
"./Field.types": "./Field.types.js",
|
|
58
60
|
"./Input.svelte": "./Input.svelte",
|
|
59
61
|
"./Label.svelte": "./Label.svelte",
|
|
60
62
|
"./List.constants": "./List.constants.js",
|
|
@@ -70,7 +72,6 @@
|
|
|
70
72
|
"./Menus.constants": "./Menus.constants.js",
|
|
71
73
|
"./Menus.types": "./Menus.types.js",
|
|
72
74
|
"./Menus.utils": "./Menus.utils.js",
|
|
73
|
-
"./Portal.svelte": "./Portal.svelte",
|
|
74
75
|
"./Progress.svelte": "./Progress.svelte",
|
|
75
76
|
"./Progress.types": "./Progress.types.js",
|
|
76
77
|
"./Radio.svelte": "./Radio.svelte",
|