@makolabs/ripple 0.0.1-dev.5 → 0.0.1-dev.50

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.
Files changed (131) hide show
  1. package/README.md +394 -54
  2. package/dist/button/Button.svelte +5 -3
  3. package/dist/button/Button.svelte.d.ts +1 -1
  4. package/dist/button/button.d.ts +40 -63
  5. package/dist/button/button.js +15 -14
  6. package/dist/charts/Chart.svelte +545 -0
  7. package/dist/charts/Chart.svelte.d.ts +4 -0
  8. package/dist/drawer/Drawer.svelte +13 -2
  9. package/dist/drawer/Drawer.svelte.d.ts +1 -1
  10. package/dist/drawer/drawer.d.ts +0 -17
  11. package/dist/drawer/drawer.js +3 -3
  12. package/dist/elements/accordion/Accordion.svelte +92 -0
  13. package/dist/elements/accordion/Accordion.svelte.d.ts +4 -0
  14. package/dist/elements/accordion/accordion.d.ts +227 -0
  15. package/dist/elements/accordion/accordion.js +138 -0
  16. package/dist/elements/alert/Alert.svelte +57 -0
  17. package/dist/elements/alert/Alert.svelte.d.ts +4 -0
  18. package/dist/elements/badge/Badge.svelte +13 -5
  19. package/dist/elements/badge/Badge.svelte.d.ts +1 -1
  20. package/dist/elements/badge/badge.d.ts +0 -12
  21. package/dist/elements/dropdown/Dropdown.svelte +100 -138
  22. package/dist/elements/dropdown/Dropdown.svelte.d.ts +1 -1
  23. package/dist/elements/dropdown/Select.svelte +167 -66
  24. package/dist/elements/dropdown/Select.svelte.d.ts +1 -1
  25. package/dist/elements/dropdown/dropdown.d.ts +34 -57
  26. package/dist/elements/dropdown/dropdown.js +11 -5
  27. package/dist/elements/dropdown/select.d.ts +34 -54
  28. package/dist/elements/dropdown/select.js +24 -16
  29. package/dist/elements/file-upload/FileUpload.svelte +130 -0
  30. package/dist/elements/file-upload/FileUpload.svelte.d.ts +4 -0
  31. package/dist/elements/file-upload/FilesPreview.svelte +93 -0
  32. package/dist/elements/file-upload/FilesPreview.svelte.d.ts +4 -0
  33. package/dist/elements/progress/Progress.svelte +145 -0
  34. package/dist/elements/progress/Progress.svelte.d.ts +4 -0
  35. package/dist/elements/timeline/Timeline.svelte +92 -0
  36. package/dist/elements/timeline/Timeline.svelte.d.ts +7 -0
  37. package/dist/forms/Checkbox.svelte +54 -0
  38. package/dist/forms/Checkbox.svelte.d.ts +4 -0
  39. package/dist/forms/DateRange.svelte +493 -0
  40. package/dist/forms/DateRange.svelte.d.ts +4 -0
  41. package/dist/forms/Form.svelte +39 -0
  42. package/dist/forms/Form.svelte.d.ts +4 -0
  43. package/dist/forms/Input.svelte +86 -0
  44. package/dist/forms/Input.svelte.d.ts +4 -0
  45. package/dist/forms/NumberInput.svelte +159 -0
  46. package/dist/forms/NumberInput.svelte.d.ts +4 -0
  47. package/dist/forms/RadioInputs.svelte +64 -0
  48. package/dist/forms/RadioInputs.svelte.d.ts +4 -0
  49. package/dist/forms/RadioPill.svelte +66 -0
  50. package/dist/forms/RadioPill.svelte.d.ts +4 -0
  51. package/dist/forms/Slider.svelte +342 -0
  52. package/dist/forms/Slider.svelte.d.ts +4 -0
  53. package/dist/forms/Tags.svelte +181 -0
  54. package/dist/forms/Tags.svelte.d.ts +4 -0
  55. package/dist/forms/Toggle.svelte +132 -0
  56. package/dist/forms/Toggle.svelte.d.ts +4 -0
  57. package/dist/forms/slider.d.ts +143 -0
  58. package/dist/forms/slider.js +62 -0
  59. package/dist/header/Breadcrumbs.svelte +2 -1
  60. package/dist/header/Breadcrumbs.svelte.d.ts +1 -1
  61. package/dist/header/PageHeader.svelte +2 -2
  62. package/dist/header/PageHeader.svelte.d.ts +1 -1
  63. package/dist/header/breadcrumbs.d.ts +20 -14
  64. package/dist/header/breadcrumbs.js +6 -0
  65. package/dist/helper/date.d.ts +7 -0
  66. package/dist/helper/date.js +15 -0
  67. package/dist/index.d.ts +760 -9
  68. package/dist/index.js +70 -16
  69. package/dist/layout/card/Card.svelte +5 -8
  70. package/dist/layout/card/Card.svelte.d.ts +1 -1
  71. package/dist/layout/card/StatsCard.svelte +119 -89
  72. package/dist/layout/card/StatsCard.svelte.d.ts +1 -1
  73. package/dist/layout/card/card.d.ts +22 -33
  74. package/dist/layout/card/card.js +9 -8
  75. package/dist/layout/card/stats-card.d.ts +22 -39
  76. package/dist/layout/card/stats-card.js +14 -14
  77. package/dist/layout/navbar/navbar.d.ts +0 -23
  78. package/dist/layout/sidebar/NavGroup.svelte +38 -48
  79. package/dist/layout/sidebar/NavGroup.svelte.d.ts +1 -1
  80. package/dist/layout/sidebar/NavItem.svelte +3 -3
  81. package/dist/layout/sidebar/NavItem.svelte.d.ts +1 -1
  82. package/dist/layout/sidebar/Sidebar.svelte +101 -72
  83. package/dist/layout/sidebar/Sidebar.svelte.d.ts +1 -1
  84. package/dist/layout/table/Table.svelte +35 -30
  85. package/dist/layout/table/Table.svelte.d.ts +1 -1
  86. package/dist/layout/table/table.d.ts +0 -47
  87. package/dist/layout/table/table.js +0 -8
  88. package/dist/layout/tabs/TabGroup.svelte +2 -2
  89. package/dist/layout/tabs/TabGroup.svelte.d.ts +2 -2
  90. package/dist/layout/tabs/tabs.d.ts +2 -2
  91. package/dist/modal/Modal.svelte +2 -1
  92. package/dist/modal/Modal.svelte.d.ts +1 -1
  93. package/dist/modal/modal.d.ts +0 -23
  94. package/dist/modal/modal.js +3 -3
  95. package/dist/sonner/sonner.svelte +13 -0
  96. package/dist/sonner/sonner.svelte.d.ts +4 -0
  97. package/dist/types/variants.d.ts +1 -21
  98. package/dist/types/variants.js +1 -19
  99. package/dist/utils/Portal.svelte +108 -0
  100. package/dist/utils/Portal.svelte.d.ts +8 -0
  101. package/dist/variants.d.ts +30 -0
  102. package/dist/variants.js +36 -0
  103. package/package.json +7 -3
  104. package/dist/button/index.d.ts +0 -1
  105. package/dist/button/index.js +0 -1
  106. package/dist/drawer/index.d.ts +0 -2
  107. package/dist/drawer/index.js +0 -1
  108. package/dist/elements/badge/index.d.ts +0 -2
  109. package/dist/elements/badge/index.js +0 -2
  110. package/dist/elements/dropdown/index.d.ts +0 -3
  111. package/dist/elements/dropdown/index.js +0 -2
  112. package/dist/header/index.d.ts +0 -4
  113. package/dist/header/index.js +0 -2
  114. package/dist/header/pageheaders.d.ts +0 -10
  115. package/dist/header/pageheaders.js +0 -1
  116. package/dist/layout/card/index.d.ts +0 -4
  117. package/dist/layout/card/index.js +0 -2
  118. package/dist/layout/index.d.ts +0 -5
  119. package/dist/layout/index.js +0 -5
  120. package/dist/layout/navbar/index.d.ts +0 -2
  121. package/dist/layout/navbar/index.js +0 -2
  122. package/dist/layout/sidebar/index.d.ts +0 -2
  123. package/dist/layout/sidebar/index.js +0 -1
  124. package/dist/layout/sidebar/sidebar.d.ts +0 -46
  125. package/dist/layout/sidebar/sidebar.js +0 -1
  126. package/dist/layout/table/index.d.ts +0 -3
  127. package/dist/layout/table/index.js +0 -2
  128. package/dist/layout/tabs/index.d.ts +0 -3
  129. package/dist/layout/tabs/index.js +0 -3
  130. package/dist/modal/index.d.ts +0 -1
  131. package/dist/modal/index.js +0 -1
