flowbite-svelte 0.21.9 → 0.21.12

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 CHANGED
@@ -2,6 +2,22 @@
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.12](https://github.com/themesberg/flowbite-svelte/compare/v0.21.11...v0.21.12) (2022-07-19)
6
+
7
+ ### [0.21.11](https://github.com/themesberg/flowbite-svelte/compare/v0.21.10...v0.21.11) (2022-07-18)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * 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))
13
+
14
+ ### [0.21.10](https://github.com/themesberg/flowbite-svelte/compare/v0.21.9...v0.21.10) (2022-07-17)
15
+
16
+
17
+ ### Features
18
+
19
+ * add Dropzone ([bb69872](https://github.com/themesberg/flowbite-svelte/commit/bb698721e07c489f1d1900012e60204e0af12e5a))
20
+
5
21
  ### [0.21.9](https://github.com/themesberg/flowbite-svelte/compare/v0.21.8...v0.21.9) (2022-07-17)
6
22
 
7
23
 
package/avatar/Dot.svelte CHANGED
@@ -23,7 +23,7 @@ $: dotClass = classNames('absolute rounded-full border-white dark:border-gray-80
23
23
  </script>
24
24
 
25
25
  {#if show}
26
- <div class="relative">
26
+ <div class="relative flex-shrink-0 h-full">
27
27
  <slot />
28
28
  <span class={dotClass} />
29
29
  </div>
@@ -19,39 +19,40 @@ $: icon = icons[placement.split('-')[0]];
19
19
  </script>
20
20
 
21
21
  <Tooltip
22
- class={classNames('w-44 !rounded !p-0', $$props.class)}
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
- {#if inline}
30
- <button class={labelClass}>
31
- <slot name="label">{label}</slot>
32
- {#if arrowIcon}
33
- <svelte:component this={icon ?? ChevronDown} class="ml-2 h-4 w-4" />
34
- {/if}
35
- </button>
36
- {:else}
37
- <Button
38
- pill={$$props.pill}
39
- outline={$$props.outline}
40
- color={$$props.color}
41
- size={$$props.size}
42
- icon={$$props.icon}
43
- gradientDuoTone={$$props.gradientDuoTone}
44
- gradientMonochrome={$$props.gradientMonochrome}
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
- <div slot="content">
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
- </div>
57
+ </slot>
57
58
  </Tooltip>
@@ -14,7 +14,11 @@ declare const __propDef: {
14
14
  [evt: string]: CustomEvent<any>;
15
15
  };
16
16
  slots: {
17
+ trigger: {};
17
18
  label: {};
19
+ content: {
20
+ slot: string;
21
+ };
18
22
  default: {};
19
23
  };
20
24
  };
@@ -1,9 +1,13 @@
1
1
  <script>import classNames from 'classnames';
2
2
  import DropdownDivider from './DropdownDivider.svelte';
3
- export let divClass = 'block py-2 px-4 text-sm text-gray-700 dark:text-gray-200';
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)} {...$$restProps}>
8
+ <div {...$$restProps} class={classNames(divClass, $$props.class)}>
7
9
  <slot />
8
10
  </div>
9
- <DropdownDivider />
11
+ {#if divider}
12
+ <DropdownDivider />
13
+ {/if}
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  divClass?: string;
6
+ divider?: boolean;
6
7
  };
7
8
  events: {
8
9
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,16 @@
1
1
  <script>import classNames from 'classnames';
2
- export let liClass = 'block cursor-pointer py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white';
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 {...$$restProps} class={classNames(liClass, $$props.class)} on:click>
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>
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  liClass?: string;
6
+ color?: string;
6
7
  };
7
8
  events: {
8
9
  click: MouseEvent;
@@ -1,21 +1,42 @@
1
- <script>import classNames from 'classnames';
2
- export let inputClass = 'w-4 h-4 bg-gray-100 rounded border-gray-300 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 ';
3
- export let checked = false;
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
- const colorClasses = {
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
- <input
17
- {...$$restProps}
18
- type="checkbox"
19
- bind:checked
20
- class={classNames(inputClass, colorClasses[color], $$props.class)}
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
- inputClass?: string;
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;
@@ -0,0 +1,14 @@
1
+ <script>export let value = '';
2
+ export let divClass = 'flex justify-center items-center w-full';
3
+ export let labelClass = 'flex flex-col justify-center items-center w-full h-64 bg-gray-50 rounded-lg border-2 border-gray-300 border-dashed cursor-pointer dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600';
4
+ export let innerDivClass = 'flex flex-col justify-center items-center pt-5 pb-6';
5
+ </script>
6
+
7
+ <div class={divClass}>
8
+ <label for="dropzone-file" class={labelClass}>
9
+ <div class={innerDivClass}>
10
+ <slot />
11
+ </div>
12
+ <input {...$$restProps} bind:value type="file" class="hidden" />
13
+ </label>
14
+ </div>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ value?: string;
6
+ divClass?: string;
7
+ labelClass?: string;
8
+ innerDivClass?: string;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {
14
+ default: {};
15
+ };
16
+ };
17
+ export declare type DropzoneProps = typeof __propDef.props;
18
+ export declare type DropzoneEvents = typeof __propDef.events;
19
+ export declare type DropzoneSlots = typeof __propDef.slots;
20
+ export default class Dropzone extends SvelteComponentTyped<DropzoneProps, DropzoneEvents, DropzoneSlots> {
21
+ }
22
+ export {};
@@ -20,6 +20,7 @@ function setType(node) {
20
20
  {...$$restProps}
21
21
  bind:value
22
22
  bind:this={ref}
23
+ on:change
23
24
  use:setType
24
25
  class={classNames(
25
26
  inputClass,
@@ -11,6 +11,8 @@ declare const __propDef: {
11
11
  ref?: HTMLElement;
12
12
  };
13
13
  events: {
14
+ change: Event;
15
+ } & {
14
16
  [evt: string]: CustomEvent<any>;
15
17
  };
16
18
  slots: {};
@@ -1,82 +1,49 @@
1
- <script>export let helper;
2
- export let id;
3
- export let value;
4
- export let label;
5
- export let group;
6
- export let divClass = 'flex items-center mr-4';
7
- export let inputClass = 'w-4 h-4 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 bg-gray-100 border-gray-300 ';
8
- export let labelClass = 'block ml-2 text-sm font-medium text-gray-900 dark:text-gray-300';
9
- export let disabled = false;
10
- export let name = '';
11
- export let divHelperClass = 'flex items-center h-5';
12
- export let labelHelperClass = 'font-medium text-gray-900 dark:text-gray-300';
13
- export let helperClass = 'text-xs font-normal text-gray-500 dark:text-gray-300';
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
- if (disabled) {
16
- labelClass = 'ml-2 text-sm font-medium text-gray-400 dark:text-gray-500';
17
- }
18
- if (color === 'red') {
19
- inputClass = 'text-red-600 focus:ring-red-500 dark:focus:ring-red-600';
20
- }
21
- else if (color === 'green') {
22
- inputClass = 'text-green-600 focus:ring-green-500 dark:focus:ring-green-600';
23
- }
24
- else if (color === 'purple') {
25
- inputClass = 'text-purple-600 focus:ring-purple-500 dark:focus:ring-purple-600';
26
- }
27
- else if (color === 'teal') {
28
- inputClass = 'text-teal-600 focus:ring-teal-500 dark:focus:ring-teal-600';
29
- }
30
- else if (color === 'yellow') {
31
- inputClass = 'text-yellow-400 focus:ring-yellow-500 dark:focus:ring-yellow-600';
32
- }
33
- else if (color === 'orange') {
34
- inputClass = 'text-orange-500 focus:ring-orange-500 dark:focus:ring-orange-600';
35
- }
36
- else {
37
- inputClass = 'text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-600';
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
- {#if helper}
42
- <div class="flex">
43
- <div class={divHelperClass}>
44
- <input
45
- {...$$restProps}
46
- bind:group
47
- {id}
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>
@@ -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;
@@ -1,55 +1,24 @@
1
- <script>import generateId from '../utils/generateId.js';
2
- export let name = 'toggle-example';
3
- export let color = 'blue';
1
+ <script>import classNames from 'classnames';
2
+ import Checkbox from './Checkbox.svelte';
4
3
  export let size = 'default';
5
- export let id = generateId();
6
- export let label = 'Toggle me';
7
- export let value = '';
8
- export let checked = false;
9
- export let disabled = false;
10
- export let labelClass = 'relative inline-flex items-center cursor-pointer';
11
- export let divClass = "w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 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-[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-blue-600";
12
- export let inputClass = 'sr-only';
13
- export let spanClass = 'ml-3 text-sm font-medium text-gray-900 dark:text-gray-300';
14
- if (color || size) {
15
- inputClass += ' peer';
16
- }
17
- if (color === 'red') {
18
- divClass =
19
- "w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 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-[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-red-600";
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
- <label for={id} class={labelClass}>
52
- <input type="checkbox" {id} class={inputClass} {value} bind:checked {name} {disabled} on:click />
53
- <div class="{divClass} {$$props.class ? $$props.class : ''}" />
54
- <span class={spanClass}>{label}</span>
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>
@@ -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/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export { default as FooterIcon } from './footer/FooterIcon.svelte';
29
29
  export { default as FooterLink } from './footer/FooterLink.svelte';
30
30
  export { default as FooterLinkGroup } from './footer/FooterLinkGroup.svelte';
31
31
  export { default as Checkbox } from './forms/Checkbox.svelte';
32
+ export { default as Dropzone } from './forms/Dropzone.svelte';
32
33
  export { default as Fileupload } from './forms/Fileupload.svelte';
33
34
  export { default as FloatingLabelInput } from './forms/FloatingLabelInput.svelte';
34
35
  export { default as Helper } from './forms/Helper.svelte';
package/index.js CHANGED
@@ -42,6 +42,7 @@ export { default as FooterLink } from './footer/FooterLink.svelte';
42
42
  export { default as FooterLinkGroup } from './footer/FooterLinkGroup.svelte';
43
43
  // Forms
44
44
  export { default as Checkbox } from './forms/Checkbox.svelte';
45
+ export { default as Dropzone } from './forms/Dropzone.svelte';
45
46
  export { default as Fileupload } from './forms/Fileupload.svelte';
46
47
  export { default as FloatingLabelInput } from './forms/FloatingLabelInput.svelte';
47
48
  export { default as Helper } from './forms/Helper.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.21.9",
3
+ "version": "0.21.12",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -134,6 +134,7 @@
134
134
  "./footer/SitemapFooter.svelte": "./footer/SitemapFooter.svelte",
135
135
  "./footer/SocialMediaFooter.svelte": "./footer/SocialMediaFooter.svelte",
136
136
  "./forms/Checkbox.svelte": "./forms/Checkbox.svelte",
137
+ "./forms/Dropzone.svelte": "./forms/Dropzone.svelte",
137
138
  "./forms/Fileupload.svelte": "./forms/Fileupload.svelte",
138
139
  "./forms/FloatingLabelInput.svelte": "./forms/FloatingLabelInput.svelte",
139
140
  "./forms/Helper.svelte": "./forms/Helper.svelte",
@@ -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>
@@ -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
- <span class="sr-only">Close</span>
20
- <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
21
- ><path
22
- fill-rule="evenodd"
23
- 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"
24
- clip-rule="evenodd"
25
- /></svg
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;