@hyvor/design 0.0.61 → 0.0.63
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/ActionList/ActionList.svelte +3 -0
- package/dist/components/ActionList/ActionList.svelte.d.ts +1 -0
- package/dist/components/ActionList/ActionListItem.svelte +8 -21
- package/dist/components/ActionList/Selected.svelte +30 -0
- package/dist/components/ActionList/Selected.svelte.d.ts +17 -0
- package/dist/components/Button/Button.svelte +7 -0
- package/dist/components/Modal/ConfirmModalProvider.svelte +1 -0
- package/dist/components/Modal/confirm.d.ts +6 -1
- package/dist/components/Modal/confirm.js +18 -3
- package/package.json +58 -58
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script>import { getContext, createEventDispatcher } from "svelte";
|
|
2
2
|
import Checkbox from "../Checkbox/Checkbox.svelte";
|
|
3
3
|
import { IconCheck } from "@hyvor/icons";
|
|
4
|
+
import Selected from "./Selected.svelte";
|
|
4
5
|
const selection = getContext("action-list-selection");
|
|
6
|
+
const selectionAlign = getContext("action-list-selection-align");
|
|
5
7
|
export let selected = false;
|
|
6
8
|
selected = selection !== "none" && selected;
|
|
7
9
|
export let disabled = false;
|
|
@@ -29,19 +31,8 @@ function handleClick() {
|
|
|
29
31
|
on:click
|
|
30
32
|
>
|
|
31
33
|
|
|
32
|
-
{#if
|
|
33
|
-
<
|
|
34
|
-
{#if selection === 'multi'}
|
|
35
|
-
<span style="transform:scale(0.9);transform-origin:top">
|
|
36
|
-
<Checkbox checked={selected}
|
|
37
|
-
tabindex="-1" />
|
|
38
|
-
</span>
|
|
39
|
-
{:else}
|
|
40
|
-
{#if selected}
|
|
41
|
-
<IconCheck />
|
|
42
|
-
{/if}
|
|
43
|
-
{/if}
|
|
44
|
-
</span>
|
|
34
|
+
{#if selectionAlign === 'start'}
|
|
35
|
+
<Selected {selection} bind:selected />
|
|
45
36
|
{/if}
|
|
46
37
|
|
|
47
38
|
{#if $$slots.start}
|
|
@@ -66,6 +57,10 @@ function handleClick() {
|
|
|
66
57
|
</span>
|
|
67
58
|
{/if}
|
|
68
59
|
|
|
60
|
+
{#if selectionAlign === 'end'}
|
|
61
|
+
<Selected {selection} bind:selected />
|
|
62
|
+
{/if}
|
|
63
|
+
|
|
69
64
|
</div>
|
|
70
65
|
|
|
71
66
|
<style>
|
|
@@ -88,14 +83,6 @@ function handleClick() {
|
|
|
88
83
|
background-color: #fffafa;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
.selected {
|
|
92
|
-
width: 30px;
|
|
93
|
-
display: inline-flex;
|
|
94
|
-
align-items: center;
|
|
95
|
-
justify-content: center;
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
86
|
.start, .middle, .end {
|
|
100
87
|
display: inline-flex;
|
|
101
88
|
align-items: center;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script>import Checkbox from "../Checkbox/Checkbox.svelte";
|
|
2
|
+
import { IconCheck } from "@hyvor/icons";
|
|
3
|
+
export let selection;
|
|
4
|
+
export let selected;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#if selection !== 'none'}
|
|
8
|
+
<span class="selected">
|
|
9
|
+
{#if selection === 'multi'}
|
|
10
|
+
<span style="transform:scale(0.9);transform-origin:top">
|
|
11
|
+
<Checkbox checked={selected}
|
|
12
|
+
tabindex="-1" />
|
|
13
|
+
</span>
|
|
14
|
+
{:else}
|
|
15
|
+
{#if selected}
|
|
16
|
+
<IconCheck />
|
|
17
|
+
{/if}
|
|
18
|
+
{/if}
|
|
19
|
+
</span>
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.selected {
|
|
24
|
+
width: 30px;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
selection: 'none' | 'single' | 'multi';
|
|
5
|
+
selected: boolean;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type SelectedProps = typeof __propDef.props;
|
|
13
|
+
export type SelectedEvents = typeof __propDef.events;
|
|
14
|
+
export type SelectedSlots = typeof __propDef.slots;
|
|
15
|
+
export default class Selected extends SvelteComponent<SelectedProps, SelectedEvents, SelectedSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -53,17 +53,24 @@ export let button = {};
|
|
|
53
53
|
|
|
54
54
|
</svelte:element>
|
|
55
55
|
|
|
56
|
+
|
|
56
57
|
<style>.slot.start {
|
|
57
58
|
margin-right: 6px;
|
|
58
59
|
display: inline-flex;
|
|
59
60
|
align-items: center;
|
|
60
61
|
}
|
|
62
|
+
.slot.start:empty {
|
|
63
|
+
margin-right: 0;
|
|
64
|
+
}
|
|
61
65
|
|
|
62
66
|
.slot.end {
|
|
63
67
|
margin-left: 6px;
|
|
64
68
|
display: inline-flex;
|
|
65
69
|
align-items: center;
|
|
66
70
|
}
|
|
71
|
+
.slot.end:empty {
|
|
72
|
+
margin-left: 0;
|
|
73
|
+
}
|
|
67
74
|
|
|
68
75
|
.button {
|
|
69
76
|
position: relative;
|
|
@@ -6,11 +6,16 @@ interface ConfirmConfig {
|
|
|
6
6
|
confirmText?: string;
|
|
7
7
|
cancelText?: string;
|
|
8
8
|
danger?: boolean;
|
|
9
|
+
loading?: boolean | string;
|
|
10
|
+
autoClose?: boolean;
|
|
9
11
|
}
|
|
10
12
|
interface ConfirmStore extends ConfirmConfig {
|
|
11
13
|
onConfirm: () => void;
|
|
12
14
|
onCancel: () => void;
|
|
13
15
|
}
|
|
14
16
|
export declare const confirmStore: import("svelte/store").Writable<ConfirmStore | null>;
|
|
15
|
-
export declare function confirm(config: ConfirmConfig): Promise<
|
|
17
|
+
export declare function confirm(config: ConfirmConfig): Promise<false | {
|
|
18
|
+
loading: (status?: string | boolean) => void;
|
|
19
|
+
close: () => void;
|
|
20
|
+
}>;
|
|
16
21
|
export {};
|
|
@@ -2,17 +2,32 @@ import {} from "svelte";
|
|
|
2
2
|
import { writable } from "svelte/store";
|
|
3
3
|
export const confirmStore = writable(null);
|
|
4
4
|
export function confirm(config) {
|
|
5
|
+
function getOptions() {
|
|
6
|
+
return {
|
|
7
|
+
loading: (status = true) => {
|
|
8
|
+
confirmStore.update((store) => {
|
|
9
|
+
if (store) {
|
|
10
|
+
store.loading = status;
|
|
11
|
+
}
|
|
12
|
+
return store;
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
close: () => confirmStore.set(null),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
5
18
|
return new Promise((resolve, reject) => {
|
|
6
19
|
confirmStore.set({
|
|
7
20
|
...config,
|
|
8
21
|
onConfirm: () => {
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
if (config.autoClose !== false) {
|
|
23
|
+
confirmStore.set(null);
|
|
24
|
+
}
|
|
25
|
+
resolve(getOptions());
|
|
11
26
|
},
|
|
12
27
|
onCancel: () => {
|
|
13
28
|
resolve(false);
|
|
14
29
|
confirmStore.set(null);
|
|
15
|
-
}
|
|
30
|
+
},
|
|
16
31
|
});
|
|
17
32
|
});
|
|
18
33
|
}
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
2
|
+
"name": "@hyvor/design",
|
|
3
|
+
"version": "0.0.63",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"private": false,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build && npm run package",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
11
|
+
"prepublishOnly": "npm run package",
|
|
12
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
13
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
"./components": {
|
|
17
|
+
"types": "./dist/components/index.d.ts",
|
|
18
|
+
"svelte": "./dist/components/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./marketing": {
|
|
21
|
+
"types": "./dist/marketing/index.d.ts",
|
|
22
|
+
"svelte": "./dist/marketing/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/**/*.test.*",
|
|
28
|
+
"!dist/**/*.spec.*"
|
|
29
|
+
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@sveltejs/kit": "^2.0.0",
|
|
32
|
+
"sass": "^1.68.0",
|
|
33
|
+
"svelte": "^4.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@sveltejs/adapter-static": "^3.0.0",
|
|
37
|
+
"@sveltejs/package": "^2.0.0",
|
|
38
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
|
39
|
+
"publint": "^0.1.9",
|
|
40
|
+
"svelte": "^4.0.5",
|
|
41
|
+
"svelte-check": "^3.4.3",
|
|
42
|
+
"tslib": "^2.4.1",
|
|
43
|
+
"typescript": "^5.0.0",
|
|
44
|
+
"vite": "^5.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@fontsource/readex-pro": "^5.0.8",
|
|
48
|
+
"@hyvor/icons": "^0.0.3",
|
|
49
|
+
"deepmerge-ts": "^5.1.0",
|
|
50
|
+
"highlight.js": "^11.9.0",
|
|
51
|
+
"intl-messageformat": "^10.5.11",
|
|
52
|
+
"npm": "^10.4.0",
|
|
53
|
+
"svelte-awesome-color-picker": "^3.0.4",
|
|
54
|
+
"tocbot": "^4.25.0"
|
|
55
|
+
},
|
|
56
|
+
"type": "module",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
}
|
|
60
60
|
}
|