flowbite-svelte 0.27.16 → 0.28.0

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,32 @@
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.28.0](https://github.com/themesberg/flowbite-svelte/compare/v0.27.17...v0.28.0) (2022-11-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * enhance DarkMode ([#437](https://github.com/themesberg/flowbite-svelte/issues/437)) ([9afd3e1](https://github.com/themesberg/flowbite-svelte/commit/9afd3e11bec5bc4416537d7d371f970dd414a394))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * checkbox initial checked ([#434](https://github.com/themesberg/flowbite-svelte/issues/434)) ([43663cf](https://github.com/themesberg/flowbite-svelte/commit/43663cf165f249c7e3fa7e7dc8ccfaccc7e467a6))
16
+ * floatinginput type changes ([#436](https://github.com/themesberg/flowbite-svelte/issues/436)) ([5af9ecf](https://github.com/themesberg/flowbite-svelte/commit/5af9ecf598800e4cbcf27e413ba0b63d82926219))
17
+ * og:image and twitter:image to replace spaces with - ([#441](https://github.com/themesberg/flowbite-svelte/issues/441)) ([25ad6d0](https://github.com/themesberg/flowbite-svelte/commit/25ad6d09816e1df3a5a8ddd9a901186d2a36f4ee))
18
+
19
+ ### [0.27.17](https://github.com/themesberg/flowbite-svelte/compare/v0.27.16...v0.27.17) (2022-11-18)
20
+
21
+
22
+ ### Features
23
+
24
+ * add SpeedDial component ([a959c5e](https://github.com/themesberg/flowbite-svelte/commit/a959c5edd96e56145453f0558f19be7f7a7fa8b5))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * checkbox group ([#427](https://github.com/themesberg/flowbite-svelte/issues/427)) ([58c6660](https://github.com/themesberg/flowbite-svelte/commit/58c66600abcb943c730dbd64e6e4ca920bc06f8e))
30
+
5
31
  ### [0.27.16](https://github.com/themesberg/flowbite-svelte/compare/v0.27.15...v0.27.16) (2022-11-14)
6
32
 
7
33
  ### [0.27.15](https://github.com/themesberg/flowbite-svelte/compare/v0.27.14...v0.27.15) (2022-11-13)
@@ -50,6 +50,7 @@ const coloredShadowClasses = {
50
50
  };
51
51
  const outlineClasses = {
52
52
  blue: 'text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-600 dark:focus:ring-blue-800',
53
+ light: "text-gray-500 hover:text-gray-900 bg-white border border-gray-200 dark:border-gray-600 dark:hover:text-white dark:text-gray-400 hover:bg-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-400",
53
54
  dark: 'text-gray-900 hover:text-white border border-gray-800 hover:bg-gray-900 focus:bg-gray-900 focus:text-white focus:ring-gray-300 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-800',
54
55
  green: 'text-green-700 hover:text-white border border-green-700 hover:bg-green-800 focus:ring-green-300 dark:border-green-500 dark:text-green-500 dark:hover:text-white dark:hover:bg-green-600 dark:focus:ring-green-800',
55
56
  red: 'text-red-700 hover:text-white border border-red-700 hover:bg-red-800 focus:ring-red-300 dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600 dark:focus:ring-red-900',
@@ -1,4 +1,5 @@
1
- <script>export let btnClass = 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 fixed left-0 top-8 z-50';
1
+ <script>import classNames from 'classnames';
2
+ export let btnClass = 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5';
2
3
  const toggleTheme = () => {
3
4
  const isDark = window.document.documentElement.classList.toggle('dark');
4
5
  localStorage.setItem('color-theme', isDark ? 'dark' : 'light');
@@ -16,19 +17,28 @@ const toggleTheme = () => {
16
17
  </script>
17
18
  </svelte:head>
18
19
 
19
- <button on:click={toggleTheme} aria-label="Dark mode" type="button" class={btnClass}>
20
+ <button
21
+ on:click={toggleTheme}
22
+ aria-label="Dark mode"
23
+ type="button"
24
+ {...$$restProps}
25
+ class={classNames(btnClass, $$props.class)}>
20
26
  <span class="hidden dark:block">
21
- <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
22
- <path
23
- d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1
27
+ <slot name="lightIcon">
28
+ <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
29
+ <path
30
+ d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1
24
31
  0 100-2H3a1 1 0 000 2h1z"
25
- fill-rule="evenodd"
26
- clip-rule="evenodd" />
27
- </svg>
32
+ fill-rule="evenodd"
33
+ clip-rule="evenodd" />
34
+ </svg>
35
+ </slot>
28
36
  </span>
29
37
  <span class="dark:hidden">
30
- <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
31
- <path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
32
- </svg>
38
+ <slot name="darkIcon">
39
+ <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
40
+ <path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
41
+ </svg>
42
+ </slot>
33
43
  </span>
34
44
  </button>
@@ -1,12 +1,16 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  btnClass?: string | undefined;
5
6
  };
6
7
  events: {
7
8
  [evt: string]: CustomEvent<any>;
8
9
  };
9
- slots: {};
10
+ slots: {
11
+ lightIcon: {};
12
+ darkIcon: {};
13
+ };
10
14
  };
11
15
  export declare type DarkModeProps = typeof __propDef.props;
12
16
  export declare type DarkModeEvents = typeof __propDef.events;
@@ -1,5 +1,5 @@
1
1
  <script>import { getContext } from 'svelte';
2
- import Radio, { labelClass, inputClass } from './Radio.svelte';
2
+ import { labelClass, inputClass } from './Radio.svelte';
3
3
  import Label from './Label.svelte';
4
4
  // properties forwarding
5
5
  export let color = 'blue';
@@ -10,7 +10,16 @@ export let value = '';
10
10
  export let checked = false;
11
11
  // tinted if put in component having its own background
12
12
  let background = getContext('background');
13
- $: {
13
+ // react on external group changes
14
+ function init(_, _group) {
15
+ checked = checked || _group.includes(value);
16
+ return {
17
+ update(_group) {
18
+ checked = _group.includes(value);
19
+ }
20
+ };
21
+ }
22
+ function onChange() {
14
23
  // There's a bug in Svelte and bind:group is not working with wrapped checkbox
15
24
  // This workaround is taken from:
16
25
  // https://svelte.dev/repl/de117399559f4e7e9e14e2fc9ab243cc?version=3.12.1
@@ -34,6 +43,7 @@ $: {
34
43
 
35
44
  <Label class={labelClass(inline, $$props.class)} show={!!$$slots.default}>
36
45
  <input
46
+ use:init={group}
37
47
  type="checkbox"
38
48
  bind:checked
39
49
  on:keyup
@@ -46,6 +56,8 @@ $: {
46
56
  on:mouseenter
47
57
  on:mouseleave
48
58
  on:paste
59
+ on:change={onChange}
60
+ on:change
49
61
  {value}
50
62
  {...$$restProps}
51
63
  class={inputClass(custom, color, true, background, $$slots.default || $$props.class)} /><slot />
@@ -21,6 +21,7 @@ declare const __propDef: {
21
21
  mouseenter: MouseEvent;
22
22
  mouseleave: MouseEvent;
23
23
  paste: ClipboardEvent;
24
+ change: Event;
24
25
  } & {
25
26
  [evt: string]: CustomEvent<any>;
26
27
  };
@@ -61,9 +61,15 @@ const labelColorClasses = {
61
61
  red: 'text-red-600 dark:text-red-500'
62
62
  };
63
63
  // you need to this to avoid 2-way binding
64
- function setType(node) {
65
- node.type = type;
64
+ function setType(node, _type) {
65
+ node.type = _type;
66
+ return {
67
+ update(_type) {
68
+ node.type = _type;
69
+ }
70
+ };
66
71
  }
72
+ ;
67
73
  </script>
68
74
 
69
75
  <div class={divClasses[style]}>
@@ -82,7 +88,7 @@ function setType(node) {
82
88
  on:mouseleave
83
89
  on:mouseover
84
90
  on:paste
85
- use:setType
91
+ use:setType={type}
86
92
  placeholder=" "
87
93
  class={classNames(
88
94
  inputClasses[style],
@@ -9,7 +9,7 @@ declare const __propDef: {
9
9
  };
10
10
  events: {
11
11
  click: MouseEvent;
12
- change: CustomEvent<any>;
12
+ change: Event;
13
13
  } & {
14
14
  [evt: string]: CustomEvent<any>;
15
15
  };
package/index.d.ts CHANGED
@@ -81,6 +81,8 @@ export { default as TestimonialPlaceholder } from './skeleton/TestimonialPlaceho
81
81
  export { default as TextPlaceholder } from './skeleton/TextPlaceholder.svelte';
82
82
  export { default as VideoPlaceholder } from './skeleton/VideoPlaceholder.svelte';
83
83
  export { default as WidgetPlaceholder } from './skeleton/WidgetPlaceholder.svelte';
84
+ export { default as SpeedDial } from './speed-dial/SpeedDial.svelte';
85
+ export { default as SpeedDialButton } from './speed-dial/SpeedDialButton.svelte';
84
86
  export { default as Spinner } from './spinners/Spinner.svelte';
85
87
  export { default as Table } from './tables/Table.svelte';
86
88
  export { default as TableBody } from './tables/TableBody.svelte';
package/index.js CHANGED
@@ -107,6 +107,9 @@ export { default as TestimonialPlaceholder } from './skeleton/TestimonialPlaceho
107
107
  export { default as TextPlaceholder } from './skeleton/TextPlaceholder.svelte';
108
108
  export { default as VideoPlaceholder } from './skeleton/VideoPlaceholder.svelte';
109
109
  export { default as WidgetPlaceholder } from './skeleton/WidgetPlaceholder.svelte';
110
+ // Speed dial
111
+ export { default as SpeedDial } from './speed-dial/SpeedDial.svelte';
112
+ export { default as SpeedDialButton } from './speed-dial/SpeedDialButton.svelte';
110
113
  // Spin
111
114
  export { default as Spinner } from './spinners/Spinner.svelte';
112
115
  // Tables
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.27.16",
3
+ "version": "0.28.0",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -12,33 +12,33 @@
12
12
  "homepage": "https://flowbite-svelte.com/",
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
- "@playwright/test": "^1.25.0",
15
+ "@playwright/test": "^1.27.1",
16
16
  "@sveltejs/adapter-vercel": "1.0.0-next.78",
17
- "@sveltejs/kit": "1.0.0-next.484",
17
+ "@sveltejs/kit": "next",
18
18
  "@sveltejs/package": "1.0.0-next.3",
19
- "@typescript-eslint/eslint-plugin": "^5.27.0",
20
- "@typescript-eslint/parser": "^5.27.0",
21
- "autoprefixer": "^10.4.7",
19
+ "@typescript-eslint/eslint-plugin": "^5.43.0",
20
+ "@typescript-eslint/parser": "^5.43.0",
21
+ "autoprefixer": "^10.4.13",
22
22
  "createprops": "^0.4.9",
23
- "eslint": "^8.16.0",
24
- "eslint-config-prettier": "^8.3.0",
23
+ "eslint": "^8.27.0",
24
+ "eslint-config-prettier": "^8.5.0",
25
25
  "eslint-plugin-svelte3": "^4.0.0",
26
26
  "mdsvex": "^0.10.6",
27
27
  "mdsvexamples": "^0.3.2",
28
- "postcss": "^8.4.14",
28
+ "postcss": "^8.4.19",
29
29
  "postcss-load-config": "^4.0.1",
30
- "prettier": "^2.6.2",
31
- "prettier-plugin-svelte": "^2.7.0",
30
+ "prettier": "^2.7.1",
31
+ "prettier-plugin-svelte": "^2.8.0",
32
32
  "prism-themes": "^1.9.0",
33
- "svelte": "^3.44.0",
34
- "svelte-check": "^2.7.1",
33
+ "svelte": "^3.53.1",
34
+ "svelte-check": "^2.9.2",
35
35
  "svelte-meta-tags": "^2.6.3",
36
36
  "svelte-preprocess": "^4.10.7",
37
- "svelte2tsx": "^0.5.18",
38
- "tailwindcss": "^3.1.5",
39
- "tslib": "^2.3.1",
40
- "typescript": "^4.7.4",
41
- "vite": "^3.1.0"
37
+ "svelte2tsx": "^0.5.20",
38
+ "tailwindcss": "^3.2.4",
39
+ "tslib": "^2.4.1",
40
+ "typescript": "^4.8.4",
41
+ "vite": "^3.2.3"
42
42
  },
43
43
  "type": "module",
44
44
  "keywords": [
@@ -196,6 +196,8 @@
196
196
  "./skeleton/TextPlaceholder.svelte": "./skeleton/TextPlaceholder.svelte",
197
197
  "./skeleton/VideoPlaceholder.svelte": "./skeleton/VideoPlaceholder.svelte",
198
198
  "./skeleton/WidgetPlaceholder.svelte": "./skeleton/WidgetPlaceholder.svelte",
199
+ "./speed-dial/SpeedDial.svelte": "./speed-dial/SpeedDial.svelte",
200
+ "./speed-dial/SpeedDialButton.svelte": "./speed-dial/SpeedDialButton.svelte",
199
201
  "./spinners/Spinner.svelte": "./spinners/Spinner.svelte",
200
202
  "./tables/Table.svelte": "./tables/Table.svelte",
201
203
  "./tables/TableBody.svelte": "./tables/TableBody.svelte",
@@ -0,0 +1,44 @@
1
+ <script context="module">export {};
2
+ </script>
3
+
4
+ <script>import classNames from 'classnames';
5
+ import Button from '../buttons/Button.svelte';
6
+ import Popper from '../utils/Popper.svelte';
7
+ import { setContext } from 'svelte';
8
+ import generateId from '../utils/generateId';
9
+ export let defaultClass = 'fixed right-6 bottom-6';
10
+ export let placement = 'top';
11
+ export let pill = true;
12
+ export let tooltip = 'left';
13
+ export let trigger = 'hover';
14
+ export let textOutside = false;
15
+ export let id = generateId();
16
+ setContext('speed-dial', { pill, tooltip, textOutside });
17
+ let divClass;
18
+ $: divClass = classNames(defaultClass, 'group', $$props.class);
19
+ let poperClass;
20
+ $: poperClass = classNames('flex items-center mb-4 gap-2', ['top', 'bottom'].includes(placement) && 'flex-col');
21
+ </script>
22
+
23
+ <div class={divClass}>
24
+ <Button {pill} name="Open actions menu" aria-controls={id} aria-expanded="false" color="blue" class="!p-3">
25
+ <slot name="icon">
26
+ <svg
27
+ aria-hidden="true"
28
+ class="w-8 h-8 transition-transform group-hover:rotate-45"
29
+ fill="none"
30
+ stroke="currentColor"
31
+ viewBox="0 0 24 24"
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ ><path
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ stroke-width="2"
37
+ d="M12 6v6m0 0v6m0-6h6m-6 0H6" /></svg>
38
+ </slot>
39
+ <span class="sr-only">Open actions menu</span>
40
+ </Button>
41
+ <Popper {id} {trigger} arrow={false} color="none" activeContent {placement} class={poperClass}>
42
+ <slot />
43
+ </Popper>
44
+ </div>
@@ -0,0 +1,32 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Placement } from '@popperjs/core';
3
+ export interface SpeedCtxType {
4
+ pill: boolean;
5
+ tooltip: Placement | 'none';
6
+ textOutside: boolean;
7
+ }
8
+ declare const __propDef: {
9
+ props: {
10
+ [x: string]: any;
11
+ defaultClass?: string | undefined;
12
+ placement?: Placement | undefined;
13
+ pill?: boolean | undefined;
14
+ tooltip?: "none" | Placement | undefined;
15
+ trigger?: "click" | "hover" | undefined;
16
+ textOutside?: boolean | undefined;
17
+ id?: string | undefined;
18
+ };
19
+ events: {
20
+ [evt: string]: CustomEvent<any>;
21
+ };
22
+ slots: {
23
+ icon: {};
24
+ default: {};
25
+ };
26
+ };
27
+ export declare type SpeedDialProps = typeof __propDef.props;
28
+ export declare type SpeedDialEvents = typeof __propDef.events;
29
+ export declare type SpeedDialSlots = typeof __propDef.slots;
30
+ export default class SpeedDial extends SvelteComponentTyped<SpeedDialProps, SpeedDialEvents, SpeedDialSlots> {
31
+ }
32
+ export {};
@@ -0,0 +1,33 @@
1
+ <script>import Button from '../buttons/Button.svelte';
2
+ import Tooltip from '../tooltips/Tooltip.svelte';
3
+ import classNames from 'classnames';
4
+ import { getContext } from 'svelte';
5
+ export let name = '';
6
+ export let tooltip;
7
+ export let pill = undefined;
8
+ export let textOutside = undefined;
9
+ const context = getContext('speed-dial');
10
+ $: {
11
+ // set defaults
12
+ pill = pill ?? context?.pill ?? true;
13
+ tooltip = tooltip ?? context?.tooltip ?? 'left';
14
+ textOutside = textOutside ?? context?.textOutside ?? false;
15
+ }
16
+ let btnClass;
17
+ $: btnClass = classNames('w-[52px] h-[52px] shadow-sm !p-2', tooltip === 'none' && 'flex-col', textOutside && 'relative', $$props.class);
18
+ </script>
19
+
20
+ <Button {pill} outline color="light" {...$$restProps} class={btnClass} on:click>
21
+ <slot />
22
+ {#if tooltip !== 'none'}
23
+ <span class="sr-only">{name}</span>
24
+ {:else if textOutside}
25
+ <span class="block absolute -left-14 top-1/2 mb-px text-sm font-medium -translate-y-1/2">{name}</span>
26
+ {:else}
27
+ <span class="block mb-px text-xs font-medium">{name}</span>
28
+ {/if}
29
+ </Button>
30
+
31
+ {#if tooltip !== 'none'}
32
+ <Tooltip placement={tooltip} style="dark">{name}</Tooltip>
33
+ {/if}
@@ -0,0 +1,25 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Placement } from '@popperjs/core';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ name?: string | undefined;
7
+ tooltip: Placement | 'none';
8
+ pill?: boolean | undefined;
9
+ textOutside?: boolean | undefined;
10
+ };
11
+ events: {
12
+ click: MouseEvent;
13
+ } & {
14
+ [evt: string]: CustomEvent<any>;
15
+ };
16
+ slots: {
17
+ default: {};
18
+ };
19
+ };
20
+ export declare type SpeedDialButtonProps = typeof __propDef.props;
21
+ export declare type SpeedDialButtonEvents = typeof __propDef.events;
22
+ export declare type SpeedDialButtonSlots = typeof __propDef.slots;
23
+ export default class SpeedDialButton extends SvelteComponentTyped<SpeedDialButtonProps, SpeedDialButtonEvents, SpeedDialButtonSlots> {
24
+ }
25
+ export {};