@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,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,50 +1,50 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { SelectProps } from '../../types/index.js';
|
|
3
|
-
import Svelecte from 'svelecte';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
options = [],
|
|
7
|
-
placeholder = '',
|
|
8
|
-
valueAsObject = false,
|
|
9
|
-
creatable = false,
|
|
10
|
-
multiple = false,
|
|
11
|
-
searchable = true,
|
|
12
|
-
labelAsValue = false,
|
|
13
|
-
disabled = false,
|
|
14
|
-
clearable = true,
|
|
15
|
-
onChange,
|
|
16
|
-
hasError,
|
|
17
|
-
minHeight,
|
|
18
|
-
hasSuccess,
|
|
19
|
-
...restProps
|
|
20
|
-
}: SelectProps = $props();
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
-
style="--sv-min-height: {minHeight}px; --sv-border: 1px solid {hasError
|
|
25
|
-
? 'red'
|
|
26
|
-
: hasSuccess
|
|
27
|
-
? 'green'
|
|
28
|
-
: '#ccc'};"
|
|
29
|
-
>
|
|
30
|
-
<Svelecte
|
|
31
|
-
{options}
|
|
32
|
-
{placeholder}
|
|
33
|
-
{valueAsObject}
|
|
34
|
-
{creatable}
|
|
35
|
-
{multiple}
|
|
36
|
-
{clearable}
|
|
37
|
-
{onChange}
|
|
38
|
-
{disabled}
|
|
39
|
-
{searchable}
|
|
40
|
-
{...restProps}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<!-- <style>
|
|
45
|
-
div :global(.sv-input) {
|
|
46
|
-
min-height: var(--sv-min-height);
|
|
47
|
-
border: var(--sv-border, 1px solid #ccc);
|
|
48
|
-
border-radius: 5px;
|
|
49
|
-
}
|
|
50
|
-
</style> -->
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SelectProps } from '../../types/index.js';
|
|
3
|
+
import Svelecte from 'svelecte';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
options = [],
|
|
7
|
+
placeholder = '',
|
|
8
|
+
valueAsObject = false,
|
|
9
|
+
creatable = false,
|
|
10
|
+
multiple = false,
|
|
11
|
+
searchable = true,
|
|
12
|
+
labelAsValue = false,
|
|
13
|
+
disabled = false,
|
|
14
|
+
clearable = true,
|
|
15
|
+
onChange,
|
|
16
|
+
hasError,
|
|
17
|
+
minHeight,
|
|
18
|
+
hasSuccess,
|
|
19
|
+
...restProps
|
|
20
|
+
}: SelectProps = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
style="--sv-min-height: {minHeight}px; --sv-border: 1px solid {hasError
|
|
25
|
+
? 'red'
|
|
26
|
+
: hasSuccess
|
|
27
|
+
? 'green'
|
|
28
|
+
: '#ccc'};"
|
|
29
|
+
>
|
|
30
|
+
<Svelecte
|
|
31
|
+
{options}
|
|
32
|
+
{placeholder}
|
|
33
|
+
{valueAsObject}
|
|
34
|
+
{creatable}
|
|
35
|
+
{multiple}
|
|
36
|
+
{clearable}
|
|
37
|
+
{onChange}
|
|
38
|
+
{disabled}
|
|
39
|
+
{searchable}
|
|
40
|
+
{...restProps}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- <style>
|
|
45
|
+
div :global(.sv-input) {
|
|
46
|
+
min-height: var(--sv-min-height);
|
|
47
|
+
border: var(--sv-border, 1px solid #ccc);
|
|
48
|
+
border-radius: 5px;
|
|
49
|
+
}
|
|
50
|
+
</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
|
+
-->
|