@rkosafo/cai.components 0.0.1 → 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 (255) hide show
  1. package/dist/baseEditor/index.svelte +32 -0
  2. package/dist/baseEditor/index.svelte.d.ts +18 -0
  3. package/dist/builders/filters/FilterBuilder.svelte +638 -0
  4. package/dist/builders/filters/FilterBuilder.svelte.d.ts +4 -0
  5. package/dist/builders/filters/index.d.ts +1 -0
  6. package/dist/builders/filters/index.js +1 -0
  7. package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -0
  8. package/dist/forms/FormCheckbox/FormCheckbox.svelte.d.ts +4 -0
  9. package/dist/forms/FormCheckbox/index.d.ts +1 -0
  10. package/dist/forms/FormCheckbox/index.js +1 -0
  11. package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -0
  12. package/dist/forms/FormDatepicker/FormDatepicker.svelte.d.ts +13 -0
  13. package/dist/forms/FormDatepicker/index.d.ts +1 -0
  14. package/dist/forms/FormDatepicker/index.js +1 -0
  15. package/dist/forms/FormInput/FormInput.svelte +87 -0
  16. package/dist/forms/FormInput/FormInput.svelte.d.ts +4 -0
  17. package/dist/forms/FormInput/index.d.ts +1 -0
  18. package/dist/forms/FormInput/index.js +1 -0
  19. package/dist/forms/FormRadio/FormRadio.svelte +53 -0
  20. package/dist/forms/FormRadio/FormRadio.svelte.d.ts +4 -0
  21. package/dist/forms/FormRadio/index.d.ts +1 -0
  22. package/dist/forms/FormRadio/index.js +1 -0
  23. package/dist/forms/FormSelect/FormSelect.svelte +86 -0
  24. package/dist/forms/FormSelect/FormSelect.svelte.d.ts +4 -0
  25. package/dist/forms/FormSelect/index.d.ts +1 -0
  26. package/dist/forms/FormSelect/index.js +1 -0
  27. package/dist/forms/FormTextarea/FormTextarea.svelte +77 -0
  28. package/dist/forms/FormTextarea/FormTextarea.svelte.d.ts +4 -0
  29. package/dist/forms/FormTextarea/index.d.ts +1 -0
  30. package/dist/forms/FormTextarea/index.js +1 -0
  31. package/dist/forms/checkbox/Checkbox.svelte +82 -0
  32. package/dist/forms/checkbox/Checkbox.svelte.d.ts +4 -0
  33. package/dist/forms/checkbox/CheckboxButton.svelte +92 -0
  34. package/dist/forms/checkbox/CheckboxButton.svelte.d.ts +18 -0
  35. package/dist/forms/checkbox/index.d.ts +3 -0
  36. package/dist/forms/checkbox/index.js +3 -0
  37. package/dist/forms/checkbox/theme.d.ts +317 -0
  38. package/dist/forms/checkbox/theme.js +113 -0
  39. package/dist/forms/datepicker/Datepicker.svelte +706 -0
  40. package/dist/forms/datepicker/Datepicker.svelte.d.ts +41 -0
  41. package/dist/forms/datepicker/index.d.ts +2 -0
  42. package/dist/forms/datepicker/index.js +2 -0
  43. package/dist/forms/datepicker/theme.d.ts +385 -0
  44. package/dist/forms/datepicker/theme.js +56 -0
  45. package/dist/forms/form/Form.svelte +69 -0
  46. package/dist/forms/form/Form.svelte.d.ts +6 -0
  47. package/dist/forms/form/index.d.ts +2 -0
  48. package/dist/forms/form/index.js +2 -0
  49. package/dist/forms/input/Input.svelte +363 -0
  50. package/dist/forms/input/Input.svelte.d.ts +4 -0
  51. package/dist/forms/input/index.d.ts +4 -0
  52. package/dist/forms/input/index.js +5 -0
  53. package/dist/forms/input/theme.d.ts +301 -0
  54. package/dist/forms/input/theme.js +100 -0
  55. package/dist/forms/label/Label.svelte +38 -0
  56. package/dist/forms/label/Label.svelte.d.ts +15 -0
  57. package/dist/forms/label/index.d.ts +2 -0
  58. package/dist/forms/label/index.js +2 -0
  59. package/dist/forms/label/theme.d.ts +75 -0
  60. package/dist/forms/label/theme.js +29 -0
  61. package/dist/forms/radio/Radio.svelte +48 -0
  62. package/dist/forms/radio/Radio.svelte.d.ts +25 -0
  63. package/dist/forms/radio/RadioButton.svelte +22 -0
  64. package/dist/forms/radio/RadioButton.svelte.d.ts +25 -0
  65. package/dist/forms/radio/index.d.ts +3 -0
  66. package/dist/forms/radio/index.js +3 -0
  67. package/dist/forms/radio/theme.d.ts +290 -0
  68. package/dist/forms/radio/theme.js +95 -0
  69. package/dist/forms/select/Select.svelte +50 -0
  70. package/dist/forms/select/Select.svelte.d.ts +4 -0
  71. package/dist/forms/select/index.d.ts +1 -0
  72. package/dist/forms/select/index.js +1 -0
  73. package/dist/forms/textarea/Textarea.svelte +165 -0
  74. package/dist/forms/textarea/Textarea.svelte.d.ts +4 -0
  75. package/dist/forms/textarea/index.d.ts +2 -0
  76. package/dist/forms/textarea/index.js +2 -0
  77. package/dist/forms/textarea/theme.d.ts +100 -0
  78. package/dist/forms/textarea/theme.js +35 -0
  79. package/dist/index.d.ts +42 -2
  80. package/dist/index.js +42 -2
  81. package/dist/layout/TF/Content/Content.svelte +28 -0
  82. package/dist/layout/TF/Content/Content.svelte.d.ts +8 -0
  83. package/dist/layout/TF/Content/index.d.ts +1 -0
  84. package/dist/layout/TF/Content/index.js +1 -0
  85. package/dist/layout/TF/Header/Header.svelte +159 -0
  86. package/dist/layout/TF/Header/Header.svelte.d.ts +21 -0
  87. package/dist/layout/TF/Header/index.d.ts +1 -0
  88. package/dist/layout/TF/Header/index.js +1 -0
  89. package/dist/layout/TF/Sidebar/Sidebar.svelte +74 -0
  90. package/dist/layout/TF/Sidebar/Sidebar.svelte.d.ts +23 -0
  91. package/dist/layout/TF/Sidebar/index.d.ts +1 -0
  92. package/dist/layout/TF/Sidebar/index.js +1 -0
  93. package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -0
  94. package/dist/layout/TF/Wrapper/Wrapper.svelte.d.ts +8 -0
  95. package/dist/layout/TF/Wrapper/index.d.ts +1 -0
  96. package/dist/layout/TF/Wrapper/index.js +1 -0
  97. package/dist/layout/TF/index.d.ts +5 -0
  98. package/dist/layout/TF/index.js +5 -0
  99. package/dist/themes/ThemeProvider.svelte +20 -0
  100. package/dist/themes/ThemeProvider.svelte.d.ts +9 -0
  101. package/dist/themes/index.d.ts +7 -0
  102. package/dist/themes/index.js +1 -0
  103. package/dist/themes/themeUtils.d.ts +24 -0
  104. package/dist/themes/themeUtils.js +74 -0
  105. package/dist/themes/themes.d.ts +18 -0
  106. package/dist/themes/themes.js +18 -0
  107. package/dist/types/index.d.ts +755 -0
  108. package/dist/types/index.js +1 -0
  109. package/dist/typography/heading/Heading.svelte +35 -0
  110. package/dist/typography/heading/Heading.svelte.d.ts +10 -0
  111. package/dist/typography/heading/index.d.ts +2 -0
  112. package/dist/typography/heading/index.js +2 -0
  113. package/dist/typography/heading/theme.d.ts +30 -0
  114. package/dist/typography/heading/theme.js +17 -0
  115. package/dist/ui/accordion/Accordion.svelte +49 -0
  116. package/dist/ui/accordion/Accordion.svelte.d.ts +4 -0
  117. package/dist/ui/accordion/AccordionItem.svelte +173 -0
  118. package/dist/ui/accordion/AccordionItem.svelte.d.ts +4 -0
  119. package/dist/ui/accordion/index.d.ts +3 -0
  120. package/dist/ui/accordion/index.js +3 -0
  121. package/dist/ui/accordion/theme.d.ts +96 -0
  122. package/dist/ui/accordion/theme.js +59 -0
  123. package/dist/ui/alert/Alert.svelte +83 -0
  124. package/dist/ui/alert/Alert.svelte.d.ts +5 -0
  125. package/dist/ui/alert/index.d.ts +2 -0
  126. package/dist/ui/alert/index.js +2 -0
  127. package/dist/ui/alert/theme.d.ts +108 -0
  128. package/dist/ui/alert/theme.js +149 -0
  129. package/dist/ui/alertDialog/AlertDialog.svelte +40 -0
  130. package/dist/ui/alertDialog/AlertDialog.svelte.d.ts +4 -0
  131. package/dist/ui/alertDialog/index.d.ts +1 -0
  132. package/dist/ui/alertDialog/index.js +1 -0
  133. package/dist/ui/avatar/Avatar.svelte +77 -0
  134. package/dist/ui/avatar/Avatar.svelte.d.ts +4 -0
  135. package/dist/ui/avatar/index.d.ts +2 -0
  136. package/dist/ui/avatar/index.js +2 -0
  137. package/dist/ui/avatar/theme.d.ts +63 -0
  138. package/dist/ui/avatar/theme.js +31 -0
  139. package/dist/ui/buttons/Button.svelte +102 -0
  140. package/dist/ui/buttons/Button.svelte.d.ts +4 -0
  141. package/dist/ui/buttons/GradientButton.svelte +59 -0
  142. package/dist/ui/buttons/GradientButton.svelte.d.ts +4 -0
  143. package/dist/ui/buttons/index.d.ts +3 -0
  144. package/dist/ui/buttons/index.js +3 -0
  145. package/dist/ui/buttons/theme.d.ts +704 -0
  146. package/dist/ui/buttons/theme.js +332 -0
  147. package/dist/ui/datatable/Datatable.svelte +516 -0
  148. package/dist/ui/datatable/Datatable.svelte.d.ts +5 -0
  149. package/dist/ui/datatable/index.d.ts +2 -0
  150. package/dist/ui/datatable/index.js +2 -0
  151. package/dist/ui/drawer/Drawer.svelte +280 -0
  152. package/dist/ui/drawer/Drawer.svelte.d.ts +37 -0
  153. package/dist/ui/drawer/index.d.ts +2 -0
  154. package/dist/ui/drawer/index.js +2 -0
  155. package/dist/ui/drawer/theme.d.ts +211 -0
  156. package/dist/ui/drawer/theme.js +46 -0
  157. package/dist/ui/dropdown/Dropdown.svelte +36 -0
  158. package/dist/ui/dropdown/Dropdown.svelte.d.ts +4 -0
  159. package/dist/ui/dropdown/DropdownDivider.svelte +11 -0
  160. package/dist/ui/dropdown/DropdownDivider.svelte.d.ts +4 -0
  161. package/dist/ui/dropdown/DropdownGroup.svelte +14 -0
  162. package/dist/ui/dropdown/DropdownGroup.svelte.d.ts +4 -0
  163. package/dist/ui/dropdown/DropdownHeader.svelte +14 -0
  164. package/dist/ui/dropdown/DropdownHeader.svelte.d.ts +4 -0
  165. package/dist/ui/dropdown/DropdownItem.svelte +52 -0
  166. package/dist/ui/dropdown/DropdownItem.svelte.d.ts +4 -0
  167. package/dist/ui/dropdown/index.d.ts +6 -0
  168. package/dist/ui/dropdown/index.js +6 -0
  169. package/dist/ui/dropdown/theme.d.ts +55 -0
  170. package/dist/ui/dropdown/theme.js +20 -0
  171. package/dist/ui/footer/Footer.svelte +15 -0
  172. package/dist/ui/footer/Footer.svelte.d.ts +4 -0
  173. package/dist/ui/footer/FooterBrand.svelte +37 -0
  174. package/dist/ui/footer/FooterBrand.svelte.d.ts +4 -0
  175. package/dist/ui/footer/FooterCopyright.svelte +45 -0
  176. package/dist/ui/footer/FooterCopyright.svelte.d.ts +4 -0
  177. package/dist/ui/footer/FooterIcon.svelte +22 -0
  178. package/dist/ui/footer/FooterIcon.svelte.d.ts +4 -0
  179. package/dist/ui/footer/FooterLink.svelte +33 -0
  180. package/dist/ui/footer/FooterLink.svelte.d.ts +4 -0
  181. package/dist/ui/footer/FooterLinkGroup.svelte +13 -0
  182. package/dist/ui/footer/FooterLinkGroup.svelte.d.ts +4 -0
  183. package/dist/ui/footer/index.d.ts +7 -0
  184. package/dist/ui/footer/index.js +7 -0
  185. package/dist/ui/footer/theme.d.ts +137 -0
  186. package/dist/ui/footer/theme.js +39 -0
  187. package/dist/ui/indicator/Indicator.svelte +42 -0
  188. package/dist/ui/indicator/Indicator.svelte.d.ts +4 -0
  189. package/dist/ui/indicator/index.d.ts +2 -0
  190. package/dist/ui/indicator/index.js +2 -0
  191. package/dist/ui/indicator/theme.d.ts +177 -0
  192. package/dist/ui/indicator/theme.js +114 -0
  193. package/dist/ui/modal/Modal.svelte +265 -0
  194. package/dist/ui/modal/Modal.svelte.d.ts +38 -0
  195. package/dist/ui/modal/index.d.ts +2 -0
  196. package/dist/ui/modal/index.js +2 -0
  197. package/dist/ui/modal/theme.d.ts +190 -0
  198. package/dist/ui/modal/theme.js +41 -0
  199. package/dist/ui/notificationList/NotificationList.svelte +123 -0
  200. package/dist/ui/notificationList/NotificationList.svelte.d.ts +25 -0
  201. package/dist/ui/notificationList/index.d.ts +1 -0
  202. package/dist/ui/notificationList/index.js +1 -0
  203. package/dist/ui/pageLoader/PageLoader.svelte +10 -0
  204. package/dist/ui/pageLoader/PageLoader.svelte.d.ts +4 -0
  205. package/dist/ui/pageLoader/index.d.ts +1 -0
  206. package/dist/ui/pageLoader/index.js +1 -0
  207. package/dist/ui/paginate/Paginate.svelte +96 -0
  208. package/dist/ui/paginate/Paginate.svelte.d.ts +4 -0
  209. package/dist/ui/paginate/index.d.ts +1 -0
  210. package/dist/ui/paginate/index.js +1 -0
  211. package/dist/ui/tab/Tab.svelte +65 -0
  212. package/dist/ui/tab/Tab.svelte.d.ts +4 -0
  213. package/dist/ui/tab/index.d.ts +2 -0
  214. package/dist/ui/tab/index.js +2 -0
  215. package/dist/ui/tab/theme.d.ts +135 -0
  216. package/dist/ui/tab/theme.js +83 -0
  217. package/dist/ui/table/Table.svelte +385 -0
  218. package/dist/ui/table/Table.svelte.d.ts +4 -0
  219. package/dist/ui/table/index.d.ts +1 -0
  220. package/dist/ui/table/index.js +1 -0
  221. package/dist/ui/tableLoader/TableLoader.svelte +24 -0
  222. package/dist/ui/tableLoader/TableLoader.svelte.d.ts +13 -0
  223. package/dist/ui/tableLoader/index.d.ts +1 -0
  224. package/dist/ui/tableLoader/index.js +1 -0
  225. package/dist/ui/toolbar/Toolbar.svelte +59 -0
  226. package/dist/ui/toolbar/Toolbar.svelte.d.ts +17 -0
  227. package/dist/ui/toolbar/ToolbarButton.svelte +56 -0
  228. package/dist/ui/toolbar/ToolbarButton.svelte.d.ts +17 -0
  229. package/dist/ui/toolbar/ToolbarGroup.svelte +43 -0
  230. package/dist/ui/toolbar/ToolbarGroup.svelte.d.ts +16 -0
  231. package/dist/ui/toolbar/index.d.ts +4 -0
  232. package/dist/ui/toolbar/index.js +4 -0
  233. package/dist/ui/toolbar/theme.d.ts +320 -0
  234. package/dist/ui/toolbar/theme.js +155 -0
  235. package/dist/utils/Popper.svelte +257 -0
  236. package/dist/utils/Popper.svelte.d.ts +4 -0
  237. package/dist/utils/action.d.ts +16 -0
  238. package/dist/utils/action.js +107 -0
  239. package/dist/utils/closeButton/CloseButton.svelte +88 -0
  240. package/dist/utils/closeButton/CloseButton.svelte.d.ts +12 -0
  241. package/dist/utils/closeButton/index.d.ts +2 -0
  242. package/dist/utils/closeButton/index.js +2 -0
  243. package/dist/utils/closeButton/theme.d.ts +100 -0
  244. package/dist/utils/closeButton/theme.js +69 -0
  245. package/dist/utils/dismissable.d.ts +9 -0
  246. package/dist/utils/dismissable.js +16 -0
  247. package/dist/utils/index.d.ts +8 -0
  248. package/dist/utils/index.js +35 -0
  249. package/dist/utils/paginate.svelte.d.ts +22 -0
  250. package/dist/utils/paginate.svelte.js +167 -0
  251. package/dist/utils/singleSelection.svelte.d.ts +15 -0
  252. package/dist/utils/singleSelection.svelte.js +49 -0
  253. package/dist/utils/svelte-legos.d.ts +7 -0
  254. package/dist/utils/svelte-legos.js +14 -0
  255. package/package.json +24 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ <script lang="ts" module>
