@valerius_petrini/corekit-ui 0.1.54 → 0.1.55
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/dist/components/Card.svelte +1 -1
- package/dist/components/{FloatingInput.svelte → Input.svelte} +73 -3
- package/dist/components/Input.svelte.d.ts +5 -0
- package/dist/components/Modal.svelte +36 -0
- package/dist/components/Modal.svelte.d.ts +4 -0
- package/dist/components/{FloatingSelect.svelte → Select.svelte} +2 -2
- package/dist/components/Select.svelte.d.ts +4 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/styles/layout.css +33 -0
- package/dist/styles/posititon.d.ts +2 -0
- package/dist/styles/posititon.js +11 -0
- package/dist/types/Button.d.ts +2 -1
- package/dist/types/Card.d.ts +2 -1
- package/dist/types/{FloatingInput.d.ts → Input.d.ts} +5 -1
- package/dist/types/Modal.d.ts +6 -0
- package/dist/types/Modal.js +1 -0
- package/dist/types/{FloatingSelect.d.ts → Select.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/components/FloatingInput.svelte.d.ts +0 -5
- package/dist/components/FloatingSelect.svelte.d.ts +0 -4
- /package/dist/types/{FloatingInput.js → Input.js} +0 -0
- /package/dist/types/{FloatingSelect.js → Select.js} +0 -0
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
let defaultClass = "text-main-text rounded-lg transition-colors ease-in-out bg-sub-background p-4";
|
|
40
|
-
let linkClass = "hover:bg-sub-background-hover cursor-pointer";
|
|
40
|
+
let linkClass = "block hover:bg-sub-background-hover cursor-pointer";
|
|
41
41
|
let combinedClass = $derived(twMerge(
|
|
42
42
|
defaultClass,
|
|
43
43
|
href ? linkClass : "",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { InputProps } from "../types/Input.js";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import Text from "./Text.svelte";
|
|
5
5
|
import { sizeStyleParts, type SizeStyleTheme } from "../styles/size.js";
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import Phone from "@lucide/svelte/icons/phone";
|
|
12
12
|
import Eye from "@lucide/svelte/icons/eye";
|
|
13
13
|
import EyeOff from "@lucide/svelte/icons/eye-off";
|
|
14
|
+
import ChevronUp from "@lucide/svelte/icons/chevron-up";
|
|
15
|
+
import ChevronDown from "@lucide/svelte/icons/chevron-down";
|
|
14
16
|
|
|
15
17
|
let {
|
|
16
18
|
children = undefined,
|
|
@@ -30,8 +32,13 @@
|
|
|
30
32
|
size = "md",
|
|
31
33
|
radius = "md",
|
|
32
34
|
id = crypto.randomUUID(),
|
|
35
|
+
min = undefined,
|
|
36
|
+
max = undefined,
|
|
37
|
+
step = undefined,
|
|
33
38
|
...restProps
|
|
34
|
-
}:
|
|
39
|
+
}: InputProps = $props();
|
|
40
|
+
|
|
41
|
+
let isHovered = $state(false);
|
|
35
42
|
|
|
36
43
|
const sizeParts = $derived(typeof size === "string" ? sizeStyleParts[size as SizeStyleTheme] : null);
|
|
37
44
|
const radiusParts = $derived(typeof radius === "string" ? sizeStyleParts[radius as SizeStyleTheme] : null);
|
|
@@ -137,6 +144,44 @@
|
|
|
137
144
|
let combinedOuterDivClass = $derived(twMerge("flex flex-col bg-transparent border-0 p-0", divSizeClass, divFullClass, divClass, disabledClass));
|
|
138
145
|
|
|
139
146
|
let EyeComponent = $derived(canSeePassword ? Eye : EyeOff);
|
|
147
|
+
|
|
148
|
+
let numberIconClass = $derived(twMerge(iconClass, sizeClasses, "text-sub-text/70 w-fit aspect-auto p-0 flex-center flex-col transition-all duration-150"));
|
|
149
|
+
let numberButtonClass = $derived(twMerge(iconContainerClass, "h-1/2 gap-0 px-0.5 hover:bg-form-border aspect-square rounded-none"));
|
|
150
|
+
|
|
151
|
+
function increment() {
|
|
152
|
+
if (max === undefined || value < max) value = (value || 0) + (step || 1);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function decrement() {
|
|
156
|
+
if (min === undefined || value > min) value = (value || 0) - (step || 1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let incrementInterval: ReturnType<typeof setInterval> | null = null;
|
|
160
|
+
let decrementInterval: ReturnType<typeof setInterval> | null = null;
|
|
161
|
+
|
|
162
|
+
function startIncrement() {
|
|
163
|
+
increment();
|
|
164
|
+
incrementInterval = setInterval(increment, 100);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function stopIncrement() {
|
|
168
|
+
if (incrementInterval) {
|
|
169
|
+
clearInterval(incrementInterval);
|
|
170
|
+
incrementInterval = null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function startDecrement() {
|
|
175
|
+
decrement();
|
|
176
|
+
decrementInterval = setInterval(decrement, 100);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function stopDecrement() {
|
|
180
|
+
if (decrementInterval) {
|
|
181
|
+
clearInterval(decrementInterval);
|
|
182
|
+
decrementInterval = null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
140
185
|
</script>
|
|
141
186
|
|
|
142
187
|
{#snippet labelElement()}
|
|
@@ -149,7 +194,8 @@
|
|
|
149
194
|
{/snippet}
|
|
150
195
|
|
|
151
196
|
{#snippet innerDivElement()}
|
|
152
|
-
|
|
197
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
198
|
+
<div class={combinedDivClass} onmouseenter={() => isHovered = true} onmouseleave={() => isHovered = false}>
|
|
153
199
|
{#if Icon}
|
|
154
200
|
<div class={iconContainerClass}>
|
|
155
201
|
<Icon class={iconClass}></Icon>
|
|
@@ -166,6 +212,9 @@
|
|
|
166
212
|
class={combinedClass}
|
|
167
213
|
{required}
|
|
168
214
|
{disabled}
|
|
215
|
+
{min}
|
|
216
|
+
{max}
|
|
217
|
+
{step}
|
|
169
218
|
placeholder={variant === "floating" ? "" : placeholder}
|
|
170
219
|
aria-disabled={disabled}
|
|
171
220
|
style={customStyle}
|
|
@@ -176,6 +225,27 @@
|
|
|
176
225
|
<Button class={iconContainerClass} onclick={() => { canSeePassword = !canSeePassword; }}>
|
|
177
226
|
<EyeComponent class={iconClass}></EyeComponent>
|
|
178
227
|
</Button>
|
|
228
|
+
{:else if restProps.type === "number"}
|
|
229
|
+
<div class={twMerge(numberIconClass, isHovered ? "opacity-100 scale-100" : "opacity-0 scale-75")}>
|
|
230
|
+
<Button
|
|
231
|
+
size="none" radius="none"
|
|
232
|
+
class={numberButtonClass}
|
|
233
|
+
onmousedown={startIncrement}
|
|
234
|
+
onmouseup={stopIncrement}
|
|
235
|
+
onmouseleave={stopIncrement}
|
|
236
|
+
disabled={max !== undefined && value >= max}>
|
|
237
|
+
<ChevronUp class="w-full h-full"/>
|
|
238
|
+
</Button>
|
|
239
|
+
<Button
|
|
240
|
+
size="none" radius="none"
|
|
241
|
+
class={numberButtonClass}
|
|
242
|
+
onmousedown={startDecrement}
|
|
243
|
+
onmouseup={stopDecrement}
|
|
244
|
+
onmouseleave={stopDecrement}
|
|
245
|
+
disabled={min !== undefined && value <= min}>
|
|
246
|
+
<ChevronDown class="w-full h-full"/>
|
|
247
|
+
</Button>
|
|
248
|
+
</div>
|
|
179
249
|
{/if}
|
|
180
250
|
</div>
|
|
181
251
|
{/snippet}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ModalProps } from "../types/Modal.js";
|
|
3
|
+
import { fade, fly } from "svelte/transition";
|
|
4
|
+
import Card from "./Card.svelte";
|
|
5
|
+
import { positionParts } from "../styles/posititon.js";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children = undefined,
|
|
10
|
+
class: className = "",
|
|
11
|
+
open = $bindable(),
|
|
12
|
+
position = "center",
|
|
13
|
+
...restProps
|
|
14
|
+
}: ModalProps = $props();
|
|
15
|
+
|
|
16
|
+
const defaultOuterDivClass = "w-full h-screen absolute bg-black/50 z-200 flex items-center justify-center top-0 left-0 p-4";
|
|
17
|
+
const positionOuterDivClass = $derived(positionParts[position] || "");
|
|
18
|
+
const combinedOuterDivClass = $derived(twMerge(defaultOuterDivClass, positionOuterDivClass));
|
|
19
|
+
|
|
20
|
+
const defaultInnerDivClass = "z-300 max-h-full";
|
|
21
|
+
|
|
22
|
+
const defaultCardClass = "overflow-y-auto max-h-[95vh]";
|
|
23
|
+
const combinedCardClass = $derived(twMerge(defaultCardClass, className));
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if open}
|
|
27
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
28
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
29
|
+
<div class={combinedOuterDivClass} transition:fade={{ duration: 200 }} onclick={() => open = false}>
|
|
30
|
+
<div class={defaultInnerDivClass} transition:fly={{ y: -20, duration: 200 }} onclick={(e) => e.stopPropagation()}>
|
|
31
|
+
<Card class={combinedCardClass} {...restProps}>
|
|
32
|
+
{@render children()}
|
|
33
|
+
</Card>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SelectProps } from "../types/Select.js";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import Text from "./Text.svelte";
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
options = [],
|
|
14
14
|
id = crypto.randomUUID(),
|
|
15
15
|
...restProps
|
|
16
|
-
}:
|
|
16
|
+
}: SelectProps = $props();
|
|
17
17
|
|
|
18
18
|
let defaultSelectClass = "cursor-pointer bg-form-background border-[1px] border-form-border text-main-text z-20 w-full rounded px-1 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
|
|
19
19
|
let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ export { default as SEO } from "./components/SEO.svelte";
|
|
|
5
5
|
export { default as Navbar } from "./components/Navbar.svelte";
|
|
6
6
|
export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
|
|
7
7
|
export { default as NavbarElement } from "./components/NavbarElement.svelte";
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
8
|
+
export { default as Input } from "./components/Input.svelte";
|
|
9
|
+
export { default as Select } from "./components/Select.svelte";
|
|
10
10
|
export { default as Text } from "./components/Text.svelte";
|
|
11
11
|
export { default as Card } from "./components/Card.svelte";
|
|
12
12
|
export { default as Checkbox } from "./components/Checkbox.svelte";
|
|
13
13
|
export { default as Progress } from "./components/Progress.svelte";
|
|
14
|
+
export { default as Modal } from "./components/Modal.svelte";
|
|
14
15
|
export { fbmBackground } from "./actions/fbm.ts";
|
|
15
16
|
export type { TypewriterAction, DisplaySegment } from "./types/Typewriter.ts";
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,11 @@ export { default as SEO } from "./components/SEO.svelte";
|
|
|
5
5
|
export { default as Navbar } from "./components/Navbar.svelte";
|
|
6
6
|
export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
|
|
7
7
|
export { default as NavbarElement } from "./components/NavbarElement.svelte";
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
8
|
+
export { default as Input } from "./components/Input.svelte";
|
|
9
|
+
export { default as Select } from "./components/Select.svelte";
|
|
10
10
|
export { default as Text } from "./components/Text.svelte";
|
|
11
11
|
export { default as Card } from "./components/Card.svelte";
|
|
12
12
|
export { default as Checkbox } from "./components/Checkbox.svelte";
|
|
13
13
|
export { default as Progress } from "./components/Progress.svelte";
|
|
14
|
+
export { default as Modal } from "./components/Modal.svelte";
|
|
14
15
|
export { fbmBackground } from "./actions/fbm.js";
|
package/dist/styles/layout.css
CHANGED
|
@@ -49,4 +49,37 @@ html.dark {
|
|
|
49
49
|
|
|
50
50
|
html {
|
|
51
51
|
background-color: var(--color-main-background);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
* {
|
|
55
|
+
scrollbar-width: thin;
|
|
56
|
+
scrollbar-color: var(--color-sub-background-hover) transparent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
*::-webkit-scrollbar {
|
|
60
|
+
width: 6px;
|
|
61
|
+
height: 6px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
*::-webkit-scrollbar-track {
|
|
65
|
+
background: transparent;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
*::-webkit-scrollbar-thumb {
|
|
69
|
+
background-color: var(--color-sub-background-hover);
|
|
70
|
+
border-radius: 999px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
74
|
+
background-color: var(--color-main-text);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
input[type="number"]::-webkit-outer-spin-button,
|
|
78
|
+
input[type="number"]::-webkit-inner-spin-button {
|
|
79
|
+
-webkit-appearance: none;
|
|
80
|
+
margin: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
input[type="number"] {
|
|
84
|
+
-moz-appearance: textfield;
|
|
52
85
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const positionParts = {
|
|
2
|
+
"top": "flex items-start justify-center",
|
|
3
|
+
"right": "flex items-center justify-end",
|
|
4
|
+
"bottom": "flex items-end justify-center",
|
|
5
|
+
"left": "flex items-center justify-start",
|
|
6
|
+
"top-left": "flex items-start justify-start",
|
|
7
|
+
"top-right": "flex items-start justify-end",
|
|
8
|
+
"bottom-left": "flex items-end justify-start",
|
|
9
|
+
"bottom-right": "flex items-end justify-end",
|
|
10
|
+
"center": "flex-center"
|
|
11
|
+
};
|
package/dist/types/Button.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
1
2
|
import type { ColorStyle, ColorStyleType } from "../styles/color.ts";
|
|
2
3
|
import type { SizeStyle } from "../styles/size.ts";
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
+
export interface ButtonProps extends Omit<HTMLButtonAttributes, 'size'> {
|
|
4
5
|
children?: any;
|
|
5
6
|
class?: string;
|
|
6
7
|
pill?: boolean;
|
package/dist/types/Card.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
1
2
|
import type { SizeStyle } from "../styles/size.ts";
|
|
2
3
|
export type CardVariant = "bordered" | "elevated";
|
|
3
4
|
export declare const cardVariantStyles: Record<CardVariant, string>;
|
|
4
|
-
export interface CardProps {
|
|
5
|
+
export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {
|
|
5
6
|
children?: any;
|
|
6
7
|
class?: string;
|
|
7
8
|
href?: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Component } from "svelte";
|
|
2
2
|
import type { SizeStyle } from "../styles/size.ts";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
4
|
export type InputVariant = "default" | "floating";
|
|
4
|
-
export interface
|
|
5
|
+
export interface InputProps extends Omit<HTMLInputAttributes, 'size'> {
|
|
5
6
|
children?: any;
|
|
6
7
|
class?: string;
|
|
7
8
|
label?: string;
|
|
@@ -13,6 +14,9 @@ export interface FloatingInputProps {
|
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
variant?: InputVariant;
|
|
15
16
|
placeholder?: string;
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
step?: number;
|
|
16
20
|
onfocus?: (e?: FocusEvent) => void;
|
|
17
21
|
onblur?: (e?: FocusEvent) => void;
|
|
18
22
|
validInputRegex?: RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FloatingInputProps } from "../types/FloatingInput.ts";
|
|
2
|
-
import { type Component } from "svelte";
|
|
3
|
-
declare const FloatingInput: Component<FloatingInputProps, {}, "value">;
|
|
4
|
-
type FloatingInput = ReturnType<typeof FloatingInput>;
|
|
5
|
-
export default FloatingInput;
|
|
File without changes
|
|
File without changes
|