flowbite-svelte 0.29.9 → 0.29.10

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.29.10](https://github.com/themesberg/flowbite-svelte/compare/v0.29.9...v0.29.10) (2023-01-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * add on:input to textarea ([#518](https://github.com/themesberg/flowbite-svelte/issues/518)) ([318ffbf](https://github.com/themesberg/flowbite-svelte/commit/318ffbf676366fcc7bd08c538270800d90ce5189))
11
+ * make Select receive custom options ([#514](https://github.com/themesberg/flowbite-svelte/issues/514)) ([a58b410](https://github.com/themesberg/flowbite-svelte/commit/a58b410a3ffce29432907457baeae8c20977ef42))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * [#530](https://github.com/themesberg/flowbite-svelte/issues/530) ([16c6650](https://github.com/themesberg/flowbite-svelte/commit/16c66504d42a378705a120fae5a6ca147a776bd4))
17
+ * export slide params ([#516](https://github.com/themesberg/flowbite-svelte/issues/516)) ([c8dd81d](https://github.com/themesberg/flowbite-svelte/commit/c8dd81d5493b908a903648104f0371ac143c1167))
18
+ * modal layout ([#526](https://github.com/themesberg/flowbite-svelte/issues/526)) ([6b25019](https://github.com/themesberg/flowbite-svelte/commit/6b250190f25feefe21191b3d8cab709fe28c6908))
19
+ * npm run check corrections ([#517](https://github.com/themesberg/flowbite-svelte/issues/517)) ([f1f89e3](https://github.com/themesberg/flowbite-svelte/commit/f1f89e30221fd3bb63fed174fe825a46f780d1c7))
20
+
5
21
  ### [0.29.9](https://github.com/themesberg/flowbite-svelte/compare/v0.29.8...v0.29.9) (2023-01-01)
6
22
 
7
23
 
@@ -35,7 +35,7 @@ onMount(() => {
35
35
  // this will trigger unsubscribe on destroy
36
36
  return selected.subscribe((x) => (open = x === self));
37
37
  });
38
- const handleToggle = (e) => selected.set(open ? {} : self);
38
+ const handleToggle = (_) => selected.set(open ? {} : self);
39
39
  let buttonClass;
40
40
  $: buttonClass = classNames(defaultClass, ctx.flush ? 'py-5' : 'p-5', open && (ctx.flush ? 'text-gray-900 dark:text-white' : activeClasses || ctx.activeClasses), !open && (ctx.flush ? 'text-gray-500 dark:text-gray-400' : inactiveClasses || ctx.inactiveClasses), $$props.class);
41
41
  </script>
@@ -5,6 +5,7 @@ export let year = new Date().getFullYear();
5
5
  export let href = '';
6
6
  export let by = '';
7
7
  export let target = undefined;
8
+ export let copyrightMessage = 'All Rights Reserved.';
8
9
  </script>
9
10
 
10
11
  <span class={classNames(spanClass, $$props.class)}>
@@ -16,5 +17,5 @@ export let target = undefined;
16
17
  {:else}
17
18
  <span class="ml-1">{by}</span>
18
19
  {/if}
19
- . All Rights Reserved.
20
+ . {copyrightMessage}
20
21
  </span>
@@ -8,6 +8,7 @@ declare const __propDef: {
8
8
  href?: string | undefined;
9
9
  by?: string | undefined;
10
10
  target?: string | undefined;
11
+ copyrightMessage?: string | undefined;
11
12
  };
12
13
  events: {
13
14
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,4 @@
1
- <script>import A from '../typography/A.svelte';
2
- import classNames from 'classnames';
1
+ <script>import classNames from 'classnames';
3
2
  export let liClass = 'mr-4 last:mr-0 md:mr-6';
4
3
  export let aClass = 'hover:underline';
5
4
  export let href = '';
@@ -17,9 +17,13 @@ $: selectClass = classNames(common, underline ? underlineClass : defaultClass, s
17
17
  </script>
18
18
 
19
19
  <select {...$$restProps} bind:value class={selectClass} on:change on:contextmenu on:input>
20
- <option disabled selected value="">{placeholder}</option>
20
+ {#if placeholder}
21
+ <option disabled selected value="">{placeholder}</option>
22
+ {/if}
21
23
 
22
24
  {#each items as { value, name }}
23
25
  <option {value}>{name}</option>
26
+ {:else}
27
+ <slot />
24
28
  {/each}
25
29
  </select>
@@ -18,7 +18,9 @@ declare const __propDef: {
18
18
  } & {
19
19
  [evt: string]: CustomEvent<any>;
20
20
  };
21
- slots: {};
21
+ slots: {
22
+ default: {};
23
+ };
22
24
  };
23
25
  export type SelectProps = typeof __propDef.props;
24
26
  export type SelectEvents = typeof __propDef.events;
@@ -30,6 +30,7 @@ $: innerWrapperClass = classNames('py-2 px-4 bg-white dark:bg-gray-800', $$slots
30
30
  on:click
31
31
  on:contextmenu
32
32
  on:focus
33
+ on:input
33
34
  on:keydown
34
35
  on:keypress
35
36
  on:keyup
@@ -10,6 +10,7 @@ declare const __propDef: {
10
10
  click: MouseEvent;
11
11
  contextmenu: MouseEvent;
12
12
  focus: FocusEvent;
13
+ input: Event;
13
14
  keydown: KeyboardEvent;
14
15
  keypress: KeyboardEvent;
15
16
  keyup: KeyboardEvent;
@@ -62,15 +62,14 @@ const sizes = {
62
62
  const onAutoClose = (e) => {
63
63
  const target = e.target;
64
64
  if (autoclose && target?.tagName === 'BUTTON')
65
- open = false;
65
+ hide(e);
66
66
  };
67
- const hide = () => {
67
+ const hide = (e) => {
68
+ e.preventDefault();
68
69
  open = false;
69
70
  };
70
- let mainClass;
71
- $: mainClass = classNames('flex overflow-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full', backdropClasses, ...getPlacementClasses());
72
71
  let frameClass;
73
- $: frameClass = classNames('relative flex flex-col w-full h-full md:h-auto', $$props.class);
72
+ $: frameClass = classNames('relative flex flex-col mx-auto', $$props.class);
74
73
  const isScrollable = (e) => [
75
74
  e.scrollWidth > e.clientWidth && ['scroll', 'auto'].indexOf(getComputedStyle(e).overflowX) >= 0,
76
75
  e.scrollHeight > e.clientHeight && ['scroll', 'auto'].indexOf(getComputedStyle(e).overflowY) >= 0
@@ -82,22 +81,28 @@ function preventWheelDefault(e) {
82
81
  }
83
82
  function handleKeys(e) {
84
83
  if (e.key === 'Escape' && !permanent)
85
- return hide();
84
+ return hide(e);
86
85
  }
87
86
  </script>
88
87
 
89
88
  {#if open}
89
+ <!-- backdrop -->
90
+ <div class={classNames('fixed inset-0 z-40', backdropClasses)} />
91
+ <!-- dialog -->
90
92
  <div
91
- tabindex="-1"
92
- class={mainClass}
93
- aria-modal="true"
94
- role="dialog"
95
- on:keydown|preventDefault={handleKeys}
93
+ on:keydown={handleKeys}
96
94
  on:wheel|preventDefault
97
95
  use:prepareFocus
98
96
  use:focusTrap
99
- on:click={autoclose ? onAutoClose : null}>
100
- <div class="flex p-4 w-full {sizes[size]} h-full md:h-auto max-h-screen">
97
+ on:click={autoclose ? onAutoClose : null}
98
+ class={classNames(
99
+ 'fixed top-0 left-0 right-0 h-modal md:inset-0 md:h-full z-50 w-full p-4 flex',
100
+ ...getPlacementClasses()
101
+ )}
102
+ tabindex="-1"
103
+ aria-modal="true"
104
+ role="dialog">
105
+ <div class="flex relative {sizes[size]} w-full max-h-full">
101
106
  <!-- Modal content -->
102
107
  <Frame rounded shadow {...$$restProps} class={frameClass}>
103
108
  <!-- Modal header -->
@@ -5,6 +5,7 @@ import Frame from '../utils/Frame.svelte';
5
5
  export let divClass = 'w-full md:block md:w-auto';
6
6
  export let ulClass = 'flex flex-col p-4 mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium';
7
7
  export let hidden = true;
8
+ export let slideParams = { delay: 250, duration: 500, easing: quintOut };
8
9
  let _divClass;
9
10
  $: _divClass = classNames(divClass, $$props.class);
10
11
  let _ulClass;
@@ -14,7 +15,7 @@ $$props.class);
14
15
  </script>
15
16
 
16
17
  {#if !hidden}
17
- <div {...$$restProps} class={_divClass} transition:slide={{ delay: 250, duration: 500, easing: quintOut }}>
18
+ <div {...$$restProps} class={_divClass} transition:slide={slideParams}>
18
19
  <Frame tag="ul" border rounded color="navbarUl" class={_ulClass}>
19
20
  <slot />
20
21
  </Frame>
@@ -1,10 +1,12 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import { type SlideParams } from 'svelte/transition';
2
3
  declare const __propDef: {
3
4
  props: {
4
5
  [x: string]: any;
5
6
  divClass?: string | undefined;
6
7
  ulClass?: string | undefined;
7
8
  hidden?: boolean | undefined;
9
+ slideParams?: SlideParams | undefined;
8
10
  };
9
11
  events: {
10
12
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.29.9",
3
+ "version": "0.29.10",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -1,5 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
- import { getContext, onMount } from 'svelte';
2
+ import { getContext } from 'svelte';
3
3
  export let href = undefined;
4
4
  export let active = false;
5
5
  export let activeClass = '';
@@ -17,12 +17,12 @@ let grayStars = total - roundedRating;
17
17
  <p class="ml-2 text-sm font-bold text-gray-900 dark:text-white">{rating}</p>
18
18
  <slot />
19
19
  {:else}
20
- {#each Array(roundedRating) as _, star}
20
+ {#each Array(roundedRating) as _}
21
21
  <slot name="ratingUp">
22
22
  <Star variation="solid" {size} class="text-yellow-300 dark:text-yellow-200" />
23
23
  </slot>
24
24
  {/each}
25
- {#each Array(grayStars) as _, star}
25
+ {#each Array(grayStars) as _}
26
26
  <slot name="ratingDown">
27
27
  <Star {size} class="text-gray-300 dark:text-gray-500" />
28
28
  </slot>
@@ -10,55 +10,55 @@ let grayStars = comment.total - roundedRating;
10
10
  </script>
11
11
 
12
12
  <article>
13
- <div class="flex items-center mb-4 space-x-4">
14
- <img class="w-10 h-10 rounded-full" src={comment.user.img.src} alt={comment.user.img.alt} />
15
- <div class="space-y-1 font-medium dark:text-white">
16
- <p>
17
- {comment.user.name}
18
- <time datetime="2014-08-16 19:00" class="block text-sm text-gray-500 dark:text-gray-400"
19
- >{comment.user.joined}</time>
20
- </p>
21
- </div>
22
- </div>
23
- <div class="flex items-center mb-1">
24
- {#each Array(roundedRating) as _, star}
25
- <slot name="ratingUp">
26
- <Star variation="solid" size="24" class="text-yellow-300 dark:text-yellow-200" />
27
- </slot>
28
- {/each}
29
- {#each Array(grayStars) as _, star}
30
- <slot name="ratingDown">
31
- <Star size="24" class="px-0.5 text-gray-300 dark:text-gray-500" />
32
- </slot>
33
- {/each}
34
- {#if comment.heading}
35
- <h3 class="ml-2 text-sm font-semibold text-gray-900 dark:text-white">
36
- {comment.heading}
37
- </h3>
38
- {/if}
39
- </div>
40
- {#if comment.address || comment.datetime}
41
- <footer class="mb-5 text-sm text-gray-500 dark:text-gray-400">
42
- <p>Reviewed in {comment.address} on {comment.datetime}</p>
43
- </footer>
44
- {/if}
45
- <slot />
46
- <aside>
47
- <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
48
- <slot name="evaluation" />
49
- </p>
50
- {#if helpfullink || abuselink}
51
- <div class="flex items-center mt-3 space-x-3 divide-x divide-gray-200 dark:divide-gray-600">
52
- {#if helpfullink}
53
- <Button size="xs" href="/" color="dark">Helpful</Button>
54
- {/if}
55
- {#if abuselink}
56
- <a
57
- href={abuselink}
58
- class="pl-4 text-sm font-medium text-blue-600 hover:underline dark:text-blue-500"
59
- >Report abuse</a>
60
- {/if}
61
- </div>
62
- {/if}
63
- </aside>
13
+ <div class="flex items-center mb-4 space-x-4">
14
+ <img class="w-10 h-10 rounded-full" src={comment.user.img.src} alt={comment.user.img.alt} />
15
+ <div class="space-y-1 font-medium dark:text-white">
16
+ <p>
17
+ {comment.user.name}
18
+ <time datetime="2014-08-16 19:00" class="block text-sm text-gray-500 dark:text-gray-400"
19
+ >{comment.user.joined}</time>
20
+ </p>
21
+ </div>
22
+ </div>
23
+ <div class="flex items-center mb-1">
24
+ {#each Array(roundedRating) as _}
25
+ <slot name="ratingUp">
26
+ <Star variation="solid" size="24" class="text-yellow-300 dark:text-yellow-200" />
27
+ </slot>
28
+ {/each}
29
+ {#each Array(grayStars) as _}
30
+ <slot name="ratingDown">
31
+ <Star size="24" class="px-0.5 text-gray-300 dark:text-gray-500" />
32
+ </slot>
33
+ {/each}
34
+ {#if comment.heading}
35
+ <h3 class="ml-2 text-sm font-semibold text-gray-900 dark:text-white">
36
+ {comment.heading}
37
+ </h3>
38
+ {/if}
39
+ </div>
40
+ {#if comment.address || comment.datetime}
41
+ <footer class="mb-5 text-sm text-gray-500 dark:text-gray-400">
42
+ <p>Reviewed in {comment.address} on {comment.datetime}</p>
43
+ </footer>
44
+ {/if}
45
+ <slot />
46
+ <aside>
47
+ <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
48
+ <slot name="evaluation" />
49
+ </p>
50
+ {#if helpfullink || abuselink}
51
+ <div class="flex items-center mt-3 space-x-3 divide-x divide-gray-200 dark:divide-gray-600">
52
+ {#if helpfullink}
53
+ <Button size="xs" href="/" color="dark">Helpful</Button>
54
+ {/if}
55
+ {#if abuselink}
56
+ <a
57
+ href={abuselink}
58
+ class="pl-4 text-sm font-medium text-blue-600 hover:underline dark:text-blue-500"
59
+ >Report abuse</a>
60
+ {/if}
61
+ </div>
62
+ {/if}
63
+ </aside>
64
64
  </article>
package/types.d.ts CHANGED
@@ -93,7 +93,7 @@ export interface ListGroupItemType {
93
93
  [propName: string]: any;
94
94
  }
95
95
  export interface LinkType {
96
- name: number;
96
+ name: string;
97
97
  href?: string;
98
98
  rel?: string;
99
99
  active?: boolean;
@@ -1,6 +1,6 @@
1
1
  export declare let open: boolean;
2
2
  export declare let placement: string;
3
- export declare const init: (node: any, _open: any) => {
4
- update(_open: any): void;
3
+ export declare const init: (node: HTMLElement, _open: boolean) => {
4
+ update(_open: boolean): void;
5
5
  destroy(): void;
6
6
  };
package/utils/backdrop.js CHANGED
@@ -15,7 +15,6 @@ export let placement;
15
15
  export const init = (node, _open) => {
16
16
  getPlacementClasses().map((c) => node.classList.add(c));
17
17
  _open && createBackdrop(node);
18
- console.log('init clicked');
19
18
  return {
20
19
  update(_open) {
21
20
  allPlacementClasses.map((c) => node.classList.remove(c));
@@ -58,7 +57,7 @@ const createBackdrop = (node) => {
58
57
  if (!backdropEl) {
59
58
  backdropEl = document.createElement('div');
60
59
  backdropEl.classList.add(...backdropClasses.split(' '));
61
- const body = document.querySelector('body');
60
+ const body = document.body;
62
61
  body.append(backdropEl);
63
62
  body.style.overflow = 'hidden';
64
63
  document.addEventListener('keydown', handleEscape, true);
@@ -66,7 +65,7 @@ const createBackdrop = (node) => {
66
65
  dispatch('show', node);
67
66
  };
68
67
  const destroyBackdrop = (node) => {
69
- const body = document.querySelector('body');
68
+ const body = document.body;
70
69
  body.style.overflow = 'auto';
71
70
  if (backdropEl)
72
71
  backdropEl.remove();