@geoffcox/sterling-svelte 0.0.7 → 0.0.9
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/buttons/Button.svelte +152 -145
- package/buttons/Button.svelte.d.ts +1 -1
- package/buttons/{types.d.ts → Button.types.d.ts} +0 -0
- package/buttons/{types.js → Button.types.js} +0 -0
- package/display/Progress.svelte +182 -0
- package/display/Progress.svelte.d.ts +42 -0
- package/display/Progress.types.d.ts +1 -0
- package/display/Progress.types.js +1 -0
- package/index.d.ts +7 -3
- package/index.js +7 -3
- package/inputs/Checkbox.svelte +8 -0
- package/inputs/Input.svelte +9 -1
- package/inputs/Radio.svelte +8 -0
- package/inputs/Select.svelte +7 -10
- package/inputs/Slider.svelte +221 -134
- package/inputs/Slider.svelte.d.ts +3 -1
- package/lists/List.svelte +9 -0
- package/package.json +7 -2
- package/surfaces/CloseX.svelte +5 -0
- package/surfaces/CloseX.svelte.d.ts +23 -0
- package/surfaces/Dialog.svelte +241 -0
- package/surfaces/Dialog.svelte.d.ts +34 -0
- package/theme/colors.js +2 -0
- package/theme/darkTheme.js +3 -3
- package/theme/lightTheme.js +2 -2
package/inputs/Slider.svelte
CHANGED
|
@@ -121,160 +121,247 @@ const onKeyDown = (event) => {
|
|
|
121
121
|
<!-- @component
|
|
122
122
|
Slider lets the user chose a value within a min/max range by dragging a thumb button.
|
|
123
123
|
-->
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
124
|
+
{#if $$slots.label}
|
|
125
|
+
<label class="sterling-slider-label" class:vertical>
|
|
126
|
+
<div class="label-content" class:disabled>
|
|
127
|
+
<slot name="label" />
|
|
128
|
+
</div>
|
|
129
|
+
<div
|
|
130
|
+
class="sterling-slider labeled"
|
|
131
|
+
class:disabled
|
|
132
|
+
class:horizontal={!vertical}
|
|
133
|
+
class:vertical
|
|
134
|
+
role="slider"
|
|
135
|
+
aria-valuemin={0}
|
|
136
|
+
aria-valuenow={value}
|
|
137
|
+
aria-valuemax={max}
|
|
138
|
+
tabindex={!disabled ? 0 : undefined}
|
|
139
|
+
{...$$restProps}
|
|
140
|
+
on:keydown={onKeyDown}
|
|
141
|
+
on:pointerdown={onPointerDown}
|
|
142
|
+
on:pointermove={onPointerMove}
|
|
143
|
+
on:pointerup={onPointerUp}
|
|
144
|
+
>
|
|
145
|
+
<div
|
|
146
|
+
class="container"
|
|
147
|
+
bind:this={sliderRef}
|
|
148
|
+
bind:clientWidth={sliderWidth}
|
|
149
|
+
bind:clientHeight={sliderHeight}
|
|
150
|
+
>
|
|
151
|
+
<div class="track" />
|
|
152
|
+
<div
|
|
153
|
+
class="fill"
|
|
154
|
+
style={vertical ? `height: ${valueOffset}px` : `width: ${valueOffset}px`}
|
|
155
|
+
/>
|
|
156
|
+
<div
|
|
157
|
+
class="thumb"
|
|
158
|
+
style={vertical ? `bottom: ${valueOffset}px` : `left: ${valueOffset}px`}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</label>
|
|
163
|
+
{:else}
|
|
164
|
+
<div
|
|
165
|
+
class="sterling-slider"
|
|
166
|
+
class:disabled
|
|
167
|
+
class:horizontal={!vertical}
|
|
168
|
+
class:vertical
|
|
169
|
+
role="slider"
|
|
170
|
+
aria-valuemin={0}
|
|
171
|
+
aria-valuenow={value}
|
|
172
|
+
aria-valuemax={max}
|
|
173
|
+
tabindex={!disabled ? 0 : undefined}
|
|
174
|
+
{...$$restProps}
|
|
175
|
+
on:keydown={onKeyDown}
|
|
176
|
+
on:pointerdown={onPointerDown}
|
|
177
|
+
on:pointermove={onPointerMove}
|
|
178
|
+
on:pointerup={onPointerUp}
|
|
179
|
+
>
|
|
180
|
+
<div
|
|
181
|
+
class="container"
|
|
182
|
+
bind:this={sliderRef}
|
|
183
|
+
bind:clientWidth={sliderWidth}
|
|
184
|
+
bind:clientHeight={sliderHeight}
|
|
185
|
+
>
|
|
186
|
+
<div class="track" />
|
|
187
|
+
<div class="fill" style={vertical ? `height: ${valueOffset}px` : `width: ${valueOffset}px`} />
|
|
188
|
+
<div class="thumb" style={vertical ? `bottom: ${valueOffset}px` : `left: ${valueOffset}px`} />
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
{/if}
|
|
147
192
|
|
|
148
193
|
<style>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
display: grid;
|
|
155
|
-
}
|
|
194
|
+
.sterling-slider-label {
|
|
195
|
+
display: grid;
|
|
196
|
+
grid-template-columns: 1fr;
|
|
197
|
+
grid-template-rows: auto 1fr;
|
|
198
|
+
}
|
|
156
199
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
200
|
+
.sterling-slider-label.vertical {
|
|
201
|
+
justify-items: center;
|
|
202
|
+
height: 100%;
|
|
203
|
+
}
|
|
160
204
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
205
|
+
.label-content {
|
|
206
|
+
font-size: 0.7em;
|
|
207
|
+
color: var(--Display__color--subtle);
|
|
208
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
209
|
+
}
|
|
164
210
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
outline-style: var(--Common__outline-style);
|
|
169
|
-
outline-width: var(--Common__outline-width);
|
|
170
|
-
}
|
|
211
|
+
.label-content.disabled {
|
|
212
|
+
color: var(--Display__color--disabled);
|
|
213
|
+
}
|
|
171
214
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
215
|
+
.sterling-slider {
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
outline: none;
|
|
218
|
+
padding: 0;
|
|
219
|
+
overflow: visible;
|
|
220
|
+
display: grid;
|
|
221
|
+
height: 100%;
|
|
222
|
+
}
|
|
175
223
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
224
|
+
.sterling-slider.labeled {
|
|
225
|
+
height: unset;
|
|
226
|
+
}
|
|
179
227
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
228
|
+
.container {
|
|
229
|
+
position: relative;
|
|
230
|
+
}
|
|
183
231
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
232
|
+
.track {
|
|
233
|
+
position: absolute;
|
|
234
|
+
background: var(--Display__background-color);
|
|
235
|
+
}
|
|
188
236
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
height: 3px;
|
|
194
|
-
transform: translate(0, -50%);
|
|
195
|
-
}
|
|
237
|
+
.fill {
|
|
238
|
+
background: var(--Display__color);
|
|
239
|
+
position: absolute;
|
|
240
|
+
}
|
|
196
241
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
242
|
+
.thumb {
|
|
243
|
+
background-color: var(--Button__background-color);
|
|
244
|
+
border-color: var(--Button__border-color);
|
|
245
|
+
border-radius: 10000px;
|
|
246
|
+
border-style: var(--Button__border-style);
|
|
247
|
+
border-width: var(--Button__border-width);
|
|
248
|
+
box-sizing: border-box;
|
|
249
|
+
color: var(--Button__color);
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
display: block;
|
|
252
|
+
font: inherit;
|
|
253
|
+
height: 1.5em;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
padding: 0;
|
|
256
|
+
text-decoration: none;
|
|
257
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
258
|
+
white-space: nowrap;
|
|
259
|
+
position: absolute;
|
|
260
|
+
width: 1.5em;
|
|
261
|
+
}
|
|
204
262
|
|
|
205
|
-
|
|
206
|
-
background: var(--Common__background-color--disabled);
|
|
207
|
-
}
|
|
263
|
+
/* ----- horizontal ----- */
|
|
208
264
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
265
|
+
.sterling-slider.horizontal {
|
|
266
|
+
height: 2em;
|
|
267
|
+
}
|
|
213
268
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
transform: translate(0, -50%);
|
|
218
|
-
}
|
|
269
|
+
.sterling-slider.horizontal .container {
|
|
270
|
+
margin: 0 0.75em;
|
|
271
|
+
}
|
|
219
272
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
273
|
+
.sterling-slider.horizontal .track {
|
|
274
|
+
left: 0;
|
|
275
|
+
right: 0;
|
|
276
|
+
top: 50%;
|
|
277
|
+
height: 3px;
|
|
278
|
+
transform: translate(0, -50%);
|
|
279
|
+
}
|
|
226
280
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
.sterling-slider.horizontal .fill {
|
|
282
|
+
height: 3px;
|
|
283
|
+
top: 50%;
|
|
284
|
+
transform: translate(0, -50%);
|
|
285
|
+
}
|
|
230
286
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
border-style: var(--Button__border-style);
|
|
236
|
-
border-width: var(--Button__border-width);
|
|
237
|
-
box-sizing: border-box;
|
|
238
|
-
color: var(--Button__color);
|
|
239
|
-
cursor: pointer;
|
|
240
|
-
display: block;
|
|
241
|
-
font: inherit;
|
|
242
|
-
height: 1.5em;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
padding: 0;
|
|
245
|
-
text-decoration: none;
|
|
246
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
247
|
-
white-space: nowrap;
|
|
248
|
-
position: absolute;
|
|
249
|
-
width: 1.5em;
|
|
250
|
-
}
|
|
287
|
+
.sterling-slider.horizontal .thumb {
|
|
288
|
+
top: 50%;
|
|
289
|
+
transform: translate(-50%, -50%);
|
|
290
|
+
}
|
|
251
291
|
|
|
252
|
-
|
|
253
|
-
top: 50%;
|
|
254
|
-
transform: translate(-50%, -50%);
|
|
255
|
-
}
|
|
292
|
+
/* ----- vertical ----- */
|
|
256
293
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
294
|
+
.sterling-slider.vertical {
|
|
295
|
+
width: 2em;
|
|
296
|
+
}
|
|
297
|
+
.sterling-slider.vertical .container {
|
|
298
|
+
margin: 0.75em 0;
|
|
299
|
+
}
|
|
261
300
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
301
|
+
.sterling-slider.vertical .track {
|
|
302
|
+
bottom: 0;
|
|
303
|
+
left: 50%;
|
|
304
|
+
top: 0;
|
|
305
|
+
transform: translate(-50%, 0);
|
|
306
|
+
width: 3px;
|
|
307
|
+
}
|
|
267
308
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
309
|
+
.sterling-slider.vertical .fill {
|
|
310
|
+
bottom: 0;
|
|
311
|
+
left: 50%;
|
|
312
|
+
transform: translate(-50%, 0);
|
|
313
|
+
width: 3px;
|
|
314
|
+
}
|
|
273
315
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
316
|
+
.sterling-slider.vertical .thumb {
|
|
317
|
+
left: 50%;
|
|
318
|
+
transform: translate(-50%, 50%);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* ----- hover ----- */
|
|
322
|
+
|
|
323
|
+
.thumb:hover {
|
|
324
|
+
background-color: var(--Button__background-color--hover);
|
|
325
|
+
border-color: var(--Button__border-color--hover);
|
|
326
|
+
color: var(--Button__color--hover);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ----- active ----- */
|
|
330
|
+
|
|
331
|
+
.thumb:active {
|
|
332
|
+
background-color: var(--Button__background-color--active);
|
|
333
|
+
border-color: var(--Button__border-color--active);
|
|
334
|
+
color: var(--Button__color--active);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* ----- focus ----- */
|
|
338
|
+
.sterling-slider:focus-visible {
|
|
339
|
+
outline-color: var(--Common__outline-color);
|
|
340
|
+
outline-offset: var(--Common__outline-offset);
|
|
341
|
+
outline-style: var(--Common__outline-style);
|
|
342
|
+
outline-width: var(--Common__outline-width);
|
|
343
|
+
}
|
|
344
|
+
/* ----- disabled ----- */
|
|
345
|
+
|
|
346
|
+
.sterling-slider.disabled .track {
|
|
347
|
+
background: var(--Common__background-color--disabled);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.sterling-slider.disabled .fill {
|
|
351
|
+
background: var(--Common__color--disabled);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.sterling-slider.disabled .thumb {
|
|
355
|
+
background-color: var(--Common__background-color--disabled);
|
|
356
|
+
border-color: var(--Common__border-color--disabled);
|
|
357
|
+
color: var(--Common__color--disabled);
|
|
358
|
+
cursor: not-allowed;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@media (prefers-reduced-motion) {
|
|
362
|
+
.thumb,
|
|
363
|
+
.label-content {
|
|
364
|
+
transition: none;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
280
367
|
</style>
|
package/lists/List.svelte
CHANGED
|
@@ -318,4 +318,13 @@ A list of items where a single item can be selected.
|
|
|
318
318
|
.list-item.disabled {
|
|
319
319
|
color: var(--Input__color--disabled);
|
|
320
320
|
}
|
|
321
|
+
|
|
322
|
+
@media (prefers-reduced-motion) {
|
|
323
|
+
.sterling-list-label,
|
|
324
|
+
.sterling-list,
|
|
325
|
+
.list-item,
|
|
326
|
+
.label-content {
|
|
327
|
+
transition: none;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
321
330
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@fontsource/fira-mono": "^4.5.10",
|
|
6
6
|
"@fontsource/overpass": "^4.5.10",
|
|
@@ -28,13 +28,16 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@floating-ui/dom": "^1.1.0",
|
|
31
|
+
"lodash-es": "^4.17.21",
|
|
31
32
|
"uuid": "^9.0.0"
|
|
32
33
|
},
|
|
33
34
|
"exports": {
|
|
34
35
|
"./package.json": "./package.json",
|
|
35
36
|
"./buttons/Button.svelte": "./buttons/Button.svelte",
|
|
36
|
-
"./buttons/types": "./buttons/types.js",
|
|
37
|
+
"./buttons/Button.types": "./buttons/Button.types.js",
|
|
37
38
|
"./clickOutside": "./clickOutside.js",
|
|
39
|
+
"./display/Progress.svelte": "./display/Progress.svelte",
|
|
40
|
+
"./display/Progress.types": "./display/Progress.types.js",
|
|
38
41
|
".": "./index.js",
|
|
39
42
|
"./inputs/Checkbox.svelte": "./inputs/Checkbox.svelte",
|
|
40
43
|
"./inputs/Input.svelte": "./inputs/Input.svelte",
|
|
@@ -42,6 +45,8 @@
|
|
|
42
45
|
"./inputs/Select.svelte": "./inputs/Select.svelte",
|
|
43
46
|
"./inputs/Slider.svelte": "./inputs/Slider.svelte",
|
|
44
47
|
"./lists/List.svelte": "./lists/List.svelte",
|
|
48
|
+
"./surfaces/CloseX.svelte": "./surfaces/CloseX.svelte",
|
|
49
|
+
"./surfaces/Dialog.svelte": "./surfaces/Dialog.svelte",
|
|
45
50
|
"./theme/applyDarkTheme": "./theme/applyDarkTheme.js",
|
|
46
51
|
"./theme/applyLightTheme": "./theme/applyLightTheme.js",
|
|
47
52
|
"./theme/applyTheme": "./theme/applyTheme.js",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" {...$$restProps}>
|
|
2
|
+
<path
|
|
3
|
+
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
|
|
4
|
+
/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} CloseXProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} CloseXEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} CloseXSlots */
|
|
4
|
+
export default class CloseX extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type CloseXProps = typeof __propDef.props;
|
|
11
|
+
export type CloseXEvents = typeof __propDef.events;
|
|
12
|
+
export type CloseXSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|