hamzus-ui 0.0.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/README.md +38 -0
- package/index.js +6 -0
- package/package.json +48 -0
- package/src/components/hamzus-ui/AdvancedTooltip/Content.svelte +22 -0
- package/src/components/hamzus-ui/AdvancedTooltip/Label.svelte +1 -0
- package/src/components/hamzus-ui/AdvancedTooltip/Root.svelte +336 -0
- package/src/components/hamzus-ui/AdvancedTooltip/Separator.svelte +12 -0
- package/src/components/hamzus-ui/AdvancedTooltip/Trigger.svelte +5 -0
- package/src/components/hamzus-ui/AdvancedTooltip/index.js +5 -0
- package/src/components/hamzus-ui/AlertCard/AlertCard.svelte +32 -0
- package/src/components/hamzus-ui/Avatar/Avatar.svelte +32 -0
- package/src/components/hamzus-ui/Button/Button.svelte +79 -0
- package/src/components/hamzus-ui/Button/Button_default.svelte +142 -0
- package/src/components/hamzus-ui/Button/Button_link.svelte +138 -0
- package/src/components/hamzus-ui/Checkboxes/Checkbox/Checkbox.svelte +41 -0
- package/src/components/hamzus-ui/Checkboxes/Checkbox/index.css +68 -0
- package/src/components/hamzus-ui/Checkboxes/CheckboxCard/CheckboxCard.svelte +27 -0
- package/src/components/hamzus-ui/Checkboxes/CheckboxCard/index.css +54 -0
- package/src/components/hamzus-ui/Code/Code.svelte +192 -0
- package/src/components/hamzus-ui/CopyCode/CopyCode.svelte +55 -0
- package/src/components/hamzus-ui/CopyLabel/CopyLabel.svelte +43 -0
- package/src/components/hamzus-ui/DataList/DataList.svelte +82 -0
- package/src/components/hamzus-ui/DatePicker/DatePicker.svelte +326 -0
- package/src/components/hamzus-ui/Dialog/Dialog.svelte +61 -0
- package/src/components/hamzus-ui/DropdownMenu/Button.svelte +46 -0
- package/src/components/hamzus-ui/DropdownMenu/Content.svelte +22 -0
- package/src/components/hamzus-ui/DropdownMenu/Label.svelte +1 -0
- package/src/components/hamzus-ui/DropdownMenu/Root.svelte +340 -0
- package/src/components/hamzus-ui/DropdownMenu/Separator.svelte +12 -0
- package/src/components/hamzus-ui/DropdownMenu/Trigger.svelte +1 -0
- package/src/components/hamzus-ui/DropdownMenu/index.js +6 -0
- package/src/components/hamzus-ui/IconButton/IconButton.svelte +80 -0
- package/src/components/hamzus-ui/IconButton/IconButton_default.svelte +140 -0
- package/src/components/hamzus-ui/IconButton/IconButton_link.svelte +141 -0
- package/src/components/hamzus-ui/InfoCard/InfoCard.svelte +32 -0
- package/src/components/hamzus-ui/Input/Input.svelte +304 -0
- package/src/components/hamzus-ui/KBD/KBD.svelte +24 -0
- package/src/components/hamzus-ui/Link/Link.svelte +36 -0
- package/src/components/hamzus-ui/List/List.svelte +30 -0
- package/src/components/hamzus-ui/LoaderCircle/Loader.svelte +25 -0
- package/src/components/hamzus-ui/LoaderCircle/index.js +1 -0
- package/src/components/hamzus-ui/Popover/Button.svelte +46 -0
- package/src/components/hamzus-ui/Popover/Content.svelte +21 -0
- package/src/components/hamzus-ui/Popover/Label.svelte +1 -0
- package/src/components/hamzus-ui/Popover/Root.svelte +374 -0
- package/src/components/hamzus-ui/Popover/Separator.svelte +12 -0
- package/src/components/hamzus-ui/Popover/Trigger.svelte +1 -0
- package/src/components/hamzus-ui/Popover/index.js +6 -0
- package/src/components/hamzus-ui/Portal/Portal.svelte +46 -0
- package/src/components/hamzus-ui/Portal/Wormhole.svelte +7 -0
- package/src/components/hamzus-ui/Radios/Radio/Radio.svelte +43 -0
- package/src/components/hamzus-ui/Radios/Radio/index.css +68 -0
- package/src/components/hamzus-ui/Radios/RadioCard/RadioCard.svelte +32 -0
- package/src/components/hamzus-ui/Radios/RadioCard/index.css +50 -0
- package/src/components/hamzus-ui/Radios/RadioGroup/RadioGroup.svelte +46 -0
- package/src/components/hamzus-ui/Radios/RadioGroup/index.css +8 -0
- package/src/components/hamzus-ui/ScrollArea/ScrollArea.svelte +360 -0
- package/src/components/hamzus-ui/Swicth/Swicth.svelte +84 -0
- package/src/components/hamzus-ui/Swicth/index.css +120 -0
- package/src/components/hamzus-ui/Table/ActionsBar.svelte +174 -0
- package/src/components/hamzus-ui/Table/Content.svelte +68 -0
- package/src/components/hamzus-ui/Table/Header.svelte +268 -0
- package/src/components/hamzus-ui/Table/NavigationBar.svelte +10 -0
- package/src/components/hamzus-ui/Table/Root.svelte +128 -0
- package/src/components/hamzus-ui/Table/index.js +5 -0
- package/src/components/hamzus-ui/Table/table.js +48 -0
- package/src/components/hamzus-ui/Tabs/Tabs.svelte +87 -0
- package/src/components/hamzus-ui/TabsLink/Tabs.svelte +80 -0
- package/src/components/hamzus-ui/Tag/Tag.svelte +43 -0
- package/src/components/hamzus-ui/TinyScrollArea/TinyScrollArea.svelte +350 -0
- package/src/styles/font.css +71 -0
- package/src/styles/global.css +37 -0
- package/src/styles/variables.css +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# sv
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
|
4
|
+
|
|
5
|
+
## Creating a project
|
|
6
|
+
|
|
7
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# create a new project in the current directory
|
|
11
|
+
npx sv create
|
|
12
|
+
|
|
13
|
+
# create a new project in my-app
|
|
14
|
+
npx sv create my-app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Developing
|
|
18
|
+
|
|
19
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run dev
|
|
23
|
+
|
|
24
|
+
# or start the server and open the app in a new browser tab
|
|
25
|
+
npm run dev -- --open
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Building
|
|
29
|
+
|
|
30
|
+
To create a production version of your app:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can preview the production build with `npm run preview`.
|
|
37
|
+
|
|
38
|
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
package/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Button } from "./src/components/hamzus-ui/Button/Button.svelte"
|
|
2
|
+
export { default as IconButton } from "./src/components/hamzus-ui/IconButton/IconButton.svelte"
|
|
3
|
+
|
|
4
|
+
export { default as DropdownMenu } from "./src/components/hamzus-ui/DropdownMenu"
|
|
5
|
+
export { default as Popover } from "./src/components/hamzus-ui/Popover"
|
|
6
|
+
export { default as Tooltip } from "./src/components/hamzus-ui/AdvancedTooltip"
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hamzus-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"svelte": "index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"svelte": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js",
|
|
14
|
+
"src/components/hamzus-ui",
|
|
15
|
+
"src/styles"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite dev",
|
|
19
|
+
"build": "vite build",
|
|
20
|
+
"preview": "vite preview",
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"lint": "prettier --check . && eslint .",
|
|
23
|
+
"test:unit": "vitest",
|
|
24
|
+
"test": "npm run test:unit -- --run"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eslint/compat": "^1.2.3",
|
|
28
|
+
"@sveltejs/adapter-node": "^5.2.9",
|
|
29
|
+
"@sveltejs/adapter-vercel": "^5.7.2",
|
|
30
|
+
"@sveltejs/kit": "^2.0.0",
|
|
31
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
32
|
+
"eslint": "^9.7.0",
|
|
33
|
+
"eslint-config-prettier": "^9.1.0",
|
|
34
|
+
"eslint-plugin-svelte": "^2.36.0",
|
|
35
|
+
"globals": "^15.0.0",
|
|
36
|
+
"prettier": "^3.3.2",
|
|
37
|
+
"prettier-plugin-svelte": "^3.2.6",
|
|
38
|
+
"svelte": "^5.0.0",
|
|
39
|
+
"vite": "^5.4.11",
|
|
40
|
+
"vitest": "^2.0.4"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"svelte": "^5.0.0"
|
|
44
|
+
},
|
|
45
|
+
"keywords": ["svelte", "ui", "components"],
|
|
46
|
+
"author": "Hamzus",
|
|
47
|
+
"license": "MIT"
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let width = "max-content"
|
|
3
|
+
export let style = "";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class="content" style="--width:{width};{style}">
|
|
7
|
+
<slot/>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
.content{
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
row-gap: var(--pad-m);
|
|
15
|
+
padding: var(--pad-m) var(--pad-l);
|
|
16
|
+
background-color: var(--bg-2);
|
|
17
|
+
border-radius: var(--radius-l);
|
|
18
|
+
border: 1px solid var(--bg-3);
|
|
19
|
+
width: min(100vw, var(--width));
|
|
20
|
+
max-height: 100vh;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h4><slot/></h4>
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Portal from '@hamzus-ui/Portal/Portal.svelte';
|
|
3
|
+
import { onDestroy, onMount } from 'svelte';
|
|
4
|
+
|
|
5
|
+
// import
|
|
6
|
+
|
|
7
|
+
// props
|
|
8
|
+
export let direction = 'bottom';
|
|
9
|
+
export let triggerFullWidth = false;
|
|
10
|
+
// locale var
|
|
11
|
+
let display = false;
|
|
12
|
+
let exit = false;
|
|
13
|
+
|
|
14
|
+
let tooltipParent;
|
|
15
|
+
let trigger;
|
|
16
|
+
let content;
|
|
17
|
+
let contentContainer;
|
|
18
|
+
|
|
19
|
+
let myInterval = null;
|
|
20
|
+
let lastTarget = null;
|
|
21
|
+
|
|
22
|
+
let top = 0;
|
|
23
|
+
let left = 0;
|
|
24
|
+
|
|
25
|
+
const padding = 7;
|
|
26
|
+
|
|
27
|
+
const entryPosition = {
|
|
28
|
+
bottom: ['-12px', '0px'],
|
|
29
|
+
top: ['12px', '0px'],
|
|
30
|
+
left: ['0px', '12px'],
|
|
31
|
+
right: ['0px', '-12px']
|
|
32
|
+
};
|
|
33
|
+
onMount(() => {
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
removeInterval();
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
// function
|
|
40
|
+
function checkDisplay(event) {
|
|
41
|
+
if (!display) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (event.target.closest('.trigger') && event.target.closest('.trigger') === trigger) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
handleDisplay();
|
|
49
|
+
}
|
|
50
|
+
function handleDisplay() {
|
|
51
|
+
if (!calc[direction]) {
|
|
52
|
+
console.error('Error : direction props not found !');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (display) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[top, left] = calc[direction]();
|
|
60
|
+
toggleDisplay();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function toggleDisplay() {
|
|
64
|
+
if (display) {
|
|
65
|
+
// appliquer une animation
|
|
66
|
+
exit = true;
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
exit = false;
|
|
69
|
+
}, 200);
|
|
70
|
+
} else {
|
|
71
|
+
checkHoverStatus();
|
|
72
|
+
myInterval = setInterval(() => {
|
|
73
|
+
checkHoverStatus();
|
|
74
|
+
}, 100);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
display = !display;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function checkHoverStatus() {
|
|
81
|
+
|
|
82
|
+
if (
|
|
83
|
+
(display && lastTarget.closest && !lastTarget.closest('.parent-tooltip')) ||
|
|
84
|
+
(lastTarget.closest &&
|
|
85
|
+
lastTarget.closest('.parent-tooltip') &&
|
|
86
|
+
lastTarget.closest('.parent-tooltip') != tooltipParent)
|
|
87
|
+
) {
|
|
88
|
+
exit = true;
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
exit = false;
|
|
91
|
+
}, 200);
|
|
92
|
+
display = false;
|
|
93
|
+
removeInterval();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function removeInterval() {
|
|
98
|
+
if (myInterval) {
|
|
99
|
+
clearInterval(myInterval);
|
|
100
|
+
myInterval = null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function handleMouseMove(event) {
|
|
105
|
+
lastTarget = event.target;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const calc = {
|
|
110
|
+
bottom: () => {
|
|
111
|
+
// recuperer la taille du content
|
|
112
|
+
const contentWidth = content.offsetWidth;
|
|
113
|
+
const contentHeight = content.offsetHeight;
|
|
114
|
+
// recuperer la taille du trigger
|
|
115
|
+
const triggerWidth = trigger.offsetWidth;
|
|
116
|
+
const triggerHeight = trigger.offsetHeight;
|
|
117
|
+
// recuperer la position du trigger par rapport a la fenetre
|
|
118
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
119
|
+
const triggerTop = triggerRect.top;
|
|
120
|
+
const triggerLeft = triggerRect.left;
|
|
121
|
+
const triggerBottom = window.innerHeight - triggerTop - triggerHeight;
|
|
122
|
+
const triggerRight = window.innerWidth - triggerLeft - triggerWidth;
|
|
123
|
+
|
|
124
|
+
// return values
|
|
125
|
+
let topCalc = triggerTop + triggerHeight + padding;
|
|
126
|
+
let leftCalc = triggerLeft - (contentWidth - triggerWidth) / 2;
|
|
127
|
+
|
|
128
|
+
// verifier si il y a assez de la place en bas
|
|
129
|
+
if (triggerBottom < contentHeight) {
|
|
130
|
+
topCalc = window.innerHeight - contentHeight - padding;
|
|
131
|
+
}
|
|
132
|
+
// verifier si il y a assez de place a droite
|
|
133
|
+
if (triggerRight < (contentWidth - triggerWidth) / 2) {
|
|
134
|
+
leftCalc = window.innerWidth - contentWidth - padding;
|
|
135
|
+
}
|
|
136
|
+
// verifier si il y a assez de place a gauche
|
|
137
|
+
|
|
138
|
+
if (triggerLeft < (contentWidth - triggerWidth) / 2) {
|
|
139
|
+
leftCalc = padding;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return [topCalc, leftCalc];
|
|
143
|
+
},
|
|
144
|
+
top: () => {
|
|
145
|
+
// recuperer la taille du content
|
|
146
|
+
const contentWidth = content.offsetWidth;
|
|
147
|
+
const contentHeight = content.offsetHeight;
|
|
148
|
+
// recuperer la taille du trigger
|
|
149
|
+
const triggerWidth = trigger.offsetWidth;
|
|
150
|
+
const triggerHeight = trigger.offsetHeight;
|
|
151
|
+
// recuperer la position du trigger par rapport a la fenetre
|
|
152
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
153
|
+
const triggerTop = triggerRect.top;
|
|
154
|
+
const triggerBottom = window.innerHeight - triggerTop - triggerHeight;
|
|
155
|
+
const triggerLeft = triggerRect.left;
|
|
156
|
+
const triggerRight = window.innerWidth - triggerLeft - triggerWidth;
|
|
157
|
+
|
|
158
|
+
// return values
|
|
159
|
+
let topCalc = triggerTop - contentHeight - padding;
|
|
160
|
+
let leftCalc = triggerLeft - (contentWidth - triggerWidth) / 2;
|
|
161
|
+
|
|
162
|
+
// verifier si il y a assez de la place en haut
|
|
163
|
+
if (triggerTop < contentHeight) {
|
|
164
|
+
topCalc = padding;
|
|
165
|
+
}
|
|
166
|
+
// verifier si il y a assez de la place en bas
|
|
167
|
+
if (triggerBottom + triggerHeight < contentHeight) {
|
|
168
|
+
topCalc = padding;
|
|
169
|
+
}
|
|
170
|
+
// verifier si il y a assez de place a gauche
|
|
171
|
+
if (triggerLeft < (contentWidth - triggerWidth) / 2) {
|
|
172
|
+
leftCalc = padding;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return [topCalc, leftCalc];
|
|
176
|
+
},
|
|
177
|
+
left: () => {
|
|
178
|
+
// recuperer la taille du content
|
|
179
|
+
const contentWidth = content.offsetWidth;
|
|
180
|
+
const contentHeight = content.offsetHeight;
|
|
181
|
+
// recuperer la taille du trigger
|
|
182
|
+
const triggerWidth = trigger.offsetWidth;
|
|
183
|
+
const triggerHeight = trigger.offsetHeight;
|
|
184
|
+
// recuperer la position du trigger par rapport a la fenetre
|
|
185
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
186
|
+
const triggerTop = triggerRect.top;
|
|
187
|
+
const triggerBottom = window.innerHeight - triggerTop - triggerHeight;
|
|
188
|
+
const triggerLeft = triggerRect.left;
|
|
189
|
+
const triggerRight = window.innerWidth - triggerLeft - triggerWidth;
|
|
190
|
+
|
|
191
|
+
// return values
|
|
192
|
+
let topCalc = triggerTop - (contentHeight - triggerHeight) / 2;
|
|
193
|
+
let leftCalc = triggerLeft - contentWidth - padding;
|
|
194
|
+
|
|
195
|
+
// verifier si il y a assez de la place en haut
|
|
196
|
+
if (triggerTop < (contentHeight - triggerHeight) / 2) {
|
|
197
|
+
topCalc = padding;
|
|
198
|
+
}
|
|
199
|
+
// verifier si il y a assez de la place en bas
|
|
200
|
+
if (triggerBottom < (contentHeight - triggerHeight) / 2) {
|
|
201
|
+
topCalc = window.innerHeight - contentHeight - padding;
|
|
202
|
+
}
|
|
203
|
+
// verifier si il y a assez de place a gauche
|
|
204
|
+
if (triggerLeft < contentWidth + padding) {
|
|
205
|
+
leftCalc = padding;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return [topCalc, leftCalc];
|
|
209
|
+
},
|
|
210
|
+
right: () => {
|
|
211
|
+
// recuperer la taille du content
|
|
212
|
+
const contentWidth = content.offsetWidth;
|
|
213
|
+
const contentHeight = content.offsetHeight;
|
|
214
|
+
// recuperer la taille du trigger
|
|
215
|
+
const triggerWidth = trigger.offsetWidth;
|
|
216
|
+
const triggerHeight = trigger.offsetHeight;
|
|
217
|
+
// recuperer la position du trigger par rapport a la fenetre
|
|
218
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
219
|
+
const triggerTop = triggerRect.top;
|
|
220
|
+
const triggerBottom = window.innerHeight - triggerTop - triggerHeight;
|
|
221
|
+
const triggerLeft = triggerRect.left;
|
|
222
|
+
const triggerRight = window.innerWidth - triggerLeft - triggerWidth;
|
|
223
|
+
|
|
224
|
+
// return values
|
|
225
|
+
let topCalc = triggerTop - (contentHeight - triggerHeight) / 2;
|
|
226
|
+
let leftCalc = triggerLeft + triggerWidth + padding;
|
|
227
|
+
|
|
228
|
+
// verifier si il y a assez de la place en haut
|
|
229
|
+
if (triggerTop < (contentHeight - triggerHeight) / 2) {
|
|
230
|
+
topCalc = padding;
|
|
231
|
+
}
|
|
232
|
+
// verifier si il y a assez de la place en bas
|
|
233
|
+
if (triggerBottom < (contentHeight - triggerHeight) / 2) {
|
|
234
|
+
topCalc = window.innerHeight - contentHeight - padding;
|
|
235
|
+
}
|
|
236
|
+
// verifier si il y a assez de place a droite
|
|
237
|
+
if (triggerRight < contentWidth + padding) {
|
|
238
|
+
leftCalc = window.innerWidth - contentWidth - padding - triggerWidth;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return [topCalc, leftCalc];
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
</script>
|
|
245
|
+
|
|
246
|
+
<svelte:body on:mousemove={handleMouseMove} on:click={handleMouseMove}/>
|
|
247
|
+
|
|
248
|
+
<dropdown bind:this={tooltipParent} class="parent-tooltip" style={triggerFullWidth ? 'width:100%;' : ''}>
|
|
249
|
+
<div
|
|
250
|
+
bind:this={trigger}
|
|
251
|
+
class="trigger"
|
|
252
|
+
style={triggerFullWidth ? 'width:100%;' : ''}
|
|
253
|
+
on:mouseenter={handleDisplay}
|
|
254
|
+
>
|
|
255
|
+
<slot name="trigger" />
|
|
256
|
+
</div>
|
|
257
|
+
<Portal disabled={!display} target="body">
|
|
258
|
+
<content-container bind:this={contentContainer}>
|
|
259
|
+
<content
|
|
260
|
+
bind:this={content}
|
|
261
|
+
class="content"
|
|
262
|
+
class:display
|
|
263
|
+
class:exit
|
|
264
|
+
style="--left:{left}px;--top:{top}px;--transform-x:{entryPosition[
|
|
265
|
+
direction
|
|
266
|
+
][1]};--transform-y:{entryPosition[direction][0]};"
|
|
267
|
+
>
|
|
268
|
+
<slot name="content" />
|
|
269
|
+
</content>
|
|
270
|
+
</content-container>
|
|
271
|
+
</Portal>
|
|
272
|
+
</dropdown>
|
|
273
|
+
|
|
274
|
+
<style>
|
|
275
|
+
.parent-tooltip{
|
|
276
|
+
width: max-content;
|
|
277
|
+
display: block;
|
|
278
|
+
}
|
|
279
|
+
.trigger {
|
|
280
|
+
width: max-content;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.content {
|
|
284
|
+
position: fixed;
|
|
285
|
+
top: var(--top);
|
|
286
|
+
left: var(--left);
|
|
287
|
+
display: block;
|
|
288
|
+
user-select: none;
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
opacity: 0;
|
|
291
|
+
z-index: 2;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.content.exit {
|
|
295
|
+
display: block;
|
|
296
|
+
animation-name: exit;
|
|
297
|
+
animation-duration: 0.2s;
|
|
298
|
+
animation-timing-function: ease-out;
|
|
299
|
+
}
|
|
300
|
+
.content.display {
|
|
301
|
+
display: block;
|
|
302
|
+
animation-name: entry;
|
|
303
|
+
animation-duration: 0.2s;
|
|
304
|
+
animation-timing-function: ease-out;
|
|
305
|
+
opacity: 1;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@keyframes entry {
|
|
309
|
+
from {
|
|
310
|
+
display: block;
|
|
311
|
+
opacity: 0;
|
|
312
|
+
user-select: none;
|
|
313
|
+
pointer-events: none;
|
|
314
|
+
transform: translate(var(--transform-x), var(--transform-y)) scale(0.9);
|
|
315
|
+
}
|
|
316
|
+
to {
|
|
317
|
+
display: block;
|
|
318
|
+
opacity: 1;
|
|
319
|
+
transform: translate(0px, 0px) scale(1);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
@keyframes exit {
|
|
323
|
+
from {
|
|
324
|
+
display: block;
|
|
325
|
+
opacity: 1;
|
|
326
|
+
transform: translate(0px, 0px) scale(1);
|
|
327
|
+
}
|
|
328
|
+
to {
|
|
329
|
+
display: block;
|
|
330
|
+
opacity: 0;
|
|
331
|
+
user-select: none;
|
|
332
|
+
pointer-events: none;
|
|
333
|
+
transform: translate(var(--transform-x), var(--transform-y)) scale(0.9);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from './Root.svelte';
|
|
2
|
+
export { default as Trigger } from './Trigger.svelte';
|
|
3
|
+
export { default as Content } from './Content.svelte';
|
|
4
|
+
export { default as Label } from './Label.svelte';
|
|
5
|
+
export { default as Separator } from './Separator.svelte';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
<div class="info-card" {...$$restProps}>
|
|
3
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path opacity="0.4" d="M21.7605 15.92L15.3605 4.4C14.5005 2.85 13.3105 2 12.0005 2C10.6905 2 9.50047 2.85 8.64047 4.4L2.24047 15.92C1.43047 17.39 1.34047 18.8 1.99047 19.91C2.64047 21.02 3.92047 21.63 5.60047 21.63H18.4005C20.0805 21.63 21.3605 21.02 22.0105 19.91C22.6605 18.8 22.5705 17.38 21.7605 15.92Z" fill="#FF9500"/>
|
|
5
|
+
<path d="M12 14.75C11.59 14.75 11.25 14.41 11.25 14V9C11.25 8.59 11.59 8.25 12 8.25C12.41 8.25 12.75 8.59 12.75 9V14C12.75 14.41 12.41 14.75 12 14.75Z" fill="#FF9500"/>
|
|
6
|
+
<path d="M12 18.0001C11.94 18.0001 11.87 17.9901 11.8 17.9801C11.74 17.9701 11.68 17.9501 11.62 17.9201C11.56 17.9001 11.5 17.8701 11.44 17.8301C11.39 17.7901 11.34 17.7501 11.29 17.7101C11.11 17.5201 11 17.2601 11 17.0001C11 16.7401 11.11 16.4801 11.29 16.2901C11.34 16.2501 11.39 16.2101 11.44 16.1701C11.5 16.1301 11.56 16.1001 11.62 16.0801C11.68 16.0501 11.74 16.0301 11.8 16.0201C11.93 15.9901 12.07 15.9901 12.19 16.0201C12.26 16.0301 12.32 16.0501 12.38 16.0801C12.44 16.1001 12.5 16.1301 12.56 16.1701C12.61 16.2101 12.66 16.2501 12.71 16.2901C12.89 16.4801 13 16.7401 13 17.0001C13 17.2601 12.89 17.5201 12.71 17.7101C12.66 17.7501 12.61 17.7901 12.56 17.8301C12.5 17.8701 12.44 17.9001 12.38 17.9201C12.32 17.9501 12.26 17.9701 12.19 17.9801C12.13 17.9901 12.06 18.0001 12 18.0001Z" fill="#FF9500"/>
|
|
7
|
+
</svg>
|
|
8
|
+
<p class="info"><slot/></p>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
.info-card{
|
|
14
|
+
display: flex;
|
|
15
|
+
column-gap: var(--pad-m);
|
|
16
|
+
padding: var(--pad-m);
|
|
17
|
+
background-color: var(--orange-b);
|
|
18
|
+
border-radius: var(--radius-m);
|
|
19
|
+
}
|
|
20
|
+
.info{
|
|
21
|
+
margin-top: 1.5px;
|
|
22
|
+
color: var(--orange);
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.info-card > svg{
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
}
|
|
29
|
+
.info-card > svg > path {
|
|
30
|
+
fill: var(--orange);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let size = 40
|
|
3
|
+
export let borderRadius = 24
|
|
4
|
+
export let src
|
|
5
|
+
export let alt = ""
|
|
6
|
+
export let link = ''
|
|
7
|
+
export let style = ''
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if link}
|
|
11
|
+
<a href={link} class="avatar" style=" height:{size}px ;width:{size}px;border-radius:{borderRadius}px;{style}">
|
|
12
|
+
<img class="image" {src} {alt} style="object-fit: cover;">
|
|
13
|
+
</a>
|
|
14
|
+
{:else}
|
|
15
|
+
<div class="avatar" style=" height:{size}px ;width:{size}px;border-radius:{borderRadius}px;{style}">
|
|
16
|
+
<img class="image" {src} {alt} style="object-fit: cover;">
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.avatar{
|
|
22
|
+
flex-shrink:0;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
.image{
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
// import
|
|
3
|
+
import ButtonDefault from "./Button_default.svelte";
|
|
4
|
+
import ButtonLink from "./Button_link.svelte";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// props
|
|
8
|
+
export let label = "";
|
|
9
|
+
export let variant = 'primary';
|
|
10
|
+
export let loading = false;
|
|
11
|
+
export let desabled = false;
|
|
12
|
+
export let avoidRipple = false;
|
|
13
|
+
export let href = "";
|
|
14
|
+
export let onClick = undefined;
|
|
15
|
+
// local var
|
|
16
|
+
const colorConfig = {
|
|
17
|
+
primary: {
|
|
18
|
+
defaultBg: '--accent',
|
|
19
|
+
defaultBorder:'',
|
|
20
|
+
defaultColor: '--white',
|
|
21
|
+
hoverBg: '--accent-b',
|
|
22
|
+
hoverBorder:'',
|
|
23
|
+
hoverColor: '--white-d'
|
|
24
|
+
},
|
|
25
|
+
secondary: {
|
|
26
|
+
defaultBg: '--bg-2',
|
|
27
|
+
defaultBorder:'',
|
|
28
|
+
defaultColor: '--font-u',
|
|
29
|
+
hoverBg: '--bg-3',
|
|
30
|
+
hoverBorder:'',
|
|
31
|
+
hoverColor: '--font-d'
|
|
32
|
+
},
|
|
33
|
+
ghost: {
|
|
34
|
+
defaultBg: '',
|
|
35
|
+
defaultBorder:'',
|
|
36
|
+
defaultColor: '--font-d',
|
|
37
|
+
hoverBg: '--bg-3',
|
|
38
|
+
hoverBorder:'',
|
|
39
|
+
hoverColor: '--font-u'
|
|
40
|
+
},
|
|
41
|
+
outline: {
|
|
42
|
+
defaultBg: '',
|
|
43
|
+
defaultBorder:'--stroke',
|
|
44
|
+
defaultColor: '--font-d',
|
|
45
|
+
hoverBg: '--bg-2',
|
|
46
|
+
hoverBorder:'--stroke',
|
|
47
|
+
hoverColor: '--font-u'
|
|
48
|
+
},
|
|
49
|
+
destructive: {
|
|
50
|
+
defaultBg: '--red',
|
|
51
|
+
defaultBorder:'--red',
|
|
52
|
+
defaultColor: '--white',
|
|
53
|
+
hoverBg: '--red',
|
|
54
|
+
hoverBorder:'--red-b',
|
|
55
|
+
hoverColor: '--white'
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<div
|
|
61
|
+
style="
|
|
62
|
+
--button-default-bg:var({colorConfig[variant].defaultBg});
|
|
63
|
+
--button-default-border:var({colorConfig[variant].defaultBorder});
|
|
64
|
+
--button-default-color:var({colorConfig[variant].defaultColor});
|
|
65
|
+
--button-hover-bg:var({colorConfig[variant].hoverBg});
|
|
66
|
+
--button-hover-border:var({colorConfig[variant].hoverBorder});
|
|
67
|
+
--button-hover-color:var({colorConfig[variant].hoverColor});
|
|
68
|
+
"
|
|
69
|
+
>
|
|
70
|
+
{#if href}
|
|
71
|
+
<ButtonLink {label} {href} {onClick} {...$$restProps} {loading} {desabled} {avoidRipple}>
|
|
72
|
+
<slot/>
|
|
73
|
+
</ButtonLink>
|
|
74
|
+
{:else}
|
|
75
|
+
<ButtonDefault {label} {onClick} {...$$restProps} {loading} {desabled} {avoidRipple}>
|
|
76
|
+
<slot/>
|
|
77
|
+
</ButtonDefault>
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|