@makolabs/ripple 0.0.1-dev.8 → 0.0.1-dev.80

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 (77) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/storage/BaseAdapter.d.ts +20 -0
  3. package/dist/adapters/storage/BaseAdapter.js +171 -0
  4. package/dist/adapters/storage/S3Adapter.d.ts +21 -0
  5. package/dist/adapters/storage/S3Adapter.js +194 -0
  6. package/dist/adapters/storage/index.d.ts +3 -0
  7. package/dist/adapters/storage/index.js +3 -0
  8. package/dist/adapters/storage/types.d.ts +102 -0
  9. package/dist/adapters/storage/types.js +4 -0
  10. package/dist/charts/Chart.svelte +59 -47
  11. package/dist/charts/Chart.svelte.d.ts +1 -1
  12. package/dist/drawer/drawer.js +3 -3
  13. package/dist/elements/accordion/Accordion.svelte +98 -0
  14. package/dist/elements/accordion/Accordion.svelte.d.ts +4 -0
  15. package/dist/elements/accordion/accordion.d.ts +227 -0
  16. package/dist/elements/accordion/accordion.js +138 -0
  17. package/dist/elements/alert/Alert.svelte +7 -3
  18. package/dist/elements/dropdown/Dropdown.svelte +74 -107
  19. package/dist/elements/dropdown/Select.svelte +81 -62
  20. package/dist/elements/dropdown/dropdown.js +1 -1
  21. package/dist/elements/dropdown/select.js +8 -8
  22. package/dist/elements/file-upload/FileUpload.svelte +17 -95
  23. package/dist/elements/file-upload/FilesPreview.svelte +93 -0
  24. package/dist/elements/file-upload/FilesPreview.svelte.d.ts +4 -0
  25. package/dist/elements/progress/Progress.svelte +83 -25
  26. package/dist/file-browser/FileBrowser.svelte +837 -0
  27. package/dist/file-browser/FileBrowser.svelte.d.ts +14 -0
  28. package/dist/file-browser/index.d.ts +1 -0
  29. package/dist/file-browser/index.js +1 -0
  30. package/dist/filters/CompactFilters.svelte +147 -0
  31. package/dist/filters/CompactFilters.svelte.d.ts +4 -0
  32. package/dist/filters/index.d.ts +1 -0
  33. package/dist/filters/index.js +1 -0
  34. package/dist/forms/Checkbox.svelte +2 -2
  35. package/dist/forms/DateRange.svelte +21 -21
  36. package/dist/forms/Input.svelte +3 -3
  37. package/dist/forms/NumberInput.svelte +1 -1
  38. package/dist/forms/RadioInputs.svelte +3 -3
  39. package/dist/forms/Tags.svelte +5 -5
  40. package/dist/forms/Toggle.svelte +3 -3
  41. package/dist/forms/slider.js +4 -4
  42. package/dist/index.d.ts +254 -143
  43. package/dist/index.js +19 -2
  44. package/dist/layout/card/MetricCard.svelte +64 -0
  45. package/dist/layout/card/MetricCard.svelte.d.ts +4 -0
  46. package/dist/layout/card/StatsCard.svelte +4 -3
  47. package/dist/layout/card/StatsCard.svelte.d.ts +1 -1
  48. package/dist/layout/card/metric-card.d.ts +49 -0
  49. package/dist/layout/card/metric-card.js +10 -0
  50. package/dist/layout/card/stats-card.d.ts +0 -15
  51. package/dist/layout/card/stats-card.js +1 -1
  52. package/dist/layout/sidebar/NavGroup.svelte +8 -9
  53. package/dist/layout/sidebar/NavItem.svelte +2 -2
  54. package/dist/layout/sidebar/Sidebar.svelte +102 -49
  55. package/dist/layout/table/Table.svelte +464 -87
  56. package/dist/layout/table/Table.svelte.d.ts +1 -1
  57. package/dist/layout/table/table.d.ts +0 -47
  58. package/dist/layout/table/table.js +0 -8
  59. package/dist/layout/tabs/Tab.svelte +9 -6
  60. package/dist/layout/tabs/Tab.svelte.d.ts +1 -1
  61. package/dist/layout/tabs/TabContent.svelte +1 -2
  62. package/dist/layout/tabs/TabContent.svelte.d.ts +1 -1
  63. package/dist/layout/tabs/TabGroup.svelte +10 -5
  64. package/dist/layout/tabs/TabGroup.svelte.d.ts +2 -2
  65. package/dist/layout/tabs/tabs.d.ts +61 -76
  66. package/dist/layout/tabs/tabs.js +170 -28
  67. package/dist/modal/Modal.svelte +3 -3
  68. package/dist/modal/modal.js +3 -3
  69. package/dist/utils/Portal.svelte +108 -0
  70. package/dist/utils/Portal.svelte.d.ts +8 -0
  71. package/dist/utils/dateUtils.d.ts +7 -0
  72. package/dist/utils/dateUtils.js +26 -0
  73. package/dist/variants.d.ts +11 -1
  74. package/dist/variants.js +17 -0
  75. package/package.json +2 -2
  76. package/dist/header/pageheaders.d.ts +0 -10
  77. package/dist/header/pageheaders.js +0 -1
