flowbite-svelte 0.22.8 → 0.22.11

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,34 @@
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.22.11](https://github.com/themesberg/flowbite-svelte/compare/v0.22.10...v0.22.11) (2022-07-23)
6
+
7
+
8
+ ### Features
9
+
10
+ * list group rewritten - API changed ([86c97dc](https://github.com/themesberg/flowbite-svelte/commit/86c97dc54581f634baed601c609e9d90c6c4611b))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * background context added ([52c8dd5](https://github.com/themesberg/flowbite-svelte/commit/52c8dd5693f3d890e7b875ae1b0435c5a7313876))
16
+ * error fix for deployment ([be684a8](https://github.com/themesberg/flowbite-svelte/commit/be684a8057c08a7c07f3f6c370114d008dc2182e))
17
+ * field name change for ListGroupItemType ([da93d46](https://github.com/themesberg/flowbite-svelte/commit/da93d460c864e0a94f803420f73dbf976e185fee))
18
+
19
+ ### [0.22.10](https://github.com/themesberg/flowbite-svelte/compare/v0.22.9...v0.22.10) (2022-07-23)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * merge conflict fix with Hetarth02-main ([914c1f9](https://github.com/themesberg/flowbite-svelte/commit/914c1f95f80dfbd73542d68d39622d79bed1ea04))
25
+
26
+ ### [0.22.9](https://github.com/themesberg/flowbite-svelte/compare/v0.22.8...v0.22.9) (2022-07-23)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * using classnames dynamic class name for Footer ([52e17c7](https://github.com/themesberg/flowbite-svelte/commit/52e17c7dd8ad2599d1f41bc938930db615459b63))
32
+
5
33
  ### [0.22.8](https://github.com/themesberg/flowbite-svelte/compare/v0.22.7...v0.22.8) (2022-07-23)
6
34
 
7
35
 
@@ -1,6 +1,7 @@
1
1
  <script>import classNames from 'classnames';
2
2
  export let customClass = '';
3
3
  export let footerType = 'default';
4
+ // using classNames dynamic class names, https://github.com/JedWatson/classnames#dynamic-class-names-with-es2015
4
5
  </script>
5
6
 
6
7
  <footer
@@ -11,7 +12,7 @@ export let footerType = 'default';
11
12
  'p-4 bg-white rounded-lg shadow md:px-6 md:py-8 dark:bg-gray-800': footerType === 'logo',
12
13
  'p-4 bg-white rounded-lg shadow md:flex md:items-center md:justify-between md:p-6 dark:bg-gray-800':
13
14
  footerType === 'default',
14
- customClass: footerType === 'custom'
15
+ [`${customClass}`]: footerType === 'custom'
15
16
  },
16
17
  $$props.class
17
18
  )}
package/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export { default as ArrowKeyLeft } from './kbd/ArrowKeyLeft.svelte';
51
51
  export { default as ArrowKeyRight } from './kbd/ArrowKeyRight.svelte';
52
52
  export { default as ArrowKeyUp } from './kbd/ArrowKeyUp.svelte';
53
53
  export { default as List } from './list-group/List.svelte';
54
+ export { default as ListItem } from './list-group/ListItem.svelte';
54
55
  export { modalIdStore } from './modals/modalStores.js';
55
56
  export { default as ExtraLargeModal } from './modals/ExtraLargeModal.svelte';
56
57
  export { default as LargeModal } from './modals/LargeModal.svelte';
package/index.js CHANGED
@@ -66,6 +66,7 @@ export { default as ArrowKeyRight } from './kbd/ArrowKeyRight.svelte';
66
66
  export { default as ArrowKeyUp } from './kbd/ArrowKeyUp.svelte';
67
67
  // List
68
68
  export { default as List } from './list-group/List.svelte';
69
+ export { default as ListItem } from './list-group/ListItem.svelte';
69
70
  // Modals
70
71
  export { modalIdStore } from './modals/modalStores.js';
71
72
  export { default as ExtraLargeModal } from './modals/ExtraLargeModal.svelte';
@@ -1,45 +1,18 @@
1
- <script>export let lists;
2
- const common = 'inline-flex relative items-center py-2 px-4 w-full text-sm font-medium hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:border-gray-600 dark:hover:bg-gray-600 dark:hover:text-white dark:focus:ring-gray-500 dark:focus:text-white';
3
- const topClass = `${common} rounded-t-lg border-b border-gray-200`;
4
- const bottomClass = `${common} rounded-b-lg`;
5
- const middleClass = `${common} border-b border-gray-200`;
1
+ <script>import { setContext } from 'svelte';
2
+ import classNames from 'classnames';
3
+ import ListItem from './ListItem.svelte';
4
+ export let items = [];
5
+ export let active = false;
6
+ setContext('background', true);
7
+ $: setContext('active', active);
8
+ let groupClass;
9
+ $: groupClass = classNames('rounded-lg border border-gray-200 dark:border-gray-600', 'divide-y divide-gray-200 dark:divide-gray-600', $$props.class);
6
10
  </script>
7
11
 
8
- <div class="w-48 text-gray-900 bg-white rounded-lg border border-gray-200 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
9
- {#each lists as { name, icon, href, rel, iconClass, iconSize }, i}
10
- {#if i === 0}
11
- <button type="button" class={topClass}>
12
- {#if icon}
13
- <svelte:component this={icon} class="mr-2 {iconClass}" size={iconSize} />
14
- {/if}
15
- {#if href}
16
- <a {href} {rel}>{name}</a>
17
- {:else}
18
- {name} here
19
- {/if}
20
- </button>
21
- {:else if i === lists.length - 1}
22
- <button type="button" class={bottomClass}>
23
- {#if icon}
24
- <svelte:component this={icon} class="mr-2 {iconClass}" size={iconSize} />
25
- {/if}
26
- {#if href}
27
- <a {href} {rel}>{name}</a>
28
- {:else}
29
- {name}
30
- {/if}
31
- </button>
32
- {:else}
33
- <button type="button" class={middleClass}>
34
- {#if icon}
35
- <svelte:component this={icon} class="mr-2 {iconClass}" size={iconSize} />
36
- {/if}
37
- {#if href}
38
- <a {href} {rel}>{name}</a>
39
- {:else}
40
- {name}
41
- {/if}
42
- </button>
43
- {/if}
12
+ <svelte:element this={active ? 'div' : 'ul'} class={groupClass}>
13
+ {#each items as item, index}
14
+ <ListItem {active} {...item} {index} on:click><slot {item} {index} /></ListItem>
15
+ {:else}
16
+ <slot />
44
17
  {/each}
45
- </div>
18
+ </svelte:element>
@@ -1,13 +1,19 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ButtonGroupType } from '../types';
2
+ import type { ListGroupItemType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
- lists: ButtonGroupType[];
5
+ [x: string]: any;
6
+ items?: ListGroupItemType[];
7
+ active?: boolean;
6
8
  };
7
9
  events: {
10
+ click: CustomEvent<any>;
11
+ } & {
8
12
  [evt: string]: CustomEvent<any>;
9
13
  };
10
- slots: {};
14
+ slots: {
15
+ default: {};
16
+ };
11
17
  };
12
18
  export declare type ListProps = typeof __propDef.props;
13
19
  export declare type ListEvents = typeof __propDef.events;
@@ -0,0 +1,44 @@
1
+ <script>import { getContext } from 'svelte';
2
+ import classNames from 'classnames';
3
+ import { createEventDispatcher } from 'svelte';
4
+ export let active = getContext('active');
5
+ export let current = false;
6
+ export let disabled = false;
7
+ export let href = '';
8
+ let dispatch = createEventDispatcher();
9
+ const states = {
10
+ current: 'text-white bg-blue-700 dark:text-white dark:bg-gray-800',
11
+ normal: 'text-gray-900 bg-white dark:text-gray-200 dark:bg-gray-700',
12
+ disabled: 'text-gray-900 bg-gray-100 dark:bg-gray-600 dark:text-gray-400'
13
+ };
14
+ let focusClass = 'focus:z-40 focus:outline-none focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:focus:ring-gray-500 dark:focus:text-white';
15
+ let hoverClass = 'hover:bg-gray-100 hover:text-blue-700 dark:hover:bg-gray-600 dark:hover:text-white';
16
+ let state;
17
+ $: state = disabled ? 'disabled' : current ? 'current' : 'normal';
18
+ let itemClass;
19
+ $: itemClass = classNames('py-2 px-4 w-full text-sm font-medium', 'first:rounded-t-lg last:rounded-b-lg', states[state], active && state === 'disabled' && 'cursor-not-allowed', active && state === 'normal' && hoverClass, active && state === 'normal' && focusClass, $$props.class);
20
+ </script>
21
+
22
+ {#if !active}
23
+ <li class={itemClass}>
24
+ <slot item={$$props} />
25
+ </li>
26
+ {:else if href}
27
+ <a
28
+ {href}
29
+ class="block {itemClass}"
30
+ on:click={() => dispatch('click', $$props)}
31
+ aria-current={current}
32
+ >
33
+ <slot item={$$props} />
34
+ </a>
35
+ {:else}
36
+ <button
37
+ class="inline-flex relative items-center text-left {itemClass}"
38
+ {disabled}
39
+ on:click={() => dispatch('click', $$props)}
40
+ aria-current={current}
41
+ >
42
+ <slot item={$$props} />
43
+ </button>
44
+ {/if}
@@ -0,0 +1,26 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ active?: boolean;
6
+ current?: boolean;
7
+ disabled?: boolean;
8
+ href?: string;
9
+ };
10
+ events: {
11
+ click: CustomEvent<any>;
12
+ } & {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {
16
+ default: {
17
+ item: SvelteAllProps;
18
+ };
19
+ };
20
+ };
21
+ export declare type ListItemProps = typeof __propDef.props;
22
+ export declare type ListItemEvents = typeof __propDef.events;
23
+ export declare type ListItemSlots = typeof __propDef.slots;
24
+ export default class ListItem extends SvelteComponentTyped<ListItemProps, ListItemEvents, ListItemSlots> {
25
+ }
26
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.22.8",
3
+ "version": "0.22.11",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -162,6 +162,7 @@
162
162
  "./kbd/ArrowKeyUp.svelte": "./kbd/ArrowKeyUp.svelte",
163
163
  "./kbd/Kbd.svelte": "./kbd/Kbd.svelte",
164
164
  "./list-group/List.svelte": "./list-group/List.svelte",
165
+ "./list-group/ListItem.svelte": "./list-group/ListItem.svelte",
165
166
  "./modals/ExtraLargeModal.svelte": "./modals/ExtraLargeModal.svelte",
166
167
  "./modals/LargeModal.svelte": "./modals/LargeModal.svelte",
167
168
  "./modals/MediumModal.svelte": "./modals/MediumModal.svelte",
package/types.d.ts CHANGED
@@ -106,6 +106,12 @@ export interface InteractiveTabType {
106
106
  id: number;
107
107
  content: string | typeof SvelteComponent;
108
108
  }
109
+ export interface ListGroupItemType {
110
+ current?: boolean;
111
+ disabled?: boolean;
112
+ href?: string;
113
+ [propName: string]: any;
114
+ }
109
115
  export interface LinkType {
110
116
  name: string;
111
117
  href: string;