flowbite-svelte 0.18.2 → 0.18.3
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 +7 -0
- package/forms/Checkbox.svelte +1 -1
- package/forms/Helper.svelte +8 -1
- package/forms/Helper.svelte.d.ts +1 -0
- package/forms/Iconinput.svelte +21 -28
- package/forms/Iconinput.svelte.d.ts +1 -7
- package/forms/Input.svelte +29 -43
- package/forms/Input.svelte.d.ts +2 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.18.3](https://github.com/themesberg/flowbite-svelte/compare/v0.18.2...v0.18.3) (2022-06-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update Input component ([94df473](https://github.com/themesberg/flowbite-svelte/commit/94df473935baaa4f22124ceb0d6501a1359bd4b4))
|
|
11
|
+
|
|
5
12
|
### [0.18.2](https://github.com/themesberg/flowbite-svelte/compare/v0.18.1...v0.18.2) (2022-06-22)
|
|
6
13
|
|
|
7
14
|
|
package/forms/Checkbox.svelte
CHANGED
package/forms/Helper.svelte
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let helperClass = 'text-xs font-normal text-gray-500 dark:text-gray-300';
|
|
3
|
+
export let color = 'gray';
|
|
4
|
+
const colorClasses = {
|
|
5
|
+
gray: 'text-gray-900 dark:text-gray-300',
|
|
6
|
+
green: 'text-green-700 dark:text-green-500',
|
|
7
|
+
red: 'text-red-700 dark:text-red-500',
|
|
8
|
+
disabled: 'text-gray-400 dark:text-gray-500'
|
|
9
|
+
};
|
|
3
10
|
</script>
|
|
4
11
|
|
|
5
|
-
<p class={classNames(helperClass, $$props.class)}
|
|
12
|
+
<p {...$$restProps} class={classNames(helperClass, colorClasses[color], $$props.class)}>
|
|
6
13
|
<slot />
|
|
7
14
|
</p>
|
package/forms/Helper.svelte.d.ts
CHANGED
package/forms/Iconinput.svelte
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
export let
|
|
3
|
-
export let id = generateId();
|
|
4
|
-
export let type;
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let type = 'text';
|
|
5
3
|
export let value = '';
|
|
6
4
|
export let icon;
|
|
7
|
-
export let helper = '';
|
|
8
|
-
export let placeholder = '';
|
|
9
5
|
export let noBorder = false;
|
|
10
|
-
export let labelClass = 'block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300';
|
|
11
6
|
export let inputClass = 'rounded-none rounded-r-lg bg-gray-50 border border-gray-300 text-gray-900 focus:ring-blue-500 focus:border-blue-500 block flex-1 min-w-0 w-full text-sm border-gray-300 p-2.5 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';
|
|
12
7
|
export let spanClass = 'inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 rounded-l-md border border-r-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600';
|
|
13
|
-
export let helperClass = 'mt-2 text-sm text-gray-500 dark:text-gray-400';
|
|
14
8
|
export let noBorderInputClass = '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:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
15
9
|
export let noBorderDivClass = 'flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none';
|
|
16
10
|
export let iconClass = 'h-4 w-4 mr-2';
|
|
@@ -20,24 +14,23 @@ function setType(node) {
|
|
|
20
14
|
}
|
|
21
15
|
</script>
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<div class={noBorderDivClass}>
|
|
28
|
-
<svelte:component this={icon} size={iconSize} class={iconClass} />
|
|
29
|
-
</div>
|
|
30
|
-
<input bind:value use:setType {id} class={noBorderInputClass} {placeholder} {...$$restProps} />
|
|
17
|
+
{#if noBorder}
|
|
18
|
+
<div class="relative">
|
|
19
|
+
<div class={noBorderDivClass}>
|
|
20
|
+
<svelte:component this={icon} size={iconSize} class={iconClass} />
|
|
31
21
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
</
|
|
22
|
+
<input
|
|
23
|
+
{...$$restProps}
|
|
24
|
+
bind:value
|
|
25
|
+
use:setType
|
|
26
|
+
class={classNames(noBorderInputClass, $$props.class)}
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
{:else}
|
|
30
|
+
<div class="flex">
|
|
31
|
+
<span class={spanClass}>
|
|
32
|
+
<svelte:component this={icon} size={iconSize} class={iconClass} />
|
|
33
|
+
</span>
|
|
34
|
+
<input {...$$restProps} {type} class={classNames(inputClass, $$props.class)} />
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -4,18 +4,12 @@ import type { SvelteComponent } from 'svelte';
|
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
[x: string]: any;
|
|
7
|
-
|
|
8
|
-
id?: string;
|
|
9
|
-
type: InputType;
|
|
7
|
+
type?: InputType;
|
|
10
8
|
value?: string;
|
|
11
9
|
icon: typeof SvelteComponent;
|
|
12
|
-
helper?: string;
|
|
13
|
-
placeholder?: string;
|
|
14
10
|
noBorder?: boolean;
|
|
15
|
-
labelClass?: string;
|
|
16
11
|
inputClass?: string;
|
|
17
12
|
spanClass?: string;
|
|
18
|
-
helperClass?: string;
|
|
19
13
|
noBorderInputClass?: string;
|
|
20
14
|
noBorderDivClass?: string;
|
|
21
15
|
iconClass?: string;
|
package/forms/Input.svelte
CHANGED
|
@@ -1,52 +1,38 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
2
|
export let type = 'text';
|
|
3
3
|
export let value = '';
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export let labelClass = 'block mb-4 text-sm font-medium text-gray-900 dark:text-gray-300';
|
|
13
|
-
export let disabled = false;
|
|
14
|
-
export let readonly = false;
|
|
15
|
-
export let helper = '';
|
|
16
|
-
export let helperClass = 'text-sm text-gray-500 dark:text-gray-400';
|
|
4
|
+
export let size = 'md';
|
|
5
|
+
export let inputClass = 'block w-full border disabled:cursor-not-allowed disabled:opacity-50 rounded-lg';
|
|
6
|
+
export let color = 'base';
|
|
7
|
+
const colorClasses = {
|
|
8
|
+
base: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500',
|
|
9
|
+
green: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500',
|
|
10
|
+
red: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500'
|
|
11
|
+
};
|
|
17
12
|
export let ref = null;
|
|
18
|
-
if (size === 'sm:text-md') {
|
|
19
|
-
padding = 'p-4';
|
|
20
|
-
}
|
|
21
|
-
else if (size === 'text-sm') {
|
|
22
|
-
padding = 'p-2.5';
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
padding = 'p-2';
|
|
26
|
-
}
|
|
27
13
|
// you need to this to avoid 2-way binding
|
|
28
14
|
function setType(node) {
|
|
29
15
|
node.type = type;
|
|
30
16
|
}
|
|
31
17
|
</script>
|
|
32
18
|
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
19
|
+
<input
|
|
20
|
+
{...$$restProps}
|
|
21
|
+
bind:value
|
|
22
|
+
bind:this={ref}
|
|
23
|
+
use:setType
|
|
24
|
+
class={classNames(
|
|
25
|
+
inputClass,
|
|
26
|
+
colorClasses[color],
|
|
27
|
+
{
|
|
28
|
+
// 'pl-10': icon !== null,
|
|
29
|
+
// 'rounded-lg': !($$slots.addon || addon),
|
|
30
|
+
// 'rounded-r-lg': $$slots.addon || addon,
|
|
31
|
+
// 'shadow-sm dark:shadow-sm-light': shadow,
|
|
32
|
+
'p-2 sm:text-xs': size === 'sm',
|
|
33
|
+
'p-2.5 text-sm': size === 'md',
|
|
34
|
+
'sm:text-md p-4': size === 'lg'
|
|
35
|
+
},
|
|
36
|
+
$$props.class
|
|
37
|
+
)}
|
|
38
|
+
/>
|
package/forms/Input.svelte.d.ts
CHANGED
|
@@ -5,18 +5,9 @@ declare const __propDef: {
|
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
type?: InputType;
|
|
7
7
|
value?: string;
|
|
8
|
-
|
|
9
|
-
id?: string;
|
|
10
|
-
label?: string;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
size?: 'sm:text-md' | 'text-sm' | 'sm:text-xs';
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
9
|
inputClass?: string;
|
|
15
|
-
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
readonly?: boolean;
|
|
18
|
-
helper?: string;
|
|
19
|
-
helperClass?: string;
|
|
10
|
+
color?: 'base' | 'green' | 'red';
|
|
20
11
|
ref?: HTMLElement;
|
|
21
12
|
};
|
|
22
13
|
events: {
|