@@ -0,0 +1,49 @@
1
+ export declare const metricCard: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-merge").ClassNameValue | {
4
+ base?: import("tailwind-merge").ClassNameValue;
5
+ value?: import("tailwind-merge").ClassNameValue;
6
+ title?: import("tailwind-merge").ClassNameValue;
7
+ progress?: import("tailwind-merge").ClassNameValue;
8
+ detail?: import("tailwind-merge").ClassNameValue;
9
+ };
10
+ };
11
+ } | {
12
+ [x: string]: {
13
+ [x: string]: import("tailwind-merge").ClassNameValue | {
14
+ base?: import("tailwind-merge").ClassNameValue;
15
+ value?: import("tailwind-merge").ClassNameValue;
16
+ title?: import("tailwind-merge").ClassNameValue;
17
+ progress?: import("tailwind-merge").ClassNameValue;
18
+ detail?: import("tailwind-merge").ClassNameValue;
19
+ };
20
+ };
21
+ } | {}, {
22
+ base: string;
23
+ title: string;
24
+ value: string;
25
+ detail: string;
26
+ progress: string;
27
+ }, undefined, {
28
+ [key: string]: {
29
+ [key: string]: import("tailwind-merge").ClassNameValue | {
30
+ base?: import("tailwind-merge").ClassNameValue;
31
+ value?: import("tailwind-merge").ClassNameValue;
32
+ title?: import("tailwind-merge").ClassNameValue;
33
+ progress?: import("tailwind-merge").ClassNameValue;
34
+ detail?: import("tailwind-merge").ClassNameValue;
35
+ };
36
+ };
37
+ } | {}, {
38
+ base: string;
39
+ title: string;
40
+ value: string;
41
+ detail: string;
42
+ progress: string;
43
+ }, import("tailwind-variants").TVReturnType<unknown, {
44
+ base: string;
45
+ title: string;
46
+ value: string;
47
+ detail: string;
48
+ progress: string;
49
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,10 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const metricCard = tv({
3
+ slots: {
4
+ base: 'bg-white rounded-lg border border-default-200 p-6 shadow-sm hover:shadow-md transition-shadow',
5
+ title: 'text-sm text-default-500',
6
+ value: 'text-3xl font-bold text-default-900 mt-2',
7
+ detail: 'mt-3 space-y-1',
8
+ progress: 'mt-auto'
9
+ }
10
+ });
@@ -1,6 +1,3 @@
1
- import type { ClassValue } from 'tailwind-variants';
2
- import type { Snippet } from 'svelte';
3
- import type { VariantColors } from '../../index.js';
4
1
  import { Color } from '../../variants.js';
5
2
  export declare const statsCard: import("tailwind-variants").TVReturnType<{
6
3
  color: {
@@ -192,15 +189,3 @@ export declare const statsCard: import("tailwind-variants").TVReturnType<{
192
189
  previousValue: string;
193
190
  unit: string;
194
191
  }, undefined, unknown, unknown, undefined>>;
195
- export type StatsCardProps = {
196
- label?: string;
197
- value?: string | number;
198
- previousValue?: string | number;
199
- previousValuePrefix?: string;
200
- trend?: number;
201
- color?: VariantColors;
202
- chartData?: number[];
203
- children?: Snippet;
204
- class?: ClassValue;
205
- formatLargeNumbers?: boolean;
206
- };
@@ -62,7 +62,7 @@ export const statsCard = tv({
62
62
  trend: 'text-danger-600'
63
63
  },
64
64
  neutral: {
65
- trend: 'text-gray-600'
65
+ trend: 'text-default-600'
66
66
  }
67
67
  }
68
68
  },
@@ -20,16 +20,14 @@
20
20
 
21
21
  const menubar: MenuBar = getContext('menubar');
22
22
 
23
- $effect(() => {
24
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
25
- menubar.collapsed;
26
- resetIsActive();
27
- });
28
-
29
23
  const navGroupClasses = $derived(
30
24
  cn(
31
- `hidden xl:flex items-center gap-x-3 p-1.5 rounded-md w-full cursor-pointer text-gray-400 text-sm/6 text-left font-medium`,
32
- { 'font-semibold ': isActive },
25
+ `items-center gap-x-3 p-1.5 rounded-md w-full cursor-pointer text-default-400 text-sm/6 text-left font-medium`,
26
+ {
27
+ 'font-semibold ': isActive,
28
+ hidden: menubar.collapsed,
29
+ 'hidden xl:flex': !menubar.collapsed
30
+ },
33
31
  className
34
32
  )
35
33
  );
@@ -58,7 +56,8 @@
58
56
  const topDivClasses = $derived(
59
57
  cn('overflow-hidden transition-all duration-200', {
60
58
  'bg-transparent mt-0 mt-1 w-auto': !menubar.collapsed,
61
- 'xl:hidden': !isActive
59
+ 'xl:hidden': !isActive,
60
+ 'hidden xl:block': menubar.collapsed
62
61
  })
63
62
  );
64
63
  </script>
@@ -10,8 +10,8 @@
10
10
 
11
11
  const navItemClasses = $derived(
12
12
  cn([
13
- 'group flex gap-x-3 p-2 rounded-md text-gray-400 text-sm/6',
14
- { 'bg-gray-950 font-semibold': active, 'hover:bg-gray-950': !active },
13
+ 'group flex gap-x-3 p-2 rounded-md text-default-400 text-sm/6',
14
+ { 'bg-default-950 font-semibold': active, 'hover:bg-default-950': !active },
15
15
  className
16
16
  ])
17
17
  );
@@ -1,10 +1,7 @@
1
1
  <script lang="ts">
2
- import NavGroup from './NavGroup.svelte';
3
- import NavItem from './NavItem.svelte';
4
- import { setContext } from 'svelte';
2
+ import { setContext, onMount } from 'svelte';
5
3
  import type { MenuBar, NavigationItem, SidebarProps, ParentItem, LinkItem } from '../../index.js';
6
4
  import clsx from 'clsx';
7
- import { cn } from '../../helper/cls.js';
8
5
  import { isRouteActive } from '../../helper/nav.svelte.js';
9
6
 
10
7
  let { items = [], logo }: SidebarProps = $props();
@@ -13,6 +10,24 @@
13
10
  });
