@rkosafo/cai.components 0.0.78 → 0.0.80
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 -119
- package/dist/forms/button-toggle/CheckIcon.svelte +28 -28
- 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 -70
- 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/types/index.d.ts +2 -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/box/Box.svelte +28 -28
- package/dist/ui/breadcrumb/Breadcrumb.svelte +39 -39
- 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/notificationList/NotificationList.svelte +123 -123
- package/dist/ui/pageLoader/PageLoader.svelte +14 -14
- package/dist/ui/pageLoader/PageLoader2.svelte +99 -0
- package/dist/ui/pageLoader/PageLoader2.svelte.d.ts +24 -0
- package/dist/ui/pageLoader/index.d.ts +2 -1
- package/dist/ui/pageLoader/index.js +2 -1
- package/dist/ui/paginate/Paginate.svelte +96 -96
- package/dist/ui/speedDial/SpeedDial.svelte +77 -77
- package/dist/ui/speedDial/SpeedDialButton.svelte +75 -75
- package/dist/ui/speedDial/SpeedDialTrigger.svelte +79 -79
- package/dist/ui/tab/Tab.svelte +93 -67
- package/dist/ui/table/Table.svelte +396 -396
- 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/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 +2 -2
- package/dist/utils/index.js +3 -3
- package/dist/utils/singleSelection.svelte.js +48 -48
- package/dist/youtube/index.svelte +12 -12
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getTheme, type LabelProps } from '../../index.js';
|
|
3
|
-
import { label } from './index.js';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
color = 'gray',
|
|
9
|
-
show = true,
|
|
10
|
-
class: className,
|
|
11
|
-
...restProps
|
|
12
|
-
}: LabelProps = $props();
|
|
13
|
-
|
|
14
|
-
const theme = getTheme('label');
|
|
15
|
-
|
|
16
|
-
let base = $derived(label({ color, class: clsx(theme, className) }));
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
{#if show}
|
|
20
|
-
<label {...restProps} class={base}>
|
|
21
|
-
{@render children()}
|
|
22
|
-
</label>
|
|
23
|
-
{:else}
|
|
24
|
-
{@render children()}
|
|
25
|
-
{/if}
|
|
26
|
-
|
|
27
|
-
<!--
|
|
28
|
-
@component
|
|
29
|
-
[Go to docs](https://flowbite-svelte.com/)
|
|
30
|
-
## Type
|
|
31
|
-
[LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L784)
|
|
32
|
-
## Props
|
|
33
|
-
@prop children
|
|
34
|
-
@prop color = "gray"
|
|
35
|
-
@prop show = true
|
|
36
|
-
@prop class: className
|
|
37
|
-
@prop ...restProps
|
|
38
|
-
-->
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getTheme, type LabelProps } from '../../index.js';
|
|
3
|
+
import { label } from './index.js';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
color = 'gray',
|
|
9
|
+
show = true,
|
|
10
|
+
class: className,
|
|
11
|
+
...restProps
|
|
12
|
+
}: LabelProps = $props();
|
|
13
|
+
|
|
14
|
+
const theme = getTheme('label');
|
|
15
|
+
|
|
16
|
+
let base = $derived(label({ color, class: clsx(theme, className) }));
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if show}
|
|
20
|
+
<label {...restProps} class={base}>
|
|
21
|
+
{@render children()}
|
|
22
|
+
</label>
|
|
23
|
+
{:else}
|
|
24
|
+
{@render children()}
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<!--
|
|
28
|
+
@component
|
|
29
|
+
[Go to docs](https://flowbite-svelte.com/)
|
|
30
|
+
## Type
|
|
31
|
+
[LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L784)
|
|
32
|
+
## Props
|
|
33
|
+
@prop children
|
|
34
|
+
@prop color = "gray"
|
|
35
|
+
@prop show = true
|
|
36
|
+
@prop class: className
|
|
37
|
+
@prop ...restProps
|
|
38
|
+
-->
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
|
|
5
|
-
import { radio } from './index.js';
|
|
6
|
-
import { Label, type RadioProps } from '../../index.js';
|
|
7
|
-
|
|
8
|
-
// remove inputClass in next major version
|
|
9
|
-
let {
|
|
10
|
-
children,
|
|
11
|
-
'aria-describedby': ariaDescribedby,
|
|
12
|
-
inline = false,
|
|
13
|
-
labelClass,
|
|
14
|
-
color = 'primary',
|
|
15
|
-
custom = false,
|
|
16
|
-
group = $bindable<T>(),
|
|
17
|
-
value = $bindable<T>(),
|
|
18
|
-
class: className,
|
|
19
|
-
inputClass,
|
|
20
|
-
classes,
|
|
21
|
-
...restProps
|
|
22
|
-
}: RadioProps<T> = $props();
|
|
23
|
-
|
|
24
|
-
warnThemeDeprecation(
|
|
25
|
-
'Radio',
|
|
26
|
-
{ inputClass, labelClass },
|
|
27
|
-
{ inputClass: 'class', labelClass: 'label' }
|
|
28
|
-
);
|
|
29
|
-
const styling = $derived(classes ?? { label: labelClass });
|
|
30
|
-
|
|
31
|
-
const theme = getTheme('radio');
|
|
32
|
-
|
|
33
|
-
const { input, label } = $derived(
|
|
34
|
-
radio({ color, tinted: !!getContext('background'), custom, inline })
|
|
35
|
-
);
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<Label class={label({ class: clsx(theme?.label, styling.label) })}>
|
|
39
|
-
<input
|
|
40
|
-
type="radio"
|
|
41
|
-
bind:group
|
|
42
|
-
{value}
|
|
43
|
-
aria-describedby={ariaDescribedby}
|
|
44
|
-
{...restProps}
|
|
45
|
-
class={input({ class: clsx(theme?.input, className ?? inputClass) })}
|
|
46
|
-
/>
|
|
47
|
-
{@render children?.()}
|
|
48
|
-
</Label>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
|
|
5
|
+
import { radio } from './index.js';
|
|
6
|
+
import { Label, type RadioProps } from '../../index.js';
|
|
7
|
+
|
|
8
|
+
// remove inputClass in next major version
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
'aria-describedby': ariaDescribedby,
|
|
12
|
+
inline = false,
|
|
13
|
+
labelClass,
|
|
14
|
+
color = 'primary',
|
|
15
|
+
custom = false,
|
|
16
|
+
group = $bindable<T>(),
|
|
17
|
+
value = $bindable<T>(),
|
|
18
|
+
class: className,
|
|
19
|
+
inputClass,
|
|
20
|
+
classes,
|
|
21
|
+
...restProps
|
|
22
|
+
}: RadioProps<T> = $props();
|
|
23
|
+
|
|
24
|
+
warnThemeDeprecation(
|
|
25
|
+
'Radio',
|
|
26
|
+
{ inputClass, labelClass },
|
|
27
|
+
{ inputClass: 'class', labelClass: 'label' }
|
|
28
|
+
);
|
|
29
|
+
const styling = $derived(classes ?? { label: labelClass });
|
|
30
|
+
|
|
31
|
+
const theme = getTheme('radio');
|
|
32
|
+
|
|
33
|
+
const { input, label } = $derived(
|
|
34
|
+
radio({ color, tinted: !!getContext('background'), custom, inline })
|
|
35
|
+
);
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<Label class={label({ class: clsx(theme?.label, styling.label) })}>
|
|
39
|
+
<input
|
|
40
|
+
type="radio"
|
|
41
|
+
bind:group
|
|
42
|
+
{value}
|
|
43
|
+
aria-describedby={ariaDescribedby}
|
|
44
|
+
{...restProps}
|
|
45
|
+
class={input({ class: clsx(theme?.input, className ?? inputClass) })}
|
|
46
|
+
/>
|
|
47
|
+
{@render children?.()}
|
|
48
|
+
</Label>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { radioButton } from "./index.js";
|
|
4
|
-
import { Button, getTheme, type RadioButtonProps } from "../../index.js";
|
|
5
|
-
|
|
6
|
-
let { children, group = $bindable<T>(), value = $bindable<T>(), inline, pill, outline, size, color, shadow, checkedClass, class: className, ...restProps }: RadioButtonProps<T> = $props();
|
|
7
|
-
|
|
8
|
-
const theme = getTheme("radioButton");
|
|
9
|
-
|
|
10
|
-
let inputEl: HTMLInputElement;
|
|
11
|
-
let isChecked = $derived(value == group);
|
|
12
|
-
let base = $derived(radioButton({ inline, class: clsx(isChecked && checkedClass, theme, className) }));
|
|
13
|
-
|
|
14
|
-
function clickHandler() {
|
|
15
|
-
inputEl?.click(); // manually trigger the click on the hidden input
|
|
16
|
-
}
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<Button tag="label" onclick={clickHandler} {pill} {outline} {size} {color} {shadow} class={base}>
|
|
20
|
-
<input bind:this={inputEl} type="radio" class="sr-only" {value} bind:group {...restProps} />
|
|
21
|
-
{@render children?.()}
|
|
22
|
-
</Button>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { radioButton } from "./index.js";
|
|
4
|
+
import { Button, getTheme, type RadioButtonProps } from "../../index.js";
|
|
5
|
+
|
|
6
|
+
let { children, group = $bindable<T>(), value = $bindable<T>(), inline, pill, outline, size, color, shadow, checkedClass, class: className, ...restProps }: RadioButtonProps<T> = $props();
|
|
7
|
+
|
|
8
|
+
const theme = getTheme("radioButton");
|
|
9
|
+
|
|
10
|
+
let inputEl: HTMLInputElement;
|
|
11
|
+
let isChecked = $derived(value == group);
|
|
12
|
+
let base = $derived(radioButton({ inline, class: clsx(isChecked && checkedClass, theme, className) }));
|
|
13
|
+
|
|
14
|
+
function clickHandler() {
|
|
15
|
+
inputEl?.click(); // manually trigger the click on the hidden input
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Button tag="label" onclick={clickHandler} {pill} {outline} {size} {color} {shadow} class={base}>
|
|
20
|
+
<input bind:this={inputEl} type="radio" class="sr-only" {value} bind:group {...restProps} />
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</Button>
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { SelectProps } from '../../types/index.js';
|
|
3
|
-
import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
|
|
4
|
-
import Svelecte from 'svelecte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
options = [],
|
|
8
|
-
placeholder = '',
|
|
9
|
-
valueAsObject = false,
|
|
10
|
-
creatable = false,
|
|
11
|
-
multiple = false,
|
|
12
|
-
searchable = true,
|
|
13
|
-
labelAsValue = false,
|
|
14
|
-
disabled = false,
|
|
15
|
-
clearable = true,
|
|
16
|
-
onChange,
|
|
17
|
-
hasError,
|
|
18
|
-
minHeight,
|
|
19
|
-
hasSuccess,
|
|
20
|
-
loading,
|
|
21
|
-
...restProps
|
|
22
|
-
}: SelectProps = $props();
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<div
|
|
26
|
-
class="relative"
|
|
27
|
-
style="--sv-min-height: {minHeight}px; --sv-border: 1px solid {hasError
|
|
28
|
-
? 'red'
|
|
29
|
-
: hasSuccess
|
|
30
|
-
? 'green'
|
|
31
|
-
: '#ccc'};"
|
|
32
|
-
>
|
|
33
|
-
<Svelecte
|
|
34
|
-
{options}
|
|
35
|
-
{placeholder}
|
|
36
|
-
{valueAsObject}
|
|
37
|
-
{creatable}
|
|
38
|
-
{multiple}
|
|
39
|
-
{clearable}
|
|
40
|
-
{onChange}
|
|
41
|
-
{disabled}
|
|
42
|
-
{searchable}
|
|
43
|
-
{...restProps}
|
|
44
|
-
/>
|
|
45
|
-
<div class="absolute right-3 bottom-0 pb-1" class:hidden={!loading}>
|
|
46
|
-
<IconifyIcon icon="svg-spinners:180-ring-with-bg" />
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<!-- <style>
|
|
51
|
-
div :global(.sv-input) {
|
|
52
|
-
min-height: var(--sv-min-height);
|
|
53
|
-
border: var(--sv-border, 1px solid #ccc);
|
|
54
|
-
border-radius: 5px;
|
|
55
|
-
}
|
|
56
|
-
</style> -->
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SelectProps } from '../../types/index.js';
|
|
3
|
+
import IconifyIcon from '../../ui/icons/IconifyIcon.svelte';
|
|
4
|
+
import Svelecte from 'svelecte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
options = [],
|
|
8
|
+
placeholder = '',
|
|
9
|
+
valueAsObject = false,
|
|
10
|
+
creatable = false,
|
|
11
|
+
multiple = false,
|
|
12
|
+
searchable = true,
|
|
13
|
+
labelAsValue = false,
|
|
14
|
+
disabled = false,
|
|
15
|
+
clearable = true,
|
|
16
|
+
onChange,
|
|
17
|
+
hasError,
|
|
18
|
+
minHeight,
|
|
19
|
+
hasSuccess,
|
|
20
|
+
loading,
|
|
21
|
+
...restProps
|
|
22
|
+
}: SelectProps = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class="relative"
|
|
27
|
+
style="--sv-min-height: {minHeight}px; --sv-border: 1px solid {hasError
|
|
28
|
+
? 'red'
|
|
29
|
+
: hasSuccess
|
|
30
|
+
? 'green'
|
|
31
|
+
: '#ccc'};"
|
|
32
|
+
>
|
|
33
|
+
<Svelecte
|
|
34
|
+
{options}
|
|
35
|
+
{placeholder}
|
|
36
|
+
{valueAsObject}
|
|
37
|
+
{creatable}
|
|
38
|
+
{multiple}
|
|
39
|
+
{clearable}
|
|
40
|
+
{onChange}
|
|
41
|
+
{disabled}
|
|
42
|
+
{searchable}
|
|
43
|
+
{...restProps}
|
|
44
|
+
/>
|
|
45
|
+
<div class="absolute right-3 bottom-0 pb-1" class:hidden={!loading}>
|
|
46
|
+
<IconifyIcon icon="svg-spinners:180-ring-with-bg" />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<!-- <style>
|
|
51
|
+
div :global(.sv-input) {
|
|
52
|
+
min-height: var(--sv-min-height);
|
|
53
|
+
border: var(--sv-border, 1px solid #ccc);
|
|
54
|
+
border-radius: 5px;
|
|
55
|
+
}
|
|
56
|
+
</style> -->
|
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { textarea } from './index.js';
|
|
5
|
-
import { CloseButton, type TextareaProps } from '../../index.js';
|
|
6
|
-
import { createDismissableContext } from '../../utils/dismissable.js';
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
header,
|
|
10
|
-
footer,
|
|
11
|
-
addon,
|
|
12
|
-
value = $bindable(),
|
|
13
|
-
elementRef = $bindable(),
|
|
14
|
-
divClass,
|
|
15
|
-
innerClass,
|
|
16
|
-
headerClass,
|
|
17
|
-
footerClass,
|
|
18
|
-
addonClass,
|
|
19
|
-
disabled,
|
|
20
|
-
class: className,
|
|
21
|
-
classes,
|
|
22
|
-
clearable,
|
|
23
|
-
clearableSvgClass,
|
|
24
|
-
clearableColor = 'none',
|
|
25
|
-
clearableClass,
|
|
26
|
-
clearableOnClick,
|
|
27
|
-
textareaClass,
|
|
28
|
-
...restProps
|
|
29
|
-
}: TextareaProps = $props();
|
|
30
|
-
|
|
31
|
-
warnThemeDeprecation(
|
|
32
|
-
'Textarea',
|
|
33
|
-
{
|
|
34
|
-
divClass,
|
|
35
|
-
innerClass,
|
|
36
|
-
headerClass,
|
|
37
|
-
footerClass,
|
|
38
|
-
addonClass,
|
|
39
|
-
textareaClass,
|
|
40
|
-
clearableClass,
|
|
41
|
-
clearableSvgClass
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
divClass: 'div',
|
|
45
|
-
innerClass: 'inner',
|
|
46
|
-
headerClass: 'header',
|
|
47
|
-
footerClass: 'footer',
|
|
48
|
-
addonClass: 'addon',
|
|
49
|
-
textareaClass: 'class',
|
|
50
|
-
clearableClass: 'close',
|
|
51
|
-
clearableSvgClass: 'svg'
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
const styling = $derived(
|
|
55
|
-
classes ?? {
|
|
56
|
-
div: divClass,
|
|
57
|
-
inner: innerClass,
|
|
58
|
-
header: headerClass,
|
|
59
|
-
footer: footerClass,
|
|
60
|
-
addon: addonClass,
|
|
61
|
-
textarea: textareaClass,
|
|
62
|
-
close: clearableClass,
|
|
63
|
-
svg: clearableSvgClass
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const theme = getTheme('textarea');
|
|
68
|
-
|
|
69
|
-
let hasHeader = $derived(!!header);
|
|
70
|
-
let hasFooter = $derived(!!footer);
|
|
71
|
-
let hasAddon = $derived(!!addon);
|
|
72
|
-
let wrapped: boolean = $derived(hasHeader || hasFooter || hasAddon);
|
|
73
|
-
|
|
74
|
-
const {
|
|
75
|
-
div,
|
|
76
|
-
base,
|
|
77
|
-
wrapper,
|
|
78
|
-
inner,
|
|
79
|
-
header: headerCls,
|
|
80
|
-
footer: footerCls,
|
|
81
|
-
addon: addonCls,
|
|
82
|
-
close
|
|
83
|
-
} = $derived(textarea({ wrapped, hasHeader, hasFooter }));
|
|
84
|
-
|
|
85
|
-
const clearAll = () => {
|
|
86
|
-
if (elementRef) {
|
|
87
|
-
elementRef.value = '';
|
|
88
|
-
value = undefined;
|
|
89
|
-
}
|
|
90
|
-
if (clearableOnClick) clearableOnClick();
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
createDismissableContext(clearAll);
|
|
94
|
-
</script>
|
|
95
|
-
|
|
96
|
-
<div class={div({ class: clsx(theme?.div, styling.div) })}>
|
|
97
|
-
{#if !wrapped}
|
|
98
|
-
<textarea
|
|
99
|
-
bind:value
|
|
100
|
-
bind:this={elementRef}
|
|
101
|
-
{disabled}
|
|
102
|
-
{...restProps}
|
|
103
|
-
class={wrapper({ class: clsx(className, classes?.wrapper) })}
|
|
104
|
-
></textarea>
|
|
105
|
-
{:else}
|
|
106
|
-
<div class={wrapper({ class: clsx(theme?.wrapper, classes?.wrapper) })}>
|
|
107
|
-
{#if header}
|
|
108
|
-
<div class={headerCls({ class: clsx(theme?.header, styling.header) })}>
|
|
109
|
-
{@render header()}
|
|
110
|
-
</div>
|
|
111
|
-
{/if}
|
|
112
|
-
<div class={inner({ class: clsx(theme?.inner, styling.inner) })}>
|
|
113
|
-
{#if addon}
|
|
114
|
-
<div class={addonCls({ class: clsx(theme?.addon, styling.addon) })}>
|
|
115
|
-
{@render addon()}
|
|
116
|
-
</div>
|
|
117
|
-
{/if}
|
|
118
|
-
<textarea
|
|
119
|
-
bind:value
|
|
120
|
-
bind:this={elementRef}
|
|
121
|
-
{disabled}
|
|
122
|
-
{...restProps}
|
|
123
|
-
class={base({ class: clsx(theme?.base, className) })}
|
|
124
|
-
></textarea>
|
|
125
|
-
</div>
|
|
126
|
-
{#if footer}
|
|
127
|
-
<div class={footerCls({ class: clsx(theme?.footer, styling.footer) })}>
|
|
128
|
-
{@render footer()}
|
|
129
|
-
</div>
|
|
130
|
-
{/if}
|
|
131
|
-
</div>
|
|
132
|
-
{/if}
|
|
133
|
-
{#if value !== undefined && value !== '' && clearable}
|
|
134
|
-
<CloseButton
|
|
135
|
-
class={close({ class: clsx(theme?.close, styling.close) })}
|
|
136
|
-
color={clearableColor}
|
|
137
|
-
aria-label="Clear search value"
|
|
138
|
-
svgClass={clsx(styling.svg)}
|
|
139
|
-
/>
|
|
140
|
-
{/if}
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<!--
|
|
144
|
-
## Props
|
|
145
|
-
@prop header
|
|
146
|
-
@prop footer
|
|
147
|
-
@prop addon
|
|
148
|
-
@prop value = $bindable()
|
|
149
|
-
@prop elementRef = $bindable()
|
|
150
|
-
@prop divClass
|
|
151
|
-
@prop innerClass
|
|
152
|
-
@prop headerClass
|
|
153
|
-
@prop footerClass
|
|
154
|
-
@prop addonClass
|
|
155
|
-
@prop disabled
|
|
156
|
-
@prop class: className
|
|
157
|
-
@prop classes
|
|
158
|
-
@prop clearable
|
|
159
|
-
@prop clearableSvgClass
|
|
160
|
-
@prop clearableColor = "none"
|
|
161
|
-
@prop clearableClass
|
|
162
|
-
@prop clearableOnClick
|
|
163
|
-
@prop textareaClass
|
|
164
|
-
@prop ...restProps
|
|
165
|
-
-->
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { textarea } from './index.js';
|
|
5
|
+
import { CloseButton, type TextareaProps } from '../../index.js';
|
|
6
|
+
import { createDismissableContext } from '../../utils/dismissable.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
header,
|
|
10
|
+
footer,
|
|
11
|
+
addon,
|
|
12
|
+
value = $bindable(),
|
|
13
|
+
elementRef = $bindable(),
|
|
14
|
+
divClass,
|
|
15
|
+
innerClass,
|
|
16
|
+
headerClass,
|
|
17
|
+
footerClass,
|
|
18
|
+
addonClass,
|
|
19
|
+
disabled,
|
|
20
|
+
class: className,
|
|
21
|
+
classes,
|
|
22
|
+
clearable,
|
|
23
|
+
clearableSvgClass,
|
|
24
|
+
clearableColor = 'none',
|
|
25
|
+
clearableClass,
|
|
26
|
+
clearableOnClick,
|
|
27
|
+
textareaClass,
|
|
28
|
+
...restProps
|
|
29
|
+
}: TextareaProps = $props();
|
|
30
|
+
|
|
31
|
+
warnThemeDeprecation(
|
|
32
|
+
'Textarea',
|
|
33
|
+
{
|
|
34
|
+
divClass,
|
|
35
|
+
innerClass,
|
|
36
|
+
headerClass,
|
|
37
|
+
footerClass,
|
|
38
|
+
addonClass,
|
|
39
|
+
textareaClass,
|
|
40
|
+
clearableClass,
|
|
41
|
+
clearableSvgClass
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
divClass: 'div',
|
|
45
|
+
innerClass: 'inner',
|
|
46
|
+
headerClass: 'header',
|
|
47
|
+
footerClass: 'footer',
|
|
48
|
+
addonClass: 'addon',
|
|
49
|
+
textareaClass: 'class',
|
|
50
|
+
clearableClass: 'close',
|
|
51
|
+
clearableSvgClass: 'svg'
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
const styling = $derived(
|
|
55
|
+
classes ?? {
|
|
56
|
+
div: divClass,
|
|
57
|
+
inner: innerClass,
|
|
58
|
+
header: headerClass,
|
|
59
|
+
footer: footerClass,
|
|
60
|
+
addon: addonClass,
|
|
61
|
+
textarea: textareaClass,
|
|
62
|
+
close: clearableClass,
|
|
63
|
+
svg: clearableSvgClass
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const theme = getTheme('textarea');
|
|
68
|
+
|
|
69
|
+
let hasHeader = $derived(!!header);
|
|
70
|
+
let hasFooter = $derived(!!footer);
|
|
71
|
+
let hasAddon = $derived(!!addon);
|
|
72
|
+
let wrapped: boolean = $derived(hasHeader || hasFooter || hasAddon);
|
|
73
|
+
|
|
74
|
+
const {
|
|
75
|
+
div,
|
|
76
|
+
base,
|
|
77
|
+
wrapper,
|
|
78
|
+
inner,
|
|
79
|
+
header: headerCls,
|
|
80
|
+
footer: footerCls,
|
|
81
|
+
addon: addonCls,
|
|
82
|
+
close
|
|
83
|
+
} = $derived(textarea({ wrapped, hasHeader, hasFooter }));
|
|
84
|
+
|
|
85
|
+
const clearAll = () => {
|
|
86
|
+
if (elementRef) {
|
|
87
|
+
elementRef.value = '';
|
|
88
|
+
value = undefined;
|
|
89
|
+
}
|
|
90
|
+
if (clearableOnClick) clearableOnClick();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
createDismissableContext(clearAll);
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<div class={div({ class: clsx(theme?.div, styling.div) })}>
|
|
97
|
+
{#if !wrapped}
|
|
98
|
+
<textarea
|
|
99
|
+
bind:value
|
|
100
|
+
bind:this={elementRef}
|
|
101
|
+
{disabled}
|
|
102
|
+
{...restProps}
|
|
103
|
+
class={wrapper({ class: clsx(className, classes?.wrapper) })}
|
|
104
|
+
></textarea>
|
|
105
|
+
{:else}
|
|
106
|
+
<div class={wrapper({ class: clsx(theme?.wrapper, classes?.wrapper) })}>
|
|
107
|
+
{#if header}
|
|
108
|
+
<div class={headerCls({ class: clsx(theme?.header, styling.header) })}>
|
|
109
|
+
{@render header()}
|
|
110
|
+
</div>
|
|
111
|
+
{/if}
|
|
112
|
+
<div class={inner({ class: clsx(theme?.inner, styling.inner) })}>
|
|
113
|
+
{#if addon}
|
|
114
|
+
<div class={addonCls({ class: clsx(theme?.addon, styling.addon) })}>
|
|
115
|
+
{@render addon()}
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
118
|
+
<textarea
|
|
119
|
+
bind:value
|
|
120
|
+
bind:this={elementRef}
|
|
121
|
+
{disabled}
|
|
122
|
+
{...restProps}
|
|
123
|
+
class={base({ class: clsx(theme?.base, className) })}
|
|
124
|
+
></textarea>
|
|
125
|
+
</div>
|
|
126
|
+
{#if footer}
|
|
127
|
+
<div class={footerCls({ class: clsx(theme?.footer, styling.footer) })}>
|
|
128
|
+
{@render footer()}
|
|
129
|
+
</div>
|
|
130
|
+
{/if}
|
|
131
|
+
</div>
|
|
132
|
+
{/if}
|
|
133
|
+
{#if value !== undefined && value !== '' && clearable}
|
|
134
|
+
<CloseButton
|
|
135
|
+
class={close({ class: clsx(theme?.close, styling.close) })}
|
|
136
|
+
color={clearableColor}
|
|
137
|
+
aria-label="Clear search value"
|
|
138
|
+
svgClass={clsx(styling.svg)}
|
|
139
|
+
/>
|
|
140
|
+
{/if}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<!--
|
|
144
|
+
## Props
|
|
145
|
+
@prop header
|
|
146
|
+
@prop footer
|
|
147
|
+
@prop addon
|
|
148
|
+
@prop value = $bindable()
|
|
149
|
+
@prop elementRef = $bindable()
|
|
150
|
+
@prop divClass
|
|
151
|
+
@prop innerClass
|
|
152
|
+
@prop headerClass
|
|
153
|
+
@prop footerClass
|
|
154
|
+
@prop addonClass
|
|
155
|
+
@prop disabled
|
|
156
|
+
@prop class: className
|
|
157
|
+
@prop classes
|
|
158
|
+
@prop clearable
|
|
159
|
+
@prop clearableSvgClass
|
|
160
|
+
@prop clearableColor = "none"
|
|
161
|
+
@prop clearableClass
|
|
162
|
+
@prop clearableOnClick
|
|
163
|
+
@prop textareaClass
|
|
164
|
+
@prop ...restProps
|
|
165
|
+
-->
|