@makolabs/ripple 0.0.1-dev.8 → 0.0.1-dev.81
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/README.md +1 -1
- package/dist/adapters/storage/BaseAdapter.d.ts +20 -0
- package/dist/adapters/storage/BaseAdapter.js +171 -0
- package/dist/adapters/storage/S3Adapter.d.ts +21 -0
- package/dist/adapters/storage/S3Adapter.js +194 -0
- package/dist/adapters/storage/index.d.ts +3 -0
- package/dist/adapters/storage/index.js +3 -0
- package/dist/adapters/storage/types.d.ts +102 -0
- package/dist/adapters/storage/types.js +4 -0
- package/dist/charts/Chart.svelte +59 -47
- package/dist/charts/Chart.svelte.d.ts +1 -1
- package/dist/drawer/drawer.js +3 -3
- package/dist/elements/accordion/Accordion.svelte +98 -0
- package/dist/elements/accordion/Accordion.svelte.d.ts +4 -0
- package/dist/elements/accordion/accordion.d.ts +227 -0
- package/dist/elements/accordion/accordion.js +138 -0
- package/dist/elements/alert/Alert.svelte +7 -3
- package/dist/elements/dropdown/Dropdown.svelte +74 -107
- package/dist/elements/dropdown/Select.svelte +81 -62
- package/dist/elements/dropdown/dropdown.js +1 -1
- package/dist/elements/dropdown/select.js +8 -8
- package/dist/elements/file-upload/FileUpload.svelte +17 -95
- package/dist/elements/file-upload/FilesPreview.svelte +93 -0
- package/dist/elements/file-upload/FilesPreview.svelte.d.ts +4 -0
- package/dist/elements/progress/Progress.svelte +83 -25
- package/dist/file-browser/FileBrowser.svelte +837 -0
- package/dist/file-browser/FileBrowser.svelte.d.ts +14 -0
- package/dist/file-browser/index.d.ts +1 -0
- package/dist/file-browser/index.js +1 -0
- package/dist/filters/CompactFilters.svelte +147 -0
- package/dist/filters/CompactFilters.svelte.d.ts +4 -0
- package/dist/filters/index.d.ts +1 -0
- package/dist/filters/index.js +1 -0
- package/dist/forms/Checkbox.svelte +2 -2
- package/dist/forms/DateRange.svelte +21 -21
- package/dist/forms/Input.svelte +3 -3
- package/dist/forms/NumberInput.svelte +1 -1
- package/dist/forms/RadioInputs.svelte +3 -3
- package/dist/forms/Tags.svelte +5 -5
- package/dist/forms/Toggle.svelte +3 -3
- package/dist/forms/slider.js +4 -4
- package/dist/header/PageHeader.svelte +49 -11
- package/dist/index.d.ts +256 -143
- package/dist/index.js +19 -2
- package/dist/layout/card/MetricCard.svelte +64 -0
- package/dist/layout/card/MetricCard.svelte.d.ts +4 -0
- package/dist/layout/card/StatsCard.svelte +4 -3
- package/dist/layout/card/StatsCard.svelte.d.ts +1 -1
- package/dist/layout/card/metric-card.d.ts +49 -0
- package/dist/layout/card/metric-card.js +10 -0
- package/dist/layout/card/stats-card.d.ts +0 -15
- package/dist/layout/card/stats-card.js +1 -1
- package/dist/layout/sidebar/NavGroup.svelte +8 -9
- package/dist/layout/sidebar/NavItem.svelte +2 -2
- package/dist/layout/sidebar/Sidebar.svelte +102 -49
- package/dist/layout/table/Table.svelte +464 -87
- package/dist/layout/table/Table.svelte.d.ts +1 -1
- package/dist/layout/table/table.d.ts +0 -47
- package/dist/layout/table/table.js +0 -8
- package/dist/layout/tabs/Tab.svelte +9 -6
- package/dist/layout/tabs/Tab.svelte.d.ts +1 -1
- package/dist/layout/tabs/TabContent.svelte +1 -2
- package/dist/layout/tabs/TabContent.svelte.d.ts +1 -1
- package/dist/layout/tabs/TabGroup.svelte +10 -5
- package/dist/layout/tabs/TabGroup.svelte.d.ts +2 -2
- package/dist/layout/tabs/tabs.d.ts +61 -76
- package/dist/layout/tabs/tabs.js +170 -28
- package/dist/modal/Modal.svelte +3 -3
- package/dist/modal/modal.js +3 -3
- package/dist/utils/Portal.svelte +108 -0
- package/dist/utils/Portal.svelte.d.ts +8 -0
- package/dist/utils/dateUtils.d.ts +7 -0
- package/dist/utils/dateUtils.js +26 -0
- package/dist/variants.d.ts +11 -1
- package/dist/variants.js +17 -0
- package/package.json +2 -2
- package/dist/header/pageheaders.d.ts +0 -10
- package/dist/header/pageheaders.js +0 -1
package/dist/layout/tabs/tabs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
|
+
import { Color, Size } from '../../index.js';
|
|
2
3
|
export const tabs = tv({
|
|
3
4
|
slots: {
|
|
4
5
|
base: 'w-full',
|
|
@@ -8,34 +9,41 @@ export const tabs = tv({
|
|
|
8
9
|
},
|
|
9
10
|
variants: {
|
|
10
11
|
color: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
[Color.PRIMARY]: {},
|
|
13
|
+
[Color.SECONDARY]: {},
|
|
14
|
+
[Color.SUCCESS]: {},
|
|
15
|
+
[Color.WARNING]: {},
|
|
16
|
+
[Color.DANGER]: {},
|
|
17
|
+
[Color.INFO]: {},
|
|
18
|
+
[Color.DEFAULT]: {}
|
|
18
19
|
},
|
|
19
20
|
size: {
|
|
20
|
-
|
|
21
|
+
[Size.XS]: {
|
|
21
22
|
trigger: 'px-2 py-1 text-xs'
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
+
[Size.SM]: {
|
|
24
25
|
trigger: 'px-2 py-1 text-xs'
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
+
[Size.BASE]: {
|
|
27
28
|
trigger: 'px-3 py-2 text-sm'
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
[Size.LG]: {
|
|
30
31
|
trigger: 'px-4 py-2.5 text-base'
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
+
[Size.XL]: {
|
|
33
34
|
trigger: 'px-5 py-3 text-lg'
|
|
34
35
|
},
|
|
35
|
-
|
|
36
|
+
[Size.XXL]: {
|
|
36
37
|
trigger: 'px-6 py-4 text-xl'
|
|
37
38
|
}
|
|
38
39
|
},
|
|
40
|
+
variant: {
|
|
41
|
+
line: {},
|
|
42
|
+
pill: {
|
|
43
|
+
list: 'flex border-none gap-2 p-1',
|
|
44
|
+
trigger: 'inline-flex items-center px-3 py-2 text-sm transition-all duration-200 ease-in-out cursor-pointer rounded-full border-0'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
39
47
|
selected: {
|
|
40
48
|
true: {},
|
|
41
49
|
false: {}
|
|
@@ -44,14 +52,16 @@ export const tabs = tv({
|
|
|
44
52
|
compoundVariants: [
|
|
45
53
|
// LINE VARIANT - PRIMARY
|
|
46
54
|
{
|
|
47
|
-
|
|
55
|
+
variant: 'line',
|
|
56
|
+
color: Color.PRIMARY,
|
|
48
57
|
selected: true,
|
|
49
58
|
class: {
|
|
50
59
|
trigger: 'text-primary-600 border-b-2 border-primary-500'
|
|
51
60
|
}
|
|
52
61
|
},
|
|
53
62
|
{
|
|
54
|
-
|
|
63
|
+
variant: 'line',
|
|
64
|
+
color: Color.PRIMARY,
|
|
55
65
|
selected: false,
|
|
56
66
|
class: {
|
|
57
67
|
trigger: 'text-default-500 hover:text-primary-500'
|
|
@@ -59,14 +69,16 @@ export const tabs = tv({
|
|
|
59
69
|
},
|
|
60
70
|
// LINE VARIANT - SECONDARY
|
|
61
71
|
{
|
|
62
|
-
|
|
72
|
+
variant: 'line',
|
|
73
|
+
color: Color.SECONDARY,
|
|
63
74
|
selected: true,
|
|
64
75
|
class: {
|
|
65
76
|
trigger: 'text-secondary-600 border-b-2 border-secondary-500'
|
|
66
77
|
}
|
|
67
78
|
},
|
|
68
79
|
{
|
|
69
|
-
|
|
80
|
+
variant: 'line',
|
|
81
|
+
color: Color.SECONDARY,
|
|
70
82
|
selected: false,
|
|
71
83
|
class: {
|
|
72
84
|
trigger: 'text-default-500 hover:text-secondary-500'
|
|
@@ -74,14 +86,16 @@ export const tabs = tv({
|
|
|
74
86
|
},
|
|
75
87
|
// LINE VARIANT - SUCCESS
|
|
76
88
|
{
|
|
77
|
-
|
|
89
|
+
variant: 'line',
|
|
90
|
+
color: Color.SUCCESS,
|
|
78
91
|
selected: true,
|
|
79
92
|
class: {
|
|
80
93
|
trigger: 'text-success-600 border-b-2 border-success-500'
|
|
81
94
|
}
|
|
82
95
|
},
|
|
83
96
|
{
|
|
84
|
-
|
|
97
|
+
variant: 'line',
|
|
98
|
+
color: Color.SUCCESS,
|
|
85
99
|
selected: false,
|
|
86
100
|
class: {
|
|
87
101
|
trigger: 'text-default-500 hover:text-success-500'
|
|
@@ -89,14 +103,16 @@ export const tabs = tv({
|
|
|
89
103
|
},
|
|
90
104
|
// LINE VARIANT - WARNING
|
|
91
105
|
{
|
|
92
|
-
|
|
106
|
+
variant: 'line',
|
|
107
|
+
color: Color.WARNING,
|
|
93
108
|
selected: true,
|
|
94
109
|
class: {
|
|
95
110
|
trigger: 'text-warning-600 border-b-2 border-warning-500'
|
|
96
111
|
}
|
|
97
112
|
},
|
|
98
113
|
{
|
|
99
|
-
|
|
114
|
+
variant: 'line',
|
|
115
|
+
color: Color.WARNING,
|
|
100
116
|
selected: false,
|
|
101
117
|
class: {
|
|
102
118
|
trigger: 'text-default-500 hover:text-warning-500'
|
|
@@ -104,14 +120,16 @@ export const tabs = tv({
|
|
|
104
120
|
},
|
|
105
121
|
// LINE VARIANT - DANGER
|
|
106
122
|
{
|
|
107
|
-
|
|
123
|
+
variant: 'line',
|
|
124
|
+
color: Color.DANGER,
|
|
108
125
|
selected: true,
|
|
109
126
|
class: {
|
|
110
127
|
trigger: 'text-danger-600 border-b-2 border-danger-500'
|
|
111
128
|
}
|
|
112
129
|
},
|
|
113
130
|
{
|
|
114
|
-
|
|
131
|
+
variant: 'line',
|
|
132
|
+
color: Color.DANGER,
|
|
115
133
|
selected: false,
|
|
116
134
|
class: {
|
|
117
135
|
trigger: 'text-default-500 hover:text-danger-500'
|
|
@@ -119,14 +137,16 @@ export const tabs = tv({
|
|
|
119
137
|
},
|
|
120
138
|
// LINE VARIANT - INFO
|
|
121
139
|
{
|
|
122
|
-
|
|
140
|
+
variant: 'line',
|
|
141
|
+
color: Color.INFO,
|
|
123
142
|
selected: true,
|
|
124
143
|
class: {
|
|
125
144
|
trigger: 'text-info-600 border-b-2 border-info-500'
|
|
126
145
|
}
|
|
127
146
|
},
|
|
128
147
|
{
|
|
129
|
-
|
|
148
|
+
variant: 'line',
|
|
149
|
+
color: Color.INFO,
|
|
130
150
|
selected: false,
|
|
131
151
|
class: {
|
|
132
152
|
trigger: 'text-default-500 hover:text-info-500'
|
|
@@ -134,23 +154,145 @@ export const tabs = tv({
|
|
|
134
154
|
},
|
|
135
155
|
// LINE VARIANT - DEFAULT
|
|
136
156
|
{
|
|
137
|
-
|
|
157
|
+
variant: 'line',
|
|
158
|
+
color: Color.DEFAULT,
|
|
138
159
|
selected: true,
|
|
139
160
|
class: {
|
|
140
161
|
trigger: 'text-default-600 border-b-2 border-default-500'
|
|
141
162
|
}
|
|
142
163
|
},
|
|
143
164
|
{
|
|
144
|
-
|
|
165
|
+
variant: 'line',
|
|
166
|
+
color: Color.DEFAULT,
|
|
145
167
|
selected: false,
|
|
146
168
|
class: {
|
|
147
169
|
trigger: 'text-default-500 hover:text-default-700'
|
|
148
170
|
}
|
|
171
|
+
},
|
|
172
|
+
// PILL VARIANT - PRIMARY
|
|
173
|
+
{
|
|
174
|
+
variant: 'pill',
|
|
175
|
+
color: Color.PRIMARY,
|
|
176
|
+
selected: true,
|
|
177
|
+
class: {
|
|
178
|
+
trigger: 'bg-primary-500 text-white'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
variant: 'pill',
|
|
183
|
+
color: Color.PRIMARY,
|
|
184
|
+
selected: false,
|
|
185
|
+
class: {
|
|
186
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
// PILL VARIANT - SECONDARY
|
|
190
|
+
{
|
|
191
|
+
variant: 'pill',
|
|
192
|
+
color: Color.SECONDARY,
|
|
193
|
+
selected: true,
|
|
194
|
+
class: {
|
|
195
|
+
trigger: 'bg-secondary-500 text-white'
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
variant: 'pill',
|
|
200
|
+
color: Color.SECONDARY,
|
|
201
|
+
selected: false,
|
|
202
|
+
class: {
|
|
203
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
// PILL VARIANT - SUCCESS
|
|
207
|
+
{
|
|
208
|
+
variant: 'pill',
|
|
209
|
+
color: Color.SUCCESS,
|
|
210
|
+
selected: true,
|
|
211
|
+
class: {
|
|
212
|
+
trigger: 'bg-success-500 text-white'
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
variant: 'pill',
|
|
217
|
+
color: Color.SUCCESS,
|
|
218
|
+
selected: false,
|
|
219
|
+
class: {
|
|
220
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
// PILL VARIANT - WARNING
|
|
224
|
+
{
|
|
225
|
+
variant: 'pill',
|
|
226
|
+
color: Color.WARNING,
|
|
227
|
+
selected: true,
|
|
228
|
+
class: {
|
|
229
|
+
trigger: 'bg-warning-500 text-white'
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
variant: 'pill',
|
|
234
|
+
color: Color.WARNING,
|
|
235
|
+
selected: false,
|
|
236
|
+
class: {
|
|
237
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
// PILL VARIANT - DANGER
|
|
241
|
+
{
|
|
242
|
+
variant: 'pill',
|
|
243
|
+
color: Color.DANGER,
|
|
244
|
+
selected: true,
|
|
245
|
+
class: {
|
|
246
|
+
trigger: 'bg-danger-500 text-white'
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
variant: 'pill',
|
|
251
|
+
color: Color.DANGER,
|
|
252
|
+
selected: false,
|
|
253
|
+
class: {
|
|
254
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
// PILL VARIANT - INFO
|
|
258
|
+
{
|
|
259
|
+
variant: 'pill',
|
|
260
|
+
color: Color.INFO,
|
|
261
|
+
selected: true,
|
|
262
|
+
class: {
|
|
263
|
+
trigger: 'bg-info-500 text-white'
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
variant: 'pill',
|
|
268
|
+
color: Color.INFO,
|
|
269
|
+
selected: false,
|
|
270
|
+
class: {
|
|
271
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
// PILL VARIANT - DEFAULT
|
|
275
|
+
{
|
|
276
|
+
variant: 'pill',
|
|
277
|
+
color: Color.DEFAULT,
|
|
278
|
+
selected: true,
|
|
279
|
+
class: {
|
|
280
|
+
trigger: 'bg-default-500 text-white'
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
variant: 'pill',
|
|
285
|
+
color: Color.DEFAULT,
|
|
286
|
+
selected: false,
|
|
287
|
+
class: {
|
|
288
|
+
trigger: 'text-default-600 hover:bg-default-100'
|
|
289
|
+
}
|
|
149
290
|
}
|
|
150
291
|
],
|
|
151
292
|
defaultVariants: {
|
|
152
|
-
color:
|
|
293
|
+
color: Color.PRIMARY,
|
|
153
294
|
size: 'base',
|
|
295
|
+
variant: 'line',
|
|
154
296
|
selected: false
|
|
155
297
|
}
|
|
156
298
|
});
|
package/dist/modal/Modal.svelte
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
title,
|
|
14
14
|
description,
|
|
15
15
|
position = 'center',
|
|
16
|
-
size = 'lg',
|
|
17
16
|
children,
|
|
18
17
|
header,
|
|
19
18
|
custom,
|
|
@@ -39,8 +38,7 @@
|
|
|
39
38
|
} = $derived(
|
|
40
39
|
modal({
|
|
41
40
|
open,
|
|
42
|
-
position
|
|
43
|
-
size
|
|
41
|
+
position
|
|
44
42
|
})
|
|
45
43
|
);
|
|
46
44
|
|
|
@@ -62,6 +60,8 @@
|
|
|
62
60
|
function handleEscapeKey(e: KeyboardEvent) {
|
|
63
61
|
if (e.key === 'Escape' && open) {
|
|
64
62
|
onClose();
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
e.stopPropagation();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
package/dist/modal/modal.js
CHANGED
|
@@ -5,10 +5,10 @@ export const modal = tv({
|
|
|
5
5
|
backdrop: 'fixed inset-0 transition-opacity bg-black/50',
|
|
6
6
|
contentWrapper: 'absolute transform overflow-hidden transition-all px-2',
|
|
7
7
|
content: 'bg-white overflow-hidden rounded-lg',
|
|
8
|
-
header: 'px-4 py-3 flex items-center justify-between border-b border-
|
|
8
|
+
header: 'px-4 py-3 flex items-center justify-between border-b border-default-200',
|
|
9
9
|
body: 'px-3 py-2 max-h-[70dvh] overflow-y-auto',
|
|
10
10
|
title: 'text-default-900 leading-6 text-base font-semibold',
|
|
11
|
-
closeButton: 'text-
|
|
11
|
+
closeButton: 'text-default-400 hover:text-default-500 rounded-md cursor-pointer'
|
|
12
12
|
},
|
|
13
13
|
variants: {
|
|
14
14
|
open: {
|
|
@@ -65,7 +65,7 @@ export const modal = tv({
|
|
|
65
65
|
content: 'border-0'
|
|
66
66
|
},
|
|
67
67
|
default: {
|
|
68
|
-
content: 'border border-
|
|
68
|
+
content: 'border border-default-200'
|
|
69
69
|
},
|
|
70
70
|
colored: {
|
|
71
71
|
content: 'border'
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy, type Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Target element to mount the portal content to
|
|
6
|
+
* Defaults to document.body
|
|
7
|
+
*/
|
|
8
|
+
let { target, children }: { target?: HTMLElement | null; children: Snippet } = $props();
|
|
9
|
+
|
|
10
|
+
let ref: HTMLElement;
|
|
11
|
+
let portal: HTMLElement;
|
|
12
|
+
let animationFrameId: number;
|
|
13
|
+
let isPositioned = $state(false);
|
|
14
|
+
|
|
15
|
+
// Position update without animation - for immediate positioning
|
|
16
|
+
function updatePosition() {
|
|
17
|
+
if (!ref || !target) return;
|
|
18
|
+
|
|
19
|
+
const { top, left, width, height } = target.getBoundingClientRect();
|
|
20
|
+
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
21
|
+
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
22
|
+
|
|
23
|
+
// Set instant positioning without transitions for first render
|
|
24
|
+
if (!isPositioned) {
|
|
25
|
+
ref.style.position = 'absolute';
|
|
26
|
+
ref.style.width = `${width}px`;
|
|
27
|
+
ref.style.zIndex = '10000'; // Ensure the highest z-index
|
|
28
|
+
ref.style.top = `${height}px`; // Position below the target
|
|
29
|
+
ref.style.left = '0px';
|
|
30
|
+
ref.style.transform = `translate(${left + scrollX}px, ${top + scrollY}px)`;
|
|
31
|
+
ref.style.visibility = 'hidden'; // Keep hidden until fully positioned
|
|
32
|
+
|
|
33
|
+
// Wait for next frame to ensure positioning is applied before showing
|
|
34
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
35
|
+
ref.style.opacity = '1';
|
|
36
|
+
ref.style.visibility = 'visible';
|
|
37
|
+
isPositioned = true;
|
|
38
|
+
|
|
39
|
+
// Now add transition for subsequent updates
|
|
40
|
+
ref.style.transition = 'transform 0.1s ease-out';
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
// For subsequent updates, smoothly transition
|
|
44
|
+
ref.style.transform = `translate(${left + scrollX}px, ${top + scrollY}px)`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Handle scroll and resize with animation frames for smooth updates
|
|
49
|
+
function handlePositionUpdate() {
|
|
50
|
+
if (animationFrameId) {
|
|
51
|
+
cancelAnimationFrame(animationFrameId);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
animationFrameId = requestAnimationFrame(updatePosition);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onMount(() => {
|
|
58
|
+
// Create portal container
|
|
59
|
+
portal = document.createElement('div');
|
|
60
|
+
portal.className = 'ripple-portal';
|
|
61
|
+
portal.style.position = 'fixed';
|
|
62
|
+
portal.style.zIndex = '10000'; // Ensure highest z-index
|
|
63
|
+
portal.style.top = '0';
|
|
64
|
+
portal.style.left = '0';
|
|
65
|
+
portal.style.width = '100%';
|
|
66
|
+
portal.style.pointerEvents = 'none'; // Allow clicking through the container but not its children
|
|
67
|
+
|
|
68
|
+
// Default to document.body if no target is provided
|
|
69
|
+
const targetElement = document.body; // Always append to body for best visibility
|
|
70
|
+
targetElement.appendChild(portal);
|
|
71
|
+
|
|
72
|
+
// Move the content to the portal
|
|
73
|
+
portal.appendChild(ref);
|
|
74
|
+
|
|
75
|
+
// Allow pointer events on the content
|
|
76
|
+
ref.style.pointerEvents = 'auto';
|
|
77
|
+
|
|
78
|
+
// Initially hide the content
|
|
79
|
+
ref.style.opacity = '0';
|
|
80
|
+
|
|
81
|
+
// Position immediately - critical for first render
|
|
82
|
+
updatePosition();
|
|
83
|
+
|
|
84
|
+
// Add event listeners for position updates
|
|
85
|
+
window.addEventListener('resize', handlePositionUpdate);
|
|
86
|
+
window.addEventListener('scroll', handlePositionUpdate, true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
onDestroy(() => {
|
|
90
|
+
// Clean up on component destruction
|
|
91
|
+
if (portal && portal.parentNode) {
|
|
92
|
+
portal.parentNode.removeChild(portal);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Clean up event listeners
|
|
96
|
+
window.removeEventListener('resize', handlePositionUpdate);
|
|
97
|
+
window.removeEventListener('scroll', handlePositionUpdate, true);
|
|
98
|
+
|
|
99
|
+
// Cancel any pending animation frame
|
|
100
|
+
if (animationFrameId) {
|
|
101
|
+
cancelAnimationFrame(animationFrameId);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<div class="portal-content" bind:this={ref}>
|
|
107
|
+
{@render children()}
|
|
108
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
target?: HTMLElement | null;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const Portal: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Portal = ReturnType<typeof Portal>;
|
|
8
|
+
export default Portal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a date to a specific format
|
|
3
|
+
* @param date - Date to format
|
|
4
|
+
* @param format - Format string (default: 'YYYY-MM-DD')
|
|
5
|
+
* @returns Formatted date string
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatDate(date: Date | string | number, formatStr?: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a date to a specific format
|
|
3
|
+
* @param date - Date to format
|
|
4
|
+
* @param format - Format string (default: 'YYYY-MM-DD')
|
|
5
|
+
* @returns Formatted date string
|
|
6
|
+
*/
|
|
7
|
+
export function formatDate(date, formatStr = 'DD.MM.YYYY HH:mm') {
|
|
8
|
+
const d = new Date(date);
|
|
9
|
+
if (isNaN(d.getTime())) {
|
|
10
|
+
return 'Invalid Date';
|
|
11
|
+
}
|
|
12
|
+
// Simple format implementation for common patterns
|
|
13
|
+
const day = d.getDate().toString().padStart(2, '0');
|
|
14
|
+
const month = (d.getMonth() + 1).toString().padStart(2, '0');
|
|
15
|
+
const year = d.getFullYear();
|
|
16
|
+
const hours = d.getHours().toString().padStart(2, '0');
|
|
17
|
+
const minutes = d.getMinutes().toString().padStart(2, '0');
|
|
18
|
+
const seconds = d.getSeconds().toString().padStart(2, '0');
|
|
19
|
+
return formatStr
|
|
20
|
+
.replace('DD', day)
|
|
21
|
+
.replace('MM', month)
|
|
22
|
+
.replace('YYYY', year.toString())
|
|
23
|
+
.replace('HH', hours)
|
|
24
|
+
.replace('mm', minutes)
|
|
25
|
+
.replace('ss', seconds);
|
|
26
|
+
}
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VariantColors, VariantSizes } from './index.js';
|
|
1
|
+
import type { ChartColors, VariantColors, VariantSizes } from './index.js';
|
|
2
2
|
export declare const Color: {
|
|
3
3
|
DEFAULT: string;
|
|
4
4
|
PRIMARY: string;
|
|
@@ -16,5 +16,15 @@ export declare const Size: {
|
|
|
16
16
|
XL: string;
|
|
17
17
|
XXL: string;
|
|
18
18
|
};
|
|
19
|
+
export declare const ChartColor: {
|
|
20
|
+
readonly HEALTH: "health";
|
|
21
|
+
readonly PROPERTY: "property";
|
|
22
|
+
readonly AUTO: "auto";
|
|
23
|
+
readonly LIFE: "life";
|
|
24
|
+
readonly OTHER: "other";
|
|
25
|
+
readonly DEFAULT: "default";
|
|
26
|
+
};
|
|
27
|
+
export declare const defaultChartColors: ChartColors;
|
|
19
28
|
export declare const colors: VariantColors[];
|
|
20
29
|
export declare const sizes: VariantSizes[];
|
|
30
|
+
export declare const chartColors: ("default" | "health" | "property" | "auto" | "life" | "other")[];
|
package/dist/variants.js
CHANGED
|
@@ -15,5 +15,22 @@ export const Size = {
|
|
|
15
15
|
XL: 'xl',
|
|
16
16
|
XXL: '2xl'
|
|
17
17
|
};
|
|
18
|
+
export const ChartColor = {
|
|
19
|
+
HEALTH: 'health',
|
|
20
|
+
PROPERTY: 'property',
|
|
21
|
+
AUTO: 'auto',
|
|
22
|
+
LIFE: 'life',
|
|
23
|
+
OTHER: 'other',
|
|
24
|
+
DEFAULT: 'default'
|
|
25
|
+
};
|
|
26
|
+
export const defaultChartColors = {
|
|
27
|
+
[ChartColor.HEALTH]: '#1F69FF',
|
|
28
|
+
[ChartColor.PROPERTY]: '#2D9D78',
|
|
29
|
+
[ChartColor.AUTO]: '#E8A317',
|
|
30
|
+
[ChartColor.LIFE]: '#E34974',
|
|
31
|
+
[ChartColor.OTHER]: '#7B3FE4',
|
|
32
|
+
[ChartColor.DEFAULT]: '#6B7280'
|
|
33
|
+
};
|
|
18
34
|
export const colors = Object.values(Color);
|
|
19
35
|
export const sizes = Object.values(Size);
|
|
36
|
+
export const chartColors = Object.values(ChartColor);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makolabs/ripple",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.81",
|
|
4
4
|
"description": "Simple Svelte 5 powered component library ✨",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/makolabsai/
|
|
7
|
+
"url": "https://github.com/makolabsai/ripple-ui.git"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "vite dev",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type ClassValue } from 'tailwind-variants';
|
|
2
|
-
import type { BreadcrumbItem } from '../index.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
export type PageHeaderProps = {
|
|
5
|
-
title: string;
|
|
6
|
-
breadcrumbs?: BreadcrumbItem[];
|
|
7
|
-
children?: Snippet;
|
|
8
|
-
class?: ClassValue;
|
|
9
|
-
titleclass?: ClassValue;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {} from 'tailwind-variants';
|