@rkosafo/cai.components 0.0.3 → 0.0.6

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 (61) hide show
  1. package/README.md +8 -8
  2. package/dist/baseEditor/index.svelte +32 -32
  3. package/dist/builders/filters/FilterBuilder.svelte +638 -638
  4. package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -53
  5. package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -159
  6. package/dist/forms/FormInput/FormInput.svelte +87 -87
  7. package/dist/forms/FormRadio/FormRadio.svelte +53 -53
  8. package/dist/forms/FormSelect/FormSelect.svelte +86 -86
  9. package/dist/forms/FormTextarea/FormTextarea.svelte +77 -77
  10. package/dist/forms/checkbox/Checkbox.svelte +82 -82
  11. package/dist/forms/checkbox/CheckboxButton.svelte +92 -92
  12. package/dist/forms/datepicker/Datepicker.svelte +706 -706
  13. package/dist/forms/form/Form.svelte +69 -69
  14. package/dist/forms/input/Input.svelte +363 -363
  15. package/dist/forms/label/Label.svelte +38 -38
  16. package/dist/forms/radio/Radio.svelte +48 -48
  17. package/dist/forms/radio/RadioButton.svelte +22 -22
  18. package/dist/forms/select/Select.svelte +50 -50
  19. package/dist/forms/textarea/Textarea.svelte +165 -165
  20. package/dist/layout/TF/Content/Content.svelte +28 -28
  21. package/dist/layout/TF/Header/Header.svelte +159 -159
  22. package/dist/layout/TF/Sidebar/Sidebar.svelte +74 -74
  23. package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -17
  24. package/dist/themes/ThemeProvider.svelte +20 -20
  25. package/dist/typography/heading/Heading.svelte +35 -35
  26. package/dist/ui/accordion/Accordion.svelte +49 -49
  27. package/dist/ui/accordion/AccordionItem.svelte +173 -173
  28. package/dist/ui/alert/Alert.svelte +83 -83
  29. package/dist/ui/alertDialog/AlertDialog.svelte +40 -40
  30. package/dist/ui/avatar/Avatar.svelte +77 -77
  31. package/dist/ui/buttons/Button.svelte +102 -102
  32. package/dist/ui/buttons/GradientButton.svelte +59 -59
  33. package/dist/ui/datatable/Datatable.svelte +516 -516
  34. package/dist/ui/drawer/Drawer.svelte +280 -280
  35. package/dist/ui/dropdown/Dropdown.svelte +36 -36
  36. package/dist/ui/dropdown/DropdownDivider.svelte +11 -11
  37. package/dist/ui/dropdown/DropdownGroup.svelte +14 -14
  38. package/dist/ui/dropdown/DropdownHeader.svelte +14 -14
  39. package/dist/ui/dropdown/DropdownItem.svelte +52 -52
  40. package/dist/ui/footer/Footer.svelte +15 -15
  41. package/dist/ui/footer/FooterBrand.svelte +37 -37
  42. package/dist/ui/footer/FooterCopyright.svelte +45 -45
  43. package/dist/ui/footer/FooterIcon.svelte +22 -22
  44. package/dist/ui/footer/FooterLink.svelte +33 -33
  45. package/dist/ui/footer/FooterLinkGroup.svelte +13 -13
  46. package/dist/ui/indicator/Indicator.svelte +42 -42
  47. package/dist/ui/modal/Modal.svelte +265 -265
  48. package/dist/ui/notificationList/NotificationList.svelte +123 -123
  49. package/dist/ui/pageLoader/PageLoader.svelte +10 -10
  50. package/dist/ui/paginate/Paginate.svelte +96 -96
  51. package/dist/ui/tab/Tab.svelte +65 -65
  52. package/dist/ui/table/Table.svelte +385 -385
  53. package/dist/ui/tableLoader/TableLoader.svelte +24 -24
  54. package/dist/ui/toolbar/Toolbar.svelte +59 -59
  55. package/dist/ui/toolbar/ToolbarButton.svelte +56 -56
  56. package/dist/ui/toolbar/ToolbarGroup.svelte +43 -43
  57. package/dist/utils/Popper.svelte +257 -257
  58. package/dist/utils/closeButton/CloseButton.svelte +88 -88
  59. package/dist/utils/singleSelection.svelte.js +48 -48
  60. package/dist/youtube/index.svelte +12 -12
  61. package/package.json +7 -3