14
11
  setContext('menubar', menubar);
15
12
 
13
+ // Track screen size for responsive behavior
14
+ let isSmallScreen = $state(false);
15
+
16
+ function updateCollapseState() {
17
+ if (typeof window !== 'undefined') {
18
+ isSmallScreen = window.innerWidth < 1280; // xl breakpoint
19
+ if (isSmallScreen && !menubar.collapsed) {
20
+ menubar.collapsed = true;
21
+ }
22
+ }
23
+ }
24
+
25
+ onMount(() => {
26
+ updateCollapseState();
27
+ window.addEventListener('resize', updateCollapseState);
28
+ return () => window.removeEventListener('resize', updateCollapseState);
29
+ });
30
+
16
31
  function toggle() {
17
32
  menubar.collapsed = !menubar.collapsed;
18
33
  }
@@ -27,7 +42,7 @@
27
42
 
28
43
  if ('children' in item) {
29
44
  const parentItem = item as ParentItem;
30
- let anyChildActive = false;
45
+ let anyChildActive = parentItem.active;
31
46
 
32
47
  const updatedChildren = parentItem.children.map((child) => {
33
48
  const childActive = isRouteActive(child.href, true);
@@ -36,7 +51,6 @@
36
51
  }
37
52
  return { ...child, active: childActive };
38
53
  });
