@geoffcox/sterling-svelte 0.0.6 → 0.0.7
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/@types/clickOutside.d.ts +5 -0
- package/index.d.ts +4 -1
- package/index.js +4 -1
- package/inputs/Input.svelte +2 -0
- package/inputs/Radio.svelte +1 -0
- package/inputs/Select.svelte +23 -17
- package/inputs/Select.svelte.d.ts +4 -5
- package/lists/List.svelte +10 -2
- package/package.json +2 -1
package/index.d.ts
CHANGED
|
@@ -7,8 +7,11 @@ export { lightTheme } from './theme/lightTheme';
|
|
|
7
7
|
export { neutrals } from './theme/colors';
|
|
8
8
|
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
9
|
export { type ButtonVariant, type ButtonShape } from './buttons/types';
|
|
10
|
+
export { clickOutside } from './clickOutside';
|
|
10
11
|
import Button from './buttons/Button.svelte';
|
|
11
12
|
import Input from './inputs/Input.svelte';
|
|
13
|
+
import List from './lists/List.svelte';
|
|
12
14
|
import Checkbox from './inputs/Checkbox.svelte';
|
|
13
15
|
import Radio from './inputs/Radio.svelte';
|
|
14
|
-
|
|
16
|
+
import Select from './inputs/Select.svelte';
|
|
17
|
+
export { Button, Checkbox, Input, List, Radio, Select };
|
package/index.js
CHANGED
|
@@ -7,8 +7,11 @@ export { lightTheme } from './theme/lightTheme';
|
|
|
7
7
|
export { neutrals } from './theme/colors';
|
|
8
8
|
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
9
|
export {} from './buttons/types';
|
|
10
|
+
export { clickOutside } from './clickOutside';
|
|
10
11
|
import Button from './buttons/Button.svelte';
|
|
11
12
|
import Input from './inputs/Input.svelte';
|
|
13
|
+
import List from './lists/List.svelte';
|
|
12
14
|
import Checkbox from './inputs/Checkbox.svelte';
|
|
13
15
|
import Radio from './inputs/Radio.svelte';
|
|
14
|
-
|
|
16
|
+
import Select from './inputs/Select.svelte';
|
|
17
|
+
export { Button, Checkbox, Input, List, Radio, Select };
|
package/inputs/Input.svelte
CHANGED
|
@@ -90,6 +90,7 @@ export let disabled = false;
|
|
|
90
90
|
font-size: 0.7em;
|
|
91
91
|
margin: 0.5em 0 0 0.7em;
|
|
92
92
|
color: var(--Display__color--subtle);
|
|
93
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
.label-content.disabled {
|
|
@@ -151,6 +152,7 @@ export let disabled = false;
|
|
|
151
152
|
|
|
152
153
|
.sterling-input::placeholder {
|
|
153
154
|
color: var(--Display__color--faint);
|
|
155
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
.sterling-input:disabled::placeholder {
|
package/inputs/Radio.svelte
CHANGED
package/inputs/Select.svelte
CHANGED
|
@@ -137,8 +137,7 @@ const onPendingItemSelected = (event) => {
|
|
|
137
137
|
|
|
138
138
|
<!--
|
|
139
139
|
@component
|
|
140
|
-
|
|
141
|
-
A single item can be selected and is displayed as the value.
|
|
140
|
+
A single item that can be selected from a popup list of items.
|
|
142
141
|
-->
|
|
143
142
|
<div
|
|
144
143
|
bind:this={selectRef}
|
|
@@ -178,7 +177,7 @@ A single item can be selected and is displayed as the value.
|
|
|
178
177
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
179
178
|
<label class="sterling-select-label">
|
|
180
179
|
{#if $$slots.label}
|
|
181
|
-
<div class="label-content">
|
|
180
|
+
<div class="label-content" class:disabled>
|
|
182
181
|
<slot name="label" />
|
|
183
182
|
</div>
|
|
184
183
|
{/if}
|
|
@@ -189,7 +188,7 @@ A single item can be selected and is displayed as the value.
|
|
|
189
188
|
</slot>
|
|
190
189
|
</div>
|
|
191
190
|
<div class="button">
|
|
192
|
-
<slot name="button">
|
|
191
|
+
<slot name="button" {open}>
|
|
193
192
|
<div class="chevron" />
|
|
194
193
|
</slot>
|
|
195
194
|
</div>
|
|
@@ -241,6 +240,15 @@ A single item can be selected and is displayed as the value.
|
|
|
241
240
|
</div>
|
|
242
241
|
|
|
243
242
|
<style>
|
|
243
|
+
/*
|
|
244
|
+
sterling-select
|
|
245
|
+
sterling-select-label
|
|
246
|
+
label-content
|
|
247
|
+
input
|
|
248
|
+
value
|
|
249
|
+
button
|
|
250
|
+
(popup)
|
|
251
|
+
*/
|
|
244
252
|
.sterling-select {
|
|
245
253
|
background-color: var(--Input__background-color);
|
|
246
254
|
border-color: var(--Input__border-color);
|
|
@@ -248,10 +256,7 @@ A single item can be selected and is displayed as the value.
|
|
|
248
256
|
border-style: var(--Input__border-style);
|
|
249
257
|
border-width: var(--Input__border-width);
|
|
250
258
|
color: var(--Input__color);
|
|
251
|
-
display: flex;
|
|
252
|
-
flex-direction: row;
|
|
253
259
|
padding: 0;
|
|
254
|
-
position: relative;
|
|
255
260
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
256
261
|
}
|
|
257
262
|
|
|
@@ -279,21 +284,23 @@ A single item can be selected and is displayed as the value.
|
|
|
279
284
|
outline: none;
|
|
280
285
|
}
|
|
281
286
|
|
|
282
|
-
.label {
|
|
283
|
-
display: flex;
|
|
284
|
-
flex-direction: column;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
287
|
.label-content {
|
|
288
288
|
font-size: 0.7em;
|
|
289
289
|
margin: 0.5em 0.7em 0 0.7em;
|
|
290
290
|
color: var(--Display__color--subtle);
|
|
291
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.label-content.disabled {
|
|
295
|
+
color: var(--Display__color--disabled);
|
|
291
296
|
}
|
|
292
297
|
|
|
293
298
|
.input {
|
|
294
|
-
display:
|
|
295
|
-
|
|
296
|
-
|
|
299
|
+
display: grid;
|
|
300
|
+
grid-template-columns: 1fr auto;
|
|
301
|
+
grid-template-rows: auto;
|
|
302
|
+
align-content: center;
|
|
303
|
+
align-items: center;
|
|
297
304
|
}
|
|
298
305
|
|
|
299
306
|
.value {
|
|
@@ -341,8 +348,7 @@ A single item can be selected and is displayed as the value.
|
|
|
341
348
|
display: none;
|
|
342
349
|
overflow: hidden;
|
|
343
350
|
position: absolute;
|
|
344
|
-
box-shadow: rgba(0, 0, 0, 0.
|
|
345
|
-
rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;
|
|
351
|
+
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
346
352
|
width: fit-content;
|
|
347
353
|
height: fit-content;
|
|
348
354
|
z-index: 1;
|
|
@@ -37,7 +37,9 @@ declare const __propDef: {
|
|
|
37
37
|
slots: {
|
|
38
38
|
label: {};
|
|
39
39
|
value: {};
|
|
40
|
-
button: {
|
|
40
|
+
button: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
};
|
|
41
43
|
list: {};
|
|
42
44
|
default: {
|
|
43
45
|
disabled: boolean;
|
|
@@ -50,10 +52,7 @@ declare const __propDef: {
|
|
|
50
52
|
export type SelectProps = typeof __propDef.props;
|
|
51
53
|
export type SelectEvents = typeof __propDef.events;
|
|
52
54
|
export type SelectSlots = typeof __propDef.slots;
|
|
53
|
-
/**
|
|
54
|
-
* Pops up a list of items when clicked.
|
|
55
|
-
* A single item can be selected and is displayed as the value.
|
|
56
|
-
*/
|
|
55
|
+
/** A single item that can be selected from a popup list of items. */
|
|
57
56
|
export default class Select extends SvelteComponentTyped<SelectProps, SelectEvents, SelectSlots> {
|
|
58
57
|
}
|
|
59
58
|
export {};
|
package/lists/List.svelte
CHANGED
|
@@ -93,7 +93,7 @@ A list of items where a single item can be selected.
|
|
|
93
93
|
{#if $$slots.label}
|
|
94
94
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
95
95
|
<label class="sterling-list-label" class:horizontal class:disabled>
|
|
96
|
-
<div class="label-content">
|
|
96
|
+
<div class="label-content" class:disabled>
|
|
97
97
|
<slot name="label" />
|
|
98
98
|
</div>
|
|
99
99
|
<div
|
|
@@ -265,6 +265,7 @@ A list of items where a single item can be selected.
|
|
|
265
265
|
cursor: not-allowed;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
/* The background, border, and outline are removed when labeled as the label provides them */
|
|
268
269
|
.sterling-list.labeled,
|
|
269
270
|
.sterling-list.labeled:hover,
|
|
270
271
|
.sterling-list.labeled:focus-visible,
|
|
@@ -284,6 +285,13 @@ A list of items where a single item can be selected.
|
|
|
284
285
|
font-size: 0.7em;
|
|
285
286
|
margin: 0.5em 0.7em;
|
|
286
287
|
color: var(--Display__color--subtle);
|
|
288
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.label-content.disabled {
|
|
292
|
+
font-size: 0.7em;
|
|
293
|
+
margin: 0.5em 0.7em;
|
|
294
|
+
color: var(--Display__color--disabled);
|
|
287
295
|
}
|
|
288
296
|
|
|
289
297
|
.list-item {
|
|
@@ -293,7 +301,7 @@ A list of items where a single item can be selected.
|
|
|
293
301
|
padding: 0.5em;
|
|
294
302
|
outline: none;
|
|
295
303
|
text-overflow: ellipsis;
|
|
296
|
-
transition: background-color
|
|
304
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
297
305
|
white-space: nowrap;
|
|
298
306
|
}
|
|
299
307
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@fontsource/fira-mono": "^4.5.10",
|
|
6
6
|
"@fontsource/overpass": "^4.5.10",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"@sveltejs/adapter-static": "^1.0.0",
|
|
10
10
|
"@sveltejs/kit": "^1.0.0",
|
|
11
11
|
"@sveltejs/package": "^1.0.0",
|
|
12
|
+
"@types/uuid": "^9.0.0",
|
|
12
13
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
13
14
|
"@typescript-eslint/parser": "^5.45.0",
|
|
14
15
|
"eslint": "^8.28.0",
|