@geoffcox/sterling-svelte 0.0.23 → 0.0.25
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/Button.svelte +17 -22
- package/Button.svelte.d.ts +1 -0
- package/Checkbox.svelte +41 -14
- package/Dropdown.svelte +42 -45
- package/Field.svelte +11 -12
- package/Input.svelte +78 -60
- package/List.svelte +45 -16
- package/ListItem.svelte +30 -7
- package/MenuItem.svelte +6 -7
- package/MenuItemDisplay.svelte +33 -2
- package/MenuItemDisplay.svelte.d.ts +1 -0
- package/Popover.svelte +135 -0
- package/Popover.svelte.d.ts +51 -0
- package/Progress.svelte +0 -2
- package/Radio.svelte +67 -31
- package/Select.svelte +44 -67
- package/Slider.svelte +19 -10
- package/Switch.svelte +38 -14
- package/Tab.svelte +25 -3
- package/TabList.svelte +2 -2
- package/TextArea.svelte +82 -55
- package/TextArea.svelte.d.ts +2 -1
- package/Tree.svelte +44 -13
- package/TreeItem.svelte +8 -8
- package/TreeItem.svelte.d.ts +0 -1
- package/TreeItemDisplay.svelte +36 -11
- package/actions/clickOutside.d.ts +12 -1
- package/actions/clickOutside.js +13 -2
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/package.json +2 -1
- package/theme/darkTheme.js +9 -0
- package/theme/lightTheme.js +9 -0
package/Select.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { createEventDispatcher, onMount, tick } from "svelte";
|
|
1
|
+
<script>import { createEventDispatcher, tick } from "svelte";
|
|
3
2
|
import { clickOutside } from "./actions/clickOutside";
|
|
4
3
|
import { idGenerator } from "./idGenerator";
|
|
5
4
|
import List from "./List.svelte";
|
|
5
|
+
import Popup from "./Popover.svelte";
|
|
6
6
|
const popupId = idGenerator.nextId("Select-popup");
|
|
7
7
|
export let composed = false;
|
|
8
8
|
export let disabled = false;
|
|
@@ -11,12 +11,7 @@ export let selectedValue = void 0;
|
|
|
11
11
|
let prevOpen = false;
|
|
12
12
|
let pendingSelectedValue = selectedValue;
|
|
13
13
|
let selectRef;
|
|
14
|
-
let popupRef;
|
|
15
14
|
let listRef;
|
|
16
|
-
let popupPosition = {
|
|
17
|
-
x: void 0,
|
|
18
|
-
y: void 0
|
|
19
|
-
};
|
|
20
15
|
const dispatch = createEventDispatcher();
|
|
21
16
|
const raiseSelect = (value) => {
|
|
22
17
|
dispatch("select", { value });
|
|
@@ -39,8 +34,10 @@ $: {
|
|
|
39
34
|
if (open && !prevOpen) {
|
|
40
35
|
prevOpen = true;
|
|
41
36
|
tick().then(() => {
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
listRef?.focus();
|
|
39
|
+
listRef?.scrollToSelectedItem();
|
|
40
|
+
}, 10);
|
|
44
41
|
});
|
|
45
42
|
} else if (prevOpen) {
|
|
46
43
|
prevOpen = false;
|
|
@@ -61,20 +58,6 @@ export const scrollToSelectedItem = () => {
|
|
|
61
58
|
listRef?.scrollToSelectedItem();
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
|
-
let mounted = false;
|
|
65
|
-
onMount(() => {
|
|
66
|
-
mounted = true;
|
|
67
|
-
const cleanup = autoUpdate(selectRef, popupRef, async () => {
|
|
68
|
-
const { x, y } = await computePosition(selectRef, popupRef, {
|
|
69
|
-
placement: "bottom-end",
|
|
70
|
-
middleware: [offset({ mainAxis: 2 }), flip(), shift({ padding: 0 })]
|
|
71
|
-
});
|
|
72
|
-
if (open) {
|
|
73
|
-
popupPosition = { x, y };
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return cleanup;
|
|
77
|
-
});
|
|
78
61
|
const onSelectClick = (event) => {
|
|
79
62
|
if (!disabled) {
|
|
80
63
|
open = !open;
|
|
@@ -216,27 +199,20 @@ const onListSelect = (event) => {
|
|
|
216
199
|
<div class="chevron" />
|
|
217
200
|
</slot>
|
|
218
201
|
</div>
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
on:select={onListSelect}
|
|
234
|
-
tabIndex={open ? 0 : -1}
|
|
235
|
-
>
|
|
236
|
-
<slot />
|
|
237
|
-
</List>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
202
|
+
<Popup reference={selectRef} bind:open id={popupId}>
|
|
203
|
+
<List
|
|
204
|
+
bind:this={listRef}
|
|
205
|
+
composed
|
|
206
|
+
{disabled}
|
|
207
|
+
selectedValue={pendingSelectedValue}
|
|
208
|
+
on:click={onListClick}
|
|
209
|
+
on:keydown={onListKeydown}
|
|
210
|
+
on:select={onListSelect}
|
|
211
|
+
tabIndex={open ? 0 : -1}
|
|
212
|
+
>
|
|
213
|
+
<slot />
|
|
214
|
+
</List>
|
|
215
|
+
</Popup>
|
|
240
216
|
</div>
|
|
241
217
|
|
|
242
218
|
<style>
|
|
@@ -255,6 +231,7 @@ const onListSelect = (event) => {
|
|
|
255
231
|
grid-template-rows: auto;
|
|
256
232
|
outline: none;
|
|
257
233
|
padding: 0;
|
|
234
|
+
position: relative;
|
|
258
235
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
259
236
|
}
|
|
260
237
|
|
|
@@ -275,13 +252,27 @@ const onListSelect = (event) => {
|
|
|
275
252
|
}
|
|
276
253
|
|
|
277
254
|
.sterling-select.disabled {
|
|
278
|
-
background-color: var(--stsv-Common__background-color--disabled);
|
|
279
|
-
border-color: var(--stsv--Common__border-color--disabled);
|
|
280
|
-
color: var(--stsv-Common__color--disabled);
|
|
281
255
|
cursor: not-allowed;
|
|
282
256
|
outline: none;
|
|
283
257
|
}
|
|
284
258
|
|
|
259
|
+
.sterling-select::after {
|
|
260
|
+
background: var(--stsv-Disabled__background);
|
|
261
|
+
bottom: 0;
|
|
262
|
+
content: '';
|
|
263
|
+
left: 0;
|
|
264
|
+
opacity: 0;
|
|
265
|
+
position: absolute;
|
|
266
|
+
right: 0;
|
|
267
|
+
top: 0;
|
|
268
|
+
pointer-events: none;
|
|
269
|
+
transition: opacity 250ms;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.sterling-select.disabled::after {
|
|
273
|
+
opacity: 1;
|
|
274
|
+
}
|
|
275
|
+
|
|
285
276
|
.sterling-select.composed,
|
|
286
277
|
.sterling-select.composed:hover,
|
|
287
278
|
.sterling-select.composed.focus,
|
|
@@ -291,6 +282,10 @@ const onListSelect = (event) => {
|
|
|
291
282
|
outline: none;
|
|
292
283
|
}
|
|
293
284
|
|
|
285
|
+
.sterling-select.composed.disabled::after {
|
|
286
|
+
opacity: 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
294
289
|
.value {
|
|
295
290
|
padding: 0.5em;
|
|
296
291
|
}
|
|
@@ -331,31 +326,13 @@ const onListSelect = (event) => {
|
|
|
331
326
|
transform-origin: 50% 50%;
|
|
332
327
|
}
|
|
333
328
|
|
|
334
|
-
.popup {
|
|
335
|
-
background-color: var(--stsv-Common__background-color);
|
|
336
|
-
box-sizing: border-box;
|
|
337
|
-
display: none;
|
|
338
|
-
overflow: visible;
|
|
339
|
-
outline: none;
|
|
340
|
-
position: absolute;
|
|
341
|
-
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
342
|
-
width: fit-content;
|
|
343
|
-
height: fit-content;
|
|
344
|
-
z-index: 1;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.popup.open {
|
|
348
|
-
display: grid;
|
|
349
|
-
grid-template-columns: 1fr;
|
|
350
|
-
grid-template-rows: 1fr;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
329
|
.popup-content {
|
|
354
330
|
max-height: 15em;
|
|
355
331
|
}
|
|
356
332
|
|
|
357
333
|
@media (prefers-reduced-motion) {
|
|
358
|
-
.sterling-select
|
|
334
|
+
.sterling-select,
|
|
335
|
+
.sterling-select::after {
|
|
359
336
|
transition: none;
|
|
360
337
|
}
|
|
361
338
|
}
|
package/Slider.svelte
CHANGED
|
@@ -236,6 +236,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
236
236
|
height: 1.5em;
|
|
237
237
|
overflow: hidden;
|
|
238
238
|
padding: 0;
|
|
239
|
+
position: relative;
|
|
239
240
|
text-decoration: none;
|
|
240
241
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
241
242
|
white-space: nowrap;
|
|
@@ -327,19 +328,26 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
327
328
|
|
|
328
329
|
/* ----- disabled ----- */
|
|
329
330
|
|
|
330
|
-
.sterling-slider.disabled .
|
|
331
|
-
|
|
331
|
+
.sterling-slider.disabled .thumb {
|
|
332
|
+
cursor: not-allowed;
|
|
333
|
+
outline: none;
|
|
332
334
|
}
|
|
333
335
|
|
|
334
|
-
.sterling-slider
|
|
335
|
-
background: var(--stsv-
|
|
336
|
+
.sterling-slider .thumb::after {
|
|
337
|
+
background: var(--stsv-Disabled__background);
|
|
338
|
+
bottom: 0;
|
|
339
|
+
content: '';
|
|
340
|
+
left: 0;
|
|
341
|
+
opacity: 0;
|
|
342
|
+
position: absolute;
|
|
343
|
+
right: 0;
|
|
344
|
+
top: 0;
|
|
345
|
+
pointer-events: none;
|
|
346
|
+
transition: opacity 250ms;
|
|
336
347
|
}
|
|
337
348
|
|
|
338
|
-
.sterling-slider.disabled .thumb {
|
|
339
|
-
|
|
340
|
-
border-color: var(--stsv-Common__border-color--disabled);
|
|
341
|
-
color: var(--stsv-Common__color--disabled);
|
|
342
|
-
cursor: not-allowed;
|
|
349
|
+
.sterling-slider.disabled .thumb::after {
|
|
350
|
+
opacity: 1;
|
|
343
351
|
}
|
|
344
352
|
|
|
345
353
|
.sterling-slider.composed,
|
|
@@ -355,7 +363,8 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
355
363
|
.sterling-slider,
|
|
356
364
|
.track,
|
|
357
365
|
.fill,
|
|
358
|
-
.thumb
|
|
366
|
+
.thumb,
|
|
367
|
+
.thumb::after {
|
|
359
368
|
transition: none;
|
|
360
369
|
}
|
|
361
370
|
}
|
package/Switch.svelte
CHANGED
|
@@ -108,18 +108,30 @@ export const focus = (options) => {
|
|
|
108
108
|
position: relative;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
.sterling-switch input {
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.sterling-switch.disabled input {
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
}
|
|
118
|
+
|
|
111
119
|
.sterling-switch:not(.vertical) {
|
|
120
|
+
align-content: center;
|
|
112
121
|
align-items: center;
|
|
113
122
|
column-gap: 0.5em;
|
|
114
|
-
grid-template-columns: auto
|
|
123
|
+
grid-template-columns: auto auto auto;
|
|
115
124
|
grid-template-rows: auto;
|
|
116
|
-
justify-
|
|
125
|
+
justify-content: flex-start;
|
|
126
|
+
justify-items: flex-start;
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
.sterling-switch.vertical {
|
|
120
|
-
align-
|
|
130
|
+
align-content: flex-start;
|
|
131
|
+
align-items: flex-start;
|
|
121
132
|
grid-template-columns: auto;
|
|
122
133
|
grid-template-rows: auto auto auto;
|
|
134
|
+
justify-content: center;
|
|
123
135
|
justify-items: center;
|
|
124
136
|
row-gap: 0.5em;
|
|
125
137
|
}
|
|
@@ -175,12 +187,6 @@ export const focus = (options) => {
|
|
|
175
187
|
outline-width: var(--stsv-Common__outline-width);
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
.sterling-switch.disabled .switch {
|
|
179
|
-
background-color: var(--stsv-Common__background-color--disabled);
|
|
180
|
-
border-color: var(--stsv-Common__border-color--disabled);
|
|
181
|
-
color: var(--stsv-Common__color--disabled);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
190
|
.sterling-switch:not(.vertical) .switch {
|
|
185
191
|
width: 2em;
|
|
186
192
|
height: 1.25em;
|
|
@@ -204,7 +210,6 @@ export const focus = (options) => {
|
|
|
204
210
|
border-width: var(--stsv-Button__border-width);
|
|
205
211
|
box-sizing: border-box;
|
|
206
212
|
color: var(--stsv-Button__color);
|
|
207
|
-
cursor: pointer;
|
|
208
213
|
display: block;
|
|
209
214
|
font: inherit;
|
|
210
215
|
height: 1.25em;
|
|
@@ -225,10 +230,21 @@ export const focus = (options) => {
|
|
|
225
230
|
color: var(--stsv-Button__color--hover);
|
|
226
231
|
}
|
|
227
232
|
|
|
228
|
-
.sterling-switch
|
|
229
|
-
background
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
.sterling-switch .thumb::after {
|
|
234
|
+
background: var(--stsv-Disabled__background);
|
|
235
|
+
bottom: 0;
|
|
236
|
+
content: '';
|
|
237
|
+
left: 0;
|
|
238
|
+
opacity: 0;
|
|
239
|
+
position: absolute;
|
|
240
|
+
right: 0;
|
|
241
|
+
top: 0;
|
|
242
|
+
pointer-events: none;
|
|
243
|
+
transition: opacity 250ms;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.sterling-switch.disabled .thumb::after {
|
|
247
|
+
opacity: 1;
|
|
232
248
|
}
|
|
233
249
|
|
|
234
250
|
.sterling-switch:not(.vertical) .thumb {
|
|
@@ -240,4 +256,12 @@ export const focus = (options) => {
|
|
|
240
256
|
left: calc(-1 * var(--stsv-Button__border-width));
|
|
241
257
|
transform: translateY(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
|
|
242
258
|
}
|
|
259
|
+
|
|
260
|
+
@media (prefers-reduced-motion) {
|
|
261
|
+
.switch,
|
|
262
|
+
.thumb,
|
|
263
|
+
.thumb::after {
|
|
264
|
+
transition: none;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
243
267
|
</style>
|
package/Tab.svelte
CHANGED
|
@@ -102,6 +102,7 @@ export const focus = (options) => {
|
|
|
102
102
|
font: inherit;
|
|
103
103
|
overflow: hidden;
|
|
104
104
|
padding: 0.5em 1em 0.25em 1em;
|
|
105
|
+
position: relative;
|
|
105
106
|
text-decoration: none;
|
|
106
107
|
text-overflow: ellipsis;
|
|
107
108
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
@@ -144,8 +145,25 @@ export const focus = (options) => {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
.sterling-tab:disabled {
|
|
147
|
-
color: var(--stsv-Common__color--disabled);
|
|
148
148
|
cursor: not-allowed;
|
|
149
|
+
outline: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.sterling-tab::after {
|
|
153
|
+
background: var(--stsv-Disabled__background);
|
|
154
|
+
bottom: 0;
|
|
155
|
+
content: '';
|
|
156
|
+
left: 0;
|
|
157
|
+
opacity: 0;
|
|
158
|
+
position: absolute;
|
|
159
|
+
right: 0;
|
|
160
|
+
top: 0;
|
|
161
|
+
pointer-events: none;
|
|
162
|
+
transition: opacity 250ms;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.sterling-tab:disabled::after {
|
|
166
|
+
opacity: 1;
|
|
149
167
|
}
|
|
150
168
|
|
|
151
169
|
.content {
|
|
@@ -190,7 +208,11 @@ export const focus = (options) => {
|
|
|
190
208
|
background-color: var(--stsv-Input__color);
|
|
191
209
|
}
|
|
192
210
|
|
|
193
|
-
|
|
194
|
-
|
|
211
|
+
@media (prefers-reduced-motion) {
|
|
212
|
+
.sterling-tab,
|
|
213
|
+
.sterling-tab::after,
|
|
214
|
+
.indicator {
|
|
215
|
+
transition: none;
|
|
216
|
+
}
|
|
195
217
|
}
|
|
196
218
|
</style>
|
package/TabList.svelte
CHANGED
|
@@ -234,7 +234,7 @@ setContext(TAB_LIST_CONTEXT_KEY, {
|
|
|
234
234
|
grid-auto-flow: column;
|
|
235
235
|
grid-template-columns: repeat(auto-fill, auto);
|
|
236
236
|
grid-template-rows: 1fr;
|
|
237
|
-
overflow-x:
|
|
237
|
+
overflow-x: auto;
|
|
238
238
|
overflow-y: hidden;
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -243,7 +243,7 @@ setContext(TAB_LIST_CONTEXT_KEY, {
|
|
|
243
243
|
grid-template-rows: auto;
|
|
244
244
|
grid-template-columns: 1fr;
|
|
245
245
|
overflow-x: hidden;
|
|
246
|
-
overflow-y:
|
|
246
|
+
overflow-y: auto;
|
|
247
247
|
row-gap: 0.5em;
|
|
248
248
|
}
|
|
249
249
|
|
package/TextArea.svelte
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
export let autoHeight = false;
|
|
3
|
+
export let disabled = false;
|
|
2
4
|
export let resize = "none";
|
|
3
|
-
export let value;
|
|
5
|
+
export let value = "";
|
|
4
6
|
let textAreaRef;
|
|
5
7
|
const autoSetHeight = () => {
|
|
6
8
|
if (autoHeight && textAreaRef) {
|
|
@@ -13,6 +15,9 @@ const onInput = () => {
|
|
|
13
15
|
};
|
|
14
16
|
$:
|
|
15
17
|
autoHeight, autoSetHeight();
|
|
18
|
+
onMount(() => {
|
|
19
|
+
autoSetHeight();
|
|
20
|
+
});
|
|
16
21
|
export const blur = () => {
|
|
17
22
|
textAreaRef?.blur();
|
|
18
23
|
};
|
|
@@ -37,51 +42,59 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
37
42
|
};
|
|
38
43
|
</script>
|
|
39
44
|
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
45
|
+
<div class="sterling-text-area" class:disabled>
|
|
46
|
+
<textarea
|
|
47
|
+
bind:this={textAreaRef}
|
|
48
|
+
bind:value
|
|
49
|
+
{disabled}
|
|
50
|
+
rows="1"
|
|
51
|
+
style={`--TextArea__resize: ${resize};`}
|
|
52
|
+
on:beforeinput
|
|
53
|
+
on:blur
|
|
54
|
+
on:click
|
|
55
|
+
on:change
|
|
56
|
+
on:copy
|
|
57
|
+
on:cut
|
|
58
|
+
on:paste
|
|
59
|
+
on:dblclick
|
|
60
|
+
on:dragend
|
|
61
|
+
on:dragenter
|
|
62
|
+
on:dragleave
|
|
63
|
+
on:dragover
|
|
64
|
+
on:dragstart
|
|
65
|
+
on:drop
|
|
66
|
+
on:focus
|
|
67
|
+
on:focusin
|
|
68
|
+
on:focusout
|
|
69
|
+
on:input
|
|
70
|
+
on:invalid
|
|
71
|
+
on:keydown
|
|
72
|
+
on:keypress
|
|
73
|
+
on:keyup
|
|
74
|
+
on:mousedown
|
|
75
|
+
on:mouseenter
|
|
76
|
+
on:mouseleave
|
|
77
|
+
on:mousemove
|
|
78
|
+
on:mouseover
|
|
79
|
+
on:mouseout
|
|
80
|
+
on:mouseup
|
|
81
|
+
on:select
|
|
82
|
+
on:submit
|
|
83
|
+
on:reset
|
|
84
|
+
on:wheel
|
|
85
|
+
on:input={onInput}
|
|
86
|
+
{...$$restProps}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
82
89
|
|
|
83
90
|
<style>
|
|
84
91
|
.sterling-text-area {
|
|
92
|
+
position: relative;
|
|
93
|
+
height: 100%;
|
|
94
|
+
width: 100%;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
textarea {
|
|
85
98
|
background-color: var(--stsv-Input__background-color);
|
|
86
99
|
border-color: var(--stsv-Input__border-color);
|
|
87
100
|
border-radius: var(--stsv-Input__border-radius);
|
|
@@ -89,6 +102,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
89
102
|
border-width: var(--stsv-Input__border-width);
|
|
90
103
|
box-sizing: border-box;
|
|
91
104
|
color: var(--stsv-Input__color);
|
|
105
|
+
display: block;
|
|
92
106
|
font: inherit;
|
|
93
107
|
line-height: inherit;
|
|
94
108
|
height: 100%;
|
|
@@ -102,13 +116,13 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
102
116
|
width: 100%;
|
|
103
117
|
}
|
|
104
118
|
|
|
105
|
-
|
|
119
|
+
textarea:hover {
|
|
106
120
|
background-color: var(--stsv-Input__background-color--hover);
|
|
107
121
|
border-color: var(--stsv-Input__border-color--hover);
|
|
108
122
|
color: var(--stsv-Input__color--hover);
|
|
109
123
|
}
|
|
110
124
|
|
|
111
|
-
|
|
125
|
+
textarea:focus {
|
|
112
126
|
background-color: var(--stsv-Input__background-color--focus);
|
|
113
127
|
border-color: var(--stsv-Input__border-color--focus);
|
|
114
128
|
color: var(--stsv-Input__color--focus);
|
|
@@ -119,23 +133,36 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
119
133
|
}
|
|
120
134
|
|
|
121
135
|
.sterling-text-area:disabled {
|
|
122
|
-
background-color: var(--stsv-Common__background-color--disabled);
|
|
123
|
-
border-color: var(--stsv--Common__border-color--disabled);
|
|
124
|
-
color: var(--stsv-Common__color--disabled);
|
|
125
136
|
cursor: not-allowed;
|
|
137
|
+
outline: none;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
.sterling-text-area::
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
.sterling-text-area::after {
|
|
141
|
+
background: var(--stsv-Disabled__background);
|
|
142
|
+
bottom: 0;
|
|
143
|
+
content: '';
|
|
144
|
+
left: 0;
|
|
145
|
+
opacity: 0;
|
|
146
|
+
position: absolute;
|
|
147
|
+
right: 0;
|
|
148
|
+
top: 0;
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
transition: opacity 250ms;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.sterling-text-area.disabled::after {
|
|
154
|
+
opacity: 1;
|
|
131
155
|
}
|
|
132
156
|
|
|
133
|
-
|
|
134
|
-
color: var(--stsv-Display__color--
|
|
157
|
+
textarea::placeholder {
|
|
158
|
+
color: var(--stsv-Display__color--faint);
|
|
159
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
135
160
|
}
|
|
136
161
|
|
|
137
162
|
@media (prefers-reduced-motion) {
|
|
138
|
-
|
|
163
|
+
textarea,
|
|
164
|
+
.sterling-text-area,
|
|
165
|
+
.sterling-text-area::after {
|
|
139
166
|
transition: none;
|
|
140
167
|
}
|
|
141
168
|
}
|
package/TextArea.svelte.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
autoHeight?: boolean | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
6
7
|
resize?: "none" | "horizontal" | "vertical" | "both" | undefined;
|
|
7
|
-
value
|
|
8
|
+
value?: string | undefined;
|
|
8
9
|
blur?: (() => void) | undefined;
|
|
9
10
|
click?: (() => void) | undefined;
|
|
10
11
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
package/Tree.svelte
CHANGED
|
@@ -100,7 +100,9 @@ setContext(TREE_CONTEXT_KEY, {
|
|
|
100
100
|
on:wheel
|
|
101
101
|
{...$$restProps}
|
|
102
102
|
>
|
|
103
|
-
<
|
|
103
|
+
<div class="container">
|
|
104
|
+
<slot {composed} {disabled} />
|
|
105
|
+
</div>
|
|
104
106
|
</div>
|
|
105
107
|
|
|
106
108
|
<style>
|
|
@@ -112,14 +114,10 @@ setContext(TREE_CONTEXT_KEY, {
|
|
|
112
114
|
border-width: var(--stsv-Common__border-width);
|
|
113
115
|
box-sizing: border-box;
|
|
114
116
|
color: var(--stsv-Common__color);
|
|
115
|
-
display: flex;
|
|
116
|
-
flex-direction: column;
|
|
117
|
-
flex-wrap: nowrap;
|
|
118
117
|
height: 100%;
|
|
119
118
|
overflow-x: hidden;
|
|
120
|
-
overflow-y:
|
|
119
|
+
overflow-y: auto;
|
|
121
120
|
margin: 0;
|
|
122
|
-
position: relative;
|
|
123
121
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
124
122
|
}
|
|
125
123
|
|
|
@@ -137,18 +135,51 @@ setContext(TREE_CONTEXT_KEY, {
|
|
|
137
135
|
outline-width: var(--stsv-Common__outline-width);
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
.sterling-tree.disabled {
|
|
141
|
-
background-color: var(--stsv-Common__background-color--disabled);
|
|
142
|
-
border-color: var(--stsv--Common__border-color--disabled);
|
|
143
|
-
color: var(--stsv-Common__color--disabled);
|
|
144
|
-
cursor: not-allowed;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
138
|
.sterling-tree.composed,
|
|
148
139
|
.sterling-tree.composed:hover,
|
|
149
140
|
.sterling-tree.composed.using-keyboard:focus-visible,
|
|
150
141
|
.sterling-tree.composed.disabled {
|
|
142
|
+
background: none;
|
|
151
143
|
border: none;
|
|
152
144
|
outline: none;
|
|
153
145
|
}
|
|
146
|
+
|
|
147
|
+
.sterling-tree.disabled * {
|
|
148
|
+
cursor: not-allowed;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* ----- container - a layout panel that grows with the items ----- */
|
|
152
|
+
|
|
153
|
+
.container {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
flex-wrap: nowrap;
|
|
157
|
+
position: relative;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.container::after {
|
|
161
|
+
background: var(--stsv-Disabled__background);
|
|
162
|
+
bottom: 0;
|
|
163
|
+
content: '';
|
|
164
|
+
left: 0;
|
|
165
|
+
opacity: 0;
|
|
166
|
+
position: absolute;
|
|
167
|
+
pointer-events: none;
|
|
168
|
+
right: 0;
|
|
169
|
+
top: 0;
|
|
170
|
+
transition: opacity 250ms;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.sterling-tree.disabled .container::after {
|
|
174
|
+
opacity: 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* ----- media queries ----- */
|
|
178
|
+
|
|
179
|
+
@media (prefers-reduced-motion) {
|
|
180
|
+
.sterling-tree,
|
|
181
|
+
.container::after {
|
|
182
|
+
transition: none;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
154
185
|
</style>
|