@@ -1,4 +1,4 @@
1
- import type { SidebarProps } from './sidebar.js';
1
+ import type { SidebarProps } from '../../index.js';
2
2
  declare const Sidebar: import("svelte").Component<SidebarProps, {}, "">;
3
3
  type Sidebar = ReturnType<typeof Sidebar>;
4
4
  export default Sidebar;
@@ -1,12 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { cn } from '../../helper/cls.js';
3
- import { table, type TableProps, type SortDirection, type SortState } from './table.js';
3
+ import { table } from './table.js';
4
+ import type { TableProps, SortDirection, SortState } from '../../index.js';
4
5
 
5
6
  let {
6
7
  data = [],
7
8
  columns = [],
8
- color = 'default',
9
- size = 'base',
10
9
  bordered = true,
11
10
  striped = false,
12
11
  pageSize = 10,
@@ -25,7 +24,8 @@
25
24
  tdclass: tdClass = '',
26
25
  footerclass: footerClass = '',
27
26
  rowclass = () => '',
28
- loading = false
27
+ loading = false,
28
+ expandedContent
29
29
  }: TableProps<any> = $props();
30
30
 
31
31
  let sortColumn = $state('');
@@ -36,38 +36,36 @@
36
36
  const pagination = $derived(pageSize > 0 && data.length > pageSize);
