svelora 3.0.8 → 3.0.11

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.
@@ -16,6 +16,18 @@ export type NavigationMenuItemType = {
16
16
  * Optional icon to display before the label.
17
17
  */
18
18
  icon?: string;
19
+ /**
20
+ * If true, the item will only be active if the current path matches the item's href exactly.
21
+ * If false, it will be active if the current path starts with the item's href.
22
+ * Defaults to true.
23
+ */
24
+ exact?: boolean;
25
+ /**
26
+ * Optional pattern to use for active state matching instead of the href.
27
+ * Useful when href points to a subpage (e.g. /docs/components/button)
28
+ * but you want it to match any page in the section (e.g. /docs/components).
29
+ */
30
+ matchPattern?: string;
19
31
  /**
20
32
  * Optional badge text/number to display after the label.
21
33
  */
@@ -88,6 +100,11 @@ export type NavigationMenuProps = {
88
100
  * @default false
89
101
  */
90
102
  accordion?: boolean;
103
+ /**
104
+ * Enable tree line styling for vertical accordion mode.
105
+ * @default false
106
+ */
107
+ tree?: boolean;
91
108
  /**
92
109
  * Additional CSS classes.
93
110
  */
@@ -30,6 +30,18 @@ export declare const navigationMenuVariants: import("tailwind-variants").TVRetur
30
30
  };
31
31
  false: {};
32
32
  };
33
+ collapsed: {
34
+ true: {
35
+ item: string;
36
+ icon: string;
37
+ };
38
+ };
39
+ tree: {
40
+ true: {
41
+ accordionGroupContent: string;
42
+ };
43
+ false: {};
44
+ };
33
45
  }, {
34
46
  base: string;
35
47
  group: string;
@@ -69,6 +81,18 @@ export declare const navigationMenuVariants: import("tailwind-variants").TVRetur
69
81
  };
70
82
  false: {};
71
83
  };
84
+ collapsed: {
85
+ true: {
86
+ item: string;
87
+ icon: string;
88
+ };
89
+ };
90
+ tree: {
91
+ true: {
92
+ accordionGroupContent: string;
93
+ };
94
+ false: {};
95
+ };
72
96
  }, {
73
97
  base: string;
74
98
  group: string;
@@ -108,6 +132,18 @@ export declare const navigationMenuVariants: import("tailwind-variants").TVRetur
108
132
  };
109
133
  false: {};
110
134
  };
135
+ collapsed: {
136
+ true: {
137
+ item: string;
138
+ icon: string;
139
+ };
140
+ };
141
+ tree: {
142
+ true: {
143
+ accordionGroupContent: string;
144
+ };
145
+ false: {};
146
+ };
111
147
  }, {
112
148
  base: string;
113
149
  group: string;
@@ -54,11 +54,34 @@ export const navigationMenuVariants = tv({
54
54
  accordionTrigger: 'bg-primary-container text-on-primary-container'
55
55
  },
56
56
  false: {}
57
+ },
58
+ collapsed: {
59
+ true: {
60
+ item: 'w-10 h-10 justify-center p-0 aspect-square shrink-0',
61
+ icon: 'text-[1.25rem] m-0'
62
+ }
63
+ },
64
+ tree: {
65
+ true: {
66
+ accordionGroupContent: 'pl-2 ml-6 border-l border-outline-variant/50 relative'
67
+ },
68
+ false: {}
57
69
  }
58
70
  },
71
+ compoundVariants: [
72
+ {
73
+ active: true,
74
+ tree: true,
75
+ class: {
76
+ item: 'border-primary',
77
+ accordionTrigger: 'border-primary bg-primary/10 text-primary'
78
+ }
79
+ }
80
+ ],
59
81
  defaultVariants: {
60
82
  variant: 'default',
61
83
  active: false,
62
- orientation: 'horizontal'
84
+ orientation: 'horizontal',
85
+ tree: false
63
86
  }
64
87
  });
@@ -6,25 +6,25 @@ let styles = $derived(sidebarVariants({
6
6
  collapsed,
7
7
  position
8
8
  }));
