@geoffcox/sterling-svelte 0.0.23 → 0.0.24
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 +26 -7
- package/Field.svelte +11 -12
- package/Input.svelte +78 -60
- package/List.svelte +46 -16
- package/ListItem.svelte +30 -7
- package/MenuItem.svelte +6 -7
- package/MenuItemDisplay.svelte +33 -2
- package/MenuItemDisplay.svelte.d.ts +1 -0
- package/Progress.svelte +0 -13
- package/Progress.svelte.d.ts +0 -1
- package/Radio.svelte +28 -9
- package/Select.svelte +24 -4
- package/Slider.svelte +19 -10
- package/Switch.svelte +31 -11
- package/Tab.svelte +25 -3
- package/TabList.svelte +2 -2
- package/TextArea.svelte +81 -56
- package/TextArea.svelte.d.ts +1 -0
- package/Tree.svelte +44 -13
- package/TreeItem.svelte +8 -8
- package/TreeItem.svelte.d.ts +0 -1
- package/TreeItemDisplay.svelte +36 -11
- package/package.json +1 -1
- package/theme/darkTheme.js +9 -0
- package/theme/lightTheme.js +9 -0
package/MenuItem.svelte
CHANGED
|
@@ -110,7 +110,7 @@ afterUpdate(() => {
|
|
|
110
110
|
prevOpen = open;
|
|
111
111
|
});
|
|
112
112
|
const onKeyDown = (event) => {
|
|
113
|
-
if (!event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
113
|
+
if (!disabled && !event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
114
114
|
switch (event.key) {
|
|
115
115
|
case "ArrowDown":
|
|
116
116
|
if (depth === 0 && hasChildren) {
|
|
@@ -277,8 +277,11 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
277
277
|
>
|
|
278
278
|
<div class="item" id={displayId}>
|
|
279
279
|
<slot name="item" {checked} {depth} {disabled} {hasChildren} {open} {role} {text} {value}>
|
|
280
|
-
<MenuItemDisplay
|
|
281
|
-
|
|
280
|
+
<MenuItemDisplay
|
|
281
|
+
{checked}
|
|
282
|
+
{disabled}
|
|
283
|
+
hasChildren={depth > 0 && hasChildren}
|
|
284
|
+
menuItemRole={role}>{text}</MenuItemDisplay
|
|
282
285
|
>
|
|
283
286
|
</slot>
|
|
284
287
|
</div>
|
|
@@ -333,10 +336,6 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
333
336
|
background-color: var(--stsv-Input__background-color--selected);
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
.sterling-menu-item.disabled {
|
|
337
|
-
color: var(--stsv-Common__color--disabled);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
339
|
.sterling-menu-item.composed,
|
|
341
340
|
.sterling-menu-item.composed:focus,
|
|
342
341
|
.sterling-menu-item.composed:hover {
|
package/MenuItemDisplay.svelte
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script>export let checked = false;
|
|
2
|
+
export let disabled = false;
|
|
2
3
|
export let hasChildren = false;
|
|
3
4
|
export let menuItemRole = "menuitem";
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
|
-
<div class="menu-item-display">
|
|
7
|
+
<div class="sterling-menu-item-display" class:disabled>
|
|
7
8
|
<div
|
|
8
9
|
class="check"
|
|
9
10
|
class:checkmark={menuItemRole === 'menuitemcheckbox'}
|
|
@@ -23,7 +24,7 @@ export let menuItemRole = "menuitem";
|
|
|
23
24
|
</div>
|
|
24
25
|
|
|
25
26
|
<style>
|
|
26
|
-
.menu-item-display {
|
|
27
|
+
.sterling-menu-item-display {
|
|
27
28
|
align-items: center;
|
|
28
29
|
justify-items: flex-start;
|
|
29
30
|
display: grid;
|
|
@@ -94,4 +95,34 @@ export let menuItemRole = "menuitem";
|
|
|
94
95
|
border-top: 3px solid currentColor;
|
|
95
96
|
transform: translate(-50%, -50%) rotate(45deg);
|
|
96
97
|
}
|
|
98
|
+
|
|
99
|
+
.sterling-menu-item-display.disabled {
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.sterling-menu-item-display::after {
|
|
105
|
+
background: var(--stsv-Disabled__background);
|
|
106
|
+
bottom: 0;
|
|
107
|
+
content: '';
|
|
108
|
+
left: 0;
|
|
109
|
+
opacity: 0;
|
|
110
|
+
position: absolute;
|
|
111
|
+
right: 0;
|
|
112
|
+
top: 0;
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
transition: opacity 250ms;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.sterling-menu-item-display.disabled::after {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@media (prefers-reduced-motion) {
|
|
122
|
+
.sterling-menu-item-display::after,
|
|
123
|
+
.check,
|
|
124
|
+
.check::after {
|
|
125
|
+
transition: none;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
97
128
|
</style>
|
|
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
checked?: boolean | undefined;
|
|
5
|
+
disabled?: boolean | undefined;
|
|
5
6
|
hasChildren?: boolean | undefined;
|
|
6
7
|
menuItemRole?: "menuitem" | "menuitemcheckbox" | "menuitemradio" | undefined;
|
|
7
8
|
};
|
package/Progress.svelte
CHANGED
|
@@ -3,7 +3,6 @@ export let max = 100;
|
|
|
3
3
|
export let percent = 0;
|
|
4
4
|
export let vertical = false;
|
|
5
5
|
export let colorful = "none";
|
|
6
|
-
export let disabled = false;
|
|
7
6
|
let clientHeight;
|
|
8
7
|
let clientWidth;
|
|
9
8
|
$:
|
|
@@ -34,7 +33,6 @@ $:
|
|
|
34
33
|
|
|
35
34
|
<div
|
|
36
35
|
class="sterling-progress"
|
|
37
|
-
class:disabled
|
|
38
36
|
class:vertical
|
|
39
37
|
role="progressbar"
|
|
40
38
|
on:blur
|
|
@@ -157,17 +155,6 @@ $:
|
|
|
157
155
|
background-color: var(--stsv-Error__border-color);
|
|
158
156
|
}
|
|
159
157
|
|
|
160
|
-
/* ----- Disabled ----- */
|
|
161
|
-
|
|
162
|
-
.sterling-progress.disabled {
|
|
163
|
-
background: var(--stsv-Common__background-color--disabled);
|
|
164
|
-
border-color: var(--stsv-Common__border-color--disabled);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.sterling-progress.disabled .indicator {
|
|
168
|
-
background-color: var(--stsv-Display__color--disabled);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
158
|
@media (prefers-reduced-motion) {
|
|
172
159
|
.sterling-progress,
|
|
173
160
|
.indicator {
|
package/Progress.svelte.d.ts
CHANGED
package/Radio.svelte
CHANGED
|
@@ -43,7 +43,7 @@ onMount(() => {
|
|
|
43
43
|
@component
|
|
44
44
|
A styled HTML input type=radio element with optional label.
|
|
45
45
|
-->
|
|
46
|
-
<div class="sterling-radio">
|
|
46
|
+
<div class="sterling-radio" class:disabled>
|
|
47
47
|
<div class="container">
|
|
48
48
|
<input
|
|
49
49
|
bind:this={radioRef}
|
|
@@ -154,6 +154,11 @@ onMount(() => {
|
|
|
154
154
|
border-color: var(--stsv-Input__border-color);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
.sterling-radio:not(.disabled):hover .indicator {
|
|
158
|
+
background-color: var(--stsv-Input__background-color--hover);
|
|
159
|
+
border-color: var(--stsv-Input__border-color--hover);
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
input:focus-visible + .indicator {
|
|
158
163
|
outline-color: var(--stsv-Common__outline-color);
|
|
159
164
|
outline-offset: var(--stsv-Common__outline-offset);
|
|
@@ -161,11 +166,6 @@ onMount(() => {
|
|
|
161
166
|
outline-width: var(--stsv-Common__outline-width);
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
input:disabled + .indicator {
|
|
165
|
-
background-color: var(--stsv-Common__background-color--disabled);
|
|
166
|
-
border-color: var(--stsv-Common__border-color--disabled);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
169
|
.indicator::after {
|
|
170
170
|
background-color: transparent;
|
|
171
171
|
border-radius: 10000px;
|
|
@@ -183,13 +183,32 @@ onMount(() => {
|
|
|
183
183
|
background-color: var(--stsv-Input__color);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
.sterling-radio.disabled * {
|
|
187
|
+
cursor: not-allowed;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.container::after {
|
|
191
|
+
background: var(--stsv-Disabled__background);
|
|
192
|
+
border-radius: 10000px;
|
|
193
|
+
bottom: 0;
|
|
194
|
+
content: '';
|
|
195
|
+
left: 0;
|
|
196
|
+
opacity: 0;
|
|
197
|
+
position: absolute;
|
|
198
|
+
right: 0;
|
|
199
|
+
top: 0;
|
|
200
|
+
pointer-events: none;
|
|
201
|
+
transition: opacity 250ms;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.sterling-radio.disabled .container::after {
|
|
205
|
+
opacity: 1;
|
|
188
206
|
}
|
|
189
207
|
|
|
190
208
|
@media (prefers-reduced-motion) {
|
|
191
209
|
.indicator,
|
|
192
|
-
.indicator::after
|
|
210
|
+
.indicator::after,
|
|
211
|
+
.container::after {
|
|
193
212
|
transition: none;
|
|
194
213
|
}
|
|
195
214
|
}
|
package/Select.svelte
CHANGED
|
@@ -255,6 +255,7 @@ const onListSelect = (event) => {
|
|
|
255
255
|
grid-template-rows: auto;
|
|
256
256
|
outline: none;
|
|
257
257
|
padding: 0;
|
|
258
|
+
position: relative;
|
|
258
259
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
259
260
|
}
|
|
260
261
|
|
|
@@ -275,13 +276,27 @@ const onListSelect = (event) => {
|
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
.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
279
|
cursor: not-allowed;
|
|
282
280
|
outline: none;
|
|
283
281
|
}
|
|
284
282
|
|
|
283
|
+
.sterling-select::after {
|
|
284
|
+
background: var(--stsv-Disabled__background);
|
|
285
|
+
bottom: 0;
|
|
286
|
+
content: '';
|
|
287
|
+
left: 0;
|
|
288
|
+
opacity: 0;
|
|
289
|
+
position: absolute;
|
|
290
|
+
right: 0;
|
|
291
|
+
top: 0;
|
|
292
|
+
pointer-events: none;
|
|
293
|
+
transition: opacity 250ms;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.sterling-select.disabled::after {
|
|
297
|
+
opacity: 1;
|
|
298
|
+
}
|
|
299
|
+
|
|
285
300
|
.sterling-select.composed,
|
|
286
301
|
.sterling-select.composed:hover,
|
|
287
302
|
.sterling-select.composed.focus,
|
|
@@ -291,6 +306,10 @@ const onListSelect = (event) => {
|
|
|
291
306
|
outline: none;
|
|
292
307
|
}
|
|
293
308
|
|
|
309
|
+
.sterling-select.composed.disabled::after {
|
|
310
|
+
opacity: 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
294
313
|
.value {
|
|
295
314
|
padding: 0.5em;
|
|
296
315
|
}
|
|
@@ -355,7 +374,8 @@ const onListSelect = (event) => {
|
|
|
355
374
|
}
|
|
356
375
|
|
|
357
376
|
@media (prefers-reduced-motion) {
|
|
358
|
-
.sterling-select
|
|
377
|
+
.sterling-select,
|
|
378
|
+
.sterling-select::after {
|
|
359
379
|
transition: none;
|
|
360
380
|
}
|
|
361
381
|
}
|
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,6 +108,14 @@ 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) {
|
|
112
120
|
align-items: center;
|
|
113
121
|
column-gap: 0.5em;
|
|
@@ -175,12 +183,6 @@ export const focus = (options) => {
|
|
|
175
183
|
outline-width: var(--stsv-Common__outline-width);
|
|
176
184
|
}
|
|
177
185
|
|
|
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
186
|
.sterling-switch:not(.vertical) .switch {
|
|
185
187
|
width: 2em;
|
|
186
188
|
height: 1.25em;
|
|
@@ -204,7 +206,6 @@ export const focus = (options) => {
|
|
|
204
206
|
border-width: var(--stsv-Button__border-width);
|
|
205
207
|
box-sizing: border-box;
|
|
206
208
|
color: var(--stsv-Button__color);
|
|
207
|
-
cursor: pointer;
|
|
208
209
|
display: block;
|
|
209
210
|
font: inherit;
|
|
210
211
|
height: 1.25em;
|
|
@@ -225,10 +226,21 @@ export const focus = (options) => {
|
|
|
225
226
|
color: var(--stsv-Button__color--hover);
|
|
226
227
|
}
|
|
227
228
|
|
|
228
|
-
.sterling-switch
|
|
229
|
-
background
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
.sterling-switch .thumb::after {
|
|
230
|
+
background: var(--stsv-Disabled__background);
|
|
231
|
+
bottom: 0;
|
|
232
|
+
content: '';
|
|
233
|
+
left: 0;
|
|
234
|
+
opacity: 0;
|
|
235
|
+
position: absolute;
|
|
236
|
+
right: 0;
|
|
237
|
+
top: 0;
|
|
238
|
+
pointer-events: none;
|
|
239
|
+
transition: opacity 250ms;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.sterling-switch.disabled .thumb::after {
|
|
243
|
+
opacity: 1;
|
|
232
244
|
}
|
|
233
245
|
|
|
234
246
|
.sterling-switch:not(.vertical) .thumb {
|
|
@@ -240,4 +252,12 @@ export const focus = (options) => {
|
|
|
240
252
|
left: calc(-1 * var(--stsv-Button__border-width));
|
|
241
253
|
transform: translateY(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
|
|
242
254
|
}
|
|
255
|
+
|
|
256
|
+
@media (prefers-reduced-motion) {
|
|
257
|
+
.switch,
|
|
258
|
+
.thumb,
|
|
259
|
+
.thumb::after {
|
|
260
|
+
transition: none;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
243
263
|
</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,4 +1,6 @@
|
|
|
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
5
|
export let value;
|
|
4
6
|
let 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,57 @@ 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-area2" 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
|
-
.sterling-text-
|
|
91
|
+
.sterling-text-area2 {
|
|
92
|
+
position: relative;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
textarea {
|
|
85
96
|
background-color: var(--stsv-Input__background-color);
|
|
86
97
|
border-color: var(--stsv-Input__border-color);
|
|
87
98
|
border-radius: var(--stsv-Input__border-radius);
|
|
@@ -89,6 +100,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
89
100
|
border-width: var(--stsv-Input__border-width);
|
|
90
101
|
box-sizing: border-box;
|
|
91
102
|
color: var(--stsv-Input__color);
|
|
103
|
+
display: block;
|
|
92
104
|
font: inherit;
|
|
93
105
|
line-height: inherit;
|
|
94
106
|
height: 100%;
|
|
@@ -102,13 +114,13 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
102
114
|
width: 100%;
|
|
103
115
|
}
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
textarea:hover {
|
|
106
118
|
background-color: var(--stsv-Input__background-color--hover);
|
|
107
119
|
border-color: var(--stsv-Input__border-color--hover);
|
|
108
120
|
color: var(--stsv-Input__color--hover);
|
|
109
121
|
}
|
|
110
122
|
|
|
111
|
-
|
|
123
|
+
textarea:focus {
|
|
112
124
|
background-color: var(--stsv-Input__background-color--focus);
|
|
113
125
|
border-color: var(--stsv-Input__border-color--focus);
|
|
114
126
|
color: var(--stsv-Input__color--focus);
|
|
@@ -118,24 +130,37 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
118
130
|
outline-width: var(--stsv-Common__outline-width);
|
|
119
131
|
}
|
|
120
132
|
|
|
121
|
-
.sterling-text-
|
|
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);
|
|
133
|
+
.sterling-text-area2:disabled {
|
|
125
134
|
cursor: not-allowed;
|
|
135
|
+
outline: none;
|
|
126
136
|
}
|
|
127
137
|
|
|
128
|
-
.sterling-text-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
.sterling-text-area2::after {
|
|
139
|
+
background: var(--stsv-Disabled__background);
|
|
140
|
+
bottom: 0;
|
|
141
|
+
content: '';
|
|
142
|
+
left: 0;
|
|
143
|
+
opacity: 0;
|
|
144
|
+
position: absolute;
|
|
145
|
+
right: 0;
|
|
146
|
+
top: 0;
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
transition: opacity 250ms;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.sterling-text-area2.disabled::after {
|
|
152
|
+
opacity: 1;
|
|
131
153
|
}
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
color: var(--stsv-Display__color--
|
|
155
|
+
textarea::placeholder {
|
|
156
|
+
color: var(--stsv-Display__color--faint);
|
|
157
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
135
158
|
}
|
|
136
159
|
|
|
137
160
|
@media (prefers-reduced-motion) {
|
|
138
|
-
|
|
161
|
+
textarea,
|
|
162
|
+
.sterling-text-area2,
|
|
163
|
+
.sterling-text-area2::after {
|
|
139
164
|
transition: none;
|
|
140
165
|
}
|
|
141
166
|
}
|
package/TextArea.svelte.d.ts
CHANGED