flowbite-svelte 0.46.17 → 0.46.19
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 +0 -1
- package/dist/accordion/Accordion.svelte +5 -5
- package/dist/accordion/Accordion.svelte.d.ts +6 -6
- package/dist/accordion/AccordionItem.svelte +17 -17
- package/dist/accordion/AccordionItem.svelte.d.ts +34 -35
- package/dist/alert/Alert.svelte +2 -2
- package/dist/alert/Alert.svelte.d.ts +3 -2
- package/dist/avatar/Avatar.svelte +8 -8
- package/dist/avatar/Avatar.svelte.d.ts +17 -17
- package/dist/badge/Badge.svelte +8 -8
- package/dist/badge/Badge.svelte.d.ts +19 -19
- package/dist/banner/Banner.svelte +8 -8
- package/dist/banner/Banner.svelte.d.ts +18 -18
- package/dist/bottom-navigation/BottomNav.svelte +6 -7
- package/dist/bottom-navigation/BottomNav.svelte.d.ts +14 -15
- package/dist/bottom-navigation/BottomNavHeader.svelte +2 -2
- package/dist/bottom-navigation/BottomNavHeader.svelte.d.ts +6 -6
- package/dist/bottom-navigation/BottomNavHeaderItem.svelte +4 -4
- package/dist/bottom-navigation/BottomNavHeaderItem.svelte.d.ts +10 -10
- package/dist/bottom-navigation/BottomNavItem.svelte +6 -6
- package/dist/bottom-navigation/BottomNavItem.svelte.d.ts +14 -14
- package/dist/breadcrumb/Breadcrumb.svelte +5 -5
- package/dist/breadcrumb/Breadcrumb.svelte.d.ts +12 -12
- package/dist/breadcrumb/BreadcrumbItem.svelte +5 -5
- package/dist/breadcrumb/BreadcrumbItem.svelte.d.ts +12 -12
- package/dist/button-group/ButtonGroup.svelte +2 -2
- package/dist/button-group/ButtonGroup.svelte.d.ts +6 -6
- package/dist/buttons/Button.svelte +10 -10
- package/dist/buttons/Button.svelte.d.ts +24 -22
- package/dist/buttons/GradientButton.svelte +2 -2
- package/dist/buttons/GradientButton.svelte.d.ts +19 -6
- package/dist/cards/Card.svelte +7 -7
- package/dist/cards/Card.svelte.d.ts +8 -7
- package/dist/carousel/Thumbnail.svelte +4 -4
- package/dist/carousel/Thumbnail.svelte.d.ts +5 -5
- package/dist/charts/Chart.svelte +3 -1
- package/dist/charts/Chart.svelte.d.ts +2 -2
- package/dist/darkmode/DarkMode.svelte +3 -3
- package/dist/darkmode/DarkMode.svelte.d.ts +8 -8
- package/dist/device-mockups/Android.svelte +7 -7
- package/dist/device-mockups/Android.svelte.d.ts +14 -15
- package/dist/device-mockups/DefaultMockup.svelte +6 -6
- package/dist/device-mockups/DefaultMockup.svelte.d.ts +12 -13
- package/dist/device-mockups/Desktop.svelte +4 -4
- package/dist/device-mockups/Desktop.svelte.d.ts +8 -9
- package/dist/device-mockups/DeviceMockup.svelte +1 -1
- package/dist/device-mockups/DeviceMockup.svelte.d.ts +1 -1
- package/dist/device-mockups/Ios.svelte +6 -6
- package/dist/device-mockups/Ios.svelte.d.ts +12 -13
- package/dist/device-mockups/Laptop.svelte +4 -4
- package/dist/device-mockups/Laptop.svelte.d.ts +8 -9
- package/dist/device-mockups/Smartwatch.svelte +6 -6
- package/dist/device-mockups/Smartwatch.svelte.d.ts +12 -13
- package/dist/device-mockups/Tablet.svelte +6 -6
- package/dist/device-mockups/Tablet.svelte.d.ts +12 -13
- package/dist/drawer/Drawer.svelte +16 -16
- package/dist/drawer/Drawer.svelte.d.ts +34 -34
- package/dist/forms/Checkbox.svelte +11 -11
- package/dist/forms/Checkbox.svelte.d.ts +24 -23
- package/dist/forms/Dropzone.svelte.d.ts +7 -7
- package/dist/forms/Helper.svelte +1 -1
- package/dist/forms/Label.svelte +1 -1
- package/dist/forms/MultiSelect.svelte +18 -8
- package/dist/forms/MultiSelect.svelte.d.ts +2 -0
- package/dist/forms/Select.svelte +2 -2
- package/dist/forms/Toggle.svelte +5 -5
- package/dist/forms/Toggle.svelte.d.ts +25 -11
- package/dist/rating/Rating.svelte +4 -4
- package/dist/rating/Rating.svelte.d.ts +4 -4
- package/dist/sidebar/SidebarItem.svelte +6 -1
- package/dist/sidebar/SidebarItem.svelte.d.ts +5 -0
- package/dist/types.d.ts +1 -0
- package/dist/typography/A.svelte +6 -1
- package/dist/typography/A.svelte.d.ts +5 -0
- package/dist/typography/List.svelte +1 -1
- package/dist/utils/focusTrap.d.ts +3 -1
- package/dist/utils/focusTrap.js +23 -33
- package/package.json +19 -18
|
@@ -8,6 +8,7 @@ export let value = [];
|
|
|
8
8
|
export let size = "md";
|
|
9
9
|
export let dropdownClass = "";
|
|
10
10
|
export let placeholder = "";
|
|
11
|
+
export let disabled = false;
|
|
11
12
|
$: selectItems = items.filter((x) => value.includes(x.value));
|
|
12
13
|
let show = false;
|
|
13
14
|
const sizes = {
|
|
@@ -15,7 +16,7 @@ const sizes = {
|
|
|
15
16
|
md: "px-3 py-1 min-h-[2.7rem]",
|
|
16
17
|
lg: "px-4 py-2 min-h-[3.2rem]"
|
|
17
18
|
};
|
|
18
|
-
const multiSelectClass = "relative border border-gray-300 flex items-center rounded-lg gap-2 dark:border-gray-600
|
|
19
|
+
const multiSelectClass = "relative border border-gray-300 flex items-center rounded-lg gap-2 dark:border-gray-600 ring-primary-500 dark:ring-primary-500 focus-visible:outline-none";
|
|
19
20
|
let multiSelectDropdown;
|
|
20
21
|
$: multiSelectDropdown = twMerge("absolute z-50 p-3 flex flex-col gap-1 max-h-64 bg-white border border-gray-300 dark:bg-gray-700 dark:border-gray-600 start-0 top-[calc(100%+1rem)] rounded-lg cursor-pointer overflow-y-scroll w-full", dropdownClass);
|
|
21
22
|
const itemsClass = "py-2 px-3 rounded-lg text-gray-600 hover:text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:text-gray-300 dark:hover:bg-gray-600";
|
|
@@ -24,6 +25,8 @@ let activeIndex = null;
|
|
|
24
25
|
$: activeItem = activeIndex !== null ? items[(activeIndex % items.length + items.length) % items.length] : null;
|
|
25
26
|
const activeItemClass = "bg-primary-100 text-primary-500 dark:bg-primary-500 dark:text-primary-100 hover:bg-primary-100 dark:hover:bg-primary-500 hover:text-primary-600 dark:hover:text-primary-100";
|
|
26
27
|
const selectOption = (select) => {
|
|
28
|
+
if (disabled) return;
|
|
29
|
+
if (select.disabled) return;
|
|
27
30
|
if (value.includes(select.value)) {
|
|
28
31
|
clearThisOption(select);
|
|
29
32
|
} else if (!value.includes(select.value)) {
|
|
@@ -32,22 +35,26 @@ const selectOption = (select) => {
|
|
|
32
35
|
}
|
|
33
36
|
};
|
|
34
37
|
const clearAll = (e) => {
|
|
38
|
+
if (disabled) return;
|
|
35
39
|
e.stopPropagation();
|
|
36
40
|
value = [];
|
|
37
41
|
dispatcher("change");
|
|
38
42
|
};
|
|
39
43
|
const clearThisOption = (select) => {
|
|
44
|
+
if (disabled) return;
|
|
40
45
|
if (value.includes(select.value)) {
|
|
41
46
|
value = value.filter((o) => o !== select.value);
|
|
42
47
|
dispatcher("change");
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
function handleEscape() {
|
|
51
|
+
if (disabled) return;
|
|
46
52
|
if (show) {
|
|
47
53
|
show = false;
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
function handleToggleActiveItem() {
|
|
57
|
+
if (disabled) return;
|
|
51
58
|
if (!show) {
|
|
52
59
|
show = true;
|
|
53
60
|
activeIndex = 0;
|
|
@@ -56,6 +63,7 @@ function handleToggleActiveItem() {
|
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
function handleArrowUpDown(offset) {
|
|
66
|
+
if (disabled) return;
|
|
59
67
|
if (!show) {
|
|
60
68
|
show = true;
|
|
61
69
|
activeIndex = 0;
|
|
@@ -68,6 +76,7 @@ function handleArrowUpDown(offset) {
|
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
function handleKeyDown(event) {
|
|
79
|
+
if (disabled) return;
|
|
71
80
|
switch (event.key) {
|
|
72
81
|
case "Escape":
|
|
73
82
|
handleEscape();
|
|
@@ -92,12 +101,12 @@ function handleKeyDown(event) {
|
|
|
92
101
|
|
|
93
102
|
<!-- Hidden select for form submission -->
|
|
94
103
|
<select {...$$restProps} {value} hidden multiple on:input>
|
|
95
|
-
{#each items as { value, name }}
|
|
96
|
-
<option {value}>{name}</option>
|
|
104
|
+
{#each items as { value, name, disabled }}
|
|
105
|
+
<option {value} {disabled}>{name}</option>
|
|
97
106
|
{/each}
|
|
98
107
|
</select>
|
|
99
108
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
100
|
-
<div on:click
|
|
109
|
+
<div on:click={() => !disabled && (show = !show)} on:focusout={() => !disabled && (show = false)} on:keydown={handleKeyDown} tabindex="0" role="listbox" class={twMerge(multiSelectClass, sizes[size], $$props.class, !disabled && "focus-within:ring-1 focus-within:border-primary-500 dark:focus-within:border-primary-500", disabled && "opacity-50 cursor-not-allowed")}>
|
|
101
110
|
{#if !selectItems.length}
|
|
102
111
|
<span class="text-gray-400">{placeholder}</span>
|
|
103
112
|
{/if}
|
|
@@ -105,7 +114,7 @@ function handleKeyDown(event) {
|
|
|
105
114
|
{#if selectItems.length}
|
|
106
115
|
{#each selectItems as item (item.name)}
|
|
107
116
|
<slot {item} clear={() => clearThisOption(item)}>
|
|
108
|
-
<Badge color="dark" large={size === 'lg'} dismissable params={{ duration: 100 }} on:close={() => clearThisOption(item)}>
|
|
117
|
+
<Badge color="dark" large={size === 'lg'} dismissable params={{ duration: 100 }} on:close={() => clearThisOption(item)} class={disabled ? "pointer-events-none" : undefined} >
|
|
109
118
|
{item.name}
|
|
110
119
|
</Badge>
|
|
111
120
|
</slot>
|
|
@@ -114,10 +123,10 @@ function handleKeyDown(event) {
|
|
|
114
123
|
</span>
|
|
115
124
|
<div class="flex ms-auto gap-2 items-center">
|
|
116
125
|
{#if selectItems.length}
|
|
117
|
-
<CloseButton {size} on:click={clearAll} color="none" class="p-0 focus:ring-gray-400 dark:text-white" />
|
|
126
|
+
<CloseButton {size} on:click={clearAll} color="none" class={twMerge("p-0 focus:ring-gray-400 dark:text-white", disabled && "cursor-not-allowed")} disabled={disabled} />
|
|
118
127
|
{/if}
|
|
119
128
|
<div class="w-[1px] bg-gray-300 dark:bg-gray-600"></div>
|
|
120
|
-
<svg
|
|
129
|
+
<svg class={twMerge("cursor-pointer h-3 w-3 ms-1 text-gray-800 dark:text-white", disabled && "cursor-not-allowed")} aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
|
121
130
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d={show ? 'm1 5 4-4 4 4' : 'm9 1-4 4-4-4'} />
|
|
122
131
|
</svg>
|
|
123
132
|
</div>
|
|
@@ -126,7 +135,7 @@ function handleKeyDown(event) {
|
|
|
126
135
|
<div on:click|stopPropagation role="presentation" class={multiSelectDropdown}>
|
|
127
136
|
{#each items as item (item.name)}
|
|
128
137
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
129
|
-
<div on:click={() => selectOption(item)} role="presentation" class={twMerge(itemsClass, selectItems.includes(item) && itemsSelectClass, activeItem === item && activeItemClass)}>
|
|
138
|
+
<div on:click={() => selectOption(item)} role="presentation" class={twMerge(itemsClass, selectItems.includes(item) && itemsSelectClass, activeItem === item && activeItemClass, disabled && "pointer-events-none", item.disabled && "opacity-50 cursor-not-allowed")}>
|
|
130
139
|
{item.name}
|
|
131
140
|
</div>
|
|
132
141
|
{/each}
|
|
@@ -143,4 +152,5 @@ function handleKeyDown(event) {
|
|
|
143
152
|
@prop export let size: FormSizeType = 'md';
|
|
144
153
|
@prop export let dropdownClass: string = '';
|
|
145
154
|
@prop export let placeholder: string = '';
|
|
155
|
+
@prop export let disabled: boolean = false;
|
|
146
156
|
-->
|
|
@@ -8,6 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
size?: FormSizeType | undefined;
|
|
9
9
|
dropdownClass?: string | undefined;
|
|
10
10
|
placeholder?: string | undefined;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
11
12
|
};
|
|
12
13
|
events: {
|
|
13
14
|
input: Event;
|
|
@@ -34,6 +35,7 @@ export type MultiSelectSlots = typeof __propDef.slots;
|
|
|
34
35
|
* @prop export let size: FormSizeType = 'md';
|
|
35
36
|
* @prop export let dropdownClass: string = '';
|
|
36
37
|
* @prop export let placeholder: string = '';
|
|
38
|
+
* @prop export let disabled: boolean = false;
|
|
37
39
|
*/
|
|
38
40
|
export default class MultiSelect extends SvelteComponentTyped<MultiSelectProps, MultiSelectEvents, MultiSelectSlots> {
|
|
39
41
|
}
|
package/dist/forms/Select.svelte
CHANGED
|
@@ -21,8 +21,8 @@ $: selectClass = twMerge(common, underline ? underlineClass : defaultClass, size
|
|
|
21
21
|
<option disabled selected={(value === undefined) ? true : undefined} value="">{placeholder}</option>
|
|
22
22
|
{/if}
|
|
23
23
|
|
|
24
|
-
{#each items as { value: itemValue, name }}
|
|
25
|
-
<option value={itemValue} selected={(itemValue === value) ? true : undefined}>{name}</option>
|
|
24
|
+
{#each items as { value: itemValue, name, disabled }}
|
|
25
|
+
<option disabled={disabled} value={itemValue} selected={(itemValue === value) ? true : undefined}>{name}</option>
|
|
26
26
|
{:else}
|
|
27
27
|
<slot />
|
|
28
28
|
{/each}
|
package/dist/forms/Toggle.svelte
CHANGED
|
@@ -39,9 +39,9 @@ $: divClass = twMerge(common, $$slots.offLabel ? "ms-3" : "", background ? "dark
|
|
|
39
39
|
@component
|
|
40
40
|
[Go to docs](https://flowbite-svelte.com/)
|
|
41
41
|
## Props
|
|
42
|
-
@prop export let size: '
|
|
43
|
-
@prop export let group:
|
|
44
|
-
@prop export let value:
|
|
45
|
-
@prop export let checked:
|
|
46
|
-
@prop export let customSize:
|
|
42
|
+
@prop export let size: NonNullable<$$Props['size']> = 'default';
|
|
43
|
+
@prop export let group: $$Props['group'] = [];
|
|
44
|
+
@prop export let value: $$Props['value'] = '';
|
|
45
|
+
@prop export let checked: $$Props['checked'] = undefined;
|
|
46
|
+
@prop export let customSize: $$Props['customSize'] = '';
|
|
47
47
|
-->
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { FormColorType } from '../types';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
name?: string;
|
|
6
|
+
color?: FormColorType;
|
|
7
|
+
custom?: boolean;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
group?: string[];
|
|
10
|
+
choices?: import("../types").CheckboxItem[];
|
|
11
|
+
value?: string | number;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
spacing?: string;
|
|
14
|
+
groupLabelClass?: string;
|
|
15
|
+
groupInputClass?: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
} & {
|
|
19
|
+
size?: "small" | "default" | "large" | "custom";
|
|
20
|
+
group?: string[];
|
|
21
|
+
value?: string | number;
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
customSize?: string;
|
|
10
24
|
};
|
|
11
25
|
events: {
|
|
12
26
|
click: MouseEvent;
|
|
@@ -25,11 +39,11 @@ export type ToggleSlots = typeof __propDef.slots;
|
|
|
25
39
|
/**
|
|
26
40
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
27
41
|
* ## Props
|
|
28
|
-
* @prop export let size: '
|
|
29
|
-
* @prop export let group:
|
|
30
|
-
* @prop export let value:
|
|
31
|
-
* @prop export let checked:
|
|
32
|
-
* @prop export let customSize:
|
|
42
|
+
* @prop export let size: NonNullable<$$Props['size']> = 'default';
|
|
43
|
+
* @prop export let group: $$Props['group'] = [];
|
|
44
|
+
* @prop export let value: $$Props['value'] = '';
|
|
45
|
+
* @prop export let checked: $$Props['checked'] = undefined;
|
|
46
|
+
* @prop export let customSize: $$Props['customSize'] = '';
|
|
33
47
|
*/
|
|
34
48
|
export default class Toggle extends SvelteComponentTyped<ToggleProps, ToggleEvents, ToggleSlots> {
|
|
35
49
|
}
|
|
@@ -8,8 +8,8 @@ export let rating = 4;
|
|
|
8
8
|
export let partialId = "partialStar" + generateId();
|
|
9
9
|
export let icon = Star;
|
|
10
10
|
export let count = false;
|
|
11
|
-
export let iconFillColor;
|
|
12
|
-
export let iconStrokeColor;
|
|
11
|
+
export let iconFillColor = "";
|
|
12
|
+
export let iconStrokeColor = "";
|
|
13
13
|
const fullStarId = generateId();
|
|
14
14
|
const grayStarId = generateId();
|
|
15
15
|
$: fullStars = Math.floor(rating);
|
|
@@ -50,6 +50,6 @@ $: grayStars = total - (fullStars + Math.ceil(rateDiffence));
|
|
|
50
50
|
@prop export let partialId: $$Props['partialId'] = 'partialStar' + generateId();
|
|
51
51
|
@prop export let icon: $$Props['icon'] = Star;
|
|
52
52
|
@prop export let count: $$Props['count'] = false;
|
|
53
|
-
@prop export let iconFillColor: $$Props['iconFillColor'];
|
|
54
|
-
@prop export let iconStrokeColor: $$Props['iconStrokeColor'];
|
|
53
|
+
@prop export let iconFillColor: $$Props['iconFillColor'] = '';
|
|
54
|
+
@prop export let iconStrokeColor: $$Props['iconStrokeColor'] = '';
|
|
55
55
|
-->
|
|
@@ -10,8 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
partialId?: string;
|
|
11
11
|
icon?: ComponentType;
|
|
12
12
|
count?: boolean;
|
|
13
|
-
iconFillColor?: string;
|
|
14
|
-
iconStrokeColor?: string;
|
|
13
|
+
iconFillColor?: string | undefined;
|
|
14
|
+
iconStrokeColor?: string | undefined;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -34,8 +34,8 @@ export type RatingSlots = typeof __propDef.slots;
|
|
|
34
34
|
* @prop export let partialId: $$Props['partialId'] = 'partialStar' + generateId();
|
|
35
35
|
* @prop export let icon: $$Props['icon'] = Star;
|
|
36
36
|
* @prop export let count: $$Props['count'] = false;
|
|
37
|
-
* @prop export let iconFillColor: $$Props['iconFillColor'];
|
|
38
|
-
* @prop export let iconStrokeColor: $$Props['iconStrokeColor'];
|
|
37
|
+
* @prop export let iconFillColor: $$Props['iconFillColor'] = '';
|
|
38
|
+
* @prop export let iconStrokeColor: $$Props['iconStrokeColor'] = '';
|
|
39
39
|
*/
|
|
40
40
|
export default class Rating extends SvelteComponentTyped<RatingProps, RatingEvents, RatingSlots> {
|
|
41
41
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
|
+
export let action = () => {
|
|
4
|
+
};
|
|
5
|
+
export let params = {};
|
|
3
6
|
export let href = "";
|
|
4
7
|
export let label = "";
|
|
5
8
|
export let spanClass = "ms-3";
|
|
@@ -16,7 +19,7 @@ $: aClass = twMerge(active ? activeClass ?? context.activeClass : nonActiveClass
|
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<li>
|
|
19
|
-
<a {...$$restProps} {href} on:blur on:click on:focus on:keydown on:keypress on:keyup on:mouseenter on:mouseleave on:mouseover class={aClass}>
|
|
22
|
+
<a {...$$restProps} {href} use:action={params} on:blur on:click on:focus on:keydown on:keypress on:keyup on:mouseenter on:mouseleave on:mouseover class={aClass}>
|
|
20
23
|
<slot name="icon" />
|
|
21
24
|
<span class={spanClass}>{label}</span>
|
|
22
25
|
{#if $$slots.subtext}
|
|
@@ -29,6 +32,8 @@ $: aClass = twMerge(active ? activeClass ?? context.activeClass : nonActiveClass
|
|
|
29
32
|
@component
|
|
30
33
|
[Go to docs](https://flowbite-svelte.com/)
|
|
31
34
|
## Props
|
|
35
|
+
@prop export let action: Action<HTMLElement, any> = () => {};
|
|
36
|
+
@prop export let params: any = {};
|
|
32
37
|
@prop export let href: string = '';
|
|
33
38
|
@prop export let label: string = '';
|
|
34
39
|
@prop export let spanClass: string = 'ms-3';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Action } from 'svelte/action';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
6
|
+
action?: Action<HTMLElement, any> | undefined;
|
|
7
|
+
params?: any;
|
|
5
8
|
href?: string | undefined;
|
|
6
9
|
label?: string | undefined;
|
|
7
10
|
spanClass?: string | undefined;
|
|
@@ -32,6 +35,8 @@ export type SidebarItemSlots = typeof __propDef.slots;
|
|
|
32
35
|
/**
|
|
33
36
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
34
37
|
* ## Props
|
|
38
|
+
* @prop export let action: Action<HTMLElement, any> = () => {};
|
|
39
|
+
* @prop export let params: any = {};
|
|
35
40
|
* @prop export let href: string = '';
|
|
36
41
|
* @prop export let label: string = '';
|
|
37
42
|
* @prop export let spanClass: string = 'ms-3';
|
package/dist/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export type ReviewType = {
|
|
|
46
46
|
export type SelectOptionType<T> = {
|
|
47
47
|
name: string | number;
|
|
48
48
|
value: T;
|
|
49
|
+
disabled?: boolean;
|
|
49
50
|
};
|
|
50
51
|
export type TransitionTypes = 'fade' | 'fly' | 'slide' | 'blur' | 'in:fly' | 'out:fly' | 'in:slide' | 'out:slide' | 'in:fade' | 'out:fade' | 'in:blur' | 'out:blur';
|
|
51
52
|
export interface ActivityType {
|
package/dist/typography/A.svelte
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<script>import { twMerge } from "tailwind-merge";
|
|
2
|
+
export let action = () => {
|
|
3
|
+
};
|
|
4
|
+
export let params = {};
|
|
2
5
|
export let href = "#";
|
|
3
6
|
export let color = "text-primary-600 dark:text-primary-500";
|
|
4
7
|
export let aClass = "inline-flex items-center hover:underline";
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
|
-
<a {...$$restProps} {href} class={twMerge(aClass, color, $$props.class)} on:click>
|
|
10
|
+
<a {...$$restProps} {href} use:action={params} class={twMerge(aClass, color, $$props.class)} on:click>
|
|
8
11
|
<slot />
|
|
9
12
|
</a>
|
|
10
13
|
|
|
@@ -12,6 +15,8 @@ export let aClass = "inline-flex items-center hover:underline";
|
|
|
12
15
|
@component
|
|
13
16
|
[Go to docs](https://flowbite-svelte.com/)
|
|
14
17
|
## Props
|
|
18
|
+
@prop export let action: Action<HTMLElement, any> = () => {};
|
|
19
|
+
@prop export let params: any = {};
|
|
15
20
|
@prop export let href: string = '#';
|
|
16
21
|
@prop export let color: string = 'text-primary-600 dark:text-primary-500';
|
|
17
22
|
@prop export let aClass: string = 'inline-flex items-center hover:underline';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Action } from 'svelte/action';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
6
|
+
action?: Action<HTMLElement, any> | undefined;
|
|
7
|
+
params?: any;
|
|
5
8
|
href?: string | undefined;
|
|
6
9
|
color?: string | undefined;
|
|
7
10
|
aClass?: string | undefined;
|
|
@@ -21,6 +24,8 @@ export type ASlots = typeof __propDef.slots;
|
|
|
21
24
|
/**
|
|
22
25
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
23
26
|
* ## Props
|
|
27
|
+
* @prop export let action: Action<HTMLElement, any> = () => {};
|
|
28
|
+
* @prop export let params: any = {};
|
|
24
29
|
* @prop export let href: string = '#';
|
|
25
30
|
* @prop export let color: string = 'text-primary-600 dark:text-primary-500';
|
|
26
31
|
* @prop export let aClass: string = 'inline-flex items-center hover:underline';
|
|
@@ -11,7 +11,7 @@ let positions = {
|
|
|
11
11
|
inside: "list-inside",
|
|
12
12
|
outside: "list-outside"
|
|
13
13
|
};
|
|
14
|
-
let classList = twMerge(lists[list ?? (tag === "ul" ? "disc" : "ol" ? "decimal" : "none")], positions[position], $$props.class);
|
|
14
|
+
let classList = twMerge(lists[list ?? (tag === "ul" ? "disc" : tag === "ol" ? "decimal" : "none")], positions[position], $$props.class);
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<svelte:element this={tag} {...$$restProps} class={classList}>
|
package/dist/utils/focusTrap.js
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Taken from github.com/carbon-design-system/carbon/packages/react/src/internal/keyboard/navigation.js
|
|
3
3
|
//
|
|
4
|
-
|
|
5
|
-
// add all the elements inside modal which you want to make focusable
|
|
6
4
|
const selectorTabbable = `
|
|
7
5
|
a[href], area[href], input:not([disabled]):not([tabindex='-1']),
|
|
8
6
|
button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),
|
|
9
7
|
textarea:not([disabled]):not([tabindex='-1']),
|
|
10
8
|
iframe, object, embed, *[tabindex]:not([tabindex='-1']):not([disabled]), *[contenteditable=true]
|
|
11
9
|
`;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
document.addEventListener('keydown', handleFocusTrap, true);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
destroy() {
|
|
39
|
-
document.removeEventListener('keydown', handleFocusTrap, true);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
10
|
+
const focusTrap = (node) => {
|
|
11
|
+
const handleFocusTrap = (e) => {
|
|
12
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === 9;
|
|
13
|
+
if (!isTabPressed) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const tabbable = Array.from(node.querySelectorAll(selectorTabbable)).filter((el) => el instanceof HTMLElement && el.hidden !== true);
|
|
17
|
+
let index = tabbable.indexOf(document.activeElement);
|
|
18
|
+
if (index === -1 && e.shiftKey)
|
|
19
|
+
index = 0;
|
|
20
|
+
index += tabbable.length + (e.shiftKey ? -1 : 1);
|
|
21
|
+
index %= tabbable.length;
|
|
22
|
+
tabbable[index].focus();
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
};
|
|
25
|
+
document.addEventListener('keydown', handleFocusTrap, true);
|
|
26
|
+
return {
|
|
27
|
+
destroy() {
|
|
28
|
+
document.removeEventListener('keydown', handleFocusTrap, true);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default focusTrap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.19",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"homepage": "https://flowbite-svelte.com/",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@changesets/cli": "^2.27.
|
|
15
|
+
"@changesets/cli": "^2.27.8",
|
|
16
16
|
"@docsearch/css": "^3.6.1",
|
|
17
17
|
"@docsearch/js": "^3.6.1",
|
|
18
|
-
"@playwright/test": "^1.
|
|
19
|
-
"@sveltejs/adapter-vercel": "^5.4.
|
|
20
|
-
"@sveltejs/kit": "^2.5.
|
|
18
|
+
"@playwright/test": "^1.47.2",
|
|
19
|
+
"@sveltejs/adapter-vercel": "^5.4.4",
|
|
20
|
+
"@sveltejs/kit": "^2.5.28",
|
|
21
21
|
"@sveltejs/package": "2.3.2",
|
|
22
22
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
23
23
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
@@ -25,31 +25,31 @@
|
|
|
25
25
|
"autoprefixer": "^10.4.20",
|
|
26
26
|
"dayjs": "^1.11.13",
|
|
27
27
|
"esbuild": "0.23.1",
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.11.0",
|
|
29
29
|
"eslint-config-prettier": "^9.1.0",
|
|
30
|
-
"eslint-plugin-svelte": "^2.
|
|
31
|
-
"flowbite-svelte": "^0.46.
|
|
30
|
+
"eslint-plugin-svelte": "^2.44.0",
|
|
31
|
+
"flowbite-svelte": "^0.46.19",
|
|
32
32
|
"flowbite-svelte-blocks": "^1.1.3",
|
|
33
33
|
"flowbite-svelte-icons": "^1.6.1",
|
|
34
34
|
"mdsvex": "^0.12.3",
|
|
35
35
|
"mdsvexamples": "^0.4.1",
|
|
36
|
-
"postcss": "^8.4.
|
|
36
|
+
"postcss": "^8.4.47",
|
|
37
37
|
"prettier": "^3.3.3",
|
|
38
38
|
"prettier-plugin-svelte": "^3.2.6",
|
|
39
39
|
"prism-themes": "^1.9.0",
|
|
40
|
-
"publint": "^0.2.
|
|
40
|
+
"publint": "^0.2.11",
|
|
41
41
|
"svelte": "^4.2.19",
|
|
42
|
-
"svelte-check": "^4.0.
|
|
43
|
-
"svelte-lib-helpers": "^0.4.
|
|
42
|
+
"svelte-check": "^4.0.2",
|
|
43
|
+
"svelte-lib-helpers": "^0.4.8",
|
|
44
44
|
"svelte-meta-tags": "^3.1.4",
|
|
45
45
|
"svelte-preprocess": "^6.0.2",
|
|
46
|
-
"svelte2tsx": "^0.7.
|
|
46
|
+
"svelte2tsx": "^0.7.19",
|
|
47
47
|
"tailwind-merge": "^1.13.1",
|
|
48
|
-
"tailwindcss": "^3.4.
|
|
48
|
+
"tailwindcss": "^3.4.12",
|
|
49
49
|
"tslib": "^2.7.0",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.6.2",
|
|
51
51
|
"typescript-eslint": "8.4.0",
|
|
52
|
-
"vite": "^5.4.
|
|
52
|
+
"vite": "^5.4.7",
|
|
53
53
|
"vitest": "^1.6.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"url": "https://github.com/themesberg/flowbite-svelte"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@floating-ui/dom": "^1.6.
|
|
102
|
+
"@floating-ui/dom": "^1.6.11",
|
|
103
103
|
"apexcharts": "^3.53.0",
|
|
104
104
|
"flowbite": "^2.5.1",
|
|
105
105
|
"tailwind-merge": "^2.5.2"
|
|
@@ -746,6 +746,7 @@
|
|
|
746
746
|
"test": "npm run test:integration && npm run test:unit",
|
|
747
747
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
748
748
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
749
|
+
"lint:format": "prettier --plugin-search-dir . --check .",
|
|
749
750
|
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
750
751
|
"format": "prettier --plugin-search-dir . --write .",
|
|
751
752
|
"test:integration": "playwright test",
|
|
@@ -754,7 +755,7 @@
|
|
|
754
755
|
"gen:docs": "svelte-lib-helpers docs",
|
|
755
756
|
"gen:compo-data": "svelte-lib-helpers compo-data",
|
|
756
757
|
"copy:package": "svelte-lib-helpers package",
|
|
757
|
-
"lib-helpers": "npm run gen:docs && npm run gen:compo-data && npm run package && npm run gen:exports && npm run copy:package",
|
|
758
|
+
"lib-helpers": "npm run gen:docs && npm run gen:compo-data && npm run package && npm run gen:exports && npm run copy:package && npm run format",
|
|
758
759
|
"package:publish": "standard-version && git push --follow-tags origin main && npm publish"
|
|
759
760
|
}
|
|
760
761
|
}
|