@txstate-mws/svelte-components 1.3.8 → 1.4.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/dist/components/Lottie.svelte +35 -0
- package/dist/components/Lottie.svelte.d.ts +24 -0
- package/{components → dist/components}/MultiSelect.svelte +8 -2
- package/{components → dist/components}/MultiSelect.svelte.d.ts +1 -0
- package/package.json +28 -41
- /package/{actions → dist/actions}/buttonify.d.ts +0 -0
- /package/{actions → dist/actions}/buttonify.js +0 -0
- /package/{actions → dist/actions}/elementqueries.d.ts +0 -0
- /package/{actions → dist/actions}/elementqueries.js +0 -0
- /package/{actions → dist/actions}/glue.d.ts +0 -0
- /package/{actions → dist/actions}/glue.js +0 -0
- /package/{actions → dist/actions}/index.d.ts +0 -0
- /package/{actions → dist/actions}/index.js +0 -0
- /package/{actions → dist/actions}/offset.d.ts +0 -0
- /package/{actions → dist/actions}/offset.js +0 -0
- /package/{actions → dist/actions}/passactions.d.ts +0 -0
- /package/{actions → dist/actions}/passactions.js +0 -0
- /package/{actions → dist/actions}/portal.d.ts +0 -0
- /package/{actions → dist/actions}/portal.js +0 -0
- /package/{actions → dist/actions}/resize.d.ts +0 -0
- /package/{actions → dist/actions}/resize.js +0 -0
- /package/{actions → dist/actions}/sticky.d.ts +0 -0
- /package/{actions → dist/actions}/sticky.js +0 -0
- /package/{actions → dist/actions}/stickyfixed.d.ts +0 -0
- /package/{actions → dist/actions}/stickyfixed.js +0 -0
- /package/{components → dist/components}/Card.svelte +0 -0
- /package/{components → dist/components}/Card.svelte.d.ts +0 -0
- /package/{components → dist/components}/CardLayout.svelte +0 -0
- /package/{components → dist/components}/CardLayout.svelte.d.ts +0 -0
- /package/{components → dist/components}/CollapsingTable.svelte +0 -0
- /package/{components → dist/components}/CollapsingTable.svelte.d.ts +0 -0
- /package/{components → dist/components}/ConditionalWrapper.svelte +0 -0
- /package/{components → dist/components}/ConditionalWrapper.svelte.d.ts +0 -0
- /package/{components → dist/components}/FocusLock.svelte +0 -0
- /package/{components → dist/components}/FocusLock.svelte.d.ts +0 -0
- /package/{components → dist/components}/Loading.svelte +0 -0
- /package/{components → dist/components}/Loading.svelte.d.ts +0 -0
- /package/{components → dist/components}/Modal.svelte +0 -0
- /package/{components → dist/components}/Modal.svelte.d.ts +0 -0
- /package/{components → dist/components}/PopupMenu.svelte +0 -0
- /package/{components → dist/components}/PopupMenu.svelte.d.ts +0 -0
- /package/{components → dist/components}/ScreenReaderOnly.svelte +0 -0
- /package/{components → dist/components}/ScreenReaderOnly.svelte.d.ts +0 -0
- /package/{components → dist/components}/index.d.ts +0 -0
- /package/{components → dist/components}/index.js +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{types → dist/types}/CardLayout.d.ts +0 -0
- /package/{types → dist/types}/CardLayout.js +0 -0
- /package/{types → dist/types}/CollapsingTable.d.ts +0 -0
- /package/{types → dist/types}/CollapsingTable.js +0 -0
- /package/{types → dist/types}/PopupMenu.d.ts +0 -0
- /package/{types → dist/types}/PopupMenu.js +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{types → dist/types}/index.js +0 -0
- /package/{util → dist/util}/bodyoffset.d.ts +0 -0
- /package/{util → dist/util}/bodyoffset.js +0 -0
- /package/{util → dist/util}/index.d.ts +0 -0
- /package/{util → dist/util}/index.js +0 -0
- /package/{util → dist/util}/repositioned.d.ts +0 -0
- /package/{util → dist/util}/repositioned.js +0 -0
- /package/{util → dist/util}/util.d.ts +0 -0
- /package/{util → dist/util}/util.js +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script>import { onMount } from 'svelte';
|
|
2
|
+
import { isBlank } from 'txstate-utils';
|
|
3
|
+
import ScreenReaderOnly from './ScreenReaderOnly.svelte';
|
|
4
|
+
export let animationData;
|
|
5
|
+
export let loop = true;
|
|
6
|
+
export let name = undefined;
|
|
7
|
+
export let speed = 1;
|
|
8
|
+
export let direction = 1;
|
|
9
|
+
export let paused = false;
|
|
10
|
+
export let width = undefined;
|
|
11
|
+
export let height = undefined;
|
|
12
|
+
export let alt = '';
|
|
13
|
+
let container;
|
|
14
|
+
let animation;
|
|
15
|
+
$: animation?.setSpeed(speed);
|
|
16
|
+
$: animation?.setDirection(direction);
|
|
17
|
+
$: paused ? animation?.pause() : animation?.play();
|
|
18
|
+
onMount(async () => {
|
|
19
|
+
const lottie = (await import('lottie-web/build/player/lottie_light')).default;
|
|
20
|
+
animation = lottie.loadAnimation({
|
|
21
|
+
container,
|
|
22
|
+
animationData,
|
|
23
|
+
renderer: 'svg',
|
|
24
|
+
loop,
|
|
25
|
+
autoplay: !paused,
|
|
26
|
+
name
|
|
27
|
+
});
|
|
28
|
+
animation.addEventListener('DOMLoaded', () => {
|
|
29
|
+
animation.setSpeed(speed);
|
|
30
|
+
animation.setDirection(direction);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div bind:this={container} style:width style:height aria-hidden={isBlank(alt)}><ScreenReaderOnly>{alt}</ScreenReaderOnly></div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
animationData: any;
|
|
5
|
+
loop?: boolean;
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
speed?: number;
|
|
8
|
+
direction?: 1 | -1;
|
|
9
|
+
paused?: boolean;
|
|
10
|
+
width?: string | undefined;
|
|
11
|
+
height?: string | undefined;
|
|
12
|
+
alt?: string;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type LottieProps = typeof __propDef.props;
|
|
20
|
+
export type LottieEvents = typeof __propDef.events;
|
|
21
|
+
export type LottieSlots = typeof __propDef.slots;
|
|
22
|
+
export default class Lottie extends SvelteComponentTyped<LottieProps, LottieEvents, LottieSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -11,6 +11,7 @@ export let menuContainerClass = undefined;
|
|
|
11
11
|
export let menuClass = undefined;
|
|
12
12
|
export let menuItemClass = undefined;
|
|
13
13
|
export let menuItemHilitedClass = undefined;
|
|
14
|
+
export let maxSelections = 0;
|
|
14
15
|
export let selected = [];
|
|
15
16
|
export let placeholder = '';
|
|
16
17
|
export let emptyText = undefined;
|
|
@@ -29,6 +30,8 @@ const optionsCache = new Cache(async (ipt) => {
|
|
|
29
30
|
return await getOptions(ipt);
|
|
30
31
|
}, { freshseconds: 5 });
|
|
31
32
|
$: selectedSet = new Set(selected.map(s => s.value));
|
|
33
|
+
$: if (maxSelections > 1 && selected.length >= maxSelections && menushown)
|
|
34
|
+
menushown = false;
|
|
32
35
|
let optionsTimer;
|
|
33
36
|
async function reactToInput(..._) {
|
|
34
37
|
loading = true;
|
|
@@ -49,7 +52,7 @@ $: availablemessage = options.filter(o => o.value).length + ' autocomplete choic
|
|
|
49
52
|
function addSelection(e) {
|
|
50
53
|
inputvalue = '';
|
|
51
54
|
const opt = { ...e.detail, label: e.detail.label || e.detail.value };
|
|
52
|
-
selected = [...selected, opt];
|
|
55
|
+
selected = maxSelections === 1 ? [opt] : [...selected, opt];
|
|
53
56
|
popupvalue = undefined;
|
|
54
57
|
dispatch('change', selected);
|
|
55
58
|
}
|
|
@@ -90,6 +93,9 @@ function inputkeydown(e) {
|
|
|
90
93
|
e.preventDefault();
|
|
91
94
|
}
|
|
92
95
|
}
|
|
96
|
+
else if (e.key !== 'Tab' && maxSelections > 1 && selected.length >= maxSelections) {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
async function inputfocus() {
|
|
95
101
|
reactToInput();
|
|
@@ -130,7 +136,7 @@ $: reactToHilite(hilitedpill, id);
|
|
|
130
136
|
</li>
|
|
131
137
|
</ul>
|
|
132
138
|
<ScreenReaderOnly id={descriptionid} arialive="assertive">
|
|
133
|
-
<span>{selected.length ? selected.length + ' selected' : '
|
|
139
|
+
<span>{selected.length ? selected.length + ' selected' : 'none selected'}, select {maxSelections ? 'up to ' + maxSelections : 'multiple'}, up down to choose, left right to hilite existing choices</span>
|
|
134
140
|
{#if menushown}<span>{availablemessage}, touch users explore to find autocomplete menu</span>{/if}
|
|
135
141
|
</ScreenReaderOnly>
|
|
136
142
|
<slot></slot>
|
package/package.json
CHANGED
|
@@ -1,66 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@txstate-mws/svelte-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Svelte components that are generically useful.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepublishOnly": "svelte-package",
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"package": "svelte-package",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
12
|
+
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
13
|
+
"lint": "eslint --ignore-path .gitignore .",
|
|
14
|
+
"test": "playwright test tests"
|
|
15
|
+
},
|
|
5
16
|
"dependencies": {
|
|
6
17
|
"@txstate-mws/svelte-store": "^1.0.3",
|
|
18
|
+
"lottie-web": "^5.10.2",
|
|
7
19
|
"tabbable": "^6.0.0",
|
|
8
20
|
"txstate-utils": "^1.7.12"
|
|
9
21
|
},
|
|
10
22
|
"devDependencies": {
|
|
11
23
|
"@playwright/test": "^1.18.1",
|
|
12
|
-
"@sveltejs/adapter-auto": "^
|
|
24
|
+
"@sveltejs/adapter-auto": "^2.0.0",
|
|
13
25
|
"@sveltejs/kit": "^1.0.1",
|
|
14
|
-
"@sveltejs/package": "^
|
|
26
|
+
"@sveltejs/package": "^2.0.2",
|
|
15
27
|
"@types/tabbable": "^3.1.2",
|
|
16
|
-
"eslint-config-standard-with-typescript": "^
|
|
28
|
+
"eslint-config-standard-with-typescript": "^34.0.0",
|
|
17
29
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
18
|
-
"svelte": "^3.44.0",
|
|
19
30
|
"svelte-check": "^3.0.1",
|
|
20
31
|
"svelte-preprocess": "^5.0.0",
|
|
21
32
|
"svelte2tsx": "^0.6.0",
|
|
22
33
|
"tslib": "^2.3.1",
|
|
23
34
|
"typescript": "^4.4.3"
|
|
24
35
|
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"svelte": "^3.44.0"
|
|
38
|
+
},
|
|
25
39
|
"type": "module",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"svelte": "./dist/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": ["dist"],
|
|
26
47
|
"repository": {
|
|
27
48
|
"type": "git",
|
|
28
49
|
"url": "git@github.com:txstate-etc/svelte-components.git"
|
|
29
50
|
},
|
|
30
51
|
"author": "Nick Wing",
|
|
31
|
-
"license": "MIT"
|
|
32
|
-
|
|
33
|
-
"./package.json": "./package.json",
|
|
34
|
-
"./actions/buttonify": "./actions/buttonify.js",
|
|
35
|
-
"./actions/elementqueries": "./actions/elementqueries.js",
|
|
36
|
-
"./actions/glue": "./actions/glue.js",
|
|
37
|
-
"./actions": "./actions/index.js",
|
|
38
|
-
"./actions/offset": "./actions/offset.js",
|
|
39
|
-
"./actions/passactions": "./actions/passactions.js",
|
|
40
|
-
"./actions/portal": "./actions/portal.js",
|
|
41
|
-
"./actions/resize": "./actions/resize.js",
|
|
42
|
-
"./actions/sticky": "./actions/sticky.js",
|
|
43
|
-
"./actions/stickyfixed": "./actions/stickyfixed.js",
|
|
44
|
-
"./components/Card.svelte": "./components/Card.svelte",
|
|
45
|
-
"./components/CardLayout.svelte": "./components/CardLayout.svelte",
|
|
46
|
-
"./components/CollapsingTable.svelte": "./components/CollapsingTable.svelte",
|
|
47
|
-
"./components/ConditionalWrapper.svelte": "./components/ConditionalWrapper.svelte",
|
|
48
|
-
"./components/FocusLock.svelte": "./components/FocusLock.svelte",
|
|
49
|
-
"./components/Loading.svelte": "./components/Loading.svelte",
|
|
50
|
-
"./components/Modal.svelte": "./components/Modal.svelte",
|
|
51
|
-
"./components/MultiSelect.svelte": "./components/MultiSelect.svelte",
|
|
52
|
-
"./components/PopupMenu.svelte": "./components/PopupMenu.svelte",
|
|
53
|
-
"./components/ScreenReaderOnly.svelte": "./components/ScreenReaderOnly.svelte",
|
|
54
|
-
"./components": "./components/index.js",
|
|
55
|
-
".": "./index.js",
|
|
56
|
-
"./types/CardLayout": "./types/CardLayout.js",
|
|
57
|
-
"./types/CollapsingTable": "./types/CollapsingTable.js",
|
|
58
|
-
"./types/PopupMenu": "./types/PopupMenu.js",
|
|
59
|
-
"./types": "./types/index.js",
|
|
60
|
-
"./util/bodyoffset": "./util/bodyoffset.js",
|
|
61
|
-
"./util": "./util/index.js",
|
|
62
|
-
"./util/repositioned": "./util/repositioned.js",
|
|
63
|
-
"./util/util": "./util/util.js"
|
|
64
|
-
},
|
|
65
|
-
"svelte": "./index.js"
|
|
66
|
-
}
|
|
52
|
+
"license": "MIT"
|
|
53
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|