@cloudparker/moldex.js 0.0.124 → 4.1.1
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/types.d.ts +6 -0
- package/dist/types.js +7 -0
- package/dist/views/core/button/components/button/button.svelte +135 -83
- package/dist/views/core/button/components/button-back/button-back.svelte +28 -15
- package/dist/views/core/button/components/button-close/button-close.svelte +4 -2
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +29 -15
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte +96 -72
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte.d.ts +1 -1
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +98 -52
- package/dist/views/core/button/components/button-menu/button-menu.svelte +79 -43
- package/dist/views/core/button/components/button-ok/button-ok.svelte +4 -2
- package/dist/views/core/button/components/button-search/button-search.svelte +45 -21
- package/dist/views/core/button/components/switch/switch.svelte +50 -37
- package/dist/views/core/common/components/content-area/content-area.svelte +40 -27
- package/dist/views/core/common/components/loading/loading.svelte +9 -2
- package/dist/views/core/common/components/virtual-scrolling/virtual-scrolling-list.svelte +37 -20
- package/dist/views/core/dialog/components/cropper-dialog/cropper-dialog.svelte +52 -36
- package/dist/views/core/dialog/components/dialog/dialog.svelte +298 -177
- package/dist/views/core/dialog/components/loading-dialog/loading-dialog.svelte +30 -18
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +17 -7
- package/dist/views/core/dialog/components/number-field-dialog/number-field-dialog.svelte +41 -26
- package/dist/views/core/dialog/components/picker-dialog/picker-dialog.svelte +150 -105
- package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte +40 -25
- package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte +40 -25
- package/dist/views/core/drawer/components/drawer/drawer.svelte +58 -36
- package/dist/views/core/icon/components/icon/icon.svelte +24 -12
- package/dist/views/core/icon/components/icon-circle/icon-circle.svelte +10 -2
- package/dist/views/core/input/components/checkbox-field/checkbox-field.svelte +44 -25
- package/dist/views/core/input/components/color-field/color-field.svelte +81 -69
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +359 -269
- package/dist/views/core/input/components/date-field/date-field.svelte +39 -30
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +18 -12
- package/dist/views/core/input/components/email-field/email-field.svelte +17 -12
- package/dist/views/core/input/components/file-field/file-field.svelte +78 -64
- package/dist/views/core/input/components/input-field/input-field.svelte +267 -164
- package/dist/views/core/input/components/label/label.svelte +24 -10
- package/dist/views/core/input/components/number-field/number-field.svelte +18 -12
- package/dist/views/core/input/components/password-field/password-field.svelte +70 -57
- package/dist/views/core/input/components/phone-field/phone-field.svelte +155 -104
- package/dist/views/core/input/components/radio-field/radio-field.svelte +83 -52
- package/dist/views/core/input/components/range-field/range-field.svelte +67 -44
- package/dist/views/core/input/components/search-field/search-field.svelte +62 -45
- package/dist/views/core/input/components/text-field/text-field.svelte +21 -16
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +17 -12
- package/dist/views/core/input/components/time-field/time-field.svelte +17 -12
- package/dist/views/core/navbar/components/navbar/navbar.svelte +76 -38
- package/dist/views/core/no-data/components/no-data/no-data.svelte +36 -19
- package/dist/views/core/pagination/components/pagination/pagination.svelte +90 -66
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +36 -22
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +5 -1
- package/dist/views/core/screen-detector/components/screen-detector.svelte +13 -9
- package/dist/views/core/sidebar/components/sidebar.svelte +36 -23
- package/dist/views/core/spinner/components/spinner/spinner.svelte +6 -1
- package/dist/views/core/text/components/text-await/text-await.svelte +9 -1
- package/dist/views/core/text/components/text-copy/text-copy.svelte +27 -16
- package/dist/views/core/text/components/text-currency/text-currency.svelte +13 -2
- package/dist/views/core/text/components/text-date/text-date.svelte +32 -20
- package/dist/views/core/text/components/text-email/text-email.svelte +12 -3
- package/dist/views/core/text/components/text-html/text-html.svelte +2 -1
- package/dist/views/core/text/components/text-phone/text-phone.svelte +12 -3
- package/dist/views/core/toast/components/toast/toast.svelte +43 -20
- package/dist/views/extra/fields/country-combobox-field.svelte +23 -15
- package/dist/views/extra/loaders/country-loader.svelte +33 -15
- package/dist/views/extra/texts/text-country-state.svelte +36 -28
- package/dist/views/extra/texts/text-country.svelte +16 -8
- package/package.json +3 -12
- package/readme.md +57 -2
- package/dist/tailwind.css +0 -1
- package/dist/theme.css +0 -27
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { showToast } from '../../../../../services';
|
|
3
|
+
import NumberField from '../../../input/components/number-field/number-field.svelte';
|
|
4
|
+
import type { DialogExports } from '../dialog/dialog.svelte';
|
|
5
|
+
|
|
6
|
+
type PropsType = {
|
|
7
|
+
value?: number;
|
|
8
|
+
label?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
maxlength?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
autofocus?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
value = $bindable(0),
|
|
18
|
+
label,
|
|
19
|
+
name,
|
|
20
|
+
maxlength,
|
|
21
|
+
className,
|
|
22
|
+
autofocus,
|
|
23
|
+
required,
|
|
24
|
+
setOnOkClick,
|
|
25
|
+
setResult,
|
|
26
|
+
closeDialog,
|
|
27
|
+
...props
|
|
28
|
+
}: PropsType & DialogExports = $props();
|
|
29
|
+
|
|
30
|
+
let _value: number = $state(value || 0);
|
|
31
|
+
|
|
32
|
+
function handleSubmit(ev: SubmitEvent) {
|
|
33
|
+
ev?.preventDefault();
|
|
34
|
+
_value = _value || 0;
|
|
35
|
+
if (required) {
|
|
36
|
+
showToast({ msg: 'This is a required field!' });
|
|
37
|
+
} else {
|
|
38
|
+
setResult(_value);
|
|
39
|
+
closeDialog();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
27
42
|
</script>
|
|
28
43
|
|
|
29
44
|
<div class="p-6">
|
|
@@ -1,108 +1,153 @@
|
|
|
1
|
-
<script lang="ts" module
|
|
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
|
-
let
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type PickerDialogProps = {
|
|
3
|
+
items?: string[] | any[];
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
value?: any;
|
|
6
|
+
identityFieldName?: string;
|
|
7
|
+
titleFieldName?: string;
|
|
8
|
+
searchFieldName?: string;
|
|
9
|
+
subtitleFieldName?: string;
|
|
10
|
+
hasCheckbox?: boolean;
|
|
11
|
+
hasArrow?: boolean;
|
|
12
|
+
maxlength?: number;
|
|
13
|
+
maxlengthMsg?: string;
|
|
14
|
+
checkboxIconPath?: string;
|
|
15
|
+
uncheckboxIconPath?: string;
|
|
16
|
+
checkboxIconClassName?: string;
|
|
17
|
+
uncheckboxIconClassName?: string;
|
|
18
|
+
checkboxClassName?: string;
|
|
19
|
+
arrowIconPath?: string;
|
|
20
|
+
arrowClassName?: string;
|
|
21
|
+
hasIcon?: boolean;
|
|
22
|
+
iconPath?: string;
|
|
23
|
+
iconClassName?: string;
|
|
24
|
+
isCircularIcon?: boolean;
|
|
25
|
+
circularIconClassName?: string;
|
|
26
|
+
itemTileSnippet?: Snippet<[item: any, index: number]>;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
import { showToast } from '../../../../../services';
|
|
32
|
+
|
|
33
|
+
import ButtonListItem from '../../../button/components/button-list-item/button-list-item.svelte';
|
|
34
|
+
import ButtonSearch from '../../../button/components/button-search/button-search.svelte';
|
|
35
|
+
import VirtualScrollingList from '../../../common/components/virtual-scrolling/virtual-scrolling-list.svelte';
|
|
36
|
+
import { mdiCheckCircle, mdiCheckCircleOutline, mdiChevronRight } from '../../../icon';
|
|
37
|
+
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
38
|
+
import { onMount, type Snippet } from 'svelte';
|
|
39
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
40
|
+
import type { DialogExports } from '../dialog/dialog.svelte';
|
|
41
|
+
|
|
42
|
+
let {
|
|
43
|
+
value,
|
|
44
|
+
items = [],
|
|
45
|
+
multiple = false,
|
|
46
|
+
identityFieldName = '_id',
|
|
47
|
+
titleFieldName = 'name',
|
|
48
|
+
subtitleFieldName,
|
|
49
|
+
searchFieldName = 'name',
|
|
50
|
+
hasCheckbox,
|
|
51
|
+
hasArrow,
|
|
52
|
+
maxlength = 0,
|
|
53
|
+
maxlengthMsg = 'Selection limit reached!',
|
|
54
|
+
checkboxIconPath = mdiCheckCircle,
|
|
55
|
+
uncheckboxIconPath = mdiCheckCircleOutline,
|
|
56
|
+
arrowIconPath = mdiChevronRight,
|
|
57
|
+
checkboxIconClassName = '',
|
|
58
|
+
uncheckboxIconClassName = '',
|
|
59
|
+
arrowClassName = '',
|
|
60
|
+
checkboxClassName = '',
|
|
61
|
+
isCircularIcon,
|
|
62
|
+
hasIcon,
|
|
63
|
+
iconClassName,
|
|
64
|
+
circularIconClassName,
|
|
65
|
+
iconPath,
|
|
66
|
+
itemTileSnippet,
|
|
67
|
+
closeDialog,
|
|
68
|
+
setResult,
|
|
69
|
+
setOnOkClick,
|
|
70
|
+
setHeaderSnippet,
|
|
71
|
+
setDialogTitle
|
|
72
|
+
}: DialogExports & PickerDialogProps = $props();
|
|
73
|
+
|
|
74
|
+
let containerHeight: number = $state(0);
|
|
75
|
+
|
|
76
|
+
// Reactive store for selected items
|
|
77
|
+
let selectedSet: SvelteSet<any> = $state(
|
|
78
|
+
value ? new SvelteSet(Array.isArray(value) ? value : [value]) : new SvelteSet()
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
let searchText: string = $state('');
|
|
82
|
+
|
|
83
|
+
let records: any[] = $derived.by(() => {
|
|
84
|
+
if (items && typeof items[0] == 'string') {
|
|
85
|
+
return items.map((name) => {
|
|
86
|
+
return {
|
|
87
|
+
[identityFieldName]: name,
|
|
88
|
+
[titleFieldName]: name
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return [...items];
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
let filteredRecords: any[] = $derived.by(() => {
|
|
97
|
+
if (searchText) {
|
|
98
|
+
return records.filter((item) => {
|
|
99
|
+
return (item[searchFieldName] || '').toLowerCase().indexOf(searchText) >= 0;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return records;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Handle item selection
|
|
106
|
+
function handleItemClick(ev: Event, item: any, index: number) {
|
|
107
|
+
let itemId = item[identityFieldName];
|
|
108
|
+
// console.log('handleItemClick', { itemId, multiple });
|
|
109
|
+
if (!multiple) {
|
|
110
|
+
if (selectedSet.has(itemId)) {
|
|
111
|
+
selectedSet.delete(itemId);
|
|
112
|
+
setResult(undefined);
|
|
113
|
+
} else {
|
|
114
|
+
selectedSet.add(itemId);
|
|
115
|
+
setResult(itemId);
|
|
116
|
+
}
|
|
117
|
+
closeDialog();
|
|
118
|
+
} else {
|
|
119
|
+
// Multiple selection: add/remove item
|
|
120
|
+
if (selectedSet.has(itemId)) {
|
|
121
|
+
selectedSet.delete(itemId);
|
|
122
|
+
} else {
|
|
123
|
+
if (selectedSet.size >= maxlength) {
|
|
124
|
+
showToast({ msg: maxlengthMsg });
|
|
125
|
+
} else {
|
|
126
|
+
selectedSet.add(itemId);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (selectedSet.size) {
|
|
130
|
+
setDialogTitle(`Selected (${selectedSet.size})`);
|
|
131
|
+
} else {
|
|
132
|
+
setDialogTitle('');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function handleOkClick(ev: MouseEvent | TouchEvent) {
|
|
138
|
+
if (multiple) {
|
|
139
|
+
closeDialog(Array.from(selectedSet));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function handleSearch(txt: string) {
|
|
144
|
+
searchText = txt;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onMount(() => {
|
|
148
|
+
setOnOkClick(handleOkClick);
|
|
149
|
+
setHeaderSnippet(headerSnippet);
|
|
150
|
+
});
|
|
106
151
|
</script>
|
|
107
152
|
|
|
108
153
|
{#snippet headerSnippet()}
|
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { showToast } from '../../../../../services';
|
|
3
|
+
import { TextField } from '../../../input';
|
|
4
|
+
import type { InputValue } from '../../../input/components/input-field/input-field.svelte';
|
|
5
|
+
import type { DialogExports } from '../dialog/dialog.svelte';
|
|
6
|
+
|
|
7
|
+
type PropsType = {
|
|
8
|
+
value?: InputValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
maxlength?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
autofocus?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
value = $bindable(''),
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
maxlength,
|
|
22
|
+
className,
|
|
23
|
+
autofocus,
|
|
24
|
+
required,
|
|
25
|
+
setOnOkClick,
|
|
26
|
+
setResult,
|
|
27
|
+
closeDialog,
|
|
28
|
+
...props
|
|
29
|
+
}: PropsType & DialogExports = $props();
|
|
30
|
+
|
|
31
|
+
function handleSubmit(ev: SubmitEvent) {
|
|
32
|
+
ev?.preventDefault();
|
|
33
|
+
value = ((value as string) || '').trim();
|
|
34
|
+
if (required && !value) {
|
|
35
|
+
showToast({ msg: 'This is a required field!' });
|
|
36
|
+
} else {
|
|
37
|
+
setResult(value);
|
|
38
|
+
closeDialog();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
26
41
|
</script>
|
|
27
42
|
|
|
28
43
|
<div class="p-6">
|
package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { showToast } from '../../../../../services';
|
|
3
|
+
import { TextareaField, TextField } from '../../../input';
|
|
4
|
+
import type { InputValue } from '../../../input/components/input-field/input-field.svelte';
|
|
5
|
+
import type { DialogExports } from '../dialog/dialog.svelte';
|
|
6
|
+
|
|
7
|
+
type PropsType = {
|
|
8
|
+
value?: InputValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
maxlength?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
autofocus?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
value = $bindable(''),
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
maxlength,
|
|
22
|
+
className,
|
|
23
|
+
autofocus,
|
|
24
|
+
required,
|
|
25
|
+
setOnOkClick,
|
|
26
|
+
setResult,
|
|
27
|
+
closeDialog,
|
|
28
|
+
...props
|
|
29
|
+
}: PropsType & DialogExports = $props();
|
|
30
|
+
|
|
31
|
+
function handleSubmit(ev: SubmitEvent) {
|
|
32
|
+
ev?.preventDefault();
|
|
33
|
+
value = ((value as string) || '').trim();
|
|
34
|
+
if (required && !value) {
|
|
35
|
+
showToast({ msg: 'This is a required field!' });
|
|
36
|
+
} else {
|
|
37
|
+
setResult(value);
|
|
38
|
+
closeDialog();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
26
41
|
</script>
|
|
27
42
|
|
|
28
43
|
<div class="p-6">
|
|
@@ -1,37 +1,59 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
type PositionType = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
|
|
7
|
+
type PropsType = {
|
|
8
|
+
backdropClassName?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
className?: string;
|
|
11
|
+
containerClassName?: string;
|
|
12
|
+
drawerClassName?: string;
|
|
13
|
+
floatingSnippet?: Snippet;
|
|
14
|
+
id?: string;
|
|
15
|
+
position?: PositionType;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
backdropClassName = '',
|
|
20
|
+
children,
|
|
21
|
+
className = '',
|
|
22
|
+
containerClassName = '',
|
|
23
|
+
drawerClassName = '',
|
|
24
|
+
floatingSnippet,
|
|
25
|
+
id = '',
|
|
26
|
+
position = 'left'
|
|
27
|
+
}: PropsType = $props();
|
|
28
|
+
|
|
29
|
+
let isPlaced: boolean = $state(false);
|
|
30
|
+
let isOpened: boolean = $state(false);
|
|
31
|
+
|
|
32
|
+
function handelBackdropClick() {
|
|
33
|
+
toggleDrawer();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function toggleDrawer() {
|
|
37
|
+
if (!isPlaced) {
|
|
38
|
+
openDrawer();
|
|
39
|
+
} else {
|
|
40
|
+
closeDrawer();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function openDrawer() {
|
|
45
|
+
isPlaced = true;
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
isOpened = true;
|
|
48
|
+
}, 0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function closeDrawer() {
|
|
52
|
+
isOpened = false;
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
isPlaced = false;
|
|
55
|
+
}, 300);
|
|
56
|
+
}
|
|
35
57
|
</script>
|
|
36
58
|
|
|
37
59
|
{#if isPlaced}
|
|
@@ -75,9 +97,9 @@ export function closeDrawer() {
|
|
|
75
97
|
{@render floatingSnippet()}
|
|
76
98
|
{/if}
|
|
77
99
|
</div>
|
|
78
|
-
|
|
100
|
+
</div>
|
|
79
101
|
|
|
80
|
-
<button class="flex-grow cursor-auto" type="button" onclick={handelBackdropClick}></button>
|
|
102
|
+
<button class="flex-grow cursor-auto" type="button" onclick={handelBackdropClick} aria-label="Close drawer" title="Close drawer"></button>
|
|
81
103
|
</div>
|
|
82
104
|
</div>
|
|
83
105
|
{/if}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
type IconPropsType = {
|
|
3
|
+
path: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
sizeClassName?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
fill?: string;
|
|
8
|
+
viewBox?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
path,
|
|
14
|
+
className = '',
|
|
15
|
+
size = 24,
|
|
16
|
+
fill = 'currentColor',
|
|
17
|
+
viewBox = '',
|
|
18
|
+
color,
|
|
19
|
+
sizeClassName = 'w-6 h-6'
|
|
20
|
+
}: IconPropsType = $props();
|
|
21
|
+
|
|
22
|
+
$effect(() => {
|
|
23
|
+
viewBox = viewBox || `0 0 ${size} ${size}`;
|
|
24
|
+
});
|
|
13
25
|
</script>
|
|
14
26
|
|
|
15
27
|
<svg class="align-middle {sizeClassName} {className}" {viewBox} fill={color || fill}>
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '../icon/icon.svelte';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
iconPath?: string;
|
|
6
|
+
iconClassName?: string;
|
|
7
|
+
circleClassName?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let { circleClassName, iconPath, iconClassName = 'w-5 h-5 text-primary' }: Props = $props();
|
|
3
11
|
</script>
|
|
4
12
|
|
|
5
13
|
<div
|