@hyvor/design 0.0.62 → 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/package.json +1 -1
|
@@ -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;
|