@rkosafo/cai.components 0.0.5 → 0.0.7
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.
- package/README.md +8 -8
- package/dist/baseEditor/index.svelte +32 -32
- package/dist/builders/filters/FilterBuilder.svelte +638 -638
- package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -53
- package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -159
- package/dist/forms/FormInput/FormInput.svelte +87 -87
- package/dist/forms/FormRadio/FormRadio.svelte +53 -53
- package/dist/forms/FormSelect/FormSelect.svelte +86 -86
- package/dist/forms/FormTextarea/FormTextarea.svelte +77 -77
- package/dist/forms/checkbox/Checkbox.svelte +82 -82
- package/dist/forms/checkbox/CheckboxButton.svelte +92 -92
- package/dist/forms/datepicker/Datepicker.svelte +706 -706
- package/dist/forms/form/Form.svelte +69 -69
- package/dist/forms/input/Input.svelte +363 -363
- package/dist/forms/label/Label.svelte +38 -38
- package/dist/forms/radio/Radio.svelte +48 -48
- package/dist/forms/radio/RadioButton.svelte +22 -22
- package/dist/forms/select/Select.svelte +50 -50
- package/dist/forms/textarea/Textarea.svelte +165 -165
- package/dist/layout/TF/Content/Content.svelte +28 -28
- package/dist/layout/TF/Header/Header.svelte +159 -159
- package/dist/layout/TF/Sidebar/Sidebar.svelte +52 -74
- package/dist/layout/TF/Sidebar/Sidebar.svelte.d.ts +1 -20
- package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -17
- package/dist/themes/ThemeProvider.svelte +20 -20
- package/dist/types/index.d.ts +19 -0
- package/dist/typography/heading/Heading.svelte +35 -35
- package/dist/ui/accordion/Accordion.svelte +49 -49
- package/dist/ui/accordion/AccordionItem.svelte +173 -173
- package/dist/ui/alert/Alert.svelte +83 -83
- package/dist/ui/alertDialog/AlertDialog.svelte +40 -40
- package/dist/ui/avatar/Avatar.svelte +77 -77
- package/dist/ui/buttons/Button.svelte +102 -102
- package/dist/ui/buttons/GradientButton.svelte +59 -59
- package/dist/ui/datatable/Datatable.svelte +516 -516
- package/dist/ui/drawer/Drawer.svelte +280 -280
- package/dist/ui/dropdown/Dropdown.svelte +36 -36
- package/dist/ui/dropdown/DropdownDivider.svelte +11 -11
- package/dist/ui/dropdown/DropdownGroup.svelte +14 -14
- package/dist/ui/dropdown/DropdownHeader.svelte +14 -14
- package/dist/ui/dropdown/DropdownItem.svelte +52 -52
- package/dist/ui/footer/Footer.svelte +15 -15
- package/dist/ui/footer/FooterBrand.svelte +37 -37
- package/dist/ui/footer/FooterCopyright.svelte +45 -45
- package/dist/ui/footer/FooterIcon.svelte +22 -22
- package/dist/ui/footer/FooterLink.svelte +33 -33
- package/dist/ui/footer/FooterLinkGroup.svelte +13 -13
- package/dist/ui/indicator/Indicator.svelte +42 -42
- package/dist/ui/modal/Modal.svelte +265 -265
- package/dist/ui/notificationList/NotificationList.svelte +123 -123
- package/dist/ui/pageLoader/PageLoader.svelte +10 -10
- package/dist/ui/paginate/Paginate.svelte +96 -96
- package/dist/ui/tab/Tab.svelte +65 -65
- package/dist/ui/table/Table.svelte +385 -385
- package/dist/ui/tableLoader/TableLoader.svelte +24 -24
- package/dist/ui/toolbar/Toolbar.svelte +59 -59
- package/dist/ui/toolbar/ToolbarButton.svelte +56 -56
- package/dist/ui/toolbar/ToolbarGroup.svelte +43 -43
- package/dist/utils/Popper.svelte +257 -257
- package/dist/utils/closeButton/CloseButton.svelte +88 -88
- package/dist/utils/singleSelection.svelte.js +48 -48
- package/dist/youtube/index.svelte +12 -12
- package/package.json +2 -2
|
@@ -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
|
+
"version": "0.0.7",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"!dist/**/*.test.*",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"semantic-release": "^24.2.9",
|
|
38
38
|
"svelte": "^5.0.0",
|
|
39
39
|
"svelte-check": "^4.0.0",
|
|
40
|
-
"svelte-headless-table": "^0.18.3",
|
|
41
40
|
"tailwindcss": "^4.0.0",
|
|
42
41
|
"typescript": "^5.0.0",
|
|
43
42
|
"vite": "^7.0.4",
|
|
@@ -62,6 +61,7 @@
|
|
|
62
61
|
"mdsvex": "^0.12.6",
|
|
63
62
|
"nanoid": "^5.1.5",
|
|
64
63
|
"svelecte": "^5.3.0",
|
|
64
|
+
"svelte-headless-table": "^0.18.3",
|
|
65
65
|
"svelte-meta-tags": "^4.4.0",
|
|
66
66
|
"tailwind-merge": "^3.3.1",
|
|
67
67
|
"tailwind-variants": "^2.1.0",
|