@geoffcox/sterling-svelte 0.0.19 → 0.0.21
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.constants.d.ts +2 -0
- package/Button.constants.js +2 -0
- package/Button.svelte +11 -0
- package/Button.svelte.d.ts +10 -5
- package/Button.types.d.ts +6 -2
- package/Checkbox.svelte +14 -1
- package/Checkbox.svelte.d.ts +8 -0
- package/Dialog.svelte +2 -3
- package/Dropdown.svelte +9 -0
- package/Dropdown.svelte.d.ts +6 -0
- package/Field.constants.d.ts +1 -0
- package/Field.constants.js +1 -0
- package/Field.svelte +22 -7
- package/Field.svelte.d.ts +9 -3
- package/Field.types.d.ts +4 -1
- package/Input.svelte +25 -1
- package/Input.svelte.d.ts +12 -0
- package/Label.svelte +12 -2
- package/Label.svelte.d.ts +9 -1
- package/Link.constants.d.ts +1 -0
- package/Link.constants.js +1 -0
- package/Link.svelte +102 -0
- package/Link.svelte.d.ts +57 -0
- package/Link.types.d.ts +4 -0
- package/List.constants.d.ts +1 -1
- package/List.constants.js +1 -1
- package/List.svelte +13 -7
- package/List.svelte.d.ts +6 -2
- package/ListItem.svelte +11 -2
- package/ListItem.svelte.d.ts +6 -0
- package/Menu.svelte +46 -12
- package/Menu.svelte.d.ts +26 -0
- package/MenuBar.constants.d.ts +1 -0
- package/MenuBar.constants.js +1 -0
- package/MenuBar.svelte +12 -3
- package/MenuBar.svelte.d.ts +5 -1
- package/MenuBar.types.d.ts +4 -0
- package/MenuBar.types.js +1 -0
- package/MenuButton.svelte +42 -8
- package/MenuButton.svelte.d.ts +12 -4
- package/MenuItem.constants.d.ts +1 -0
- package/MenuItem.constants.js +1 -0
- package/MenuItem.svelte +18 -8
- package/MenuItem.svelte.d.ts +12 -3
- package/{Menus.types.d.ts → MenuItem.types.d.ts} +0 -4
- package/MenuItem.types.js +1 -0
- package/{Menus.utils.d.ts → MenuItem.utils.d.ts} +1 -1
- package/Progress.constants.d.ts +1 -0
- package/Progress.constants.js +1 -0
- package/Progress.svelte +16 -3
- package/Progress.svelte.d.ts +15 -3
- package/Progress.types.d.ts +4 -1
- package/Radio.svelte +14 -1
- package/Radio.svelte.d.ts +8 -0
- package/Select.svelte +15 -1
- package/Select.svelte.d.ts +10 -0
- package/Slider.svelte +9 -0
- package/Slider.svelte.d.ts +6 -0
- package/Switch.svelte +11 -0
- package/Switch.svelte.d.ts +6 -0
- package/Tab.svelte +11 -2
- package/Tab.svelte.d.ts +6 -0
- package/TabList.constants.d.ts +1 -1
- package/TabList.constants.js +1 -1
- package/TabList.svelte +8 -2
- package/TabList.svelte.d.ts +4 -0
- package/TextArea.constants.d.ts +1 -0
- package/TextArea.constants.js +1 -0
- package/TextArea.svelte +22 -0
- package/TextArea.svelte.d.ts +13 -2
- package/TextArea.types.d.ts +4 -1
- package/Tooltip.constants.d.ts +1 -0
- package/Tooltip.constants.js +1 -0
- package/Tooltip.svelte +26 -10
- package/Tooltip.svelte.d.ts +7 -3
- package/Tooltip.types.d.ts +4 -3
- package/Tree.constants.d.ts +2 -2
- package/Tree.constants.js +2 -2
- package/Tree.svelte +41 -7
- package/Tree.svelte.d.ts +34 -1
- package/Tree.types.d.ts +4 -4
- package/TreeChevron.svelte +1 -1
- package/TreeItem.svelte +76 -52
- package/TreeItem.svelte.d.ts +26 -3
- package/TreeItemDisplay.svelte +11 -0
- package/TreeItemDisplay.svelte.d.ts +6 -0
- package/floating-ui.constants.d.ts +1 -0
- package/floating-ui.constants.js +14 -0
- package/floating-ui.types.d.ts +2 -0
- package/floating-ui.types.js +1 -0
- package/index.d.ts +19 -7
- package/index.js +14 -6
- package/package.json +16 -4
- package/Menus.constants.d.ts +0 -2
- package/Menus.constants.js +0 -2
- /package/{Menus.types.js → Link.types.js} +0 -0
- /package/{Menus.utils.js → MenuItem.utils.js} +0 -0
package/Button.svelte
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<script>export let variant = "regular";
|
|
2
2
|
export let shape = "rounded";
|
|
3
|
+
let buttonRef;
|
|
4
|
+
export const click = () => {
|
|
5
|
+
buttonRef?.click();
|
|
6
|
+
};
|
|
7
|
+
export const blur = () => {
|
|
8
|
+
buttonRef?.blur();
|
|
9
|
+
};
|
|
10
|
+
export const focus = (options) => {
|
|
11
|
+
buttonRef?.focus(options);
|
|
12
|
+
};
|
|
3
13
|
</script>
|
|
4
14
|
|
|
5
15
|
<!--
|
|
@@ -7,6 +17,7 @@ export let shape = "rounded";
|
|
|
7
17
|
A styled HTML button element.
|
|
8
18
|
-->
|
|
9
19
|
<button
|
|
20
|
+
bind:this={buttonRef}
|
|
10
21
|
class="sterling-button"
|
|
11
22
|
class:square={shape === 'square'}
|
|
12
23
|
class:circular={shape === 'circular'}
|
package/Button.svelte.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { ButtonShape, ButtonVariant } from './Button.types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
variant?:
|
|
7
|
-
shape?:
|
|
5
|
+
variant?: "regular" | "outline" | "ghost" | undefined;
|
|
6
|
+
shape?: "circular" | "rounded" | "square" | undefined;
|
|
7
|
+
click?: (() => void) | undefined;
|
|
8
|
+
blur?: (() => void) | undefined;
|
|
9
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
8
10
|
};
|
|
9
11
|
events: {
|
|
10
12
|
blur: FocusEvent;
|
|
@@ -37,8 +39,8 @@ declare const __propDef: {
|
|
|
37
39
|
};
|
|
38
40
|
slots: {
|
|
39
41
|
default: {
|
|
40
|
-
shape:
|
|
41
|
-
variant:
|
|
42
|
+
shape: "circular" | "rounded" | "square";
|
|
43
|
+
variant: "regular" | "outline" | "ghost";
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
};
|
|
@@ -47,5 +49,8 @@ export type ButtonEvents = typeof __propDef.events;
|
|
|
47
49
|
export type ButtonSlots = typeof __propDef.slots;
|
|
48
50
|
/** A styled HTML button element. */
|
|
49
51
|
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
|
|
52
|
+
get click(): () => void;
|
|
53
|
+
get blur(): () => void;
|
|
54
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
50
55
|
}
|
|
51
56
|
export {};
|
package/Button.types.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { BUTTON_SHAPES, BUTTON_VARIANTS } from './Button.constants';
|
|
2
|
+
type ButtonShapeTuple = typeof BUTTON_SHAPES;
|
|
3
|
+
export type ButtonShape = ButtonShapeTuple[number];
|
|
4
|
+
type ButtonVariantTuple = typeof BUTTON_VARIANTS;
|
|
5
|
+
export type ButtonVariant = ButtonVariantTuple[number];
|
|
6
|
+
export {};
|
package/Checkbox.svelte
CHANGED
|
@@ -3,11 +3,21 @@ import Label from "./Label.svelte";
|
|
|
3
3
|
export let checked = false;
|
|
4
4
|
export let disabled = false;
|
|
5
5
|
export let id = void 0;
|
|
6
|
+
let inputRef;
|
|
6
7
|
$: {
|
|
7
8
|
if ($$slots.default && id === void 0) {
|
|
8
9
|
id = uuid();
|
|
9
10
|
}
|
|
10
11
|
}
|
|
12
|
+
export const blur = () => {
|
|
13
|
+
inputRef?.blur();
|
|
14
|
+
};
|
|
15
|
+
export const click = () => {
|
|
16
|
+
inputRef?.click();
|
|
17
|
+
};
|
|
18
|
+
export const focus = (options) => {
|
|
19
|
+
inputRef?.focus(options);
|
|
20
|
+
};
|
|
11
21
|
</script>
|
|
12
22
|
|
|
13
23
|
<!--
|
|
@@ -17,6 +27,7 @@ $: {
|
|
|
17
27
|
<div class="sterling-checkbox">
|
|
18
28
|
<div class="container">
|
|
19
29
|
<input
|
|
30
|
+
bind:this={inputRef}
|
|
20
31
|
{disabled}
|
|
21
32
|
{id}
|
|
22
33
|
type="checkbox"
|
|
@@ -48,7 +59,9 @@ $: {
|
|
|
48
59
|
{#if $$slots.default}
|
|
49
60
|
<div class="label">
|
|
50
61
|
<Label {disabled} for={id}>
|
|
51
|
-
<slot {checked} {disabled}
|
|
62
|
+
<slot {checked} {disabled} inputId={id} value={$$restProps.value}>
|
|
63
|
+
{$$restProps.value}
|
|
64
|
+
</slot>
|
|
52
65
|
</Label>
|
|
53
66
|
</div>
|
|
54
67
|
{/if}
|
package/Checkbox.svelte.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ declare const __propDef: {
|
|
|
5
5
|
checked?: boolean | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
8
|
+
blur?: (() => void) | undefined;
|
|
9
|
+
click?: (() => void) | undefined;
|
|
10
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
8
11
|
};
|
|
9
12
|
events: {
|
|
10
13
|
blur: FocusEvent;
|
|
@@ -34,6 +37,8 @@ declare const __propDef: {
|
|
|
34
37
|
default: {
|
|
35
38
|
checked: boolean;
|
|
36
39
|
disabled: boolean;
|
|
40
|
+
inputId: string | undefined;
|
|
41
|
+
value: any;
|
|
37
42
|
};
|
|
38
43
|
};
|
|
39
44
|
};
|
|
@@ -42,5 +47,8 @@ export type CheckboxEvents = typeof __propDef.events;
|
|
|
42
47
|
export type CheckboxSlots = typeof __propDef.slots;
|
|
43
48
|
/** A styled HTML input type=checkbox element. */
|
|
44
49
|
export default class Checkbox extends SvelteComponentTyped<CheckboxProps, CheckboxEvents, CheckboxSlots> {
|
|
50
|
+
get blur(): () => void;
|
|
51
|
+
get click(): () => void;
|
|
52
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
45
53
|
}
|
|
46
54
|
export {};
|
package/Dialog.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { onMount, tick } from "svelte";
|
|
2
2
|
import Button from "./Button.svelte";
|
|
3
3
|
const dialogFadeDuration = 250;
|
|
4
4
|
export let open = false;
|
|
@@ -8,7 +8,6 @@ let dialogRef;
|
|
|
8
8
|
let contentRef;
|
|
9
9
|
let formRef;
|
|
10
10
|
let closing = false;
|
|
11
|
-
const dispatch = createEventDispatcher();
|
|
12
11
|
const onDocumentClick = (event) => {
|
|
13
12
|
const targetNode = event?.target;
|
|
14
13
|
if (targetNode && !contentRef.contains(targetNode) && backdropCloses) {
|
|
@@ -89,10 +88,10 @@ A styled <dialog> element
|
|
|
89
88
|
- Props and events to make using <dialog> easier
|
|
90
89
|
-->
|
|
91
90
|
<dialog
|
|
91
|
+
bind:this={dialogRef}
|
|
92
92
|
class="dialog"
|
|
93
93
|
class:open
|
|
94
94
|
class:closing
|
|
95
|
-
bind:this={dialogRef}
|
|
96
95
|
on:close
|
|
97
96
|
on:cancel
|
|
98
97
|
{...$$restProps}
|
package/Dropdown.svelte
CHANGED
|
@@ -20,6 +20,15 @@ const raiseOpen = (open2) => {
|
|
|
20
20
|
$: {
|
|
21
21
|
raiseOpen(open);
|
|
22
22
|
}
|
|
23
|
+
export const click = () => {
|
|
24
|
+
dropdownRef?.click();
|
|
25
|
+
};
|
|
26
|
+
export const blur = () => {
|
|
27
|
+
dropdownRef?.blur();
|
|
28
|
+
};
|
|
29
|
+
export const focus = (options) => {
|
|
30
|
+
dropdownRef?.focus(options);
|
|
31
|
+
};
|
|
23
32
|
let mounted = false;
|
|
24
33
|
onMount(() => {
|
|
25
34
|
mounted = true;
|
package/Dropdown.svelte.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ declare const __propDef: {
|
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
open?: boolean | undefined;
|
|
8
8
|
stayOpenOnClickAway?: boolean | undefined;
|
|
9
|
+
click?: (() => void) | undefined;
|
|
10
|
+
blur?: (() => void) | undefined;
|
|
11
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
9
12
|
};
|
|
10
13
|
events: {
|
|
11
14
|
blur: FocusEvent;
|
|
@@ -54,5 +57,8 @@ export type DropdownProps = typeof __propDef.props;
|
|
|
54
57
|
export type DropdownEvents = typeof __propDef.events;
|
|
55
58
|
export type DropdownSlots = typeof __propDef.slots;
|
|
56
59
|
export default class Dropdown extends SvelteComponentTyped<DropdownProps, DropdownEvents, DropdownSlots> {
|
|
60
|
+
get click(): () => void;
|
|
61
|
+
get blur(): () => void;
|
|
62
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
57
63
|
}
|
|
58
64
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FIELD_STATUSES: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FIELD_STATUSES = ['none', 'info', 'success', 'warning', 'error'];
|
package/Field.svelte
CHANGED
|
@@ -67,6 +67,15 @@ let usingKeyboard = keyborg.isNavigatingWithKeyboard();
|
|
|
67
67
|
const keyborgHandler = (value) => {
|
|
68
68
|
usingKeyboard = value;
|
|
69
69
|
};
|
|
70
|
+
export const click = () => {
|
|
71
|
+
fieldRef?.click();
|
|
72
|
+
};
|
|
73
|
+
export const blur = () => {
|
|
74
|
+
fieldRef?.blur();
|
|
75
|
+
};
|
|
76
|
+
export const focus = (options) => {
|
|
77
|
+
fieldRef?.focus(options);
|
|
78
|
+
};
|
|
70
79
|
onMount(() => {
|
|
71
80
|
keyborg.subscribe(keyborgHandler);
|
|
72
81
|
return () => {
|
|
@@ -81,8 +90,8 @@ const onClick = () => {
|
|
|
81
90
|
</script>
|
|
82
91
|
|
|
83
92
|
<label
|
|
84
|
-
aria-disabled={targetDisabled}
|
|
85
93
|
bind:this={fieldRef}
|
|
94
|
+
aria-disabled={targetDisabled}
|
|
86
95
|
class="sterling-field"
|
|
87
96
|
class:disabled={targetDisabled}
|
|
88
97
|
class:using-keyboard={usingKeyboard}
|
|
@@ -111,12 +120,18 @@ const onClick = () => {
|
|
|
111
120
|
on:paste
|
|
112
121
|
{...$$restProps}
|
|
113
122
|
>
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
123
|
+
{#if label || $$slots.label}
|
|
124
|
+
<slot name="label" disabled={targetDisabled} for={htmlFor} {forwardClick} {label} {required}>
|
|
125
|
+
<div class="label-text">
|
|
126
|
+
{label}
|
|
127
|
+
</div>
|
|
128
|
+
</slot>
|
|
129
|
+
{/if}
|
|
130
|
+
{#if $$slots.default}
|
|
131
|
+
<div class="content">
|
|
132
|
+
<slot />
|
|
117
133
|
</div>
|
|
118
|
-
|
|
119
|
-
<slot />
|
|
134
|
+
{/if}
|
|
120
135
|
{#if message}
|
|
121
136
|
<slot name="message" disabled={targetDisabled} {message} {required} {status}>
|
|
122
137
|
<div
|
|
@@ -132,7 +147,7 @@ const onClick = () => {
|
|
|
132
147
|
{/if}
|
|
133
148
|
{#if required}
|
|
134
149
|
<slot name="required" {requiredTip}>
|
|
135
|
-
<Tooltip
|
|
150
|
+
<Tooltip showOn="hover">
|
|
136
151
|
<span class="required-tip" slot="tip">{requiredTip}</span>
|
|
137
152
|
<div class="required">*</div>
|
|
138
153
|
</Tooltip>
|
package/Field.svelte.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { FieldStatus } from './Field.types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
@@ -9,7 +8,10 @@ declare const __propDef: {
|
|
|
9
8
|
message?: string | undefined;
|
|
10
9
|
required?: boolean | undefined;
|
|
11
10
|
requiredTip?: string | undefined;
|
|
12
|
-
status?:
|
|
11
|
+
status?: string | undefined;
|
|
12
|
+
click?: (() => void) | undefined;
|
|
13
|
+
blur?: (() => void) | undefined;
|
|
14
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
13
15
|
};
|
|
14
16
|
events: {
|
|
15
17
|
blur: FocusEvent;
|
|
@@ -40,6 +42,7 @@ declare const __propDef: {
|
|
|
40
42
|
label: {
|
|
41
43
|
disabled: boolean;
|
|
42
44
|
for: string | undefined;
|
|
45
|
+
forwardClick: boolean;
|
|
43
46
|
label: string | undefined;
|
|
44
47
|
required: boolean;
|
|
45
48
|
};
|
|
@@ -48,7 +51,7 @@ declare const __propDef: {
|
|
|
48
51
|
disabled: boolean;
|
|
49
52
|
message: string | undefined;
|
|
50
53
|
required: boolean;
|
|
51
|
-
status:
|
|
54
|
+
status: string;
|
|
52
55
|
};
|
|
53
56
|
required: {
|
|
54
57
|
requiredTip: string;
|
|
@@ -59,5 +62,8 @@ export type FieldProps = typeof __propDef.props;
|
|
|
59
62
|
export type FieldEvents = typeof __propDef.events;
|
|
60
63
|
export type FieldSlots = typeof __propDef.slots;
|
|
61
64
|
export default class Field extends SvelteComponentTyped<FieldProps, FieldEvents, FieldSlots> {
|
|
65
|
+
get click(): () => void;
|
|
66
|
+
get blur(): () => void;
|
|
67
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
62
68
|
}
|
|
63
69
|
export {};
|
package/Field.types.d.ts
CHANGED
package/Input.svelte
CHANGED
|
@@ -4,11 +4,34 @@ export let composed = false;
|
|
|
4
4
|
export let disabled = false;
|
|
5
5
|
export let id = void 0;
|
|
6
6
|
export let value = "";
|
|
7
|
+
let inputRef;
|
|
7
8
|
$: {
|
|
8
9
|
if ($$slots.default && id === void 0) {
|
|
9
10
|
id = uuid();
|
|
10
11
|
}
|
|
11
12
|
}
|
|
13
|
+
export const blur = () => {
|
|
14
|
+
inputRef?.blur();
|
|
15
|
+
};
|
|
16
|
+
export const click = () => {
|
|
17
|
+
inputRef?.click();
|
|
18
|
+
};
|
|
19
|
+
export const focus = (options) => {
|
|
20
|
+
inputRef?.focus();
|
|
21
|
+
};
|
|
22
|
+
export const select = () => {
|
|
23
|
+
inputRef?.select();
|
|
24
|
+
};
|
|
25
|
+
export const setSelectionRange = (start, end, direction) => {
|
|
26
|
+
inputRef?.setSelectionRange(start, end, direction);
|
|
27
|
+
};
|
|
28
|
+
export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
29
|
+
if (start && end) {
|
|
30
|
+
inputRef?.setRangeText(replacement, start, end, selectionMode);
|
|
31
|
+
} else {
|
|
32
|
+
inputRef?.setRangeText(replacement);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
12
35
|
</script>
|
|
13
36
|
|
|
14
37
|
{#if $$slots.default}
|
|
@@ -17,11 +40,12 @@ $: {
|
|
|
17
40
|
</Label>
|
|
18
41
|
{/if}
|
|
19
42
|
<input
|
|
20
|
-
bind:
|
|
43
|
+
bind:this={inputRef}
|
|
21
44
|
class="sterling-input"
|
|
22
45
|
class:composed
|
|
23
46
|
{disabled}
|
|
24
47
|
{id}
|
|
48
|
+
bind:value
|
|
25
49
|
on:blur
|
|
26
50
|
on:click
|
|
27
51
|
on:change
|
package/Input.svelte.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ declare const __propDef: {
|
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
8
8
|
value?: string | undefined;
|
|
9
|
+
blur?: (() => void) | undefined;
|
|
10
|
+
click?: (() => void) | undefined;
|
|
11
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
12
|
+
select?: (() => void) | undefined;
|
|
13
|
+
setSelectionRange?: ((start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none') => void) | undefined;
|
|
14
|
+
setRangeText?: ((replacement: string, start?: number, end?: number, selectionMode?: SelectionMode) => void) | undefined;
|
|
9
15
|
};
|
|
10
16
|
events: {
|
|
11
17
|
blur: FocusEvent;
|
|
@@ -49,5 +55,11 @@ export type InputProps = typeof __propDef.props;
|
|
|
49
55
|
export type InputEvents = typeof __propDef.events;
|
|
50
56
|
export type InputSlots = typeof __propDef.slots;
|
|
51
57
|
export default class Input extends SvelteComponentTyped<InputProps, InputEvents, InputSlots> {
|
|
58
|
+
get blur(): () => void;
|
|
59
|
+
get click(): () => void;
|
|
60
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
61
|
+
get select(): () => void;
|
|
62
|
+
get setSelectionRange(): (start: number | null, end: number | null, direction?: "none" | "forward" | "backward" | undefined) => void;
|
|
63
|
+
get setRangeText(): (replacement: string, start?: number | undefined, end?: number | undefined, selectionMode?: SelectionMode | undefined) => void;
|
|
52
64
|
}
|
|
53
65
|
export {};
|
package/Label.svelte
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
<script>export let disabled = false;
|
|
2
|
-
|
|
2
|
+
let labelRef;
|
|
3
|
+
export const blur = () => {
|
|
4
|
+
labelRef?.blur();
|
|
5
|
+
};
|
|
6
|
+
export const click = () => {
|
|
7
|
+
labelRef?.click();
|
|
8
|
+
};
|
|
9
|
+
export const focus = (options) => {
|
|
10
|
+
labelRef?.focus();
|
|
11
|
+
};
|
|
3
12
|
</script>
|
|
4
13
|
|
|
5
14
|
<label
|
|
15
|
+
bind:this={labelRef}
|
|
6
16
|
aria-disabled={disabled}
|
|
7
17
|
class="sterling-label"
|
|
8
18
|
class:disabled
|
|
@@ -29,7 +39,7 @@ HTMLLabelElement;
|
|
|
29
39
|
on:paste
|
|
30
40
|
{...$$restProps}
|
|
31
41
|
>
|
|
32
|
-
<slot />
|
|
42
|
+
<slot {disabled} />
|
|
33
43
|
</label>
|
|
34
44
|
|
|
35
45
|
<style>
|
package/Label.svelte.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
disabled?: boolean | undefined;
|
|
6
|
+
blur?: (() => void) | undefined;
|
|
7
|
+
click?: (() => void) | undefined;
|
|
8
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
6
9
|
};
|
|
7
10
|
events: {
|
|
8
11
|
blur: FocusEvent;
|
|
@@ -30,12 +33,17 @@ declare const __propDef: {
|
|
|
30
33
|
[evt: string]: CustomEvent<any>;
|
|
31
34
|
};
|
|
32
35
|
slots: {
|
|
33
|
-
default: {
|
|
36
|
+
default: {
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
};
|
|
34
39
|
};
|
|
35
40
|
};
|
|
36
41
|
export type LabelProps = typeof __propDef.props;
|
|
37
42
|
export type LabelEvents = typeof __propDef.events;
|
|
38
43
|
export type LabelSlots = typeof __propDef.slots;
|
|
39
44
|
export default class Label extends SvelteComponentTyped<LabelProps, LabelEvents, LabelSlots> {
|
|
45
|
+
get blur(): () => void;
|
|
46
|
+
get click(): () => void;
|
|
47
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
40
48
|
}
|
|
41
49
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LINK_VARIANTS: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LINK_VARIANTS = ['regular', 'ghost', 'undecorated'];
|
package/Link.svelte
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script>export let href;
|
|
2
|
+
export let disabled = false;
|
|
3
|
+
export let variant = "regular";
|
|
4
|
+
let linkRef;
|
|
5
|
+
export const blur = () => {
|
|
6
|
+
linkRef?.blur();
|
|
7
|
+
};
|
|
8
|
+
export const click = () => {
|
|
9
|
+
linkRef?.click();
|
|
10
|
+
};
|
|
11
|
+
export const focus = (options) => {
|
|
12
|
+
linkRef?.focus();
|
|
13
|
+
};
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<a
|
|
17
|
+
bind:this={linkRef}
|
|
18
|
+
class="sterling-link"
|
|
19
|
+
class:disabled
|
|
20
|
+
class:ghost={variant === 'ghost'}
|
|
21
|
+
class:undecorated={variant === 'undecorated'}
|
|
22
|
+
{href}
|
|
23
|
+
on:blur
|
|
24
|
+
on:click
|
|
25
|
+
on:dblclick
|
|
26
|
+
on:focus
|
|
27
|
+
on:focusin
|
|
28
|
+
on:focusout
|
|
29
|
+
on:keydown
|
|
30
|
+
on:keypress
|
|
31
|
+
on:keyup
|
|
32
|
+
on:mousedown
|
|
33
|
+
on:mouseenter
|
|
34
|
+
on:mouseleave
|
|
35
|
+
on:mousemove
|
|
36
|
+
on:mouseover
|
|
37
|
+
on:mouseout
|
|
38
|
+
on:mouseup
|
|
39
|
+
on:pointercancel
|
|
40
|
+
on:pointerdown
|
|
41
|
+
on:pointerenter
|
|
42
|
+
on:pointerleave
|
|
43
|
+
on:pointermove
|
|
44
|
+
on:pointerover
|
|
45
|
+
on:pointerout
|
|
46
|
+
on:pointerup
|
|
47
|
+
on:wheel
|
|
48
|
+
{...$$restProps}><slot {disabled} {href} {variant} /></a
|
|
49
|
+
>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
a {
|
|
53
|
+
background-color: transparent;
|
|
54
|
+
border-top: none;
|
|
55
|
+
border-left: none;
|
|
56
|
+
border-right: none;
|
|
57
|
+
border-radius: 0;
|
|
58
|
+
border-bottom-style: var(--stsv-Button__border-style);
|
|
59
|
+
border-bottom-width: calc(var(--stsv-Button__border-width));
|
|
60
|
+
border-bottom-color: var(--stsv-Button__border-color);
|
|
61
|
+
color: var(--stsv-Button__color);
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
font: inherit;
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
user-select: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
a:visited {
|
|
72
|
+
border-bottom-color: var(--stsv-Button__border-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
a.ghost {
|
|
76
|
+
border-bottom-color: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
a:hover {
|
|
80
|
+
border-bottom-color: var(--stsv-Button__border-color--hover);
|
|
81
|
+
color: var(--stsv-Button__color--hover);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
a:active {
|
|
85
|
+
border-bottom-color: var(--stsv-Button__border-color--active);
|
|
86
|
+
color: var(--stsv-Button__color--active);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
a.disabled {
|
|
90
|
+
border-bottom-color: var(--stsv-Common__border-color--disabled);
|
|
91
|
+
color: var(--stsv-Common__color--disabled);
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
a.undecorated,
|
|
97
|
+
a.undecorated:hover,
|
|
98
|
+
a.undecorated:active,
|
|
99
|
+
a.undecorated:visited {
|
|
100
|
+
border: none;
|
|
101
|
+
}
|
|
102
|
+
</style>
|
package/Link.svelte.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
href: string;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
variant?: string | undefined;
|
|
8
|
+
blur?: (() => void) | undefined;
|
|
9
|
+
click?: (() => void) | undefined;
|
|
10
|
+
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
blur: FocusEvent;
|
|
14
|
+
click: MouseEvent;
|
|
15
|
+
dblclick: MouseEvent;
|
|
16
|
+
focus: FocusEvent;
|
|
17
|
+
focusin: FocusEvent;
|
|
18
|
+
focusout: FocusEvent;
|
|
19
|
+
keydown: KeyboardEvent;
|
|
20
|
+
keypress: KeyboardEvent;
|
|
21
|
+
keyup: KeyboardEvent;
|
|
22
|
+
mousedown: MouseEvent;
|
|
23
|
+
mouseenter: MouseEvent;
|
|
24
|
+
mouseleave: MouseEvent;
|
|
25
|
+
mousemove: MouseEvent;
|
|
26
|
+
mouseover: MouseEvent;
|
|
27
|
+
mouseout: MouseEvent;
|
|
28
|
+
mouseup: MouseEvent;
|
|
29
|
+
pointercancel: PointerEvent;
|
|
30
|
+
pointerdown: PointerEvent;
|
|
31
|
+
pointerenter: PointerEvent;
|
|
32
|
+
pointerleave: PointerEvent;
|
|
33
|
+
pointermove: PointerEvent;
|
|
34
|
+
pointerover: PointerEvent;
|
|
35
|
+
pointerout: PointerEvent;
|
|
36
|
+
pointerup: PointerEvent;
|
|
37
|
+
wheel: WheelEvent;
|
|
38
|
+
} & {
|
|
39
|
+
[evt: string]: CustomEvent<any>;
|
|
40
|
+
};
|
|
41
|
+
slots: {
|
|
42
|
+
default: {
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
href: string;
|
|
45
|
+
variant: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type LinkProps = typeof __propDef.props;
|
|
50
|
+
export type LinkEvents = typeof __propDef.events;
|
|
51
|
+
export type LinkSlots = typeof __propDef.slots;
|
|
52
|
+
export default class Link extends SvelteComponentTyped<LinkProps, LinkEvents, LinkSlots> {
|
|
53
|
+
get blur(): () => void;
|
|
54
|
+
get click(): () => void;
|
|
55
|
+
get focus(): (options?: FocusOptions | undefined) => void;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
package/Link.types.d.ts
ADDED
package/List.constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const LIST_CONTEXT_KEY = "sterlingList";
|
package/List.constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const LIST_CONTEXT_KEY = 'sterlingList';
|