@txstate-mws/svelte-components 1.2.2 → 1.2.5
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/components/Loading.svelte +41 -0
- package/components/Loading.svelte.d.ts +18 -0
- package/components/MultiSelect.svelte +11 -4
- package/components/MultiSelect.svelte.d.ts +2 -0
- package/components/PopupMenu.svelte +1 -0
- package/components/index.d.ts +2 -1
- package/components/index.js +2 -1
- package/package.json +2 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script >import ScreenReaderOnly from './ScreenReaderOnly.svelte';
|
|
2
|
+
import { resize, ResizeStore } from '../actions';
|
|
3
|
+
export let loading;
|
|
4
|
+
const store = new ResizeStore();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#if loading}
|
|
8
|
+
<div class="container">
|
|
9
|
+
<div use:resize={{ store }} class="loader" style:border-width="{$store.offsetWidth * 0.1}px"><ScreenReaderOnly>Loading</ScreenReaderOnly></div>
|
|
10
|
+
</div>
|
|
11
|
+
{:else}
|
|
12
|
+
<slot />
|
|
13
|
+
{/if}
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.container {
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
background-color: var(--loading-bg, var(--modal-bg, rgba(0, 0, 0, 0.7)));
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
}
|
|
27
|
+
.loader {
|
|
28
|
+
width: var(--loading-size, 10%);
|
|
29
|
+
padding-top: var(--loading-size, 10%);
|
|
30
|
+
border-color: var(--loading-bg-color, #FFFFFF);
|
|
31
|
+
border-top-color: var(--loading-moving-color, #333333);
|
|
32
|
+
border-style: solid;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
animation: spin 2s linear infinite;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes spin {
|
|
38
|
+
0% { transform: rotate(0deg); }
|
|
39
|
+
100% { transform: rotate(360deg); }
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
default: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare type LoadingProps = typeof __propDef.props;
|
|
14
|
+
export declare type LoadingEvents = typeof __propDef.events;
|
|
15
|
+
export declare type LoadingSlots = typeof __propDef.slots;
|
|
16
|
+
export default class Loading extends SvelteComponentTyped<LoadingProps, LoadingEvents, LoadingSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import DefaultPopupMenu from './PopupMenu.svelte';
|
|
|
5
5
|
import { debouncedPromise, modifierKey, selectionIsLeft } from '../util';
|
|
6
6
|
export let id = randomid();
|
|
7
7
|
export let name;
|
|
8
|
+
export let disabled = false;
|
|
8
9
|
export let getOptions;
|
|
9
10
|
export let menuContainerClass = undefined;
|
|
10
11
|
export let menuClass = undefined;
|
|
@@ -101,18 +102,18 @@ $: dispatch('change', selected);
|
|
|
101
102
|
</script>
|
|
102
103
|
|
|
103
104
|
<fieldset>
|
|
104
|
-
<ul class="multiselect-selected" role="listbox">
|
|
105
|
+
<ul class="multiselect-selected" class:disabled role="listbox">
|
|
105
106
|
{#each selected as option, i}
|
|
106
107
|
<li id={id + option.value} role="option" tabindex="-1" class="multiselect-pill" class:hilited={hilitedpill === option.value}
|
|
107
|
-
on:click|preventDefault|stopPropagation={() => removeSelection(option, i, 1)}
|
|
108
|
+
on:click|preventDefault|stopPropagation={() => !disabled && removeSelection(option, i, 1)} on:mousedown={e => disabled && e.preventDefault()}
|
|
108
109
|
aria-selected="true">
|
|
109
110
|
{option.label || option.value}
|
|
110
111
|
<ScreenReaderOnly>, click to remove</ScreenReaderOnly>
|
|
111
112
|
</li>
|
|
112
113
|
{/each}
|
|
113
114
|
<li class="input">
|
|
114
|
-
<input type="text" id={id} name={name} placeholder={placeholder}
|
|
115
|
-
bind:this={inputelement} bind:value={inputvalue}
|
|
115
|
+
<input type="text" id={id} name={name} {disabled} placeholder={placeholder}
|
|
116
|
+
bind:this={inputelement} bind:value={inputvalue} on:blur
|
|
116
117
|
on:focus={inputfocus} on:keydown={inputkeydown}
|
|
117
118
|
autocomplete="off" autocorrect="off" spellcheck="false" aria-autocomplete="list"
|
|
118
119
|
aria-describedby="{descriptionid}">
|
|
@@ -172,6 +173,12 @@ $: dispatch('change', selected);
|
|
|
172
173
|
color: var(--multiselect-pill-text, black);
|
|
173
174
|
padding: var(--multiselect-pill-padding, 0.3em 0.5em);
|
|
174
175
|
}
|
|
176
|
+
.multiselect-selected.disabled {
|
|
177
|
+
opacity: 0.5;
|
|
178
|
+
}
|
|
179
|
+
.multiselect-selected.disabled .multiselect-pill {
|
|
180
|
+
cursor: default;
|
|
181
|
+
}
|
|
175
182
|
.multiselect-pill.hilited {
|
|
176
183
|
outline: 0;
|
|
177
184
|
background-color: var(--multiselect-pill-selected, gray);
|
|
@@ -5,6 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
props: {
|
|
6
6
|
id?: string;
|
|
7
7
|
name: string;
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
getOptions: (search: string) => Promise<PopupMenuItem[]> | PopupMenuItem[];
|
|
9
10
|
menuContainerClass?: string | undefined;
|
|
10
11
|
menuClass?: string | undefined;
|
|
@@ -19,6 +20,7 @@ declare const __propDef: {
|
|
|
19
20
|
PopupMenu?: typeof DefaultPopupMenu;
|
|
20
21
|
};
|
|
21
22
|
events: {
|
|
23
|
+
blur: FocusEvent;
|
|
22
24
|
change: CustomEvent<any>;
|
|
23
25
|
} & {
|
|
24
26
|
[evt: string]: CustomEvent<any>;
|
package/components/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { default as CardLayout } from './CardLayout.svelte';
|
|
2
2
|
export { default as Card } from './Card.svelte';
|
|
3
3
|
export { default as CollapsingTable } from './CollapsingTable.svelte';
|
|
4
|
-
export { default as FocusLock } from './FocusLock.svelte';
|
|
5
4
|
export { default as ConditionalWrapper } from './ConditionalWrapper.svelte';
|
|
5
|
+
export { default as FocusLock } from './FocusLock.svelte';
|
|
6
|
+
export { default as Loading } from './Loading.svelte';
|
|
6
7
|
export { default as Modal } from './Modal.svelte';
|
|
7
8
|
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
8
9
|
export { default as PopupMenu } from './PopupMenu.svelte';
|
package/components/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { default as CardLayout } from './CardLayout.svelte';
|
|
2
2
|
export { default as Card } from './Card.svelte';
|
|
3
3
|
export { default as CollapsingTable } from './CollapsingTable.svelte';
|
|
4
|
-
export { default as FocusLock } from './FocusLock.svelte';
|
|
5
4
|
export { default as ConditionalWrapper } from './ConditionalWrapper.svelte';
|
|
5
|
+
export { default as FocusLock } from './FocusLock.svelte';
|
|
6
|
+
export { default as Loading } from './Loading.svelte';
|
|
6
7
|
export { default as Modal } from './Modal.svelte';
|
|
7
8
|
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
8
9
|
export { default as PopupMenu } from './PopupMenu.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@txstate-mws/svelte-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Svelte components that are generically useful.",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@txstate-mws/svelte-store": "^1.0.3",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"./components/CollapsingTable.svelte": "./components/CollapsingTable.svelte",
|
|
45
45
|
"./components/ConditionalWrapper.svelte": "./components/ConditionalWrapper.svelte",
|
|
46
46
|
"./components/FocusLock.svelte": "./components/FocusLock.svelte",
|
|
47
|
+
"./components/Loading.svelte": "./components/Loading.svelte",
|
|
47
48
|
"./components/Modal.svelte": "./components/Modal.svelte",
|
|
48
49
|
"./components/MultiSelect.svelte": "./components/MultiSelect.svelte",
|
|
49
50
|
"./components/PopupMenu.svelte": "./components/PopupMenu.svelte",
|