flowbite-svelte 0.13.8 → 0.14.1

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,43 @@
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.14.1](https://github.com/shinokada/flowbite-svelte/compare/v0.13.10...v0.14.1) (2022-04-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * add ImgDropdown ([30e9d01](https://github.com/shinokada/flowbite-svelte/commit/30e9d01dcd51559f6771ebaeef57100cf198c452))
11
+
12
+ ### [0.13.10](https://github.com/shinokada/flowbite-svelte/compare/v0.13.9...v0.13.10) (2022-04-16)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add a space in front of from /index ([32beb0e](https://github.com/shinokada/flowbite-svelte/commit/32beb0e9d3fd7c9c92e34ccc8d690a9f8361c780))
18
+ * add Breadcrumb to md files ([6ea1d24](https://github.com/shinokada/flowbite-svelte/commit/6ea1d246ef2ed47f87ec764634fad6729700d286))
19
+ * add btnLabel=Read more ([0730167](https://github.com/shinokada/flowbite-svelte/commit/073016733d50fddc70e78e38520eabf0a912236c))
20
+ * update h1 for breadcrumb ([8bfef6a](https://github.com/shinokada/flowbite-svelte/commit/8bfef6a93f69dbbf4fb667ba0d177059181b6cdb))
21
+ * update h1 in index pages ([e4d1a52](https://github.com/shinokada/flowbite-svelte/commit/e4d1a5284c5ce5f1d981e377263f97c2a2d00485))
22
+ * update layouts for breadcrumb ([1c07955](https://github.com/shinokada/flowbite-svelte/commit/1c07955215fe7a48e3e5573c5c657d59978b5fe4))
23
+
24
+ ### [0.13.9](https://github.com/shinokada/flowbite-svelte/compare/v0.13.8...v0.13.9) (2022-04-16)
25
+
26
+
27
+ ### Features
28
+
29
+ * add focus on load to Input component ([5d0c7fb](https://github.com/shinokada/flowbite-svelte/commit/5d0c7fb7750aac2dc0df2ddd24a7c11cd66404c6))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * add 100% to pre tag ([3c8eaf2](https://github.com/shinokada/flowbite-svelte/commit/3c8eaf257697c48121cc79496885e05309b302bc))
35
+ * Input padding uses p-4, p-2.5 and p-2 depends on the size ([632bd5d](https://github.com/shinokada/flowbite-svelte/commit/632bd5d550b0268a93eec91598b35a854a45c081))
36
+ * logo ([c28e9f3](https://github.com/shinokada/flowbite-svelte/commit/c28e9f3683140e1bb12f4667e26e5d7805d4ddb9))
37
+ * moved p-tag and h3 tag css to app.css ([cb3d08e](https://github.com/shinokada/flowbite-svelte/commit/cb3d08edb98d96cadad9975e20488af55f4fa344))
38
+ * refresh dev environment ([3a1b452](https://github.com/shinokada/flowbite-svelte/commit/3a1b452f925e14b2d159456c8f1f50b2972ae52b))
39
+ * update carousel page ([27c621b](https://github.com/shinokada/flowbite-svelte/commit/27c621b5f7a97896635ddbc2aa9cccf624275e80))
40
+ * update main nav. add transition to carousel ([3a9f572](https://github.com/shinokada/flowbite-svelte/commit/3a9f5723af8f54ef58c6902af5599114cc81fb86))
41
+
5
42
  ### [0.13.8](https://github.com/shinokada/flowbite-svelte/compare/v0.13.7...v0.13.8) (2022-04-14)
6
43
 
7
44
 
package/README.md CHANGED
@@ -31,6 +31,10 @@
31
31
  - [Icon badge](https://flowbite-svelte.vercel.app/badges/badge-icon)
32
32
  - [Link badge](https://flowbite-svelte.vercel.app/badges/badge-link)
33
33
 
34
+ ## Breadcrumb components
35
+
36
+ - [Breadcrumb](https://flowbite-svelte.vercel.app/breadcrumbs)
37
+
34
38
  ## Button group compnents
35
39
 
36
40
  - [Default button group](https://flowbite-svelte.vercel.app/button-groups/default)
@@ -57,13 +61,18 @@
57
61
  - [List Card](https://flowbite-svelte.vercel.app/cards/list)
58
62
  - [Signin Card](https://flowbite-svelte.vercel.app/cards/signin)
59
63
 
64
+ ## Carousel components
65
+
66
+ - [Carousel](https://flowbite-svelte.vercel.app/carousels)
67
+
60
68
  ## Dark mode components
61
69
 
62
70
  - [Dark mode](https://flowbite-svelte.vercel.app/darkmode)
63
71
 
64
72
  ## Dropdown components
65
73
 
66
- - [Dropdowns](https://flowbite-svelte.vercel.app/dropdowns)
74
+ - [Dropdown](https://flowbite-svelte.vercel.app/dropdowns/default)
75
+ - [Dropdown with Image](https://flowbite-svelte.vercel.app/dropdowns/image)
67
76
 
68
77
  ## Form components
69
78
 
@@ -150,4 +159,13 @@ Run:
150
159
 
151
160
  ```sh
152
161
  npm run test
153
- ```
162
+ ```
163
+
164
+ ## Create props
165
+
166
+ ```sh
167
+ cd scripts
168
+ node createProps.js
169
+ ```
170
+
171
+ This will pull all props from components and replace files in `/src/routes/props` directory.
@@ -0,0 +1,49 @@
1
+ <script >export let crumbs = [];
2
+ export let homeClass = 'inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white';
3
+ export let crumbClass = 'ml-1 text-sm font-medium text-gray-700 hover:text-gray-900 md:ml-2 dark:text-gray-400 dark:hover:text-white';
4
+ export let solid = false;
5
+ let navClass = 'flex';
6
+ if (solid) {
7
+ navClass =
8
+ 'flex py-3 px-5 text-gray-700 bg-gray-50 rounded-lg border border-gray-200 dark:bg-gray-800 dark:border-gray-700';
9
+ }
10
+ </script>
11
+
12
+ <nav class={navClass} aria-label="Breadcrumb">
13
+ <ol class="inline-flex items-center space-x-1 md:space-x-3">
14
+ {#each crumbs as crumb}
15
+ {#if crumb.href === '/'}
16
+ <li class="inline-flex items-center">
17
+ <a href={crumb.href} class={homeClass}>
18
+ <svg
19
+ class="mr-2 w-4 h-4"
20
+ fill="currentColor"
21
+ viewBox="0 0 20 20"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ ><path
24
+ d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"
25
+ /></svg
26
+ >
27
+ {crumb.label}</a
28
+ >
29
+ </li>
30
+ {:else}
31
+ <li>
32
+ <div class="flex items-center">
33
+ <svg
34
+ class="w-6 h-6 text-gray-400"
35
+ fill="currentColor"
36
+ viewBox="0 0 20 20"
37
+ xmlns="http://www.w3.org/2000/svg"
38
+ ><path
39
+ fill-rule="evenodd"
40
+ d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
41
+ clip-rule="evenodd"
42
+ /></svg
43
+ ><a href={crumb.href} class={crumbClass}>{crumb.label}</a>
44
+ </div>
45
+ </li>
46
+ {/if}
47
+ {/each}
48
+ </ol>
49
+ </nav>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { CrumbType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ crumbs?: CrumbType[];
6
+ homeClass?: string;
7
+ crumbClass?: string;
8
+ solid?: boolean;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export declare type BreadcrumbProps = typeof __propDef.props;
16
+ export declare type BreadcrumbEvents = typeof __propDef.events;
17
+ export declare type BreadcrumbSlots = typeof __propDef.slots;
18
+ export default class Breadcrumb extends SvelteComponentTyped<BreadcrumbProps, BreadcrumbEvents, BreadcrumbSlots> {
19
+ }
20
+ export {};
package/cards/Card.svelte CHANGED
@@ -2,40 +2,48 @@
2
2
  export let rel = '';
3
3
  export let alt = '';
4
4
  export let img = '';
5
- export let btnLabel = 'Read more';
5
+ export let btnLabel = '';
6
6
  export let btnColor = 'blue';
7
7
  export let textdivClass = 'p-5';
8
- export let paragraphClass = 'mb-3 font-normal text-gray-700 dark:text-gray-400';
9
8
  export let headerClass = 'mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white';
10
- export let header = 'Lorem ipsum';
9
+ export let header = '';
11
10
  export let divClass = 'max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700';
12
11
  let buttonClass;
13
12
  if (btnColor === 'blue') {
14
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
13
+ buttonClass =
14
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
15
15
  }
16
16
  else if (btnColor === 'gray') {
17
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-gray-700 rounded-lg hover:bg-gray-800 focus:ring-4 focus:ring-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800';
17
+ buttonClass =
18
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-gray-700 rounded-lg hover:bg-gray-800 focus:ring-4 focus:ring-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800';
18
19
  }
19
20
  else if (btnColor === 'red') {
20
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-red-700 rounded-lg hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800';
21
+ buttonClass =
22
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-red-700 rounded-lg hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800';
21
23
  }
22
24
  else if (btnColor === 'yellow') {
23
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-yellow-700 rounded-lg hover:bg-yellow-800 focus:ring-4 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
25
+ buttonClass =
26
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-yellow-700 rounded-lg hover:bg-yellow-800 focus:ring-4 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
24
27
  }
25
28
  else if (btnColor === 'green') {
26
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-green-700 rounded-lg hover:bg-green-800 focus:ring-4 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
29
+ buttonClass =
30
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-green-700 rounded-lg hover:bg-green-800 focus:ring-4 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
27
31
  }
28
32
  else if (btnColor === 'indigo') {
29
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-indigo-700 rounded-lg hover:bg-indigo-800 focus:ring-4 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
33
+ buttonClass =
34
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-indigo-700 rounded-lg hover:bg-indigo-800 focus:ring-4 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
30
35
  }
31
36
  else if (btnColor === 'purple') {
32
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-purple-700 rounded-lg hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
37
+ buttonClass =
38
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-purple-700 rounded-lg hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
33
39
  }
34
40
  else if (btnColor === 'pink') {
35
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-pink-700 rounded-lg hover:bg-pink-800 focus:ring-4 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
41
+ buttonClass =
42
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-pink-700 rounded-lg hover:bg-pink-800 focus:ring-4 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
36
43
  }
37
44
  else {
38
- buttonClass = 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
45
+ buttonClass =
46
+ 'inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
39
47
  }
40
48
  </script>
41
49
 
@@ -50,26 +58,36 @@ else {
50
58
  {/if}
51
59
  {/if}
52
60
  <div class={textdivClass}>
53
- {#if link}
54
- <a href={link} {rel}>
61
+ {#if header}
62
+ {#if link}
63
+ <a href={link} {rel}>
64
+ <h3 class={headerClass}>
65
+ {header}
66
+ </h3>
67
+ </a>
68
+ {:else}
55
69
  <h3 class={headerClass}>
56
70
  {header}
57
71
  </h3>
58
- </a>
59
- {:else}
60
- <h3 class={headerClass}>
61
- {header}
62
- </h3>
72
+ {/if}
63
73
  {/if}
64
74
  {#if $$slots.paragraph}
65
- <p class={paragraphClass}>
66
- <slot name="paragraph" />
67
- </p>
75
+ <slot name="paragraph" />
68
76
  {/if}
69
- {#if link}
77
+ {#if link && btnLabel}
70
78
  <a href={link} {rel} class={buttonClass}>
71
79
  {btnLabel}
72
- <svg class="ml-2 -mr-1 w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
80
+ <svg
81
+ class="ml-2 -mr-1 w-4 h-4"
82
+ fill="currentColor"
83
+ viewBox="0 0 20 20"
84
+ xmlns="http://www.w3.org/2000/svg"
85
+ ><path
86
+ fill-rule="evenodd"
87
+ d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z"
88
+ clip-rule="evenodd"
89
+ /></svg
90
+ >
73
91
  </a>
74
92
  {/if}
75
93
  </div>
@@ -9,7 +9,6 @@ declare const __propDef: {
9
9
  btnLabel?: string;
10
10
  btnColor?: Colors;
11
11
  textdivClass?: string;
12
- paragraphClass?: string;
13
12
  headerClass?: string;
14
13
  header?: string;
15
14
  divClass?: string;
@@ -1,6 +1,7 @@
1
1
  <script >export let caption = '';
2
+ export let captionClass = '';
2
3
  </script>
3
4
 
4
- <div class="h-10 bg-gray-300 dark:bg-gray-700 dark:text-white p-2 my-2 text-center">
5
+ <div class={captionClass}>
5
6
  <p id="caption" class="text-gray-900 dark:text-white">{caption}</p>
6
7
  </div>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  caption?: string;
5
+ captionClass?: string;
5
6
  };
6
7
  events: {
7
8
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,4 @@
1
- <script >// import { images } from './imageData.js';
2
- import Slide from './Slide.svelte';
1
+ <script >import Slide from './Slide.svelte';
3
2
  import Thumbnail from './Thumbnail.svelte';
4
3
  import Caption from './Caption.svelte';
5
4
  import Indicator from './Indicator.svelte';
@@ -8,8 +7,17 @@ export let showCaptions = true;
8
7
  export let showThumbs = true;
9
8
  export let images;
10
9
  export let slideControls = true;
10
+ // Carousel
11
+ export let divClass = 'overflow-hidden relative h-56 rounded-lg sm:h-64 xl:h-80 2xl:h-96';
12
+ export let indicatorDivClass = 'flex absolute bottom-5 left-1/2 z-30 space-x-3 -translate-x-1/2';
13
+ // Caption
14
+ export let captionClass = 'h-10 bg-gray-300 dark:bg-gray-700 dark:text-white p-2 my-2 text-center';
15
+ // Indicator
16
+ export let indicatorClass = 'w-3 h-3 rounded-full bg-gray-100 hover:bg-gray-300 opacity-60';
17
+ // Slide
18
+ export let slideClass = '';
11
19
  let imageShowingIndex = 0;
12
- $: console.log(imageShowingIndex);
20
+ // $: console.log(imageShowingIndex);
13
21
  $: image = images[imageShowingIndex];
14
22
  const nextSlide = () => {
15
23
  if (imageShowingIndex === images.length - 1) {
@@ -32,42 +40,93 @@ let thumbWidth = 100 / images.length;
32
40
  </script>
33
41
 
34
42
  <div id="default-carousel" class="relative">
35
- <div class="overflow-hidden relative h-56 rounded-lg sm:h-64 xl:h-80 2xl:h-96">
36
- <Slide image={image.imgurl} altTag={image.name} attr={image.attribution} />
37
- </div>
38
- {#if showIndicators}
39
- <!-- Slider indicators -->
40
- <div class="flex absolute bottom-5 left-1/2 z-30 space-x-3 -translate-x-1/2">
41
- {#each images as { id, imgurl, name, attribution }}
42
- <Indicator {name} selected={imageShowingIndex === id} on:click={() => goToSlide(id)} />
43
- {/each}
44
- </div>
45
- {/if}
46
- {#if slideControls}
47
- <!-- Slider controls -->
48
- <button on:click={prevSlide} type="button" class="flex absolute top-0 left-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none" data-carousel-prev>
49
- <span class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
50
- <svg class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" /></svg>
51
- <span class="hidden">Previous</span>
52
- </span>
53
- </button>
54
- <button on:click={nextSlide} type="button" class="flex absolute top-0 right-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none" data-carousel-next>
55
- <span class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
56
- <svg class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" /></svg>
57
- <span class="hidden">Next</span>
58
- </span>
59
- </button>
60
- {/if}
43
+ <div class={divClass}>
44
+ <Slide image={image.imgurl} altTag={image.name} attr={image.attribution} {slideClass} />
45
+ </div>
46
+ {#if showIndicators}
47
+ <!-- Slider indicators -->
48
+ <div class={indicatorDivClass}>
49
+ {#each images as { id, imgurl, name, attribution }}
50
+ <Indicator
51
+ {name}
52
+ selected={imageShowingIndex === id}
53
+ on:click={() => goToSlide(id)}
54
+ {indicatorClass}
55
+ />
56
+ {/each}
57
+ </div>
58
+ {/if}
59
+ {#if slideControls}
60
+ <!-- Slider controls -->
61
+ <button
62
+ on:click={prevSlide}
63
+ type="button"
64
+ class="flex absolute top-0 left-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none"
65
+ data-carousel-prev
66
+ >
67
+ <span
68
+ class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"
69
+ >
70
+ <svg
71
+ class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300"
72
+ fill="none"
73
+ stroke="currentColor"
74
+ viewBox="0 0 24 24"
75
+ xmlns="http://www.w3.org/2000/svg"
76
+ ><path
77
+ stroke-linecap="round"
78
+ stroke-linejoin="round"
79
+ stroke-width="2"
80
+ d="M15 19l-7-7 7-7"
81
+ /></svg
82
+ >
83
+ <span class="hidden">Previous</span>
84
+ </span>
85
+ </button>
86
+ <button
87
+ on:click={nextSlide}
88
+ type="button"
89
+ class="flex absolute top-0 right-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none"
90
+ data-carousel-next
91
+ >
92
+ <span
93
+ class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"
94
+ >
95
+ <svg
96
+ class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300"
97
+ fill="none"
98
+ stroke="currentColor"
99
+ viewBox="0 0 24 24"
100
+ xmlns="http://www.w3.org/2000/svg"
101
+ ><path
102
+ stroke-linecap="round"
103
+ stroke-linejoin="round"
104
+ stroke-width="2"
105
+ d="M9 5l7 7-7 7"
106
+ /></svg
107
+ >
108
+ <span class="hidden">Next</span>
109
+ </span>
110
+ </button>
111
+ {/if}
61
112
  </div>
62
113
 
63
114
  {#if showCaptions}
64
- <Caption caption={images[imageShowingIndex].name} />
115
+ <Caption caption={images[imageShowingIndex].name} {captionClass} />
65
116
  {/if}
66
117
 
67
118
  {#if showThumbs}
68
- <div class="flex flex-row justify-center bg-gray-100">
69
- {#each images as { id, imgurl, name, attribution }}
70
- <Thumbnail {thumbWidth} thumbImg={imgurl} altTag={name} titleLink={attribution} {id} selected={imageShowingIndex === id} on:click={() => goToSlide(id)} />
71
- {/each}
72
- </div>
119
+ <div class="flex flex-row justify-center bg-gray-100">
120
+ {#each images as { id, imgurl, name, attribution }}
121
+ <Thumbnail
122
+ {thumbWidth}
123
+ thumbImg={imgurl}
124
+ altTag={name}
125
+ titleLink={attribution}
126
+ {id}
127
+ selected={imageShowingIndex === id}
128
+ on:click={() => goToSlide(id)}
129
+ />
130
+ {/each}
131
+ </div>
73
132
  {/if}
@@ -6,6 +6,11 @@ declare const __propDef: {
6
6
  showThumbs?: boolean;
7
7
  images: any[];
8
8
  slideControls?: boolean;
9
+ divClass?: string;
10
+ indicatorDivClass?: string;
11
+ captionClass?: string;
12
+ indicatorClass?: string;
13
+ slideClass?: string;
9
14
  };
10
15
  events: {
11
16
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1,155 @@
1
+ <script >import { fade, blur, fly, slide } from 'svelte/transition';
2
+ import Slide from './Slide.svelte';
3
+ import Thumbnail from './Thumbnail.svelte';
4
+ import Caption from './Caption.svelte';
5
+ import Indicator from './Indicator.svelte';
6
+ export let showIndicators = true;
7
+ export let showCaptions = true;
8
+ export let showThumbs = true;
9
+ export let images;
10
+ export let slideControls = true;
11
+ export let transitionType;
12
+ export let transitionParams = {};
13
+ // have a custom transition function that returns the desired transition
14
+ function multiple(node, params) {
15
+ switch (transitionType) {
16
+ case 'slide':
17
+ return slide(node, params);
18
+ case 'blur':
19
+ return blur(node, params);
20
+ case 'fly':
21
+ return fly(node, params);
22
+ case 'fade':
23
+ return fade(node, params);
24
+ }
25
+ }
26
+ // Carousel
27
+ export let divClass = 'overflow-hidden relative h-56 rounded-lg sm:h-64 xl:h-80 2xl:h-96';
28
+ export let indicatorDivClass = 'flex absolute bottom-5 left-1/2 z-30 space-x-3 -translate-x-1/2';
29
+ // Caption
30
+ export let captionClass = 'h-10 bg-gray-300 dark:bg-gray-700 dark:text-white p-2 my-2 text-center';
31
+ // Indicator
32
+ export let indicatorClass = 'w-3 h-3 rounded-full bg-gray-100 hover:bg-gray-300 opacity-60';
33
+ // Slide
34
+ // export let slideClass: string = 'hidden';
35
+ let imageShowingIndex = 1;
36
+ // $: console.log(imageShowingIndex);
37
+ // $: image = images[imageShowingIndex];
38
+ const nextSlide = () => {
39
+ if (imageShowingIndex === images.length - 1) {
40
+ imageShowingIndex = 0;
41
+ }
42
+ else {
43
+ imageShowingIndex += 1;
44
+ }
45
+ };
46
+ const prevSlide = () => {
47
+ if (imageShowingIndex === 0) {
48
+ imageShowingIndex = images.length - 1;
49
+ }
50
+ else {
51
+ imageShowingIndex -= 1;
52
+ }
53
+ };
54
+ const goToSlide = (number) => (imageShowingIndex = number);
55
+ let thumbWidth = 100 / images.length;
56
+ </script>
57
+
58
+ <div id="default-carousel" class="relative">
59
+ <div class={divClass}>
60
+ {#each images as { id, imgurl, name, attribution }}
61
+ {#if imageShowingIndex === id}
62
+ <div transition:multiple={transitionParams}>
63
+ <Slide image={imgurl} altTag={name} attr={attribution} />
64
+ </div>
65
+ {/if}
66
+ {/each}
67
+ </div>
68
+
69
+ {#if showIndicators}
70
+ <!-- Slider indicators -->
71
+ <div class={indicatorDivClass}>
72
+ {#each images as { id, imgurl, name, attribution }}
73
+ <Indicator
74
+ {name}
75
+ selected={imageShowingIndex === id}
76
+ on:click={() => goToSlide(id)}
77
+ {indicatorClass}
78
+ />
79
+ {/each}
80
+ </div>
81
+ {/if}
82
+ {#if slideControls}
83
+ <!-- Slider controls -->
84
+ <button
85
+ on:click={prevSlide}
86
+ type="button"
87
+ class="flex absolute top-0 left-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none"
88
+ data-carousel-prev
89
+ >
90
+ <span
91
+ class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"
92
+ >
93
+ <svg
94
+ class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300"
95
+ fill="none"
96
+ stroke="currentColor"
97
+ viewBox="0 0 24 24"
98
+ xmlns="http://www.w3.org/2000/svg"
99
+ ><path
100
+ stroke-linecap="round"
101
+ stroke-linejoin="round"
102
+ stroke-width="2"
103
+ d="M15 19l-7-7 7-7"
104
+ /></svg
105
+ >
106
+ <span class="hidden">Previous</span>
107
+ </span>
108
+ </button>
109
+ <button
110
+ on:click={nextSlide}
111
+ type="button"
112
+ class="flex absolute top-0 right-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none"
113
+ data-carousel-next
114
+ >
115
+ <span
116
+ class="inline-flex justify-center items-center w-8 h-8 rounded-full sm:w-10 sm:h-10 bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"
117
+ >
118
+ <svg
119
+ class="w-5 h-5 text-white sm:w-6 sm:h-6 dark:text-gray-300"
120
+ fill="none"
121
+ stroke="currentColor"
122
+ viewBox="0 0 24 24"
123
+ xmlns="http://www.w3.org/2000/svg"
124
+ ><path
125
+ stroke-linecap="round"
126
+ stroke-linejoin="round"
127
+ stroke-width="2"
128
+ d="M9 5l7 7-7 7"
129
+ /></svg
130
+ >
131
+ <span class="hidden">Next</span>
132
+ </span>
133
+ </button>
134
+ {/if}
135
+ </div>
136
+
137
+ {#if showCaptions}
138
+ <Caption caption={images[imageShowingIndex].name} {captionClass} />
139
+ {/if}
140
+
141
+ {#if showThumbs}
142
+ <div class="flex flex-row justify-center bg-gray-100">
143
+ {#each images as { id, imgurl, name, attribution }}
144
+ <Thumbnail
145
+ {thumbWidth}
146
+ thumbImg={imgurl}
147
+ altTag={name}
148
+ titleLink={attribution}
149
+ {id}
150
+ selected={imageShowingIndex === id}
151
+ on:click={() => goToSlide(id)}
152
+ />
153
+ {/each}
154
+ </div>
155
+ {/if}
@@ -0,0 +1,27 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { TransitionTypes, TransitionParamTypes } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ showIndicators?: boolean;
6
+ showCaptions?: boolean;
7
+ showThumbs?: boolean;
8
+ images: any[];
9
+ slideControls?: boolean;
10
+ transitionType: TransitionTypes;
11
+ transitionParams?: TransitionParamTypes;
12
+ divClass?: string;
13
+ indicatorDivClass?: string;
14
+ captionClass?: string;
15
+ indicatorClass?: string;
16
+ };
17
+ events: {
18
+ [evt: string]: CustomEvent<any>;
19
+ };
20
+ slots: {};
21
+ };
22
+ export declare type CarouselTransitionProps = typeof __propDef.props;
23
+ export declare type CarouselTransitionEvents = typeof __propDef.events;
24
+ export declare type CarouselTransitionSlots = typeof __propDef.slots;
25
+ export default class CarouselTransition extends SvelteComponentTyped<CarouselTransitionProps, CarouselTransitionEvents, CarouselTransitionSlots> {
26
+ }
27
+ export {};
@@ -1,8 +1,9 @@
1
1
  <script >export let name = '';
2
2
  export let selected = false;
3
+ export let indicatorClass = '';
3
4
  </script>
4
5
 
5
- <button type="button" class="w-3 h-3 rounded-full bg-gray-100 hover:bg-gray-300 opacity-60" class:active={selected} aria-label={name} on:click />
6
+ <button type="button" class={indicatorClass} class:active={selected} aria-label={name} on:click />
6
7
 
7
8
  <style>
8
9
  .active {