37
37
 
38
38
  const {
39
- base,
40
- wrapper,
39
+ base: baseClass,
40
+ wrapper: wrapperBaseClass,
41
41
  table: tableBaseClass,
42
- thead,
43
- tbody,
44
- tr,
45
- th,
46
- td,
47
- footer,
48
- pagination: paginationClass,
49
- emptyState,
50
- sortButton,
51
- sortIcon
42
+ thead: theadBaseClass,
43
+ tbody: tbodyBaseClass,
44
+ tr: trBaseClass,
45
+ th: thBaseClass,
46
+ td: tdBaseClass,
47
+ footer: footerBaseClass,
48
+ pagination: paginationBaseClass,
49
+ emptyState: emptyStateBaseClass,
50
+ sortButton: sortButtonBaseClass,
51
+ sortIcon: sortIconBaseClass
52
52
  } = $derived(
53
53
  table({
54
- size,
55
- color,
56
54
  bordered,
57
55
  striped
58
56
  })
59
57
  );
60
58
 
61
- const baseClasses = $derived(cn(base(), classname));
62
- const wrapperClasses = $derived(cn(wrapper(), wrapperClass));
59
+ const baseClasses = $derived(cn(baseClass(), classname));
60
+ const wrapperClasses = $derived(cn(wrapperBaseClass(), wrapperClass));
63
61
  const tableClasses = $derived(cn(tableBaseClass(), tableClass));
64
- const theadClasses = $derived(cn(thead(), theadClass));
65
- const tbodyClasses = $derived(cn(tbody(), tbodyClass));
66
- const trClasses = $derived(cn(tr(), trClass));
67
- const thClasses = $derived(cn(th(), thClass));
68
- const tdClasses = $derived(cn(td(), tdClass));
69
- const footerClasses = $derived(cn(footer(), footerClass));
70
- const emptyStateClasses = $derived(emptyState());
62
+ const theadClasses = $derived(cn(theadBaseClass(), theadClass));
63
+ const tbodyClasses = $derived(cn(tbodyBaseClass(), tbodyClass));
64
+ const trClasses = $derived(cn(trBaseClass(), trClass));
65
+ const thClasses = $derived(cn(thBaseClass(), thClass));
66
+ const tdClasses = $derived(cn(tdBaseClass(), tdClass));
67
+ const footerClasses = $derived(cn(footerBaseClass(), footerClass));
68
+ const emptyStateClasses = $derived(emptyStateBaseClass());
71
69
 
