@rkosafo/cai.components 0.0.78 → 0.0.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 (103) hide show
  1. package/README.md +8 -8
  2. package/dist/baseEditor/index.svelte +32 -32
  3. package/dist/builders/filters/FilterBuilder.svelte +641 -641
  4. package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -53
  5. package/dist/forms/FormClEditor/ClEdito.svelte +68 -68
  6. package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -159
  7. package/dist/forms/FormFileUpload/FormFileUplad.svelte +134 -134
  8. package/dist/forms/FormInput/FormInput.svelte +87 -87
  9. package/dist/forms/FormRadio/FormRadio.svelte +53 -53
  10. package/dist/forms/FormSelect/FormSelect.svelte +88 -88
  11. package/dist/forms/FormTextarea/FormTextarea.svelte +78 -78
  12. package/dist/forms/button-toggle/ButtonToggle.svelte +119 -119
  13. package/dist/forms/button-toggle/CheckIcon.svelte +28 -28
  14. package/dist/forms/checkbox/Checkbox.svelte +82 -82
  15. package/dist/forms/checkbox/CheckboxButton.svelte +92 -92
  16. package/dist/forms/datepicker/Datepicker.svelte +707 -707
  17. package/dist/forms/form/Form.svelte +69 -69
  18. package/dist/forms/input/Input.svelte +363 -363
  19. package/dist/forms/label/Label.svelte +38 -38
  20. package/dist/forms/radio/Radio.svelte +48 -48
  21. package/dist/forms/radio/RadioButton.svelte +22 -22
  22. package/dist/forms/select/Select.svelte +56 -56
  23. package/dist/forms/textarea/Textarea.svelte +165 -165
  24. package/dist/forms/toggle/Toggle.svelte +70 -70
  25. package/dist/layout/Chat/CategorySelector.svelte +52 -52
  26. package/dist/layout/Chat/ChatEntry.svelte +246 -246
  27. package/dist/layout/Chat/ChatEntrySkeleton.svelte +81 -81
  28. package/dist/layout/Chat/ChatHeader.svelte +172 -172
  29. package/dist/layout/Chat/ChatInput.svelte +207 -207
  30. package/dist/layout/Chat/DraggableWindow.svelte +230 -230
  31. package/dist/layout/Chat/PreviewPage.svelte +182 -182
  32. package/dist/layout/Chat/RichText.svelte +216 -216
  33. package/dist/layout/ComponentCanvas/Canvas.svelte +40 -40
  34. package/dist/layout/ComponentCanvas/ComponentRenderer.svelte +85 -85
  35. package/dist/layout/TF/Content/Content.svelte +21 -21
  36. package/dist/layout/TF/Header/Header.svelte +166 -166
  37. package/dist/layout/TF/Sidebar/Sidebar.svelte +148 -148
  38. package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -17
  39. package/dist/layout/mailing/MailPaginator.svelte +36 -36
  40. package/dist/layout/mailing/MailSidebar.svelte +39 -39
  41. package/dist/layout/mailing/MailToolBar.svelte +174 -174
  42. package/dist/layout/mailing/MailingContent.svelte +10 -10
  43. package/dist/layout/mailing/MailingHeader.svelte +55 -55
  44. package/dist/layout/mailing/MailingMessageCard.svelte +112 -112
  45. package/dist/layout/mailing/MailingMessageViewer.svelte +87 -87
  46. package/dist/layout/mailing/MailingModule.svelte +448 -448
  47. package/dist/styles/docs.css +615 -615
  48. package/dist/styles/tf-layout.css +185 -185
  49. package/dist/themes/ThemeProvider.svelte +20 -20
  50. package/dist/types/index.d.ts +2 -0
  51. package/dist/typography/heading/Heading.svelte +35 -35
  52. package/dist/ui/accordion/Accordion.svelte +49 -49
  53. package/dist/ui/accordion/AccordionItem.svelte +173 -173
  54. package/dist/ui/alert/Alert.svelte +83 -83
  55. package/dist/ui/alertDialog/AlertDialog.svelte +40 -40
  56. package/dist/ui/avatar/Avatar.svelte +77 -77
  57. package/dist/ui/box/Box.svelte +28 -28
  58. package/dist/ui/breadcrumb/Breadcrumb.svelte +39 -39
  59. package/dist/ui/buttons/ActionButton.svelte +234 -234
  60. package/dist/ui/buttons/Button.svelte +102 -102
  61. package/dist/ui/buttons/GradientButton.svelte +59 -59
  62. package/dist/ui/datatable/Datatable.svelte +525 -525
  63. package/dist/ui/drawer/Drawer.svelte +300 -300
  64. package/dist/ui/dropdown/Dropdown.svelte +36 -36
  65. package/dist/ui/dropdown/DropdownDivider.svelte +11 -11
  66. package/dist/ui/dropdown/DropdownGroup.svelte +14 -14
  67. package/dist/ui/dropdown/DropdownHeader.svelte +14 -14
  68. package/dist/ui/dropdown/DropdownItem.svelte +52 -52
  69. package/dist/ui/footer/Footer.svelte +15 -15
  70. package/dist/ui/footer/FooterBrand.svelte +37 -37
  71. package/dist/ui/footer/FooterCopyright.svelte +45 -45
  72. package/dist/ui/footer/FooterIcon.svelte +22 -22
  73. package/dist/ui/footer/FooterLink.svelte +33 -33
  74. package/dist/ui/footer/FooterLinkGroup.svelte +13 -13
  75. package/dist/ui/icons/IconifyIcon.svelte +7 -7
  76. package/dist/ui/indicator/Indicator.svelte +42 -42
  77. package/dist/ui/modal/Modal.svelte +265 -265
  78. package/dist/ui/notificationList/NotificationList.svelte +123 -123
  79. package/dist/ui/pageLoader/PageLoader.svelte +14 -14
  80. package/dist/ui/pageLoader/PageLoader2.svelte +99 -0
  81. package/dist/ui/pageLoader/PageLoader2.svelte.d.ts +24 -0
  82. package/dist/ui/pageLoader/index.d.ts +2 -1
  83. package/dist/ui/pageLoader/index.js +2 -1
  84. package/dist/ui/paginate/Paginate.svelte +96 -96
  85. package/dist/ui/speedDial/SpeedDial.svelte +77 -77
  86. package/dist/ui/speedDial/SpeedDialButton.svelte +75 -75
  87. package/dist/ui/speedDial/SpeedDialTrigger.svelte +79 -79
  88. package/dist/ui/tab/Tab.svelte +93 -67
  89. package/dist/ui/table/Table.svelte +396 -396
  90. package/dist/ui/tableLoader/TableLoader.svelte +24 -24
  91. package/dist/ui/toast/Toast.svelte +337 -337
  92. package/dist/ui/toast/Toast.svelte.d.ts +10 -10
  93. package/dist/ui/toolbar/Toolbar.svelte +59 -59
  94. package/dist/ui/toolbar/ToolbarButton.svelte +56 -56
  95. package/dist/ui/toolbar/ToolbarGroup.svelte +43 -43
  96. package/dist/ui/tooltip/Tooltip.svelte +51 -51
  97. package/dist/utils/Popper.svelte +257 -257
  98. package/dist/utils/closeButton/CloseButton.svelte +88 -88
  99. package/dist/utils/index.d.ts +2 -2
  100. package/dist/utils/index.js +3 -3
  101. package/dist/utils/singleSelection.svelte.js +48 -48
  102. package/dist/youtube/index.svelte +12 -12
  103. package/package.json +1 -1
