@geoffcox/sterling-svelte 0.0.30 → 1.0.0
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 +11 -7
- package/Button.svelte +11 -183
- package/Button.svelte.d.ts +2 -6
- package/Callout.svelte +188 -0
- package/Callout.svelte.d.ts +54 -0
- package/Checkbox.svelte +15 -177
- package/Checkbox.svelte.d.ts +2 -2
- package/ColorPicker.svelte +204 -223
- package/ColorPicker.svelte.d.ts +1 -2
- package/Dialog.svelte +91 -187
- package/Dialog.svelte.d.ts +3 -1
- package/Dropdown.svelte +52 -219
- package/Dropdown.svelte.d.ts +4 -8
- package/HexColorSliders.svelte +77 -145
- package/HexColorSliders.svelte.d.ts +28 -1
- package/HslColorSliders.svelte +99 -179
- package/HslColorSliders.svelte.d.ts +28 -1
- package/Input.svelte +27 -136
- package/Input.svelte.d.ts +2 -3
- package/Label.constants.d.ts +1 -0
- package/Label.constants.js +1 -0
- package/Label.svelte +96 -169
- package/Label.svelte.d.ts +6 -1
- package/Label.types.d.ts +3 -1
- package/Link.svelte +9 -106
- package/Link.svelte.d.ts +0 -1
- package/List.svelte +142 -230
- package/List.svelte.d.ts +2 -3
- package/List.types.d.ts +6 -1
- package/ListItem.svelte +25 -94
- package/ListItem.svelte.d.ts +2 -0
- package/Menu.svelte +48 -64
- package/Menu.svelte.d.ts +4 -1
- package/MenuBar.svelte +84 -86
- package/MenuBar.svelte.d.ts +4 -1
- package/MenuButton.svelte +67 -74
- package/MenuButton.svelte.d.ts +7 -3
- package/MenuItem.svelte +256 -288
- package/MenuItem.svelte.d.ts +2 -2
- package/MenuItemDisplay.svelte +12 -116
- package/MenuItemDisplay.svelte.d.ts +21 -7
- package/MenuSeparator.svelte +6 -45
- package/MenuSeparator.svelte.d.ts +8 -78
- package/Popover.constants.d.ts +2 -0
- package/{floating-ui.constants.js → Popover.constants.js} +10 -9
- package/Popover.svelte +72 -82
- package/Popover.svelte.d.ts +10 -5
- package/Popover.types.d.ts +4 -0
- package/Progress.svelte +28 -126
- package/Progress.svelte.d.ts +4 -3
- package/Radio.svelte +49 -192
- package/Radio.svelte.d.ts +2 -2
- package/RgbColorSliders.svelte +48 -137
- package/RgbColorSliders.svelte.d.ts +5 -5
- package/Select.svelte +124 -251
- package/Select.svelte.d.ts +6 -2
- package/Slider.svelte +90 -259
- package/Slider.svelte.d.ts +1 -2
- package/Switch.svelte +24 -259
- package/Switch.svelte.d.ts +3 -1
- package/Tab.svelte +27 -175
- package/Tab.svelte.d.ts +6 -4
- package/TabList.svelte +146 -171
- package/TabList.svelte.d.ts +3 -2
- package/TabList.types.d.ts +6 -1
- package/TextArea.svelte +32 -129
- package/TextArea.svelte.d.ts +1 -1
- package/Tooltip.svelte +88 -222
- package/Tooltip.svelte.d.ts +21 -13
- package/Tree.constants.d.ts +0 -1
- package/Tree.constants.js +0 -1
- package/Tree.svelte +35 -119
- package/Tree.svelte.d.ts +4 -4
- package/Tree.types.d.ts +1 -3
- package/TreeChevron.svelte +18 -98
- package/TreeChevron.svelte.d.ts +1 -0
- package/TreeItem.constants.d.ts +1 -0
- package/TreeItem.constants.js +1 -0
- package/TreeItem.svelte +251 -211
- package/TreeItem.svelte.d.ts +7 -3
- package/TreeItem.types.d.ts +1 -1
- package/TreeItemDisplay.svelte +20 -104
- package/TreeItemDisplay.svelte.d.ts +2 -2
- package/actions/applyLightDarkMode.d.ts +10 -0
- package/actions/applyLightDarkMode.js +36 -0
- package/actions/forwardEvents.js +3 -3
- package/css/Button.base.css +74 -0
- package/css/Button.colorful.css +17 -0
- package/css/Button.css +7 -0
- package/css/Button.secondary.colorful.css +15 -0
- package/css/Button.secondary.css +11 -0
- package/css/Button.shapes.css +14 -0
- package/css/Button.tool.colorful.css +13 -0
- package/css/Button.tool.css +18 -0
- package/css/Callout.base.css +43 -0
- package/css/Callout.colorful.css +5 -0
- package/css/Callout.css +2 -0
- package/css/Checkbox.base.css +145 -0
- package/css/Checkbox.colorful.css +17 -0
- package/css/Checkbox.css +2 -0
- package/css/ColorPicker.base.css +23 -0
- package/css/ColorPicker.css +1 -0
- package/css/Dialog.base.css +116 -0
- package/css/Dialog.css +1 -0
- package/css/Dropdown.base.css +147 -0
- package/css/Dropdown.colorful.css +23 -0
- package/css/Dropdown.css +2 -0
- package/css/HexColorSliders.base.css +106 -0
- package/css/HexColorSliders.css +1 -0
- package/css/HslColorSliders.base.css +124 -0
- package/css/HslColorSliders.css +1 -0
- package/css/Input.base.css +100 -0
- package/css/Input.colorful.css +22 -0
- package/css/Input.composed.css +8 -0
- package/css/Input.css +3 -0
- package/css/Label.base.css +119 -0
- package/css/Label.boxed.colorful.css +21 -0
- package/css/Label.boxed.css +31 -0
- package/css/Label.colorful.css +3 -0
- package/css/Label.css +4 -0
- package/css/Link.base.css +52 -0
- package/css/Link.colorful.css +15 -0
- package/css/Link.css +6 -0
- package/css/Link.ghost.colorful.css +7 -0
- package/css/Link.ghost.css +11 -0
- package/css/Link.undecorated.colorful.css +6 -0
- package/css/Link.undecorated.css +6 -0
- package/css/List.base.css +98 -0
- package/css/List.css +1 -0
- package/css/ListItem.base.css +59 -0
- package/css/ListItem.css +1 -0
- package/css/Menu.base.css +21 -0
- package/css/Menu.css +1 -0
- package/css/MenuBar.base.css +9 -0
- package/css/MenuBar.css +1 -0
- package/css/MenuButton.base.css +13 -0
- package/css/MenuButton.css +1 -0
- package/css/MenuItem.base.css +48 -0
- package/css/MenuItem.css +1 -0
- package/css/MenuItemDisplay.base.css +104 -0
- package/css/MenuItemDisplay.css +1 -0
- package/css/MenuSeparator.base.css +5 -0
- package/css/MenuSeparator.css +1 -0
- package/css/Popover copy.css +21 -0
- package/css/Popover.css +21 -0
- package/css/Progress.base.css +99 -0
- package/css/Progress.css +1 -0
- package/css/Radio.base.css +135 -0
- package/css/Radio.colorful.css +18 -0
- package/css/Radio.css +2 -0
- package/css/RgbColorSliders.base.css +94 -0
- package/css/RgbColorSliders.css +1 -0
- package/css/Select.base.css +127 -0
- package/css/Select.colorful.css +24 -0
- package/css/Select.composed.css +12 -0
- package/css/Select.css +3 -0
- package/css/Slider.base.css +182 -0
- package/css/Slider.colorful.css +11 -0
- package/css/Slider.composed.css +8 -0
- package/css/Slider.css +3 -0
- package/css/Switch.base.css +193 -0
- package/css/Switch.colorful.css +39 -0
- package/css/Switch.css +2 -0
- package/css/Tab.base.css +135 -0
- package/css/Tab.colorful.css +13 -0
- package/css/Tab.css +2 -0
- package/css/TabList.base.css +34 -0
- package/css/TabList.css +1 -0
- package/css/TextArea.base.css +85 -0
- package/css/TextArea.colorful.css +17 -0
- package/css/TextArea.composed.css +8 -0
- package/css/TextArea.css +3 -0
- package/css/Tooltip.base.css +6 -0
- package/css/Tooltip.css +1 -0
- package/css/Tree.base.css +74 -0
- package/css/Tree.composed.css +8 -0
- package/css/Tree.css +2 -0
- package/css/TreeChevron.base.css +86 -0
- package/css/TreeChevron.css +1 -0
- package/css/TreeItem.base.css +3 -0
- package/css/TreeItem.css +1 -0
- package/css/TreeItemDisplay.base.css +74 -0
- package/css/TreeItemDisplay.colorful.css +9 -0
- package/css/TreeItemDisplay.css +1 -0
- package/css/dark-mode.css +134 -0
- package/css/light-mode.css +134 -0
- package/css/sterling.css +37 -0
- package/index.d.ts +13 -18
- package/index.js +11 -15
- package/mediaQueries/prefersColorSchemeDark.d.ts +2 -0
- package/mediaQueries/prefersColorSchemeDark.js +10 -0
- package/{stores → mediaQueries}/prefersReducedMotion.d.ts +1 -0
- package/{stores → mediaQueries}/usingKeyboard.d.ts +1 -0
- package/package.json +136 -19
- package/Link.constants.d.ts +0 -1
- package/Link.constants.js +0 -1
- package/Link.types.d.ts +0 -4
- package/Tooltip.constants.d.ts +0 -1
- package/Tooltip.constants.js +0 -1
- package/Tooltip.types.d.ts +0 -4
- package/Tooltip.types.js +0 -1
- package/floating-ui.constants.d.ts +0 -1
- package/floating-ui.types.d.ts +0 -4
- package/floating-ui.types.js +0 -1
- package/theme/applyDarkTheme.d.ts +0 -7
- package/theme/applyDarkTheme.js +0 -11
- package/theme/applyLightTheme.d.ts +0 -7
- package/theme/applyLightTheme.js +0 -11
- package/theme/applyTheme.d.ts +0 -7
- package/theme/applyTheme.js +0 -20
- package/theme/colors.d.ts +0 -54
- package/theme/colors.js +0 -82
- package/theme/darkTheme.d.ts +0 -2
- package/theme/darkTheme.js +0 -142
- package/theme/lightTheme.d.ts +0 -2
- package/theme/lightTheme.js +0 -119
- package/theme/toggleDarkTheme.d.ts +0 -18
- package/theme/toggleDarkTheme.js +0 -53
- package/theme/types.d.ts +0 -21
- package/theme/types.js +0 -1
- /package/{Link.types.js → Popover.types.js} +0 -0
- /package/{stores → mediaQueries}/prefersReducedMotion.js +0 -0
- /package/{stores → mediaQueries}/usingKeyboard.js +0 -0
package/Checkbox.svelte
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
<script>import { idGenerator } from
|
|
1
|
+
<script>import { idGenerator } from './idGenerator';
|
|
2
|
+
// ----- Props ----- //
|
|
2
3
|
export let checked = false;
|
|
3
4
|
export let disabled = false;
|
|
4
|
-
export let id =
|
|
5
|
-
|
|
5
|
+
export let id = undefined;
|
|
6
|
+
/** Additional class names to apply. */
|
|
7
|
+
export let variant = '';
|
|
8
|
+
// ----- State ----- //
|
|
6
9
|
let inputRef;
|
|
7
10
|
$: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
if ($$slots.default && id === undefined) {
|
|
12
|
+
id = idGenerator.nextId('Checkbox');
|
|
13
|
+
}
|
|
11
14
|
}
|
|
15
|
+
// ----- Methods ----- //
|
|
12
16
|
export const blur = () => {
|
|
13
|
-
|
|
17
|
+
inputRef?.blur();
|
|
14
18
|
};
|
|
15
19
|
export const click = () => {
|
|
16
|
-
|
|
20
|
+
inputRef?.click();
|
|
17
21
|
};
|
|
18
22
|
export const focus = (options) => {
|
|
19
|
-
|
|
23
|
+
inputRef?.focus(options);
|
|
20
24
|
};
|
|
21
25
|
</script>
|
|
22
26
|
|
|
@@ -24,7 +28,7 @@ export const focus = (options) => {
|
|
|
24
28
|
@component
|
|
25
29
|
A styled HTML input type=checkbox element.
|
|
26
30
|
-->
|
|
27
|
-
<div class=
|
|
31
|
+
<div class={`sterling-checkbox ${variant}`} class:disabled>
|
|
28
32
|
<div class="container">
|
|
29
33
|
<input
|
|
30
34
|
bind:this={inputRef}
|
|
@@ -63,173 +67,7 @@ export const focus = (options) => {
|
|
|
63
67
|
</div>
|
|
64
68
|
{#if $$slots.default}
|
|
65
69
|
<label for={id}>
|
|
66
|
-
<slot {checked} {
|
|
70
|
+
<slot {checked} {disabled} inputId={id} value={$$restProps.value} {variant} />
|
|
67
71
|
</label>
|
|
68
72
|
{/if}
|
|
69
73
|
</div>
|
|
70
|
-
|
|
71
|
-
<style>
|
|
72
|
-
.sterling-checkbox {
|
|
73
|
-
align-content: center;
|
|
74
|
-
align-items: center;
|
|
75
|
-
box-sizing: border-box;
|
|
76
|
-
display: inline-flex;
|
|
77
|
-
font: inherit;
|
|
78
|
-
margin: 0;
|
|
79
|
-
outline: none;
|
|
80
|
-
padding: 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/*
|
|
84
|
-
The container
|
|
85
|
-
- allows the input to be hidden
|
|
86
|
-
- avoids input participating in layout
|
|
87
|
-
- prevents collisions with surrounding slots
|
|
88
|
-
*/
|
|
89
|
-
.container {
|
|
90
|
-
font: inherit;
|
|
91
|
-
position: relative;
|
|
92
|
-
display: grid;
|
|
93
|
-
align-items: center;
|
|
94
|
-
margin-right: 0.25em;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/*
|
|
98
|
-
The input is hidden since the built-in browser checkbox cannot be customized
|
|
99
|
-
*/
|
|
100
|
-
input {
|
|
101
|
-
font: inherit;
|
|
102
|
-
margin: 0;
|
|
103
|
-
padding: 0;
|
|
104
|
-
position: absolute;
|
|
105
|
-
opacity: 0;
|
|
106
|
-
height: 20px;
|
|
107
|
-
width: 20px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/*
|
|
111
|
-
The indicator handles both the box and the checkmark.
|
|
112
|
-
The box cannot be on the container since the adjacent sibling selector is needed
|
|
113
|
-
and there is not a parent CSS selector.
|
|
114
|
-
*/
|
|
115
|
-
.indicator {
|
|
116
|
-
background-color: var(--stsv-input__background-color);
|
|
117
|
-
border-color: var(--stsv-input__border-color);
|
|
118
|
-
border-style: var(--stsv-input__border-style);
|
|
119
|
-
border-width: var(--stsv-input__border-width);
|
|
120
|
-
box-sizing: border-box;
|
|
121
|
-
display: inline-block;
|
|
122
|
-
height: 20px;
|
|
123
|
-
position: relative;
|
|
124
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
125
|
-
width: 20px;
|
|
126
|
-
pointer-events: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
input:checked + .indicator {
|
|
130
|
-
background-color: var(--stsv-input__background-color);
|
|
131
|
-
border-color: var(--stsv-input__border-color);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.sterling-checkbox:not(.disabled):hover .indicator {
|
|
135
|
-
background-color: var(--stsv-input__background-color--hover);
|
|
136
|
-
border-color: var(--stsv-input__border-color--hover);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
input:focus-visible + .indicator {
|
|
140
|
-
outline-color: var(--stsv-common__outline-color);
|
|
141
|
-
outline-offset: var(--stsv-common__outline-offset);
|
|
142
|
-
outline-style: var(--stsv-common__outline-style);
|
|
143
|
-
outline-width: var(--stsv-common__outline-width);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/*
|
|
147
|
-
The checkmark is a rotated L centered in the box.
|
|
148
|
-
*/
|
|
149
|
-
.indicator::after {
|
|
150
|
-
border-color: var(--stsv-input__color);
|
|
151
|
-
border-style: solid;
|
|
152
|
-
border-width: 0 3px 3px 0;
|
|
153
|
-
box-sizing: border-box;
|
|
154
|
-
content: '';
|
|
155
|
-
height: 14px;
|
|
156
|
-
left: 50%;
|
|
157
|
-
position: absolute;
|
|
158
|
-
top: 45%;
|
|
159
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
160
|
-
transform-origin: center;
|
|
161
|
-
transition: border-color 250ms, opacity 150ms;
|
|
162
|
-
width: 7px;
|
|
163
|
-
opacity: 0;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
input:checked + .indicator::after {
|
|
167
|
-
opacity: 1;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.sterling-checkbox:not(.disabled):hover input:checked + .indicator::after {
|
|
171
|
-
border-color: var(--stsv-input__color--hover);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.sterling-checkbox.colorful .indicator {
|
|
175
|
-
background-color: var(--stsv-input--colorful__background-color);
|
|
176
|
-
border-color: var(--stsv-input--colorful__border-color);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.sterling-checkbox.colorful:not(.disabled):hover .indicator {
|
|
180
|
-
background-color: var(--stsv-input--colorful__background-color--hover);
|
|
181
|
-
border-color: var(--stsv-input--colorful__border-color--hover);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.sterling-checkbox.colorful .indicator::after {
|
|
185
|
-
border-color: var(--stsv-input--colorful__color);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.sterling-checkbox.colorful:not(.disabled):hover input:checked + .indicator::after {
|
|
189
|
-
border-color: var(--stsv-input--colorful__color--hover);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.sterling-checkbox.disabled,
|
|
193
|
-
.sterling-checkbox.disabled input {
|
|
194
|
-
cursor: not-allowed;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.container::after {
|
|
198
|
-
background: repeating-linear-gradient(
|
|
199
|
-
var(--stsv-common--disabled__stripe-angle),
|
|
200
|
-
var(--stsv-common--disabled__stripe-color),
|
|
201
|
-
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
202
|
-
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
203
|
-
var(--stsv-common--disabled__stripe-color--alt)
|
|
204
|
-
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
205
|
-
);
|
|
206
|
-
bottom: 0;
|
|
207
|
-
content: '';
|
|
208
|
-
left: 0;
|
|
209
|
-
opacity: 0;
|
|
210
|
-
position: absolute;
|
|
211
|
-
right: 0;
|
|
212
|
-
top: 0;
|
|
213
|
-
pointer-events: none;
|
|
214
|
-
transition: opacity 250ms;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
label {
|
|
218
|
-
color: var(--stsv-common__color);
|
|
219
|
-
transition: color 250ms;
|
|
220
|
-
font: inherit;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.sterling-checkbox.disabled .container::after {
|
|
224
|
-
opacity: 1;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@media (prefers-reduced-motion) {
|
|
228
|
-
.indicator,
|
|
229
|
-
.indicator::after,
|
|
230
|
-
.container::after,
|
|
231
|
-
label {
|
|
232
|
-
transition: none;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
</style>
|
package/Checkbox.svelte.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
checked?: boolean | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
8
|
-
|
|
8
|
+
variant?: string | undefined;
|
|
9
9
|
blur?: (() => void) | undefined;
|
|
10
10
|
click?: (() => void) | undefined;
|
|
11
11
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
@@ -42,10 +42,10 @@ declare const __propDef: {
|
|
|
42
42
|
slots: {
|
|
43
43
|
default: {
|
|
44
44
|
checked: boolean;
|
|
45
|
-
colorful: boolean;
|
|
46
45
|
disabled: boolean;
|
|
47
46
|
inputId: string | undefined;
|
|
48
47
|
value: any;
|
|
48
|
+
variant: string;
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
};
|