72
70
  // Handle pagination
73
71
  const totalPages = $derived(Math.ceil(data.length / pageSize));
@@ -175,12 +173,12 @@
175
173
  {#if column.sortable}
176
174
  <button
177
175
  type="button"
178
- class={sortButton()}
176
+ class={sortButtonBaseClass()}
179
177
  onclick={() => toggleSort(column.sortKey || column.key)}
180
178
  aria-label={`Sort by ${column.header}`}
181
179
  >
182
180
  {column.header}
183
- <span class={sortIcon()}>
181
+ <span class={sortIconBaseClass()}>
184
182
  {#if sortColumn === (column.sortKey || column.key)}
185
183
  {#if sortDirection === 'asc'}
186
184
  <svg
@@ -315,6 +313,13 @@
315
313
  </td>
316
314
  {/each}
317
315
  </tr>
316
+ {#if expandedContent}
317
+ <tr class="expandedContent-row">
318
+ <td colspan={selectable ? columns.length + 1 : columns.length} class="border-0 p-0">
319
+ {@render expandedContent(row)}
320
+ </td>
321
+ </tr>
322
+ {/if}
318
323
  {/each}
319
324
  {/if}
320
325
  </tbody>
@@ -323,7 +328,7 @@
323
328
 
324
329
  {#if pagination && totalPages > 1}
325
330
  <div class={footerClasses}>
326
- <div class={paginationClass}>
331
+ <div class={paginationBaseClass()}>
327
332
  <div class="flex items-center gap-2">
328
333
  <span class="text-default-500 text-sm">
329
334
  Showing {Math.min((currentPage - 1) * pageSize + 1, data.length)}
@@ -1,4 +1,4 @@
1
- import { type TableProps } from './table.js';
1
+ import type { TableProps } from '../../index.js';
2
2
  declare const Table: import("svelte").Component<TableProps<any>, {}, "selected">;
3
3
  type Table = ReturnType<typeof Table>;
4
4
  export default Table;
@@ -1,24 +1,3 @@
1
- import type { ClassValue } from 'tailwind-variants';
2
- import type { Snippet } from 'svelte';
3
- import type { VariantColors, VariantSizes } from '../../types/variants.js';
4
- export type DataRow = Record<string, any>;
5
- export type KeyType = keyof DataRow;
6
- export type StatusType = 'active' | 'inactive' | 'pending' | 'error' | 'default';
7
- export type TableColumn<T extends DataRow = any> = {
8
- key: KeyType;
9
- header: string;
10
- cell?: Snippet<[row: T, key: KeyType, index?: number]>;
11
- sortable?: boolean;
12
- sortKey?: string;
13
- align?: 'left' | 'center' | 'right';
14
- width?: string;
15
- class?: ClassValue;
16
- };
17
- export type SortDirection = 'asc' | 'desc' | null;
18
- export type SortState = {
19
- column: string | null;
20
- direction: SortDirection;
21
- };
22
1
  export declare const table: import("tailwind-variants").TVReturnType<{
23
2
  size: {
24
3
  xs: {
@@ -275,29 +254,3 @@ export declare const table: import("tailwind-variants").TVReturnType<{
275
254
  sortButton: string;
276
255
  sortIcon: string;
277
256
  }, undefined, unknown, unknown, undefined>>;
278
- export type TableProps<T extends DataRow = any> = {
279
- data: T[];
280
- columns: TableColumn<T>[];
281
- color?: VariantColors;
282
- size?: VariantSizes;
283
- bordered?: boolean;
284
- striped?: boolean;
285
- emptyStateText?: string;
286
- pageSize?: number;
287
- selectable?: boolean;
288
- selected?: T[];
289
- class?: ClassValue;
290
- wrapperclass?: ClassValue;
291
- tableclass?: ClassValue;
292
- theadclass?: ClassValue;
293
- tbodyclass?: ClassValue;
294
- trclass?: ClassValue;
295
- thclass?: ClassValue;
296
- tdclass?: ClassValue;
297
- footerclass?: ClassValue;
298
- onrowclick?: (row: T, index: number) => void;
299
- onsort?: (sortState: SortState) => void;
300
- onselect?: (selected: T[]) => void;
301
- rowclass?: (row: T, index: number) => ClassValue;
302
- loading?: boolean;
303
- };
@@ -1,12 +1,4 @@
1
1
  import { tv } from 'tailwind-variants';
2
- // Prebuild Cell rendering options
3
- // Snippet 1 - Date
4
- // Snippet 2 - Currency
5
- // Snippet 3 - Percentage
6
- // Snippet 4 - Phone Number
7
- // Snippet 5 - Email
8
- // Snippet 6 - Status
9
- // Snippet 7 - Time
10
2
  export const table = tv({
11
3
  slots: {
12
4
  base: 'w-full',
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { cn } from '../../helper/cls.js';
3
3
  import Tab from './Tab.svelte';
4
- import { tabs, type TabsProps } from './tabs.js';
4
+ import { tabs, type TabsGroupProps } from './tabs.js';
5
5
  import { setContext } from 'svelte';
6
6
 
7
7
  let {
@@ -14,7 +14,7 @@
14
14
  panelClass = '',
15
15
  onchange = () => {},
16
16
  children
17
- }: TabsProps = $props();
17
+ }: TabsGroupProps = $props();
18
18
 
19
19
  const { base, list, panel } = $derived(
20
20
  tabs({
@@ -1,4 +1,4 @@
1
- import { type TabsProps } from './tabs.js';
2
- declare const TabGroup: import("svelte").Component<TabsProps, {}, "selected">;
1
+ import { type TabsGroupProps } from './tabs.js';
2
+ declare const TabGroup: import("svelte").Component<TabsGroupProps, {}, "selected">;
3
3
  type TabGroup = ReturnType<typeof TabGroup>;
4
4
  export default TabGroup;
@@ -1,6 +1,6 @@
1
1
  import type { ClassValue } from 'tailwind-variants';
2
2
  import type { Component, Snippet } from 'svelte';
3
- import type { VariantColors, VariantSizes } from '../../types/variants.js';
3
+ import type { VariantColors, VariantSizes } from '../../index.js';
4
4
  export type TabItem = {
5
5
  value: string;
6
6
  label: string;
@@ -17,7 +17,7 @@ export type TabProps = {
17
17
  size?: VariantSizes;
18
18
  onclick?: (event: Event) => void;
19
19
  };
20
- export type TabsProps = {
20
+ export type TabsGroupProps = {
21
21
  tabs: TabItem[];
22
22
  selected?: string;
23
23
  color?: VariantColors;
@@ -4,7 +4,8 @@
4
4
  import { fade, scale } from 'svelte/transition';
5
5
  import { quintOut } from 'svelte/easing';
6
6
  import { cn } from '../helper/cls.js';
7
- import { modal, type MakeModalProps } from './modal.js';
7
+ import { modal } from './modal.js';
8
+ import type { MakeModalProps } from '../index.js';
8
9
 
9
10
  let {
10
11
  open = $bindable(false),
@@ -1,4 +1,4 @@
1
- import { type MakeModalProps } from './modal.js';
1
+ import type { MakeModalProps } from '../index.js';
2
2
  declare const Modal: import("svelte").Component<MakeModalProps, {}, "open">;
3
3
  type Modal = ReturnType<typeof Modal>;
4
4
  export default Modal;
@@ -1,5 +1,3 @@
1
- import type { VariantSizes } from '../types/variants.js';
2
- import type { Snippet } from 'svelte';
3
1
  export declare const modal: import("tailwind-variants").TVReturnType<{
4
2
  open: {
5
3
  true: {
@@ -211,24 +209,3 @@ export declare const modal: import("tailwind-variants").TVReturnType<{
211
209
  title: string;
212
210
  closeButton: string;
213
211
  }, undefined, unknown, unknown, undefined>>;
214
- export type MakeModalProps = {
215
- open?: boolean;
216
- onclose?: () => void;
217
- title?: string;
218
- description?: string;
219
- hideCloseButton?: boolean;
220
- closeOnBackdropClick?: boolean;
221
- closeOnEsc?: boolean;
222
- position?: keyof typeof modal.variants.position;
223
- size?: VariantSizes;
224
- class?: string;
225
- backdropclass?: string;
226
- contentclass?: string;
227
- headerclass?: string;
228
- bodyclass?: string;
229
- titleclass?: string;
230
- children?: Snippet;
231
- header?: Snippet;
232
- footer?: Snippet;
233
- custom?: Snippet;
234
- };
@@ -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-gray-200',
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-gray-400 hover:text-gray-500 rounded-md cursor-pointer'
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-gray-200'
68
+ content: 'border border-default-200'
69
69
  },
70
70
  colored: {
71
71
  content: 'border'
@@ -0,0 +1,13 @@
1
+ <script lang="ts">
2
+ import { Toaster as Sonner, type ToasterProps as SonnerProps } from 'svelte-sonner';
3
+
4
+ let restProps: SonnerProps = $props();
5
+ </script>
6
+
7
+ <Sonner
8
+ class="toaster group"
9
+ toastOptions={{
10
+
11
+ }}
12
+ {...restProps}
13
+ />
@@ -0,0 +1,4 @@
1
+ import { Toaster as Sonner, type ToasterProps as SonnerProps } from 'svelte-sonner';
2
+ declare const Sonner: import("svelte").Component<SonnerProps, {}, "">;
3
+ type Sonner = ReturnType<typeof Sonner>;
4
+ export default Sonner;
@@ -1,21 +1 @@
1
- export declare const Color: {
2
- readonly DEFAULT: "default";
3
- readonly PRIMARY: "primary";
4
- readonly SECONDARY: "secondary";
5
- readonly INFO: "info";
6
- readonly SUCCESS: "success";
7
- readonly WARNING: "warning";
8
- readonly DANGER: "danger";
9
- };
10
- export type VariantColors = (typeof Color)[keyof typeof Color];
11
- export declare const Size: {
12
- readonly XS: "xs";
13
- readonly SM: "sm";
14
- readonly BASE: "base";
15
- readonly LG: "lg";
16
- readonly XL: "xl";
17
- readonly XXL: "2xl";
18
- };
19
- export type VariantSizes = (typeof Size)[keyof typeof Size];
20
- export declare const colors: VariantColors[];
21
- export declare const sizes: VariantSizes[];
1
+ export {};
@@ -1,19 +1 @@
1
- export const Color = {
2
- DEFAULT: 'default',
3
- PRIMARY: 'primary',
4
- SECONDARY: 'secondary',
5
- INFO: 'info',
6
- SUCCESS: 'success',
7
- WARNING: 'warning',
8
- DANGER: 'danger'
9
- };
10
- export const Size = {
11
- XS: 'xs',
12
- SM: 'sm',
13
- BASE: 'base',
14
- LG: 'lg',
15
- XL: 'xl',
16
- XXL: '2xl'
17
- };
18
- export const colors = Object.values(Color);
19
- export const sizes = Object.values(Size);
1
+ "use strict";
@@ -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,30 @@
1
+ import type { ChartColors, VariantColors, VariantSizes } from './index.js';
2
+ export declare const Color: {
3
+ DEFAULT: string;
4
+ PRIMARY: string;
5
+ SECONDARY: string;
6
+ INFO: string;
7
+ SUCCESS: string;
8
+ WARNING: string;
9
+ DANGER: string;
10
+ };
11
+ export declare const Size: {
12
+ XS: string;
13
+ SM: string;
14
+ BASE: string;
15
+ LG: string;
16
+ XL: string;
17
+ XXL: string;
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;
28
+ export declare const colors: VariantColors[];
29
+ export declare const sizes: VariantSizes[];
30
+ export declare const chartColors: ("default" | "health" | "property" | "auto" | "life" | "other")[];
@@ -0,0 +1,36 @@
1
+ export const Color = {
2
+ DEFAULT: 'default',
3
+ PRIMARY: 'primary',
4
+ SECONDARY: 'secondary',
5
+ INFO: 'info',
6
+ SUCCESS: 'success',
7
+ WARNING: 'warning',
8
+ DANGER: 'danger'
9
+ };
10
+ export const Size = {
11
+ XS: 'xs',
12
+ SM: 'sm',
13
+ BASE: 'base',
14
+ LG: 'lg',
15
+ XL: 'xl',
16
+ XXL: '2xl'
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
+ };
34
+ export const colors = Object.values(Color);
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.5",
3
+ "version": "0.0.1-dev.50",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/makolabsai/mako-ui-components.git"
7
+ "url": "https://github.com/makolabsai/ripple-ui.git"
8
8
  },
9
9
  "scripts": {
10
10
  "dev": "vite dev",
@@ -63,11 +63,13 @@
63
63
  "publint": "^0.3.2",
64
64
  "svelte": "^5.0.0",
65
65
  "svelte-check": "^4.0.0",
66
+ "sveltekit-superforms": "^2.24.0",
66
67
  "tailwindcss": "^4.0.0",
67
68
  "typescript": "^5.0.0",
68
69
  "typescript-eslint": "^8.20.0",
69
70
  "vite": "^6.0.0",
70
- "vitest": "^3.0.0"
71
+ "vitest": "^3.0.0",
72
+ "zod": "^3.24.2"
71
73
  },
72
74
  "keywords": [
73
75
  "svelte",
@@ -95,7 +97,9 @@
95
97
  "toast"
96
98
  ],
97
99
  "dependencies": {
100
+ "dayjs": "^1.11.13",
98
101
  "echarts": "^5.6.0",
102
+ "svelte-sonner": "^0.3.28",
99
103
  "tailwind-merge": "^3.0.2",
100
104
  "tailwind-variants": "^1.0.0"
101
105
  }
@@ -1 +0,0 @@
1
- export { default as Button } from './Button.svelte';
@@ -1 +0,0 @@
1
- export { default as Button } from './Button.svelte';
@@ -1,2 +0,0 @@
1
- export { default as Drawer } from './Drawer.svelte';
2
- export type { DrawerProps } from './drawer.js';
@@ -1 +0,0 @@
1
- export { default as Drawer } from './Drawer.svelte';
@@ -1,2 +0,0 @@
1
- export { default as Badge } from './Badge.svelte';
2
- export { badge, type BadgeProps } from './badge.js';
@@ -1,2 +0,0 @@
1
- export { default as Badge } from './Badge.svelte';
2
- export { badge } from './badge.js';
@@ -1,3 +0,0 @@
1
- export { default as Select } from './Select.svelte';
2
- export { default as Dropdown } from './Dropdown.svelte';
3
- export type { SelectItem, SelectProps } from './select.js';
@@ -1,2 +0,0 @@
1
- export { default as Select } from './Select.svelte';
2
- export { default as Dropdown } from './Dropdown.svelte';
@@ -1,4 +0,0 @@
1
- export { default as PageHeader } from './PageHeader.svelte';
2
- export type { PageHeaderProps } from './pageheaders.js';
3
- export { default as Breadcrumbs } from './Breadcrumbs.svelte';
4
- export type { BreadcrumbsProps } from './breadcrumbs.js';
@@ -1,2 +0,0 @@
1
- export { default as PageHeader } from './PageHeader.svelte';
2
- export { default as Breadcrumbs } from './Breadcrumbs.svelte';
@@ -1,10 +0,0 @@
1
- import { type ClassValue } from 'tailwind-variants';
2
- import type { BreadcrumbItem } from './breadcrumbs.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
- };