flowbite-svelte 0.26.8 → 0.26.9

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/buttons/Button.svelte +18 -19
  3. package/drawer/Drawer.svelte +54 -0
  4. package/drawer/Drawer.svelte.d.ts +30 -0
  5. package/index.d.ts +1 -0
  6. package/index.js +2 -0
  7. package/package.json +3 -2
  8. package/typography/A.svelte +3 -2
  9. package/typography/A.svelte.d.ts +2 -1
  10. package/typography/Blockquote.svelte +2 -0
  11. package/typography/Blockquote.svelte.d.ts +1 -0
  12. package/typography/DescriptionList.svelte +2 -1
  13. package/typography/DescriptionList.svelte.d.ts +1 -0
  14. package/typography/Heading.svelte +4 -2
  15. package/typography/Heading.svelte.d.ts +2 -1
  16. package/typography/Hr.svelte +8 -7
  17. package/typography/Hr.svelte.d.ts +1 -0
  18. package/typography/Img.svelte +15 -10
  19. package/typography/Img.svelte.d.ts +1 -0
  20. package/typography/Layout.svelte +2 -1
  21. package/typography/Layout.svelte.d.ts +1 -0
  22. package/typography/Li.svelte +2 -1
  23. package/typography/Li.svelte.d.ts +1 -0
  24. package/typography/List.svelte +2 -1
  25. package/typography/List.svelte.d.ts +1 -0
  26. package/typography/Mark.svelte +4 -3
  27. package/typography/Mark.svelte.d.ts +2 -1
  28. package/typography/P.svelte +2 -1
  29. package/typography/P.svelte.d.ts +1 -0
  30. package/typography/Secondary.svelte +4 -3
  31. package/typography/Secondary.svelte.d.ts +2 -1
  32. package/typography/Span.svelte +2 -1
  33. package/typography/Span.svelte.d.ts +1 -0
  34. package/typography/Ul.svelte +2 -1
  35. package/typography/Ul.svelte.d.ts +1 -0
  36. package/utils/backdrop.d.ts +6 -0
  37. package/utils/backdrop.js +90 -0
  38. package/typography/Underline.svelte +0 -7
  39. package/typography/Underline.svelte.d.ts +0 -19
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.26.9](https://github.com/themesberg/flowbite-svelte/compare/v0.26.8...v0.26.9) (2022-09-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * add id to typograpy components ([64cbe1b](https://github.com/themesberg/flowbite-svelte/commit/64cbe1b6f2cbe43fdf5cb71a0d82e3a5caad1586))
11
+ * add placement to Drawer component ([1b91e52](https://github.com/themesberg/flowbite-svelte/commit/1b91e52618da8935b326a69161d01f0cc7739158))
12
+ * working on drawer ([07a8e02](https://github.com/themesberg/flowbite-svelte/commit/07a8e02ceac450e7e7ceeb2ad9b98bfac7c7c1cf))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * folder names without s and update tests ([4e9c9ce](https://github.com/themesberg/flowbite-svelte/commit/4e9c9ce69e06b1a8e4394c3920c75606894c06d3))
18
+ * no dropdown docs ([4f92d9b](https://github.com/themesberg/flowbite-svelte/commit/4f92d9b56a53677bed7264b6f044e64a10c42c7e))
19
+ * update Htwo using scroll-mt-20 ([2006490](https://github.com/themesberg/flowbite-svelte/commit/200649069a05c6df4ed0e269d3479526092afe01))
20
+
5
21
  ### [0.26.8](https://github.com/themesberg/flowbite-svelte/compare/v0.26.7...v0.26.8) (2022-09-03)
6
22
 
7
23
 
@@ -77,7 +77,7 @@ const hasBorder = () => outline || color === 'alternative' || color === 'light';
77
77
  let buttonClass;
78
78
  $: buttonClass = btnClass
79
79
  ? btnClass
80
- : classNames('group text-center font-medium', group ? 'focus:ring-2' : 'focus:ring-4', group && 'focus:z-10', !group || color === 'alternative' || (outline && color === 'dark') || 'focus:outline-none', outline && gradient
80
+ : classNames('text-center font-medium', group ? 'focus:ring-2' : 'focus:ring-4', group && 'focus:z-10', !group || color === 'alternative' || (outline && color === 'dark') || 'focus:outline-none', outline && gradient
81
81
  ? 'p-0.5'
82
82
  : 'inline-flex items-center justify-center ' + sizeClasses[size], gradient ? gradientClasses[color] : outline ? outlineClasses[color] : colorClasses[color], color === 'alternative' &&
83
83
  (background
@@ -93,24 +93,23 @@ $: gradientOutlineClass = classNames('inline-flex items-center justify-center',
93
93
  </script>
94
94
 
95
95
  <svelte:element
96
- this={href ? 'a' : 'button'}
97
- type={href ? undefined : type}
98
- {href}
99
- {...$$restProps}
100
- class={buttonClass}
101
- on:click
102
- on:change
103
- on:keydown
104
- on:keyup
105
- on:mouseenter
106
- on:mouseleave
107
- >
108
- {#if outline && gradient}
109
- <!-- Trick to prentend outline without using border
96
+ this={href ? 'a' : 'button'}
97
+ type={href ? undefined : type}
98
+ {href}
99
+ {...$$restProps}
100
+ class={buttonClass}
101
+ on:click
102
+ on:change
103
+ on:keydown
104
+ on:keyup
105
+ on:mouseenter
106
+ on:mouseleave>
107
+ {#if outline && gradient}
108
+ <!-- Trick to prentend outline without using border
110
109
  This has a limitation of no supporting transparency as
111
110
  background is set to bg-white dark:bg-gray-900 -->
112
- <span class={gradientOutlineClass}><slot /></span>
113
- {:else}
114
- <slot />
115
- {/if}
111
+ <span class={gradientOutlineClass}><slot /></span>
112
+ {:else}
113
+ <slot />
114
+ {/if}
116
115
  </svelte:element>
@@ -0,0 +1,54 @@
1
+ <script>import classNames from 'classnames';
2
+ import { fly, slide, blur, fade } from 'svelte/transition';
3
+ import { clickOutside } from '../utils/clickOutside';
4
+ export let hidden = true;
5
+ export let position = 'fixed';
6
+ export let width = 'w-80';
7
+ export let backdrop = true;
8
+ export let placement = 'left';
9
+ export let id = 'drawer-example';
10
+ export let divClass = 'overflow-y-auto z-50 p-4 bg-white dark:bg-gray-800';
11
+ export let transitionParams = {};
12
+ export let transitionType = 'fly';
13
+ function multiple(node, params) {
14
+ switch (transitionType) {
15
+ case 'slide':
16
+ return slide(node, params);
17
+ case 'blur':
18
+ return blur(node, params);
19
+ case 'fly':
20
+ return fly(node, params);
21
+ case 'fade':
22
+ return fade(node, params);
23
+ }
24
+ }
25
+ const placements = {
26
+ left: 'inset-y-0 left-0',
27
+ right: 'inset-y-0 right-0',
28
+ top: 'inset-x-0 top-0',
29
+ bottom: 'inset-x-0 bottom-0'
30
+ };
31
+ const handleDrawer = () => {
32
+ hidden = !hidden;
33
+ console.log('clicked');
34
+ };
35
+ </script>
36
+
37
+ {#if !hidden}
38
+ {#if backdrop}
39
+ <div
40
+ class="fixed top-0 left-0 z-50 w-full h-full bg-gray-900/70"
41
+ on:click={() => !hidden && handleDrawer()} />
42
+ {/if}
43
+ <div
44
+ use:clickOutside={() => !hidden && handleDrawer()}
45
+ {id}
46
+ {...$$restProps}
47
+ class={classNames(divClass, width, position, placements[placement], $$props.class)}
48
+ transition:multiple={transitionParams}
49
+ tabindex="-1"
50
+ aria-controls={id}
51
+ aria-labelledby={id}>
52
+ <slot {hidden} />
53
+ </div>
54
+ {/if}
@@ -0,0 +1,30 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { drawerTransitionParamTypes, drawerTransitionTypes } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ hidden?: boolean;
7
+ position?: 'fixed' | 'absolute';
8
+ width?: string;
9
+ backdrop?: boolean;
10
+ placement?: 'left' | 'right' | 'top' | 'bottom';
11
+ id?: string;
12
+ divClass?: string;
13
+ transitionParams?: drawerTransitionParamTypes;
14
+ transitionType?: drawerTransitionTypes;
15
+ };
16
+ events: {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {
20
+ default: {
21
+ hidden: boolean;
22
+ };
23
+ };
24
+ };
25
+ export declare type DrawerProps = typeof __propDef.props;
26
+ export declare type DrawerEvents = typeof __propDef.events;
27
+ export declare type DrawerSlots = typeof __propDef.slots;
28
+ export default class Drawer extends SvelteComponentTyped<DrawerProps, DrawerEvents, DrawerSlots> {
29
+ }
30
+ export {};
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as Carousel } from './carousels/Carousel.svelte';
11
11
  export { default as CarouselTransition } from './carousels/CarouselTransition.svelte';
12
12
  export { default as DarkMode } from './darkmode/DarkMode.svelte';
13
13
  export { default as Datepicker } from './datepicker/Datepicker.svelte';
14
+ export { default as Drawer } from './drawer/Drawer.svelte';
14
15
  export { default as Dropdown } from './dropdowns/Dropdown.svelte';
15
16
  export { default as DropdownDivider } from './dropdowns/DropdownDivider.svelte';
16
17
  export { default as DropdownHeader } from './dropdowns/DropdownHeader.svelte';
package/index.js CHANGED
@@ -22,6 +22,8 @@ export { default as CarouselTransition } from './carousels/CarouselTransition.sv
22
22
  export { default as DarkMode } from './darkmode/DarkMode.svelte';
23
23
  // Datepicker
24
24
  export { default as Datepicker } from './datepicker/Datepicker.svelte';
25
+ // Drawer
26
+ export { default as Drawer } from './drawer/Drawer.svelte';
25
27
  // Dropdown
26
28
  export { default as Dropdown } from './dropdowns/Dropdown.svelte';
27
29
  export { default as DropdownDivider } from './dropdowns/DropdownDivider.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.26.8",
3
+ "version": "0.26.9",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -118,6 +118,7 @@
118
118
  "./darkmode/DarkMode.svelte": "./darkmode/DarkMode.svelte",
119
119
  "./datepicker/Calender.svelte": "./datepicker/Calender.svelte",
120
120
  "./datepicker/Datepicker.svelte": "./datepicker/Datepicker.svelte",
121
+ "./drawer/Drawer.svelte": "./drawer/Drawer.svelte",
121
122
  "./dropdowns/Dropdown.svelte": "./dropdowns/Dropdown.svelte",
122
123
  "./dropdowns/DropdownDivider.svelte": "./dropdowns/DropdownDivider.svelte",
123
124
  "./dropdowns/DropdownHeader.svelte": "./dropdowns/DropdownHeader.svelte",
@@ -232,7 +233,6 @@
232
233
  "./typography/Secondary.svelte": "./typography/Secondary.svelte",
233
234
  "./typography/Span.svelte": "./typography/Span.svelte",
234
235
  "./typography/Ul.svelte": "./typography/Ul.svelte",
235
- "./typography/Underline.svelte": "./typography/Underline.svelte",
236
236
  "./utils/Chevron.svelte": "./utils/Chevron.svelte",
237
237
  "./utils/ChevronDown.svelte": "./utils/ChevronDown.svelte",
238
238
  "./utils/ChevronLeft.svelte": "./utils/ChevronLeft.svelte",
@@ -244,6 +244,7 @@
244
244
  "./utils/Popper.svelte": "./utils/Popper.svelte",
245
245
  "./utils/UserCircle.svelte": "./utils/UserCircle.svelte",
246
246
  "./utils/Wrapper.svelte": "./utils/Wrapper.svelte",
247
+ "./utils/backdrop": "./utils/backdrop.js",
247
248
  "./utils/clickOutside": "./utils/clickOutside.js",
248
249
  "./utils/createEventDispatcher": "./utils/createEventDispatcher.js",
249
250
  "./utils/focusTrap": "./utils/focusTrap.js",
@@ -1,9 +1,10 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let href = '#';
3
- export let textColor = 'text-blue-600 dark:text-blue-500';
4
+ export let color = 'text-blue-600 dark:text-blue-500';
4
5
  export let aClass = 'inline-flex items-center hover:underline';
5
6
  </script>
6
7
 
7
- <a {href} class={classNames(aClass, textColor, $$props.class)}>
8
+ <a {href} {id} class={classNames(aClass, color, $$props.class)}>
8
9
  <slot />
9
10
  </a>
@@ -2,8 +2,9 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  href?: string;
6
- textColor?: string;
7
+ color?: string;
7
8
  aClass?: string;
8
9
  };
9
10
  events: {
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let border = false;
3
4
  export let italic = true;
4
5
  export let borderClass = 'border-l-4 border-gray-300 dark:border-gray-500';
@@ -30,6 +31,7 @@ const sizes = {
30
31
  </script>
31
32
 
32
33
  <blockquote
34
+ {id}
33
35
  class={classNames(
34
36
  baseClass,
35
37
  alignmentClasses[alignment],
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  border?: boolean;
6
7
  italic?: boolean;
7
8
  borderClass?: string;
@@ -1,10 +1,11 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let tag;
3
4
  export let dtClass = 'text-gray-500 md:text-lg dark:text-gray-400';
4
5
  export let ddClass = 'text-lg font-semibold';
5
6
  let classDesc = classNames(tag === 'dt' ? dtClass : ddClass, $$props.class);
6
7
  </script>
7
8
 
8
- <svelte:element this={tag} class={classDesc}>
9
+ <svelte:element this={tag} {id} class={classDesc}>
9
10
  <slot />
10
11
  </svelte:element>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  tag: 'dt' | 'dd';
6
7
  dtClass?: string;
7
8
  ddClass?: string;
@@ -1,7 +1,8 @@
1
1
  <script>import classNames from 'classnames';
2
2
  export let tag = 'h1';
3
- export let textColor = 'text-gray-900 dark:text-white';
3
+ export let color = 'text-gray-900 dark:text-white';
4
4
  export let customSize;
5
+ export let id;
5
6
  const textSizes = {
6
7
  h1: 'text-5xl font-extrabold',
7
8
  h2: 'text-4xl font-bold',
@@ -14,6 +15,7 @@ const textSizes = {
14
15
 
15
16
  <svelte:element
16
17
  this={tag}
17
- class={classNames(customSize ? customSize : textSizes[tag], textColor, 'w-full', $$props.class)}>
18
+ {id}
19
+ class={classNames(customSize ? customSize : textSizes[tag], color, 'w-full', $$props.class)}>
18
20
  <slot />
19
21
  </svelte:element>
@@ -3,8 +3,9 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
6
- textColor?: string;
6
+ color?: string;
7
7
  customSize: string;
8
+ id: string;
8
9
  };
9
10
  events: {
10
11
  [evt: string]: CustomEvent<any>;
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let icon = false;
3
4
  export let width = 'w-full';
4
5
  export let height = 'h-px';
@@ -13,12 +14,12 @@ let middleClass = classNames(middleBgColor, icon ? iconDivClass : textSpanClass)
13
14
  </script>
14
15
 
15
16
  {#if $$slots}
16
- <div class={classDiv}>
17
- <hr class={horizontalClass} />
18
- <div class={middleClass}>
19
- <slot />
20
- </div>
21
- </div>
17
+ <div class={classDiv} {id}>
18
+ <hr class={horizontalClass} />
19
+ <div class={middleClass}>
20
+ <slot />
21
+ </div>
22
+ </div>
22
23
  {:else}
23
- <hr class={horizontalClass} />
24
+ <hr class={horizontalClass} />
24
25
  {/if}
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  icon?: boolean;
6
7
  width?: string;
7
8
  height?: string;
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let caption = undefined;
3
4
  export let src = undefined;
4
5
  export let srcset = undefined;
@@ -12,15 +13,19 @@ export let captionClass = 'mt-2 text-sm text-center text-gray-500 dark:text-gray
12
13
  </script>
13
14
 
14
15
  {#if caption}
15
- <figure class={figClass}>
16
- <img
17
- class={classNames(imgClass, size, alignment, effect, $$props.class)}
18
- {src}
19
- {srcset}
20
- {alt}
21
- />
22
- <figcaption class={captionClass}>{@html caption}</figcaption>
23
- </figure>
16
+ <figure class={figClass}>
17
+ <img
18
+ class={classNames(imgClass, size, alignment, effect, $$props.class)}
19
+ {src}
20
+ {srcset}
21
+ {alt} />
22
+ <figcaption class={captionClass}>{@html caption}</figcaption>
23
+ </figure>
24
24
  {:else}
25
- <img class={classNames(imgClass, size, alignment, effect, $$props.class)} {src} {srcset} {alt} />
25
+ <img
26
+ {id}
27
+ class={classNames(imgClass, size, alignment, effect, $$props.class)}
28
+ {src}
29
+ {srcset}
30
+ {alt} />
26
31
  {/if}
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  caption?: string | undefined;
6
7
  src?: string | undefined;
7
8
  srcset?: string | undefined;
@@ -1,10 +1,11 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let divClass = 'grid';
3
4
  export let cols = 'grid-cols-1 sm:grid-cols-2';
4
5
  export let gap;
5
6
  let classDiv = classNames(divClass, 'gap-' + String(gap), cols);
6
7
  </script>
7
8
 
8
- <div class={classDiv}>
9
+ <div {id} class={classDiv}>
9
10
  <slot />
10
11
  </div>
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ id: string;
4
5
  divClass?: string;
5
6
  cols?: string;
6
7
  gap: number;
@@ -1,9 +1,10 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let icon = false;
3
4
  export let liClass = '';
4
5
  let classLi = classNames(liClass, icon && 'flex items-center', $$props.class);
5
6
  </script>
6
7
 
7
- <li class={classLi}>
8
+ <li {id} class={classLi}>
8
9
  <slot />
9
10
  </li>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  icon?: boolean;
6
7
  liClass?: string;
7
8
  };
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let tag = 'ul';
3
4
  export let list = 'disc';
4
5
  export let position = 'inside';
@@ -18,6 +19,6 @@ let positions = {
18
19
  let classList = classNames(color, tag === 'ul' ? ulClass : 'ol' ? olClass : dlClass, lists[list], positions[position], $$props.class);
19
20
  </script>
20
21
 
21
- <svelte:element this={tag} class={classList}>
22
+ <svelte:element this={tag} {id} class={classList}>
22
23
  <slot />
23
24
  </svelte:element>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  tag?: 'ul' | 'ol' | 'dl';
6
7
  list?: 'disc' | 'none' | 'decimal';
7
8
  position?: 'inside' | 'outside';
@@ -1,9 +1,10 @@
1
1
  <script>import classNames from 'classnames';
2
- export let textColor = 'text-white dark:bg-blue-500';
2
+ export let id;
3
+ export let color = 'text-white dark:bg-blue-500';
3
4
  export let bgColor = 'bg-blue-600';
4
5
  export let markClass = 'px-2 rounded';
5
6
  </script>
6
7
 
7
- <mark class={classNames(markClass, bgColor, textColor, $$props.class)}>
8
- <slot />
8
+ <mark {id} class={classNames(markClass, bgColor, color, $$props.class)}>
9
+ <slot />
9
10
  </mark>
@@ -2,7 +2,8 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
- textColor?: string;
5
+ id: string;
6
+ color?: string;
6
7
  bgColor?: string;
7
8
  markClass?: string;
8
9
  };
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let color = 'text-gray-900 dark:text-white';
3
4
  export let height = 'normal';
4
5
  export let align = 'left';
@@ -72,6 +73,6 @@ let colorAndopacity = color
72
73
  let classP = classNames(size && sizes[size], (opacity && colorAndopacity) || (color && color), height && heights[height], weight && weights[weight], space && spaces[space], align && aligns[align], justify && 'text-justify', italic && 'italic', firstupper && upperClass, whitespace && whitespaces[whitespace], $$props.class);
73
74
  </script>
74
75
 
75
- <p class={classP}>
76
+ <p {id} class={classP}>
76
77
  <slot />
77
78
  </p>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  color?: string;
6
7
  height?: 'normal' | 'relaxed' | 'loose';
7
8
  align?: 'left' | 'center' | 'right';
@@ -1,8 +1,9 @@
1
1
  <script>import classNames from 'classnames';
2
- export let textColor = 'text-gray-500 dark:text-gray-400';
2
+ export let id;
3
+ export let color = 'text-gray-500 dark:text-gray-400';
3
4
  export let secondaryClass = 'font-semibold';
4
5
  </script>
5
6
 
6
- <small class={classNames(textColor, secondaryClass, $$props.class)}>
7
- <slot />
7
+ <small {id} class={classNames(color, secondaryClass, $$props.class)}>
8
+ <slot />
8
9
  </small>
@@ -2,7 +2,8 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
- textColor?: string;
5
+ id: string;
6
+ color?: string;
6
7
  secondaryClass?: string;
7
8
  };
8
9
  events: {
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let italic = false;
3
4
  export let underline = false;
4
5
  export let linethrough = false;
@@ -12,6 +13,6 @@ let underlineClass = classNames('underline', decorationClass);
12
13
  let classSpan = classNames(italic && 'italic', underline && underlineClass, linethrough && 'line-through', uppercase && 'uppercase', gradient ? gradientClass : 'font-semibold text-gray-900 dark:text-white', highlight && highlightClass, $$props.class);
13
14
  </script>
14
15
 
15
- <span class={classSpan}>
16
+ <span {id} class={classSpan}>
16
17
  <slot />
17
18
  </span>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  italic?: boolean;
6
7
  underline?: boolean;
7
8
  linethrough?: boolean;
@@ -1,4 +1,5 @@
1
1
  <script>import classNames from 'classnames';
2
+ export let id;
2
3
  export let list = 'disc';
3
4
  export let position = 'inside';
4
5
  export let ulClass = 'max-w-md text-gray-500 dark:text-gray-400';
@@ -15,6 +16,6 @@ let classUl = classNames(ulClass, lists[list], positions[position], $$props.clas
15
16
  console.log('list', list);
16
17
  </script>
17
18
 
18
- <ul class={classUl} {list}>
19
+ <ul {id} class={classUl} {list}>
19
20
  <slot />
20
21
  </ul>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ id: string;
5
6
  list?: 'disc' | 'none' | 'decimal';
6
7
  position?: 'inside' | 'outside';
7
8
  ulClass?: string;
@@ -0,0 +1,6 @@
1
+ export declare let open: boolean;
2
+ export declare let placement: any;
3
+ export declare const init: (node: any, _open: any) => {
4
+ update(_open: any): void;
5
+ destroy(): void;
6
+ };
@@ -0,0 +1,90 @@
1
+ import { createEventDispatcher } from 'svelte';
2
+ export let open = false;
3
+ const backdropClasses = 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40';
4
+ export let placement;
5
+ // const placement:
6
+ // | 'top-left'
7
+ // | 'top-center'
8
+ // | 'top-right'
9
+ // | 'center-left'
10
+ // | 'center'
11
+ // | 'center-right'
12
+ // | 'bottom-left'
13
+ // | 'bottom-center'
14
+ // | 'bottom-right'='center';
15
+ export const init = (node, _open) => {
16
+ getPlacementClasses().map((c) => node.classList.add(c));
17
+ _open && createBackdrop(node);
18
+ console.log('init clicked');
19
+ return {
20
+ update(_open) {
21
+ allPlacementClasses.map((c) => node.classList.remove(c));
22
+ getPlacementClasses().map((c) => node.classList.add(c));
23
+ _open ? createBackdrop(node) : destroyBackdrop(node);
24
+ },
25
+ destroy() {
26
+ destroyBackdrop(node);
27
+ }
28
+ };
29
+ };
30
+ const getPlacementClasses = () => {
31
+ switch (placement) {
32
+ // top
33
+ case 'top-left':
34
+ return ['justify-start', 'items-start'];
35
+ case 'top-center':
36
+ return ['justify-center', 'items-start'];
37
+ case 'top-right':
38
+ return ['justify-end', 'items-start'];
39
+ // center
40
+ case 'center-left':
41
+ return ['justify-start', 'items-center'];
42
+ case 'center':
43
+ return ['justify-center', 'items-center'];
44
+ case 'center-right':
45
+ return ['justify-end', 'items-center'];
46
+ // bottom
47
+ case 'bottom-left':
48
+ return ['justify-start', 'items-end'];
49
+ case 'bottom-center':
50
+ return ['justify-center', 'items-end'];
51
+ case 'bottom-right':
52
+ return ['justify-end', 'items-end'];
53
+ default:
54
+ return ['justify-center', 'items-center'];
55
+ }
56
+ };
57
+ const createBackdrop = (node) => {
58
+ if (!backdropEl) {
59
+ backdropEl = document.createElement('div');
60
+ backdropEl.classList.add(...backdropClasses.split(' '));
61
+ const body = document.querySelector('body');
62
+ body.append(backdropEl);
63
+ body.style.overflow = 'hidden';
64
+ document.addEventListener('keydown', handleEscape, true);
65
+ }
66
+ dispatch('show', node);
67
+ };
68
+ const destroyBackdrop = (node) => {
69
+ const body = document.querySelector('body');
70
+ body.style.overflow = 'auto';
71
+ if (backdropEl)
72
+ backdropEl.remove();
73
+ backdropEl = undefined;
74
+ document.removeEventListener('keydown', handleEscape, true);
75
+ dispatch('hide', node);
76
+ };
77
+ let backdropEl;
78
+ const handleEscape = (e) => {
79
+ if (open && e.key === 'Escape')
80
+ open = false;
81
+ };
82
+ const dispatch = createEventDispatcher();
83
+ const allPlacementClasses = [
84
+ 'justify-start',
85
+ 'justify-center',
86
+ 'justify-end',
87
+ 'items-start',
88
+ 'items-center',
89
+ 'items-end'
90
+ ];
@@ -1,7 +0,0 @@
1
- <script>import classNames from 'classnames';
2
- export let underlineClass = 'underline decoration-8 decoration-blue-400 dark:decoration-blue-600';
3
- </script>
4
-
5
- <span class={classNames(underlineClass, $$props.class)}>
6
- <slot />
7
- </span>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- underlineClass?: string;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export declare type UnderlineProps = typeof __propDef.props;
15
- export declare type UnderlineEvents = typeof __propDef.events;
16
- export declare type UnderlineSlots = typeof __propDef.slots;
17
- export default class Underline extends SvelteComponentTyped<UnderlineProps, UnderlineEvents, UnderlineSlots> {
18
- }
19
- export {};