@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,49 +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
- -->
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
+ -->
@@ -1,173 +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
- -->
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
+ -->
@@ -1,83 +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}
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}