@geoffcox/sterling-svelte 1.0.10 → 1.0.12
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/dist/Callout.svelte +15 -7
- package/dist/ColorPicker.svelte +27 -10
- package/dist/ColorPicker.svelte.d.ts +2 -0
- package/dist/Dialog.svelte +8 -11
- package/dist/Dropdown.svelte +4 -1
- package/dist/HslColorSliders.svelte +3 -3
- package/dist/List.svelte +0 -1
- package/dist/MenuButton.svelte +4 -12
- package/dist/MenuButton.svelte.d.ts +2 -2
- package/dist/MenuItem.types.d.ts +1 -1
- package/dist/Popover.svelte +1 -1
- package/dist/TextArea.svelte +20 -2
- package/dist/Tooltip.svelte +1 -1
- package/dist/css/Button.base.css +4 -24
- package/dist/css/Button.css +1 -0
- package/dist/css/Button.disabled.css +22 -0
- package/dist/css/Callout.base.css +12 -0
- package/dist/css/Checkbox.base.css +7 -31
- package/dist/css/Checkbox.css +1 -0
- package/dist/css/Checkbox.disabled.css +28 -0
- package/dist/css/Dropdown.base.css +4 -46
- package/dist/css/Dropdown.composed.css +11 -0
- package/dist/css/Dropdown.css +2 -0
- package/dist/css/Dropdown.disabled.css +32 -0
- package/dist/css/HexColorSliders.base.css +6 -25
- package/dist/css/HslColorSliders.base.css +7 -26
- package/dist/css/Input.base.css +4 -32
- package/dist/css/Input.composed.css +4 -0
- package/dist/css/Input.css +1 -0
- package/dist/css/Input.disabled.css +24 -0
- package/dist/css/Label.base.css +8 -12
- package/dist/css/Label.css +1 -0
- package/dist/css/Label.disabled.css +9 -0
- package/dist/css/Link.base.css +5 -14
- package/dist/css/Link.css +5 -0
- package/dist/css/Link.disabled.css +10 -0
- package/dist/css/Link.text-underline.css +8 -0
- package/dist/css/Link.text-underline.ghost.css +13 -0
- package/dist/css/Link.undecorated.colorful.css +2 -0
- package/dist/css/Link.undecorated.css +2 -0
- package/dist/css/Link.undecorated.ghost.css +8 -0
- package/dist/css/Link.undecorated.underline.css +8 -0
- package/dist/css/List.base.css +4 -18
- package/dist/css/List.composed.css +8 -0
- package/dist/css/List.css +2 -0
- package/dist/css/List.disabled.css +7 -0
- package/dist/css/ListItem.base.css +4 -30
- package/dist/css/ListItem.css +1 -0
- package/dist/css/ListItem.disabled.css +28 -0
- package/dist/css/MenuItemDisplay.base.css +5 -30
- package/dist/css/MenuItemDisplay.css +1 -0
- package/dist/css/MenuItemDisplay.disabled.css +28 -0
- package/dist/css/Progress.base.css +8 -22
- package/dist/css/Progress.css +1 -0
- package/dist/css/Progress.disabled.css +17 -0
- package/dist/css/Radio.base.css +4 -30
- package/dist/css/Radio.css +1 -0
- package/dist/css/Radio.disabled.css +28 -0
- package/dist/css/Select.base.css +4 -30
- package/dist/css/Select.css +1 -0
- package/dist/css/Select.disabled.css +28 -0
- package/dist/css/Slider.base.css +16 -46
- package/dist/css/Slider.css +1 -0
- package/dist/css/Slider.disabled.css +30 -0
- package/dist/css/Switch.base.css +15 -33
- package/dist/css/Switch.colorful.css +6 -0
- package/dist/css/Switch.css +1 -0
- package/dist/css/Switch.disabled.css +30 -0
- package/dist/css/Tab.base.css +4 -40
- package/dist/css/Tab.css +1 -0
- package/dist/css/Tab.disabled.css +36 -0
- package/dist/css/TextArea.base.css +8 -31
- package/dist/css/TextArea.composed.css +1 -1
- package/dist/css/TextArea.css +1 -0
- package/dist/css/TextArea.disabled.css +28 -0
- package/dist/css/Tree.base.css +4 -29
- package/dist/css/Tree.css +1 -0
- package/dist/css/Tree.disabled.css +27 -0
- package/dist/css/TreeItemDisplay.base.css +4 -30
- package/dist/css/TreeItemDisplay.css +2 -0
- package/dist/css/TreeItemDisplay.disabled.css +28 -0
- package/dist/package.json +108 -0
- package/package.json +3 -4
package/dist/Callout.svelte
CHANGED
|
@@ -14,7 +14,7 @@ export let mainAxisOffset = 0;
|
|
|
14
14
|
/** When true, the callout is open and visible. */
|
|
15
15
|
export let open = false;
|
|
16
16
|
/** How the callout should be positioned relative to the reference element. */
|
|
17
|
-
export let placement = '
|
|
17
|
+
export let placement = 'top-start';
|
|
18
18
|
/** The host container for the callout. */
|
|
19
19
|
export let portalHost = undefined;
|
|
20
20
|
/** The reference to the element anchoring the position of the callout. */
|
|
@@ -83,9 +83,7 @@ const getArrowPlacementStyle = (position) => {
|
|
|
83
83
|
case 'top':
|
|
84
84
|
case 'top-start':
|
|
85
85
|
case 'top-end':
|
|
86
|
-
return (`bottom: -${arrowRef.offsetWidth}px;` +
|
|
87
|
-
`filter: drop-shadow(-1px -2px 1px rgba(0,0,0,0.2));` +
|
|
88
|
-
`transform:translate(0, -50%) rotate(135deg);`);
|
|
86
|
+
return (`bottom: -${arrowRef.offsetWidth}px;` + `transform:translate(0, -50%) rotate(135deg);`);
|
|
89
87
|
case 'right':
|
|
90
88
|
case 'right-start':
|
|
91
89
|
case 'right-end':
|
|
@@ -97,9 +95,7 @@ const getArrowPlacementStyle = (position) => {
|
|
|
97
95
|
case 'left':
|
|
98
96
|
case 'left-start':
|
|
99
97
|
case 'left-end':
|
|
100
|
-
return (`right: -${arrowRef.offsetWidth}px;` +
|
|
101
|
-
`filter: drop-shadow(2px 2px 1px rgba(0,0,0,0.2));` +
|
|
102
|
-
`transform:translate(-50%, 0) rotate(45deg);`);
|
|
98
|
+
return (`right: -${arrowRef.offsetWidth}px;` + `transform:translate(-50%, 0) rotate(45deg);`);
|
|
103
99
|
}
|
|
104
100
|
}
|
|
105
101
|
return '';
|
|
@@ -155,6 +151,18 @@ ensurePortalHost();
|
|
|
155
151
|
bind:this={popupRef}
|
|
156
152
|
class={`sterling-callout ${variant}`}
|
|
157
153
|
class:open
|
|
154
|
+
class:top={popupPosition.placement === 'top'}
|
|
155
|
+
class:top-start={popupPosition.placement === 'top-start'}
|
|
156
|
+
class:top-end={popupPosition.placement === 'top-end'}
|
|
157
|
+
class:right={popupPosition.placement === 'right'}
|
|
158
|
+
class:right-start={popupPosition.placement === 'right-start'}
|
|
159
|
+
class:right-end={popupPosition.placement === 'right-end'}
|
|
160
|
+
class:bottom={popupPosition.placement === 'bottom'}
|
|
161
|
+
class:bottom-start={popupPosition.placement === 'bottom-start'}
|
|
162
|
+
class:bottom-end={popupPosition.placement === 'bottom-end'}
|
|
163
|
+
class:left={popupPosition.placement === 'left'}
|
|
164
|
+
class:left-start={popupPosition.placement === 'left-start'}
|
|
165
|
+
class:left-end={popupPosition.placement === 'left-end'}
|
|
158
166
|
role="tooltip"
|
|
159
167
|
on:blur
|
|
160
168
|
on:click
|
package/dist/ColorPicker.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { tick } from 'svelte';
|
|
2
|
-
import
|
|
2
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
3
3
|
import Dropdown from './Dropdown.svelte';
|
|
4
4
|
import Input from './Input.svelte';
|
|
5
5
|
import Tab from './Tab.svelte';
|
|
@@ -22,6 +22,10 @@ export let disabled = false;
|
|
|
22
22
|
export let open = false;
|
|
23
23
|
/** Additional class names to apply. */
|
|
24
24
|
export let variant = '';
|
|
25
|
+
/** Additional class names to apply to the value input. */
|
|
26
|
+
export let valueVariant = '';
|
|
27
|
+
/** Additional class names to apply to sliders. */
|
|
28
|
+
export let sliderVariant = '';
|
|
25
29
|
// ----- State ----- //
|
|
26
30
|
let hue = 0;
|
|
27
31
|
let saturation = 0;
|
|
@@ -41,7 +45,7 @@ const updateFromRgb = async () => {
|
|
|
41
45
|
if (!updating && (colorFormat === 'hex' || colorFormat === 'rgb')) {
|
|
42
46
|
updating = true;
|
|
43
47
|
const newAlpha = colorFormat === 'hex' ? hexAlpha / 255 : alpha;
|
|
44
|
-
const color =
|
|
48
|
+
const color = new TinyColor({ r: red, g: green, b: blue, a: newAlpha });
|
|
45
49
|
const hsl = color.toHsl();
|
|
46
50
|
hue = Math.round(hsl.h);
|
|
47
51
|
saturation = Math.round(hsl.s * 100);
|
|
@@ -66,7 +70,7 @@ const updateFromHsl = async () => {
|
|
|
66
70
|
if (globalThis.window) {
|
|
67
71
|
if (!updating && colorFormat === 'hsl') {
|
|
68
72
|
updating = true;
|
|
69
|
-
const color =
|
|
73
|
+
const color = new TinyColor({ h: hue, s: saturation / 100, l: lightness / 100, a: alpha });
|
|
70
74
|
const rgb = color.toRgb();
|
|
71
75
|
red = rgb.r;
|
|
72
76
|
green = rgb.g;
|
|
@@ -81,7 +85,7 @@ const updateFromHsl = async () => {
|
|
|
81
85
|
const updateColorsFromText = async () => {
|
|
82
86
|
// tinycolor requires window
|
|
83
87
|
if (globalThis.window) {
|
|
84
|
-
const color =
|
|
88
|
+
const color = new TinyColor(colorText);
|
|
85
89
|
if (color.isValid) {
|
|
86
90
|
if (!updating) {
|
|
87
91
|
updating = true;
|
|
@@ -144,13 +148,13 @@ $: {
|
|
|
144
148
|
}
|
|
145
149
|
// ----- Event handlers ----- //
|
|
146
150
|
const onInputBlur = async () => {
|
|
147
|
-
if (globalThis.window
|
|
151
|
+
if (globalThis.window) {
|
|
148
152
|
if (!updating) {
|
|
149
153
|
if (colorText.trim().length === 0) {
|
|
150
154
|
colorText = defaultColorText;
|
|
151
155
|
return;
|
|
152
156
|
}
|
|
153
|
-
const color =
|
|
157
|
+
const color = new TinyColor(colorText);
|
|
154
158
|
if (color.isValid) {
|
|
155
159
|
updating = true;
|
|
156
160
|
switch (colorFormat) {
|
|
@@ -234,6 +238,7 @@ updateColorsFromText();
|
|
|
234
238
|
on:mouseup
|
|
235
239
|
on:wheel
|
|
236
240
|
on:paste
|
|
241
|
+
{variant}
|
|
237
242
|
{...$$restProps}
|
|
238
243
|
>
|
|
239
244
|
<div class="value" slot="value">
|
|
@@ -245,7 +250,7 @@ updateColorsFromText();
|
|
|
245
250
|
on:click={onInputClick}
|
|
246
251
|
on:keydown={onInputKeydown}
|
|
247
252
|
spellcheck="false"
|
|
248
|
-
variant={`composed ${
|
|
253
|
+
variant={`composed ${valueVariant}`}
|
|
249
254
|
/>
|
|
250
255
|
</div>
|
|
251
256
|
<div class="sterling-color-picker-popup" use:trapKeyboardFocus>
|
|
@@ -258,11 +263,23 @@ updateColorsFromText();
|
|
|
258
263
|
</div>
|
|
259
264
|
<div class="sliders">
|
|
260
265
|
{#if colorFormat === 'rgb'}
|
|
261
|
-
<RgbColorSliders bind:red bind:green bind:blue bind:alpha />
|
|
266
|
+
<RgbColorSliders bind:red bind:green bind:blue bind:alpha variant={sliderVariant} />
|
|
262
267
|
{:else if colorFormat === 'hex'}
|
|
263
|
-
<HexColorSliders
|
|
268
|
+
<HexColorSliders
|
|
269
|
+
bind:red
|
|
270
|
+
bind:green
|
|
271
|
+
bind:blue
|
|
272
|
+
bind:alpha={hexAlpha}
|
|
273
|
+
variant={sliderVariant}
|
|
274
|
+
/>
|
|
264
275
|
{:else if colorFormat === 'hsl'}
|
|
265
|
-
<HslColorSliders
|
|
276
|
+
<HslColorSliders
|
|
277
|
+
bind:hue
|
|
278
|
+
bind:saturation
|
|
279
|
+
bind:lightness
|
|
280
|
+
bind:alpha
|
|
281
|
+
variant={sliderVariant}
|
|
282
|
+
/>
|
|
266
283
|
{/if}
|
|
267
284
|
</div>
|
|
268
285
|
</div>
|
package/dist/Dialog.svelte
CHANGED
|
@@ -39,17 +39,18 @@ const showDialog = () => {
|
|
|
39
39
|
if (dialogRef?.open === false) {
|
|
40
40
|
// when open, track clicks outside the dialog (use capture = true)
|
|
41
41
|
document.addEventListener('click', onDocumentClick, true);
|
|
42
|
+
returnValue = '';
|
|
42
43
|
dialogRef.showModal();
|
|
43
44
|
}
|
|
44
45
|
open = true;
|
|
45
46
|
};
|
|
46
|
-
const closeDialog = (
|
|
47
|
+
const closeDialog = async () => {
|
|
47
48
|
if (dialogRef?.open === true) {
|
|
48
49
|
// when closed, stop tracking clicks outside the dialog
|
|
49
50
|
document.removeEventListener('click', onDocumentClick);
|
|
50
51
|
// to allow time for the CSS transition animation, closing the dialog is delayed
|
|
51
52
|
closing = true;
|
|
52
|
-
tick();
|
|
53
|
+
await tick();
|
|
53
54
|
setTimeout(() => {
|
|
54
55
|
dialogRef.close(returnValue);
|
|
55
56
|
open = false;
|
|
@@ -73,6 +74,7 @@ const onCancel = (event) => {
|
|
|
73
74
|
// To allow animation with closeDialog, this event is canceled.
|
|
74
75
|
event.preventDefault();
|
|
75
76
|
event.stopPropagation();
|
|
77
|
+
returnValue = '';
|
|
76
78
|
closeDialog();
|
|
77
79
|
return false;
|
|
78
80
|
};
|
|
@@ -84,9 +86,11 @@ const onSubmit = (event) => {
|
|
|
84
86
|
const anyEvent = event;
|
|
85
87
|
if (anyEvent?.submitter.type === 'submit') {
|
|
86
88
|
if (dialogRef.open) {
|
|
87
|
-
|
|
89
|
+
const eventSubmitter = anyEvent?.submitter;
|
|
90
|
+
returnValue = eventSubmitter?.value ?? '';
|
|
91
|
+
closeDialog();
|
|
88
92
|
setTimeout(() => {
|
|
89
|
-
formRef.requestSubmit(
|
|
93
|
+
formRef.requestSubmit(eventSubmitter);
|
|
90
94
|
}, dialogFadeDuration);
|
|
91
95
|
event.preventDefault();
|
|
92
96
|
return false;
|
|
@@ -97,11 +101,6 @@ const onSubmit = (event) => {
|
|
|
97
101
|
return false;
|
|
98
102
|
}
|
|
99
103
|
};
|
|
100
|
-
const onClose = (event) => {
|
|
101
|
-
// This event is not cancelable.
|
|
102
|
-
// Update the returnValue whenever the dialog closes.
|
|
103
|
-
returnValue = dialogRef.returnValue;
|
|
104
|
-
};
|
|
105
104
|
$: {
|
|
106
105
|
updateDialog(open);
|
|
107
106
|
}
|
|
@@ -110,10 +109,8 @@ onMount(() => {
|
|
|
110
109
|
// Use the dialog for any element portals
|
|
111
110
|
portalHostStore.set(dialogRef);
|
|
112
111
|
dialogRef.addEventListener('cancel', onCancel);
|
|
113
|
-
dialogRef.addEventListener('close', onClose);
|
|
114
112
|
return () => {
|
|
115
113
|
dialogRef?.removeEventListener('cancel', onCancel);
|
|
116
|
-
dialogRef?.removeEventListener('close', onClose);
|
|
117
114
|
portalHostStore.set(undefined);
|
|
118
115
|
};
|
|
119
116
|
});
|
package/dist/Dropdown.svelte
CHANGED
|
@@ -4,6 +4,7 @@ import { clickOutside } from './actions/clickOutside';
|
|
|
4
4
|
import { idGenerator } from './idGenerator';
|
|
5
5
|
import { prefersReducedMotion } from './mediaQueries/prefersReducedMotion';
|
|
6
6
|
import { slide } from 'svelte/transition';
|
|
7
|
+
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
7
8
|
const popupId = idGenerator.nextId('Dropdown-popup');
|
|
8
9
|
// ----- Props ----- //
|
|
9
10
|
/** Disables the dropdown. */
|
|
@@ -79,6 +80,8 @@ $: slideMotion = !$prefersReducedMotion ? slide : slideNoOp;
|
|
|
79
80
|
aria-expanded={open}
|
|
80
81
|
class={`sterling-dropdown ${variant}`}
|
|
81
82
|
class:disabled
|
|
83
|
+
class:open
|
|
84
|
+
class:using-keyboard={$usingKeyboard}
|
|
82
85
|
role="combobox"
|
|
83
86
|
tabindex="0"
|
|
84
87
|
use:clickOutside={{ ignoreOthers: [popupContentRef] }}
|
|
@@ -126,7 +129,7 @@ $: slideMotion = !$prefersReducedMotion ? slide : slideNoOp;
|
|
|
126
129
|
</div>
|
|
127
130
|
</slot>
|
|
128
131
|
|
|
129
|
-
<Popover reference={dropdownRef} open={!disabled && open}>
|
|
132
|
+
<Popover reference={dropdownRef} open={!disabled && open} placement="bottom-start">
|
|
130
133
|
<div
|
|
131
134
|
class={`sterling-dropdown-popup-content ${variant}`}
|
|
132
135
|
transition:slideMotion|global={{ duration: 200 }}
|
|
@@ -4,11 +4,11 @@ import Slider from './Slider.svelte';
|
|
|
4
4
|
import { round } from 'lodash-es';
|
|
5
5
|
// ----- Props ----- //
|
|
6
6
|
/** The hue value. */
|
|
7
|
-
export let hue =
|
|
7
|
+
export let hue = 0;
|
|
8
8
|
/** The saturation value. */
|
|
9
|
-
export let saturation =
|
|
9
|
+
export let saturation = 0;
|
|
10
10
|
/** The lightness value. */
|
|
11
|
-
export let lightness =
|
|
11
|
+
export let lightness = 0;
|
|
12
12
|
/** The alpha value. */
|
|
13
13
|
export let alpha = 1;
|
|
14
14
|
/** Additional class names to apply. */
|
package/dist/List.svelte
CHANGED
|
@@ -114,7 +114,6 @@ export const selectNextItem = () => {
|
|
|
114
114
|
};
|
|
115
115
|
export const selectLastItem = () => {
|
|
116
116
|
let candidate = listRef?.querySelector('[data-value][role=listitem]:last-of-type');
|
|
117
|
-
console.log('in selectLastItem', candidate);
|
|
118
117
|
while (candidate && !isElementListItem(candidate)) {
|
|
119
118
|
candidate = candidate.previousElementSibling;
|
|
120
119
|
}
|
package/dist/MenuButton.svelte
CHANGED
|
@@ -7,14 +7,11 @@ import { idGenerator } from './idGenerator';
|
|
|
7
7
|
import Popover from './Popover.svelte';
|
|
8
8
|
import { clickOutside } from './actions/clickOutside';
|
|
9
9
|
// ----- Props ----- //
|
|
10
|
-
/** When true, the menu is open. */
|
|
11
10
|
export let open = false;
|
|
12
|
-
|
|
11
|
+
export let menuVariant = '';
|
|
12
|
+
export let popoverPlacement = 'bottom-start';
|
|
13
13
|
export let value;
|
|
14
|
-
/** Additional class names to apply. */
|
|
15
14
|
export let variant = '';
|
|
16
|
-
/** Additional class names to apply to the Menu*/
|
|
17
|
-
export let menuVariant = '';
|
|
18
15
|
// ----- State ----- //
|
|
19
16
|
const instanceId = idGenerator.nextId('MenuButton');
|
|
20
17
|
let buttonRef;
|
|
@@ -66,7 +63,6 @@ $: {
|
|
|
66
63
|
}
|
|
67
64
|
prevOpen = open;
|
|
68
65
|
}
|
|
69
|
-
// ----- Event Handlers ----- //
|
|
70
66
|
const closeAllMenus = () => {
|
|
71
67
|
openValues.set([]);
|
|
72
68
|
};
|
|
@@ -81,7 +77,7 @@ const onClickOutside = (event) => {
|
|
|
81
77
|
}
|
|
82
78
|
closeAllMenus?.();
|
|
83
79
|
};
|
|
84
|
-
// -----
|
|
80
|
+
// ----- Context ----- //
|
|
85
81
|
setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
86
82
|
depth: 1,
|
|
87
83
|
openValues,
|
|
@@ -95,10 +91,6 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
95
91
|
});
|
|
96
92
|
</script>
|
|
97
93
|
|
|
98
|
-
<!--
|
|
99
|
-
@component
|
|
100
|
-
A Button that displays a context menu when clicked.
|
|
101
|
-
-->
|
|
102
94
|
<Button
|
|
103
95
|
bind:this={buttonRef}
|
|
104
96
|
aria-controls={menuId}
|
|
@@ -145,7 +137,7 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
145
137
|
<div class="reference" bind:this={reference} use:clickOutside on:click_outside={onClickOutside}>
|
|
146
138
|
<slot {open} {value} {variant} />
|
|
147
139
|
</div>
|
|
148
|
-
<Popover {reference} {open}>
|
|
140
|
+
<Popover {reference} {open} placement={popoverPlacement}>
|
|
149
141
|
<Menu bind:this={menuRef} id={menuId} {reference} {open} variant={menuVariant}>
|
|
150
142
|
<slot name="items" />
|
|
151
143
|
</Menu>
|
|
@@ -3,9 +3,10 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
open?: boolean | undefined;
|
|
6
|
+
menuVariant?: string | undefined;
|
|
7
|
+
popoverPlacement?: string | undefined;
|
|
6
8
|
value: string;
|
|
7
9
|
variant?: string | undefined;
|
|
8
|
-
menuVariant?: string | undefined;
|
|
9
10
|
click?: (() => void) | undefined;
|
|
10
11
|
blur?: (() => void) | undefined;
|
|
11
12
|
focus?: ((options?: FocusOptions) => void) | undefined;
|
|
@@ -62,7 +63,6 @@ declare const __propDef: {
|
|
|
62
63
|
export type MenuButtonProps = typeof __propDef.props;
|
|
63
64
|
export type MenuButtonEvents = typeof __propDef.events;
|
|
64
65
|
export type MenuButtonSlots = typeof __propDef.slots;
|
|
65
|
-
/** A Button that displays a context menu when clicked. */
|
|
66
66
|
export default class MenuButton extends SvelteComponent<MenuButtonProps, MenuButtonEvents, MenuButtonSlots> {
|
|
67
67
|
get click(): () => void;
|
|
68
68
|
get blur(): () => void;
|
package/dist/MenuItem.types.d.ts
CHANGED
package/dist/Popover.svelte
CHANGED
|
@@ -12,7 +12,7 @@ export let mainAxisOffset = 0;
|
|
|
12
12
|
/** When true, the popover is open and visible. */
|
|
13
13
|
export let open = false;
|
|
14
14
|
/** How the popover should be positioned relative to the reference element. */
|
|
15
|
-
export let placement = '
|
|
15
|
+
export let placement = 'top-start';
|
|
16
16
|
/** The host container for the callout. */
|
|
17
17
|
export let portalHost = undefined;
|
|
18
18
|
/** The reference to the element anchoring the position of the popover. */
|
package/dist/TextArea.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { onMount } from 'svelte';
|
|
1
|
+
<script>import { onMount, tick } from 'svelte';
|
|
2
2
|
// ----- Props ----- //
|
|
3
3
|
export let disabled = false;
|
|
4
4
|
export let value = '';
|
|
@@ -10,6 +10,24 @@ export let resize = 'none';
|
|
|
10
10
|
export let variant = '';
|
|
11
11
|
// ----- State ----- //
|
|
12
12
|
let textAreaRef;
|
|
13
|
+
const correctResize = async () => {
|
|
14
|
+
console.log('correctResize');
|
|
15
|
+
await tick();
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
if (autoHeight) {
|
|
18
|
+
if (resize === 'both') {
|
|
19
|
+
console.warn('The resize property cannot be set to "both" when autoHeight is true. The resize property will be set to "horizontal".');
|
|
20
|
+
resize = 'horizontal';
|
|
21
|
+
}
|
|
22
|
+
if (resize === 'vertical') {
|
|
23
|
+
console.warn('The resize property cannot be set to "vertical" when autoHeight is true. The resize property will be set to "none".');
|
|
24
|
+
resize = 'none';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, 0);
|
|
28
|
+
};
|
|
29
|
+
$: autoHeight, resize, correctResize();
|
|
30
|
+
// ----- autoHeight ----- //
|
|
13
31
|
const autoSetHeight = () => {
|
|
14
32
|
if (autoHeight && textAreaRef) {
|
|
15
33
|
// the style must be directly set to avoid re-rendering looping latency
|
|
@@ -18,11 +36,11 @@ const autoSetHeight = () => {
|
|
|
18
36
|
textAreaRef.style.height = `${textAreaRef.scrollHeight}px`;
|
|
19
37
|
}
|
|
20
38
|
};
|
|
39
|
+
$: autoHeight, autoSetHeight();
|
|
21
40
|
// ----- Event Handlers ----- //
|
|
22
41
|
const onInput = () => {
|
|
23
42
|
autoSetHeight();
|
|
24
43
|
};
|
|
25
|
-
$: autoHeight, autoSetHeight();
|
|
26
44
|
onMount(() => {
|
|
27
45
|
autoSetHeight();
|
|
28
46
|
});
|
package/dist/Tooltip.svelte
CHANGED
|
@@ -6,7 +6,7 @@ export let conditionalRender = true;
|
|
|
6
6
|
export let crossAxisOffset = 0;
|
|
7
7
|
export let mainAxisOffset = 0;
|
|
8
8
|
export let open = false;
|
|
9
|
-
export let placement = '
|
|
9
|
+
export let placement = 'top-start';
|
|
10
10
|
export let portalHost = undefined;
|
|
11
11
|
export let variant = '';
|
|
12
12
|
/** When true, the tooltip is disabled and will not be shown. */
|
package/dist/css/Button.base.css
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
padding: 0.5em 1em;
|
|
20
20
|
text-decoration: none;
|
|
21
21
|
text-overflow: ellipsis;
|
|
22
|
-
transition:
|
|
22
|
+
transition:
|
|
23
|
+
background-color 250ms,
|
|
24
|
+
color 250ms,
|
|
25
|
+
border-color 250ms;
|
|
23
26
|
white-space: nowrap;
|
|
24
27
|
user-select: none;
|
|
25
28
|
}
|
|
@@ -44,29 +47,6 @@
|
|
|
44
47
|
outline-width: 2px;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
.sterling-button:disabled {
|
|
48
|
-
cursor: not-allowed;
|
|
49
|
-
position: relative;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.sterling-button:disabled::after {
|
|
53
|
-
content: '';
|
|
54
|
-
position: absolute;
|
|
55
|
-
left: 0;
|
|
56
|
-
right: 0;
|
|
57
|
-
top: 0;
|
|
58
|
-
bottom: 0;
|
|
59
|
-
background: repeating-linear-gradient(
|
|
60
|
-
var(--stsv-common--disabled__stripe-angle),
|
|
61
|
-
var(--stsv-common--disabled__stripe-color),
|
|
62
|
-
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
63
|
-
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
64
|
-
var(--stsv-common--disabled__stripe-color--alt)
|
|
65
|
-
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
66
|
-
);
|
|
67
|
-
pointer-events: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
50
|
@media (prefers-reduced-motion) {
|
|
71
51
|
.sterling-button {
|
|
72
52
|
transition: none;
|
package/dist/css/Button.css
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.sterling-button:disabled {
|
|
2
|
+
cursor: not-allowed;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sterling-button:disabled::after {
|
|
7
|
+
content: '';
|
|
8
|
+
position: absolute;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
top: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
background: repeating-linear-gradient(
|
|
14
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
15
|
+
var(--stsv-common--disabled__stripe-color),
|
|
16
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
17
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
18
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
19
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
20
|
+
);
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
@@ -41,3 +41,15 @@
|
|
|
41
41
|
/* The -100% and 200% allow for the drop-shadow to not be clipped */
|
|
42
42
|
clip-path: polygon(-100% -100%, 200% -100%, 200% 200%, -100% -100%);
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
.sterling-callout.top-start .arrow,
|
|
46
|
+
.sterling-callout.top .arrow,
|
|
47
|
+
.sterling-callout.top-end .arrow {
|
|
48
|
+
filter: drop-shadow(-1px -2px 1px rgba(0, 0, 0, 0.2));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sterling-callout.left-start .arrow,
|
|
52
|
+
.sterling-callout.left .arrow,
|
|
53
|
+
.sterling-callout.left-end .arrow {
|
|
54
|
+
filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.2));
|
|
55
|
+
}
|
|
@@ -50,7 +50,10 @@ and there is not a parent CSS selector.
|
|
|
50
50
|
display: inline-block;
|
|
51
51
|
height: 20px;
|
|
52
52
|
position: relative;
|
|
53
|
-
transition:
|
|
53
|
+
transition:
|
|
54
|
+
background-color 250ms,
|
|
55
|
+
color 250ms,
|
|
56
|
+
border-color 250ms;
|
|
54
57
|
width: 20px;
|
|
55
58
|
pointer-events: none;
|
|
56
59
|
}
|
|
@@ -87,7 +90,9 @@ The checkmark is a rotated L centered in the box.
|
|
|
87
90
|
top: 45%;
|
|
88
91
|
transform: translate(-50%, -50%) rotate(45deg);
|
|
89
92
|
transform-origin: center;
|
|
90
|
-
transition:
|
|
93
|
+
transition:
|
|
94
|
+
border-color 250ms,
|
|
95
|
+
opacity 150ms;
|
|
91
96
|
width: 7px;
|
|
92
97
|
opacity: 0;
|
|
93
98
|
}
|
|
@@ -100,41 +105,12 @@ The checkmark is a rotated L centered in the box.
|
|
|
100
105
|
border-color: var(--stsv-input__color--hover);
|
|
101
106
|
}
|
|
102
107
|
|
|
103
|
-
.sterling-checkbox.disabled,
|
|
104
|
-
.sterling-checkbox.disabled input {
|
|
105
|
-
cursor: not-allowed;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.sterling-checkbox .container::after {
|
|
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
|
-
bottom: 0;
|
|
118
|
-
content: '';
|
|
119
|
-
left: 0;
|
|
120
|
-
opacity: 0;
|
|
121
|
-
position: absolute;
|
|
122
|
-
right: 0;
|
|
123
|
-
top: 0;
|
|
124
|
-
pointer-events: none;
|
|
125
|
-
transition: opacity 250ms;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
108
|
.sterling-checkbox > label {
|
|
129
109
|
color: var(--stsv-common__color);
|
|
130
110
|
transition: color 250ms;
|
|
131
111
|
font: inherit;
|
|
132
112
|
}
|
|
133
113
|
|
|
134
|
-
.sterling-checkbox.disabled .container::after {
|
|
135
|
-
opacity: 1;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
114
|
@media (prefers-reduced-motion) {
|
|
139
115
|
.sterling-checkbox .indicator,
|
|
140
116
|
.sterling-checkbox .indicator::after,
|
package/dist/css/Checkbox.css
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.sterling-checkbox.disabled,
|
|
2
|
+
.sterling-checkbox.disabled input {
|
|
3
|
+
cursor: not-allowed;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sterling-checkbox .container::after {
|
|
7
|
+
background: repeating-linear-gradient(
|
|
8
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
9
|
+
var(--stsv-common--disabled__stripe-color),
|
|
10
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
11
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
12
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
13
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
14
|
+
);
|
|
15
|
+
bottom: 0;
|
|
16
|
+
content: '';
|
|
17
|
+
left: 0;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
position: absolute;
|
|
20
|
+
right: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
transition: opacity 250ms;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sterling-checkbox.disabled .container::after {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
padding: 0;
|
|
16
16
|
position: relative;
|
|
17
|
-
transition:
|
|
17
|
+
transition:
|
|
18
|
+
background-color 250ms,
|
|
19
|
+
color 250ms,
|
|
20
|
+
border-color 250ms;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
.sterling-dropdown:hover {
|
|
@@ -33,51 +36,6 @@
|
|
|
33
36
|
outline-width: 2px;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
.sterling-dropdown.disabled {
|
|
37
|
-
cursor: not-allowed;
|
|
38
|
-
outline: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.sterling-dropdown.disabled .button {
|
|
42
|
-
cursor: not-allowed;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.sterling-dropdown::after {
|
|
46
|
-
background: repeating-linear-gradient(
|
|
47
|
-
var(--stsv-common--disabled__stripe-angle),
|
|
48
|
-
var(--stsv-common--disabled__stripe-color),
|
|
49
|
-
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
50
|
-
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
51
|
-
var(--stsv-common--disabled__stripe-color--alt)
|
|
52
|
-
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
53
|
-
);
|
|
54
|
-
bottom: 0;
|
|
55
|
-
content: '';
|
|
56
|
-
left: 0;
|
|
57
|
-
opacity: 0;
|
|
58
|
-
position: absolute;
|
|
59
|
-
right: 0;
|
|
60
|
-
top: 0;
|
|
61
|
-
pointer-events: none;
|
|
62
|
-
transition: opacity 250ms;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.sterling-dropdown.disabled::after {
|
|
66
|
-
opacity: 1;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.sterling-dropdown.composed,
|
|
70
|
-
.sterling-dropdown.composed:hover,
|
|
71
|
-
.sterling-dropdown.composed.focus {
|
|
72
|
-
background: none;
|
|
73
|
-
border: none;
|
|
74
|
-
outline: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.sterling-dropdown.composed.disabled::after {
|
|
78
|
-
opacity: 0;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
39
|
.sterling-dropdown > .value {
|
|
82
40
|
overflow: hidden;
|
|
83
41
|
}
|