@rkosafo/cai.components 0.0.74 → 0.0.78
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 +641 -641
- package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -53
- package/dist/forms/FormClEditor/ClEdito.svelte +68 -68
- package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -159
- package/dist/forms/FormFileUpload/FormFileUplad.svelte +134 -134
- package/dist/forms/FormInput/FormInput.svelte +87 -87
- package/dist/forms/FormRadio/FormRadio.svelte +53 -53
- package/dist/forms/FormSelect/FormSelect.svelte +88 -88
- package/dist/forms/FormTextarea/FormTextarea.svelte +78 -78
- package/dist/forms/button-toggle/ButtonToggle.svelte +119 -0
- package/dist/forms/button-toggle/ButtonToggle.svelte.d.ts +139 -0
- package/dist/forms/button-toggle/ButtonToggleGroup.svelte +0 -0
- package/dist/forms/button-toggle/ButtonToggleGroup.svelte.d.ts +26 -0
- package/dist/forms/button-toggle/CheckIcon.svelte +28 -0
- package/dist/forms/button-toggle/CheckIcon.svelte.d.ts +4 -0
- package/dist/forms/button-toggle/index.d.ts +4 -0
- package/dist/forms/button-toggle/index.js +4 -0
- package/dist/forms/button-toggle/theme.d.ts +347 -0
- package/dist/forms/button-toggle/theme.js +129 -0
- package/dist/forms/checkbox/Checkbox.svelte +82 -82
- package/dist/forms/checkbox/CheckboxButton.svelte +92 -92
- package/dist/forms/datepicker/Datepicker.svelte +707 -707
- 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 +56 -56
- package/dist/forms/textarea/Textarea.svelte +165 -165
- package/dist/forms/toggle/Toggle.svelte +70 -0
- package/dist/forms/toggle/Toggle.svelte.d.ts +3 -0
- package/dist/forms/toggle/index.d.ts +2 -0
- package/dist/forms/toggle/index.js +2 -0
- package/dist/forms/toggle/theme.d.ts +280 -0
- package/dist/forms/toggle/theme.js +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/layout/Chat/CategorySelector.svelte +52 -52
- package/dist/layout/Chat/ChatEntry.svelte +246 -246
- package/dist/layout/Chat/ChatEntrySkeleton.svelte +81 -81
- package/dist/layout/Chat/ChatHeader.svelte +172 -172
- package/dist/layout/Chat/ChatInput.svelte +207 -207
- package/dist/layout/Chat/DraggableWindow.svelte +230 -230
- package/dist/layout/Chat/PreviewPage.svelte +182 -182
- package/dist/layout/Chat/RichText.svelte +216 -216
- package/dist/layout/ComponentCanvas/Canvas.svelte +40 -40
- package/dist/layout/ComponentCanvas/ComponentRenderer.svelte +85 -85
- package/dist/layout/TF/Content/Content.svelte +21 -21
- package/dist/layout/TF/Header/Header.svelte +166 -166
- package/dist/layout/TF/Sidebar/Sidebar.svelte +148 -148
- package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -17
- package/dist/layout/mailing/MailPaginator.svelte +36 -36
- package/dist/layout/mailing/MailSidebar.svelte +39 -39
- package/dist/layout/mailing/MailToolBar.svelte +174 -174
- package/dist/layout/mailing/MailingContent.svelte +10 -10
- package/dist/layout/mailing/MailingHeader.svelte +55 -55
- package/dist/layout/mailing/MailingMessageCard.svelte +112 -112
- package/dist/layout/mailing/MailingMessageViewer.svelte +87 -87
- package/dist/layout/mailing/MailingModule.svelte +448 -448
- package/dist/styles/docs.css +615 -615
- package/dist/styles/tf-layout.css +185 -185
- package/dist/themes/ThemeProvider.svelte +20 -20
- package/dist/themes/themes.d.ts +3 -0
- package/dist/themes/themes.js +3 -0
- package/dist/types/index.d.ts +59 -2
- 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/box/Box.svelte +28 -28
- package/dist/ui/breadcrumb/Breadcrumb.svelte +39 -28
- package/dist/ui/buttons/ActionButton.svelte +234 -234
- package/dist/ui/buttons/Button.svelte +102 -102
- package/dist/ui/buttons/GradientButton.svelte +59 -59
- package/dist/ui/datatable/Datatable.svelte +525 -525
- package/dist/ui/drawer/Drawer.svelte +300 -300
- 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/icons/IconifyIcon.svelte +7 -7
- package/dist/ui/indicator/Indicator.svelte +42 -42
- package/dist/ui/modal/Modal.svelte +265 -265
- package/dist/ui/modal/theme.d.ts +26 -26
- package/dist/ui/modal/theme.js +25 -25
- package/dist/ui/notificationList/NotificationList.svelte +123 -123
- package/dist/ui/pageLoader/PageLoader.svelte +14 -14
- package/dist/ui/paginate/Paginate.svelte +96 -96
- package/dist/ui/speedDial/SpeedDial.svelte +77 -0
- package/dist/ui/speedDial/SpeedDial.svelte.d.ts +21 -0
- package/dist/ui/speedDial/SpeedDialButton.svelte +75 -0
- package/dist/ui/speedDial/SpeedDialButton.svelte.d.ts +20 -0
- package/dist/ui/speedDial/SpeedDialTrigger.svelte +79 -0
- package/dist/ui/speedDial/SpeedDialTrigger.svelte.d.ts +18 -0
- package/dist/ui/speedDial/index.d.ts +4 -0
- package/dist/ui/speedDial/index.js +4 -0
- package/dist/ui/speedDial/theme.d.ts +75 -0
- package/dist/ui/speedDial/theme.js +35 -0
- package/dist/ui/tab/Tab.svelte +67 -67
- package/dist/ui/table/Table.svelte +396 -394
- package/dist/ui/tableLoader/TableLoader.svelte +24 -24
- package/dist/ui/toast/Toast.svelte +337 -337
- package/dist/ui/toast/Toast.svelte.d.ts +10 -10
- package/dist/ui/toast/index.d.ts +1 -2
- package/dist/ui/toast/index.js +3 -1
- 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/ui/tooltip/Tooltip.svelte +51 -51
- package/dist/utils/Popper.svelte +257 -257
- package/dist/utils/closeButton/CloseButton.svelte +88 -88
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +13 -3
- package/dist/utils/singleSelection.svelte.js +48 -48
- package/dist/youtube/index.svelte +12 -12
- package/package.json +2 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Placement } from '@floating-ui/dom';
|
|
3
|
+
import { getContext, untrack } from 'svelte';
|
|
4
|
+
import { speedDialButton } from './theme.js';
|
|
5
|
+
import type { SpeedCtxType, SpeedDialButtonProps } from '../../index.js';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
|
|
8
|
+
import Button from '../buttons/Button.svelte';
|
|
9
|
+
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
10
|
+
|
|
11
|
+
const context = getContext<SpeedCtxType>('speed-dial');
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
name = '',
|
|
16
|
+
color = 'light',
|
|
17
|
+
tooltip: _tooltip,
|
|
18
|
+
pill = context.pill,
|
|
19
|
+
textOutside = context.textOutside,
|
|
20
|
+
textClass,
|
|
21
|
+
class: className,
|
|
22
|
+
classes,
|
|
23
|
+
...restProps
|
|
24
|
+
}: SpeedDialButtonProps = $props();
|
|
25
|
+
|
|
26
|
+
warnThemeDeprecation(
|
|
27
|
+
'SpeedDialButton',
|
|
28
|
+
untrack(() => ({ textClass })),
|
|
29
|
+
{ textClass: 'span' }
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const styling = $derived(
|
|
33
|
+
classes ?? {
|
|
34
|
+
span: textClass
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
let tooltip = $derived<Placement | 'none'>(_tooltip ?? context.tooltip);
|
|
39
|
+
|
|
40
|
+
const theme = $derived(getTheme('speedDialButton'));
|
|
41
|
+
|
|
42
|
+
let { base, span } = $derived(speedDialButton({ textOutside, noTooltip: tooltip === 'none' }));
|
|
43
|
+
let spanCls = $derived(
|
|
44
|
+
tooltip === 'none' || textOutside ? span({ class: clsx(theme?.span, styling.span) }) : 'sr-only'
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let buttonCls = $derived(base({ class: clsx(theme?.base, className) }));
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<Button {pill} {color} {...restProps} class={buttonCls}>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
<span class={spanCls}>{name}</span>
|
|
53
|
+
</Button>
|
|
54
|
+
|
|
55
|
+
{#if tooltip !== 'none'}
|
|
56
|
+
<Tooltip placement={tooltip} type="dark">{name}</Tooltip>
|
|
57
|
+
{/if}
|
|
58
|
+
|
|
59
|
+
<!--
|
|
60
|
+
@component
|
|
61
|
+
[Go to docs](https://flowbite-svelte.com/)
|
|
62
|
+
## Type
|
|
63
|
+
[SpeedDialButtonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1613)
|
|
64
|
+
## Props
|
|
65
|
+
@prop children
|
|
66
|
+
@prop name = ""
|
|
67
|
+
@prop color = "light"
|
|
68
|
+
@prop tooltip: _tooltip
|
|
69
|
+
@prop pill = context.pill
|
|
70
|
+
@prop textOutside = context.textOutside
|
|
71
|
+
@prop textClass
|
|
72
|
+
@prop class: className
|
|
73
|
+
@prop classes
|
|
74
|
+
@prop ...restProps
|
|
75
|
+
-->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SpeedDialButtonProps } from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
|
+
* ## Type
|
|
5
|
+
* [SpeedDialButtonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1613)
|
|
6
|
+
* ## Props
|
|
7
|
+
* @prop children
|
|
8
|
+
* @prop name = ""
|
|
9
|
+
* @prop color = "light"
|
|
10
|
+
* @prop tooltip: _tooltip
|
|
11
|
+
* @prop pill = context.pill
|
|
12
|
+
* @prop textOutside = context.textOutside
|
|
13
|
+
* @prop textClass
|
|
14
|
+
* @prop class: className
|
|
15
|
+
* @prop classes
|
|
16
|
+
* @prop ...restProps
|
|
17
|
+
*/
|
|
18
|
+
declare const SpeedDialButton: import("svelte").Component<SpeedDialButtonProps, {}, "">;
|
|
19
|
+
type SpeedDialButton = ReturnType<typeof SpeedDialButton>;
|
|
20
|
+
export default SpeedDialButton;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
import type { SpeedDialTriggerProps, ButtonProps, GradientButtonProps } from '../../index.js';
|
|
5
|
+
import GradientButton from '../buttons/GradientButton.svelte';
|
|
6
|
+
import Button from '../buttons/Button.svelte';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
name = 'Open actions menu',
|
|
11
|
+
gradient = false,
|
|
12
|
+
icon,
|
|
13
|
+
pill = true,
|
|
14
|
+
color,
|
|
15
|
+
class: className,
|
|
16
|
+
...restProps
|
|
17
|
+
}: SpeedDialTriggerProps = $props();
|
|
18
|
+
|
|
19
|
+
const buttonProps = $derived({
|
|
20
|
+
pill,
|
|
21
|
+
color,
|
|
22
|
+
...restProps,
|
|
23
|
+
class: ['group p-3!', clsx(className)]
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#snippet moving_cross()}
|
|
28
|
+
<svg
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
class="h-8 w-8 transition-transform group-hover:rotate-45"
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
+
>
|
|
36
|
+
<path
|
|
37
|
+
stroke-linecap="round"
|
|
38
|
+
stroke-linejoin="round"
|
|
39
|
+
stroke-width="2"
|
|
40
|
+
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
41
|
+
/>
|
|
42
|
+
</svg>
|
|
43
|
+
{/snippet}
|
|
44
|
+
|
|
45
|
+
{#if gradient}
|
|
46
|
+
<GradientButton {...buttonProps as GradientButtonProps}>
|
|
47
|
+
{#if icon}
|
|
48
|
+
{@render icon()}
|
|
49
|
+
{:else}
|
|
50
|
+
{@render moving_cross()}
|
|
51
|
+
{/if}
|
|
52
|
+
<span class="sr-only">{name}</span>
|
|
53
|
+
</GradientButton>
|
|
54
|
+
{:else}
|
|
55
|
+
<Button {...buttonProps as ButtonProps}>
|
|
56
|
+
{#if icon}
|
|
57
|
+
{@render icon()}
|
|
58
|
+
{:else}
|
|
59
|
+
{@render moving_cross()}
|
|
60
|
+
{/if}
|
|
61
|
+
<span class="sr-only">{name}</span>
|
|
62
|
+
</Button>
|
|
63
|
+
{/if}
|
|
64
|
+
|
|
65
|
+
<!--
|
|
66
|
+
@component
|
|
67
|
+
[Go to docs](https://flowbite-svelte.com/)
|
|
68
|
+
## Type
|
|
69
|
+
[SpeedDialTriggerProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1596)
|
|
70
|
+
## Props
|
|
71
|
+
@prop children
|
|
72
|
+
@prop name = "Open actions menu"
|
|
73
|
+
@prop gradient = false
|
|
74
|
+
@prop icon
|
|
75
|
+
@prop pill = true
|
|
76
|
+
@prop color
|
|
77
|
+
@prop class: className
|
|
78
|
+
@prop ...restProps
|
|
79
|
+
-->
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SpeedDialTriggerProps } from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
|
+
* ## Type
|
|
5
|
+
* [SpeedDialTriggerProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1596)
|
|
6
|
+
* ## Props
|
|
7
|
+
* @prop children
|
|
8
|
+
* @prop name = "Open actions menu"
|
|
9
|
+
* @prop gradient = false
|
|
10
|
+
* @prop icon
|
|
11
|
+
* @prop pill = true
|
|
12
|
+
* @prop color
|
|
13
|
+
* @prop class: className
|
|
14
|
+
* @prop ...restProps
|
|
15
|
+
*/
|
|
16
|
+
declare const SpeedDialTrigger: import("svelte").Component<SpeedDialTriggerProps, {}, "">;
|
|
17
|
+
type SpeedDialTrigger = ReturnType<typeof SpeedDialTrigger>;
|
|
18
|
+
export default SpeedDialTrigger;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Classes } from '../../themes/themeUtils.js';
|
|
2
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
+
export type SpeedDialVariants = VariantProps<typeof speedDial> & Classes<typeof speedDial>;
|
|
4
|
+
export type SpeedDialButtonVariants = VariantProps<typeof speedDialButton> & Classes<typeof speedDialButton>;
|
|
5
|
+
export declare const speedDial: import("tailwind-variants").TVReturnType<{
|
|
6
|
+
vertical: {
|
|
7
|
+
true: {
|
|
8
|
+
popper: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}, {
|
|
12
|
+
base: string;
|
|
13
|
+
popper: string;
|
|
14
|
+
}, undefined, {
|
|
15
|
+
vertical: {
|
|
16
|
+
true: {
|
|
17
|
+
popper: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
base: string;
|
|
22
|
+
popper: string;
|
|
23
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
24
|
+
vertical: {
|
|
25
|
+
true: {
|
|
26
|
+
popper: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
base: string;
|
|
31
|
+
popper: string;
|
|
32
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
33
|
+
export declare const speedDialButton: import("tailwind-variants").TVReturnType<{
|
|
34
|
+
noTooltip: {
|
|
35
|
+
false: {};
|
|
36
|
+
true: {};
|
|
37
|
+
};
|
|
38
|
+
textOutside: {
|
|
39
|
+
true: {
|
|
40
|
+
base: string;
|
|
41
|
+
span: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
base: string;
|
|
46
|
+
span: string;
|
|
47
|
+
}, undefined, {
|
|
48
|
+
noTooltip: {
|
|
49
|
+
false: {};
|
|
50
|
+
true: {};
|
|
51
|
+
};
|
|
52
|
+
textOutside: {
|
|
53
|
+
true: {
|
|
54
|
+
base: string;
|
|
55
|
+
span: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
base: string;
|
|
60
|
+
span: string;
|
|
61
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
62
|
+
noTooltip: {
|
|
63
|
+
false: {};
|
|
64
|
+
true: {};
|
|
65
|
+
};
|
|
66
|
+
textOutside: {
|
|
67
|
+
true: {
|
|
68
|
+
base: string;
|
|
69
|
+
span: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
73
|
+
base: string;
|
|
74
|
+
span: string;
|
|
75
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const speedDial = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: 'group bg-transparent',
|
|
5
|
+
popper: 'flex items-center gap-2 bg-transparent text-inherit'
|
|
6
|
+
},
|
|
7
|
+
variants: {
|
|
8
|
+
vertical: {
|
|
9
|
+
true: { popper: 'flex-col' }
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
vertical: false
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export const speedDialButton = tv({
|
|
17
|
+
slots: {
|
|
18
|
+
base: 'w-[52px] h-[52px] shadow-xs p-0',
|
|
19
|
+
span: 'mb-px text-xs font-medium'
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
noTooltip: {
|
|
23
|
+
false: {},
|
|
24
|
+
true: {}
|
|
25
|
+
},
|
|
26
|
+
textOutside: {
|
|
27
|
+
true: {
|
|
28
|
+
base: 'relative',
|
|
29
|
+
span: 'absolute -start-12 top-1/2 mb-px text-sm font-medium -translate-y-1/2'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
compoundVariants: [{ noTooltip: true, textOutside: false, class: { base: 'flex flex-col' } }],
|
|
34
|
+
defaultVariants: {}
|
|
35
|
+
});
|
package/dist/ui/tab/Tab.svelte
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { CloseButton, type TabProps } from '../../index.js';
|
|
3
|
-
|
|
4
|
-
let {
|
|
5
|
-
activeTab = $bindable(0),
|
|
6
|
-
tabs = [],
|
|
7
|
-
onTabChange,
|
|
8
|
-
onRemoveTab,
|
|
9
|
-
onTabAdd
|
|
10
|
-
}: TabProps = $props();
|
|
11
|
-
|
|
12
|
-
function changeTab(id: number | string) {
|
|
13
|
-
activeTab = id;
|
|
14
|
-
onTabChange?.(id);
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div class="relative flex h-full w-full flex-col">
|
|
19
|
-
<div class="mb-4 flex flex-wrap space-x-3 border-b border-gray-300">
|
|
20
|
-
{#each tabs as tab}
|
|
21
|
-
<button
|
|
22
|
-
class="rounded-t-md border-b-2 px-4 py-2"
|
|
23
|
-
class:bg-primary-500={activeTab === tab.id}
|
|
24
|
-
class:text-white={activeTab === tab.id}
|
|
25
|
-
class:text-gray-600={activeTab !== tab.id}
|
|
26
|
-
class:hover:bg-gray-100={activeTab !== tab.id}
|
|
27
|
-
class:border-transparent={activeTab !== tab.id}
|
|
28
|
-
class:border-white={activeTab === tab.id}
|
|
29
|
-
onclick={() => changeTab(tab.id)}
|
|
30
|
-
>
|
|
31
|
-
<div class="flex items-center gap-2">
|
|
32
|
-
<span class="text-sm">
|
|
33
|
-
{tab.title}
|
|
34
|
-
</span>
|
|
35
|
-
{#if tab.icon}
|
|
36
|
-
<iconify-icon icon={tab.icon} style="font-size: 15px;"></iconify-icon>
|
|
37
|
-
{/if}
|
|
38
|
-
{#if tab.isClosable}
|
|
39
|
-
<CloseButton
|
|
40
|
-
size="sm"
|
|
41
|
-
class=" {activeTab === tab.id
|
|
42
|
-
? 'text-white hover:bg-white/20'
|
|
43
|
-
: 'text-gray-600 hover:bg-gray-200'}"
|
|
44
|
-
onclick={(e: any) => {
|
|
45
|
-
onRemoveTab?.({ tabId: tab.id });
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
{/if}
|
|
50
|
-
</div>
|
|
51
|
-
</button>
|
|
52
|
-
{/each}
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class=" h-full w-full">
|
|
56
|
-
{#each tabs as tab (tab.id)}
|
|
57
|
-
<div class:hidden={activeTab !== tab.id} class="h-full w-full">
|
|
58
|
-
<!-- {@render tab.children({
|
|
59
|
-
...tab,
|
|
60
|
-
onTabAdd,
|
|
61
|
-
onRemoveTab
|
|
62
|
-
})} -->
|
|
63
|
-
<tab.children {...tab} {...tab.props} {onTabAdd} {onRemoveTab} />
|
|
64
|
-
</div>
|
|
65
|
-
{/each}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CloseButton, type TabProps } from '../../index.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
activeTab = $bindable(0),
|
|
6
|
+
tabs = [],
|
|
7
|
+
onTabChange,
|
|
8
|
+
onRemoveTab,
|
|
9
|
+
onTabAdd
|
|
10
|
+
}: TabProps = $props();
|
|
11
|
+
|
|
12
|
+
function changeTab(id: number | string) {
|
|
13
|
+
activeTab = id;
|
|
14
|
+
onTabChange?.(id);
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div class="relative flex h-full w-full flex-col">
|
|
19
|
+
<div class="mb-4 flex flex-wrap space-x-3 border-b border-gray-300">
|
|
20
|
+
{#each tabs as tab}
|
|
21
|
+
<button
|
|
22
|
+
class="rounded-t-md border-b-2 px-4 py-2"
|
|
23
|
+
class:bg-primary-500={activeTab === tab.id}
|
|
24
|
+
class:text-white={activeTab === tab.id}
|
|
25
|
+
class:text-gray-600={activeTab !== tab.id}
|
|
26
|
+
class:hover:bg-gray-100={activeTab !== tab.id}
|
|
27
|
+
class:border-transparent={activeTab !== tab.id}
|
|
28
|
+
class:border-white={activeTab === tab.id}
|
|
29
|
+
onclick={() => changeTab(tab.id)}
|
|
30
|
+
>
|
|
31
|
+
<div class="flex items-center gap-2">
|
|
32
|
+
<span class="text-sm">
|
|
33
|
+
{tab.title}
|
|
34
|
+
</span>
|
|
35
|
+
{#if tab.icon}
|
|
36
|
+
<iconify-icon icon={tab.icon} style="font-size: 15px;"></iconify-icon>
|
|
37
|
+
{/if}
|
|
38
|
+
{#if tab.isClosable}
|
|
39
|
+
<CloseButton
|
|
40
|
+
size="sm"
|
|
41
|
+
class=" {activeTab === tab.id
|
|
42
|
+
? 'text-white hover:bg-white/20'
|
|
43
|
+
: 'text-gray-600 hover:bg-gray-200'}"
|
|
44
|
+
onclick={(e: any) => {
|
|
45
|
+
onRemoveTab?.({ tabId: tab.id });
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
51
|
+
</button>
|
|
52
|
+
{/each}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class=" h-full w-full">
|
|
56
|
+
{#each tabs as tab (tab.id)}
|
|
57
|
+
<div class:hidden={activeTab !== tab.id} class="h-full w-full">
|
|
58
|
+
<!-- {@render tab.children({
|
|
59
|
+
...tab,
|
|
60
|
+
onTabAdd,
|
|
61
|
+
onRemoveTab
|
|
62
|
+
})} -->
|
|
63
|
+
<tab.children {...tab} {...tab.props} {onTabAdd} {onRemoveTab} />
|
|
64
|
+
</div>
|
|
65
|
+
{/each}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|