@cloudparker/moldex.js 0.0.28 → 0.0.30
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/services/dialog/dialog-service.d.ts +16 -0
- package/dist/services/dialog/dialog-service.js +23 -1
- package/dist/services/utils/utils-service.d.ts +3 -0
- package/dist/services/utils/utils-service.js +26 -0
- package/dist/tailwind.css +1 -1
- package/dist/views/core/button/components/button/button.svelte +57 -34
- package/dist/views/core/button/components/button/button.svelte.d.ts +19 -18
- package/dist/views/core/button/components/button-back/button-back.svelte +44 -0
- package/dist/views/core/button/components/button-back/button-back.svelte.d.ts +24 -0
- package/dist/views/core/button/components/button-close/button-close.svelte +7 -0
- package/dist/views/core/button/components/button-close/button-close.svelte.d.ts +19 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +47 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte.d.ts +25 -0
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +94 -42
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte.d.ts +11 -11
- package/dist/views/core/button/components/button-menu/button-menu.svelte +155 -103
- package/dist/views/core/button/components/button-menu/button-menu.svelte.d.ts +7 -7
- package/dist/views/core/button/components/button-ok/button-ok.svelte +7 -0
- package/dist/views/core/button/components/button-ok/button-ok.svelte.d.ts +19 -0
- package/dist/views/core/button/index.d.ts +5 -1
- package/dist/views/core/button/index.js +10 -1
- package/dist/views/core/dialog/components/dialog/dialog.svelte +328 -231
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +6 -10
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +189 -0
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte.d.ts +41 -0
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +22 -13
- package/dist/views/core/dialog/index.d.ts +4 -2
- package/dist/views/core/dialog/index.js +2 -2
- package/dist/views/core/drawer/components/drawer/drawer.svelte +52 -34
- package/dist/views/core/icon/components/icon/icon.svelte +25 -12
- package/dist/views/core/icon/components/icon/icon.svelte.d.ts +1 -0
- package/dist/views/core/icon/services/icon-path-service.d.ts +6 -0
- package/dist/views/core/icon/services/icon-path-service.js +6 -0
- package/dist/views/core/index.d.ts +2 -0
- package/dist/views/core/index.js +2 -0
- package/dist/views/core/input/components/color-field/color-field.svelte +114 -0
- package/dist/views/core/input/components/color-field/color-field.svelte.d.ts +23 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +467 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +63 -0
- package/dist/views/core/input/components/date-field/date-field.svelte +13 -0
- package/dist/views/core/input/components/date-field/date-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +13 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/email-field/email-field.svelte +12 -0
- package/dist/views/core/input/components/email-field/email-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/file-field/file-field.svelte +92 -0
- package/dist/views/core/input/components/file-field/file-field.svelte.d.ts +25 -0
- package/dist/views/core/input/components/input-field/input-field.svelte +382 -0
- package/dist/views/core/{form → input}/components/input-field/input-field.svelte.d.ts +51 -35
- package/dist/views/core/input/components/label/label.svelte +46 -0
- package/dist/views/core/input/components/number-field/number-field.svelte +13 -0
- package/dist/views/core/input/components/number-field/number-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/password-field/password-field.svelte +83 -0
- package/dist/views/core/input/components/password-field/password-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte +90 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/range-field/range-field.svelte +72 -0
- package/dist/views/core/input/components/range-field/range-field.svelte.d.ts +31 -0
- package/dist/views/core/input/components/search-field/search-field.svelte +67 -0
- package/dist/views/core/input/components/search-field/search-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/text-field/text-field.svelte +12 -0
- package/dist/views/core/input/components/text-field/text-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +12 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/time-field/time-field.svelte +12 -0
- package/dist/views/core/input/components/time-field/time-field.svelte.d.ts +21 -0
- package/dist/views/core/input/index.d.ts +19 -0
- package/dist/views/core/input/index.js +19 -0
- package/dist/views/core/navbar/components/navbar/navbar.svelte +71 -39
- package/dist/views/core/navbar/components/navbar/navbar.svelte.d.ts +3 -3
- package/dist/views/core/no-data/components/no-data/no-data.svelte +51 -0
- package/dist/views/core/no-data/components/no-data/no-data.svelte.d.ts +27 -0
- package/dist/views/core/no-data/index.d.ts +2 -0
- package/dist/views/core/no-data/index.js +2 -0
- package/dist/views/core/pagination/components/pagination/pagination.svelte +100 -71
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +37 -23
- package/dist/views/core/referrer/components/referrer.svelte +15 -13
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +6 -2
- package/dist/views/core/screen-detector/components/screen-detector.svelte +13 -9
- package/dist/views/core/spinner/components/spinner/spinner.svelte +7 -2
- package/dist/views/core/text/components/text-await/text-await.svelte +8 -2
- package/dist/views/core/text/components/text-copy/text-copy.svelte +28 -17
- package/dist/views/core/text/components/text-country/text-country.svelte +42 -29
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +38 -30
- package/dist/views/core/text/components/text-currency/text-currency.svelte +21 -10
- package/dist/views/core/text/components/text-date/text-date.svelte +33 -21
- package/dist/views/core/text/components/text-email/text-email.svelte +13 -4
- package/dist/views/core/text/components/text-html/text-html.svelte +3 -2
- package/dist/views/core/text/components/text-phone/text-phone.svelte +13 -4
- package/dist/views/core/toast/components/toast/toast.svelte +44 -21
- package/package.json +2 -2
- package/dist/views/core/form/components/input-field/input-field.svelte +0 -233
- package/dist/views/core/form/components/label/label.svelte +0 -32
- package/dist/views/core/form/index.d.ts +0 -3
- package/dist/views/core/form/index.js +0 -3
- /package/dist/views/core/{form → input}/components/label/label.svelte.d.ts +0 -0
|
@@ -1,31 +1,82 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type ListItemType = {
|
|
3
|
+
id?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
titleClassName?: string;
|
|
7
|
+
subtitleClassName?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
iconPath?: string;
|
|
11
|
+
iconClassName?: string;
|
|
12
|
+
imgSrc?: string;
|
|
13
|
+
imgClassName?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
openInNewWindow?: boolean;
|
|
16
|
+
divider?: boolean;
|
|
17
|
+
hasArrow?: boolean;
|
|
18
|
+
arrowIconPath?: string;
|
|
19
|
+
arrowClassName?: string;
|
|
20
|
+
isChecked?: boolean;
|
|
21
|
+
onclick?: (ev: MouseEvent, item: ListItemType) => void;
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import '../../../../../tailwind.css';
|
|
27
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
28
|
+
|
|
29
|
+
import type { Snippet } from 'svelte';
|
|
30
|
+
import {
|
|
31
|
+
Icon,
|
|
32
|
+
mdiCheckCircle,
|
|
33
|
+
mdiCheckCircleOutline,
|
|
34
|
+
mdiChevronRight
|
|
35
|
+
} from '../../../icon';
|
|
2
36
|
|
|
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
|
-
|
|
37
|
+
type PropsType = {
|
|
38
|
+
item: ListItemType;
|
|
39
|
+
index: number;
|
|
40
|
+
id?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
hasCheckbox?: boolean;
|
|
43
|
+
checkIconPath?: string;
|
|
44
|
+
uncheckIconPath?: string;
|
|
45
|
+
checkIconClassName?: string;
|
|
46
|
+
uncheckIconClassName?: string;
|
|
47
|
+
checkClassName?: string;
|
|
48
|
+
iconClassName?: string;
|
|
49
|
+
imgClassName?: string;
|
|
50
|
+
titleClassName?: string;
|
|
51
|
+
subtitleClassName?: string;
|
|
52
|
+
hasArrow?: boolean;
|
|
53
|
+
arrowIconPath?: string;
|
|
54
|
+
arrowClassName?: string;
|
|
55
|
+
onClick?: (ev: MouseEvent, item: ListItemType, index: number) => void;
|
|
56
|
+
children?: Snippet<[ListItemType, number]>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let {
|
|
60
|
+
item,
|
|
61
|
+
index,
|
|
62
|
+
id = '',
|
|
63
|
+
className = '',
|
|
64
|
+
hasCheckbox = false,
|
|
65
|
+
uncheckIconPath = mdiCheckCircleOutline,
|
|
66
|
+
checkIconPath = mdiCheckCircle,
|
|
67
|
+
checkIconClassName = '',
|
|
68
|
+
uncheckIconClassName = '',
|
|
69
|
+
iconClassName = '',
|
|
70
|
+
imgClassName = '',
|
|
71
|
+
titleClassName = '',
|
|
72
|
+
subtitleClassName = '',
|
|
73
|
+
checkClassName = '',
|
|
74
|
+
hasArrow = false,
|
|
75
|
+
arrowIconPath = mdiChevronRight,
|
|
76
|
+
arrowClassName = '',
|
|
77
|
+
onClick,
|
|
78
|
+
children
|
|
79
|
+
}: PropsType = $props();
|
|
29
80
|
</script>
|
|
30
81
|
|
|
31
82
|
{#snippet itemInternal()}
|
|
@@ -44,26 +95,27 @@ let {
|
|
|
44
95
|
/>
|
|
45
96
|
</div>
|
|
46
97
|
{/if}
|
|
98
|
+
|
|
47
99
|
<div class="flex-grow">
|
|
48
|
-
{#if item?.
|
|
49
|
-
<div class="text-ellipsis overflow-hidden {
|
|
50
|
-
{item?.
|
|
100
|
+
{#if item?.title}
|
|
101
|
+
<div class="text-ellipsis overflow-hidden {titleClassName} {item?.titleClassName || ''}">
|
|
102
|
+
{item?.title || ''}
|
|
51
103
|
</div>
|
|
52
104
|
{/if}
|
|
53
|
-
{#if item?.
|
|
105
|
+
{#if item?.subtitle}
|
|
54
106
|
<div
|
|
55
|
-
class="text-ellipsis overflow-hidden text-gray-400 text-sm font-light {
|
|
107
|
+
class="text-ellipsis overflow-hidden text-gray-400 text-sm font-light {subtitleClassName} {item?.subtitleClassName ||
|
|
56
108
|
''}"
|
|
57
109
|
>
|
|
58
|
-
{item?.
|
|
110
|
+
{item?.subtitle || ''}
|
|
59
111
|
</div>
|
|
60
112
|
{/if}
|
|
61
113
|
</div>
|
|
62
|
-
{#if
|
|
114
|
+
{#if hasCheckbox}
|
|
63
115
|
<div>
|
|
64
116
|
<Icon
|
|
65
|
-
path={
|
|
66
|
-
className="w-5 h-5 {checkClassName} {
|
|
117
|
+
path={item?.isChecked ? checkIconPath : uncheckIconPath}
|
|
118
|
+
className="w-5 h-5 {checkClassName} {item?.isChecked
|
|
67
119
|
? `text-primary ${checkIconClassName}`
|
|
68
120
|
: `text-gray-400 ${uncheckIconClassName}`}"
|
|
69
121
|
/>
|
|
@@ -80,11 +132,11 @@ let {
|
|
|
80
132
|
|
|
81
133
|
{#snippet buttonSnippet()}
|
|
82
134
|
<button
|
|
83
|
-
id="{
|
|
135
|
+
id="{id}-item-item-{index}"
|
|
84
136
|
type="button"
|
|
85
|
-
class="w-full select-none block px-3 py-2 text-start leading-
|
|
137
|
+
class="w-full select-none block px-3 py-2 text-start leading-normal text-gray-900 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none {className} {item.className}"
|
|
86
138
|
role="menuitem"
|
|
87
|
-
onclick={(ev) =>
|
|
139
|
+
onclick={(ev) => onClick && onClick(ev, item, index)}
|
|
88
140
|
disabled={item?.disabled}
|
|
89
141
|
use:ripple
|
|
90
142
|
>
|
|
@@ -94,12 +146,12 @@ let {
|
|
|
94
146
|
|
|
95
147
|
{#snippet linkSnippet()}
|
|
96
148
|
<a
|
|
97
|
-
id="{
|
|
149
|
+
id="{id}-item-item-{index}"
|
|
98
150
|
href={item?.url}
|
|
99
|
-
class="block select-none px-3 py-1 w-full text-start leading-
|
|
151
|
+
class="block select-none px-3 py-1 w-full text-start leading-normal text-gray-900 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none {className} {item.className}"
|
|
100
152
|
role="menuitem"
|
|
101
153
|
target={item?.openInNewWindow ? '_blank' : ''}
|
|
102
|
-
onclick={(ev) =>
|
|
154
|
+
onclick={(ev) => onClick && onClick(ev, item, index)}
|
|
103
155
|
use:ripple
|
|
104
156
|
>
|
|
105
157
|
{@render itemInternal()}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export type ListItemType = {
|
|
2
2
|
id?: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
title?: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
titleClassName?: string;
|
|
6
|
+
subtitleClassName?: string;
|
|
7
7
|
url?: string;
|
|
8
|
-
onclick?: (ev: MouseEvent, item: ListItemType) => void;
|
|
9
8
|
disabled?: boolean;
|
|
10
9
|
iconPath?: string;
|
|
11
10
|
iconClassName?: string;
|
|
@@ -17,6 +16,8 @@ export type ListItemType = {
|
|
|
17
16
|
hasArrow?: boolean;
|
|
18
17
|
arrowIconPath?: string;
|
|
19
18
|
arrowClassName?: string;
|
|
19
|
+
isChecked?: boolean;
|
|
20
|
+
onclick?: (ev: MouseEvent, item: ListItemType) => void;
|
|
20
21
|
};
|
|
21
22
|
import '../../../../../tailwind.css';
|
|
22
23
|
import type { Snippet } from 'svelte';
|
|
@@ -36,9 +37,9 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
36
37
|
declare const ButtonListItem: $$__sveltets_2_IsomorphicComponent<{
|
|
37
38
|
item: ListItemType;
|
|
38
39
|
index: number;
|
|
39
|
-
|
|
40
|
+
id?: string;
|
|
40
41
|
className?: string;
|
|
41
|
-
|
|
42
|
+
hasCheckbox?: boolean;
|
|
42
43
|
checkIconPath?: string;
|
|
43
44
|
uncheckIconPath?: string;
|
|
44
45
|
checkIconClassName?: string;
|
|
@@ -46,13 +47,12 @@ declare const ButtonListItem: $$__sveltets_2_IsomorphicComponent<{
|
|
|
46
47
|
checkClassName?: string;
|
|
47
48
|
iconClassName?: string;
|
|
48
49
|
imgClassName?: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
checked?: boolean;
|
|
50
|
+
titleClassName?: string;
|
|
51
|
+
subtitleClassName?: string;
|
|
52
52
|
hasArrow?: boolean;
|
|
53
53
|
arrowIconPath?: string;
|
|
54
54
|
arrowClassName?: string;
|
|
55
|
-
|
|
55
|
+
onClick?: (ev: MouseEvent, item: ListItemType, index: number) => void;
|
|
56
56
|
children?: Snippet<[ListItemType, number]>;
|
|
57
57
|
}, {
|
|
58
58
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,93 +1,146 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '../../../../../tailwind.css';
|
|
3
|
+
|
|
4
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
5
|
+
|
|
6
|
+
import { Icon, mdiCheckCircle, mdiCheckCircleOutline, mdiChevronDown } from '../../../icon';
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { ListItemType } from '../button-list-item/button-list-item.svelte';
|
|
9
|
+
import ButtonListItem from '../button-list-item/button-list-item.svelte';
|
|
10
|
+
|
|
11
|
+
enum MenuStateEnum {
|
|
12
|
+
OPENED,
|
|
13
|
+
CLOSED
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type PropsType = {
|
|
17
|
+
id?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
screenOnlyDesc?: string;
|
|
20
|
+
style?: string;
|
|
21
|
+
disabled?: boolean | undefined | null;
|
|
22
|
+
imgSrc?:string;
|
|
23
|
+
imgClassName?: string;
|
|
24
|
+
imgAlt?: string;
|
|
25
|
+
leftIconPath?: string;
|
|
26
|
+
leftIconClassName?: string;
|
|
27
|
+
rightIconPath?: string;
|
|
28
|
+
rightIconClassName?: string;
|
|
29
|
+
title?: string | any;
|
|
30
|
+
titleClassName?: string;
|
|
31
|
+
dropdownClassName?: string;
|
|
32
|
+
dropdownStyle?: string;
|
|
33
|
+
hasCheck?: boolean;
|
|
34
|
+
checkIconPath?: string;
|
|
35
|
+
checkIconClassName?: string;
|
|
36
|
+
menus?: string[] | ListItemType[];
|
|
37
|
+
containerClassName?: string;
|
|
38
|
+
backgropClassName?: string;
|
|
39
|
+
menuItemClassName?: string;
|
|
40
|
+
uncheckIconPath?: string;
|
|
41
|
+
uncheckIconClassName?: string;
|
|
42
|
+
dropdownOpenClassName?: string;
|
|
43
|
+
dropdownCloseClassName?: string;
|
|
44
|
+
checkClassName?: string;
|
|
45
|
+
listIconClassName?: string;
|
|
46
|
+
listImgClassName?: string;
|
|
47
|
+
listTitleClassName?: string;
|
|
48
|
+
listSubtitleClassName?: string;
|
|
49
|
+
dividerClassName?: string;
|
|
50
|
+
dropIconPath?: string;
|
|
51
|
+
dropIconClassName?: string;
|
|
52
|
+
onmenuclick?: (ev: MouseEvent, item: string | ListItemType, index: number) => void;
|
|
53
|
+
children?: Snippet;
|
|
54
|
+
buttonSnippet?: Snippet;
|
|
55
|
+
menuItemSnippet?: Snippet<[ListItemType, number]>;
|
|
56
|
+
menuItemInnerSnippet?: Snippet<[ListItemType, number]>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let {
|
|
60
|
+
id = 'menu',
|
|
61
|
+
className = '',
|
|
62
|
+
screenOnlyDesc = 'Menu',
|
|
63
|
+
style = '',
|
|
64
|
+
imgSrc = '',
|
|
65
|
+
imgClassName = '',
|
|
66
|
+
imgAlt = 'Menu',
|
|
67
|
+
leftIconPath = '',
|
|
68
|
+
leftIconClassName = '',
|
|
69
|
+
rightIconPath = '',
|
|
70
|
+
rightIconClassName = '',
|
|
71
|
+
dropIconPath = mdiChevronDown,
|
|
72
|
+
dropIconClassName = '',
|
|
73
|
+
titleClassName = '',
|
|
74
|
+
title = 'Button',
|
|
75
|
+
dropdownStyle = '',
|
|
76
|
+
dropdownClassName = '',
|
|
77
|
+
hasCheck = false,
|
|
78
|
+
uncheckIconPath = mdiCheckCircleOutline,
|
|
79
|
+
checkIconPath = mdiCheckCircle,
|
|
80
|
+
checkIconClassName = '',
|
|
81
|
+
containerClassName = '',
|
|
82
|
+
backgropClassName = '',
|
|
83
|
+
menus = [],
|
|
84
|
+
menuItemClassName = '',
|
|
85
|
+
uncheckIconClassName = '',
|
|
86
|
+
dropdownOpenClassName = '',
|
|
87
|
+
dropdownCloseClassName = '',
|
|
88
|
+
checkClassName = '',
|
|
89
|
+
listIconClassName = '',
|
|
90
|
+
listImgClassName = '',
|
|
91
|
+
listTitleClassName = '',
|
|
92
|
+
listSubtitleClassName = '',
|
|
93
|
+
dividerClassName = '',
|
|
94
|
+
onmenuclick = (ev: MouseEvent, item: string | ListItemType, index: number) => {},
|
|
95
|
+
children,
|
|
96
|
+
buttonSnippet,
|
|
97
|
+
menuItemSnippet,
|
|
98
|
+
menuItemInnerSnippet
|
|
99
|
+
}: PropsType = $props();
|
|
100
|
+
|
|
101
|
+
let expanded = $state(false);
|
|
102
|
+
let dropdownState: MenuStateEnum = $state(MenuStateEnum.CLOSED);
|
|
103
|
+
let options: ListItemType[] = $state([]);
|
|
104
|
+
let selectedMenu: ListItemType | null | undefined = $state(null);
|
|
105
|
+
|
|
106
|
+
function hendleToggleDropdown(ev: MouseEvent) {
|
|
107
|
+
ev && ev.stopPropagation();
|
|
108
|
+
if (dropdownState == MenuStateEnum.CLOSED) {
|
|
109
|
+
dropdownState = MenuStateEnum.OPENED;
|
|
110
|
+
} else {
|
|
111
|
+
dropdownState = MenuStateEnum.CLOSED;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function handlemenuItemClick(ev: MouseEvent, menu: ListItemType, index: number) {
|
|
116
|
+
hendleToggleDropdown(ev);
|
|
117
|
+
if (onmenuclick) {
|
|
118
|
+
let item = menus[index];
|
|
119
|
+
|
|
120
|
+
if (item) {
|
|
121
|
+
onmenuclick(ev, item, index);
|
|
122
|
+
}
|
|
123
|
+
selectedMenu = menu;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
$effect(() => {
|
|
128
|
+
if (menus?.length) {
|
|
129
|
+
let item = menus[0];
|
|
130
|
+
if (typeof item == 'string') {
|
|
131
|
+
options = menus.map((str) => {
|
|
132
|
+
if (str == '-' || str == '') {
|
|
133
|
+
return { divider: true } as ListItemType;
|
|
134
|
+
} else {
|
|
135
|
+
return { label: str } as ListItemType;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
options = [];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
91
144
|
</script>
|
|
92
145
|
|
|
93
146
|
<div class="relative min-h-max {containerClassName}">
|
|
@@ -103,8 +156,8 @@ $effect(() => {
|
|
|
103
156
|
>
|
|
104
157
|
<span class="sr-only">{screenOnlyDesc}</span>
|
|
105
158
|
<div class="flex items-center flex-nowrap gap-2">
|
|
106
|
-
{#if
|
|
107
|
-
{@render
|
|
159
|
+
{#if buttonSnippet}
|
|
160
|
+
{@render buttonSnippet()}
|
|
108
161
|
{:else}
|
|
109
162
|
{#if imgSrc}
|
|
110
163
|
<img class="h-8 w-8 rounded-full bg-gray-50 {imgClassName}" src={imgSrc} alt={imgAlt} />
|
|
@@ -112,9 +165,9 @@ $effect(() => {
|
|
|
112
165
|
{#if leftIconPath}
|
|
113
166
|
<Icon path={leftIconPath} className={leftIconClassName} />
|
|
114
167
|
{/if}
|
|
115
|
-
{#if
|
|
116
|
-
<span class="text-nowrap {
|
|
117
|
-
{@html
|
|
168
|
+
{#if title}
|
|
169
|
+
<span class="text-nowrap {titleClassName}">
|
|
170
|
+
{@html title}
|
|
118
171
|
</span>
|
|
119
172
|
{/if}
|
|
120
173
|
{#if rightIconPath}
|
|
@@ -152,15 +205,14 @@ $effect(() => {
|
|
|
152
205
|
{#each options as menu, index (menu.id || index)}
|
|
153
206
|
{#if menu?.divider}
|
|
154
207
|
<div class="border-t border-gray-200 {dividerClassName}"></div>
|
|
155
|
-
{:else if
|
|
156
|
-
{@render
|
|
208
|
+
{:else if menuItemSnippet}
|
|
209
|
+
{@render menuItemSnippet(menu, index)}
|
|
157
210
|
{:else}
|
|
158
211
|
<ButtonListItem
|
|
159
212
|
item={menu}
|
|
160
213
|
{index}
|
|
161
|
-
checked={selectedMenu == menu}
|
|
162
214
|
{hasCheck}
|
|
163
|
-
|
|
215
|
+
id={id}
|
|
164
216
|
className={menuItemClassName}
|
|
165
217
|
{uncheckIconPath}
|
|
166
218
|
{checkIconPath}
|
|
@@ -169,10 +221,10 @@ $effect(() => {
|
|
|
169
221
|
{checkClassName}
|
|
170
222
|
iconClassName={listIconClassName}
|
|
171
223
|
imgClassName={listImgClassName}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
children={
|
|
175
|
-
|
|
224
|
+
titleClassName={listTitleClassName}
|
|
225
|
+
subtitleClassName={listSubtitleClassName}
|
|
226
|
+
children={menuItemInnerSnippet}
|
|
227
|
+
onClick={handlemenuItemClick}
|
|
176
228
|
/>
|
|
177
229
|
{/if}
|
|
178
230
|
{/each}
|
|
@@ -27,8 +27,8 @@ declare const ButtonMenu: $$__sveltets_2_IsomorphicComponent<{
|
|
|
27
27
|
leftIconClassName?: string;
|
|
28
28
|
rightIconPath?: string;
|
|
29
29
|
rightIconClassName?: string;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
title?: string | any;
|
|
31
|
+
titleClassName?: string;
|
|
32
32
|
dropdownClassName?: string;
|
|
33
33
|
dropdownStyle?: string;
|
|
34
34
|
hasCheck?: boolean;
|
|
@@ -45,16 +45,16 @@ declare const ButtonMenu: $$__sveltets_2_IsomorphicComponent<{
|
|
|
45
45
|
checkClassName?: string;
|
|
46
46
|
listIconClassName?: string;
|
|
47
47
|
listImgClassName?: string;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
listTitleClassName?: string;
|
|
49
|
+
listSubtitleClassName?: string;
|
|
50
50
|
dividerClassName?: string;
|
|
51
51
|
dropIconPath?: string;
|
|
52
52
|
dropIconClassName?: string;
|
|
53
53
|
onmenuclick?: (ev: MouseEvent, item: string | ListItemType, index: number) => void;
|
|
54
54
|
children?: Snippet;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
buttonSnippet?: Snippet;
|
|
56
|
+
menuItemSnippet?: Snippet<[ListItemType, number]>;
|
|
57
|
+
menuItemInnerSnippet?: Snippet<[ListItemType, number]>;
|
|
58
58
|
}, {
|
|
59
59
|
[evt: string]: CustomEvent<any>;
|
|
60
60
|
}, {}, {}, "">;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button, { type ButtonPropsType } from '../button/button.svelte';
|
|
3
|
+
|
|
4
|
+
let { className, ...props }: ButtonPropsType = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<Button {...props} className="bg-indigo-600 focus:bg-indigo-700 text-white p-2 px-4 {className}" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ButtonPropsType } from '../button/button.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const ButtonOk: $$__sveltets_2_IsomorphicComponent<ButtonPropsType, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, "">;
|
|
18
|
+
type ButtonOk = InstanceType<typeof ButtonOk>;
|
|
19
|
+
export default ButtonOk;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import Button from './components/button/button.svelte';
|
|
2
|
+
import ButtonBack from './components/button-back/button-back.svelte';
|
|
3
|
+
import ButtonClose from './components/button-close/button-close.svelte';
|
|
4
|
+
import ButtonCloseIcon from './components/button-close-icon/button-close-icon.svelte';
|
|
2
5
|
import ButtonListItem from './components/button-list-item/button-list-item.svelte';
|
|
3
6
|
import ButtonMenu from './components/button-menu/button-menu.svelte';
|
|
4
|
-
|
|
7
|
+
import ButtonOk from './components/button-ok/button-ok.svelte';
|
|
8
|
+
export { Button, ButtonBack, ButtonClose, ButtonCloseIcon, ButtonListItem, ButtonMenu, ButtonOk };
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import ButtonBack from './components/button-back/button-back.svelte';
|
|
2
|
+
import ButtonCloseIcon from './components/button-close-icon/button-close-icon.svelte';
|
|
3
|
+
import ButtonClose from './components/button-close/button-close.svelte';
|
|
1
4
|
import ButtonListItem from './components/button-list-item/button-list-item.svelte';
|
|
2
5
|
import ButtonMenu from './components/button-menu/button-menu.svelte';
|
|
6
|
+
import ButtonOk from './components/button-ok/button-ok.svelte';
|
|
3
7
|
import Button from './components/button/button.svelte';
|
|
4
8
|
|
|
5
9
|
export {
|
|
6
10
|
Button,
|
|
11
|
+
ButtonBack,
|
|
12
|
+
ButtonClose,
|
|
13
|
+
ButtonCloseIcon,
|
|
7
14
|
ButtonListItem,
|
|
8
|
-
ButtonMenu
|
|
15
|
+
ButtonMenu,
|
|
16
|
+
ButtonOk
|
|
9
17
|
};
|
|
18
|
+
|