@makolabs/ripple 0.0.1-dev.4 → 0.0.1-dev.41

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 (129) 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 +83 -0
  13. package/dist/elements/accordion/Accordion.svelte.d.ts +4 -0
  14. package/dist/elements/accordion/accordion.d.ts +200 -0
  15. package/dist/elements/accordion/accordion.js +86 -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 +32 -37
  22. package/dist/elements/dropdown/Dropdown.svelte.d.ts +1 -1
  23. package/dist/elements/dropdown/Select.svelte +143 -59
  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 +10 -4
  27. package/dist/elements/dropdown/select.d.ts +34 -54
  28. package/dist/elements/dropdown/select.js +22 -14
  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 +762 -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 +2 -2
  85. package/dist/layout/table/Table.svelte.d.ts +1 -1
  86. package/dist/layout/table/table.d.ts +1 -20
  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/variants.d.ts +30 -0
  100. package/dist/variants.js +36 -0
  101. package/package.json +7 -3
  102. package/dist/button/index.d.ts +0 -1
  103. package/dist/button/index.js +0 -1
  104. package/dist/drawer/index.d.ts +0 -2
  105. package/dist/drawer/index.js +0 -1
  106. package/dist/elements/badge/index.d.ts +0 -2
  107. package/dist/elements/badge/index.js +0 -2
  108. package/dist/elements/dropdown/index.d.ts +0 -3
  109. package/dist/elements/dropdown/index.js +0 -2
  110. package/dist/header/index.d.ts +0 -4
  111. package/dist/header/index.js +0 -2
  112. package/dist/header/pageheaders.d.ts +0 -10
  113. package/dist/header/pageheaders.js +0 -1
  114. package/dist/layout/card/index.d.ts +0 -4
  115. package/dist/layout/card/index.js +0 -2
  116. package/dist/layout/index.d.ts +0 -7
  117. package/dist/layout/index.js +0 -7
  118. package/dist/layout/navbar/index.d.ts +0 -2
  119. package/dist/layout/navbar/index.js +0 -2
  120. package/dist/layout/sidebar/index.d.ts +0 -2
  121. package/dist/layout/sidebar/index.js +0 -1
  122. package/dist/layout/sidebar/sidebar.d.ts +0 -46
  123. package/dist/layout/sidebar/sidebar.js +0 -1
  124. package/dist/layout/table/index.d.ts +0 -3
  125. package/dist/layout/table/index.js +0 -2
  126. package/dist/layout/tabs/index.d.ts +0 -3
  127. package/dist/layout/tabs/index.js +0 -3
  128. package/dist/modal/index.d.ts +0 -1
  129. package/dist/modal/index.js +0 -1
@@ -1,24 +1,27 @@
1
1
  <script lang="ts">
2
2
  import { tick } from 'svelte';
3
3
  import { cn } from '../../helper/cls.js';
4
- import { selectTV, type SelectItem, type SelectProps } from './select.js';
4
+ import { selectTV } from './select.js';
5
+ import type { SelectItem, SelectProps } from '../../index.js';
6
+ import Badge from '../badge/Badge.svelte';
7
+ import { Size } from '../../variants.js';
5
8
 
