flowbite-svelte 0.21.10 → 0.21.13
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 +11 -0
- package/avatar/Dot.svelte +1 -1
- package/dropdowns/Dropdown.svelte +27 -26
- package/dropdowns/Dropdown.svelte.d.ts +4 -0
- package/dropdowns/DropdownHeader.svelte +7 -3
- package/dropdowns/DropdownHeader.svelte.d.ts +1 -0
- package/dropdowns/DropdownItem.svelte +11 -2
- package/dropdowns/DropdownItem.svelte.d.ts +1 -0
- package/forms/Checkbox.svelte +39 -18
- package/forms/Checkbox.svelte.d.ts +7 -2
- package/forms/Input.svelte +1 -0
- package/forms/Input.svelte.d.ts +2 -0
- package/forms/Radio.svelte +46 -79
- package/forms/Radio.svelte.d.ts +9 -14
- package/forms/Toggle.svelte +21 -52
- package/forms/Toggle.svelte.d.ts +3 -15
- package/package.json +1 -1
- package/tooltips/Tooltip.svelte +7 -6
- package/utils/CloseButton.svelte +10 -8
- package/utils/CloseButton.svelte.d.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
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.21.13](https://github.com/themesberg/flowbite-svelte/compare/v0.21.12...v0.21.13) (2022-07-19)
|
|
6
|
+
|
|
7
|
+
### [0.21.12](https://github.com/themesberg/flowbite-svelte/compare/v0.21.11...v0.21.12) (2022-07-19)
|
|
8
|
+
|
|
9
|
+
### [0.21.11](https://github.com/themesberg/flowbite-svelte/compare/v0.21.10...v0.21.11) (2022-07-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* add on:change to Input component requested by https://github.com/themesberg/flowbite-svelte/pull/127 ([af5e64d](https://github.com/themesberg/flowbite-svelte/commit/af5e64d84b45f424b6166ff4fa1b5634a6f387d0))
|
|
15
|
+
|
|
5
16
|
### [0.21.10](https://github.com/themesberg/flowbite-svelte/compare/v0.21.9...v0.21.10) (2022-07-17)
|
|
6
17
|
|
|
7
18
|
|
package/avatar/Dot.svelte
CHANGED
|
@@ -19,39 +19,40 @@ $: icon = icons[placement.split('-')[0]];
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<Tooltip
|
|
22
|
-
class={classNames('
|
|
22
|
+
class={classNames('!rounded !p-0', $$props.class)}
|
|
23
23
|
style="auto"
|
|
24
24
|
animation="duration-100"
|
|
25
25
|
{placement}
|
|
26
26
|
arrow={tooltipArrow}
|
|
27
27
|
trigger="click"
|
|
28
28
|
>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
<slot name="trigger">
|
|
30
|
+
{#if inline}
|
|
31
|
+
<button class={labelClass}>
|
|
32
|
+
<slot name="label">{label}</slot>
|
|
33
|
+
{#if arrowIcon}
|
|
34
|
+
<svelte:component this={icon ?? ChevronDown} class="ml-2 h-4 w-4" />
|
|
35
|
+
{/if}
|
|
36
|
+
</button>
|
|
37
|
+
{:else}
|
|
38
|
+
<Button
|
|
39
|
+
pill={$$props.pill}
|
|
40
|
+
outline={$$props.outline}
|
|
41
|
+
color={$$props.color}
|
|
42
|
+
size={$$props.size}
|
|
43
|
+
icon={$$props.icon}
|
|
44
|
+
gradient={$$props.gradient}
|
|
45
|
+
>
|
|
46
|
+
<slot name="label">{label}</slot>
|
|
47
|
+
{#if arrowIcon}
|
|
48
|
+
<svelte:component this={icon ?? ChevronDown} class="ml-2 h-4 w-4" />
|
|
49
|
+
{/if}
|
|
50
|
+
</Button>
|
|
51
|
+
{/if}
|
|
52
|
+
</slot>
|
|
53
|
+
<slot name="content" slot="content">
|
|
53
54
|
<ul class="py-1">
|
|
54
55
|
<slot />
|
|
55
56
|
</ul>
|
|
56
|
-
</
|
|
57
|
+
</slot>
|
|
57
58
|
</Tooltip>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
import DropdownDivider from './DropdownDivider.svelte';
|
|
3
|
-
export let divClass = '
|
|
3
|
+
export let divClass = 'py-2 px-4 text-gray-700 dark:text-white';
|
|
4
|
+
// 'block py-2 px-4 text-sm text-gray-700 dark:text-gray-200';
|
|
5
|
+
export let divider = true;
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
|
-
<div class={classNames(divClass, $$props.class)}
|
|
8
|
+
<div {...$$restProps} class={classNames(divClass, $$props.class)}>
|
|
7
9
|
<slot />
|
|
8
10
|
</div>
|
|
9
|
-
|
|
11
|
+
{#if divider}
|
|
12
|
+
<DropdownDivider />
|
|
13
|
+
{/if}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
|
-
export let liClass = 'block cursor-pointer py-2 px-4 text-sm
|
|
2
|
+
export let liClass = 'block font-medium cursor-pointer py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600';
|
|
3
|
+
export let color = 'default';
|
|
4
|
+
const colors = {
|
|
5
|
+
default: 'text-gray-700 dark:text-gray-200 dark:hover:text-white',
|
|
6
|
+
red: 'text-red-600 dark:text-red-500'
|
|
7
|
+
};
|
|
3
8
|
</script>
|
|
4
9
|
|
|
5
|
-
<li
|
|
10
|
+
<li
|
|
11
|
+
{...$$restProps}
|
|
12
|
+
class={classNames(liClass, colors[color] ?? colors.default, $$props.class)}
|
|
13
|
+
on:click|stopPropagation
|
|
14
|
+
>
|
|
6
15
|
<slot />
|
|
7
16
|
</li>
|
package/forms/Checkbox.svelte
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
export let
|
|
3
|
-
export let
|
|
1
|
+
<script>import Radio from './Radio.svelte';
|
|
2
|
+
export let group = [];
|
|
3
|
+
export let value = '';
|
|
4
|
+
export let checked = undefined;
|
|
5
|
+
$: {
|
|
6
|
+
// There's a bug in Svelte and bind:group is not working with wrapped checkbox
|
|
7
|
+
// This workaround is taken from:
|
|
8
|
+
// https://svelte.dev/repl/de117399559f4e7e9e14e2fc9ab243cc?version=3.12.1
|
|
9
|
+
const index = group.indexOf(value);
|
|
10
|
+
if (checked === undefined)
|
|
11
|
+
checked = index >= 0;
|
|
12
|
+
if (checked) {
|
|
13
|
+
if (index < 0) {
|
|
14
|
+
group.push(value);
|
|
15
|
+
group = group;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
if (index >= 0) {
|
|
20
|
+
group.splice(index, 1);
|
|
21
|
+
group = group;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let inputClass; // get the value from the underlying Radio
|
|
26
|
+
// properties forwarding
|
|
27
|
+
export let custom = false;
|
|
4
28
|
export let color = 'blue';
|
|
5
|
-
|
|
6
|
-
red: 'text-red-600 focus:ring-red-500 dark:focus:ring-red-600',
|
|
7
|
-
green: 'text-green-600 focus:ring-green-500 dark:focus:ring-green-600',
|
|
8
|
-
purple: 'text-purple-600 focus:ring-purple-500 dark:focus:ring-purple-600',
|
|
9
|
-
teal: 'text-teal-600 focus:ring-teal-500 dark:focus:ring-teal-600',
|
|
10
|
-
yellow: 'text-yellow-400 focus:ring-yellow-500 dark:focus:ring-yellow-600',
|
|
11
|
-
orange: 'text-orange-500 focus:ring-orange-500 dark:focus:ring-orange-600',
|
|
12
|
-
blue: 'text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600'
|
|
13
|
-
};
|
|
29
|
+
export let inline = false;
|
|
14
30
|
</script>
|
|
15
31
|
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
<Radio class={$$restProps.class} bind:inputClass {color} {custom} {inline}>
|
|
33
|
+
<input
|
|
34
|
+
slot="input"
|
|
35
|
+
type="checkbox"
|
|
36
|
+
bind:checked
|
|
37
|
+
{value}
|
|
38
|
+
{...$$restProps}
|
|
39
|
+
class="rounded {inputClass}"
|
|
40
|
+
/>
|
|
41
|
+
<slot />
|
|
42
|
+
</Radio>
|
|
@@ -3,14 +3,19 @@ import type { FormColorType } from '../types';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
|
|
6
|
+
group?: string[];
|
|
7
|
+
value?: string;
|
|
7
8
|
checked?: boolean;
|
|
9
|
+
custom?: boolean;
|
|
8
10
|
color?: FormColorType;
|
|
11
|
+
inline?: boolean;
|
|
9
12
|
};
|
|
10
13
|
events: {
|
|
11
14
|
[evt: string]: CustomEvent<any>;
|
|
12
15
|
};
|
|
13
|
-
slots: {
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
14
19
|
};
|
|
15
20
|
export declare type CheckboxProps = typeof __propDef.props;
|
|
16
21
|
export declare type CheckboxEvents = typeof __propDef.events;
|
package/forms/Input.svelte
CHANGED
package/forms/Input.svelte.d.ts
CHANGED
package/forms/Radio.svelte
CHANGED
|
@@ -1,82 +1,49 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<script>/* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Label
|
|
2
|
+
|
|
3
|
+
To associate the <label> with an <input> element, you need to give the <input> an id attribute.
|
|
4
|
+
The <label> then needs a for attribute whose value is the same as the input's id.
|
|
5
|
+
|
|
6
|
+
Alternatively, you can nest the <input> directly inside the <label>, in which case the for and
|
|
7
|
+
id attributes are not needed because the association is implicit:
|
|
8
|
+
|
|
9
|
+
<label>Do you like peas?
|
|
10
|
+
<input type="checkbox" name="peas">
|
|
11
|
+
</label>
|
|
12
|
+
|
|
13
|
+
*/
|
|
14
|
+
import classNames from 'classnames';
|
|
14
15
|
export let color = 'blue';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
export let custom = false;
|
|
17
|
+
export let inline = false;
|
|
18
|
+
export let group = '';
|
|
19
|
+
export let value = '';
|
|
20
|
+
export let inputClass;
|
|
21
|
+
$: inputClass = classNames('w-4 h-4 bg-gray-100 border-gray-300 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 mr-2', custom && 'sr-only peer', colorClasses[color]);
|
|
22
|
+
let colorLabel = 'gray';
|
|
23
|
+
$: colorLabel = $$restProps.disabled ? 'disabled' : colorLabel;
|
|
24
|
+
let labelClass;
|
|
25
|
+
$: labelClass = classNames(inline ? 'inline-flex' : 'flex', 'items-center text-sm font-medium', colorClassesLabel[colorLabel], $$restProps.class);
|
|
26
|
+
const colorClassesLabel = {
|
|
27
|
+
gray: 'text-gray-900 dark:text-gray-300',
|
|
28
|
+
green: 'text-green-700 dark:text-green-500',
|
|
29
|
+
red: 'text-red-700 dark:text-red-500',
|
|
30
|
+
disabled: 'text-gray-400 dark:text-gray-500'
|
|
31
|
+
};
|
|
32
|
+
const colorClasses = {
|
|
33
|
+
red: 'text-red-600 focus:ring-red-500 dark:focus:ring-red-600',
|
|
34
|
+
green: 'text-green-600 focus:ring-green-500 dark:focus:ring-green-600',
|
|
35
|
+
purple: 'text-purple-600 focus:ring-purple-500 dark:focus:ring-purple-600',
|
|
36
|
+
teal: 'text-teal-600 focus:ring-teal-500 dark:focus:ring-teal-600',
|
|
37
|
+
yellow: 'text-yellow-400 focus:ring-yellow-500 dark:focus:ring-yellow-600',
|
|
38
|
+
orange: 'text-orange-500 focus:ring-orange-500 dark:focus:ring-orange-600',
|
|
39
|
+
blue: 'text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600'
|
|
40
|
+
};
|
|
39
41
|
</script>
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
type="radio"
|
|
49
|
-
{name}
|
|
50
|
-
{value}
|
|
51
|
-
class={inputClass}
|
|
52
|
-
aria-labelledby={id}
|
|
53
|
-
aria-describedby={id}
|
|
54
|
-
{disabled}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="ml-2 text-sm">
|
|
58
|
-
<label for={id} class={labelHelperClass}>
|
|
59
|
-
{@html label}
|
|
60
|
-
</label>
|
|
61
|
-
<p id="{id}-helper-radio-text" class={helperClass}>{helper}</p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
{:else}
|
|
65
|
-
<div class={divClass}>
|
|
66
|
-
<input
|
|
67
|
-
bind:group
|
|
68
|
-
{id}
|
|
69
|
-
type="radio"
|
|
70
|
-
{name}
|
|
71
|
-
{value}
|
|
72
|
-
class={inputClass}
|
|
73
|
-
aria-labelledby={id}
|
|
74
|
-
aria-describedby={id}
|
|
75
|
-
{disabled}
|
|
76
|
-
{...$$restProps}
|
|
77
|
-
/>
|
|
78
|
-
<label for={id} class={labelClass}>
|
|
79
|
-
{@html label}
|
|
80
|
-
</label>
|
|
81
|
-
</div>
|
|
82
|
-
{/if}
|
|
43
|
+
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
44
|
+
<label class={labelClass}>
|
|
45
|
+
<slot name="input">
|
|
46
|
+
<input type="radio" bind:group {value} {...$$restProps} class={inputClass} />
|
|
47
|
+
</slot>
|
|
48
|
+
<slot />
|
|
49
|
+
</label>
|
package/forms/Radio.svelte.d.ts
CHANGED
|
@@ -3,25 +3,20 @@ import type { FormColorType } from '../types';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
helper: string;
|
|
7
|
-
id: string;
|
|
8
|
-
value: string;
|
|
9
|
-
label: string;
|
|
10
|
-
group: number | string;
|
|
11
|
-
divClass?: string;
|
|
12
|
-
inputClass?: string;
|
|
13
|
-
labelClass?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
name?: string;
|
|
16
|
-
divHelperClass?: string;
|
|
17
|
-
labelHelperClass?: string;
|
|
18
|
-
helperClass?: string;
|
|
19
6
|
color?: FormColorType;
|
|
7
|
+
custom?: boolean;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
group?: number | string;
|
|
10
|
+
value?: string;
|
|
11
|
+
inputClass: string;
|
|
20
12
|
};
|
|
21
13
|
events: {
|
|
22
14
|
[evt: string]: CustomEvent<any>;
|
|
23
15
|
};
|
|
24
|
-
slots: {
|
|
16
|
+
slots: {
|
|
17
|
+
input: {};
|
|
18
|
+
default: {};
|
|
19
|
+
};
|
|
25
20
|
};
|
|
26
21
|
export declare type RadioProps = typeof __propDef.props;
|
|
27
22
|
export declare type RadioEvents = typeof __propDef.events;
|
package/forms/Toggle.svelte
CHANGED
|
@@ -1,55 +1,24 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
|
|
3
|
-
export let color = 'blue';
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
import Checkbox from './Checkbox.svelte';
|
|
4
3
|
export let size = 'default';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
else if (color === 'green') {
|
|
22
|
-
divClass =
|
|
23
|
-
"w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-green-600";
|
|
24
|
-
}
|
|
25
|
-
else if (color === 'purple') {
|
|
26
|
-
divClass =
|
|
27
|
-
"w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-purple-600";
|
|
28
|
-
}
|
|
29
|
-
else if (color === 'yellow') {
|
|
30
|
-
divClass =
|
|
31
|
-
"w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-yellow-300 dark:peer-focus:ring-yellow-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-yellow-400";
|
|
32
|
-
}
|
|
33
|
-
else if (color === 'teal') {
|
|
34
|
-
divClass =
|
|
35
|
-
"w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-teal-600";
|
|
36
|
-
}
|
|
37
|
-
else if (color === 'orange') {
|
|
38
|
-
divClass =
|
|
39
|
-
"w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500";
|
|
40
|
-
}
|
|
41
|
-
else if (size === 'small') {
|
|
42
|
-
divClass =
|
|
43
|
-
"w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
|
|
44
|
-
}
|
|
45
|
-
else if (size === 'large') {
|
|
46
|
-
divClass =
|
|
47
|
-
"w-14 h-7 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[4px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-6 after:w-6 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
|
|
48
|
-
}
|
|
4
|
+
const common = "mr-3 bg-gray-200 rounded-full peer-focus:ring-4 dark:bg-gray-700 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 dark:border-gray-600";
|
|
5
|
+
const colors = {
|
|
6
|
+
red: 'peer-focus:ring-red-300 dark:peer-focus:ring-red-800 peer-checked:bg-red-600',
|
|
7
|
+
green: 'peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:bg-green-600',
|
|
8
|
+
purple: 'peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 peer-checked:bg-purple-600',
|
|
9
|
+
yellow: 'peer-focus:ring-yellow-300 dark:peer-focus:ring-yellow-800 peer-checked:bg-yellow-400',
|
|
10
|
+
teal: 'peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:bg-teal-600',
|
|
11
|
+
orange: 'peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:bg-orange-500',
|
|
12
|
+
blue: 'peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 peer-checked:bg-blue-600'
|
|
13
|
+
};
|
|
14
|
+
const sizes = {
|
|
15
|
+
small: 'w-9 h-5 after:top-[2px] after:left-[2px] after:h-4 after:w-4',
|
|
16
|
+
default: 'w-11 h-6 after:top-0.5 after:left-[2px] after:h-5 after:w-5',
|
|
17
|
+
large: 'w-14 h-7 after:top-0.5 after:left-[4px] after:h-6 after:w-6'
|
|
18
|
+
};
|
|
49
19
|
</script>
|
|
50
20
|
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
</label>
|
|
21
|
+
<Checkbox custom class="relative {$$restProps.class}" {...$$restProps}>
|
|
22
|
+
<div class={classNames(common, colors[$$restProps.color ?? 'blue'], sizes[size])} />
|
|
23
|
+
<slot />
|
|
24
|
+
</Checkbox>
|
package/forms/Toggle.svelte.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { ToggleColorType } from '../types.js';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
name?: string;
|
|
7
|
-
color?: ToggleColorType;
|
|
8
5
|
size?: 'small' | 'default' | 'large';
|
|
9
|
-
id?: string;
|
|
10
|
-
label?: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
checked?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
labelClass?: string;
|
|
15
|
-
divClass?: string;
|
|
16
|
-
inputClass?: string;
|
|
17
|
-
spanClass?: string;
|
|
18
6
|
};
|
|
19
7
|
events: {
|
|
20
|
-
click: MouseEvent;
|
|
21
|
-
} & {
|
|
22
8
|
[evt: string]: CustomEvent<any>;
|
|
23
9
|
};
|
|
24
|
-
slots: {
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
25
13
|
};
|
|
26
14
|
export declare type ToggleProps = typeof __propDef.props;
|
|
27
15
|
export declare type ToggleEvents = typeof __propDef.events;
|
package/package.json
CHANGED
package/tooltips/Tooltip.svelte
CHANGED
|
@@ -61,7 +61,13 @@ onDestroy(() => {
|
|
|
61
61
|
|
|
62
62
|
<svelte:window on:resize={() => open && updatePosition()} />
|
|
63
63
|
|
|
64
|
-
<div
|
|
64
|
+
<div
|
|
65
|
+
use:clickOutside={() => {
|
|
66
|
+
if (open) {
|
|
67
|
+
open = false;
|
|
68
|
+
}
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
65
71
|
<div
|
|
66
72
|
class="w-fit"
|
|
67
73
|
bind:this={triggerRef}
|
|
@@ -80,11 +86,6 @@ onDestroy(() => {
|
|
|
80
86
|
open = !open;
|
|
81
87
|
}
|
|
82
88
|
}}
|
|
83
|
-
use:clickOutside={() => {
|
|
84
|
-
if (open) {
|
|
85
|
-
open = false;
|
|
86
|
-
}
|
|
87
|
-
}}
|
|
88
89
|
>
|
|
89
90
|
<slot />
|
|
90
91
|
</div>
|
package/utils/CloseButton.svelte
CHANGED
|
@@ -16,12 +16,14 @@ $: buttonClass = classNames('ml-auto -mx-1 -my-1.5 rounded-lg focus:ring-2 p-1.5
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<button on:click type="button" class={buttonClass} aria-label="Close">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
<slot>
|
|
20
|
+
<span class="sr-only">Close</span>
|
|
21
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
|
|
22
|
+
><path
|
|
23
|
+
fill-rule="evenodd"
|
|
24
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
25
|
+
clip-rule="evenodd"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
</slot>
|
|
27
29
|
</button>
|
|
@@ -9,7 +9,9 @@ declare const __propDef: {
|
|
|
9
9
|
} & {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
|
-
slots: {
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
13
15
|
};
|
|
14
16
|
export declare type CloseButtonProps = typeof __propDef.props;
|
|
15
17
|
export declare type CloseButtonEvents = typeof __propDef.events;
|