@@ -1,148 +1,148 @@
1
- <script lang="ts">
2
- import { cn } from '../../../utils/index.js';
3
- import { page } from '$app/state';
4
- import { IconifyIcon, type IMenuItem, type TFSidebarProps } from '../../../index.js';
5
- import { slide } from 'svelte/transition';
6
-
7
- let {
8
- homeUrl,
9
- logoUrl,
10
- appName,
11
- appShortName,
12
- hideSidebar = false,
13
- menuItems = [],
14
- logo,
15
- isActiveFunction
16
- }: TFSidebarProps = $props();
17
-
18
- let activeUrl = $state('');
19
- let openNestedIndexes = $state<Set<number>>(new Set());
20
-
21
- $effect(() => {
22
- activeUrl = page.url.pathname;
23
- });
24
-
25
- // Function to toggle nested menu by index
26
- function toggleNestedMenu(index: number) {
27
- handleMenuItemClick();
28
- const newOpenIndexes = new Set(openNestedIndexes);
29
-
30
- if (newOpenIndexes.has(index)) {
31
- // If already open, close it
32
- newOpenIndexes.delete(index);
33
- } else {
34
- // If opening new one, just add it (don't clear others)
35
- newOpenIndexes.add(index);
36
- }
37
- openNestedIndexes = newOpenIndexes;
38
- }
39
-
40
- // Function to handle regular menu item clicks (non-nested)
41
- function handleMenuItemClick() {
42
- // Close all nested menus when clicking a regular menu item
43
- openNestedIndexes = new Set();
44
- }
45
-
46
- // Function to check if a menu item or any of its children is active
47
- function isItemOrChildActive(item: IMenuItem): boolean {
48
- if (isActiveFunction) {
49
- return isActiveFunction(item);
50
- }
51
-
52
- if (item.path === activeUrl) {
53
- return true;
54
- }
55
-
56
- // Check if any child is active
57
- if (item.items) {
58
- return item.items.some((child) => child.path === activeUrl);
59
- }
60
-
61
- return false;
62
- }
63
- </script>
64
-
65
- {#snippet menuItemSnippet(item: IMenuItem, active: boolean)}
66
- <li class:active class="relative">
67
- <a
68
- class="space-x-3 pl-3 {active ? 'text-[#3C91E6]' : ''}"
69
- href={item.path}
70
- onclick={() => handleMenuItemClick()}
71
- >
72
- <IconifyIcon icon={item.icon} class={active ? 'text-[#3C91E6]' : ''} />
73
- <span class="text hidden md:block {active ? 'text-[#3C91E6]' : ''}">{item.title}</span>
74
- </a>
75
- </li>
76
- {/snippet}
77
-
78
- {#snippet nestedItemSnippet(item: IMenuItem, index: number)}
79
- {@const isActive = isItemOrChildActive(item)}
80
- {@const isOpen = openNestedIndexes.has(index)}
81
-
82
- <div class="mx-1 rounded-[5px] px-1.5 py-2 {isActive ? 'bg-[#cfe8ff79] text-[#3C91E6]' : ''}">
83
- <button
84
- class="flex w-full items-center space-x-3 pl-3"
85
- onclick={() => toggleNestedMenu(index)}
86
- type="button"
87
- >
88
- <IconifyIcon icon={item.icon} class={isActive ? 'text-[#3C91E6]' : ''} />
89
- <span class="text hidden md:block {isActive ? 'text-[#3C91E6]' : ''}">{item.title}</span>
90
- <IconifyIcon
91
- icon="ri:arrow-down-s-line"
92
- class="ml-auto transition-transform duration-200 {isOpen ? 'rotate-180' : ''}"
93
- />
94
- </button>
95
- {#if isOpen}
96
- <ul transition:slide class="sub-menu space-y-0 py-1">
97
- {#each item.items! as child}
98
- {@const isChildActive = isActiveFunction
99
- ? isActiveFunction(child)
100
- : activeUrl === child.path}
101
- <div class="pl-4">
102
- <li class="relative">
103
- <a
104
- class="flex items-center space-x-3 rounded transition-colors hover:bg-[#cfe8ff] {isChildActive
105
- ? 'bg-[#cfe8ff] text-[#3C91E6]'
106
- : ''}"
107
- href={child.path}
108
- >
109
- {#if child.icon}
110
- <IconifyIcon icon={child.icon} class={isChildActive ? 'text-[#3C91E6]' : ''} />
111
- {/if}
112
- <span class="text hidden md:block {isChildActive ? 'text-[#3C91E6]' : ''}"
113
- >{child.title}</span
114
- >
115
- </a>
116
- </li>
117
- </div>
118
- {/each}
119
- </ul>
120
- {/if}
121
- </div>
122
- {/snippet}
123
-
124
- <section id="tf-sidebar" class={cn('relative')} class:hide={hideSidebar}>
125
- <a href={homeUrl} class="brand flex flex-col pt-4" onclick={() => handleMenuItemClick()}>
126
- {#if logo}
127
- {@render logo()}
128
- {:else}
129
- <img src={logoUrl} alt="Logo" class={hideSidebar ? 'w-12' : 'w-12 md:w-24'} loading="lazy" />
130
- {/if}
131
- <span class="text-base font-thin {hideSidebar ? 'block' : 'md:hidden'}">{appShortName}</span>
132
- <p class="text-center text-lg font-medium {hideSidebar ? 'hidden' : 'hidden md:block'}">
133
- {appName}
134
- </p>
135
- </a>
136
- {#if menuItems.length > 0}
137
- <ul class="side-menu top relative pt-4">
138
- {#each menuItems as item, index}
139
- {@const active = isActiveFunction ? isActiveFunction(item) : activeUrl === item.path}
140
- {#if item.items}
141
- {@render nestedItemSnippet(item, index)}
142
- {:else}
143
- {@render menuItemSnippet(item, active)}
144
- {/if}
145
- {/each}
146
- </ul>
147
- {/if}
148
- </section>
1
+ <script lang="ts">
2
+ import { cn } from '../../../utils/index.js';
3
+ import { page } from '$app/state';
4
+ import { IconifyIcon, type IMenuItem, type TFSidebarProps } from '../../../index.js';
5
+ import { slide } from 'svelte/transition';
6
+
7
+ let {
8
+ homeUrl,
9
+ logoUrl,
10
+ appName,
11
+ appShortName,
12
+ hideSidebar = false,
13
+ menuItems = [],
14
+ logo,
15
+ isActiveFunction
16
+ }: TFSidebarProps = $props();
17
+
18
+ let activeUrl = $state('');
19
+ let openNestedIndexes = $state<Set<number>>(new Set());
20
+
21
+ $effect(() => {
22
+ activeUrl = page.url.pathname;
23
+ });
24
+
25
+ // Function to toggle nested menu by index
26
+ function toggleNestedMenu(index: number) {
27
+ handleMenuItemClick();
28
+ const newOpenIndexes = new Set(openNestedIndexes);
29
+
30
+ if (newOpenIndexes.has(index)) {
31
+ // If already open, close it
32
+ newOpenIndexes.delete(index);
33
+ } else {
34
+ // If opening new one, just add it (don't clear others)
35
+ newOpenIndexes.add(index);
36
+ }
37
+ openNestedIndexes = newOpenIndexes;
38
+ }
39
+
40
+ // Function to handle regular menu item clicks (non-nested)
41
+ function handleMenuItemClick() {
42
+ // Close all nested menus when clicking a regular menu item
43
+ openNestedIndexes = new Set();
44
+ }
45
+
46
+ // Function to check if a menu item or any of its children is active
47
+ function isItemOrChildActive(item: IMenuItem): boolean {
48
+ if (isActiveFunction) {
49
+ return isActiveFunction(item);
50
+ }
51
+
52
+ if (item.path === activeUrl) {
53
+ return true;
54
+ }
55
+
56
+ // Check if any child is active
57
+ if (item.items) {
58
+ return item.items.some((child) => child.path === activeUrl);
59
+ }
60
+
61
+ return false;
62
+ }
63
+ </script>
64
+
65
+ {#snippet menuItemSnippet(item: IMenuItem, active: boolean)}
66
+ <li class:active class="relative">
67
+ <a
68
+ class="space-x-3 pl-3 {active ? 'text-[#3C91E6]' : ''}"
69
+ href={item.path}
70
+ onclick={() => handleMenuItemClick()}
71
+ >
72
+ <IconifyIcon icon={item.icon} class={active ? 'text-[#3C91E6]' : ''} />
73
+ <span class="text hidden md:block {active ? 'text-[#3C91E6]' : ''}">{item.title}</span>
74
+ </a>
75
+ </li>
76
+ {/snippet}
77
+
78
+ {#snippet nestedItemSnippet(item: IMenuItem, index: number)}
79
+ {@const isActive = isItemOrChildActive(item)}
80
+ {@const isOpen = openNestedIndexes.has(index)}
81
+
82
+ <div class="mx-1 rounded-[5px] px-1.5 py-2 {isActive ? 'bg-[#cfe8ff79] text-[#3C91E6]' : ''}">
83
+ <button
84
+ class="flex w-full items-center space-x-3 pl-3"
85
+ onclick={() => toggleNestedMenu(index)}
86
+ type="button"
87
+ >
88
+ <IconifyIcon icon={item.icon} class={isActive ? 'text-[#3C91E6]' : ''} />
89
+ <span class="text hidden md:block {isActive ? 'text-[#3C91E6]' : ''}">{item.title}</span>
90
+ <IconifyIcon
91
+ icon="ri:arrow-down-s-line"
92
+ class="ml-auto transition-transform duration-200 {isOpen ? 'rotate-180' : ''}"
93
+ />
94
+ </button>
95
+ {#if isOpen}
96
+ <ul transition:slide class="sub-menu space-y-0 py-1">
97
+ {#each item.items! as child}
98
+ {@const isChildActive = isActiveFunction
99
+ ? isActiveFunction(child)
100
+ : activeUrl === child.path}
101
+ <div class="pl-4">
102
+ <li class="relative">
103
+ <a
104
+ class="flex items-center space-x-3 rounded transition-colors hover:bg-[#cfe8ff] {isChildActive
105
+ ? 'bg-[#cfe8ff] text-[#3C91E6]'
106
+ : ''}"
107
+ href={child.path}
108
+ >
109
+ {#if child.icon}
110
+ <IconifyIcon icon={child.icon} class={isChildActive ? 'text-[#3C91E6]' : ''} />
111
+ {/if}
112
+ <span class="text hidden md:block {isChildActive ? 'text-[#3C91E6]' : ''}"
113
+ >{child.title}</span
114
+ >
115
+ </a>
116
+ </li>
117
+ </div>
118
+ {/each}
119
+ </ul>
120
+ {/if}
121
+ </div>
122
+ {/snippet}
123
+
124
+ <section id="tf-sidebar" class={cn('relative')} class:hide={hideSidebar}>
125
+ <a href={homeUrl} class="brand flex flex-col pt-4" onclick={() => handleMenuItemClick()}>
126
+ {#if logo}
127
+ {@render logo()}
128
+ {:else}
129
+ <img src={logoUrl} alt="Logo" class={hideSidebar ? 'w-12' : 'w-12 md:w-24'} loading="lazy" />
130
+ {/if}
131
+ <span class="text-base font-thin {hideSidebar ? 'block' : 'md:hidden'}">{appShortName}</span>
132
+ <p class="text-center text-lg font-medium {hideSidebar ? 'hidden' : 'hidden md:block'}">
133
+ {appName}
134
+ </p>
135
+ </a>
136
+ {#if menuItems.length > 0}
137
+ <ul class="side-menu top relative pt-4">
138
+ {#each menuItems as item, index}
139
+ {@const active = isActiveFunction ? isActiveFunction(item) : activeUrl === item.path}
140
+ {#if item.items}
141
+ {@render nestedItemSnippet(item, index)}
142
+ {:else}
143
+ {@render menuItemSnippet(item, active)}
144
+ {/if}
145
+ {/each}
146
+ </ul>
147
+ {/if}
148
+ </section>
@@ -1,17 +1,17 @@
1
- <script lang="ts" module>
2
- import type { Snippet } from 'svelte';
3
-
4
- export interface TFLayoutWrapperProps {
5
- sidebar: Snippet;
6
- content: Snippet;
7
- }
8
- </script>
9
-
10
- <script lang="ts">
11
- let { sidebar, content }: TFLayoutWrapperProps = $props();
12
- </script>
13
-
14
- <div class="h-full w-full overflow-hidden">
15
- {@render sidebar()}
16
- {@render content()}
17
- </div>
1
+ <script lang="ts" module>
2
+ import type { Snippet } from 'svelte';
3
+
4
+ export interface TFLayoutWrapperProps {
5
+ sidebar: Snippet;
6
+ content: Snippet;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ let { sidebar, content }: TFLayoutWrapperProps = $props();
12
+ </script>
13
+
14
+ <div class="h-full w-full overflow-hidden">
15
+ {@render sidebar()}
16
+ {@render content()}
17
+ </div>
@@ -1,36 +1,36 @@
1
- <script lang="ts">
2
- import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
3
- import type { MailPaginatorProps } from './types.js';
4
-
5
- let {
6
- hasNextPage = false,
7
- hasPreviousPage = false,
8
- currentPage = 0,
9
- pageSize = 0,
10
- totalCount = 0,
11
- onNextClick,
12
- onPreviousClick
13
- }: MailPaginatorProps = $props();
14
- </script>
15
-
16
- <div class="flex items-center space-x-4 px-2">
17
- <span class="text-sm text-gray-500">{currentPage}-{pageSize} of {totalCount}</span>
18
- <div class="flex items-center space-x-2">
19
- <button
20
- disabled={!hasPreviousPage}
21
- onclick={onPreviousClick}
22
- class="rounded-lg bg-gray-200 p-1.5 text-gray-700 hover:bg-gray-300 disabled:bg-gray-200 disabled:text-gray-400"
23
- title="Older"
24
- >
25
- <IconifyIcon icon="material-symbols:arrow-back" class="flex h-5 w-5 justify-center" />
26
- </button>
27
- <button
28
- disabled={!hasNextPage}
29
- onclick={onNextClick}
30
- class="rounded-lg bg-gray-200 p-1.5 text-gray-700 transition duration-150 hover:bg-gray-300 disabled:bg-gray-200 disabled:text-gray-400"
31
- title="Newer"
32
- >
33
- <IconifyIcon icon="material-symbols:arrow-forward" class="flex h-5 w-5 justify-center" />
34
- </button>
35
- </div>
36
- </div>
1
+ <script lang="ts">
2
+ import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
3
+ import type { MailPaginatorProps } from './types.js';
4
+
5
+ let {
6
+ hasNextPage = false,
7
+ hasPreviousPage = false,
8
+ currentPage = 0,
9
+ pageSize = 0,
10
+ totalCount = 0,
11
+ onNextClick,
12
+ onPreviousClick
13
+ }: MailPaginatorProps = $props();
14
+ </script>
15
+
16
+ <div class="flex items-center space-x-4 px-2">
17
+ <span class="text-sm text-gray-500">{currentPage}-{pageSize} of {totalCount}</span>
18
+ <div class="flex items-center space-x-2">
19
+ <button
20
+ disabled={!hasPreviousPage}
21
+ onclick={onPreviousClick}
22
+ class="rounded-lg bg-gray-200 p-1.5 text-gray-700 hover:bg-gray-300 disabled:bg-gray-200 disabled:text-gray-400"
23
+ title="Older"
24
+ >
25
+ <IconifyIcon icon="material-symbols:arrow-back" class="flex h-5 w-5 justify-center" />
26
+ </button>
27
+ <button
28
+ disabled={!hasNextPage}
29
+ onclick={onNextClick}
30
+ class="rounded-lg bg-gray-200 p-1.5 text-gray-700 transition duration-150 hover:bg-gray-300 disabled:bg-gray-200 disabled:text-gray-400"
31
+ title="Newer"
32
+ >
33
+ <IconifyIcon icon="material-symbols:arrow-forward" class="flex h-5 w-5 justify-center" />
34
+ </button>
35
+ </div>
36
+ </div>
@@ -1,39 +1,39 @@
1
- <script lang="ts">
2
- import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
3
- import { Tooltip } from '../../ui/tooltip/index.js';
4
- import type { MailSidebar } from './types.js';
5
-
6
- let { setActiveMenu, menus = [], onClick }: MailSidebar = $props();
7
- </script>
8
-
9
- <div class="h-full w-full">
10
- <ul class="flex h-full w-full flex-col gap-2 pt-4 pb-8">
11
- {#each menus as menu, i}
12
- {@const active = setActiveMenu?.(menu)}
13
- <li class="grid w-full place-content-center">
14
- <a
15
- onclick={() => onClick?.(menu)}
16
- href={menu.path}
17
- class:text-primary-500={active}
18
- class:bg-primary-100={active}
19
- class:bg-opacity-10={active}
20
- class:hover:bg-primary-100={!active}
21
- class:hover:bg-opacity-10={!active}
22
- class:text-gray-500={!active}
23
- class:hover:text-gray-700={!active}
24
- class="relative grid cursor-pointer place-content-center rounded px-3 py-3 transition-colors"
25
- >
26
- <IconifyIcon icon={menu.icon} style="font-size: 18px;" />
27
- <div class="absolute -top-1 right-0">
28
- <span
29
- class:hidden={!Boolean(menu.count > 0)}
30
- class="rounded-lg bg-sky-500 px-1.5 py-0.5 text-xs font-bold text-gray-100"
31
- >{menu.count}</span
32
- >
33
- </div>
34
- </a>
35
- <Tooltip placement="right">{menu.title}</Tooltip>
36
- </li>
37
- {/each}
38
- </ul>
39
- </div>
1
+ <script lang="ts">
2
+ import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
3
+ import { Tooltip } from '../../ui/tooltip/index.js';
4
+ import type { MailSidebar } from './types.js';
5
+
6
+ let { setActiveMenu, menus = [], onClick }: MailSidebar = $props();
7
+ </script>
8
+
9
+ <div class="h-full w-full">
10
+ <ul class="flex h-full w-full flex-col gap-2 pt-4 pb-8">
11
+ {#each menus as menu, i}
12
+ {@const active = setActiveMenu?.(menu)}
13
+ <li class="grid w-full place-content-center">
14
+ <a
15
+ onclick={() => onClick?.(menu)}
16
+ href={menu.path}
17
+ class:text-primary-500={active}
18
+ class:bg-primary-100={active}
19
+ class:bg-opacity-10={active}
20
+ class:hover:bg-primary-100={!active}
21
+ class:hover:bg-opacity-10={!active}
22
+ class:text-gray-500={!active}
23
+ class:hover:text-gray-700={!active}
24
+ class="relative grid cursor-pointer place-content-center rounded px-3 py-3 transition-colors"
25
+ >
26
+ <IconifyIcon icon={menu.icon} style="font-size: 18px;" />
27
+ <div class="absolute -top-1 right-0">
28
+ <span
29
+ class:hidden={!Boolean(menu.count > 0)}
30
+ class="rounded-lg bg-sky-500 px-1.5 py-0.5 text-xs font-bold text-gray-100"
31
+ >{menu.count}</span
32
+ >
33
+ </div>
34
+ </a>
35
+ <Tooltip placement="right">{menu.title}</Tooltip>
36
+ </li>
37
+ {/each}
38
+ </ul>
39
+ </div>