6
9
  let {
7
10
  items = [],
8
11
  value = $bindable(''),
12
+ multiple = false,
9
13
  placeholder = 'Select an option',
10
14
  searchable = false,
11
15
  disabled = false,
12
- size = 'sm',
16
+ size = Size.BASE,
13
17
  class: className = '',
14
- triggerClass = '',
15
18
  containerClass = '',
16
19
  listClass = '',
17
20
  itemClass = '',
18
21
  searchInputClass = '',
19
22
  icon: Icon,
20
23
  iconClass = '',
21
- triggerContent,
24
+ triggerClass = '', // recently, just now
22
25
  onselect = () => {},
23
26
  onopen = () => {},
24
27
  onclose = () => {}
@@ -30,10 +33,19 @@
30
33
  let searchInputRef = $state<HTMLInputElement | null>(null);
31
34
  let highlightedIndex = $state(-1);
32
35
 
36
+ // Convert value to array for internal processing if multiple is true
37
+ const valueArray = $derived.by(() => {
38
+ if (multiple) {
39
+ return Array.isArray(value) ? value : value ? [value] : [];
40
+ }
41
+ return typeof value === 'string' ? [value] : [];
42
+ });
43
+
33
44
  const { base, trigger, triggerIcon, container, searchInput, list, item, emptyMessage } = $derived(
34
45
  selectTV({
35
46
  size,
36
- disabled
47
+ disabled,
48
+ multiple
37
49
  })
38
50
  );
39
51
 
@@ -47,6 +59,7 @@
47
59
  const emptyMessageClass = $derived(cn(emptyMessage()));
48
60
 
49
61
  const selectedItem = $derived(items.find((item) => item.value === value));
62
+ const selectedItems = $derived(items.filter((item) => valueArray.includes(item.value)));
50
63
 
51
64
  const filteredItems = $derived(
52
65
  searchable && searchQuery
@@ -59,7 +72,7 @@
59
72
  open = !open;
60
73
 
61
74
  if (open) {
62
- highlightedIndex = filteredItems.findIndex((item) => item.value === value);
75
+ highlightedIndex = !multiple ? filteredItems.findIndex((item) => item.value === value) : -1;
63
76
 
64
77
  onopen();
65
78
 
@@ -76,9 +89,36 @@
76
89
 
77
90
  function handleSelect(item: SelectItem) {
78
91
  if (item.disabled) return;
79
- value = item.value;
80
- onselect({ value: item.value });
81
- open = false;
92
+
93
+ if (multiple) {
94
+ const isSelected = valueArray.includes(item.value);
95
+
96
+ if (isSelected) {
97
+ // Remove from selection
98
+ value = Array.isArray(value) ? value.filter((v) => v !== item.value) : [];
99
+ } else {
100
+ // Add to selection
101
+ value = Array.isArray(value) ? [...value, item.value] : [item.value];
102
+ }
103
+
104
+ // Keep dropdown open when multiple selection is enabled
105
+ if (searchable && searchInputRef) {
106
+ searchInputRef.focus();
107
+ }
108
+ } else {
109
+ // Single selection
110
+ value = item.value;
111
+ open = false;
112
+ }
113
+
114
+ onselect({ value });
115
+ }
116
+
117
+ function removeItem(itemValue: string) {
118
+ if (multiple && Array.isArray(value)) {
119
+ value = value.filter((v) => v !== itemValue);
120
+ onselect({ value });
121
+ }
82
122
  }
83
123
 
84
124
  function handleClickOutside(event: MouseEvent) {
@@ -143,55 +183,82 @@
143
183
  <svelte:window onclick={handleClickOutside} onkeydown={handleKeydown} />
144
184
 
145
185
  <div bind:this={selectRef} class={baseClass} data-state={open ? 'open' : 'closed'}>
146
- <button
147
- type="button"
148
- onclick={handleToggle}
149
- {disabled}
186
+ <label
150
187
  class={triggerClass_}
188
+ aria-disabled={disabled}
151
189
  aria-haspopup="listbox"
152
- aria-expanded={open}
153
190
  aria-labelledby="select-label"
154
191
  >
155
- {#if triggerContent}
156
- {@render triggerContent({ selectedItem, open })}
157
- {:else}
158
- <span id="select-label" class="flex-1 truncate text-left">
159
- {selectedItem?.label || placeholder}
160
- </span>
161
-
162
- <span class="flex items-center gap-2">
163
- {#if Icon}
164
- <Icon class={triggerIconClass} />
165
- {:else}
192
+ <button
193
+ type="button"
194
+ aria-label="Toggle dropdown"
195
+ {disabled}
196
+ aria-expanded={open}
197
+ onclick={handleToggle}
198
+ ></button>
199
+ <span class="flex min-h-[1.5rem] flex-1 flex-wrap items-center gap-1 overflow-hidden">
200
+ {#if multiple && selectedItems.length > 0}
201
+ {#each selectedItems as item (item.value)}
202
+ <Badge {size} color="info" onclose={() => removeItem(item.value)}>
203
+ {item.value}
204
+ </Badge>
205
+ {/each}
206
+ {:else if !multiple && selectedItem}
207
+ <span id="select-label" class="flex-1 truncate text-left">
208
+ {selectedItem.label}
209
+ </span>
210
+ {:else}
211
+ <span id="select-label" class="text-default-500 px-1">
212
+ {placeholder}
213
+ </span>
214
+ {/if}
215
+ </span>
216
+
217
+ <span class="ml-auto flex flex-shrink-0 items-center pl-2">
218
+ {#if Icon}
219
+ <Icon class={triggerIconClass} />
220
+ {:else}
221
+ <svg
222
+ xmlns="http://www.w3.org/2000/svg"
223
+ viewBox="0 0 20 20"
224
+ fill="currentColor"
225
+ class={cn(triggerIconClass, open && 'rotate-180 transform')}
226
+ >
227
+ <path
228
+ fill-rule="evenodd"
229
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
230
+ clip-rule="evenodd"
231
+ />
232
+ </svg>
233
+ {/if}
234
+ </span>
235
+ </label>
236
+
237
+ {#if open}
238
+ <div class={containerClass_} role="listbox" aria-labelledby="select-label">
239
+ {#if searchable}
240
+ <div class={searchInputClass_}>
166
241
  <svg
167
242
  xmlns="http://www.w3.org/2000/svg"
168
- viewBox="0 0 20 20"
169
- fill="currentColor"
170
- class={cn(triggerIconClass, open && 'rotate-180 transform')}
243
+ width="12"
244
+ height="12"
245
+ viewBox="0 0 12 12"
246
+ class="size-4"
171
247
  >
172
248
  <path
173
- fill-rule="evenodd"
174
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
175
- clip-rule="evenodd"
249
+ fill="currentColor"
250
+ d="M5 1a4 4 0 1 0 2.452 7.16l2.694 2.693a.5.5 0 1 0 .707-.707L8.16 7.453A4 4 0 0 0 5 1M2 5a3 3 0 1 1 6 0a3 3 0 0 1-6 0"
176
251
  />
177
252
  </svg>
178
- {/if}
179
- </span>
180
- {/if}
181
- </button>
182
-
183
- <!-- Select Menu -->
184
- {#if open}
185
- <div class={containerClass_} role="listbox" aria-labelledby="select-label">
186
- {#if searchable}
187
- <input
188
- bind:this={searchInputRef}
189
- bind:value={searchQuery}
190
- type="text"
191
- placeholder="Search..."
192
- class={searchInputClass_}
193
- aria-label="Search select options"
194
- />
253
+ <input
254
+ bind:this={searchInputRef}
255
+ bind:value={searchQuery}
256
+ type="text"
257
+ class="ring-0 outline-0"
258
+ placeholder="Search..."
259
+ aria-label="Search select options"
260
+ />
261
+ </div>
195
262
  {/if}
196
263
 
197
264
  {#if filteredItems.length === 0}
@@ -206,20 +273,37 @@
206
273
  disabled={item.disabled}
207
274
  class={itemClass_}
208
275
  role="option"
209
- aria-selected={value === item.value}
210
- data-selected={value === item.value}
276
+ aria-selected={valueArray.includes(item.value)}
277
+ data-selected={valueArray.includes(item.value)}
211
278
  data-highlighted={index === highlightedIndex}
212
279
  data-index={index}
213
280
  >
214
- {#if item.icon}
215
- {@const Icon = item.icon}
216
- <div class="flex items-center gap-2">
217
- <Icon class="h-4 w-4 flex-shrink-0" />
218
- <span>{item.label}</span>
219
- </div>
220
- {:else}
221
- {item.label}
222
- {/if}
281
+ <span class="flex w-full items-center justify-between">
282
+ <span class="flex items-center gap-2 overflow-hidden">
283
+ {#if item.icon}
284
+ {@const Icon = item.icon}
285
+ <Icon class="h-4 w-4 flex-shrink-0" />
286
+ {/if}
287
+ <span class="truncate">{item.label}</span>
288
+ </span>
289
+
290
+ {#if valueArray.includes(item.value)}
291
+ <svg
292
+ xmlns="http://www.w3.org/2000/svg"
293
+ width="16"
294
+ height="16"
295
+ viewBox="0 0 24 24"
296
+ fill="none"
297
+ stroke="currentColor"
298
+ stroke-width="2"
299
+ stroke-linecap="round"
300
+ stroke-linejoin="round"
301
+ class="text-info-500"
302
+ >
303
+ <polyline points="20 6 9 17 4 12" />
304
+ </svg>
305
+ {/if}
306
+ </span>
223
307
  </button>
224
308
  </li>
225
309
  {/each}
@@ -1,4 +1,4 @@
1
- import { type SelectProps } from './select.js';
1
+ import type { SelectProps } from '../../index.js';
2
2
  declare const Select: import("svelte").Component<SelectProps, {}, "value">;
3
3
  type Select = ReturnType<typeof Select>;
4
4
  export default Select;
@@ -1,6 +1,4 @@
1
- import type { Component, Snippet } from 'svelte';
2
- import type { ClassValue } from 'tailwind-variants';
3
- import { type VariantSizes } from '../../types/variants.js';
1
+ import { Size } from '../../variants.js';
4
2
  export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
5
3
  position: {
6
4
  'top-left': {
@@ -17,7 +15,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
17
15
  };
18
16
  };
19
17
  size: {
20
- xs: {
18
+ [Size.XS]: {
21
19
  trigger: string;
22
20
  item: string;
23
21
  itemIcon: string;
@@ -25,7 +23,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
25
23
  headerTitle: string;
26
24
  headerSubtitle: string;
27
25
  };
28
- sm: {
26
+ [Size.SM]: {
29
27
  trigger: string;
30
28
  item: string;
31
29
  itemIcon: string;
@@ -33,7 +31,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
33
31
  headerTitle: string;
34
32
  headerSubtitle: string;
35
33
  };
36
- base: {
34
+ [Size.BASE]: {
37
35
  trigger: string;
38
36
  item: string;
39
37
  itemIcon: string;
@@ -41,7 +39,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
41
39
  headerTitle: string;
42
40
  headerSubtitle: string;
43
41
  };
44
- lg: {
42
+ [Size.LG]: {
45
43
  trigger: string;
46
44
  item: string;
47
45
  itemIcon: string;
@@ -49,7 +47,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
49
47
  headerTitle: string;
50
48
  headerSubtitle: string;
51
49
  };
52
- xl: {
50
+ [Size.XL]: {
53
51
  trigger: string;
54
52
  item: string;
55
53
  itemIcon: string;
@@ -57,7 +55,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
57
55
  headerTitle: string;
58
56
  headerSubtitle: string;
59
57
  };
60
- "2xl": {
58
+ [Size.XXL]: {
61
59
  trigger: string;
62
60
  item: string;
63
61
  itemIcon: string;
@@ -69,6 +67,11 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
69
67
  isOpen: {
70
68
  true: {};
71
69
  };
70
+ iconOnly: {
71
+ true: {
72
+ trigger: string;
73
+ };
74
+ };
72
75
  }, {
73
76
  base: string;
74
77
  trigger: string;
@@ -95,7 +98,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
95
98
  };
96
99
  };
97
100
  size: {
98
- xs: {
101
+ [Size.XS]: {
99
102
  trigger: string;
100
103
  item: string;
101
104
  itemIcon: string;
@@ -103,7 +106,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
103
106
  headerTitle: string;
104
107
  headerSubtitle: string;
105
108
  };
106
- sm: {
109
+ [Size.SM]: {
107
110
  trigger: string;
108
111
  item: string;
109
112
  itemIcon: string;
@@ -111,7 +114,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
111
114
  headerTitle: string;
112
115
  headerSubtitle: string;
113
116
  };
114
- base: {
117
+ [Size.BASE]: {
115
118
  trigger: string;
116
119
  item: string;
117
120
  itemIcon: string;
@@ -119,7 +122,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
119
122
  headerTitle: string;
120
123
  headerSubtitle: string;
121
124
  };
122
- lg: {
125
+ [Size.LG]: {
123
126
  trigger: string;
124
127
  item: string;
125
128
  itemIcon: string;
@@ -127,7 +130,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
127
130
  headerTitle: string;
128
131
  headerSubtitle: string;
129
132
  };
130
- xl: {
133
+ [Size.XL]: {
131
134
  trigger: string;
132
135
  item: string;
133
136
  itemIcon: string;
@@ -135,7 +138,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
135
138
  headerTitle: string;
136
139
  headerSubtitle: string;
137
140
  };
138
- "2xl": {
141
+ [Size.XXL]: {
139
142
  trigger: string;
140
143
  item: string;
141
144
  itemIcon: string;
@@ -147,6 +150,11 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
147
150
  isOpen: {
148
151
  true: {};
149
152
  };
153
+ iconOnly: {
154
+ true: {
155
+ trigger: string;
156
+ };
157
+ };
150
158
  }, {
151
159
  base: string;
152
160
  trigger: string;
@@ -173,7 +181,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
173
181
  };
174
182
  };
175
183
  size: {
176
- xs: {
184
+ [Size.XS]: {
177
185
  trigger: string;
178
186
  item: string;
179
187
  itemIcon: string;
@@ -181,7 +189,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
181
189
  headerTitle: string;
182
190
  headerSubtitle: string;
183
191
  };
184
- sm: {
192
+ [Size.SM]: {
185
193
  trigger: string;
186
194
  item: string;
187
195
  itemIcon: string;
@@ -189,7 +197,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
189
197
  headerTitle: string;
190
198
  headerSubtitle: string;
191
199
  };
192
- base: {
200
+ [Size.BASE]: {
193
201
  trigger: string;
194
202
  item: string;
195
203
  itemIcon: string;
@@ -197,7 +205,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
197
205
  headerTitle: string;
198
206
  headerSubtitle: string;
199
207
  };
200
- lg: {
208
+ [Size.LG]: {
201
209
  trigger: string;
202
210
  item: string;
203
211
  itemIcon: string;
@@ -205,7 +213,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
205
213
  headerTitle: string;
206
214
  headerSubtitle: string;
207
215
  };
208
- xl: {
216
+ [Size.XL]: {
209
217
  trigger: string;
210
218
  item: string;
211
219
  itemIcon: string;
@@ -213,7 +221,7 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
213
221
  headerTitle: string;
214
222
  headerSubtitle: string;
215
223
  };
216
- "2xl": {
224
+ [Size.XXL]: {
217
225
  trigger: string;
218
226
  item: string;
219
227
  itemIcon: string;
@@ -225,6 +233,11 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
225
233
  isOpen: {
226
234
  true: {};
227
235
  };
236
+ iconOnly: {
237
+ true: {
238
+ trigger: string;
239
+ };
240
+ };
228
241
  }, {
229
242
  base: string;
230
243
  trigger: string;
@@ -236,39 +249,3 @@ export declare const dropdownMenu: import("tailwind-variants").TVReturnType<{
236
249
  item: string;
237
250
  itemIcon: string;
238
251
  }, undefined, unknown, unknown, undefined>>;
239
- export type DropdownItem = {
240
- label: string;
241
- href?: string;
242
- icon?: Component;
243
- onclick?: () => void;
244
- active?: boolean;
245
- disabled?: boolean;
246
- };
247
- export type DropSection = {
248
- items: DropdownItem[];
249
- };
250
- export type DropHeaderConfig = {
251
- title?: string;
252
- subtitle?: string;
253
- content?: Snippet<[]>;
254
- class?: ClassValue;
255
- titleClass?: ClassValue;
256
- subtitleClass?: ClassValue;
257
- onclick?: () => void;
258
- };
259
- export type DropdownMenuProps = {
260
- open?: boolean;
261
- sections: DropSection[];
262
- label?: string;
263
- icon?: Component;
264
- triggerContent?: Snippet<[]>;
265
- triggerClass?: ClassValue;
266
- containerClass?: ClassValue;
267
- itemClass?: ClassValue;
268
- class?: ClassValue;
269
- size?: VariantSizes;
270
- disabled?: boolean;
271
- position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
272
- width?: string;
273
- header?: DropHeaderConfig;
274
- };
@@ -1,15 +1,15 @@
1
1
  import { tv } from '../../helper/cls.js';
2
- import { Size } from '../../types/variants.js';
2
+ import { Size } from '../../variants.js';
3
3
  export const dropdownMenu = tv({
4
4
  slots: {
5
5
  base: 'relative inline-block text-left',
6
- trigger: 'inline-flex w-full justify-center items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-default-900 shadow-xs ring-1 ring-inset ring-default-300 hover:bg-default-50',
6
+ trigger: 'inline-flex w-full justify-center items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-default-900 shadow-xs ring-1 ring-inset ring-default-300 hover:bg-default-50 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed',
7
7
  container: 'absolute z-50 mt-2 origin-top-right divide-y divide-default-100 rounded-md bg-white ring-1 ring-black/5 shadow-lg focus:outline-none',
8
8
  section: 'py-1',
9
9
  header: 'flex flex-col px-4 py-2 w-full items-start',
10
10
  headerTitle: 'text-sm font-medium text-default-900',
11
11
  headerSubtitle: 'text-sm text-default-500',
12
- item: 'w-full group flex items-center px-4 py-2 text-sm text-default-700 hover:bg-default-100 hover:text-default-900 data-[active=true]:bg-default-100 data-[active=true]:text-default-900',
12
+ item: 'w-full group flex items-center px-4 py-2 text-sm text-default-700 hover:bg-default-100 hover:text-default-900 data-[active=true]:bg-default-100 data-[active=true]:text-default-900 disabled:opacity-50 disabled:cursor-not-allowed',
13
13
  itemIcon: 'mr-3 size-5 text-default-400 group-hover:text-default-500 group-data-[active=true]:text-default-500'
14
14
  },
15
15
  variants: {
@@ -79,11 +79,17 @@ export const dropdownMenu = tv({
79
79
  },
80
80
  isOpen: {
81
81
  true: {}
82
+ },
83
+ iconOnly: {
84
+ true: {
85
+ trigger: 'inline-flex justify-center items-center cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed bg-transparent shadow-none ring-0 hover:bg-transparent'
86
+ }
82
87
  }
83
88
  },
84
89
  defaultVariants: {
85
90
  position: 'bottom-right',
86
91
  size: Size.BASE,
87
- isOpen: false
92
+ isOpen: false,
93
+ iconOnly: false
88
94
  }
89
95
  });