@makolabs/ripple 0.0.1-dev.9 → 0.0.3

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 (78) 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 +877 -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/header/PageHeader.svelte +49 -11
  43. package/dist/index.d.ts +256 -143
  44. package/dist/index.js +19 -2
  45. package/dist/layout/card/MetricCard.svelte +64 -0
  46. package/dist/layout/card/MetricCard.svelte.d.ts +4 -0
  47. package/dist/layout/card/StatsCard.svelte +4 -3
  48. package/dist/layout/card/StatsCard.svelte.d.ts +1 -1
  49. package/dist/layout/card/metric-card.d.ts +49 -0
  50. package/dist/layout/card/metric-card.js +10 -0
  51. package/dist/layout/card/stats-card.d.ts +0 -15
  52. package/dist/layout/card/stats-card.js +1 -1
  53. package/dist/layout/sidebar/NavGroup.svelte +1 -7
  54. package/dist/layout/sidebar/NavItem.svelte +2 -2
  55. package/dist/layout/sidebar/Sidebar.svelte +103 -49
  56. package/dist/layout/table/Table.svelte +465 -88
  57. package/dist/layout/table/Table.svelte.d.ts +1 -1
  58. package/dist/layout/table/table.d.ts +0 -47
  59. package/dist/layout/table/table.js +0 -8
  60. package/dist/layout/tabs/Tab.svelte +9 -6
  61. package/dist/layout/tabs/Tab.svelte.d.ts +1 -1
  62. package/dist/layout/tabs/TabContent.svelte +1 -2
  63. package/dist/layout/tabs/TabContent.svelte.d.ts +1 -1
  64. package/dist/layout/tabs/TabGroup.svelte +10 -5
  65. package/dist/layout/tabs/TabGroup.svelte.d.ts +2 -2
  66. package/dist/layout/tabs/tabs.d.ts +61 -76
  67. package/dist/layout/tabs/tabs.js +170 -28
  68. package/dist/modal/Modal.svelte +3 -3
  69. package/dist/modal/modal.js +3 -3
  70. package/dist/utils/Portal.svelte +108 -0
  71. package/dist/utils/Portal.svelte.d.ts +8 -0
  72. package/dist/utils/dateUtils.d.ts +7 -0
  73. package/dist/utils/dateUtils.js +26 -0
  74. package/dist/variants.d.ts +11 -1
  75. package/dist/variants.js +17 -0
  76. package/package.json +4 -3
  77. package/dist/header/pageheaders.d.ts +0 -10
  78. 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,15 +20,9 @@
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
- `items-center gap-x-3 p-1.5 rounded-md w-full cursor-pointer text-gray-400 text-sm/6 text-left font-medium`,
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`,
32
26
  {
33
27
  'font-semibold ': isActive,
34
28
  hidden: menubar.collapsed,
@@ -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,11 +1,9 @@
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';
6
+ import { goto } from '$app/navigation';
9
7
 
10
8
  let { items = [], logo }: SidebarProps = $props();
11
9
  let menubar: MenuBar = $state({
@@ -13,6 +11,24 @@
13
11
  });
14
12
  setContext('menubar', menubar);
15
13
 
14
+ // Track screen size for responsive behavior
15
+ let isSmallScreen = $state(false);
16
+
17
+ function updateCollapseState() {
18
+ if (typeof window !== 'undefined') {
19
+ isSmallScreen = window.innerWidth < 1280; // xl breakpoint
20
+ if (isSmallScreen && !menubar.collapsed) {
21
+ menubar.collapsed = true;
22
+ }
23
+ }
24
+ }
25
+
26
+ onMount(() => {
27
+ updateCollapseState();
28
+ window.addEventListener('resize', updateCollapseState);
29
+ return () => window.removeEventListener('resize', updateCollapseState);
30
+ });
31
+
16
32
  function toggle() {
17
33
  menubar.collapsed = !menubar.collapsed;
18
34
  }
@@ -27,7 +43,7 @@
27
43
 
28
44
  if ('children' in item) {
29
45
  const parentItem = item as ParentItem;
30
- let anyChildActive = false;
46
+ let anyChildActive = parentItem.active;
31
47
 
32
48
  const updatedChildren = parentItem.children.map((child) => {
33
49
  const childActive = isRouteActive(child.href, true);
@@ -36,7 +52,6 @@
36
52
  }
37
53
  return { ...child, active: childActive };
38
54
  });
39
-
40
55
  return { ...parentItem, active: anyChildActive, children: updatedChildren };
41
56
  }
42
57
 
@@ -50,80 +65,119 @@
50
65
 
51
66
  // Reactively compute the active states based on the current route
52
67
  const navigationItems = $derived(items.map((item) => processNavigationItem(item)));
68
+ $inspect(navigationItems);
53
69
 
54
70
  const sidebarClasses = $derived(
55
71
  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`,
72
+ `min-h-screen flex flex-col bg-gradient-to-b from-gray-900 to-default-900 h-full shrink-0`,
58
73
  {
59
74
  'w-16': menubar.collapsed,
60
- 'w-16 xl:w-72 shrink-0': !menubar.collapsed
75
+ 'w-64': !menubar.collapsed
61
76
  }
