flowbite-svelte 0.25.23 → 0.26.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 +57 -0
- package/avatar/Avatar.svelte +4 -4
- package/dropdowns/Dropdown.svelte +19 -12
- package/dropdowns/Dropdown.svelte.d.ts +2 -3
- package/dropdowns/DropdownItem.svelte +1 -0
- package/index.d.ts +6 -0
- package/index.js +7 -0
- package/package.json +9 -1
- package/popover/Popover.svelte +3 -3
- package/popover/Popover.svelte.d.ts +1 -0
- package/ratings/Review.svelte +9 -13
- package/ratings/Review.svelte.d.ts +4 -3
- package/sidebars/SidebarDropdownWrapper.svelte +1 -6
- package/sidebars/SidebarDropdownWrapper.svelte.d.ts +1 -2
- package/sidebars/SidebarItem.svelte +2 -9
- package/sidebars/SidebarItem.svelte.d.ts +1 -2
- package/tabs/TabContentItem.svelte +10 -0
- package/tabs/TabContentItem.svelte.d.ts +20 -0
- package/tabs/TabContentWrapper.svelte +8 -0
- package/tabs/TabContentWrapper.svelte.d.ts +16 -0
- package/tabs/TabHead.svelte +27 -0
- package/tabs/TabHead.svelte.d.ts +21 -0
- package/tabs/TabHeadItem.svelte +54 -0
- package/tabs/TabHeadItem.svelte.d.ts +34 -0
- package/tabs/TabWrapper.svelte +10 -0
- package/tabs/TabWrapper.svelte.d.ts +25 -0
- package/tabs/Tabs.svelte +2 -4
- package/tooltips/Tooltip.svelte +7 -8
- package/tooltips/Tooltip.svelte.d.ts +3 -6
- package/types.d.ts +3 -7
- package/utils/InformationCircle.svelte +37 -0
- package/utils/InformationCircle.svelte.d.ts +22 -0
- package/utils/Popper.svelte +94 -66
- package/utils/Popper.svelte.d.ts +5 -8
- package/utils/UserCircle.svelte +37 -0
- package/utils/UserCircle.svelte.d.ts +22 -0
- package/utils/createEventDispatcher.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,63 @@
|
|
|
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.1](https://github.com/themesberg/flowbite-svelte/compare/v0.26.0...v0.26.1) (2022-08-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* new tab components and page ([7c53437](https://github.com/themesberg/flowbite-svelte/commit/7c534377c31384b609774db19b0bace7fee3d5cb))
|
|
11
|
+
* working on Tabs ([201c124](https://github.com/themesberg/flowbite-svelte/commit/201c124e33bed0d1b13cfe2e3f6ba5ea0bfc6c1c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* fixing the tab page layout problem ([bc3b7bf](https://github.com/themesberg/flowbite-svelte/commit/bc3b7bf32100abbbab3fede7fa6a912ff81d00f6))
|
|
17
|
+
* remove heros from cards page ([c46f0b3](https://github.com/themesberg/flowbite-svelte/commit/c46f0b3f9a16793f12d68fd3d1b9e973dd1f7b4a))
|
|
18
|
+
* remove heros from megamenu and list-group page ([9980b7d](https://github.com/themesberg/flowbite-svelte/commit/9980b7d98668c0356217dd3aac810c52cd5e0e51))
|
|
19
|
+
* remove heros from popover page ([eeff79f](https://github.com/themesberg/flowbite-svelte/commit/eeff79f53733a8f5cbb480eead692f111f96b07c))
|
|
20
|
+
* remove heros from sidebars page ([a3981a0](https://github.com/themesberg/flowbite-svelte/commit/a3981a09b6b36dcbcb90cfad789bee6a10dae9a1))
|
|
21
|
+
* remove heros icons from select and toggle pages ([fba7660](https://github.com/themesberg/flowbite-svelte/commit/fba7660c1bf08c47a9d0200db545f0b1fce457a9))
|
|
22
|
+
* remove unused icon prop ([10e8c81](https://github.com/themesberg/flowbite-svelte/commit/10e8c81dae9e0470ef875fc95dd7d89decdae732))
|
|
23
|
+
* Review component and review in the ratings page ([afe6972](https://github.com/themesberg/flowbite-svelte/commit/afe69726d08a3cad7de7f29db131909816bc9c3e))
|
|
24
|
+
|
|
25
|
+
## [0.26.0](https://github.com/themesberg/flowbite-svelte/compare/v0.25.24...v0.26.0) (2022-08-29)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### ⚠ BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
* Tooltip changed in accordance to new Popper implementation.
|
|
31
|
+
|
|
32
|
+
- Tooltip examples corrected
|
|
33
|
+
- Avatar example corrected
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* tooltips new API ([d9dacf9](https://github.com/themesberg/flowbite-svelte/commit/d9dacf9f65e85be93a3458dd5359d614a0dd12a0))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* Avatar tooltip example ([ff7c1af](https://github.com/themesberg/flowbite-svelte/commit/ff7c1af20306609f77831ff1d2632700a9f596da))
|
|
43
|
+
* docs corrections ([f208323](https://github.com/themesberg/flowbite-svelte/commit/f208323ac1457b88572aaae37531e6b3da1055de))
|
|
44
|
+
* docs corrections 2 ([5adb4d8](https://github.com/themesberg/flowbite-svelte/commit/5adb4d816591d7bc9aff2e549fc364c80e650b4b))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
* Merge branch 'jjagielka-tooltip' ([1c37601](https://github.com/themesberg/flowbite-svelte/commit/1c3760139e24569287891c1ca3f67f2e0e3b9168))
|
|
48
|
+
|
|
49
|
+
### [0.25.24](https://github.com/themesberg/flowbite-svelte/compare/v0.25.23...v0.25.24) (2022-08-28)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* popper reloaded ([a4b851e](https://github.com/themesberg/flowbite-svelte/commit/a4b851e2409356a90fd6aaae62db327b505bdcb2))
|
|
55
|
+
* popper reloaded part 2 ([2482870](https://github.com/themesberg/flowbite-svelte/commit/2482870842386c8c1e5824869ce7822b8682e8a0))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* tab page timeline ([ab598a5](https://github.com/themesberg/flowbite-svelte/commit/ab598a59a3d373f14740a42bbaec3cb276eed34b))
|
|
61
|
+
|
|
5
62
|
### [0.25.23](https://github.com/themesberg/flowbite-svelte/compare/v0.25.22...v0.25.23) (2022-08-28)
|
|
6
63
|
|
|
7
64
|
|
package/avatar/Avatar.svelte
CHANGED
|
@@ -22,17 +22,17 @@ $: avatarClass = classNames(rounded ? 'rounded' : 'rounded-full', border && 'p-1
|
|
|
22
22
|
|
|
23
23
|
<Dot show={$$props.dot} {rounded} {...dot} {size} class={sizes[size]}>
|
|
24
24
|
{#if src}
|
|
25
|
-
<img
|
|
25
|
+
<img {alt} {src} {...$$restProps} class={avatarClass} />
|
|
26
26
|
{:else if $$slots.default}
|
|
27
27
|
<svelte:element
|
|
28
28
|
this={href ? 'a' : 'div'}
|
|
29
|
-
class="flex justify-center items-center text-xs font-medium {avatarClass}"
|
|
30
29
|
{href}
|
|
31
|
-
|
|
30
|
+
{...$$restProps}
|
|
31
|
+
class="flex justify-center items-center text-xs font-medium {avatarClass}">
|
|
32
32
|
<slot />
|
|
33
33
|
</svelte:element>
|
|
34
34
|
{:else}
|
|
35
|
-
<svelte:element this={href ? 'a' : 'div'} class={avatarClass}>
|
|
35
|
+
<svelte:element this={href ? 'a' : 'div'} {...$$restProps} class={avatarClass}>
|
|
36
36
|
<AvatarPlaceholder {rounded} />
|
|
37
37
|
</svelte:element>
|
|
38
38
|
{/if}
|
|
@@ -6,12 +6,15 @@ import ChevronUp from '../utils/ChevronUp.svelte';
|
|
|
6
6
|
import ChevronRight from '../utils/ChevronRight.svelte';
|
|
7
7
|
import ChevronDown from '../utils/ChevronDown.svelte';
|
|
8
8
|
import ChevronLeft from '../utils/ChevronLeft.svelte';
|
|
9
|
+
import generateId from '../utils/generateId';
|
|
9
10
|
export let label = '';
|
|
10
11
|
export let inline = false;
|
|
11
12
|
export let arrowIcon = true;
|
|
12
13
|
export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4 font-medium text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:w-auto dark:text-gray-400 dark:hover:text-white dark:focus:text-white dark:border-gray-700 dark:hover:bg-gray-700 md:dark:hover:bg-transparent';
|
|
13
14
|
export let placement = 'bottom';
|
|
14
15
|
export let open = false;
|
|
16
|
+
export let triggeredBy = undefined;
|
|
17
|
+
let id = generateId();
|
|
15
18
|
setContext('background', true);
|
|
16
19
|
const icons = {
|
|
17
20
|
top: ChevronUp,
|
|
@@ -25,18 +28,10 @@ let popoverClass;
|
|
|
25
28
|
$: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800', 'text-gray-500 dark:text-gray-400', 'border border-gray-200 dark:border-gray-700', 'outline-none', $$props.class);
|
|
26
29
|
</script>
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
arrow={false}
|
|
31
|
-
{placement}
|
|
32
|
-
{...$$restProps}
|
|
33
|
-
class={popoverClass}
|
|
34
|
-
trigger="click"
|
|
35
|
-
on:show
|
|
36
|
-
bind:open>
|
|
37
|
-
<slot name="trigger" slot="trigger">
|
|
31
|
+
{#if label}
|
|
32
|
+
<slot name="trigger">
|
|
38
33
|
{#if inline}
|
|
39
|
-
<button class={labelClass} class:flex-row-reverse={icon == ChevronLeft}>
|
|
34
|
+
<button {id} class={labelClass} class:flex-row-reverse={icon == ChevronLeft}>
|
|
40
35
|
<slot name="label">{label}</slot>
|
|
41
36
|
{#if arrowIcon}
|
|
42
37
|
<svelte:component
|
|
@@ -45,7 +40,7 @@ $: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800'
|
|
|
45
40
|
{/if}
|
|
46
41
|
</button>
|
|
47
42
|
{:else}
|
|
48
|
-
<Button {...$$restProps} class={icon == ChevronLeft && 'flex-row-reverse'}>
|
|
43
|
+
<Button {id} {...$$restProps} class={icon == ChevronLeft && 'flex-row-reverse'}>
|
|
49
44
|
<slot name="label">{label}</slot>
|
|
50
45
|
{#if arrowIcon}
|
|
51
46
|
<svelte:component
|
|
@@ -55,6 +50,18 @@ $: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800'
|
|
|
55
50
|
</Button>
|
|
56
51
|
{/if}
|
|
57
52
|
</slot>
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
<Popper
|
|
56
|
+
activeContent={true}
|
|
57
|
+
arrow={false}
|
|
58
|
+
{placement}
|
|
59
|
+
{...$$restProps}
|
|
60
|
+
class={popoverClass}
|
|
61
|
+
trigger="click"
|
|
62
|
+
on:show
|
|
63
|
+
bind:open
|
|
64
|
+
triggeredBy={triggeredBy ?? '#' + id}>
|
|
58
65
|
<slot name="content">
|
|
59
66
|
<ul class="py-1">
|
|
60
67
|
<slot />
|
|
@@ -9,6 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
labelClass?: string;
|
|
10
10
|
placement?: 'auto' | Placement;
|
|
11
11
|
open?: boolean;
|
|
12
|
+
triggeredBy?: string;
|
|
12
13
|
};
|
|
13
14
|
events: {
|
|
14
15
|
show: CustomEvent<any>;
|
|
@@ -16,9 +17,7 @@ declare const __propDef: {
|
|
|
16
17
|
[evt: string]: CustomEvent<any>;
|
|
17
18
|
};
|
|
18
19
|
slots: {
|
|
19
|
-
trigger: {
|
|
20
|
-
slot: string;
|
|
21
|
-
};
|
|
20
|
+
trigger: {};
|
|
22
21
|
label: {};
|
|
23
22
|
content: {};
|
|
24
23
|
default: {};
|
package/index.d.ts
CHANGED
|
@@ -98,6 +98,10 @@ export { default as IconTabs } from './tabs/IconTabs.svelte';
|
|
|
98
98
|
export { default as PillTabs } from './tabs/PillTabs.svelte';
|
|
99
99
|
export { default as TabContent } from './tabs/TabContent.svelte';
|
|
100
100
|
export { default as UnderlineTabs } from './tabs/UnderlineTabs.svelte';
|
|
101
|
+
export { default as TabHead } from './tabs/TabHead.svelte';
|
|
102
|
+
export { default as TabHeadItem } from './tabs/TabHeadItem.svelte';
|
|
103
|
+
export { default as TabContentItem } from './tabs/TabContentItem.svelte';
|
|
104
|
+
export { default as TabWrapper } from './tabs/TabWrapper.svelte';
|
|
101
105
|
export { default as Group } from './timelines/Group.svelte';
|
|
102
106
|
export { default as GroupItem } from './timelines/GroupItem.svelte';
|
|
103
107
|
export { default as Activity } from './timelines/Activity.svelte';
|
|
@@ -128,3 +132,5 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
|
|
|
128
132
|
export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
|
|
129
133
|
export { default as ChevronRight } from './utils/ChevronRight.svelte';
|
|
130
134
|
export { default as ChevronUp } from './utils/ChevronUp.svelte';
|
|
135
|
+
export { default as InformationCircle } from './utils/InformationCircle.svelte';
|
|
136
|
+
export { default as UserCircle } from './utils/UserCircle.svelte';
|
package/index.js
CHANGED
|
@@ -126,6 +126,11 @@ export { default as IconTabs } from './tabs/IconTabs.svelte';
|
|
|
126
126
|
export { default as PillTabs } from './tabs/PillTabs.svelte';
|
|
127
127
|
export { default as TabContent } from './tabs/TabContent.svelte';
|
|
128
128
|
export { default as UnderlineTabs } from './tabs/UnderlineTabs.svelte';
|
|
129
|
+
// Tabs new
|
|
130
|
+
export { default as TabHead } from './tabs/TabHead.svelte';
|
|
131
|
+
export { default as TabHeadItem } from './tabs/TabHeadItem.svelte';
|
|
132
|
+
export { default as TabContentItem } from './tabs/TabContentItem.svelte';
|
|
133
|
+
export { default as TabWrapper } from './tabs/TabWrapper.svelte';
|
|
129
134
|
// Timeline
|
|
130
135
|
export { default as Group } from './timelines/Group.svelte';
|
|
131
136
|
export { default as GroupItem } from './timelines/GroupItem.svelte';
|
|
@@ -162,3 +167,5 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
|
|
|
162
167
|
export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
|
|
163
168
|
export { default as ChevronRight } from './utils/ChevronRight.svelte';
|
|
164
169
|
export { default as ChevronUp } from './utils/ChevronUp.svelte';
|
|
170
|
+
export { default as InformationCircle } from './utils/InformationCircle.svelte';
|
|
171
|
+
export { default as UserCircle } from './utils/UserCircle.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -207,6 +207,11 @@
|
|
|
207
207
|
"./tabs/InteractiveTabs.svelte": "./tabs/InteractiveTabs.svelte",
|
|
208
208
|
"./tabs/PillTabs.svelte": "./tabs/PillTabs.svelte",
|
|
209
209
|
"./tabs/TabContent.svelte": "./tabs/TabContent.svelte",
|
|
210
|
+
"./tabs/TabContentItem.svelte": "./tabs/TabContentItem.svelte",
|
|
211
|
+
"./tabs/TabContentWrapper.svelte": "./tabs/TabContentWrapper.svelte",
|
|
212
|
+
"./tabs/TabHead.svelte": "./tabs/TabHead.svelte",
|
|
213
|
+
"./tabs/TabHeadItem.svelte": "./tabs/TabHeadItem.svelte",
|
|
214
|
+
"./tabs/TabWrapper.svelte": "./tabs/TabWrapper.svelte",
|
|
210
215
|
"./tabs/Tabs.svelte": "./tabs/Tabs.svelte",
|
|
211
216
|
"./tabs/UnderlineTabs.svelte": "./tabs/UnderlineTabs.svelte",
|
|
212
217
|
"./tabs/tabStores": "./tabs/tabStores.js",
|
|
@@ -241,9 +246,12 @@
|
|
|
241
246
|
"./utils/ChevronRight.svelte": "./utils/ChevronRight.svelte",
|
|
242
247
|
"./utils/ChevronUp.svelte": "./utils/ChevronUp.svelte",
|
|
243
248
|
"./utils/CloseButton.svelte": "./utils/CloseButton.svelte",
|
|
249
|
+
"./utils/InformationCircle.svelte": "./utils/InformationCircle.svelte",
|
|
244
250
|
"./utils/Popper.svelte": "./utils/Popper.svelte",
|
|
251
|
+
"./utils/UserCircle.svelte": "./utils/UserCircle.svelte",
|
|
245
252
|
"./utils/Wrapper.svelte": "./utils/Wrapper.svelte",
|
|
246
253
|
"./utils/clickOutside": "./utils/clickOutside.js",
|
|
254
|
+
"./utils/createEventDispatcher": "./utils/createEventDispatcher.js",
|
|
247
255
|
"./utils/focusTrap": "./utils/focusTrap.js",
|
|
248
256
|
"./utils/generateId": "./utils/generateId.js"
|
|
249
257
|
},
|
package/popover/Popover.svelte
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script>import Popper from '../utils/Popper.svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
export let title = '';
|
|
4
|
+
export let triggeredBy;
|
|
4
5
|
let popoverClass;
|
|
5
6
|
$: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800', 'text-gray-500 dark:text-gray-400', 'border border-gray-200 dark:border-gray-700', $$props.class);
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<Popper activeContent={true} {...$$restProps} class={popoverClass} on:show>
|
|
9
|
+
<Popper activeContent={true} {triggeredBy} {...$$restProps} class={popoverClass} on:show>
|
|
9
10
|
<slot name="trigger" slot="trigger" />
|
|
10
11
|
{#if $$slots.title || title}
|
|
11
12
|
<div
|
|
12
|
-
class="py-2 px-3 bg-gray-100 rounded-t-lg border-b border-gray-200 dark:border-gray-600 dark:bg-gray-700"
|
|
13
|
-
>
|
|
13
|
+
class="py-2 px-3 bg-gray-100 rounded-t-lg border-b border-gray-200 dark:border-gray-600 dark:bg-gray-700">
|
|
14
14
|
<slot name="title">
|
|
15
15
|
<h3 class="font-semibold text-gray-900 dark:text-white">{title}</h3>
|
|
16
16
|
</slot>
|
package/ratings/Review.svelte
CHANGED
|
@@ -15,29 +15,26 @@ export let liClass = 'flex items-center';
|
|
|
15
15
|
<p>{review.name}</p>
|
|
16
16
|
{#if review.address}
|
|
17
17
|
<div class="flex items-center text-sm text-gray-500 dark:text-gray-400">
|
|
18
|
-
|
|
19
|
-
<svelte:component this={review.addressIcon} size="16" class="mr-2" />
|
|
20
|
-
{/if}
|
|
21
|
-
{review.address}
|
|
18
|
+
<slot name="address" />
|
|
22
19
|
</div>
|
|
23
20
|
{/if}
|
|
24
21
|
</div>
|
|
25
22
|
</div>
|
|
26
|
-
{#if $$slots.
|
|
23
|
+
{#if $$slots.item1 || $$slots.item2 || $$slots.item3}
|
|
27
24
|
<ul class={classNames(ulClass, $$props.classUl)}>
|
|
28
|
-
{#if $$slots.
|
|
25
|
+
{#if $$slots.item1}
|
|
29
26
|
<li class={classNames(liClass, $$props.classLi)}>
|
|
30
|
-
<slot name="
|
|
27
|
+
<slot name="item1" />
|
|
31
28
|
</li>
|
|
32
29
|
{/if}
|
|
33
|
-
{#if $$slots.
|
|
30
|
+
{#if $$slots.item2}
|
|
34
31
|
<li class={classNames(liClass, $$props.classLi)}>
|
|
35
|
-
<slot name="
|
|
32
|
+
<slot name="item2" />
|
|
36
33
|
</li>
|
|
37
34
|
{/if}
|
|
38
|
-
{#if $$slots.
|
|
35
|
+
{#if $$slots.item3}
|
|
39
36
|
<li class={classNames(liClass, $$props.classLi)}>
|
|
40
|
-
<slot name="
|
|
37
|
+
<slot name="item3" />
|
|
41
38
|
</li>
|
|
42
39
|
{/if}
|
|
43
40
|
</ul>
|
|
@@ -58,8 +55,7 @@ export let liClass = 'flex items-center';
|
|
|
58
55
|
</h4>
|
|
59
56
|
</div>
|
|
60
57
|
<p
|
|
61
|
-
class="bg-blue-700 text-white text-sm font-semibold inline-flex items-center p-1.5 rounded"
|
|
62
|
-
>
|
|
58
|
+
class="bg-blue-700 text-white text-sm font-semibold inline-flex items-center p-1.5 rounded">
|
|
63
59
|
{review.rating}
|
|
64
60
|
</p>
|
|
65
61
|
</div>
|
|
@@ -6,7 +6,6 @@ export let btnClass = 'flex items-center p-2 w-full text-base font-normal text-g
|
|
|
6
6
|
export let label = '';
|
|
7
7
|
export let spanClass = 'flex-1 ml-3 text-left whitespace-nowrap';
|
|
8
8
|
export let ulClass = 'py-2 space-y-2';
|
|
9
|
-
export let icon;
|
|
10
9
|
let isOpen = false;
|
|
11
10
|
const handleDropdown = () => {
|
|
12
11
|
isOpen = !isOpen;
|
|
@@ -20,11 +19,7 @@ const handleDropdown = () => {
|
|
|
20
19
|
type="button"
|
|
21
20
|
class={classNames(btnClass, $$props.class)}
|
|
22
21
|
aria-controls="sidebar-dropdown">
|
|
23
|
-
<
|
|
24
|
-
this={icon.name}
|
|
25
|
-
size={icon.size}
|
|
26
|
-
color={icon.color}
|
|
27
|
-
class="mr-2 {icon.class}" />
|
|
22
|
+
<slot name="icon" />
|
|
28
23
|
<span class={spanClass} sidebar-toggle-item>{label}</span>
|
|
29
24
|
<ChevronDown />
|
|
30
25
|
</button>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { IconType } from '../types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
@@ -7,12 +6,12 @@ declare const __propDef: {
|
|
|
7
6
|
label?: string;
|
|
8
7
|
spanClass?: string;
|
|
9
8
|
ulClass?: string;
|
|
10
|
-
icon: IconType;
|
|
11
9
|
};
|
|
12
10
|
events: {
|
|
13
11
|
[evt: string]: CustomEvent<any>;
|
|
14
12
|
};
|
|
15
13
|
slots: {
|
|
14
|
+
icon: {};
|
|
16
15
|
default: {};
|
|
17
16
|
};
|
|
18
17
|
};
|
|
@@ -3,7 +3,6 @@ export let aClass = 'flex items-center p-2 text-base font-normal text-gray-900 r
|
|
|
3
3
|
export let href = '';
|
|
4
4
|
export let label = '';
|
|
5
5
|
export let spanClass = 'ml-3';
|
|
6
|
-
export let icon;
|
|
7
6
|
</script>
|
|
8
7
|
|
|
9
8
|
<li>
|
|
@@ -19,14 +18,8 @@ export let icon;
|
|
|
19
18
|
on:mouseenter
|
|
20
19
|
on:mouseleave
|
|
21
20
|
on:mouseover
|
|
22
|
-
class={classNames(aClass, $$props.class)}
|
|
23
|
-
|
|
24
|
-
<svelte:component
|
|
25
|
-
this={icon.name}
|
|
26
|
-
size={icon.size}
|
|
27
|
-
color={icon.color}
|
|
28
|
-
class="mr-2 {icon.class}"
|
|
29
|
-
/>
|
|
21
|
+
class={classNames(aClass, $$props.class)}>
|
|
22
|
+
<slot name="icon" />
|
|
30
23
|
<span class={spanClass}>{label}</span>
|
|
31
24
|
{#if $$slots.subtext}
|
|
32
25
|
<slot name="subtext" />
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { IconType } from '../types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
@@ -7,7 +6,6 @@ declare const __propDef: {
|
|
|
7
6
|
href?: string;
|
|
8
7
|
label?: string;
|
|
9
8
|
spanClass?: string;
|
|
10
|
-
icon: IconType;
|
|
11
9
|
};
|
|
12
10
|
events: {
|
|
13
11
|
blur: FocusEvent;
|
|
@@ -23,6 +21,7 @@ declare const __propDef: {
|
|
|
23
21
|
[evt: string]: CustomEvent<any>;
|
|
24
22
|
};
|
|
25
23
|
slots: {
|
|
24
|
+
icon: {};
|
|
26
25
|
subtext: {};
|
|
27
26
|
};
|
|
28
27
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>export let activeTabValue;
|
|
2
|
+
export let id;
|
|
3
|
+
export let contentDivClass = 'p-4 bg-gray-50 rounded-lg dark:bg-gray-800';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if activeTabValue === id}
|
|
7
|
+
<div class={contentDivClass} id="{id}-tabitem" role="tabpanel" aria-labelledby="{id}-tab">
|
|
8
|
+
<slot />
|
|
9
|
+
</div>
|
|
10
|
+
{/if}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
activeTabValue: number;
|
|
5
|
+
id: number;
|
|
6
|
+
contentDivClass?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type TabContentItemProps = typeof __propDef.props;
|
|
16
|
+
export declare type TabContentItemEvents = typeof __propDef.events;
|
|
17
|
+
export declare type TabContentItemSlots = typeof __propDef.slots;
|
|
18
|
+
export default class TabContentItem extends SvelteComponentTyped<TabContentItemProps, TabContentItemEvents, TabContentItemSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {};
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {
|
|
8
|
+
default: {};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare type TabContentWrapperProps = typeof __propDef.props;
|
|
12
|
+
export declare type TabContentWrapperEvents = typeof __propDef.events;
|
|
13
|
+
export declare type TabContentWrapperSlots = typeof __propDef.slots;
|
|
14
|
+
export default class TabContentWrapper extends SvelteComponentTyped<TabContentWrapperProps, TabContentWrapperEvents, TabContentWrapperSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>export let tabStyle;
|
|
2
|
+
export let tabId;
|
|
3
|
+
export let customDivClass = '';
|
|
4
|
+
export let customUlClass = '';
|
|
5
|
+
const divClasses = {
|
|
6
|
+
default: 'mb-4 border-b border-gray-200 dark:border-gray-700',
|
|
7
|
+
full: 'mb-4',
|
|
8
|
+
icon: 'mb-4 border-b border-gray-200 dark:border-gray-700',
|
|
9
|
+
pill: 'mb-4 ',
|
|
10
|
+
underline: 'mb-4 text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700',
|
|
11
|
+
custom: customDivClass
|
|
12
|
+
};
|
|
13
|
+
const ulClasses = {
|
|
14
|
+
default: 'flex flex-wrap -mb-px',
|
|
15
|
+
full: 'hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400 mb-1',
|
|
16
|
+
icon: 'flex flex-wrap -mb-px text-sm font-medium text-center text-gray-500 dark:text-gray-400',
|
|
17
|
+
pill: 'flex flex-wrap',
|
|
18
|
+
underline: 'flex flex-wrap -mb-px',
|
|
19
|
+
custom: customUlClass
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class={divClasses[tabStyle]}>
|
|
24
|
+
<ul class={ulClasses[tabStyle]} id={tabId} role="tablist">
|
|
25
|
+
<slot />
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
tabStyle: any;
|
|
5
|
+
tabId: any;
|
|
6
|
+
customDivClass?: string;
|
|
7
|
+
customUlClass?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type TabHeadProps = typeof __propDef.props;
|
|
17
|
+
export declare type TabHeadEvents = typeof __propDef.events;
|
|
18
|
+
export declare type TabHeadSlots = typeof __propDef.slots;
|
|
19
|
+
export default class TabHead extends SvelteComponentTyped<TabHeadProps, TabHeadEvents, TabHeadSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let id;
|
|
3
|
+
export let tabStyle;
|
|
4
|
+
export let activeTabValue;
|
|
5
|
+
export let customActiveClass = '';
|
|
6
|
+
export let customInActiveClass = '';
|
|
7
|
+
export let customLiClass = '';
|
|
8
|
+
const activeClasses = {
|
|
9
|
+
default: 'inline-block py-4 px-4 text-sm font-medium text-center text-blue-600 bg-gray-100 rounded-t-lg active dark:bg-gray-800 dark:text-blue-500',
|
|
10
|
+
full: 'inline-block p-4 w-full text-gray-900 bg-gray-100 focus:ring-4 focus:ring-blue-300 active focus:outline-none dark:bg-gray-700 dark:text-white',
|
|
11
|
+
icon: 'inline-flex p-4 text-blue-600 rounded-t-lg border-b-2 border-blue-600 active dark:text-blue-500 dark:border-blue-500 group',
|
|
12
|
+
pill: 'active inline-block py-3 px-4 text-sm font-medium text-center text-white bg-blue-600 rounded-lg',
|
|
13
|
+
underline: 'inline-block p-4 text-blue-600 rounded-t-lg border-b-2 border-blue-600 active dark:text-blue-500 dark:border-blue-500',
|
|
14
|
+
custom: customActiveClass
|
|
15
|
+
};
|
|
16
|
+
const inactiveClasses = {
|
|
17
|
+
default: 'inline-block py-4 px-4 text-sm font-medium text-center text-gray-500 rounded-t-lg hover:text-gray-600 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300',
|
|
18
|
+
full: 'inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700',
|
|
19
|
+
icon: 'inline-flex p-4 rounded-t-lg border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300 group ',
|
|
20
|
+
pill: 'inline-block py-3 px-4 text-sm font-medium text-center text-gray-500 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white',
|
|
21
|
+
underline: 'inline-block p-4 rounded-t-lg border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300',
|
|
22
|
+
custom: customInActiveClass
|
|
23
|
+
};
|
|
24
|
+
const liClasses = {
|
|
25
|
+
default: 'mr-2',
|
|
26
|
+
full: 'w-full',
|
|
27
|
+
icon: 'mr-2',
|
|
28
|
+
pill: 'mr-2',
|
|
29
|
+
underline: 'mr-2',
|
|
30
|
+
custom: customLiClass
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<li class={liClasses[tabStyle]} role="presentation">
|
|
35
|
+
<button
|
|
36
|
+
{...$$restProps}
|
|
37
|
+
on:click
|
|
38
|
+
on:blur
|
|
39
|
+
on:click
|
|
40
|
+
on:focus
|
|
41
|
+
on:keydown
|
|
42
|
+
on:keypress
|
|
43
|
+
on:keyup
|
|
44
|
+
on:mouseenter
|
|
45
|
+
on:mouseleave
|
|
46
|
+
on:mouseover
|
|
47
|
+
class={classNames(activeTabValue === id ? activeClasses[tabStyle] : inactiveClasses[tabStyle])}
|
|
48
|
+
id="{id}-tabhead"
|
|
49
|
+
type="button"
|
|
50
|
+
role="tab"
|
|
51
|
+
{...$$restProps}>
|
|
52
|
+
<slot />
|
|
53
|
+
</button>
|
|
54
|
+
</li>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
id: number;
|
|
6
|
+
tabStyle: string;
|
|
7
|
+
activeTabValue: number;
|
|
8
|
+
customActiveClass?: string;
|
|
9
|
+
customInActiveClass?: string;
|
|
10
|
+
customLiClass?: string;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
click: MouseEvent;
|
|
14
|
+
blur: FocusEvent;
|
|
15
|
+
focus: FocusEvent;
|
|
16
|
+
keydown: KeyboardEvent;
|
|
17
|
+
keypress: KeyboardEvent;
|
|
18
|
+
keyup: KeyboardEvent;
|
|
19
|
+
mouseenter: MouseEvent;
|
|
20
|
+
mouseleave: MouseEvent;
|
|
21
|
+
mouseover: MouseEvent;
|
|
22
|
+
} & {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {
|
|
26
|
+
default: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare type TabHeadItemProps = typeof __propDef.props;
|
|
30
|
+
export declare type TabHeadItemEvents = typeof __propDef.events;
|
|
31
|
+
export declare type TabHeadItemSlots = typeof __propDef.slots;
|
|
32
|
+
export default class TabHeadItem extends SvelteComponentTyped<TabHeadItemProps, TabHeadItemEvents, TabHeadItemSlots> {
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let divClass = 'w-full';
|
|
3
|
+
export let tabStyle = 'default';
|
|
4
|
+
let tabId;
|
|
5
|
+
export let activeTabValue;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class={classNames(divClass, $$props.class)}>
|
|
9
|
+
<slot {tabStyle} {tabId} {activeTabValue} />
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
divClass?: string;
|
|
6
|
+
tabStyle?: 'default' | 'full' | 'icon' | 'pill' | 'underline' | 'custom';
|
|
7
|
+
activeTabValue: number;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {
|
|
14
|
+
tabStyle: "default" | "custom" | "full" | "icon" | "pill" | "underline";
|
|
15
|
+
tabId: number;
|
|
16
|
+
activeTabValue: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare type TabWrapperProps = typeof __propDef.props;
|
|
21
|
+
export declare type TabWrapperEvents = typeof __propDef.events;
|
|
22
|
+
export declare type TabWrapperSlots = typeof __propDef.slots;
|
|
23
|
+
export default class TabWrapper extends SvelteComponentTyped<TabWrapperProps, TabWrapperEvents, TabWrapperSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/tabs/Tabs.svelte
CHANGED
|
@@ -87,13 +87,11 @@ const handleClick = (tabValue) => () => (activeTabValue = tabValue);
|
|
|
87
87
|
type="button"
|
|
88
88
|
role="tab"
|
|
89
89
|
aria-controls={name}
|
|
90
|
-
{disabled}
|
|
91
|
-
>
|
|
90
|
+
{disabled}>
|
|
92
91
|
{#if icon}
|
|
93
92
|
<svelte:component this={icon} size={iconSize} class={iconClass} />
|
|
94
93
|
{/if}
|
|
95
|
-
{name}</button
|
|
96
|
-
>
|
|
94
|
+
{name}</button>
|
|
97
95
|
</li>
|
|
98
96
|
{/each}
|
|
99
97
|
</ul>
|
package/tooltips/Tooltip.svelte
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
<script>import Popper from '../utils/Popper.svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
export let
|
|
3
|
+
export let color = '';
|
|
4
4
|
export let style = 'dark';
|
|
5
|
-
export let tipColor = '';
|
|
6
5
|
export let tipClass = 'py-2 px-3 text-sm font-medium rounded-lg shadow-sm tooltip';
|
|
7
|
-
|
|
6
|
+
export let triggeredBy;
|
|
7
|
+
const colors = {
|
|
8
8
|
dark: 'border border-gray-800 bg-gray-900 text-white dark:bg-gray-700 dark:border-gray-600',
|
|
9
9
|
light: 'border border-gray-200 bg-white text-gray-900',
|
|
10
10
|
auto: 'border border-gray-200 bg-white text-gray-900 dark:bg-gray-700 dark:text-white dark:border-gray-600 ',
|
|
11
|
-
custom:
|
|
11
|
+
custom: color
|
|
12
12
|
};
|
|
13
13
|
let toolTipClass;
|
|
14
|
-
$: toolTipClass = classNames(tipClass,
|
|
14
|
+
$: toolTipClass = classNames(tipClass, colors[style], $$props.class);
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<Popper activeContent={false} {...$$restProps} class={toolTipClass} on:show>
|
|
18
|
-
<slot
|
|
19
|
-
<slot name="content">{content}</slot>
|
|
17
|
+
<Popper activeContent={false} {triggeredBy} {...$$restProps} class={toolTipClass} on:show>
|
|
18
|
+
<slot />
|
|
20
19
|
</Popper>
|
|
@@ -2,10 +2,10 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
5
|
+
color?: string;
|
|
6
6
|
style?: 'dark' | 'light' | 'auto' | 'custom';
|
|
7
|
-
tipColor?: string;
|
|
8
7
|
tipClass?: string;
|
|
8
|
+
triggeredBy: string;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
show: CustomEvent<any>;
|
|
@@ -13,10 +13,7 @@ declare const __propDef: {
|
|
|
13
13
|
[evt: string]: CustomEvent<any>;
|
|
14
14
|
};
|
|
15
15
|
slots: {
|
|
16
|
-
default: {
|
|
17
|
-
slot: string;
|
|
18
|
-
};
|
|
19
|
-
content: {};
|
|
16
|
+
default: {};
|
|
20
17
|
};
|
|
21
18
|
};
|
|
22
19
|
export declare type TooltipProps = typeof __propDef.props;
|
package/types.d.ts
CHANGED
|
@@ -157,16 +157,12 @@ export declare type ReviewType = {
|
|
|
157
157
|
imgSrc: string;
|
|
158
158
|
imgAlt: string;
|
|
159
159
|
address: string | undefined;
|
|
160
|
-
addressIcon: typeof SvelteComponent | undefined;
|
|
161
160
|
reviewDate: string | undefined;
|
|
162
161
|
title: string;
|
|
163
162
|
rating: number;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
option1Icon: typeof SvelteComponent | undefined;
|
|
168
|
-
option2: string | undefined;
|
|
169
|
-
option2Icon: typeof SvelteComponent | undefined;
|
|
163
|
+
item1: string | undefined;
|
|
164
|
+
item2: string | undefined;
|
|
165
|
+
item3: string | undefined;
|
|
170
166
|
};
|
|
171
167
|
export declare type SelectOptionType = {
|
|
172
168
|
name: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script>export let size = '24';
|
|
2
|
+
export let color = 'currentColor';
|
|
3
|
+
export let variation = 'outline';
|
|
4
|
+
let viewBox;
|
|
5
|
+
let svgpath;
|
|
6
|
+
let svgoutline = `<path d="M11.25 11.25L11.2915 11.2293C11.8646 10.9427 12.5099 11.4603 12.3545 12.082L11.6455 14.918C11.4901 15.5397 12.1354 16.0573 12.7085 15.7707L12.75 15.75M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM12 8.25H12.0075V8.2575H12V8.25Z" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> `;
|
|
7
|
+
let svgsolid = `<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 12C2.25 6.61522 6.61522 2.25 12 2.25C17.3848 2.25 21.75 6.61522 21.75 12C21.75 17.3848 17.3848 21.75 12 21.75C6.61522 21.75 2.25 17.3848 2.25 12ZM10.9562 10.5584C12.1025 9.98533 13.3931 11.0206 13.0823 12.2639L12.3733 15.0999L12.4148 15.0792C12.7852 14.894 13.2357 15.0441 13.421 15.4146C13.6062 15.7851 13.4561 16.2356 13.0856 16.4208L13.0441 16.4416C11.8979 17.0147 10.6072 15.9794 10.9181 14.7361L11.6271 11.9001L11.5856 11.9208C11.2151 12.1061 10.7646 11.9559 10.5793 11.5854C10.3941 11.2149 10.5443 10.7644 10.9148 10.5792L10.9562 10.5584ZM12 9C12.4142 9 12.75 8.66421 12.75 8.25C12.75 7.83579 12.4142 7.5 12 7.5C11.5858 7.5 11.25 7.83579 11.25 8.25C11.25 8.66421 11.5858 9 12 9Z" fill="${color}"/> `;
|
|
8
|
+
$: switch (variation) {
|
|
9
|
+
case 'outline':
|
|
10
|
+
svgpath = svgoutline;
|
|
11
|
+
viewBox = '0 0 24 24';
|
|
12
|
+
break;
|
|
13
|
+
case 'solid':
|
|
14
|
+
svgpath = svgsolid;
|
|
15
|
+
viewBox = '0 0 24 24';
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
svgpath = svgoutline;
|
|
19
|
+
viewBox = '0 0 24 24';
|
|
20
|
+
}
|
|
21
|
+
export let ariaLabel = 'information circle';
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
width={size}
|
|
27
|
+
height={size}
|
|
28
|
+
class={$$props.class}
|
|
29
|
+
{...$$restProps}
|
|
30
|
+
aria-label={ariaLabel}
|
|
31
|
+
fill="none"
|
|
32
|
+
{viewBox}
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
on:click
|
|
35
|
+
>
|
|
36
|
+
{@html svgpath}
|
|
37
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
size?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
variation?: 'solid' | 'outline';
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export declare type InformationCircleProps = typeof __propDef.props;
|
|
18
|
+
export declare type InformationCircleEvents = typeof __propDef.events;
|
|
19
|
+
export declare type InformationCircleSlots = typeof __propDef.slots;
|
|
20
|
+
export default class InformationCircle extends SvelteComponentTyped<InformationCircleProps, InformationCircleEvents, InformationCircleSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
package/utils/Popper.svelte
CHANGED
|
@@ -1,84 +1,112 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { onMount } from 'svelte';
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
2
3
|
import { createPopper } from '@popperjs/core';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
5
|
+
import createEventDispatcher from './createEventDispatcher';
|
|
6
|
+
export let activeContent = false;
|
|
7
|
+
export let animation = 100;
|
|
8
|
+
export let arrow = true;
|
|
7
9
|
export let offset = 8;
|
|
10
|
+
export let placement = 'top';
|
|
8
11
|
export let trigger = 'hover';
|
|
9
|
-
export let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
export let triggeredBy;
|
|
13
|
+
const dispatch = createEventDispatcher();
|
|
14
|
+
let open = false;
|
|
12
15
|
let clickable;
|
|
13
16
|
$: clickable = trigger === 'click';
|
|
14
|
-
|
|
17
|
+
$: dispatch('show', triggerEl, open);
|
|
18
|
+
let triggerEl;
|
|
19
|
+
let triggerEls = [];
|
|
20
|
+
let popper;
|
|
15
21
|
let _blocked = false; // managment of the race condition between focusin and click events
|
|
16
|
-
const block = () => ((_blocked = true), setTimeout(() => (_blocked = false),
|
|
22
|
+
const block = () => ((_blocked = true), setTimeout(() => (_blocked = false), 250));
|
|
17
23
|
const showHandler = (ev) => {
|
|
24
|
+
if (triggerEl === undefined)
|
|
25
|
+
triggerEl = ev.target;
|
|
26
|
+
else if (triggerEls.includes(ev.target) && triggerEl !== ev.target) {
|
|
27
|
+
triggerEl = ev.target;
|
|
28
|
+
block();
|
|
29
|
+
}
|
|
18
30
|
if (clickable && ev.type === 'focusin' && !open)
|
|
19
31
|
block();
|
|
20
|
-
open = ev.type === 'click' && !_blocked ? !open : true;
|
|
32
|
+
open = clickable && ev.type === 'click' && !_blocked ? !open : true;
|
|
21
33
|
};
|
|
34
|
+
// reactivity
|
|
35
|
+
$: popper && (popper.state.elements.reference = triggerEl) && popper.setOptions({ placement });
|
|
36
|
+
// typescript typeguards - poper.state.element.reference: Element|HTMLElement|VirtualElement
|
|
37
|
+
const hasHover = (el) => el.matches && el.matches(':hover');
|
|
38
|
+
const hasFocus = (el) => el.contains && el.contains(document.activeElement);
|
|
22
39
|
const hideHandler = (ev) => {
|
|
23
|
-
if (activeContent)
|
|
24
|
-
setTimeout(() =>
|
|
25
|
-
|
|
26
|
-
(
|
|
40
|
+
if (activeContent) {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
const elements = Object.values(popper?.state.elements ?? {});
|
|
43
|
+
if (ev.type === 'mouseleave' && elements.some(hasHover))
|
|
44
|
+
return;
|
|
45
|
+
if (ev.type === 'focusout' && elements.some(hasFocus))
|
|
46
|
+
return;
|
|
47
|
+
open = false;
|
|
48
|
+
}, 100);
|
|
49
|
+
}
|
|
27
50
|
else
|
|
28
51
|
open = false;
|
|
29
52
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return modifiers;
|
|
53
|
+
function init(node, _open) {
|
|
54
|
+
popper = createPopper(triggerEl, node, {
|
|
55
|
+
placement,
|
|
56
|
+
modifiers: [
|
|
57
|
+
{ name: 'offset', options: { offset: [0, offset] } },
|
|
58
|
+
{ name: 'eventListeners', enabled: open }
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
destroy() {
|
|
63
|
+
popper.destroy();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
44
66
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
onMount(() => {
|
|
68
|
+
const events = [
|
|
69
|
+
['focusin', showHandler, true],
|
|
70
|
+
['focusout', hideHandler, true],
|
|
71
|
+
['click', showHandler, clickable],
|
|
72
|
+
['mouseenter', showHandler, !clickable],
|
|
73
|
+
['mouseleave', hideHandler, !clickable]
|
|
74
|
+
];
|
|
75
|
+
triggerEls = [...document.querySelectorAll(triggeredBy)];
|
|
76
|
+
if (!triggerEls.length)
|
|
77
|
+
console.error('no triggers given');
|
|
78
|
+
triggerEls.forEach((element) => {
|
|
79
|
+
if (element.tabIndex < 0)
|
|
80
|
+
element.tabIndex = 0; // trigger must be focusable
|
|
81
|
+
for (const [name, handler, cond] of events)
|
|
82
|
+
if (cond)
|
|
83
|
+
element.addEventListener(name, handler);
|
|
84
|
+
});
|
|
85
|
+
return () => {
|
|
86
|
+
triggerEl = undefined;
|
|
87
|
+
triggerEls.forEach((element) => {
|
|
88
|
+
if (element) {
|
|
89
|
+
for (const [name, handler] of events)
|
|
90
|
+
element.removeEventListener(name, handler);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
});
|
|
58
95
|
</script>
|
|
59
96
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
on:focusin={activeContent ? showHandler : undefined}
|
|
77
|
-
on:focusout={activeContent ? hideHandler : undefined}
|
|
78
|
-
on:mouseenter={activeContent && !clickable ? showHandler : undefined}
|
|
79
|
-
on:mouseleave={activeContent && !clickable ? hideHandler : undefined}
|
|
80
|
-
style="position: absolute;"
|
|
81
|
-
>
|
|
82
|
-
<slot />
|
|
83
|
-
{#if arrow}<div data-popper-arrow />{/if}
|
|
84
|
-
</div>
|
|
97
|
+
{#if open}
|
|
98
|
+
<div
|
|
99
|
+
use:init={open}
|
|
100
|
+
transition:fade={{ duration: animation ? animation : 0 }}
|
|
101
|
+
role="tooltip"
|
|
102
|
+
tabIndex={activeContent ? -1 : undefined}
|
|
103
|
+
class={classNames('z-10', $$props.class)}
|
|
104
|
+
on:focusin={activeContent ? showHandler : undefined}
|
|
105
|
+
on:focusout={activeContent ? hideHandler : undefined}
|
|
106
|
+
on:mouseenter={activeContent && !clickable ? showHandler : undefined}
|
|
107
|
+
on:mouseleave={activeContent && !clickable ? hideHandler : undefined}
|
|
108
|
+
style="position: absolute;">
|
|
109
|
+
<slot />
|
|
110
|
+
{#if arrow}<div data-popper-arrow />{/if}
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
package/utils/Popper.svelte.d.ts
CHANGED
|
@@ -3,21 +3,18 @@ import type { Placement } from '@popperjs/core';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
activeContent?: boolean;
|
|
7
|
+
animation?: false | number;
|
|
8
|
+
arrow?: boolean;
|
|
8
9
|
offset?: number;
|
|
10
|
+
placement?: Placement;
|
|
9
11
|
trigger?: 'hover' | 'click';
|
|
10
|
-
|
|
11
|
-
animation?: false | `duration-${number}`;
|
|
12
|
-
activeContent: boolean;
|
|
12
|
+
triggeredBy: string;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
15
|
-
show: CustomEvent<any>;
|
|
16
|
-
} & {
|
|
17
15
|
[evt: string]: CustomEvent<any>;
|
|
18
16
|
};
|
|
19
17
|
slots: {
|
|
20
|
-
trigger: {};
|
|
21
18
|
default: {};
|
|
22
19
|
};
|
|
23
20
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script>export let size = '24';
|
|
2
|
+
export let color = 'currentColor';
|
|
3
|
+
export let variation = 'outline';
|
|
4
|
+
let viewBox;
|
|
5
|
+
let svgpath;
|
|
6
|
+
let svgoutline = `<path d="M17.9815 18.7248C16.6121 16.9175 14.4424 15.75 12 15.75C9.55761 15.75 7.38789 16.9175 6.01846 18.7248M17.9815 18.7248C19.8335 17.0763 21 14.6744 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 14.6744 4.1665 17.0763 6.01846 18.7248M17.9815 18.7248C16.3915 20.1401 14.2962 21 12 21C9.70383 21 7.60851 20.1401 6.01846 18.7248M15 9.75C15 11.4069 13.6569 12.75 12 12.75C10.3431 12.75 9 11.4069 9 9.75C9 8.09315 10.3431 6.75 12 6.75C13.6569 6.75 15 8.09315 15 9.75Z" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> `;
|
|
7
|
+
let svgsolid = `<path fill-rule="evenodd" clip-rule="evenodd" d="M18.6854 19.0971C20.5721 17.3191 21.75 14.7971 21.75 12C21.75 6.61522 17.3848 2.25 12 2.25C6.61522 2.25 2.25 6.61522 2.25 12C2.25 14.7971 3.42785 17.3191 5.31463 19.0971C7.06012 20.7419 9.41234 21.75 12 21.75C14.5877 21.75 16.9399 20.7419 18.6854 19.0971ZM6.14512 17.8123C7.51961 16.0978 9.63161 15 12 15C14.3684 15 16.4804 16.0978 17.8549 17.8123C16.3603 19.3178 14.289 20.25 12 20.25C9.711 20.25 7.63973 19.3178 6.14512 17.8123ZM15.75 9C15.75 11.0711 14.0711 12.75 12 12.75C9.92893 12.75 8.25 11.0711 8.25 9C8.25 6.92893 9.92893 5.25 12 5.25C14.0711 5.25 15.75 6.92893 15.75 9Z" fill="${color}"/> `;
|
|
8
|
+
$: switch (variation) {
|
|
9
|
+
case 'outline':
|
|
10
|
+
svgpath = svgoutline;
|
|
11
|
+
viewBox = '0 0 24 24';
|
|
12
|
+
break;
|
|
13
|
+
case 'solid':
|
|
14
|
+
svgpath = svgsolid;
|
|
15
|
+
viewBox = '0 0 24 24';
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
svgpath = svgoutline;
|
|
19
|
+
viewBox = '0 0 24 24';
|
|
20
|
+
}
|
|
21
|
+
export let ariaLabel = 'user circle';
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
width={size}
|
|
27
|
+
height={size}
|
|
28
|
+
class={$$props.class}
|
|
29
|
+
{...$$restProps}
|
|
30
|
+
aria-label={ariaLabel}
|
|
31
|
+
fill="none"
|
|
32
|
+
{viewBox}
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
on:click
|
|
35
|
+
>
|
|
36
|
+
{@html svgpath}
|
|
37
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
size?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
variation?: 'solid' | 'outline';
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export declare type UserCircleProps = typeof __propDef.props;
|
|
18
|
+
export declare type UserCircleEvents = typeof __propDef.events;
|
|
19
|
+
export declare type UserCircleSlots = typeof __propDef.slots;
|
|
20
|
+
export default class UserCircle extends SvelteComponentTyped<UserCircleProps, UserCircleEvents, UserCircleSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Custom Event Dispatcher
|
|
3
|
+
|
|
4
|
+
Sets `target` in event data.
|
|
5
|
+
|
|
6
|
+
https://svelte.dev/repl/c93cbf99a8ca4f44912e662a8e3cbef7?version=3.37.0
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { get_current_component } from 'svelte/internal';
|
|
11
|
+
|
|
12
|
+
export default function createEventDispatcher() {
|
|
13
|
+
const component = get_current_component();
|
|
14
|
+
return (type, target, detail) => {
|
|
15
|
+
const callbacks = component.$$.callbacks[type];
|
|
16
|
+
if (callbacks) {
|
|
17
|
+
const event = new CustomEvent(type, { detail });
|
|
18
|
+
target.dispatchEvent(event);
|
|
19
|
+
callbacks.slice().forEach((fn) => {
|
|
20
|
+
fn.call(component, event);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|