flowbite-svelte 1.0.7 → 1.1.0
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/dist/accordion/Accordion.svelte +1 -1
- package/dist/accordion/Accordion.svelte.d.ts +1 -1
- package/dist/accordion/AccordionItem.svelte +1 -1
- package/dist/accordion/AccordionItem.svelte.d.ts +1 -1
- package/dist/alert/Alert.svelte +1 -1
- package/dist/alert/Alert.svelte.d.ts +1 -1
- package/dist/avatar/Avatar.svelte +1 -1
- package/dist/avatar/Avatar.svelte.d.ts +1 -1
- package/dist/badge/Badge.svelte +1 -1
- package/dist/badge/Badge.svelte.d.ts +1 -1
- package/dist/banner/Banner.svelte +1 -1
- package/dist/banner/Banner.svelte.d.ts +1 -1
- package/dist/bottom-navigation/BottomNav.svelte +1 -2
- package/dist/bottom-navigation/BottomNav.svelte.d.ts +1 -1
- package/dist/bottom-navigation/BottomNavHeader.svelte +1 -1
- package/dist/bottom-navigation/BottomNavHeader.svelte.d.ts +1 -1
- package/dist/bottom-navigation/BottomNavHeaderItem.svelte +1 -1
- package/dist/bottom-navigation/BottomNavHeaderItem.svelte.d.ts +1 -1
- package/dist/bottom-navigation/BottomNavItem.svelte +1 -1
- package/dist/bottom-navigation/BottomNavItem.svelte.d.ts +1 -1
- package/dist/breadcrumb/Breadcrumb.svelte +1 -1
- package/dist/breadcrumb/Breadcrumb.svelte.d.ts +1 -1
- package/dist/breadcrumb/BreadcrumbItem.svelte +1 -1
- package/dist/breadcrumb/BreadcrumbItem.svelte.d.ts +1 -1
- package/dist/buttongroup/ButtonGroup.svelte +1 -1
- package/dist/buttongroup/ButtonGroup.svelte.d.ts +1 -1
- package/dist/buttons/Button.svelte +1 -1
- package/dist/buttons/Button.svelte.d.ts +1 -1
- package/dist/buttons/GradientButton.svelte +1 -1
- package/dist/buttons/GradientButton.svelte.d.ts +1 -1
- package/dist/card/Card.svelte +1 -1
- package/dist/card/Card.svelte.d.ts +1 -1
- package/dist/carousel/Carousel.svelte +1 -1
- package/dist/carousel/Carousel.svelte.d.ts +1 -1
- package/dist/carousel/ControlButton.svelte +1 -1
- package/dist/carousel/ControlButton.svelte.d.ts +1 -1
- package/dist/carousel/Controls.svelte +1 -1
- package/dist/carousel/Controls.svelte.d.ts +1 -1
- package/dist/carousel/Indicators.svelte +1 -1
- package/dist/carousel/Indicators.svelte.d.ts +1 -1
- package/dist/carousel/Slide.svelte +1 -1
- package/dist/carousel/Slide.svelte.d.ts +1 -1
- package/dist/carousel/Thumbnail.svelte +1 -1
- package/dist/carousel/Thumbnail.svelte.d.ts +1 -1
- package/dist/carousel/Thumbnails.svelte +1 -1
- package/dist/carousel/Thumbnails.svelte.d.ts +1 -1
- package/dist/chart/Chart.svelte +1 -1
- package/dist/chart/Chart.svelte.d.ts +1 -1
- package/dist/darkmode/DarkMode.svelte +1 -1
- package/dist/darkmode/DarkMode.svelte.d.ts +1 -1
- package/dist/datepicker/Datepicker.svelte +1 -1
- package/dist/datepicker/Datepicker.svelte.d.ts +1 -1
- package/dist/device-mockups/Android.svelte +1 -1
- package/dist/device-mockups/Android.svelte.d.ts +1 -1
- package/dist/device-mockups/DefaultMockup.svelte +1 -1
- package/dist/device-mockups/DefaultMockup.svelte.d.ts +1 -1
- package/dist/device-mockups/Desktop.svelte +1 -1
- package/dist/device-mockups/Desktop.svelte.d.ts +1 -1
- package/dist/device-mockups/DeviceMockup.svelte +1 -1
- package/dist/device-mockups/DeviceMockup.svelte.d.ts +1 -1
- package/dist/device-mockups/Ios.svelte +1 -1
- package/dist/device-mockups/Ios.svelte.d.ts +1 -1
- package/dist/device-mockups/Laptop.svelte +1 -1
- package/dist/device-mockups/Laptop.svelte.d.ts +1 -1
- package/dist/device-mockups/Smartwatch.svelte +1 -1
- package/dist/device-mockups/Smartwatch.svelte.d.ts +1 -1
- package/dist/device-mockups/Tablet.svelte +1 -1
- package/dist/device-mockups/Tablet.svelte.d.ts +1 -1
- package/dist/device-mockups/theme.d.ts +18 -18
- package/dist/drawer/Drawer.svelte +1 -2
- package/dist/drawer/Drawer.svelte.d.ts +1 -1
- package/dist/drawer/Drawerhead.svelte +1 -1
- package/dist/drawer/Drawerhead.svelte.d.ts +1 -1
- package/dist/dropdown/Dropdown.svelte +1 -1
- package/dist/dropdown/Dropdown.svelte.d.ts +1 -1
- package/dist/dropdown/DropdownDivider.svelte +1 -1
- package/dist/dropdown/DropdownDivider.svelte.d.ts +1 -1
- package/dist/dropdown/DropdownGroup.svelte +1 -1
- package/dist/dropdown/DropdownGroup.svelte.d.ts +1 -1
- package/dist/dropdown/DropdownHeader.svelte +1 -1
- package/dist/dropdown/DropdownHeader.svelte.d.ts +1 -1
- package/dist/dropdown/DropdownItem.svelte +1 -1
- package/dist/dropdown/DropdownItem.svelte.d.ts +1 -1
- package/dist/footer/Footer.svelte +1 -1
- package/dist/footer/Footer.svelte.d.ts +1 -1
- package/dist/footer/FooterBrand.svelte +1 -1
- package/dist/footer/FooterBrand.svelte.d.ts +1 -1
- package/dist/footer/FooterCopyright.svelte +1 -1
- package/dist/footer/FooterCopyright.svelte.d.ts +1 -1
- package/dist/footer/FooterIcon.svelte +1 -1
- package/dist/footer/FooterIcon.svelte.d.ts +1 -1
- package/dist/footer/FooterLink.svelte +1 -1
- package/dist/footer/FooterLink.svelte.d.ts +1 -1
- package/dist/footer/FooterLinkGroup.svelte +1 -1
- package/dist/footer/FooterLinkGroup.svelte.d.ts +1 -1
- package/dist/forms/checkbox/Checkbox.svelte +1 -1
- package/dist/forms/checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/forms/checkbox-button/CheckboxButton.svelte +1 -1
- package/dist/forms/checkbox-button/CheckboxButton.svelte.d.ts +1 -1
- package/dist/forms/fileupload/Fileupload.svelte +20 -19
- package/dist/forms/fileupload/Fileupload.svelte.d.ts +9 -4
- package/dist/forms/floating-label-input/FloatingLabelInput.svelte +22 -6
- package/dist/forms/floating-label-input/FloatingLabelInput.svelte.d.ts +9 -3
- package/dist/forms/floating-label-input/theme.d.ts +3 -0
- package/dist/forms/floating-label-input/theme.js +2 -1
- package/dist/forms/helper/Helper.svelte +1 -1
- package/dist/forms/helper/Helper.svelte.d.ts +1 -1
- package/dist/forms/input/Input.svelte +13 -11
- package/dist/forms/input/Input.svelte.d.ts +2 -2
- package/dist/forms/input/theme.d.ts +3 -0
- package/dist/forms/input/theme.js +2 -1
- package/dist/forms/input-addon/InputAddon.svelte +1 -1
- package/dist/forms/input-addon/InputAddon.svelte.d.ts +1 -1
- package/dist/forms/label/Label.svelte +1 -1
- package/dist/forms/label/Label.svelte.d.ts +1 -1
- package/dist/forms/range/Range.svelte +1 -1
- package/dist/forms/range/Range.svelte.d.ts +1 -1
- package/dist/forms/search/Search.svelte +30 -6
- package/dist/forms/search/Search.svelte.d.ts +17 -18
- package/dist/forms/search/theme.d.ts +3 -0
- package/dist/forms/search/theme.js +2 -1
- package/dist/forms/select/Select.svelte +28 -16
- package/dist/forms/select/Select.svelte.d.ts +2 -2
- package/dist/forms/select/theme.d.ts +60 -18
- package/dist/forms/select/theme.js +14 -6
- package/dist/forms/textarea/Textarea.svelte +41 -22
- package/dist/forms/textarea/Textarea.svelte.d.ts +10 -3
- package/dist/forms/textarea/theme.d.ts +6 -0
- package/dist/forms/textarea/theme.js +3 -1
- package/dist/forms/timepicker/Timepicker.svelte +1 -1
- package/dist/forms/timepicker/Timepicker.svelte.d.ts +1 -1
- package/dist/forms/toggle/Toggle.svelte +1 -1
- package/dist/forms/toggle/Toggle.svelte.d.ts +1 -1
- package/dist/gallery/Gallery.svelte +1 -1
- package/dist/gallery/Gallery.svelte.d.ts +1 -1
- package/dist/gallery/theme.d.ts +3 -3
- package/dist/indicator/Indicator.svelte +1 -1
- package/dist/indicator/Indicator.svelte.d.ts +1 -1
- package/dist/kbd/Kbd.svelte +1 -1
- package/dist/kbd/Kbd.svelte.d.ts +1 -1
- package/dist/list-group/Listgroup.svelte +1 -1
- package/dist/list-group/Listgroup.svelte.d.ts +1 -1
- package/dist/list-group/ListgroupItem.svelte +1 -1
- package/dist/list-group/ListgroupItem.svelte.d.ts +1 -1
- package/dist/mega-menu/MegaMenu.svelte +1 -1
- package/dist/mega-menu/MegaMenu.svelte.d.ts +1 -1
- package/dist/modal/Modal.svelte +1 -1
- package/dist/modal/Modal.svelte.d.ts +1 -1
- package/dist/navbar/Menu.svelte +1 -1
- package/dist/navbar/Menu.svelte.d.ts +1 -1
- package/dist/navbar/NavBrand.svelte +1 -1
- package/dist/navbar/NavBrand.svelte.d.ts +1 -1
- package/dist/navbar/NavContainer.svelte +1 -1
- package/dist/navbar/NavContainer.svelte.d.ts +1 -1
- package/dist/navbar/NavHamburger.svelte +1 -1
- package/dist/navbar/NavHamburger.svelte.d.ts +1 -1
- package/dist/navbar/NavLi.svelte +1 -1
- package/dist/navbar/NavLi.svelte.d.ts +1 -1
- package/dist/navbar/NavUl.svelte +1 -1
- package/dist/navbar/NavUl.svelte.d.ts +1 -1
- package/dist/navbar/Navbar.svelte +1 -1
- package/dist/navbar/Navbar.svelte.d.ts +1 -1
- package/dist/pagination/Pagination.svelte +1 -1
- package/dist/pagination/Pagination.svelte.d.ts +1 -1
- package/dist/pagination/PaginationItem.svelte +1 -1
- package/dist/pagination/PaginationItem.svelte.d.ts +1 -1
- package/dist/popover/Popover.svelte +1 -2
- package/dist/popover/Popover.svelte.d.ts +1 -1
- package/dist/progress/Progressbar.svelte +1 -1
- package/dist/progress/Progressbar.svelte.d.ts +1 -1
- package/dist/rating/AdvancedRating.svelte +1 -1
- package/dist/rating/AdvancedRating.svelte.d.ts +1 -1
- package/dist/rating/CustomIcon.svelte +1 -1
- package/dist/rating/CustomIcon.svelte.d.ts +1 -1
- package/dist/rating/Heart.svelte +1 -1
- package/dist/rating/Heart.svelte.d.ts +1 -1
- package/dist/rating/Rating.svelte +1 -1
- package/dist/rating/Rating.svelte.d.ts +1 -1
- package/dist/rating/RatingComment.svelte +1 -1
- package/dist/rating/RatingComment.svelte.d.ts +1 -1
- package/dist/rating/Review.svelte +1 -1
- package/dist/rating/Review.svelte.d.ts +1 -1
- package/dist/rating/ScoreRating.svelte +1 -1
- package/dist/rating/ScoreRating.svelte.d.ts +1 -1
- package/dist/rating/Star.svelte +1 -1
- package/dist/rating/Star.svelte.d.ts +1 -1
- package/dist/rating/Thumbup.svelte +1 -1
- package/dist/rating/Thumbup.svelte.d.ts +1 -1
- package/dist/sidebar/Sidebar.svelte +1 -1
- package/dist/sidebar/Sidebar.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarBrand.svelte +1 -1
- package/dist/sidebar/SidebarBrand.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarButton.svelte +1 -1
- package/dist/sidebar/SidebarButton.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarCta.svelte +1 -1
- package/dist/sidebar/SidebarCta.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarDropdownWrapper.svelte +1 -1
- package/dist/sidebar/SidebarDropdownWrapper.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarGroup.svelte +1 -1
- package/dist/sidebar/SidebarGroup.svelte.d.ts +1 -1
- package/dist/sidebar/SidebarItem.svelte +1 -1
- package/dist/sidebar/SidebarItem.svelte.d.ts +1 -1
- package/dist/sidebar/theme.d.ts +6 -6
- package/dist/skeleton/CardPlaceholder.svelte +1 -1
- package/dist/skeleton/CardPlaceholder.svelte.d.ts +1 -1
- package/dist/skeleton/ImagePlaceholder.svelte +1 -1
- package/dist/skeleton/ImagePlaceholder.svelte.d.ts +1 -1
- package/dist/skeleton/ListPlaceholder.svelte +1 -1
- package/dist/skeleton/ListPlaceholder.svelte.d.ts +1 -1
- package/dist/skeleton/Skeleton.svelte +1 -1
- package/dist/skeleton/Skeleton.svelte.d.ts +1 -1
- package/dist/skeleton/TextPlaceholder.svelte +1 -1
- package/dist/skeleton/TextPlaceholder.svelte.d.ts +1 -1
- package/dist/skeleton/VideoPlaceholder.svelte +1 -1
- package/dist/skeleton/VideoPlaceholder.svelte.d.ts +1 -1
- package/dist/speed-dial/SpeedDial.svelte +1 -1
- package/dist/speed-dial/SpeedDial.svelte.d.ts +1 -1
- package/dist/speed-dial/SpeedDialButton.svelte +1 -1
- package/dist/speed-dial/SpeedDialButton.svelte.d.ts +1 -1
- package/dist/speed-dial/SpeedDialTrigger.svelte +1 -1
- package/dist/speed-dial/SpeedDialTrigger.svelte.d.ts +1 -1
- package/dist/spinner/Spinner.svelte +1 -1
- package/dist/spinner/Spinner.svelte.d.ts +1 -1
- package/dist/steps/StepIndicator.svelte +1 -1
- package/dist/steps/StepIndicator.svelte.d.ts +1 -1
- package/dist/table/Table.svelte +1 -1
- package/dist/table/Table.svelte.d.ts +1 -1
- package/dist/table/TableBody.svelte +1 -1
- package/dist/table/TableBody.svelte.d.ts +1 -1
- package/dist/table/TableBodyCell.svelte +1 -1
- package/dist/table/TableBodyCell.svelte.d.ts +1 -1
- package/dist/table/TableBodyRow.svelte +1 -1
- package/dist/table/TableBodyRow.svelte.d.ts +1 -1
- package/dist/table/TableHead.svelte +1 -1
- package/dist/table/TableHead.svelte.d.ts +1 -1
- package/dist/table/TableHeadCell.svelte +1 -1
- package/dist/table/TableHeadCell.svelte.d.ts +1 -1
- package/dist/table/TableSearch.svelte +1 -1
- package/dist/table/TableSearch.svelte.d.ts +1 -1
- package/dist/tabs/TabItem.svelte +1 -1
- package/dist/tabs/TabItem.svelte.d.ts +1 -1
- package/dist/tabs/Tabs.svelte +1 -1
- package/dist/tabs/Tabs.svelte.d.ts +1 -1
- package/dist/theme/Theme.svelte +1 -1
- package/dist/theme/Theme.svelte.d.ts +1 -1
- package/dist/theme/index.d.ts +105 -48
- package/dist/timeline/Activity.svelte +1 -1
- package/dist/timeline/Activity.svelte.d.ts +1 -1
- package/dist/timeline/ActivityItem.svelte +1 -1
- package/dist/timeline/ActivityItem.svelte.d.ts +1 -1
- package/dist/timeline/Group.svelte +1 -1
- package/dist/timeline/Group.svelte.d.ts +1 -1
- package/dist/timeline/GroupItem.svelte +1 -1
- package/dist/timeline/GroupItem.svelte.d.ts +1 -1
- package/dist/timeline/Timeline.svelte +1 -1
- package/dist/timeline/Timeline.svelte.d.ts +1 -1
- package/dist/timeline/TimelineItem.svelte +1 -1
- package/dist/timeline/TimelineItem.svelte.d.ts +1 -1
- package/dist/timeline/theme.d.ts +3 -3
- package/dist/toast/Toast.svelte +4 -4
- package/dist/toast/Toast.svelte.d.ts +2 -2
- package/dist/toolbar/Toolbar.svelte +1 -1
- package/dist/toolbar/Toolbar.svelte.d.ts +1 -1
- package/dist/toolbar/ToolbarButton.svelte +1 -1
- package/dist/toolbar/ToolbarButton.svelte.d.ts +1 -1
- package/dist/toolbar/ToolbarGroup.svelte +1 -1
- package/dist/toolbar/ToolbarGroup.svelte.d.ts +1 -1
- package/dist/tooltip/Tooltip.svelte +1 -1
- package/dist/tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/types.d.ts +48 -4
- package/dist/typography/anchor/A.svelte +1 -1
- package/dist/typography/anchor/A.svelte.d.ts +1 -1
- package/dist/typography/blockquote/Blockquote.svelte +1 -1
- package/dist/typography/blockquote/Blockquote.svelte.d.ts +1 -1
- package/dist/typography/descriptionlist/DescriptionList.svelte +1 -1
- package/dist/typography/descriptionlist/DescriptionList.svelte.d.ts +1 -1
- package/dist/typography/heading/Heading.svelte +1 -1
- package/dist/typography/heading/Heading.svelte.d.ts +1 -1
- package/dist/typography/hr/Hr.svelte +1 -1
- package/dist/typography/hr/Hr.svelte.d.ts +1 -1
- package/dist/typography/img/EnhancedImg.svelte +1 -1
- package/dist/typography/img/EnhancedImg.svelte.d.ts +1 -1
- package/dist/typography/img/Img.svelte +1 -1
- package/dist/typography/img/Img.svelte.d.ts +1 -1
- package/dist/typography/layout/Layout.svelte +1 -1
- package/dist/typography/layout/Layout.svelte.d.ts +1 -1
- package/dist/typography/list/Li.svelte +1 -1
- package/dist/typography/list/Li.svelte.d.ts +1 -1
- package/dist/typography/list/List.svelte +1 -1
- package/dist/typography/list/List.svelte.d.ts +1 -1
- package/dist/typography/mark/Mark.svelte +1 -1
- package/dist/typography/mark/Mark.svelte.d.ts +1 -1
- package/dist/typography/paragraph/P.svelte +1 -1
- package/dist/typography/paragraph/P.svelte.d.ts +1 -1
- package/dist/typography/secondary/Secondary.svelte +1 -1
- package/dist/typography/secondary/Secondary.svelte.d.ts +1 -1
- package/dist/typography/span/Span.svelte +1 -1
- package/dist/typography/span/Span.svelte.d.ts +1 -1
- package/dist/utils/Arrow.svelte +1 -1
- package/dist/utils/CloseButton.svelte +6 -4
- package/dist/utils/CloseButton.svelte.d.ts +4 -3
- package/dist/utils/Popper.svelte +1 -1
- package/dist/utils/Popper.svelte.d.ts +1 -1
- package/dist/utils/index.d.ts +2 -107
- package/dist/utils/index.js +2 -66
- package/dist/utils/theme.d.ts +97 -0
- package/dist/utils/theme.js +69 -0
- package/dist/video/Video.svelte +1 -1
- package/dist/video/Video.svelte.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fileupload } from ".";
|
|
3
|
-
import type
|
|
4
|
-
import { CloseButton } from "../..";
|
|
3
|
+
import { CloseButton, type FileuploadProps } from "../..";
|
|
5
4
|
import clsx from "clsx";
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
let { files = $bindable(), size = "md", clearable = false, elementRef = $bindable(), class: className, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, ...restProps }: FileuploadProps = $props();
|
|
7
|
+
|
|
7
8
|
const { base, wrapper, right } = fileupload();
|
|
8
9
|
|
|
9
|
-
let fileInputRef: HTMLInputElement | undefined = $state();
|
|
10
10
|
const clearAll = () => {
|
|
11
|
-
if (
|
|
12
|
-
|
|
11
|
+
if (elementRef) {
|
|
12
|
+
elementRef.value = "";
|
|
13
13
|
files = undefined;
|
|
14
14
|
}
|
|
15
|
+
if (clearableOnClick) clearableOnClick();
|
|
15
16
|
};
|
|
16
|
-
const hasFiles = $derived(files && files.length > 0);
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
|
-
{
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</div>
|
|
26
|
-
{:else}
|
|
27
|
-
<input type="file" bind:files {...restProps} class={base({ size, class: clsx(className) })} />
|
|
28
|
-
{/if}
|
|
19
|
+
<div class={wrapper()}>
|
|
20
|
+
<input type="file" bind:files bind:this={elementRef} {...restProps} class={base({ size, class: clsx(className) })} />
|
|
21
|
+
{#if files && files.length > 0 && clearable}
|
|
22
|
+
<CloseButton onclick={clearAll} class={right({ class: clearableClass })} color={clearableColor} aria-label="Clear selected files" svgClass={clearableSvgClass} />
|
|
23
|
+
{/if}
|
|
24
|
+
</div>
|
|
29
25
|
|
|
30
26
|
<!--
|
|
31
27
|
@component
|
|
32
28
|
[Go to docs](https://flowbite-svelte.com/)
|
|
33
29
|
## Type
|
|
34
|
-
[FileuploadProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
30
|
+
[FileuploadProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L700)
|
|
35
31
|
## Props
|
|
36
|
-
@prop files = $bindable
|
|
32
|
+
@prop files = $bindable()
|
|
37
33
|
@prop size = "md"
|
|
38
34
|
@prop clearable = false
|
|
35
|
+
@prop elementRef = $bindable()
|
|
39
36
|
@prop class: className
|
|
37
|
+
@prop clearableSvgClass
|
|
38
|
+
@prop clearableColor = "none"
|
|
39
|
+
@prop clearableClass
|
|
40
|
+
@prop clearableOnClick
|
|
40
41
|
@prop ...restProps
|
|
41
42
|
-->
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FileuploadProps } from "../..";
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [FileuploadProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [FileuploadProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L700)
|
|
6
6
|
* ## Props
|
|
7
|
-
* @prop files = $bindable
|
|
7
|
+
* @prop files = $bindable()
|
|
8
8
|
* @prop size = "md"
|
|
9
9
|
* @prop clearable = false
|
|
10
|
+
* @prop elementRef = $bindable()
|
|
10
11
|
* @prop class: className
|
|
12
|
+
* @prop clearableSvgClass
|
|
13
|
+
* @prop clearableColor = "none"
|
|
14
|
+
* @prop clearableClass
|
|
15
|
+
* @prop clearableOnClick
|
|
11
16
|
* @prop ...restProps
|
|
12
17
|
*/
|
|
13
|
-
declare const Fileupload: import("svelte").Component<FileuploadProps, {}, "files">;
|
|
18
|
+
declare const Fileupload: import("svelte").Component<FileuploadProps, {}, "elementRef" | "files">;
|
|
14
19
|
type Fileupload = ReturnType<typeof Fileupload>;
|
|
15
20
|
export default Fileupload;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { idGenerator } from "../../uiHelpers.svelte";
|
|
3
3
|
import { floatingLabelInput } from ".";
|
|
4
|
-
import type
|
|
4
|
+
import { type FloatingLabelInputProps, CloseButton } from "../..";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
|
|
7
|
-
let { children, id = idGenerator(), value = $bindable(), "aria-describedby": ariaDescribedby, variant = "standard", size = "default", color = "default", class: divClass, inputClass, labelClass, ...restProps }: FloatingLabelInputProps = $props();
|
|
7
|
+
let { children, id = idGenerator(), value = $bindable(), elementRef = $bindable(), "aria-describedby": ariaDescribedby, variant = "standard", size = "default", color = "default", class: divClass, inputClass, labelClass, clearable, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, ...restProps }: FloatingLabelInputProps = $props();
|
|
8
8
|
|
|
9
|
-
const { base, input, label } = $derived(floatingLabelInput({ variant, size, color }));
|
|
9
|
+
const { base, input, label, clearbtn } = $derived(floatingLabelInput({ variant, size, color }));
|
|
10
|
+
|
|
11
|
+
const clearAll = () => {
|
|
12
|
+
if (elementRef) {
|
|
13
|
+
elementRef.value = "";
|
|
14
|
+
value = undefined;
|
|
15
|
+
}
|
|
16
|
+
if (clearableOnClick) clearableOnClick();
|
|
17
|
+
};
|
|
10
18
|
</script>
|
|
11
19
|
|
|
12
20
|
<div class={base({ class: clsx(divClass) })}>
|
|
13
|
-
<input {id} placeholder=" " bind:value {...restProps} aria-describedby={ariaDescribedby} class={input({ class: inputClass })} />
|
|
14
|
-
|
|
21
|
+
<input {id} placeholder=" " bind:value bind:this={elementRef} {...restProps} aria-describedby={ariaDescribedby} class={input({ class: inputClass })} />
|
|
22
|
+
{#if value !== undefined && value !== "" && clearable}
|
|
23
|
+
<CloseButton onclick={clearAll} class={clearbtn({ class: clearableClass })} color={clearableColor} aria-label="Clear search value" svgClass={clearableSvgClass} />
|
|
24
|
+
{/if}
|
|
15
25
|
<label for={id} class={label({ class: labelClass })}>
|
|
16
26
|
{@render children()}
|
|
17
27
|
</label>
|
|
@@ -21,11 +31,12 @@
|
|
|
21
31
|
@component
|
|
22
32
|
[Go to docs](https://flowbite-svelte.com/)
|
|
23
33
|
## Type
|
|
24
|
-
[FloatingLabelInputProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
34
|
+
[FloatingLabelInputProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L713)
|
|
25
35
|
## Props
|
|
26
36
|
@prop children
|
|
27
37
|
@prop id = idGenerator()
|
|
28
38
|
@prop value = $bindable()
|
|
39
|
+
@prop elementRef = $bindable()
|
|
29
40
|
@prop "aria-describedby": ariaDescribedby
|
|
30
41
|
@prop variant = "standard"
|
|
31
42
|
@prop size = "default"
|
|
@@ -33,5 +44,10 @@
|
|
|
33
44
|
@prop class: divClass
|
|
34
45
|
@prop inputClass
|
|
35
46
|
@prop labelClass
|
|
47
|
+
@prop clearable
|
|
48
|
+
@prop clearableSvgClass
|
|
49
|
+
@prop clearableColor = "none"
|
|
50
|
+
@prop clearableClass
|
|
51
|
+
@prop clearableOnClick
|
|
36
52
|
@prop ...restProps
|
|
37
53
|
-->
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FloatingLabelInputProps } from "../..";
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [FloatingLabelInputProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [FloatingLabelInputProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L713)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop id = idGenerator()
|
|
9
9
|
* @prop value = $bindable()
|
|
10
|
+
* @prop elementRef = $bindable()
|
|
10
11
|
* @prop "aria-describedby": ariaDescribedby
|
|
11
12
|
* @prop variant = "standard"
|
|
12
13
|
* @prop size = "default"
|
|
@@ -14,8 +15,13 @@ import type { FloatingLabelInputProps } from "../../types";
|
|
|
14
15
|
* @prop class: divClass
|
|
15
16
|
* @prop inputClass
|
|
16
17
|
* @prop labelClass
|
|
18
|
+
* @prop clearable
|
|
19
|
+
* @prop clearableSvgClass
|
|
20
|
+
* @prop clearableColor = "none"
|
|
21
|
+
* @prop clearableClass
|
|
22
|
+
* @prop clearableOnClick
|
|
17
23
|
* @prop ...restProps
|
|
18
24
|
*/
|
|
19
|
-
declare const FloatingLabelInput: import("svelte").Component<FloatingLabelInputProps, {}, "value">;
|
|
25
|
+
declare const FloatingLabelInput: import("svelte").Component<FloatingLabelInputProps, {}, "value" | "elementRef">;
|
|
20
26
|
type FloatingLabelInput = ReturnType<typeof FloatingLabelInput>;
|
|
21
27
|
export default FloatingLabelInput;
|
|
@@ -112,6 +112,7 @@ export declare const floatingLabelInput: import("tailwind-variants").TVReturnTyp
|
|
|
112
112
|
base: string;
|
|
113
113
|
input: string;
|
|
114
114
|
label: string;
|
|
115
|
+
clearbtn: string;
|
|
115
116
|
}, undefined, {
|
|
116
117
|
variant: {
|
|
117
118
|
filled: {
|
|
@@ -224,6 +225,7 @@ export declare const floatingLabelInput: import("tailwind-variants").TVReturnTyp
|
|
|
224
225
|
base: string;
|
|
225
226
|
input: string;
|
|
226
227
|
label: string;
|
|
228
|
+
clearbtn: string;
|
|
227
229
|
}, import("tailwind-variants").TVReturnType<{
|
|
228
230
|
variant: {
|
|
229
231
|
filled: {
|
|
@@ -336,4 +338,5 @@ export declare const floatingLabelInput: import("tailwind-variants").TVReturnTyp
|
|
|
336
338
|
base: string;
|
|
337
339
|
input: string;
|
|
338
340
|
label: string;
|
|
341
|
+
clearbtn: string;
|
|
339
342
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -3,7 +3,8 @@ export const floatingLabelInput = tv({
|
|
|
3
3
|
slots: {
|
|
4
4
|
base: "relative",
|
|
5
5
|
input: "block w-full text-sm text-gray-900 bg-transparent appearance-none dark:text-white focus:outline-hidden focus:ring-0 peer",
|
|
6
|
-
label: "absolute text-sm duration-300 transform scale-75 z-10 origin-left rtl:origin-right peer-placeholder-shown:scale-100 peer-focus:scale-75"
|
|
6
|
+
label: "absolute text-sm duration-300 transform scale-75 z-10 origin-left rtl:origin-right peer-placeholder-shown:scale-100 peer-focus:scale-75",
|
|
7
|
+
clearbtn: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-black"
|
|
7
8
|
},
|
|
8
9
|
variants: {
|
|
9
10
|
variant: {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
@component
|
|
17
17
|
[Go to docs](https://flowbite-svelte.com/)
|
|
18
18
|
## Type
|
|
19
|
-
[HelperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
19
|
+
[HelperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L732)
|
|
20
20
|
## Props
|
|
21
21
|
@prop children
|
|
22
22
|
@prop class: className
|
|
@@ -2,7 +2,7 @@ import type { HelperProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [HelperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [HelperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L732)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { SizeType } from "../../types";
|
|
3
2
|
import { getContext } from "svelte";
|
|
4
|
-
import { CloseButton } from "../..";
|
|
3
|
+
import { CloseButton, type SizeType, type InputProps, type InputValue } from "../..";
|
|
5
4
|
import { input, clampSize } from ".";
|
|
6
|
-
import type { InputProps, InputValue } from "../../types";
|
|
7
5
|
import clsx from "clsx";
|
|
8
6
|
|
|
9
|
-
let { children, left, right, value = $bindable(), clearable = false, size, color = "default", class: className, classLeft, classRight, divClass, ...restProps }: InputProps<InputValue> = $props();
|
|
7
|
+
let { children, left, right, value = $bindable(), elementRef = $bindable(), clearable = false, size, color = "default", class: className, classLeft, classRight, divClass, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, ...restProps }: InputProps<InputValue> = $props();
|
|
10
8
|
|
|
11
9
|
// tinted if put in component having its own background
|
|
12
10
|
let background: boolean = getContext("background");
|
|
@@ -16,10 +14,14 @@
|
|
|
16
14
|
let _size = $derived(size || clampSize(group?.size) || "md");
|
|
17
15
|
const _color = $derived(color === "default" && background ? "tinted" : color);
|
|
18
16
|
|
|
19
|
-
const { base, input: inputCls, left: leftCls, right: rightCls } = $derived(input({ size: _size, color: _color, group: isGroup, class: clsx(className) }));
|
|
17
|
+
const { base, input: inputCls, left: leftCls, right: rightCls, clearbtn } = $derived(input({ size: _size, color: _color, group: isGroup, class: clsx(className) }));
|
|
20
18
|
|
|
21
19
|
const clearAll = () => {
|
|
22
|
-
|
|
20
|
+
if (elementRef) {
|
|
21
|
+
elementRef.value = "";
|
|
22
|
+
value = undefined;
|
|
23
|
+
}
|
|
24
|
+
if (clearableOnClick) clearableOnClick();
|
|
23
25
|
};
|
|
24
26
|
</script>
|
|
25
27
|
|
|
@@ -32,21 +34,21 @@
|
|
|
32
34
|
{#if children}
|
|
33
35
|
{@render children({ ...restProps, class: inputCls() })}
|
|
34
36
|
{:else}
|
|
35
|
-
<input {...restProps} bind:value class={inputCls({ class: clsx(className) })} />
|
|
37
|
+
<input {...restProps} bind:value bind:this={elementRef} class={inputCls({ class: clsx(className) })} />
|
|
38
|
+
{#if value !== undefined && value !== "" && clearable}
|
|
39
|
+
<CloseButton onclick={clearAll} class={clearbtn({ class: clearableClass })} color={clearableColor} aria-label="Clear search value" svgClass={clearableSvgClass} />
|
|
40
|
+
{/if}
|
|
36
41
|
{/if}
|
|
37
42
|
{#if right}
|
|
38
43
|
<div class={rightCls({ class: classRight })}>
|
|
39
44
|
{@render right()}
|
|
40
45
|
</div>
|
|
41
46
|
{/if}
|
|
42
|
-
{#if clearable && value && `${value}`.length > 0}
|
|
43
|
-
<CloseButton {size} onclick={clearAll} class={rightCls({ class: classRight })} />
|
|
44
|
-
{/if}
|
|
45
47
|
{/snippet}
|
|
46
48
|
|
|
47
49
|
{#if group}
|
|
48
50
|
{@render inputContent()}
|
|
49
|
-
{:else if right || left}
|
|
51
|
+
{:else if right || left || clearable}
|
|
50
52
|
<div class={base({ class: divClass })}>
|
|
51
53
|
{@render inputContent()}
|
|
52
54
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InputProps, type InputValue } from "../..";
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Props
|
|
5
5
|
* @props:
|
|
6
6
|
*/
|
|
7
|
-
declare const Input: import("svelte").Component<InputProps<InputValue>, {}, "value">;
|
|
7
|
+
declare const Input: import("svelte").Component<InputProps<InputValue>, {}, "value" | "elementRef">;
|
|
8
8
|
type Input = ReturnType<typeof Input>;
|
|
9
9
|
export default Input;
|
|
@@ -93,6 +93,7 @@ export declare const input: import("tailwind-variants").TVReturnType<{
|
|
|
93
93
|
input: string;
|
|
94
94
|
left: string;
|
|
95
95
|
right: string;
|
|
96
|
+
clearbtn: string;
|
|
96
97
|
}, undefined, {
|
|
97
98
|
size: {
|
|
98
99
|
sm: {
|
|
@@ -186,6 +187,7 @@ export declare const input: import("tailwind-variants").TVReturnType<{
|
|
|
186
187
|
input: string;
|
|
187
188
|
left: string;
|
|
188
189
|
right: string;
|
|
190
|
+
clearbtn: string;
|
|
189
191
|
}, import("tailwind-variants").TVReturnType<{
|
|
190
192
|
size: {
|
|
191
193
|
sm: {
|
|
@@ -279,4 +281,5 @@ export declare const input: import("tailwind-variants").TVReturnType<{
|
|
|
279
281
|
input: string;
|
|
280
282
|
left: string;
|
|
281
283
|
right: string;
|
|
284
|
+
clearbtn: string;
|
|
282
285
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -4,7 +4,8 @@ export const input = tv({
|
|
|
4
4
|
base: "relative w-full",
|
|
5
5
|
input: "block w-full disabled:cursor-not-allowed disabled:opacity-50 rtl:text-right focus:outline-hidden",
|
|
6
6
|
left: "flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400 pointer-events-none start-0 p-2.5",
|
|
7
|
-
right: "flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400 end-0 p-2.5"
|
|
7
|
+
right: "flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400 end-0 p-2.5",
|
|
8
|
+
clearbtn: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-black"
|
|
8
9
|
},
|
|
9
10
|
variants: {
|
|
10
11
|
size: {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
@component
|
|
42
42
|
[Go to docs](https://flowbite-svelte.com/)
|
|
43
43
|
## Type
|
|
44
|
-
[InputAddonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
44
|
+
[InputAddonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L756)
|
|
45
45
|
## Props
|
|
46
46
|
@prop children
|
|
47
47
|
@prop class: className
|
|
@@ -2,7 +2,7 @@ import type { InputAddonProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [InputAddonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [InputAddonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L756)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
@component
|
|
21
21
|
[Go to docs](https://flowbite-svelte.com/)
|
|
22
22
|
## Type
|
|
23
|
-
[LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
23
|
+
[LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L763)
|
|
24
24
|
## Props
|
|
25
25
|
@prop children
|
|
26
26
|
@prop color = "gray"
|
|
@@ -2,7 +2,7 @@ import type { LabelProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [LabelProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L763)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop color = "gray"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
@component
|
|
15
15
|
[Go to docs](https://flowbite-svelte.com/)
|
|
16
16
|
## Type
|
|
17
|
-
[RangeProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
17
|
+
[RangeProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L792)
|
|
18
18
|
## Props
|
|
19
19
|
@prop value = $bindable()
|
|
20
20
|
@prop appearance = "none"
|
|
@@ -2,7 +2,7 @@ import type { RangeProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [RangeProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [RangeProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L792)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop value = $bindable()
|
|
8
8
|
* @prop appearance = "none"
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
<script lang="ts"
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { search } from ".";
|
|
4
|
-
import type
|
|
4
|
+
import { CloseButton, type SearchProps } from "../..";
|
|
5
5
|
|
|
6
|
-
let { children, class: inputClass, size, placeholder = "Search", value = $bindable
|
|
6
|
+
let { children, class: inputClass, size, placeholder = "Search", value = $bindable(), elementRef = $bindable(), clearable = false, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, ...restProps }: SearchProps = $props();
|
|
7
7
|
|
|
8
|
-
const { base, content, icon, input: inputCls, leftDiv } = $derived(search({ size }));
|
|
8
|
+
const { base, content, icon, clearbtn, input: inputCls, leftDiv } = $derived(search({ size }));
|
|
9
|
+
|
|
10
|
+
const clearAll = () => {
|
|
11
|
+
if (elementRef) {
|
|
12
|
+
elementRef.value = "";
|
|
13
|
+
value = undefined;
|
|
14
|
+
}
|
|
15
|
+
if (clearableOnClick) clearableOnClick();
|
|
16
|
+
};
|
|
9
17
|
</script>
|
|
10
18
|
|
|
11
19
|
<div class={base()}>
|
|
@@ -14,17 +22,33 @@
|
|
|
14
22
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" />
|
|
15
23
|
</svg>
|
|
16
24
|
</div>
|
|
17
|
-
<input type="search" bind:value class={inputCls({ class: clsx(inputClass) })} {placeholder} required {...restProps} />
|
|
25
|
+
<input type="search" bind:value bind:this={elementRef} class={inputCls({ class: clsx(inputClass) })} {placeholder} required {...restProps} />
|
|
18
26
|
{#if children}
|
|
19
27
|
<div class={content()}>
|
|
20
28
|
{@render children()}
|
|
21
29
|
</div>
|
|
22
30
|
{/if}
|
|
31
|
+
{#if value !== undefined && value !== "" && clearable}
|
|
32
|
+
<CloseButton onclick={clearAll} class={clearbtn({ class: clearableClass })} color={clearableColor} aria-label="Clear search value" svgClass={clearableSvgClass} />
|
|
33
|
+
{/if}
|
|
23
34
|
</div>
|
|
24
35
|
|
|
25
36
|
<!--
|
|
26
37
|
@component
|
|
27
38
|
[Go to docs](https://flowbite-svelte.com/)
|
|
39
|
+
## Type
|
|
40
|
+
[SearchProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L797)
|
|
28
41
|
## Props
|
|
29
|
-
@
|
|
42
|
+
@prop children
|
|
43
|
+
@prop class: inputClass
|
|
44
|
+
@prop size
|
|
45
|
+
@prop placeholder = "Search"
|
|
46
|
+
@prop value = $bindable()
|
|
47
|
+
@prop elementRef = $bindable()
|
|
48
|
+
@prop clearable = false
|
|
49
|
+
@prop clearableSvgClass
|
|
50
|
+
@prop clearableColor = "none"
|
|
51
|
+
@prop clearableClass
|
|
52
|
+
@prop clearableOnClick
|
|
53
|
+
@prop ...restProps
|
|
30
54
|
-->
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import type
|
|
2
|
-
declare class __sveltets_Render<T> {
|
|
3
|
-
props(): SearchProps<T>;
|
|
4
|
-
events(): {};
|
|
5
|
-
slots(): {};
|
|
6
|
-
bindings(): "value";
|
|
7
|
-
exports(): {};
|
|
8
|
-
}
|
|
9
|
-
interface $$IsomorphicComponent {
|
|
10
|
-
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
11
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
12
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
13
|
-
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
14
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
15
|
-
}
|
|
1
|
+
import { type SearchProps } from "../..";
|
|
16
2
|
/**
|
|
17
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
|
+
* ## Type
|
|
5
|
+
* [SearchProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L797)
|
|
18
6
|
* ## Props
|
|
19
|
-
* @
|
|
7
|
+
* @prop children
|
|
8
|
+
* @prop class: inputClass
|
|
9
|
+
* @prop size
|
|
10
|
+
* @prop placeholder = "Search"
|
|
11
|
+
* @prop value = $bindable()
|
|
12
|
+
* @prop elementRef = $bindable()
|
|
13
|
+
* @prop clearable = false
|
|
14
|
+
* @prop clearableSvgClass
|
|
15
|
+
* @prop clearableColor = "none"
|
|
16
|
+
* @prop clearableClass
|
|
17
|
+
* @prop clearableOnClick
|
|
18
|
+
* @prop ...restProps
|
|
20
19
|
*/
|
|
21
|
-
declare const Search:
|
|
22
|
-
type Search
|
|
20
|
+
declare const Search: import("svelte").Component<SearchProps, {}, "value" | "elementRef">;
|
|
21
|
+
type Search = ReturnType<typeof Search>;
|
|
23
22
|
export default Search;
|
|
@@ -21,6 +21,7 @@ export declare const search: import("tailwind-variants").TVReturnType<{
|
|
|
21
21
|
icon: string;
|
|
22
22
|
content: string;
|
|
23
23
|
input: string;
|
|
24
|
+
clearbtn: string;
|
|
24
25
|
}, undefined, {
|
|
25
26
|
size: {
|
|
26
27
|
sm: {
|
|
@@ -42,6 +43,7 @@ export declare const search: import("tailwind-variants").TVReturnType<{
|
|
|
42
43
|
icon: string;
|
|
43
44
|
content: string;
|
|
44
45
|
input: string;
|
|
46
|
+
clearbtn: string;
|
|
45
47
|
}, import("tailwind-variants").TVReturnType<{
|
|
46
48
|
size: {
|
|
47
49
|
sm: {
|
|
@@ -63,4 +65,5 @@ export declare const search: import("tailwind-variants").TVReturnType<{
|
|
|
63
65
|
icon: string;
|
|
64
66
|
content: string;
|
|
65
67
|
input: string;
|
|
68
|
+
clearbtn: string;
|
|
66
69
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -5,7 +5,8 @@ export const search = tv({
|
|
|
5
5
|
leftDiv: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none",
|
|
6
6
|
icon: "text-gray-500 dark:text-gray-400",
|
|
7
7
|
content: "absolute inset-y-0 end-0 flex items-center text-gray-500 dark:text-gray-400",
|
|
8
|
-
input: "block w-full text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
8
|
+
input: "block w-full text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
|
|
9
|
+
clearbtn: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-black"
|
|
9
10
|
},
|
|
10
11
|
variants: {
|
|
11
12
|
size: {
|
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
<script lang="ts" generics="T">
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { select as selectCls } from ".";
|
|
4
|
-
import type
|
|
4
|
+
import { type SelectProps, CloseButton } from "../..";
|
|
5
5
|
|
|
6
|
-
let { children, items, value = $bindable(), underline, size = "md", class: className, placeholder = "Choose option ...", ...restProps }: SelectProps<T> = $props();
|
|
6
|
+
let { children, items, value = $bindable(), elementRef = $bindable(), underline, size = "md", selectClass, class: className, placeholder = "Choose option ...", clearable, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, ...restProps }: SelectProps<T> = $props();
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const { base, select, clearbtn } = $derived(selectCls({ underline, size }));
|
|
9
|
+
|
|
10
|
+
const clearAll = () => {
|
|
11
|
+
if (elementRef) {
|
|
12
|
+
elementRef.value = "";
|
|
13
|
+
value = undefined;
|
|
14
|
+
}
|
|
15
|
+
if (clearableOnClick) clearableOnClick();
|
|
16
|
+
};
|
|
9
17
|
</script>
|
|
10
18
|
|
|
11
|
-
<
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
<div class={base({ class: clsx(className) })}>
|
|
20
|
+
<select {...restProps} bind:value bind:this={elementRef} class={select({ class: clsx(selectClass) })}>
|
|
21
|
+
{#if placeholder}
|
|
22
|
+
<option disabled selected value="">{placeholder}</option>
|
|
23
|
+
{/if}
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
{#if items}
|
|
26
|
+
{#each items as { value, name }}
|
|
27
|
+
<option {value}>{name}</option>
|
|
28
|
+
{/each}
|
|
29
|
+
{/if}
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
{#if children}
|
|
32
|
+
{@render children()}
|
|
33
|
+
{/if}
|
|
34
|
+
</select>
|
|
35
|
+
{#if value !== undefined && value !== "" && clearable}
|
|
36
|
+
<CloseButton onclick={clearAll} class={clearbtn({ class: clearableClass })} color={clearableColor} aria-label="Clear search value" svgClass={clearableSvgClass} />
|
|
24
37
|
{/if}
|
|
25
|
-
</
|
|
26
|
-
|
|
38
|
+
</div>
|
|
27
39
|
<!--
|
|
28
40
|
@component
|
|
29
41
|
[Go to docs](https://flowbite-svelte.com/)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SelectProps } from "../..";
|
|
2
2
|
declare class __sveltets_Render<T> {
|
|
3
3
|
props(): SelectProps<T>;
|
|
4
4
|
events(): {};
|
|
5
5
|
slots(): {};
|
|
6
|
-
bindings(): "value";
|
|
6
|
+
bindings(): "value" | "elementRef";
|
|
7
7
|
exports(): {};
|
|
8
8
|
}
|
|
9
9
|
interface $$IsomorphicComponent {
|