9
- // Provide context to children (like Menu) so they know if sidebar is collapsed
10
- // Useful if we want the Menu to hide labels when collapsed
9
+ // Provide context to children (like Menu) so they know if sidebar is collapsed or right-aligned
11
10
  setContext("sidebar-collapsed", () => collapsed);
11
+ setContext("sidebar-position", () => position);
12
12
  </script>
13
13
 
14
14
  <aside class={twMerge(styles.base(), className)} {...restProps}>
15
15
  {#if header}
16
16
  <div class={styles.header()}>
17
- {@render header()}
17
+ {@render header({ collapsed })}
18
18
  </div>
19
19
  {/if}
20
20
 
21
21
  <div class={styles.content()}>
22
- {@render children?.()}
22
+ {@render children?.({ collapsed })}
23
23
  </div>
24
24
 
25
25
  {#if footer}
26
26
  <div class={styles.footer()}>
27
- {@render footer()}
27
+ {@render footer({ collapsed })}
28
28
  </div>
29
29
  {/if}
30
30
  </aside>
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import type { SidebarVariantProps } from './sidebar.variants.js';
4
- export interface SidebarProps extends HTMLAttributes<HTMLElement> {
4
+ export interface SidebarProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
5
5
  /**
6
6
  * Whether the sidebar is collapsed (icons only).
7
7
  * @default false
@@ -19,13 +19,19 @@ export interface SidebarProps extends HTMLAttributes<HTMLElement> {
19
19
  /**
20
20
  * Snippet for the top header section (e.g. Logo).
21
21
  */
22
- header?: Snippet;
22
+ header?: Snippet<[{
23
+ collapsed: boolean;
24
+ }]>;
23
25
  /**
24
26
  * Snippet for the main content (e.g. Navigation Menu).
25
27
  */
26
- children?: Snippet;
28
+ children?: Snippet<[{
29
+ collapsed: boolean;
30
+ }]>;
27
31
  /**
28
32
  * Snippet for the bottom footer section (e.g. User Profile).
29
33
  */
30
- footer?: Snippet;
34
+ footer?: Snippet<[{
35
+ collapsed: boolean;
36
+ }]>;
31
37
  }
@@ -11,9 +11,15 @@ export declare const sidebarVariants: import("tailwind-variants").TVReturnType<{
11
11
  collapsed: {
12
12
  true: {
13
13
  base: string;
14
+ header: string;
15
+ content: string;
16
+ footer: string;
14
17
  };
15
18
  false: {
16
19
  base: string;
20
+ header: string;
21
+ content: string;
22
+ footer: string;
17
23
  };
18
24
  };
19
25
  }, {
@@ -33,9 +39,15 @@ export declare const sidebarVariants: import("tailwind-variants").TVReturnType<{
33
39
  collapsed: {
34
40
  true: {
35
41
  base: string;
42
+ header: string;
43
+ content: string;
44
+ footer: string;
36
45
  };
37
46
  false: {
38
47
  base: string;
48
+ header: string;
49
+ content: string;
50
+ footer: string;
39
51
  };
40
52
  };
41
53
  }, {
@@ -55,9 +67,15 @@ export declare const sidebarVariants: import("tailwind-variants").TVReturnType<{
55
67
  collapsed: {
56
68
  true: {
57
69
  base: string;
70
+ header: string;
71
+ content: string;
72
+ footer: string;
58
73
  };
59
74
  false: {
60
75
  base: string;
76
+ header: string;
77
+ content: string;
78
+ footer: string;
61
79
  };
62
80
  };
63
81
  }, {
@@ -1,10 +1,10 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const sidebarVariants = tv({
3
3
  slots: {
4
- base: 'flex flex-col h-full bg-surface-50 dark:bg-surface-900 border-outline-variant text-surface-900 dark:text-surface-50 transition-all duration-300',
5
- header: 'flex items-center px-4 h-16 shrink-0 border-b border-outline-variant',
6
- content: 'flex-1 overflow-y-auto px-3 py-4',
7
- footer: 'p-4 mt-auto border-t border-outline-variant shrink-0'
4
+ base: 'flex flex-col h-full bg-surface-container-low border-outline-variant/60 text-on-surface transition-[width] duration-300 ease-in-out',
5
+ header: 'flex items-center shrink-0 border-b border-outline-variant/60 transition-[padding] duration-300 h-16',
6
+ content: 'flex-1 overflow-y-auto py-4 transition-[padding] duration-300',
7
+ footer: 'mt-auto border-t border-outline-variant/60 shrink-0 transition-[padding] duration-300'
8
8
  },
9
9
  variants: {
10
10
  position: {
@@ -12,8 +12,18 @@ export const sidebarVariants = tv({
12
12
  right: { base: 'border-l' }
13
13
  },
14
14
  collapsed: {
15
- true: { base: 'w-16' },
16
- false: { base: 'w-64' }
15
+ true: {
16
+ base: 'w-[64px]',
17
+ header: 'px-3 justify-center',
18
+ content: 'px-3 flex flex-col items-center',
19
+ footer: 'p-3 flex flex-col items-center justify-center gap-4'
20
+ },
21
+ false: {
22
+ base: 'w-64',
23
+ header: 'px-4',
24
+ content: 'px-3',
25
+ footer: 'p-4'
26
+ }
17
27
  }
18
28
  },
19
29
  defaultVariants: {
@@ -0,0 +1,38 @@
1
+ <script lang="ts" module>export {};
2
+ </script>
3
+
4
+ <script lang="ts">import { fly } from "svelte/transition";
5
+ import { tableBulkActionBarVariants } from "./table-bulk-action-bar.variants.js";
6
+ import Button from "../Button/Button.svelte";
7
+ let { count, onClear, text = "items selected", class: className, ui, children, ...restProps } = $props();
8
+ const slots = $derived(tableBulkActionBarVariants());
9
+ </script>
10
+
11
+ <div
12
+ class={slots.root({ class: [ui?.root, className] })}
13
+ transition:fly={{ y: 20, duration: 250 }}
14
+ {...restProps}
15
+ >
16
+ <div class={slots.content({ class: ui?.content })}>
17
+ <span class={slots.countBadge({ class: ui?.countBadge })}>{count}</span>
18
+ <span class="opacity-90">{text}</span>
19
+ </div>
20
+
21
+ {#if children}
22
+ <div class={slots.actions({ class: ui?.actions })}>
23
+ {@render children()}
24
+ </div>
25
+ {/if}
26
+
27
+ <div class={slots.clearButton({ class: ui?.clearButton })}>
28
+ <Button
29
+ variant="ghost"
30
+ color="surface"
31
+ size="sm"
32
+ icon="lucide:x"
33
+ onclick={onClear}
34
+ class="h-8 w-8 !p-0 rounded-full"
35
+ aria-label="Clear selection"
36
+ />
37
+ </div>
38
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { TableBulkActionBarProps } from './table-bulk-action-bar.types.js';
2
+ export type Props = TableBulkActionBarProps;
3
+ declare const TableBulkActionBar: import("svelte").Component<TableBulkActionBarProps, {}, "">;
4
+ type TableBulkActionBar = ReturnType<typeof TableBulkActionBar>;
5
+ export default TableBulkActionBar;
@@ -1,2 +1,4 @@
1
1
  export { default as Table } from './Table.svelte';
2
+ export { default as TableBulkActionBar } from './TableBulkActionBar.svelte';
2
3
  export type { SortState, TableCellSlotProps, TableColumn, TableFooterSlotProps, TableHeaderSlotProps, TableProps } from './table.types.js';
4
+ export type { TableBulkActionBarProps } from './table-bulk-action-bar.types.js';
@@ -1 +1,2 @@
1
1
  export { default as Table } from './Table.svelte';
2
+ export { default as TableBulkActionBar } from './TableBulkActionBar.svelte';
@@ -0,0 +1,31 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ClassNameValue } from 'tailwind-merge';
3
+ import type { TableBulkActionBarSlots } from './table-bulk-action-bar.variants.js';
4
+ export type TableBulkActionBarProps = {
5
+ /**
6
+ * The number of selected items to display.
7
+ */
8
+ count: number;
9
+ /**
10
+ * Callback when the clear/close button is clicked.
11
+ * This is usually where you clear the selection state (`selectedRows = []`).
12
+ */
13
+ onClear?: () => void;
14
+ /**
15
+ * Text to display next to the count.
16
+ * @default 'items selected'
17
+ */
18
+ text?: string;
19
+ /**
20
+ * Additional CSS classes.
21
+ */
22
+ class?: ClassNameValue;
23
+ /**
24
+ * Override specific slot classes.
25
+ */
26
+ ui?: Partial<Record<TableBulkActionBarSlots, ClassNameValue>>;
27
+ /**
28
+ * The action buttons to display.
29
+ */
30
+ children?: Snippet;
31
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const tableBulkActionBarVariants: import("tailwind-variants").TVReturnType<{
3
+ [key: string]: {
4
+ [key: string]: import("tailwind-merge").ClassNameValue | {
5
+ content?: import("tailwind-merge").ClassNameValue;
6
+ root?: import("tailwind-merge").ClassNameValue;
7
+ actions?: import("tailwind-merge").ClassNameValue;
8
+ countBadge?: import("tailwind-merge").ClassNameValue;
9
+ clearButton?: import("tailwind-merge").ClassNameValue;
10
+ };
11
+ };
12
+ } | {
13
+ [x: string]: {
14
+ [x: string]: import("tailwind-merge").ClassNameValue | {
15
+ content?: import("tailwind-merge").ClassNameValue;
16
+ root?: import("tailwind-merge").ClassNameValue;
17
+ actions?: import("tailwind-merge").ClassNameValue;
18
+ countBadge?: import("tailwind-merge").ClassNameValue;
19
+ clearButton?: import("tailwind-merge").ClassNameValue;
20
+ };
21
+ };
22
+ } | {}, {
23
+ root: string;
24
+ content: string;
25
+ countBadge: string;
26
+ actions: string;
27
+ clearButton: string;
28
+ }, undefined, {
29
+ [key: string]: {
30
+ [key: string]: import("tailwind-merge").ClassNameValue | {
31
+ content?: import("tailwind-merge").ClassNameValue;
32
+ root?: import("tailwind-merge").ClassNameValue;
33
+ actions?: import("tailwind-merge").ClassNameValue;
34
+ countBadge?: import("tailwind-merge").ClassNameValue;
35
+ clearButton?: import("tailwind-merge").ClassNameValue;
36
+ };
37
+ };
38
+ } | {}, {
39
+ root: string;
40
+ content: string;
41
+ countBadge: string;
42
+ actions: string;
43
+ clearButton: string;
44
+ }, import("tailwind-variants").TVReturnType<unknown, {
45
+ root: string;
46
+ content: string;
47
+ countBadge: string;
48
+ actions: string;
49
+ clearButton: string;
50
+ }, undefined, unknown, unknown, undefined>>;
51
+ export type TableBulkActionBarVariantProps = VariantProps<typeof tableBulkActionBarVariants>;
52
+ export type TableBulkActionBarSlots = keyof ReturnType<typeof tableBulkActionBarVariants>;
@@ -0,0 +1,10 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const tableBulkActionBarVariants = tv({
3
+ slots: {
4
+ root: 'fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center justify-between gap-6 rounded-2xl border border-outline-variant/50 bg-surface/95 px-4 py-3 shadow-xl shadow-surface-container-highest/20 backdrop-blur-md',
5
+ content: 'flex items-center gap-3 text-sm text-on-surface whitespace-nowrap',
6
+ countBadge: 'font-semibold bg-primary text-on-primary px-2 py-0.5 rounded-full text-xs flex items-center justify-center min-w-[20px]',
7
+ actions: 'flex items-center gap-2 border-l border-outline-variant/50 pl-4',
8
+ clearButton: ''
9
+ }
10
+ });
@@ -7,6 +7,7 @@ export type DocsItem = {
7
7
  };
8
8
  export type DocsGroup = {
9
9
  title: string;
10
+ icon?: string;
10
11
  items: DocsItem[];
11
12
  };
12
13
  export declare const docsMeta: {
@@ -61,6 +61,7 @@ export const docsThemeItems = [
61
61
  export const docsComponentGroups = [
62
62
  {
63
63
  title: 'General',
64
+ icon: 'lucide:box',
64
65
  items: [
65
66
  {
66
67
  title: 'Button',
@@ -84,7 +85,7 @@ export const docsComponentGroups = [
84
85
  title: 'Fonts',
85
86
  href: '/docs/components/fonts',
86
87
  legacyHref: '/google-fonts',
87
- icon: 'lucide:font'
88
+ icon: 'lucide:type'
88
89
  },
89
90
  {
90
91
  title: 'Icon',
@@ -120,6 +121,7 @@ export const docsComponentGroups = [
120
121
  },
121
122
  {
122
123
  title: 'Layout',
124
+ icon: 'lucide:layout-panel-top',
123
125
  items: [
124
126
  {
125
127
  title: 'BentoGrid',
@@ -143,12 +145,12 @@ export const docsComponentGroups = [
143
145
  title: 'Resizable',
144
146
  href: '/docs/components/resizable',
145
147
  legacyHref: '/resizable',
146
- icon: 'lucide:layout-panel-left-right'
148
+ icon: 'lucide:stretch-horizontal'
147
149
  },
148
150
  {
149
151
  title: 'Modal',
150
152
  href: '/docs/components/modal',
151
- icon: 'lucide:layout-panel-left-right'
153
+ icon: 'lucide:app-window'
152
154
  },
153
155
  {
154
156
  title: 'Navigation Menu',
@@ -178,6 +180,7 @@ export const docsComponentGroups = [
178
180
  },
179
181
  {
180
182
  title: 'Data Display',
183
+ icon: 'lucide:table-properties',
181
184
  items: [
182
185
  {
183
186
  title: 'Accordion',
@@ -279,6 +282,7 @@ export const docsComponentGroups = [
279
282
  },
280
283
  {
281
284
  title: 'Forms',
285
+ icon: 'lucide:type',
282
286
  items: [
283
287
  {
284
288
  title: 'Checkbox',
@@ -392,6 +396,7 @@ export const docsComponentGroups = [
392
396
  },
393
397
  {
394
398
  title: 'Feedback',
399
+ icon: 'lucide:message-square',
395
400
  items: [
396
401
  {
397
402
  title: 'Alert',
@@ -439,6 +444,7 @@ export const docsComponentGroups = [
439
444
  },
440
445
  {
441
446
  title: 'Navigation',
447
+ icon: 'lucide:compass',
442
448
  items: [
443
449
  {
444
450
  title: 'Breadcrumb',
@@ -456,7 +462,7 @@ export const docsComponentGroups = [
456
462
  title: 'Sidebar',
457
463
  href: '/docs/components/sidebar',
458
464
  legacyHref: '/sidebar',
459
- icon: 'lucide:layout-sidebar'
465
+ icon: 'lucide:panel-left'
460
466
  },
461
467
  {
462
468
  title: 'Stepper',
@@ -474,6 +480,7 @@ export const docsComponentGroups = [
474
480
  },
475
481
  {
476
482
  title: 'Overlay',
483
+ icon: 'lucide:layers',
477
484
  items: [
478
485
  {
479
486
  title: 'Collapsible',
@@ -533,6 +540,7 @@ export const docsComponentGroups = [
533
540
  },
534
541
  {
535
542
  title: 'Date & Time',
543
+ icon: 'lucide:calendar',
536
544
  items: [
537
545
  {
538
546
  title: 'Calendar',
@@ -656,7 +664,7 @@ export const docsHookItems = [
656
664
  export const docsTopNav = [
657
665
  { title: 'Docs', href: '/docs', icon: 'lucide:book-open' },
658
666
  { title: 'Components', href: '/docs/components/button', icon: 'lucide:blocks' },
659
- { title: 'Hooks', href: '/docs/hooks/use-debounce', icon: 'lucide:hook' }
667
+ { title: 'Hooks', href: '/docs/hooks/use-debounce', icon: 'lucide:webhook' }
660
668
  ];
661
669
  export const allComponentItems = docsComponentGroups.flatMap((group) => group.items);
662
670
  export const allDocsItems = [