62
77
  )
63
78
  );
64
79
 
65
- const logoTextClasses = $derived(
66
- clsx('text-xl font-semibold hidden text-white truncate', { 'xl:block': !menubar.collapsed })
67
- );
68
-
69
80
  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
- })
81
+ clsx(
82
+ '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',
83
+ {
84
+ 'justify-between': !menubar.collapsed,
85
+ 'justify-center': menubar.collapsed
86
+ }
87
+ )
73
88
  );
74
89
  </script>
75
90
 
76
91
  <div class={sidebarClasses}>
77
92
  <div class={logoWrapperClasses}>
78
93
  <div class="flex items-center gap-x-1">
79
- {#if logo.src}
94
+ {#if logo.src && !menubar.collapsed}
80
95
  <img src={logo.src} alt={logo.title} class="size-8 shrink-0" />
81
96
  {/if}
82
- {#if logo.title}
83
- <h1 class={logoTextClasses}>{logo.title}</h1>
97
+ {#if logo.title && !menubar.collapsed}
98
+ <h1 class="text-xl font-bold text-white">{logo.title}</h1>
84
99
  {/if}
85
100
  </div>
86
- <button onclick={toggle} class="hidden cursor-pointer xl:block" aria-label="Toggle Sidebar">
101
+ <button
102
+ onclick={toggle}
103
+ class="cursor-pointer text-white {isSmallScreen
104
+ ? 'block'
105
+ : menubar.collapsed
106
+ ? 'block'
107
+ : 'hidden xl:block'}"
108
+ aria-label="Toggle Sidebar"
109
+ >
87
110
  {@render ToggleIcon()}
88
111
  </button>
89
112
  </div>
90
- <nav class="flex flex-1 flex-col">
91
- <ul role="list" class="flex flex-1 flex-col gap-y-1">
113
+
114
+ <div class="flex flex-1 flex-col overflow-y-auto bg-gradient-to-b from-transparent to-black/20">
115
+ <nav class="flex-1 space-y-6 px-2 py-4">
92
116
  {#each navigationItems as item, index (index)}
93
117
  {#if 'type' in item && item.type === 'horizontal-divider'}
94
- <li class="my-3 border-t border-gray-700"></li>
118
+ <li class="my-2 border-t border-white/10"></li>
95
119
  {: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>
120
+ <div>
121
+ {#if !menubar.collapsed}
122
+ <h3 class="text-default-200 px-3 text-xs font-semibold tracking-wider uppercase">
123
+ {item.label}
124
+ </h3>
125
+ {/if}
126
+ <div class={menubar.collapsed ? '' : 'mt-2 space-y-1'}>
127
+ {#each item.children as child (child.label)}
128
+ <button
129
+ 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
130
+ ? 'bg-default-500/20'
131
+ : ''} {menubar.collapsed ? 'justify-center' : ''}"
132
+ class:text-white={child.active}
133
+ class:text-gray-300={!child.active}
134
+ onclick={() => goto(child.href)}
135
+ title={menubar.collapsed ? child.label : ''}
136
+ >
137
+ {#if child.Icon}
138
+ {@const Icon = child.Icon}
139
+ <Icon
140
+ class="h-5 w-5 flex-shrink-0 {child.active
141
+ ? 'text-default-200'
142
+ : 'text-gray-400'} {menubar.collapsed ? '' : 'mr-3'}"
143
+ />
144
+ {/if}
145
+ {#if !menubar.collapsed}
146
+ <span class="truncate">{child.label}</span>
147
+ {/if}
148
+ </button>
149
+ {/each}
150
+ </div>
151
+ </div>
110
152
  {: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>
153
+ <button
154
+ 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
155
+ ? 'bg-default-500/20'
156
+ : ''} {menubar.collapsed ? 'justify-center' : ''}"
157
+ class:text-white={item.active}
158
+ class:text-gray-300={!item.active}
159
+ onclick={() => (window.location.href = item.href)}
160
+ title={menubar.collapsed ? item.label : ''}
161
+ >
162
+ {#if item.Icon}
163
+ {@const Icon = item.Icon}
164
+ <Icon
165
+ class="h-5 w-5 flex-shrink-0 {item.active
166
+ ? 'text-default-200'
167
+ : 'text-gray-400'} {menubar.collapsed ? '' : 'mr-3'}"
168
+ />
169
+ {/if}
170
+ {#if !menubar.collapsed}
171
+ <span class="truncate">{item.label}</span>
172
+ {/if}
173
+ </button>
120
174
  {/if}
121
175
  {/each}
122
- </ul>
123
- </nav>
176
+ </nav>
177
+ </div>
124
178
  </div>
125
179
 
126
- {#snippet ToggleIcon(classes = 'size-6 shrink-0 text-gray-600')}
180
+ {#snippet ToggleIcon(classes = 'size-6 shrink-0 text-default-200')}
127
181
  <svg
128
182
  xmlns="http://www.w3.org/2000/svg"
129
183
  width="0.8em"