flowbite-svelte 0.22.4 → 0.22.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/CHANGELOG.md +31 -0
- package/dropdowns/Dropdown.svelte +13 -5
- package/forms/Checkbox.svelte +5 -3
- package/forms/Checkbox.svelte.d.ts +0 -1
- package/forms/Label.svelte +1 -1
- package/forms/Radio.svelte +6 -3
- package/forms/Radio.svelte.d.ts +1 -1
- package/forms/Select.svelte +22 -4
- package/forms/Select.svelte.d.ts +9 -4
- package/forms/SimpleSearch.svelte +5 -3
- package/forms/SimpleSearch.svelte.d.ts +0 -1
- package/forms/Toggle.svelte +17 -4
- package/package.json +5 -2
- package/toasts/Toast.svelte +1 -1
- package/toasts/Toast.svelte.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.22.7](https://github.com/themesberg/flowbite-svelte/compare/v0.22.6...v0.22.7) (2022-07-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* form buttons tinted removed ([5c2d619](https://github.com/themesberg/flowbite-svelte/commit/5c2d619c8c5ade960e2b3a59c20b809a40174829))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* [#177](https://github.com/themesberg/flowbite-svelte/issues/177) export visible/autohide ([2127151](https://github.com/themesberg/flowbite-svelte/commit/2127151550a778d35bee5eb3b2b77f38423f50e4))
|
|
16
|
+
|
|
17
|
+
### [0.22.6](https://github.com/themesberg/flowbite-svelte/compare/v0.22.5...v0.22.6) (2022-07-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* select input [#50](https://github.com/themesberg/flowbite-svelte/issues/50) ([8cea993](https://github.com/themesberg/flowbite-svelte/commit/8cea993344f1427f83ab46f29a9bc1613c67960c))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* add on:change to Radio ([074bd16](https://github.com/themesberg/flowbite-svelte/commit/074bd1677ced075971173c8abf1cf15387026efd))
|
|
28
|
+
|
|
29
|
+
### [0.22.5](https://github.com/themesberg/flowbite-svelte/compare/v0.22.4...v0.22.5) (2022-07-21)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* [#144](https://github.com/themesberg/flowbite-svelte/issues/144) ChevronLeft fix ([016940b](https://github.com/themesberg/flowbite-svelte/commit/016940b36c6782c2481d8ff6c489c2808945d674))
|
|
35
|
+
|
|
5
36
|
### [0.22.4](https://github.com/themesberg/flowbite-svelte/compare/v0.22.3...v0.22.4) (2022-07-21)
|
|
6
37
|
|
|
7
38
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { setContext } from 'svelte';
|
|
2
|
+
import Tooltip from '../tooltips/Tooltip.svelte';
|
|
2
3
|
import Button from '../buttons/Button.svelte';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import { ChevronUp, ChevronRight, ChevronDown, ChevronLeft } from 'svelte-heros';
|
|
@@ -8,6 +9,7 @@ export let tooltipArrow = false;
|
|
|
8
9
|
export let arrowIcon = true;
|
|
9
10
|
export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4 font-medium text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:w-auto dark:text-gray-400 dark:hover:text-white dark:focus:text-white dark:border-gray-700 dark:hover:bg-gray-700 md:dark:hover:bg-transparent';
|
|
10
11
|
export let placement = 'bottom';
|
|
12
|
+
setContext('background', true);
|
|
11
13
|
const icons = {
|
|
12
14
|
top: ChevronUp,
|
|
13
15
|
right: ChevronRight,
|
|
@@ -28,17 +30,23 @@ $: icon = icons[placement.split('-')[0]];
|
|
|
28
30
|
>
|
|
29
31
|
<slot name="trigger">
|
|
30
32
|
{#if inline}
|
|
31
|
-
<button class={labelClass}>
|
|
33
|
+
<button class={labelClass} class:flex-row-reverse={icon == ChevronLeft}>
|
|
32
34
|
<slot name="label">{label}</slot>
|
|
33
35
|
{#if arrowIcon}
|
|
34
|
-
<svelte:component
|
|
36
|
+
<svelte:component
|
|
37
|
+
this={icon ?? ChevronDown}
|
|
38
|
+
class={classNames('h-4 w-4', icon == ChevronLeft ? 'mr-2' : 'ml-2')}
|
|
39
|
+
/>
|
|
35
40
|
{/if}
|
|
36
41
|
</button>
|
|
37
42
|
{:else}
|
|
38
|
-
<Button {...$$restProps}>
|
|
43
|
+
<Button {...$$restProps} class={icon == ChevronLeft && 'flex-row-reverse'}>
|
|
39
44
|
<slot name="label">{label}</slot>
|
|
40
45
|
{#if arrowIcon}
|
|
41
|
-
<svelte:component
|
|
46
|
+
<svelte:component
|
|
47
|
+
this={icon ?? ChevronDown}
|
|
48
|
+
class={classNames('h-4 w-4', icon == ChevronLeft ? 'mr-2' : 'ml-2')}
|
|
49
|
+
/>
|
|
42
50
|
{/if}
|
|
43
51
|
</Button>
|
|
44
52
|
{/if}
|
package/forms/Checkbox.svelte
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import Radio, { labelClass, inputClass } from './Radio.svelte';
|
|
2
3
|
import Label from './Label.svelte';
|
|
3
4
|
// properties forwarding
|
|
4
5
|
export let color = 'blue';
|
|
5
6
|
export let custom = false;
|
|
6
7
|
export let inline = false;
|
|
7
|
-
export let tinted = false;
|
|
8
8
|
export let group = [];
|
|
9
9
|
export let value = '';
|
|
10
10
|
export let checked = undefined;
|
|
11
|
+
// tinted if put in component having its own background
|
|
12
|
+
let background = getContext('background');
|
|
11
13
|
$: {
|
|
12
14
|
// There's a bug in Svelte and bind:group is not working with wrapped checkbox
|
|
13
15
|
// This workaround is taken from:
|
|
@@ -37,6 +39,6 @@ $: {
|
|
|
37
39
|
on:click
|
|
38
40
|
{value}
|
|
39
41
|
{...$$restProps}
|
|
40
|
-
class={inputClass(custom, color, true,
|
|
42
|
+
class={inputClass(custom, color, true, background, $$slots.default || $$props.class)}
|
|
41
43
|
/><slot />
|
|
42
44
|
</Label>
|
package/forms/Label.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let color = 'gray';
|
|
3
|
-
export let defaultClass = 'text-sm font-medium';
|
|
3
|
+
export let defaultClass = 'text-sm font-medium block';
|
|
4
4
|
export let show = true; // helper for inheritance
|
|
5
5
|
let node;
|
|
6
6
|
const colorClasses = {
|
package/forms/Radio.svelte
CHANGED
|
@@ -26,13 +26,15 @@
|
|
|
26
26
|
);
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
|
-
<script>import
|
|
29
|
+
<script>import { getContext } from 'svelte';
|
|
30
|
+
import Label from './Label.svelte';
|
|
30
31
|
export let color = 'blue';
|
|
31
32
|
export let custom = false;
|
|
32
33
|
export let inline = false;
|
|
33
|
-
export let tinted = false;
|
|
34
34
|
export let group = '';
|
|
35
35
|
export let value = '';
|
|
36
|
+
// tinted if put in component having its own background
|
|
37
|
+
let background = getContext('background');
|
|
36
38
|
</script>
|
|
37
39
|
|
|
38
40
|
<Label class={labelClass(inline, $$props.class)} show={!!$$slots.default}>
|
|
@@ -40,8 +42,9 @@ export let value = '';
|
|
|
40
42
|
type="radio"
|
|
41
43
|
bind:group
|
|
42
44
|
on:click
|
|
45
|
+
on:change
|
|
43
46
|
{value}
|
|
44
47
|
{...$$restProps}
|
|
45
|
-
class={inputClass(custom, color, false,
|
|
48
|
+
class={inputClass(custom, color, false, background, $$slots.default || $$props.class)}
|
|
46
49
|
/><slot />
|
|
47
50
|
</Label>
|
package/forms/Radio.svelte.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ declare const __propDef: {
|
|
|
8
8
|
color?: FormColorType;
|
|
9
9
|
custom?: boolean;
|
|
10
10
|
inline?: boolean;
|
|
11
|
-
tinted?: boolean;
|
|
12
11
|
group?: number | string;
|
|
13
12
|
value?: string;
|
|
14
13
|
};
|
|
15
14
|
events: {
|
|
16
15
|
click: MouseEvent;
|
|
16
|
+
change: Event;
|
|
17
17
|
} & {
|
|
18
18
|
[evt: string]: CustomEvent<any>;
|
|
19
19
|
};
|
package/forms/Select.svelte
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let items = [];
|
|
3
|
+
export let value;
|
|
4
|
+
export let placeholder = 'Choose option ...';
|
|
5
|
+
export let underline = false;
|
|
6
|
+
export let size = 'md';
|
|
7
|
+
const common = 'block w-full';
|
|
8
|
+
export let defaultClass = 'text-gray-900 bg-gray-50 border border-gray-300 rounded-lg 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
|
+
export let underlineClass = 'text-gray-500 bg-transparent border-0 border-b-2 border-gray-200 appearance-none dark:text-gray-400 dark:border-gray-700 focus:outline-none focus:ring-0 focus:border-gray-200 peer';
|
|
10
|
+
const sizes = {
|
|
11
|
+
sm: 'text-sm p-2',
|
|
12
|
+
md: 'text-sm p-2.5',
|
|
13
|
+
lg: 'text-base py-3 px-4'
|
|
14
|
+
};
|
|
15
|
+
let selectClass;
|
|
16
|
+
$: selectClass = classNames(common, underline ? underlineClass : defaultClass, sizes[size], underline && '!px-0', $$restProps.class);
|
|
3
17
|
</script>
|
|
4
18
|
|
|
5
|
-
<select {...$$restProps} bind:value class={selectClass} on:change>
|
|
6
|
-
<
|
|
19
|
+
<select {...$$restProps} bind:value class={selectClass} on:change on:input>
|
|
20
|
+
<option disabled selected value="">{placeholder}</option>
|
|
21
|
+
|
|
22
|
+
{#each items as { value, name }}
|
|
23
|
+
<option {value}>{name}</option>
|
|
24
|
+
{/each}
|
|
7
25
|
</select>
|
package/forms/Select.svelte.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SelectOptionType } from '../types';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
6
|
+
items?: SelectOptionType[];
|
|
5
7
|
value: string | number;
|
|
6
|
-
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
underline?: boolean;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
defaultClass?: string;
|
|
12
|
+
underlineClass?: string;
|
|
7
13
|
};
|
|
8
14
|
events: {
|
|
9
15
|
change: Event;
|
|
16
|
+
input: Event;
|
|
10
17
|
} & {
|
|
11
18
|
[evt: string]: CustomEvent<any>;
|
|
12
19
|
};
|
|
13
|
-
slots: {
|
|
14
|
-
default: {};
|
|
15
|
-
};
|
|
20
|
+
slots: {};
|
|
16
21
|
};
|
|
17
22
|
export declare type SelectProps = typeof __propDef.props;
|
|
18
23
|
export declare type SelectEvents = typeof __propDef.events;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
// tainted if put in component having its own background
|
|
3
|
+
let background = getContext('background');
|
|
4
|
+
export let id = '';
|
|
2
5
|
export let labelClass = 'sr-only';
|
|
3
6
|
export let iconClass = 'w-5 h-5 text-gray-500 dark:text-gray-400';
|
|
4
7
|
export let iconDivClass = 'flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none';
|
|
5
8
|
export let inputClass = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
6
9
|
export let btnClass = 'p-2.5 ml-2 text-sm font-medium text-white bg-blue-700 rounded-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
7
10
|
export let placeholder = 'Search';
|
|
8
|
-
export let tinted = false;
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
13
|
<form class="flex items-center" on:submit>
|
|
@@ -28,7 +30,7 @@ export let tinted = false;
|
|
|
28
30
|
{...$$restProps}
|
|
29
31
|
type="text"
|
|
30
32
|
{id}
|
|
31
|
-
class="{
|
|
33
|
+
class="{background
|
|
32
34
|
? 'dark:bg-gray-600 dark:border-gray-500'
|
|
33
35
|
: ' dark:bg-gray-700 dark:border-gray-600'} {inputClass}"
|
|
34
36
|
{placeholder}
|
package/forms/Toggle.svelte
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import Checkbox from './Checkbox.svelte';
|
|
3
4
|
export let size = 'default';
|
|
4
5
|
export let group = [];
|
|
5
6
|
export let value = '';
|
|
6
7
|
export let checked = undefined;
|
|
7
|
-
|
|
8
|
+
// tinted if put in component having its own background
|
|
9
|
+
let background = getContext('background');
|
|
10
|
+
const common = "mr-3 bg-gray-200 rounded-full peer-focus:ring-4 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:bg-white after:border-gray-300 after:border after:rounded-full after:transition-all";
|
|
8
11
|
const colors = {
|
|
9
12
|
red: 'peer-focus:ring-red-300 dark:peer-focus:ring-red-800 peer-checked:bg-red-600',
|
|
10
13
|
green: 'peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:bg-green-600',
|
|
@@ -19,9 +22,19 @@ const sizes = {
|
|
|
19
22
|
default: 'w-11 h-6 after:top-0.5 after:left-[2px] after:h-5 after:w-5',
|
|
20
23
|
large: 'w-14 h-7 after:top-0.5 after:left-[4px] after:h-6 after:w-6'
|
|
21
24
|
};
|
|
25
|
+
let divClass;
|
|
26
|
+
$: divClass = classNames(common, background ? 'dark:bg-gray-600 dark:border-gray-500' : 'dark:bg-gray-700 dark:border-gray-600', colors[$$restProps.color ?? 'blue'], sizes[size]);
|
|
22
27
|
</script>
|
|
23
28
|
|
|
24
|
-
<Checkbox
|
|
25
|
-
|
|
29
|
+
<Checkbox
|
|
30
|
+
custom
|
|
31
|
+
class="relative {$$props.class}"
|
|
32
|
+
{value}
|
|
33
|
+
bind:checked
|
|
34
|
+
bind:group
|
|
35
|
+
{...$$restProps}
|
|
36
|
+
on:click
|
|
37
|
+
>
|
|
38
|
+
<div class={divClass} />
|
|
26
39
|
<slot />
|
|
27
40
|
</Checkbox>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.7",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -58,12 +58,15 @@
|
|
|
58
58
|
"dropdown",
|
|
59
59
|
"footer",
|
|
60
60
|
"forms",
|
|
61
|
+
"kbd",
|
|
61
62
|
"list group",
|
|
62
|
-
"
|
|
63
|
+
"modal",
|
|
63
64
|
"navbar",
|
|
64
65
|
"paginations",
|
|
65
66
|
"progress bars",
|
|
67
|
+
"rating",
|
|
66
68
|
"sidebars",
|
|
69
|
+
"skeleton",
|
|
67
70
|
"spinners",
|
|
68
71
|
"tables",
|
|
69
72
|
"tabs",
|
package/toasts/Toast.svelte
CHANGED
|
@@ -9,7 +9,7 @@ export let transition = 'fade';
|
|
|
9
9
|
export let params = {};
|
|
10
10
|
// Absolute position
|
|
11
11
|
export let position = undefined; // default not set
|
|
12
|
-
let visible = true;
|
|
12
|
+
export let visible = true;
|
|
13
13
|
const colors = {
|
|
14
14
|
blue: 'text-blue-500 bg-blue-100 dark:bg-blue-800 dark:text-blue-200',
|
|
15
15
|
green: 'text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200',
|