@geoffcox/sterling-svelte 0.0.27 → 0.0.28
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 +7 -6
- package/Button.svelte.d.ts +2 -0
- package/Checkbox.svelte +18 -13
- package/Checkbox.svelte.d.ts +2 -1
- package/ColorPicker.svelte +33 -2
- package/ColorPicker.svelte.d.ts +28 -1
- package/Dropdown.svelte +16 -9
- package/HexColorSliders.svelte +25 -4
- package/HexColorSliders.svelte.d.ts +1 -1
- package/HslColorSliders.svelte +25 -4
- package/HslColorSliders.svelte.d.ts +1 -1
- package/Input.svelte +16 -10
- package/Input.svelte.d.ts +2 -2
- package/Label.constants.d.ts +1 -0
- package/Label.constants.js +1 -0
- package/Label.svelte +211 -13
- package/Label.svelte.d.ts +24 -4
- package/Label.types.d.ts +4 -0
- package/Link.svelte +2 -2
- package/Link.svelte.d.ts +1 -1
- package/List.svelte +6 -5
- package/ListItem.svelte +7 -6
- package/MenuButton.svelte +0 -4
- package/MenuButton.svelte.d.ts +2 -4
- package/MenuItem.svelte +1 -1
- package/MenuItem.svelte.d.ts +1 -1
- package/MenuItemDisplay.svelte +6 -5
- package/Progress.constants.d.ts +1 -1
- package/Progress.constants.js +1 -1
- package/Progress.svelte +27 -21
- package/Progress.svelte.d.ts +1 -1
- package/Progress.types.d.ts +3 -3
- package/Radio.svelte +18 -13
- package/Radio.svelte.d.ts +2 -1
- package/RgbColorSliders.svelte +25 -4
- package/RgbColorSliders.svelte.d.ts +1 -1
- package/Select.svelte +7 -6
- package/Select.svelte.d.ts +1 -1
- package/Slider.svelte +6 -8
- package/Switch.svelte +21 -13
- package/Switch.svelte.d.ts +3 -3
- package/Tab.svelte +6 -5
- package/Tab.svelte.d.ts +7 -4
- package/TabList.svelte +0 -1
- package/TextArea.svelte +8 -7
- package/TextArea.svelte.d.ts +2 -2
- package/Tooltip.svelte +47 -5
- package/Tooltip.svelte.d.ts +34 -2
- package/Tree.svelte +6 -5
- package/Tree.types.d.ts +5 -8
- package/TreeItem.svelte +2 -2
- package/TreeItem.svelte.d.ts +1 -1
- package/TreeItem.types.d.ts +4 -4
- package/TreeItemDisplay.svelte +7 -6
- package/TreeItemDisplay.svelte.d.ts +1 -1
- package/index.d.ts +7 -8
- package/index.js +5 -6
- package/package.json +3 -4
- package/theme/darkTheme.js +7 -8
- package/theme/lightTheme.js +14 -15
- package/Field.constants.d.ts +0 -1
- package/Field.constants.js +0 -1
- package/Field.svelte +0 -265
- package/Field.svelte.d.ts +0 -75
- package/Field.types.d.ts +0 -4
- /package/{Field.types.js → Label.types.js} +0 -0
package/Label.svelte
CHANGED
|
@@ -1,23 +1,92 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import Tooltip from "./Tooltip.svelte";
|
|
2
|
+
import { usingKeyboard } from "./stores/usingKeyboard";
|
|
3
|
+
let htmlFor = void 0;
|
|
4
|
+
export { htmlFor as for };
|
|
5
|
+
export let forwardClick = false;
|
|
6
|
+
export let text = void 0;
|
|
7
|
+
export let message = void 0;
|
|
8
|
+
export let required = false;
|
|
9
|
+
export let requiredReason = "required";
|
|
10
|
+
export let status = "none";
|
|
2
11
|
let labelRef;
|
|
3
|
-
|
|
4
|
-
|
|
12
|
+
let targetDisabled = false;
|
|
13
|
+
let targetRef = null;
|
|
14
|
+
const findTarget = () => {
|
|
15
|
+
let candidate = null;
|
|
16
|
+
if (htmlFor) {
|
|
17
|
+
candidate = labelRef?.querySelector(`[id="${htmlFor}"]`);
|
|
18
|
+
}
|
|
19
|
+
if (!candidate) {
|
|
20
|
+
candidate = labelRef?.querySelector(
|
|
21
|
+
'a[href], audio[controls], button, details, div[contenteditable], form, input, select, textarea, video[controls], [tabindex]:not([tabindex="-1"])'
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
targetRef = candidate;
|
|
25
|
+
};
|
|
26
|
+
const isElementDisabled = (element) => {
|
|
27
|
+
if (element) {
|
|
28
|
+
return element.getAttribute("aria-disabled") === "true" || element?.matches(":disabled") || element?.disabled === true || element?.classList.contains("disabled");
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
5
31
|
};
|
|
32
|
+
$:
|
|
33
|
+
$$slots.default, labelRef, htmlFor, findTarget();
|
|
34
|
+
$: {
|
|
35
|
+
targetDisabled = isElementDisabled(targetRef);
|
|
36
|
+
}
|
|
37
|
+
const mutationCallback = (mutations) => {
|
|
38
|
+
let disabled = void 0;
|
|
39
|
+
for (let i = 0; i < mutations.length; i++) {
|
|
40
|
+
const mutation = mutations[i];
|
|
41
|
+
if (mutation.type === "attributes") {
|
|
42
|
+
if (mutation.attributeName === "aria-disabled" || mutation.attributeName === "disabled" || mutation.attributeName === "class") {
|
|
43
|
+
if (isElementDisabled(targetRef)) {
|
|
44
|
+
disabled = true;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
disabled = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (disabled !== void 0) {
|
|
52
|
+
targetDisabled = disabled;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
let mutationObserver = new MutationObserver(mutationCallback);
|
|
56
|
+
$: {
|
|
57
|
+
mutationObserver.disconnect();
|
|
58
|
+
if (targetRef) {
|
|
59
|
+
mutationObserver.observe(targetRef, {
|
|
60
|
+
attributes: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
6
64
|
export const click = () => {
|
|
7
65
|
labelRef?.click();
|
|
8
66
|
};
|
|
67
|
+
export const blur = () => {
|
|
68
|
+
labelRef?.blur();
|
|
69
|
+
};
|
|
9
70
|
export const focus = (options) => {
|
|
10
|
-
labelRef?.focus();
|
|
71
|
+
labelRef?.focus(options);
|
|
72
|
+
};
|
|
73
|
+
const onClick = () => {
|
|
74
|
+
if (forwardClick) {
|
|
75
|
+
targetRef?.click();
|
|
76
|
+
}
|
|
11
77
|
};
|
|
12
78
|
</script>
|
|
13
79
|
|
|
14
80
|
<label
|
|
15
81
|
bind:this={labelRef}
|
|
16
|
-
aria-disabled={
|
|
82
|
+
aria-disabled={targetDisabled}
|
|
17
83
|
class="sterling-label"
|
|
18
|
-
class:disabled
|
|
84
|
+
class:disabled={targetDisabled}
|
|
85
|
+
class:using-keyboard={$usingKeyboard}
|
|
86
|
+
for={htmlFor}
|
|
19
87
|
on:blur
|
|
20
88
|
on:click
|
|
89
|
+
on:click={onClick}
|
|
21
90
|
on:copy
|
|
22
91
|
on:cut
|
|
23
92
|
on:dblclick
|
|
@@ -45,22 +114,151 @@ export const focus = (options) => {
|
|
|
45
114
|
on:paste
|
|
46
115
|
{...$$restProps}
|
|
47
116
|
>
|
|
48
|
-
|
|
117
|
+
{#if text || $$slots.text}
|
|
118
|
+
<slot name="text" disabled={targetDisabled} for={htmlFor} {forwardClick} {text} {required}>
|
|
119
|
+
<div class="text">
|
|
120
|
+
{text}
|
|
121
|
+
</div>
|
|
122
|
+
</slot>
|
|
123
|
+
{/if}
|
|
124
|
+
{#if $$slots.default}
|
|
125
|
+
<div class="content">
|
|
126
|
+
<slot />
|
|
127
|
+
</div>
|
|
128
|
+
{/if}
|
|
129
|
+
{#if message}
|
|
130
|
+
<slot name="message" disabled={targetDisabled} {message} {required} {status}>
|
|
131
|
+
<div
|
|
132
|
+
class="message"
|
|
133
|
+
class:info={status === 'info'}
|
|
134
|
+
class:success={status === 'success'}
|
|
135
|
+
class:warning={status === 'warning'}
|
|
136
|
+
class:error={status === 'danger'}
|
|
137
|
+
>
|
|
138
|
+
{message}
|
|
139
|
+
</div>
|
|
140
|
+
</slot>
|
|
141
|
+
{/if}
|
|
142
|
+
{#if required}
|
|
143
|
+
<slot name="required" {requiredReason}>
|
|
144
|
+
<Tooltip showOn="hover">
|
|
145
|
+
<span class="required-reason" slot="tip">{requiredReason}</span>
|
|
146
|
+
<div class="required">*</div>
|
|
147
|
+
</Tooltip>
|
|
148
|
+
</slot>
|
|
149
|
+
{/if}
|
|
49
150
|
</label>
|
|
50
151
|
|
|
51
152
|
<style>
|
|
52
|
-
label {
|
|
53
|
-
color: var(--stsv-
|
|
54
|
-
|
|
153
|
+
.sterling-label {
|
|
154
|
+
background-color: var(--stsv-input__background-color);
|
|
155
|
+
border-color: var(--stsv-input__border-color);
|
|
156
|
+
border-radius: var(--stsv-input__border-radius);
|
|
157
|
+
border-style: var(--stsv-input__border-style);
|
|
158
|
+
border-width: var(--stsv-input__border-width);
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
color: var(--stsv-input__color);
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
55
163
|
font: inherit;
|
|
164
|
+
margin: 0;
|
|
165
|
+
overflow: visible;
|
|
166
|
+
padding: 0;
|
|
167
|
+
position: relative;
|
|
168
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.sterling-label:not(.disabled):hover {
|
|
172
|
+
background-color: var(--stsv-input__background-color--hover);
|
|
173
|
+
border-color: var(--stsv-input__border-color--hover);
|
|
174
|
+
color: var(--stsv-input__color--hover);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.sterling-label.using-keyboard:focus-within {
|
|
178
|
+
border-color: var(--stsv-input__border-color--focus);
|
|
179
|
+
color: var(--stsv-input__color--focus);
|
|
180
|
+
outline-color: var(--stsv-common__outline-color);
|
|
181
|
+
outline-offset: var(--stsv-common__outline-offset);
|
|
182
|
+
outline-style: var(--stsv-common__outline-style);
|
|
183
|
+
outline-width: var(--stsv-common__outline-width);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.sterling-label.disabled {
|
|
187
|
+
cursor: not-allowed;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.sterling-label.disabled * {
|
|
191
|
+
cursor: not-allowed;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.text {
|
|
195
|
+
color: var(--stsv-common__color--secondary);
|
|
196
|
+
font-size: 0.8em;
|
|
197
|
+
margin: 0.5em 0.7em 0.2em 0.2em;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.text:empty {
|
|
201
|
+
margin: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.content {
|
|
205
|
+
display: grid;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.message {
|
|
209
|
+
box-sizing: border-box;
|
|
210
|
+
font-size: 0.8em;
|
|
211
|
+
background-color: var(--stsv-common__background-color--secondary);
|
|
212
|
+
color: var(--stsv-common__color--secondary);
|
|
213
|
+
padding: 0.5em;
|
|
214
|
+
width: 100%;
|
|
215
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.message.info {
|
|
219
|
+
background-color: var(--stsv-status--info__background-color);
|
|
220
|
+
border-color: var(--stsv-status--info__border-color);
|
|
221
|
+
color: var(--stsv-status--info__color);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.message.success {
|
|
225
|
+
background-color: var(--stsv-status--success__background-color);
|
|
226
|
+
border-color: var(--stsv-status--success__border-color);
|
|
227
|
+
color: var(--stsv-status--success__color);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.message.warning {
|
|
231
|
+
background-color: var(--stsv-status--warning__background-color);
|
|
232
|
+
border-color: var(--stsv-status--warning__border-color);
|
|
233
|
+
color: var(--stsv-status--warning__color);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.message.error {
|
|
237
|
+
background-color: var(--stsv-status--danger__background-color);
|
|
238
|
+
border-color: var(--stsv_--danger-color);
|
|
239
|
+
color: var(--stsv-status--danger__color);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.required {
|
|
243
|
+
text-align: center;
|
|
244
|
+
font-weight: bold;
|
|
245
|
+
box-sizing: border-box;
|
|
246
|
+
width: 1em;
|
|
247
|
+
height: 1em;
|
|
248
|
+
position: absolute;
|
|
249
|
+
top: 0;
|
|
250
|
+
right: 0;
|
|
56
251
|
}
|
|
57
252
|
|
|
58
|
-
|
|
59
|
-
|
|
253
|
+
.required-reason {
|
|
254
|
+
display: block;
|
|
255
|
+
padding: 4px;
|
|
60
256
|
}
|
|
61
257
|
|
|
62
258
|
@media (prefers-reduced-motion) {
|
|
63
|
-
label
|
|
259
|
+
.sterling-label,
|
|
260
|
+
.sterling-label::after,
|
|
261
|
+
.message {
|
|
64
262
|
transition: none;
|
|
65
263
|
}
|
|
66
264
|
}
|
package/Label.svelte.d.ts
CHANGED
|
@@ -2,9 +2,15 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
for?: string | undefined;
|
|
6
|
+
forwardClick?: boolean | undefined;
|
|
7
|
+
text?: string | undefined;
|
|
8
|
+
message?: string | undefined;
|
|
9
|
+
required?: boolean | undefined;
|
|
10
|
+
requiredReason?: string | undefined;
|
|
11
|
+
status?: string | undefined;
|
|
7
12
|
click?: (() => void) | undefined;
|
|
13
|
+
blur?: (() => void) | undefined;
|
|
8
14
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
9
15
|
};
|
|
10
16
|
events: {
|
|
@@ -39,8 +45,22 @@ declare const __propDef: {
|
|
|
39
45
|
[evt: string]: CustomEvent<any>;
|
|
40
46
|
};
|
|
41
47
|
slots: {
|
|
42
|
-
|
|
48
|
+
text: {
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
for: string | undefined;
|
|
51
|
+
forwardClick: boolean;
|
|
52
|
+
text: string | undefined;
|
|
53
|
+
required: boolean;
|
|
54
|
+
};
|
|
55
|
+
default: {};
|
|
56
|
+
message: {
|
|
43
57
|
disabled: boolean;
|
|
58
|
+
message: string | undefined;
|
|
59
|
+
required: boolean;
|
|
60
|
+
status: string;
|
|
61
|
+
};
|
|
62
|
+
required: {
|
|
63
|
+
requiredReason: string;
|
|
44
64
|
};
|
|
45
65
|
};
|
|
46
66
|
};
|
|
@@ -48,8 +68,8 @@ export type LabelProps = typeof __propDef.props;
|
|
|
48
68
|
export type LabelEvents = typeof __propDef.events;
|
|
49
69
|
export type LabelSlots = typeof __propDef.slots;
|
|
50
70
|
export default class Label extends SvelteComponentTyped<LabelProps, LabelEvents, LabelSlots> {
|
|
51
|
-
get blur(): () => void;
|
|
52
71
|
get click(): () => void;
|
|
72
|
+
get blur(): () => void;
|
|
53
73
|
get focus(): (options?: FocusOptions | undefined) => void;
|
|
54
74
|
}
|
|
55
75
|
export {};
|
package/Label.types.d.ts
ADDED
package/Link.svelte
CHANGED
package/Link.svelte.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
colorful?: boolean | undefined;
|
|
6
5
|
href: string;
|
|
7
6
|
disabled?: boolean | undefined;
|
|
7
|
+
colorful?: boolean | undefined;
|
|
8
8
|
variant?: string | undefined;
|
|
9
9
|
blur?: (() => void) | undefined;
|
|
10
10
|
click?: (() => void) | undefined;
|
package/List.svelte
CHANGED
|
@@ -299,11 +299,12 @@ A list of items where a single item can be selected.
|
|
|
299
299
|
|
|
300
300
|
.container::after {
|
|
301
301
|
background: repeating-linear-gradient(
|
|
302
|
-
|
|
303
|
-
var(--stsv-
|
|
304
|
-
var(--stsv-
|
|
305
|
-
var(--stsv-
|
|
306
|
-
var(--stsv-
|
|
302
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
303
|
+
var(--stsv-common--disabled__stripe-color),
|
|
304
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
305
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
306
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
307
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
307
308
|
);
|
|
308
309
|
content: '';
|
|
309
310
|
bottom: 0;
|
package/ListItem.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
|
-
import { LIST_CONTEXT_KEY } from "./List.constants";
|
|
3
2
|
import { readable, writable } from "svelte/store";
|
|
3
|
+
import { LIST_CONTEXT_KEY } from "./List.constants";
|
|
4
4
|
export let disabled = false;
|
|
5
5
|
export let value;
|
|
6
6
|
const {
|
|
@@ -116,11 +116,12 @@ export const focus = (options) => {
|
|
|
116
116
|
|
|
117
117
|
.sterling-list-item::after {
|
|
118
118
|
background: repeating-linear-gradient(
|
|
119
|
-
|
|
120
|
-
var(--stsv-
|
|
121
|
-
var(--stsv-
|
|
122
|
-
var(--stsv-
|
|
123
|
-
var(--stsv-
|
|
119
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
120
|
+
var(--stsv-common--disabled__stripe-color),
|
|
121
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
122
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
123
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
124
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
124
125
|
);
|
|
125
126
|
bottom: 0;
|
|
126
127
|
content: '';
|
package/MenuButton.svelte
CHANGED
|
@@ -7,9 +7,7 @@ import { idGenerator } from "./idGenerator";
|
|
|
7
7
|
import Popover from "./Popover.svelte";
|
|
8
8
|
import { clickOutside } from "./actions/clickOutside";
|
|
9
9
|
export let open = false;
|
|
10
|
-
export let shape = "rounded";
|
|
11
10
|
export let value;
|
|
12
|
-
export let variant = "regular";
|
|
13
11
|
const instanceId = idGenerator.nextId("MenuButton");
|
|
14
12
|
let buttonRef;
|
|
15
13
|
let reference;
|
|
@@ -99,8 +97,6 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
99
97
|
aria-owns={menuId}
|
|
100
98
|
data-value={value}
|
|
101
99
|
data-root-value={value}
|
|
102
|
-
{variant}
|
|
103
|
-
{shape}
|
|
104
100
|
on:blur
|
|
105
101
|
on:click
|
|
106
102
|
on:click={onClick}
|
package/MenuButton.svelte.d.ts
CHANGED
|
@@ -3,9 +3,7 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
open?: boolean | undefined;
|
|
6
|
-
shape?: "circular" | "rounded" | "square" | undefined;
|
|
7
6
|
value: string;
|
|
8
|
-
variant?: "regular" | "outline" | "ghost" | undefined;
|
|
9
7
|
click?: (() => void) | undefined;
|
|
10
8
|
blur?: (() => void) | undefined;
|
|
11
9
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
@@ -50,8 +48,8 @@ declare const __propDef: {
|
|
|
50
48
|
};
|
|
51
49
|
slots: {
|
|
52
50
|
default: {
|
|
53
|
-
shape:
|
|
54
|
-
variant:
|
|
51
|
+
shape: any;
|
|
52
|
+
variant: any;
|
|
55
53
|
};
|
|
56
54
|
items: {};
|
|
57
55
|
};
|
package/MenuItem.svelte
CHANGED
|
@@ -19,9 +19,9 @@ export let checked = false;
|
|
|
19
19
|
export let colorful = false;
|
|
20
20
|
export let composed = false;
|
|
21
21
|
export let disabled = false;
|
|
22
|
-
export let value;
|
|
23
22
|
export let role = "menuitem";
|
|
24
23
|
export let text = void 0;
|
|
24
|
+
export let value;
|
|
25
25
|
const {
|
|
26
26
|
isMenuBarItem,
|
|
27
27
|
openValues = writable([]),
|
package/MenuItem.svelte.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ declare const __propDef: {
|
|
|
6
6
|
colorful?: boolean | undefined;
|
|
7
7
|
composed?: boolean | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
|
-
value: string;
|
|
10
9
|
role?: "menuitem" | "menuitemcheckbox" | "menuitemradio" | undefined;
|
|
11
10
|
text?: string | undefined;
|
|
11
|
+
value: string;
|
|
12
12
|
blur?: (() => void) | undefined;
|
|
13
13
|
click?: (() => void) | undefined;
|
|
14
14
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
package/MenuItemDisplay.svelte
CHANGED
|
@@ -104,11 +104,12 @@ export let menuItemRole = "menuitem";
|
|
|
104
104
|
|
|
105
105
|
.sterling-menu-item-display::after {
|
|
106
106
|
background: repeating-linear-gradient(
|
|
107
|
-
|
|
108
|
-
var(--stsv-
|
|
109
|
-
var(--stsv-
|
|
110
|
-
var(--stsv-
|
|
111
|
-
var(--stsv-
|
|
107
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
108
|
+
var(--stsv-common--disabled__stripe-color),
|
|
109
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
110
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
111
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
112
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
112
113
|
);
|
|
113
114
|
bottom: 0;
|
|
114
115
|
content: '';
|
package/Progress.constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const PROGRESS_STATUSES: string[];
|
package/Progress.constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const PROGRESS_STATUSES = ['none', 'auto', 'info', 'success', 'warning', 'danger'];
|
package/Progress.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export let max = 100;
|
|
3
3
|
export let percent = 0;
|
|
4
4
|
export let vertical = false;
|
|
5
|
-
export let
|
|
5
|
+
export let status = "none";
|
|
6
6
|
export let disabled = false;
|
|
7
7
|
let clientHeight;
|
|
8
8
|
let clientWidth;
|
|
@@ -22,7 +22,7 @@ $:
|
|
|
22
22
|
$:
|
|
23
23
|
indicatorStyle = vertical ? `height: ${percentHeight}px` : `width: ${percentWidth}px`;
|
|
24
24
|
$:
|
|
25
|
-
indicatorColor =
|
|
25
|
+
indicatorColor = status === "auto" ? percent === 100 ? "success" : "info" : status;
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<!--
|
|
@@ -76,7 +76,7 @@ $:
|
|
|
76
76
|
class:info={indicatorColor === 'info'}
|
|
77
77
|
class:success={indicatorColor === 'success'}
|
|
78
78
|
class:warning={indicatorColor === 'warning'}
|
|
79
|
-
class:error={indicatorColor === '
|
|
79
|
+
class:error={indicatorColor === 'danger'}
|
|
80
80
|
style={indicatorStyle}
|
|
81
81
|
/>
|
|
82
82
|
</div>
|
|
@@ -84,22 +84,39 @@ $:
|
|
|
84
84
|
|
|
85
85
|
<style>
|
|
86
86
|
.sterling-progress {
|
|
87
|
-
display: inline-flex;
|
|
88
|
-
flex-direction: column;
|
|
89
87
|
align-content: flex-start;
|
|
90
88
|
align-items: flex-start;
|
|
91
|
-
display: block;
|
|
92
89
|
background: var(--stsv-common__background-color);
|
|
93
|
-
box-sizing: border-box;
|
|
94
|
-
height: 1em;
|
|
95
|
-
padding: 0.25em;
|
|
96
90
|
border-width: var(--stsv-common__border-width);
|
|
97
91
|
border-style: var(--stsv-common__border-style);
|
|
98
92
|
border-color: var(--stsv-common__border-color);
|
|
99
93
|
border-radius: var(--stsv-common__border-radius);
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
display: block;
|
|
96
|
+
height: 1em;
|
|
97
|
+
padding: 0.25em;
|
|
98
|
+
position: relative;
|
|
100
99
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
101
100
|
}
|
|
102
101
|
|
|
102
|
+
.sterling-progress.disabled::after {
|
|
103
|
+
content: '';
|
|
104
|
+
position: absolute;
|
|
105
|
+
left: 0;
|
|
106
|
+
right: 0;
|
|
107
|
+
top: 0;
|
|
108
|
+
bottom: 0;
|
|
109
|
+
background: repeating-linear-gradient(
|
|
110
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
111
|
+
var(--stsv-common--disabled__stripe-color),
|
|
112
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
113
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
114
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
115
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
116
|
+
);
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
103
120
|
.container {
|
|
104
121
|
display: flex;
|
|
105
122
|
justify-content: flex-start;
|
|
@@ -152,18 +169,7 @@ $:
|
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
.indicator.error {
|
|
155
|
-
background-color: var(--stsv-status--
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/* ----- Disabled ----- */
|
|
159
|
-
|
|
160
|
-
.sterling-progress.disabled {
|
|
161
|
-
background: var(--stsv-common__background-color--disabled);
|
|
162
|
-
border-color: var(--stsv-common__border-color--disabled);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.sterling-progress.disabled .indicator {
|
|
166
|
-
background-color: var(--stsv-common__color--disabled);
|
|
172
|
+
background-color: var(--stsv-status--danger__border-color);
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
@media (prefers-reduced-motion) {
|
package/Progress.svelte.d.ts
CHANGED
package/Progress.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type
|
|
3
|
-
export type
|
|
1
|
+
import type { PROGRESS_STATUSES } from './Progress.constants';
|
|
2
|
+
type ProgressStatusTuple = typeof PROGRESS_STATUSES;
|
|
3
|
+
export type ProgressStatus = ProgressStatusTuple[number];
|
|
4
4
|
export {};
|
package/Radio.svelte
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script>import { idGenerator } from "./idGenerator";
|
|
2
|
-
import Label from "./Label.svelte";
|
|
3
|
-
export let colorful = false;
|
|
4
2
|
export let checked = false;
|
|
5
3
|
export let disabled = false;
|
|
6
4
|
export let group = void 0;
|
|
7
5
|
export let id = void 0;
|
|
6
|
+
export let colorful = false;
|
|
8
7
|
if (checked && $$restProps.value !== group) {
|
|
9
8
|
group = $$restProps.value;
|
|
10
9
|
} else if (!checked && $$restProps.value === group) {
|
|
@@ -100,11 +99,9 @@ const onChange = (e) => {
|
|
|
100
99
|
<div class="indicator" />
|
|
101
100
|
</div>
|
|
102
101
|
{#if $$slots.default}
|
|
103
|
-
<
|
|
104
|
-
<slot {checked} {disabled} {group} inputId={id} value={$$restProps.value}
|
|
105
|
-
|
|
106
|
-
</slot>
|
|
107
|
-
</Label>
|
|
102
|
+
<label for={id}>
|
|
103
|
+
<slot {colorful} {checked} {disabled} {group} inputId={id} value={$$restProps.value} />
|
|
104
|
+
</label>
|
|
108
105
|
{/if}
|
|
109
106
|
</div>
|
|
110
107
|
|
|
@@ -226,11 +223,12 @@ const onChange = (e) => {
|
|
|
226
223
|
|
|
227
224
|
.container::after {
|
|
228
225
|
background: repeating-linear-gradient(
|
|
229
|
-
|
|
230
|
-
var(--stsv-
|
|
231
|
-
var(--stsv-
|
|
232
|
-
var(--stsv-
|
|
233
|
-
var(--stsv-
|
|
226
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
227
|
+
var(--stsv-common--disabled__stripe-color),
|
|
228
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
229
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
230
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
231
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
234
232
|
);
|
|
235
233
|
border-radius: 10000px;
|
|
236
234
|
bottom: 0;
|
|
@@ -244,6 +242,12 @@ const onChange = (e) => {
|
|
|
244
242
|
transition: opacity 250ms;
|
|
245
243
|
}
|
|
246
244
|
|
|
245
|
+
label {
|
|
246
|
+
color: var(--stsv-common__color);
|
|
247
|
+
transition: color 250ms;
|
|
248
|
+
font: inherit;
|
|
249
|
+
}
|
|
250
|
+
|
|
247
251
|
.sterling-radio.disabled .container::after {
|
|
248
252
|
opacity: 1;
|
|
249
253
|
}
|
|
@@ -251,7 +255,8 @@ const onChange = (e) => {
|
|
|
251
255
|
@media (prefers-reduced-motion) {
|
|
252
256
|
.indicator,
|
|
253
257
|
.indicator::after,
|
|
254
|
-
.container::after
|
|
258
|
+
.container::after,
|
|
259
|
+
label {
|
|
255
260
|
transition: none;
|
|
256
261
|
}
|
|
257
262
|
}
|
package/Radio.svelte.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
colorful?: boolean | undefined;
|
|
6
5
|
checked?: boolean | undefined;
|
|
7
6
|
disabled?: boolean | undefined;
|
|
8
7
|
group?: any | undefined | null;
|
|
9
8
|
id?: string | undefined;
|
|
9
|
+
colorful?: boolean | undefined;
|
|
10
10
|
blur?: (() => void) | undefined;
|
|
11
11
|
click?: (() => void) | undefined;
|
|
12
12
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
@@ -42,6 +42,7 @@ declare const __propDef: {
|
|
|
42
42
|
};
|
|
43
43
|
slots: {
|
|
44
44
|
default: {
|
|
45
|
+
colorful: boolean;
|
|
45
46
|
checked: boolean;
|
|
46
47
|
disabled: boolean;
|
|
47
48
|
group: any;
|