2
+ // heading
3
+ export interface HeadingProps extends HTMLAttributes<HTMLElement> {
4
+ children: Snippet;
5
+ tag?: HeadingVariants['tag'];
6
+ }
7
+
8
+ // // hr
9
+ // export interface HrProps extends HrVariants, HTMLAttributes<HTMLElement> {
10
+ // children?: Snippet;
11
+ // divClass?: string;
12
+ // iconDivClass?: string;
13
+ // textSpanClass?: string;
14
+ // innerDivClass?: string;
15
+ // }
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ import { getTheme } from '../../index.js';
20
+ import clsx from 'clsx';
21
+ import { heading } from './index.js';
22
+ import type { HTMLAttributes } from 'svelte/elements';
23
+ import type { Snippet } from 'svelte';
24
+ import type { HeadingVariants } from './theme.js';
25
+
26
+ let { children, tag = 'h1', class: className, ...restProps }: HeadingProps = $props();
27
+
28
+ const theme = getTheme('heading');
29
+
30
+ let headingCls = $derived(heading({ tag, class: clsx(theme, className) }));
31
+ </script>
32
+
33
+ <svelte:element this={tag} {...restProps} class={headingCls}>
34
+ {@render children()}
35
+ </svelte:element>
@@ -0,0 +1,10 @@
1
+ export interface HeadingProps extends HTMLAttributes<HTMLElement> {
2
+ children: Snippet;
3
+ tag?: HeadingVariants['tag'];
4
+ }
5
+ import type { HTMLAttributes } from 'svelte/elements';
6
+ import type { Snippet } from 'svelte';
7
+ import type { HeadingVariants } from './theme.js';
8
+ declare const Heading: import("svelte").Component<HeadingProps, {}, "">;
9
+ type Heading = ReturnType<typeof Heading>;
10
+ export default Heading;
@@ -0,0 +1,2 @@
1
+ export { default as Heading } from "./Heading.svelte";
2
+ export { heading } from "./theme.js";
@@ -0,0 +1,2 @@
1
+ export { default as Heading } from "./Heading.svelte";
2
+ export { heading } from "./theme.js";
@@ -0,0 +1,30 @@
1
+ import { type VariantProps } from "tailwind-variants";
2
+ export type HeadingVariants = VariantProps<typeof heading>;
3
+ export declare const heading: import("tailwind-variants").TVReturnType<{
4
+ tag: {
5
+ h1: string;
6
+ h2: string;
7
+ h3: string;
8
+ h4: string;
9
+ h5: string;
10
+ h6: string;
11
+ };
12
+ }, undefined, "font-bold text-gray-900 dark:text-white", {
13
+ tag: {
14
+ h1: string;
15
+ h2: string;
16
+ h3: string;
17
+ h4: string;
18
+ h5: string;
19
+ h6: string;
20
+ };
21
+ }, undefined, import("tailwind-variants").TVReturnType<{
22
+ tag: {
23
+ h1: string;
24
+ h2: string;
25
+ h3: string;
26
+ h4: string;
27
+ h5: string;
28
+ h6: string;
29
+ };
30
+ }, undefined, "font-bold text-gray-900 dark:text-white", unknown, unknown, undefined>>;
@@ -0,0 +1,17 @@
1
+ import { tv } from "tailwind-variants";
2
+ export const heading = tv({
3
+ base: "font-bold text-gray-900 dark:text-white",
4
+ variants: {
5
+ tag: {
6
+ h1: "text-5xl font-extrabold",
7
+ h2: "text-4xl",
8
+ h3: "text-3xl",
9
+ h4: "text-2xl",
10
+ h5: "text-xl",
11
+ h6: "text-lg"
12
+ }
13
+ },
14
+ defaultVariants: {
15
+ tag: "h1"
16
+ }
17
+ });
@@ -0,0 +1,49 @@
1
+ <script lang="ts">
2
+ import { accordion, getTheme, type AccordionCtxType, type AccordionProps } from '../../index.js';
3
+ import { createSingleSelectionContext } from '../../utils/singleSelection.svelte.js';
4
+ import clsx from 'clsx';
5
+ import { setContext } from 'svelte';
6
+
7
+ let {
8
+ children,
9
+ flush,
10
+ activeClass,
11
+ inactiveClass,
12
+ multiple = false,
13
+ class: className,
14
+ transitionType,
15
+ ...restProps
16
+ }: AccordionProps = $props();
17
+
18
+ const theme = getTheme('accordion');
19
+
20
+ const ctx: AccordionCtxType = $state({
21
+ flush,
22
+ activeClass,
23
+ inactiveClass,
24
+ transitionType
25
+ });
26
+
27
+ setContext<AccordionCtxType>('ctx', ctx);
28
+
29
+ createSingleSelectionContext(multiple);
30
+
31
+ const base = $derived(accordion({ flush, class: clsx(theme, className) }));
32
+ </script>
33
+
34
+ <div {...restProps} class={base}>
35
+ {@render children()}
36
+ </div>
37
+
38
+ <!--
39
+
40
+ ## Props
41
+ @prop children
42
+ @prop flush
43
+ @prop activeClass
44
+ @prop inactiveClass
45
+ @prop multiple = false
46
+ @prop class: className
47
+ @prop transitionType
48
+ @prop ...restProps
49
+ -->
@@ -0,0 +1,4 @@
1
+ import { type AccordionProps } from '../../index.js';
2
+ declare const Accordion: import("svelte").Component<AccordionProps, {}, "">;
3
+ type Accordion = ReturnType<typeof Accordion>;
4
+ export default Accordion;
@@ -0,0 +1,173 @@
1
+ <script lang="ts">
2
+ import {
3
+ accordionItem,
4
+ type AccordionCtxType,
5
+ type AccordionItemProps,
6
+ type ParamsType
7
+ } from '../../index.js';
8
+ import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
9
+ import { useSingleSelection } from '../../utils/singleSelection.svelte.js';
10
+ import clsx from 'clsx';
11
+ import { getContext } from 'svelte';
12
+ import { slide } from 'svelte/transition';
13
+
14
+ let {
15
+ children,
16
+ header,
17
+ arrowup,
18
+ arrowdown,
19
+ open = $bindable(false),
20
+ activeClass,
21
+ inactiveClass,
22
+ transitionType = slide,
23
+ transitionParams,
24
+ class: className,
25
+ classes,
26
+ headerClass,
27
+ contentClass
28
+ }: AccordionItemProps = $props();
29
+
30
+ warnThemeDeprecation(
31
+ 'AccordionItem',
32
+ {
33
+ headerClass,
34
+ contentClass,
35
+ activeClass,
36
+ inactiveClass
37
+ },
38
+ {
39
+ headerClass: 'button',
40
+ contentClass: 'content',
41
+ activeClass: 'active',
42
+ inactiveClass: 'inactive'
43
+ }
44
+ );
45
+
46
+ let styling: typeof classes = $derived(
47
+ classes ?? {
48
+ button: headerClass,
49
+ content: contentClass,
50
+ active: activeClass,
51
+ inactive: inactiveClass
52
+ }
53
+ );
54
+
55
+ const ctx: AccordionCtxType = getContext('ctx') ?? {};
56
+
57
+ const ctxTransitionType = ctx.transitionType ?? transitionType;
58
+ // Check if transitionType is explicitly set to undefined in props
59
+ const useTransition =
60
+ transitionType === 'none' ? false : ctxTransitionType === 'none' ? false : true;
61
+
62
+ // Theme context
63
+ const theme = getTheme('accordionItem');
64
+
65
+ // single selection
66
+ const self = Symbol('accordion-item');
67
+
68
+ const updateSingleSelection = useSingleSelection<symbol>((value) => (open = value === self));
69
+
70
+ $effect(() => {
71
+ updateSingleSelection(open, self);
72
+ });
73
+
74
+ const handleToggle = () => {
75
+ open = !open;
76
+ };
77
+
78
+ const { base, button, content, active, inactive } = $derived(
79
+ accordionItem({ flush: ctx.flush, open })
80
+ );
81
+
82
+ let buttonClass = $derived(
83
+ clsx(
84
+ open && !ctx.flush && (styling.active || ctx.activeClass || active()),
85
+ !open && !ctx.flush && (styling.inactive || ctx.inactiveClass || inactive())
86
+ )
87
+ );
88
+ </script>
89
+
90
+ <h2 class={base({ class: clsx(theme?.base, className) })}>
91
+ <button
92
+ type="button"
93
+ onclick={handleToggle}
94
+ class={button({ class: clsx(buttonClass, theme?.button, styling.button) })}
95
+ aria-expanded={open}
96
+ >
97
+ {#if header}
98
+ {@render header()}
99
+ {#if open}
100
+ {#if !arrowup}
101
+ <svg
102
+ class="h-3 w-3 text-gray-800 dark:text-white"
103
+ aria-hidden="true"
104
+ xmlns="http://www.w3.org/2000/svg"
105
+ fill="none"
106
+ viewBox="0 0 10 6"
107
+ >
108
+ <path
109
+ stroke="currentColor"
110
+ stroke-linecap="round"
111
+ stroke-linejoin="round"
112
+ stroke-width="2"
113
+ d="M9 5 5 1 1 5"
114
+ />
115
+ </svg>
116
+ {:else}
117
+ {@render arrowup()}
118
+ {/if}
119
+ {:else if !arrowdown}
120
+ <svg
121
+ class="h-3 w-3 text-gray-800 dark:text-white"
122
+ aria-hidden="true"
123
+ xmlns="http://www.w3.org/2000/svg"
124
+ fill="none"
125
+ viewBox="0 0 10 6"
126
+ >
127
+ <path
128
+ stroke="currentColor"
129
+ stroke-linecap="round"
130
+ stroke-linejoin="round"
131
+ stroke-width="2"
132
+ d="m1 1 4 4 4-4"
133
+ />
134
+ </svg>
135
+ {:else}
136
+ {@render arrowdown()}
137
+ {/if}
138
+ {/if}
139
+ </button>
140
+ </h2>
141
+
142
+ {#if useTransition}
143
+ {#if open && transitionType !== 'none'}
144
+ <div transition:transitionType={transitionParams as ParamsType}>
145
+ <div class={content({ class: clsx(theme?.content, styling.content) })}>
146
+ {@render children()}
147
+ </div>
148
+ </div>
149
+ {/if}
150
+ {:else}
151
+ <div class={open ? 'block' : 'hidden'}>
152
+ <div class={content({ class: clsx(theme?.content, styling.content) })}>
153
+ {@render children()}
154
+ </div>
155
+ </div>
156
+ {/if}
157
+
158
+ <!--
159
+ ## Props
160
+ @prop children
161
+ @prop header
162
+ @prop arrowup
163
+ @prop arrowdown
164
+ @prop open = $bindable(false)
165
+ @prop activeClass
166
+ @prop inactiveClass
167
+ @prop transitionType = slide
168
+ @prop transitionParams
169
+ @prop class: className
170
+ @prop classes
171
+ @prop headerClass
172
+ @prop contentClass
173
+ -->
@@ -0,0 +1,4 @@
1
+ import { type AccordionItemProps } from '../../index.js';
2
+ declare const AccordionItem: import("svelte").Component<AccordionItemProps, {}, "open">;
3
+ type AccordionItem = ReturnType<typeof AccordionItem>;
4
+ export default AccordionItem;
@@ -0,0 +1,3 @@
1
+ export { default as Accordion } from "./Accordion.svelte";
2
+ export { default as AccordionItem } from "./AccordionItem.svelte";
3
+ export { accordion, accordionItem } from "./theme.js";
@@ -0,0 +1,3 @@
1
+ export { default as Accordion } from "./Accordion.svelte";
2
+ export { default as AccordionItem } from "./AccordionItem.svelte";
3
+ export { accordion, accordionItem } from "./theme.js";
@@ -0,0 +1,96 @@
1
+ import type { Classes } from '../../themes/themeUtils.js';
2
+ import { type VariantProps } from 'tailwind-variants';
3
+ export type AccordionVariants = VariantProps<typeof accordion>;
4
+ export type AccordionItemVariants = VariantProps<typeof accordionItem> & Classes<typeof accordionItem>;
5
+ export declare const accordion: import("tailwind-variants").TVReturnType<{
6
+ color: {
7
+ primary: string;
8
+ secondary: string;
9
+ };
10
+ flush: {
11
+ true: string;
12
+ false: string;
13
+ };
14
+ }, undefined, "w-full", {
15
+ color: {
16
+ primary: string;
17
+ secondary: string;
18
+ };
19
+ flush: {
20
+ true: string;
21
+ false: string;
22
+ };
23
+ }, undefined, import("tailwind-variants").TVReturnType<{
24
+ color: {
25
+ primary: string;
26
+ secondary: string;
27
+ };
28
+ flush: {
29
+ true: string;
30
+ false: string;
31
+ };
32
+ }, undefined, "w-full", unknown, unknown, undefined>>;
33
+ export declare const accordionItem: import("tailwind-variants").TVReturnType<{
34
+ flush: {
35
+ true: {
36
+ button: string;
37
+ content: string;
38
+ };
39
+ false: {
40
+ button: string;
41
+ content: string;
42
+ };
43
+ };
44
+ open: {
45
+ true: {};
46
+ false: {};
47
+ };
48
+ }, {
49
+ base: string;
50
+ button: string;
51
+ content: string;
52
+ active: string;
53
+ inactive: string;
54
+ }, undefined, {
55
+ flush: {
56
+ true: {
57
+ button: string;
58
+ content: string;
59
+ };
60
+ false: {
61
+ button: string;
62
+ content: string;
63
+ };
64
+ };
65
+ open: {
66
+ true: {};
67
+ false: {};
68
+ };
69
+ }, {
70
+ base: string;
71
+ button: string;
72
+ content: string;
73
+ active: string;
74
+ inactive: string;
75
+ }, import("tailwind-variants").TVReturnType<{
76
+ flush: {
77
+ true: {
78
+ button: string;
79
+ content: string;
80
+ };
81
+ false: {
82
+ button: string;
83
+ content: string;
84
+ };
85
+ };
86
+ open: {
87
+ true: {};
88
+ false: {};
89
+ };
90
+ }, {
91
+ base: string;
92
+ button: string;
93
+ content: string;
94
+ active: string;
95
+ inactive: string;
96
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,59 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const accordion = tv({
3
+ base: 'w-full',
4
+ variants: {
5
+ color: {
6
+ primary: 'text-primary-500 dark:text-primary-400',
7
+ secondary: 'text-secondary-500 dark:text-secondary-400'
8
+ },
9
+ flush: {
10
+ true: '',
11
+ false: 'border border-gray-200 dark:border-gray-700 rounded-t-xl'
12
+ }
13
+ }
14
+ });
15
+ export const accordionItem = tv({
16
+ slots: {
17
+ base: 'group',
18
+ button: 'flex items-center justify-between w-full font-medium text-left group-first:rounded-t-xl border-gray-200 dark:border-gray-700 border-b',
19
+ content: 'border-b border-gray-200 dark:border-gray-700',
20
+ active: 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800',
21
+ inactive: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800'
22
+ },
23
+ variants: {
24
+ flush: {
25
+ true: {
26
+ button: 'py-5',
27
+ content: 'py-5'
28
+ },
29
+ false: {
30
+ button: 'p-5 border-s border-e group-first:border-t',
31
+ content: 'p-5 border-s border-e'
32
+ }
33
+ },
34
+ open: {
35
+ true: {},
36
+ false: {}
37
+ }
38
+ },
39
+ compoundVariants: [
40
+ {
41
+ flush: true,
42
+ open: true,
43
+ class: {
44
+ button: 'text-gray-900 dark:text-white'
45
+ }
46
+ },
47
+ {
48
+ flush: true,
49
+ open: false,
50
+ class: {
51
+ button: 'text-gray-500 dark:text-gray-400'
52
+ }
53
+ }
54
+ ],
55
+ defaultVariants: {
56
+ flush: false,
57
+ open: false
58
+ }
59
+ });
@@ -0,0 +1,83 @@
1
+ <script lang="ts">
2
+ import { fade } from 'svelte/transition';
3
+ import clsx from 'clsx';
4
+ import { getTheme } from '../../index.js';
5
+ import type { AlertVariants } from './theme.js';
6
+ import type { HTMLAttributes } from 'svelte/elements';
7
+ import type { Component, Snippet } from 'svelte';
8
+ import type { AlertProps, ParamsType, TransitionFunc } from '../../types/index.js';
9
+ import { createDismissableContext } from '../../utils/dismissable.js';
10
+ import { CloseButton } from '../../utils/closeButton/index.js';
11
+ import { alert } from './theme.js';
12
+
13
+ let {
14
+ children,
15
+ icon,
16
+ alertStatus = $bindable(true),
17
+ closeIcon: CloseIcon,
18
+ color = 'primary',
19
+ rounded = true,
20
+ border,
21
+ class: className,
22
+ dismissable,
23
+ transition = fade,
24
+ params,
25
+ ...restProps
26
+ }: AlertProps = $props();
27
+
28
+ // Theme context
29
+ const theme = getTheme('alert');
30
+
31
+ let divCls = $derived(
32
+ alert({
33
+ color,
34
+ rounded,
35
+ border,
36
+ icon: !!icon,
37
+ dismissable,
38
+ class: clsx(theme, className)
39
+ })
40
+ );
41
+
42
+ let ref: HTMLDivElement | undefined = $state(undefined);
43
+
44
+ function close(event: MouseEvent) {
45
+ if (ref?.dispatchEvent(new Event('close', { bubbles: true, cancelable: true }))) {
46
+ alertStatus = false;
47
+ }
48
+ }
49
+
50
+ createDismissableContext(close);
51
+ </script>
52
+
53
+ {#if alertStatus}
54
+ <div
55
+ role="alert"
56
+ bind:this={ref}
57
+ {...restProps}
58
+ transition:transition={params as ParamsType}
59
+ class={divCls}
60
+ >
61
+ {#if icon}
62
+ {@render icon()}
63
+ {/if}
64
+
65
+ {#if icon || dismissable}
66
+ <div>
67
+ {@render children()}
68
+ </div>
69
+ {:else}
70
+ {@render children()}
71
+ {/if}
72
+
73
+ {#if dismissable}
74
+ {#if CloseIcon}
75
+ <CloseButton class="-my-1.5 ms-auto -me-1.5" {color} ariaLabel="Remove alert">
76
+ <CloseIcon />
77
+ </CloseButton>
78
+ {:else}
79
+ <CloseButton class="-my-1.5 ms-auto -me-1.5" {color} ariaLabel="Remove alert" />
80
+ {/if}
81
+ {/if}
82
+ </div>
83
+ {/if}
@@ -0,0 +1,5 @@
1
+ import type { Component } from 'svelte';
2
+ import type { AlertProps } from '../../types/index.js';
3
+ declare const Alert: Component<AlertProps, {}, "alertStatus">;
4
+ type Alert = ReturnType<typeof Alert>;
5
+ export default Alert;
@@ -0,0 +1,2 @@
1
+ export { default as Alert } from "./Alert.svelte";
2
+ export { alert } from "./theme.js";
@@ -0,0 +1,2 @@
1
+ export { default as Alert } from "./Alert.svelte";
2
+ export { alert } from "./theme.js";