@valerius_petrini/corekit-ui 0.1.79 → 0.1.80
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/display/KBD/index.svelte +2 -2
- package/dist/components/display/Skeleton/index.svelte +1 -1
- package/dist/components/feedback/Loader/index.svelte +1 -0
- package/dist/components/feedback/Modal/index.svelte +29 -17
- package/dist/components/feedback/Toast/index.svelte +1 -1
- package/dist/components/inputs/Input/index.svelte +4 -4
- package/dist/components/inputs/helper/BaseInput.svelte +1 -3
- package/dist/components/navigation/Navbar/NavbarDropdown.svelte +23 -17
- package/dist/components/navigation/Navbar/NavbarElement.svelte +3 -2
- package/dist/components/navigation/Navbar/index.stories.svelte +3 -0
- package/dist/components/navigation/Navbar/index.svelte +1 -1
- package/dist/components/navigation/Navbar/types.d.ts +2 -0
- package/dist/components/typography/Text/index.svelte +3 -3
- package/package.json +1 -1
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
const combinedClass = $derived(twMerge(defaultClass, className));
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<
|
|
17
|
+
<kbd class={combinedClass} {...restProps} bind:this={element}>
|
|
18
18
|
{@render children?.()}
|
|
19
19
|
{#if subtext}
|
|
20
20
|
<span class="text-sub-text text-[10px] mt-0.5">
|
|
21
21
|
{@render subtext?.()}
|
|
22
22
|
</span>
|
|
23
23
|
{/if}
|
|
24
|
-
</
|
|
24
|
+
</kbd>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</div>
|
|
40
40
|
{/snippet}
|
|
41
41
|
|
|
42
|
-
<div class={combinedContainerClass} bind:this={element}>
|
|
42
|
+
<div class={combinedContainerClass} bind:this={element} aria-hidden="true">
|
|
43
43
|
{#if variant === "default"}
|
|
44
44
|
<div class="h-4 bg-sub-background rounded w-3/4"></div>
|
|
45
45
|
<div class="h-4 bg-sub-background rounded w-full"></div>
|
|
@@ -9,13 +9,26 @@
|
|
|
9
9
|
let {
|
|
10
10
|
children = undefined,
|
|
11
11
|
class: className = "",
|
|
12
|
-
element = $bindable(),
|
|
13
|
-
open = $bindable(),
|
|
12
|
+
element = $bindable<HTMLDialogElement>(),
|
|
13
|
+
open = $bindable(false),
|
|
14
14
|
position = "center",
|
|
15
15
|
size = "md",
|
|
16
16
|
...restProps
|
|
17
17
|
}: ModalProps = $props();
|
|
18
18
|
|
|
19
|
+
$effect(() => {
|
|
20
|
+
if (!element) return;
|
|
21
|
+
if (open) {
|
|
22
|
+
(element as HTMLDialogElement).showModal();
|
|
23
|
+
} else {
|
|
24
|
+
(element as HTMLDialogElement).close();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function onclose() {
|
|
29
|
+
open = false;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
const outerClass = $derived(twMerge(
|
|
20
33
|
"inset-0 flex flex-col w-[calc(100%-1rem)] h-[calc(100%-1rem)] p-4",
|
|
21
34
|
modalPositionParts[position]
|
|
@@ -28,20 +41,19 @@
|
|
|
28
41
|
));
|
|
29
42
|
</script>
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{@render children()}
|
|
44
|
+
<dialog
|
|
45
|
+
bind:this={element}
|
|
46
|
+
class="w-full h-screen bg-black/50 z-300 fixed top-0 left-0 p-0 m-0 max-w-none max-h-none"
|
|
47
|
+
transition:fade={{ duration: 200 }}
|
|
48
|
+
onclick={() => open = false}
|
|
49
|
+
onclose={onclose}
|
|
50
|
+
{...restProps}
|
|
51
|
+
>
|
|
52
|
+
{#if open}
|
|
53
|
+
<div class={outerClass} transition:fly={{ y: -20, duration: 200 }}>
|
|
54
|
+
<Card class={cardClass} onclick={(e: MouseEvent) => e.stopPropagation()}>
|
|
55
|
+
{@render children?.()}
|
|
44
56
|
</Card>
|
|
45
57
|
</div>
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
{/if}
|
|
59
|
+
</dialog>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
});
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
|
-
<div transition:fly={flyParams} class={combinedToastClass} {...restProps} bind:this={element}>
|
|
62
|
+
<div transition:fly={flyParams} class={combinedToastClass} {...restProps} bind:this={element} role="status" aria-live={type === "error" ? "assertive" : "polite"}>
|
|
63
63
|
<div class="w-8 h-8 flex-center">
|
|
64
64
|
<Icon class={defualtIconClass}/>
|
|
65
65
|
</div>
|
|
@@ -134,19 +134,19 @@
|
|
|
134
134
|
{...restProps}>
|
|
135
135
|
{#snippet outerDivElementAfter()}
|
|
136
136
|
{#if touched && requirements}
|
|
137
|
-
<
|
|
137
|
+
<ul role="list" class="mt-1 text-xs" transition:slide={{ duration: 300 }}>
|
|
138
138
|
{#each requirements as req}
|
|
139
139
|
{@const isReqMet = testRequirement(req.requirements)}
|
|
140
140
|
{@const reqClass = isReqMet ? "text-green-500" : "text-red-500"}
|
|
141
|
-
<
|
|
141
|
+
<li class="flex w-full items-center gap-1 transition-colors {reqClass}">
|
|
142
142
|
<div class="relative w-4 h-4">
|
|
143
143
|
<Check class="w-4 h-4 absolute transition-all duration-150 {isReqMet ? 'opacity-100 scale-100' : 'opacity-0 scale-0'}"/>
|
|
144
144
|
<X class="w-4 h-4 absolute transition-all duration-150 {isReqMet ? 'opacity-0 scale-0' : 'opacity-100 scale-100'}"/>
|
|
145
145
|
</div>
|
|
146
146
|
<Text tag="span" class="text-xs text-inherit">{req.label}</Text>
|
|
147
|
-
</
|
|
147
|
+
</li>
|
|
148
148
|
{/each}
|
|
149
|
-
</
|
|
149
|
+
</ul>
|
|
150
150
|
{/if}
|
|
151
151
|
{/snippet}
|
|
152
152
|
|
|
@@ -85,9 +85,7 @@
|
|
|
85
85
|
{/if}
|
|
86
86
|
{#if icon}
|
|
87
87
|
{@const Icon = icon}
|
|
88
|
-
<
|
|
89
|
-
<Icon class="h-full aspect-square text-sub-text"></Icon>
|
|
90
|
-
</div>
|
|
88
|
+
<Icon class="h-5 aspect-square mx-1 py-0! text-sub-text shrink-0"></Icon>
|
|
91
89
|
{/if}
|
|
92
90
|
{@render innerDivElement?.()}
|
|
93
91
|
</div>
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
} from "@floating-ui/dom";
|
|
13
13
|
import { tick } from "svelte";
|
|
14
14
|
|
|
15
|
+
import ChevronUp from "@lucide/svelte/icons/chevron-up";
|
|
16
|
+
import ChevronDown from "@lucide/svelte/icons/chevron-down";
|
|
17
|
+
|
|
15
18
|
let {
|
|
16
19
|
children = undefined,
|
|
17
20
|
class: className = "",
|
|
@@ -75,20 +78,23 @@
|
|
|
75
78
|
|
|
76
79
|
<svelte:window onclick={handleClickOutside} />
|
|
77
80
|
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</
|
|
91
|
-
|
|
81
|
+
<NavbarElement
|
|
82
|
+
onclick={toggle}
|
|
83
|
+
class="{className} relative {wrapperClass}"
|
|
84
|
+
bind:element
|
|
85
|
+
{...restProps}
|
|
86
|
+
aria-haspopup="true"
|
|
87
|
+
aria-expanded={open}
|
|
88
|
+
>
|
|
89
|
+
{label}
|
|
90
|
+
{#if navelement}
|
|
91
|
+
{@render navelement()}
|
|
92
|
+
{/if}
|
|
93
|
+
<span class="sr-only">{open ? 'Close' : 'Open'} dropdown</span>
|
|
94
|
+
<ChevronDown
|
|
95
|
+
class="mt-0.5 transition-transform ease-out duration-150 {open ? 'rotate-180' : 'rotate-0'}"
|
|
96
|
+
size="16"/>
|
|
97
|
+
</NavbarElement>
|
|
92
98
|
|
|
93
99
|
{#if open}
|
|
94
100
|
<div
|
|
@@ -98,13 +104,13 @@
|
|
|
98
104
|
class="z-100 shadow-lg"
|
|
99
105
|
style:visibility={ready ? "visible" : "hidden"}
|
|
100
106
|
>
|
|
101
|
-
<
|
|
107
|
+
<menu
|
|
102
108
|
transition:fly={flyParams}
|
|
103
109
|
class="bg-sub-background p-2 min-w-max flex flex-col rounded border border-white/10 shadow-xl shadow-black/40"
|
|
104
110
|
>
|
|
105
|
-
<button onclick={() => (open = false)} class="contents *:w-full [&
|
|
111
|
+
<button onclick={() => (open = false)} class="contents *:w-full [&_button]:justify-start [&_a]:justify-start *:mx-0 [&_a]:pr-5">
|
|
106
112
|
{@render children?.()}
|
|
107
113
|
</button>
|
|
108
|
-
</
|
|
114
|
+
</menu>
|
|
109
115
|
</div>
|
|
110
116
|
{/if}
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
active = false,
|
|
13
13
|
href = undefined,
|
|
14
14
|
threshold = 10,
|
|
15
|
+
color = "sub",
|
|
15
16
|
...restProps
|
|
16
17
|
}: NavbarElementProps = $props();
|
|
17
18
|
|
|
18
|
-
let defaultClass = "navbar-element w-fit h-
|
|
19
|
+
let defaultClass = "navbar-element w-fit h-fit mx-2 px-2.5 py-1.5 rounded text-main-text";
|
|
19
20
|
|
|
20
21
|
let scrollY = $state(0);
|
|
21
22
|
let isAtTop = $derived(scrollY <= threshold);
|
|
@@ -30,6 +31,6 @@
|
|
|
30
31
|
|
|
31
32
|
<svelte:window bind:scrollY={scrollY}/>
|
|
32
33
|
|
|
33
|
-
<Button bind:element radius="none" {href} color
|
|
34
|
+
<Button bind:element radius="none" {href} {color} class={combinedClass} {...restProps} aria-current={active ? 'page' : undefined}>
|
|
34
35
|
{@render children?.()}
|
|
35
36
|
</Button>
|
|
@@ -25,5 +25,8 @@
|
|
|
25
25
|
<NavbarElement href="/about">About</NavbarElement>
|
|
26
26
|
<NavbarSeparator variant="horizontal"/>
|
|
27
27
|
<NavbarElement href="/contact">Contact</NavbarElement>
|
|
28
|
+
<NavbarElement>No Link</NavbarElement>
|
|
28
29
|
</NavbarDropdown>
|
|
30
|
+
|
|
31
|
+
<NavbarElement color="primary">Action</NavbarElement>
|
|
29
32
|
</Story>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
...restProps
|
|
12
12
|
}: NavbarProps = $props();
|
|
13
13
|
|
|
14
|
-
let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-sub-background/99 border-b border-box border-b-sub-background-hover";
|
|
14
|
+
let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-sub-background/99 border-b border-box border-b-sub-background-hover px-4 md:px-6 lg:px-8";
|
|
15
15
|
|
|
16
16
|
let scrollY = $state(0);
|
|
17
17
|
let isAtTop = $derived(scrollY <= threshold);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
|
|
3
|
+
import type { ColorStyle } from "../../../styles/color.ts";
|
|
3
4
|
export interface NavbarProps extends BaseComponentProps {
|
|
4
5
|
classTop?: string;
|
|
5
6
|
threshold?: number;
|
|
@@ -10,6 +11,7 @@ export interface NavbarElementProps extends BaseComponentProps {
|
|
|
10
11
|
active?: boolean;
|
|
11
12
|
href?: string;
|
|
12
13
|
threshold?: number;
|
|
14
|
+
color?: ColorStyle;
|
|
13
15
|
}
|
|
14
16
|
export type NavbarSeparatorVariant = "vertical" | "horizontal" | "dynamic";
|
|
15
17
|
export declare const NavbarSeparatorClasses: Record<NavbarSeparatorVariant, string>;
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"u": { class: "underline", size: "text-base" },
|
|
26
26
|
"small": { class: "", size: "text-sm" },
|
|
27
27
|
"blockquote": { class: "border-l-4 border-gray-500 pl-2 opacity-70", size: "text-base" },
|
|
28
|
-
"pre": { class: "font-mono bg-sub-background px-3 py-2
|
|
29
|
-
"code": { class: "font-mono bg-sub-background px-1
|
|
30
|
-
"a": { class: "text-blue-400
|
|
28
|
+
"pre": { class: "font-mono bg-sub-background px-3 py-2 rounded overflow-x-auto whitespace-pre", size: "text-base" },
|
|
29
|
+
"code": { class: "font-mono bg-sub-background px-1 rounded inline-block", size: "text-base" },
|
|
30
|
+
"a": { class: "text-blue-400 decoration-blue-400/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-blue-400 ", size: "text-base" },
|
|
31
31
|
"li": { class: "text-base list-disc list-inside", size: "text-base" },
|
|
32
32
|
"h1": { class: "font-bold", size: "text-4xl" },
|
|
33
33
|
"h2": { class: "font-bold", size: "text-3xl" },
|