39
-
40
54
  return { ...parentItem, active: anyChildActive, children: updatedChildren };
41
55
  }
42
56
 
@@ -50,80 +64,119 @@
50
64
 
51
65
  // Reactively compute the active states based on the current route
52
66
  const navigationItems = $derived(items.map((item) => processNavigationItem(item)));
67
+ $inspect(navigationItems);
53
68
 
54
69
  const sidebarClasses = $derived(
55
70
  clsx(
56
- `flex min-h-screen max-h-screen overflow-y-auto flex-col gap-y-1 overflow-y-auto
57
- border-r border-gray-800 bg-gray-900 px-3 duration-300 sticky top-0`,
71
+ `min-h-screen flex flex-col bg-gradient-to-b from-gray-900 to-default-900 h-full shrink-0`,
58
72
  {
59
73
  'w-16': menubar.collapsed,
60
- 'w-16 xl:w-72 shrink-0': !menubar.collapsed
74
+ 'w-64': !menubar.collapsed
61
75
  }
62
76
  )
63
77
  );
64
78
 
65
- const logoTextClasses = $derived(
66
- clsx('text-xl font-semibold hidden text-white', { 'xl:block': !menubar.collapsed })
67
- );
68
-
69
79
  const logoWrapperClasses = $derived(
70
- clsx('flex shrink-0 items-center justify-between mt-3 flex-col', {
71
- 'xl:mt-0 xl:h-16 flex-row': !menubar.collapsed
72
- })
80
+ clsx(
81
+ 'flex items-center h-16 flex-shrink-0 px-4 bg-gradient-to-r from-gray-900 to-default-900/50 border-b border-white/10',
82
+ {
83
+ 'justify-between': !menubar.collapsed,
84
+ 'justify-center': menubar.collapsed
85
+ }
86
+ )
73
87
  );
74
88
  </script>
75
89
 
76
90
  <div class={sidebarClasses}>
77
91
  <div class={logoWrapperClasses}>
78
92
  <div class="flex items-center gap-x-1">