@@ -1,88 +1,88 @@
1
- <script lang="ts" module>
2
- export type CloseButtonProps = CloseButtonVariants &
3
- AnchorButtonAttributes & {
4
- onclick?: (ev: MouseEvent) => void;
5
- name?: string;
6
- ariaLabel?: string;
7
- class?: string;
8
- svgClass?: string;
9
- };
10
- </script>
11
-
12
- <script lang="ts">
13
- import clsx from 'clsx';
14
- import { closeButton } from './index.js';
15
- import { useDismiss } from '../dismissable.js';
16
- import type { AnchorButtonAttributes } from '../../types/index.js';
17
- import type { CloseButtonVariants } from './theme.js';
18
-
19
- let {
20
- children,
21
- color = 'gray',
22
- onclick: onclickorg,
23
- name = 'Close',
24
- ariaLabel,
25
- size = 'md',
26
- class: className,
27
- svgClass,
28
- ...restProps
29
- }: CloseButtonProps = $props();
30
-
31
- const { base, svg } = $derived(closeButton({ color, size }));
32
-
33
- const context = useDismiss();
34
-
35
- function onclick(event: MouseEvent) {
36
- onclickorg?.(event);
37
- if (event.defaultPrevented) return;
38
- context?.dismiss?.(event);
39
- }
40
- </script>
41
-
42
- {#if restProps.href === undefined}
43
- <button
44
- type="button"
45
- {...restProps}
46
- class={base({ class: clsx(className) })}
47
- {onclick}
48
- aria-label={ariaLabel ?? name}
49
- >
50
- {#if name}<span class="sr-only">{name}</span>{/if}
51
- {#if children}
52
- {@render children()}
53
- {:else}
54
- <svg
55
- class={svg({ class: svgClass })}
56
- fill="currentColor"
57
- viewBox="0 0 20 20"
58
- xmlns="http://www.w3.org/2000/svg"
59
- >
60
- <path
61
- fill-rule="evenodd"
62
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
63
- clip-rule="evenodd"
64
- />
65
- </svg>
66
- {/if}
67
- </button>
68
- {:else}
69
- <a
70
- {...restProps}
71
- {onclick}
72
- class={base({ class: clsx(className) })}
73
- aria-label={ariaLabel ?? name}
74
- >
75
- {#if name}<span class="sr-only">{name}</span>{/if}
76
- {#if children}
77
- {@render children()}
78
- {:else}
79
- <svg class={svg()} fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
80
- <path
81
- fill-rule="evenodd"
82
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
83
- clip-rule="evenodd"
84
- />
85
- </svg>
86
- {/if}
87
- </a>
88
- {/if}
1
+ <script lang="ts" module>
2
+ export type CloseButtonProps = CloseButtonVariants &
3
+ AnchorButtonAttributes & {
4
+ onclick?: (ev: MouseEvent) => void;
5
+ name?: string;
6
+ ariaLabel?: string;
7
+ class?: string;
8
+ svgClass?: string;
9
+ };
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import clsx from 'clsx';
14
+ import { closeButton } from './index.js';
15
+ import { useDismiss } from '../dismissable.js';
16
+ import type { AnchorButtonAttributes } from '../../types/index.js';
17
+ import type { CloseButtonVariants } from './theme.js';
18
+
19
+ let {
20
+ children,
21
+ color = 'gray',
22
+ onclick: onclickorg,
23
+ name = 'Close',
24
+ ariaLabel,
25
+ size = 'md',
26
+ class: className,
27
+ svgClass,
28
+ ...restProps
29
+ }: CloseButtonProps = $props();
30
+
31
+ const { base, svg } = $derived(closeButton({ color, size }));
32
+
33
+ const context = useDismiss();
34
+
35
+ function onclick(event: MouseEvent) {
36
+ onclickorg?.(event);
37
+ if (event.defaultPrevented) return;
38
+ context?.dismiss?.(event);
39
+ }
40
+ </script>
41
+
42
+ {#if restProps.href === undefined}
43
+ <button
44
+ type="button"
45
+ {...restProps}
46
+ class={base({ class: clsx(className) })}
47
+ {onclick}
48
+ aria-label={ariaLabel ?? name}
49
+ >
50
+ {#if name}<span class="sr-only">{name}</span>{/if}
51
+ {#if children}
52
+ {@render children()}
53
+ {:else}
54
+ <svg
55
+ class={svg({ class: svgClass })}
56
+ fill="currentColor"
57
+ viewBox="0 0 20 20"
58
+ xmlns="http://www.w3.org/2000/svg"
59
+ >
60
+ <path
61
+ fill-rule="evenodd"
62
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
63
+ clip-rule="evenodd"
64
+ />
65
+ </svg>
66
+ {/if}
67
+ </button>
68
+ {:else}
69
+ <a
70
+ {...restProps}
71
+ {onclick}
72
+ class={base({ class: clsx(className) })}
73
+ aria-label={ariaLabel ?? name}
74
+ >
75
+ {#if name}<span class="sr-only">{name}</span>{/if}
76
+ {#if children}
77
+ {@render children()}
78
+ {:else}
79
+ <svg class={svg()} fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
80
+ <path
81
+ fill-rule="evenodd"
82
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
83
+ clip-rule="evenodd"
84
+ />
85
+ </svg>
86
+ {/if}
87
+ </a>
88
+ {/if}
@@ -1,49 +1,49 @@
1
- import { getContext, setContext } from "svelte";
2
-
3
- /**
4
- * @template T
5
- * @typedef {Object} SingleSelectionContext
6
- * @property {T=} value
7
- */
8
-
9
- /** @type {symbol} */
10
- const SINGLE_SELECTION_KEY = Symbol("singleton");
11
-
12
- /**
13
- * @template T
14
- * @param {boolean} [nonReactive=false] - use a non-reactive placeholder to allow multiple selection and keep context shallow
15
- * @returns {SingleSelectionContext<T>}
16
- */
17
- export function createSingleSelectionContext(nonReactive = false) {
18
- const context = $state({ value: undefined });
19
- return setContext(SINGLE_SELECTION_KEY, nonReactive ? {} : context);
20
- }
21
-
22
- /**
23
- * @template T
24
- * @param {SingleSelectionContext<T>} context
25
- * @param {boolean} open
26
- * @param {T=} value
27
- * @returns {SingleSelectionContext<T>}
28
- */
29
- function setSelected(context, open, value) {
30
- if (Object.hasOwn(context, 'value')) {
31
- if (open) context.value = value;
32
- else if (context.value === value) context.value = undefined;
33
- }
34
- return context;
35
- }
36
-
37
- /**
38
- * @template T
39
- * @param {(value: T) => void} callback
40
- * @returns {(open: boolean, v?: T) => SingleSelectionContext<T>}
41
- */
42
- export function useSingleSelection(callback) {
43
- const context = getContext(SINGLE_SELECTION_KEY) ?? createSingleSelectionContext(false);
44
-
45
- $effect(() => {
46
- if (context.value !== undefined) callback(context.value);
47
- });
48
- return (open, v) => setSelected(context, open, v);
1
+ import { getContext, setContext } from "svelte";
2
+
3
+ /**
4
+ * @template T
5
+ * @typedef {Object} SingleSelectionContext
6
+ * @property {T=} value
7
+ */
8
+
9
+ /** @type {symbol} */
10
+ const SINGLE_SELECTION_KEY = Symbol("singleton");
11
+
12
+ /**
13
+ * @template T
14
+ * @param {boolean} [nonReactive=false] - use a non-reactive placeholder to allow multiple selection and keep context shallow
15
+ * @returns {SingleSelectionContext<T>}
16
+ */
17
+ export function createSingleSelectionContext(nonReactive = false) {
18
+ const context = $state({ value: undefined });
19
+ return setContext(SINGLE_SELECTION_KEY, nonReactive ? {} : context);
20
+ }
21
+
22
+ /**
23
+ * @template T
24
+ * @param {SingleSelectionContext<T>} context
25
+ * @param {boolean} open
26
+ * @param {T=} value
27
+ * @returns {SingleSelectionContext<T>}
28
+ */
29
+ function setSelected(context, open, value) {
30
+ if (Object.hasOwn(context, 'value')) {
31
+ if (open) context.value = value;
32
+ else if (context.value === value) context.value = undefined;
33
+ }
34
+ return context;
35
+ }
36
+
37
+ /**
38
+ * @template T
39
+ * @param {(value: T) => void} callback
40
+ * @returns {(open: boolean, v?: T) => SingleSelectionContext<T>}
41
+ */
42
+ export function useSingleSelection(callback) {
43
+ const context = getContext(SINGLE_SELECTION_KEY) ?? createSingleSelectionContext(false);
44
+
45
+ $effect(() => {
46
+ if (context.value !== undefined) callback(context.value);
47
+ });
48
+ return (open, v) => setSelected(context, open, v);
49
49
  }
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- let { url, videoId } = $props()
3
- </script>
4
-
5
-
6
- <div>
7
- <div class="bg-red-100 p-4 m-4">
8
- {url}
9
-
10
- </div>
11
- <br/>
12
- {videoId}
1
+ <script lang="ts">
2
+ let { url, videoId } = $props()
3
+ </script>
4
+
5
+
6
+ <div>
7
+ <div class="bg-red-100 p-4 m-4">
8
+ {url}
9
+
10
+ </div>
11
+ <br/>
12
+ {videoId}
13
13
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkosafo/cai.components",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -29,16 +29,19 @@
29
29
  "@tailwindcss/forms": "^0.5.9",
30
30
  "@tailwindcss/typography": "^0.5.15",
31
31
  "@tailwindcss/vite": "^4.0.0",
32
+ "@vitest/ui": "^3.2.4",
32
33
  "prettier": "^3.4.2",
33
34
  "prettier-plugin-svelte": "^3.3.3",
34
35
  "prettier-plugin-tailwindcss": "^0.6.11",
35
36
  "publint": "^0.3.2",
37
+ "semantic-release": "^24.2.9",
36
38
  "svelte": "^5.0.0",
37
39
  "svelte-check": "^4.0.0",
38
40
  "svelte-headless-table": "^0.18.3",
39
41
  "tailwindcss": "^4.0.0",
40
42
  "typescript": "^5.0.0",
41
- "vite": "^7.0.4"
43
+ "vite": "^7.0.4",
44
+ "vitest": "^3.2.4"
42
45
  },
43
46
  "keywords": [
44
47
  "cai"
@@ -74,6 +77,7 @@
74
77
  "lint": "prettier --check .",
75
78
  "use:npmReadme": "mv README.md github.README.md && mv npm.README.md README.md",
76
79
  "use:githubReadme": "mv README.md npm.README.md && mv github.README.md README.md",
77
- "npm:publish": "pnpm publish --access public"
80
+ "npm:publish": "pnpm publish --access public",
81
+ "test": "vitest run"
78
82
  }
79
83
  }