polymorph-ui-components 0.1.0
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/README.md +354 -0
- package/dist/Accordion/Accordion.svelte +28 -0
- package/dist/Accordion/Accordion.svelte.d.ts +4 -0
- package/dist/Accordion/properties.d.ts +7 -0
- package/dist/Accordion/properties.js +1 -0
- package/dist/Animations/ModalAnimation.svelte +55 -0
- package/dist/Animations/ModalAnimation.svelte.d.ts +12 -0
- package/dist/Animations/OverlayAnimation.svelte +14 -0
- package/dist/Animations/OverlayAnimation.svelte.d.ts +7 -0
- package/dist/Avatar/Avatar.svelte +122 -0
- package/dist/Avatar/Avatar.svelte.d.ts +4 -0
- package/dist/Avatar/properties.d.ts +15 -0
- package/dist/Avatar/properties.js +1 -0
- package/dist/Badge/Badge.svelte +53 -0
- package/dist/Badge/Badge.svelte.d.ts +4 -0
- package/dist/Badge/properties.d.ts +6 -0
- package/dist/Badge/properties.js +1 -0
- package/dist/Banner/Banner.svelte +158 -0
- package/dist/Banner/Banner.svelte.d.ts +4 -0
- package/dist/Banner/properties.d.ts +19 -0
- package/dist/Banner/properties.js +1 -0
- package/dist/Book/Book.svelte +281 -0
- package/dist/Book/Book.svelte.d.ts +4 -0
- package/dist/Book/properties.d.ts +24 -0
- package/dist/Book/properties.js +1 -0
- package/dist/Browser/Browser.svelte +176 -0
- package/dist/Browser/Browser.svelte.d.ts +3 -0
- package/dist/Browser/properties.d.ts +14 -0
- package/dist/Browser/properties.js +1 -0
- package/dist/Button/Button.svelte +153 -0
- package/dist/Button/Button.svelte.d.ts +4 -0
- package/dist/Button/properties.d.ts +24 -0
- package/dist/Button/properties.js +1 -0
- package/dist/Calendar/Calendar.svelte +477 -0
- package/dist/Calendar/Calendar.svelte.d.ts +4 -0
- package/dist/Calendar/properties.d.ts +30 -0
- package/dist/Calendar/properties.js +1 -0
- package/dist/Carousel/Carousel.svelte +258 -0
- package/dist/Carousel/Carousel.svelte.d.ts +4 -0
- package/dist/Carousel/properties.d.ts +20 -0
- package/dist/Carousel/properties.js +1 -0
- package/dist/CheckListItem/CheckListItem.svelte +65 -0
- package/dist/CheckListItem/CheckListItem.svelte.d.ts +4 -0
- package/dist/CheckListItem/properties.d.ts +15 -0
- package/dist/CheckListItem/properties.js +1 -0
- package/dist/Checkbox/Checkbox.svelte +157 -0
- package/dist/Checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/Checkbox/properties.d.ts +17 -0
- package/dist/Checkbox/properties.js +1 -0
- package/dist/Choicebox/Choicebox.svelte +85 -0
- package/dist/Choicebox/Choicebox.svelte.d.ts +4 -0
- package/dist/Choicebox/properties.d.ts +14 -0
- package/dist/Choicebox/properties.js +1 -0
- package/dist/ColorPicker/ColorPicker.svelte +583 -0
- package/dist/ColorPicker/ColorPicker.svelte.d.ts +4 -0
- package/dist/ColorPicker/properties.d.ts +15 -0
- package/dist/ColorPicker/properties.js +1 -0
- package/dist/Combobox/Combobox.svelte +432 -0
- package/dist/Combobox/Combobox.svelte.d.ts +6 -0
- package/dist/Combobox/properties.d.ts +42 -0
- package/dist/Combobox/properties.js +1 -0
- package/dist/CommandMenu/CommandMenu.svelte +452 -0
- package/dist/CommandMenu/CommandMenu.svelte.d.ts +4 -0
- package/dist/CommandMenu/properties.d.ts +26 -0
- package/dist/CommandMenu/properties.js +1 -0
- package/dist/ContextMenu/ContextMenu.svelte +308 -0
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +4 -0
- package/dist/ContextMenu/properties.d.ts +26 -0
- package/dist/ContextMenu/properties.js +1 -0
- package/dist/Gauge/Gauge.svelte +70 -0
- package/dist/Gauge/Gauge.svelte.d.ts +4 -0
- package/dist/Gauge/properties.d.ts +9 -0
- package/dist/Gauge/properties.js +1 -0
- package/dist/GridItem/GridItem.svelte +145 -0
- package/dist/GridItem/GridItem.svelte.d.ts +4 -0
- package/dist/GridItem/properties.d.ts +15 -0
- package/dist/GridItem/properties.js +1 -0
- package/dist/Icon/Icon.svelte +61 -0
- package/dist/Icon/Icon.svelte.d.ts +4 -0
- package/dist/Icon/properties.d.ts +12 -0
- package/dist/Icon/properties.js +1 -0
- package/dist/IconStack/IconStack.svelte +55 -0
- package/dist/IconStack/IconStack.svelte.d.ts +4 -0
- package/dist/IconStack/properties.d.ts +9 -0
- package/dist/IconStack/properties.js +1 -0
- package/dist/Img/Img.svelte +37 -0
- package/dist/Img/Img.svelte.d.ts +4 -0
- package/dist/Img/properties.d.ts +13 -0
- package/dist/Img/properties.js +1 -0
- package/dist/Input/Input.svelte +349 -0
- package/dist/Input/Input.svelte.d.ts +8 -0
- package/dist/Input/properties.d.ts +45 -0
- package/dist/Input/properties.js +1 -0
- package/dist/InputButton/InputButton.svelte +252 -0
- package/dist/InputButton/InputButton.svelte.d.ts +7 -0
- package/dist/InputButton/properties.d.ts +22 -0
- package/dist/InputButton/properties.js +1 -0
- package/dist/KeyboardInput/KeyboardInput.svelte +93 -0
- package/dist/KeyboardInput/KeyboardInput.svelte.d.ts +4 -0
- package/dist/KeyboardInput/properties.d.ts +12 -0
- package/dist/KeyboardInput/properties.js +1 -0
- package/dist/ListItem/ListItem.svelte +309 -0
- package/dist/ListItem/ListItem.svelte.d.ts +4 -0
- package/dist/ListItem/properties.d.ts +34 -0
- package/dist/ListItem/properties.js +1 -0
- package/dist/Loader/Loader.svelte +90 -0
- package/dist/Loader/Loader.svelte.d.ts +4 -0
- package/dist/Loader/properties.d.ts +4 -0
- package/dist/Loader/properties.js +1 -0
- package/dist/LoadingDots/LoadingDots.svelte +59 -0
- package/dist/LoadingDots/LoadingDots.svelte.d.ts +3 -0
- package/dist/LoadingDots/properties.d.ts +8 -0
- package/dist/LoadingDots/properties.js +1 -0
- package/dist/Menu/Menu.svelte +356 -0
- package/dist/Menu/Menu.svelte.d.ts +4 -0
- package/dist/Menu/properties.d.ts +28 -0
- package/dist/Menu/properties.js +1 -0
- package/dist/Modal/Modal.svelte +357 -0
- package/dist/Modal/Modal.svelte.d.ts +4 -0
- package/dist/Modal/properties.d.ts +39 -0
- package/dist/Modal/properties.js +1 -0
- package/dist/Pagination/Pagination.svelte +148 -0
- package/dist/Pagination/Pagination.svelte.d.ts +4 -0
- package/dist/Pagination/properties.d.ts +14 -0
- package/dist/Pagination/properties.js +1 -0
- package/dist/Phone/Phone.svelte +234 -0
- package/dist/Phone/Phone.svelte.d.ts +3 -0
- package/dist/Phone/properties.d.ts +11 -0
- package/dist/Phone/properties.js +1 -0
- package/dist/Pill/Pill.svelte +130 -0
- package/dist/Pill/Pill.svelte.d.ts +4 -0
- package/dist/Pill/properties.d.ts +16 -0
- package/dist/Pill/properties.js +1 -0
- package/dist/Progress/Progress.svelte +68 -0
- package/dist/Progress/Progress.svelte.d.ts +4 -0
- package/dist/Progress/properties.d.ts +10 -0
- package/dist/Progress/properties.js +1 -0
- package/dist/Radio/Radio.svelte +124 -0
- package/dist/Radio/Radio.svelte.d.ts +4 -0
- package/dist/Radio/properties.d.ts +15 -0
- package/dist/Radio/properties.js +1 -0
- package/dist/RelativeTime/RelativeTime.svelte +109 -0
- package/dist/RelativeTime/RelativeTime.svelte.d.ts +4 -0
- package/dist/RelativeTime/properties.d.ts +13 -0
- package/dist/RelativeTime/properties.js +1 -0
- package/dist/Scroller/Scroller.svelte +390 -0
- package/dist/Scroller/Scroller.svelte.d.ts +4 -0
- package/dist/Scroller/properties.d.ts +30 -0
- package/dist/Scroller/properties.js +1 -0
- package/dist/Select/Select.svelte +472 -0
- package/dist/Select/Select.svelte.d.ts +4 -0
- package/dist/Select/properties.d.ts +20 -0
- package/dist/Select/properties.js +1 -0
- package/dist/Sheet/Sheet.svelte +264 -0
- package/dist/Sheet/Sheet.svelte.d.ts +4 -0
- package/dist/Sheet/properties.d.ts +19 -0
- package/dist/Sheet/properties.js +1 -0
- package/dist/Shimmer/Shimmer.svelte +44 -0
- package/dist/Shimmer/Shimmer.svelte.d.ts +4 -0
- package/dist/Shimmer/properties.d.ts +4 -0
- package/dist/Shimmer/properties.js +1 -0
- package/dist/Slider/Slider.svelte +147 -0
- package/dist/Slider/Slider.svelte.d.ts +4 -0
- package/dist/Slider/properties.d.ts +17 -0
- package/dist/Slider/properties.js +1 -0
- package/dist/Snippet/Snippet.svelte +123 -0
- package/dist/Snippet/Snippet.svelte.d.ts +4 -0
- package/dist/Snippet/properties.d.ts +15 -0
- package/dist/Snippet/properties.js +1 -0
- package/dist/SplitButton/SplitButton.svelte +145 -0
- package/dist/SplitButton/SplitButton.svelte.d.ts +4 -0
- package/dist/SplitButton/properties.d.ts +17 -0
- package/dist/SplitButton/properties.js +1 -0
- package/dist/SplitInput/SplitInput.svelte +225 -0
- package/dist/SplitInput/SplitInput.svelte.d.ts +7 -0
- package/dist/SplitInput/properties.d.ts +20 -0
- package/dist/SplitInput/properties.js +1 -0
- package/dist/Stepper/Step.svelte +88 -0
- package/dist/Stepper/Step.svelte.d.ts +4 -0
- package/dist/Stepper/Stepper.svelte +64 -0
- package/dist/Stepper/Stepper.svelte.d.ts +4 -0
- package/dist/Stepper/properties.d.ts +27 -0
- package/dist/Stepper/properties.js +1 -0
- package/dist/Table/Table.svelte +357 -0
- package/dist/Table/Table.svelte.d.ts +4 -0
- package/dist/Table/properties.d.ts +26 -0
- package/dist/Table/properties.js +1 -0
- package/dist/Tabs/Tabs.svelte +303 -0
- package/dist/Tabs/Tabs.svelte.d.ts +4 -0
- package/dist/Tabs/properties.d.ts +30 -0
- package/dist/Tabs/properties.js +1 -0
- package/dist/ThemeSwitcher/ThemeSwitcher.svelte +249 -0
- package/dist/ThemeSwitcher/ThemeSwitcher.svelte.d.ts +4 -0
- package/dist/ThemeSwitcher/properties.d.ts +19 -0
- package/dist/ThemeSwitcher/properties.js +1 -0
- package/dist/Toast/Toast.svelte +220 -0
- package/dist/Toast/Toast.svelte.d.ts +4 -0
- package/dist/Toast/properties.d.ts +24 -0
- package/dist/Toast/properties.js +1 -0
- package/dist/Toggle/Toggle.svelte +99 -0
- package/dist/Toggle/Toggle.svelte.d.ts +4 -0
- package/dist/Toggle/properties.d.ts +9 -0
- package/dist/Toggle/properties.js +1 -0
- package/dist/Toolbar/Toolbar.svelte +142 -0
- package/dist/Toolbar/Toolbar.svelte.d.ts +4 -0
- package/dist/Toolbar/properties.d.ts +16 -0
- package/dist/Toolbar/properties.js +1 -0
- package/dist/Tooltip/Tooltip.svelte +153 -0
- package/dist/Tooltip/Tooltip.svelte.d.ts +4 -0
- package/dist/Tooltip/properties.d.ts +13 -0
- package/dist/Tooltip/properties.js +1 -0
- package/dist/assets/back.svg +3 -0
- package/dist/assets/battery.svg +5 -0
- package/dist/assets/checkmark.svg +3 -0
- package/dist/assets/chevron-down-sm.svg +3 -0
- package/dist/assets/chevron-down.svg +3 -0
- package/dist/assets/chevron-left-lg.svg +3 -0
- package/dist/assets/chevron-left.svg +3 -0
- package/dist/assets/chevron-right-lg.svg +3 -0
- package/dist/assets/chevron-right.svg +3 -0
- package/dist/assets/chevron-up.svg +3 -0
- package/dist/assets/close.svg +4 -0
- package/dist/assets/copy.svg +4 -0
- package/dist/assets/error-circle.svg +5 -0
- package/dist/assets/lock.svg +3 -0
- package/dist/assets/minus.svg +3 -0
- package/dist/assets/monitor.svg +5 -0
- package/dist/assets/moon.svg +3 -0
- package/dist/assets/palette.svg +7 -0
- package/dist/assets/search.svg +4 -0
- package/dist/assets/signal.svg +6 -0
- package/dist/assets/sort-default.svg +4 -0
- package/dist/assets/sun.svg +11 -0
- package/dist/assets/swap-vertical.svg +6 -0
- package/dist/assets/wifi.svg +3 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +55 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.js +294 -0
- package/package.json +91 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ToolbarProperties } from './properties';
|
|
3
|
+
import backSvg from '../assets/back.svg?raw';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
showBackButton = true,
|
|
7
|
+
text,
|
|
8
|
+
backIcon,
|
|
9
|
+
leftContent,
|
|
10
|
+
centerContent,
|
|
11
|
+
rightContent,
|
|
12
|
+
additionalContent,
|
|
13
|
+
testId,
|
|
14
|
+
classes,
|
|
15
|
+
onbackclick,
|
|
16
|
+
onkeydown
|
|
17
|
+
}: ToolbarProperties = $props();
|
|
18
|
+
|
|
19
|
+
function handleBackKeydown(event: KeyboardEvent): void {
|
|
20
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
if (event.currentTarget instanceof HTMLElement) {
|
|
23
|
+
event.currentTarget.click();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
onkeydown?.(event);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div class="toolbar {classes ?? ''}" data-pw={testId}>
|
|
31
|
+
<div class="content">
|
|
32
|
+
{#if typeof leftContent === 'function'}
|
|
33
|
+
{@render leftContent()}
|
|
34
|
+
{:else if showBackButton}
|
|
35
|
+
<div
|
|
36
|
+
class="back"
|
|
37
|
+
onclick={onbackclick}
|
|
38
|
+
onkeydown={handleBackKeydown}
|
|
39
|
+
role="button"
|
|
40
|
+
tabindex="0"
|
|
41
|
+
aria-label="Back"
|
|
42
|
+
>
|
|
43
|
+
{#if typeof backIcon === 'string' && backIcon.length > 0}
|
|
44
|
+
<img src={backIcon} alt="Back" />
|
|
45
|
+
{:else}
|
|
46
|
+
<!-- eslint-disable svelte/no-at-html-tags -->
|
|
47
|
+
{@html backSvg}
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
{#if typeof centerContent === 'function'}
|
|
52
|
+
<div class="center-content">
|
|
53
|
+
{@render centerContent()}
|
|
54
|
+
</div>
|
|
55
|
+
{:else if typeof text === 'string' && text.length > 0}
|
|
56
|
+
<div class="text">
|
|
57
|
+
{text}
|
|
58
|
+
</div>
|
|
59
|
+
{/if}
|
|
60
|
+
{#if typeof rightContent === 'function'}
|
|
61
|
+
<div class="right-content">
|
|
62
|
+
{@render rightContent()}
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
65
|
+
</div>
|
|
66
|
+
<div class="additional-content" class:hidden={!(typeof additionalContent === 'function')}>
|
|
67
|
+
{#if typeof additionalContent === 'function'}
|
|
68
|
+
{@render additionalContent()}
|
|
69
|
+
{/if}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
.toolbar {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
padding: var(--toolbar-padding, 0px);
|
|
78
|
+
height: var(--toolbar-height, fit-content);
|
|
79
|
+
width: var(--toolbar-width, 100%);
|
|
80
|
+
position: var(--toolbar-position, sticky);
|
|
81
|
+
top: var(--toolbar-top, 0);
|
|
82
|
+
left: var(--toolbar-left, 0);
|
|
83
|
+
right: var(--toolbar-right, 0);
|
|
84
|
+
background: var(--toolbar-background, #ffffff);
|
|
85
|
+
box-shadow: var(--toolbar-box-shadow, 0px 2px 12px rgba(0, 0, 0, 0.1));
|
|
86
|
+
z-index: var(--toolbar-z-index, 10);
|
|
87
|
+
border-radius: var(--toolbar-border-radius, 0px);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.content {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
align-items: center;
|
|
94
|
+
padding: var(--toolbar-content-padding, 0px);
|
|
95
|
+
justify-content: var(--toolbar-justify-content, normal);
|
|
96
|
+
visibility: var(--toolbar-content-visibility, visible);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.additional-content {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
align-items: center;
|
|
103
|
+
padding: var(--toolbar-additional-content-padding, 0px);
|
|
104
|
+
height: var(--toolbar-additional-content-height, fit-content);
|
|
105
|
+
justify-content: var(--toolbar-justify-additional-content, normal);
|
|
106
|
+
visibility: var(--toolbar-additional-content-visibility, visible);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.hidden {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.back {
|
|
114
|
+
height: var(--toolbar-back-button-height, 20px);
|
|
115
|
+
width: var(--toolbar-back-button-width, 20px);
|
|
116
|
+
padding: var(--toolbar-back-button-padding, 20px 14px);
|
|
117
|
+
cursor: var(--toolbar-back-button-cursor, pointer);
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
align-items: center;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.back img,
|
|
124
|
+
.back :global(svg) {
|
|
125
|
+
height: var(--toolbar-back-image-height, 16px);
|
|
126
|
+
width: var(--toolbar-back-image-width, 16px);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.center-content {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex: 1;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.text {
|
|
135
|
+
font-size: var(--toolbar-text-font-size, inherit);
|
|
136
|
+
font-weight: var(--toolbar-text-font-weight, 400);
|
|
137
|
+
padding: var(--toolbar-text-padding, 0px);
|
|
138
|
+
margin: var(--toolbar-text-margin, 0px);
|
|
139
|
+
color: var(--toolbar-text-color);
|
|
140
|
+
flex: var(--toolbar-text-flex, 1);
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type ToolbarProperties = ToolbarEventProperties & {
|
|
3
|
+
showBackButton?: boolean;
|
|
4
|
+
text?: string | null;
|
|
5
|
+
backIcon?: string | null;
|
|
6
|
+
leftContent?: Snippet;
|
|
7
|
+
centerContent?: Snippet;
|
|
8
|
+
rightContent?: Snippet;
|
|
9
|
+
additionalContent?: Snippet;
|
|
10
|
+
testId?: string;
|
|
11
|
+
classes?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ToolbarEventProperties = {
|
|
14
|
+
onbackclick?: () => void;
|
|
15
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TooltipProperties } from './properties';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
text,
|
|
6
|
+
position = 'top',
|
|
7
|
+
delay = 0,
|
|
8
|
+
testId,
|
|
9
|
+
classes,
|
|
10
|
+
children
|
|
11
|
+
}: TooltipProperties = $props();
|
|
12
|
+
|
|
13
|
+
let visible = $state(false);
|
|
14
|
+
let delayTimeout = $state<ReturnType<typeof setTimeout> | null>(null);
|
|
15
|
+
|
|
16
|
+
function showTooltip() {
|
|
17
|
+
if (delay > 0) {
|
|
18
|
+
delayTimeout = setTimeout(() => {
|
|
19
|
+
visible = true;
|
|
20
|
+
}, delay);
|
|
21
|
+
} else {
|
|
22
|
+
visible = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function hideTooltip() {
|
|
27
|
+
if (delayTimeout !== null) {
|
|
28
|
+
clearTimeout(delayTimeout);
|
|
29
|
+
delayTimeout = null;
|
|
30
|
+
}
|
|
31
|
+
visible = false;
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
class="tooltip-container {classes ?? ''}"
|
|
37
|
+
role="none"
|
|
38
|
+
onmouseenter={showTooltip}
|
|
39
|
+
onmouseleave={hideTooltip}
|
|
40
|
+
onfocusin={showTooltip}
|
|
41
|
+
onfocusout={hideTooltip}
|
|
42
|
+
data-pw={testId}
|
|
43
|
+
>
|
|
44
|
+
{@render children()}
|
|
45
|
+
{#if visible}
|
|
46
|
+
<div class="tooltip-bubble {position}" role="tooltip">
|
|
47
|
+
<div class="tooltip-arrow"></div>
|
|
48
|
+
<span class="tooltip-text">{text}</span>
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
.tooltip-container {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: var(--tooltip-container-display, inline-flex);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.tooltip-bubble {
|
|
60
|
+
position: absolute;
|
|
61
|
+
z-index: var(--tooltip-z-index, 1000);
|
|
62
|
+
max-width: var(--tooltip-max-width, 200px);
|
|
63
|
+
background: var(--tooltip-background, #18181b);
|
|
64
|
+
color: var(--tooltip-color, #ffffff);
|
|
65
|
+
font-size: var(--tooltip-font-size, 12px);
|
|
66
|
+
font-weight: var(--tooltip-font-weight, 400);
|
|
67
|
+
font-family: var(--tooltip-font-family);
|
|
68
|
+
padding: var(--tooltip-padding, 6px 10px);
|
|
69
|
+
border-radius: var(--tooltip-border-radius, 8px);
|
|
70
|
+
border: var(--tooltip-border, none);
|
|
71
|
+
box-shadow: var(--tooltip-box-shadow, 0 2px 6px rgba(0, 0, 0, 0.15));
|
|
72
|
+
white-space: normal;
|
|
73
|
+
word-wrap: break-word;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
opacity: 1;
|
|
76
|
+
transition: opacity var(--tooltip-opacity-duration, 0.15s) ease-in-out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.tooltip-arrow {
|
|
80
|
+
position: absolute;
|
|
81
|
+
width: 0;
|
|
82
|
+
height: 0;
|
|
83
|
+
border-style: solid;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Top position */
|
|
87
|
+
.top {
|
|
88
|
+
bottom: calc(100% + var(--tooltip-offset, 8px));
|
|
89
|
+
left: 50%;
|
|
90
|
+
transform: translateX(-50%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.top .tooltip-arrow {
|
|
94
|
+
top: 100%;
|
|
95
|
+
left: 50%;
|
|
96
|
+
transform: translateX(-50%);
|
|
97
|
+
border-width: var(--tooltip-arrow-size, 5px) var(--tooltip-arrow-size, 5px) 0
|
|
98
|
+
var(--tooltip-arrow-size, 5px);
|
|
99
|
+
border-color: var(--tooltip-arrow-color, var(--tooltip-background, #18181b)) transparent
|
|
100
|
+
transparent transparent;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Bottom position */
|
|
104
|
+
.bottom {
|
|
105
|
+
top: calc(100% + var(--tooltip-offset, 8px));
|
|
106
|
+
left: 50%;
|
|
107
|
+
transform: translateX(-50%);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.bottom .tooltip-arrow {
|
|
111
|
+
bottom: 100%;
|
|
112
|
+
left: 50%;
|
|
113
|
+
transform: translateX(-50%);
|
|
114
|
+
border-width: 0 var(--tooltip-arrow-size, 5px) var(--tooltip-arrow-size, 5px)
|
|
115
|
+
var(--tooltip-arrow-size, 5px);
|
|
116
|
+
border-color: transparent transparent
|
|
117
|
+
var(--tooltip-arrow-color, var(--tooltip-background, #18181b)) transparent;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Left position */
|
|
121
|
+
.left {
|
|
122
|
+
right: calc(100% + var(--tooltip-offset, 8px));
|
|
123
|
+
top: 50%;
|
|
124
|
+
transform: translateY(-50%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.left .tooltip-arrow {
|
|
128
|
+
left: 100%;
|
|
129
|
+
top: 50%;
|
|
130
|
+
transform: translateY(-50%);
|
|
131
|
+
border-width: var(--tooltip-arrow-size, 5px) 0 var(--tooltip-arrow-size, 5px)
|
|
132
|
+
var(--tooltip-arrow-size, 5px);
|
|
133
|
+
border-color: transparent transparent transparent
|
|
134
|
+
var(--tooltip-arrow-color, var(--tooltip-background, #18181b));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Right position */
|
|
138
|
+
.right {
|
|
139
|
+
left: calc(100% + var(--tooltip-offset, 8px));
|
|
140
|
+
top: 50%;
|
|
141
|
+
transform: translateY(-50%);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.right .tooltip-arrow {
|
|
145
|
+
right: 100%;
|
|
146
|
+
top: 50%;
|
|
147
|
+
transform: translateY(-50%);
|
|
148
|
+
border-width: var(--tooltip-arrow-size, 5px) var(--tooltip-arrow-size, 5px)
|
|
149
|
+
var(--tooltip-arrow-size, 5px) 0;
|
|
150
|
+
border-color: transparent var(--tooltip-arrow-color, var(--tooltip-background, #18181b))
|
|
151
|
+
transparent transparent;
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type MandatoryTooltipProperties = {
|
|
4
|
+
text: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
export type OptionalTooltipProperties = {
|
|
8
|
+
position?: TooltipPosition;
|
|
9
|
+
delay?: number;
|
|
10
|
+
testId?: string | null;
|
|
11
|
+
classes?: string;
|
|
12
|
+
};
|
|
13
|
+
export type TooltipProperties = MandatoryTooltipProperties & OptionalTooltipProperties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg viewBox="0 0 28 13" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="0" y="0" width="24" height="12" rx="2" stroke="currentColor" stroke-width="1" fill="none" />
|
|
3
|
+
<rect x="2" y="2" width="18" height="8" rx="1" />
|
|
4
|
+
<rect x="25" y="3.5" width="3" height="5" rx="1" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<line x1="18" y1="6" x2="6" y2="18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<line x1="6" y1="6" x2="18" y2="18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
3
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
|
|
3
|
+
<path d="M12 8V12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
4
|
+
<circle cx="12" cy="16" r="1" fill="currentColor"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM12 17c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM15.1 8H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
|
|
3
|
+
<line x1="8" y1="21" x2="16" y2="21"></line>
|
|
4
|
+
<line x1="12" y1="17" x2="12" y2="21"></line>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="13.5" cy="6.5" r="0.5" fill="currentColor"></circle>
|
|
3
|
+
<circle cx="17.5" cy="10.5" r="0.5" fill="currentColor"></circle>
|
|
4
|
+
<circle cx="8.5" cy="7.5" r="0.5" fill="currentColor"></circle>
|
|
5
|
+
<circle cx="6.5" cy="12.5" r="0.5" fill="currentColor"></circle>
|
|
6
|
+
<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"></path>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg viewBox="0 0 18 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="0" y="8" width="3" height="4" rx="0.5" />
|
|
3
|
+
<rect x="5" y="5" width="3" height="7" rx="0.5" />
|
|
4
|
+
<rect x="10" y="2" width="3" height="10" rx="0.5" />
|
|
5
|
+
<rect x="15" y="0" width="3" height="12" rx="0.5" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<polyline points="18 15 12 9 6 15" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
3
|
+
<polyline points="6 17 12 23 18 17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="12" cy="12" r="5"></circle>
|
|
3
|
+
<line x1="12" y1="1" x2="12" y2="3"></line>
|
|
4
|
+
<line x1="12" y1="21" x2="12" y2="23"></line>
|
|
5
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
|
6
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
|
7
|
+
<line x1="1" y1="12" x2="3" y2="12"></line>
|
|
8
|
+
<line x1="21" y1="12" x2="23" y2="12"></line>
|
|
9
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
|
10
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M7 4v16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M3 8l4-4 4 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M17 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M13 16l4 4 4-4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg viewBox="0 0 16 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M8 2.4C5.6 2.4 3.5 3.4 2 5l1.4 1.4C4.6 5.2 6.2 4.4 8 4.4s3.4.8 4.6 2l1.4-1.4C12.5 3.4 10.4 2.4 8 2.4zM8 6.4c-1.4 0-2.6.6-3.4 1.4L6 9.2c.5-.5 1.2-.8 2-.8s1.5.3 2 .8l1.4-1.4C10.6 7 9.4 6.4 8 6.4zM8 10.4c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z" />
|
|
3
|
+
</svg>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export { default as Modal } from './Modal/Modal.svelte';
|
|
2
|
+
export { default as Button } from './Button/Button.svelte';
|
|
3
|
+
export { default as Input } from './Input/Input.svelte';
|
|
4
|
+
export { default as InputButton } from './InputButton/InputButton.svelte';
|
|
5
|
+
export { default as ListItem } from './ListItem/ListItem.svelte';
|
|
6
|
+
export { default as Loader } from './Loader/Loader.svelte';
|
|
7
|
+
export { default as Toolbar } from './Toolbar/Toolbar.svelte';
|
|
8
|
+
export { default as Icon } from './Icon/Icon.svelte';
|
|
9
|
+
export { default as Select } from './Select/Select.svelte';
|
|
10
|
+
export { default as ModalAnimation } from './Animations/ModalAnimation.svelte';
|
|
11
|
+
export { default as OverlayAnimation } from './Animations/OverlayAnimation.svelte';
|
|
12
|
+
export { default as Carousel } from './Carousel/Carousel.svelte';
|
|
13
|
+
export { default as Badge } from './Badge/Badge.svelte';
|
|
14
|
+
export { default as Banner } from './Banner/Banner.svelte';
|
|
15
|
+
export { default as Toggle } from './Toggle/Toggle.svelte';
|
|
16
|
+
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
17
|
+
export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
|
|
18
|
+
export { default as Table } from './Table/Table.svelte';
|
|
19
|
+
export { default as Stepper } from './Stepper/Stepper.svelte';
|
|
20
|
+
export { default as Step } from './Stepper/Step.svelte';
|
|
21
|
+
export { default as Toast } from './Toast/Toast.svelte';
|
|
22
|
+
export { default as GridItem } from './GridItem/GridItem.svelte';
|
|
23
|
+
export { default as IconStack } from './IconStack/IconStack.svelte';
|
|
24
|
+
export { default as Img } from './Img/Img.svelte';
|
|
25
|
+
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
26
|
+
export { default as Radio } from './Radio/Radio.svelte';
|
|
27
|
+
export { default as Avatar } from './Avatar/Avatar.svelte';
|
|
28
|
+
export { default as Tabs } from './Tabs/Tabs.svelte';
|
|
29
|
+
export { default as Choicebox } from './Choicebox/Choicebox.svelte';
|
|
30
|
+
export { default as Slider } from './Slider/Slider.svelte';
|
|
31
|
+
export { default as Tooltip } from './Tooltip/Tooltip.svelte';
|
|
32
|
+
export { default as Shimmer } from './Shimmer/Shimmer.svelte';
|
|
33
|
+
export { default as Progress } from './Progress/Progress.svelte';
|
|
34
|
+
export { default as Pill } from './Pill/Pill.svelte';
|
|
35
|
+
export { default as Pagination } from './Pagination/Pagination.svelte';
|
|
36
|
+
export { default as Snippet } from './Snippet/Snippet.svelte';
|
|
37
|
+
export { default as Gauge } from './Gauge/Gauge.svelte';
|
|
38
|
+
export { default as SplitButton } from './SplitButton/SplitButton.svelte';
|
|
39
|
+
export { default as KeyboardInput } from './KeyboardInput/KeyboardInput.svelte';
|
|
40
|
+
export { default as LoadingDots } from './LoadingDots/LoadingDots.svelte';
|
|
41
|
+
export { default as Menu } from './Menu/Menu.svelte';
|
|
42
|
+
export { default as Sheet } from './Sheet/Sheet.svelte';
|
|
43
|
+
export { default as Scroller } from './Scroller/Scroller.svelte';
|
|
44
|
+
export { default as CommandMenu } from './CommandMenu/CommandMenu.svelte';
|
|
45
|
+
export { default as ContextMenu } from './ContextMenu/ContextMenu.svelte';
|
|
46
|
+
export { default as Calendar } from './Calendar/Calendar.svelte';
|
|
47
|
+
export { default as RelativeTime } from './RelativeTime/RelativeTime.svelte';
|
|
48
|
+
export { default as ThemeSwitcher } from './ThemeSwitcher/ThemeSwitcher.svelte';
|
|
49
|
+
export { default as Book } from './Book/Book.svelte';
|
|
50
|
+
export { default as Browser } from './Browser/Browser.svelte';
|
|
51
|
+
export { default as Phone } from './Phone/Phone.svelte';
|
|
52
|
+
export { default as Combobox } from './Combobox/Combobox.svelte';
|
|
53
|
+
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
54
|
+
export { default as SplitInput } from './SplitInput/SplitInput.svelte';
|
|
55
|
+
export type * from './Button/properties';
|
|
56
|
+
export type * from './Modal/properties';
|
|
57
|
+
export type * from './Input/properties';
|
|
58
|
+
export type * from './InputButton/properties';
|
|
59
|
+
export type * from './ListItem/properties';
|
|
60
|
+
export type * from './types';
|
|
61
|
+
export type * from './Icon/properties';
|
|
62
|
+
export type * from './Select/properties';
|
|
63
|
+
export type * from './Toolbar/properties';
|
|
64
|
+
export type * from './Carousel/properties';
|
|
65
|
+
export type * from './Badge/properties';
|
|
66
|
+
export type * from './Banner/properties';
|
|
67
|
+
export type * from './Table/properties';
|
|
68
|
+
export type * from './Stepper/properties';
|
|
69
|
+
export type * from './Toast/properties';
|
|
70
|
+
export type * from './IconStack/properties';
|
|
71
|
+
export type * from './Img/properties';
|
|
72
|
+
export type * from './Checkbox/properties';
|
|
73
|
+
export type * from './Radio/properties';
|
|
74
|
+
export type * from './Avatar/properties';
|
|
75
|
+
export type * from './Tabs/properties';
|
|
76
|
+
export type * from './Choicebox/properties';
|
|
77
|
+
export type * from './Slider/properties';
|
|
78
|
+
export type * from './Tooltip/properties';
|
|
79
|
+
export type * from './Shimmer/properties';
|
|
80
|
+
export type * from './Progress/properties';
|
|
81
|
+
export type * from './Pill/properties';
|
|
82
|
+
export type * from './Pagination/properties';
|
|
83
|
+
export type * from './Snippet/properties';
|
|
84
|
+
export type * from './Gauge/properties';
|
|
85
|
+
export type * from './SplitButton/properties';
|
|
86
|
+
export type * from './KeyboardInput/properties';
|
|
87
|
+
export type * from './LoadingDots/properties';
|
|
88
|
+
export type * from './Menu/properties';
|
|
89
|
+
export type * from './Sheet/properties';
|
|
90
|
+
export type * from './Scroller/properties';
|
|
91
|
+
export type * from './CommandMenu/properties';
|
|
92
|
+
export type * from './ContextMenu/properties';
|
|
93
|
+
export type * from './Calendar/properties';
|
|
94
|
+
export type * from './RelativeTime/properties';
|
|
95
|
+
export type * from './ThemeSwitcher/properties';
|
|
96
|
+
export type * from './Book/properties';
|
|
97
|
+
export type * from './Browser/properties';
|
|
98
|
+
export type * from './Phone/properties';
|
|
99
|
+
export type * from './Loader/properties';
|
|
100
|
+
export type * from './Combobox/properties';
|
|
101
|
+
export type * from './ColorPicker/properties';
|
|
102
|
+
export type * from './SplitInput/properties';
|
|
103
|
+
export { validateInput } from './utils';
|