79
- {#if logo.src}
93
+ {#if logo.src && !menubar.collapsed}
80
94
  <img src={logo.src} alt={logo.title} class="size-8 shrink-0" />
81
95
  {/if}
82
- {#if logo.title}
83
- <h1 class={logoTextClasses}>{logo.title}</h1>
96
+ {#if logo.title && !menubar.collapsed}
97
+ <h1 class="text-xl font-bold text-white">{logo.title}</h1>
84
98
  {/if}
85
99
  </div>
86
- <button onclick={toggle} class="hidden cursor-pointer xl:block" aria-label="Toggle Sidebar">
100
+ <button
101
+ onclick={toggle}
102
+ class="cursor-pointer text-white {isSmallScreen
103
+ ? 'block'
104
+ : menubar.collapsed
105
+ ? 'block'
106
+ : 'hidden xl:block'}"
107
+ aria-label="Toggle Sidebar"
108
+ >
87
109
  {@render ToggleIcon()}
88
110
  </button>
89
111
  </div>
90
- <nav class="flex flex-1 flex-col">
91
- <ul role="list" class="flex flex-1 flex-col gap-y-1">
112
+
113
+ <div class="flex flex-1 flex-col overflow-y-auto bg-gradient-to-b from-transparent to-black/20">
114
+ <nav class="flex-1 space-y-6 px-2 py-4">
92
115
  {#each navigationItems as item, index (index)}
93
116
  {#if 'type' in item && item.type === 'horizontal-divider'}
94
- <li class="my-3 border-t border-gray-700"></li>
117
+ <li class="my-2 border-t border-white/10"></li>
95
118
  {:else if 'children' in item}
96
- <NavGroup active={item.active}>
97
- {#snippet labelArea(classes)}
98
- <span class={classes}>{item.label}</span>
99
- {/snippet}
100
- {#each item.children as child (child.label)}
101
- <NavItem href={child.href} active={child.active}>
102
- {#if child.Icon}
103
- {@const Icon = child.Icon}
104
- <Icon class="size-6 shrink-0 text-gray-600" />
105
- {/if}
106
- <span class="truncate">{child.label}</span>
107
- </NavItem>
108
- {/each}
109
- </NavGroup>
119
+ <div>
120
+ {#if !menubar.collapsed}
121
+ <h3 class="text-default-200 px-3 text-xs font-semibold tracking-wider uppercase">
122
+ {item.label}
123
+ </h3>
124
+ {/if}
125
+ <div class={menubar.collapsed ? '' : 'mt-2 space-y-1'}>
126
+ {#each item.children as child (child.label)}
127
+ <button
128
+ class="group hover:bg-default-500/10 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm font-medium transition-all duration-150 ease-in-out hover:text-white {child.active
129
+ ? 'bg-default-500/20'
130
+ : ''} {menubar.collapsed ? 'justify-center' : ''}"
131
+ class:text-white={child.active}
132
+ class:text-gray-300={!child.active}
133
+ onclick={() => (window.location.href = child.href)}
134
+ title={menubar.collapsed ? child.label : ''}
135
+ >
136
+ {#if child.Icon}
137
+ {@const Icon = child.Icon}
138
+ <Icon
139
+ class="h-5 w-5 flex-shrink-0 {child.active
140
+ ? 'text-default-200'
141
+ : 'text-gray-400'} {menubar.collapsed ? '' : 'mr-3'}"
142
+ />
143
+ {/if}
144
+ {#if !menubar.collapsed}
145
+ <span class="truncate">{child.label}</span>
146
+ {/if}
147
+ </button>
148
+ {/each}
149
+ </div>
150
+ </div>
110
151
  {:else if 'href' in item}
111
- <NavItem href={item.href} active={item.active}>
112
- {#snippet children(classes)}
113
- {#if item.Icon}
114
- {@const Icon = item.Icon}
115
- <Icon class="size-6 shrink-0 text-gray-600" />
116
- {/if}
117
- <span class={cn(classes)}>{item.label}</span>
118
- {/snippet}
119
- </NavItem>
152
+ <button
153
+ class="group hover:bg-default-500/10 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm font-medium transition-all duration-150 ease-in-out hover:text-white {item.active
154
+ ? 'bg-default-500/20'
155
+ : ''} {menubar.collapsed ? 'justify-center' : ''}"
156
+ class:text-white={item.active}
157
+ class:text-gray-300={!item.active}
158
+ onclick={() => (window.location.href = item.href)}
159
+ title={menubar.collapsed ? item.label : ''}
160
+ >
161
+ {#if item.Icon}
162
+ {@const Icon = item.Icon}
163
+ <Icon
164
+ class="h-5 w-5 flex-shrink-0 {item.active
165
+ ? 'text-default-200'
166
+ : 'text-gray-400'} {menubar.collapsed ? '' : 'mr-3'}"
167
+ />
168
+ {/if}
169
+ {#if !menubar.collapsed}
170
+ <span class="truncate">{item.label}</span>
171
+ {/if}
172
+ </button>
120
173
  {/if}
121
174
  {/each}
122
- </ul>
123
- </nav>
175
+ </nav>
176
+ </div>
124
177
  </div>
125
178
 
126
- {#snippet ToggleIcon(classes = 'size-6 shrink-0 text-gray-600')}
179
+ {#snippet ToggleIcon(classes = 'size-6 shrink-0 text-default-200')}
127
180
  <svg
128
181
  xmlns="http://www.w3.org/2000/svg"
129
182
  width="0.8em"