@valerius_petrini/corekit-ui 0.1.44 → 0.1.45

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.
@@ -29,12 +29,6 @@
29
29
  let combinedClass = $derived(twMerge(defaultClass, className));
30
30
  </script>
31
31
 
32
- {#if href}
33
- <a class={combinedClass} {href} {...restProps}>
34
- {@render children?.()}
35
- </a>
36
- {:else}
37
- <button class={combinedClass} {...restProps}>
38
- {@render children?.()}
39
- </button>
40
- {/if}
32
+ <svelte:element this={href ? "a" : "button"} class={combinedClass} {href} {...restProps}>
33
+ {@render children?.()}
34
+ </svelte:element>
@@ -1,16 +1,24 @@
1
1
  <script lang="ts">
2
+ import type { CardProps } from "../types/Card.js";
3
+ import type { SvelteComponent } from "svelte";
2
4
  import { twMerge } from "tailwind-merge";
3
5
 
4
6
  let {
5
7
  children = undefined,
6
8
  class: className = "",
9
+ href = undefined,
7
10
  ...restProps
8
- } = $props();
11
+ }: CardProps = $props();
9
12
 
10
13
  let defaultClass = "text-main-text shadow-xl rounded-lg transition-colors bg-sub-background hover:bg-sub-background-hover p-4";
11
14
  let combinedClass = $derived(twMerge(defaultClass, className));
12
15
  </script>
13
16
 
14
- <div class={combinedClass}>
17
+ <svelte:element
18
+ this={href ? "a" : "div"}
19
+ class={combinedClass}
20
+ {...(href ? { href } : {})}
21
+ {...restProps}
22
+ >
15
23
  {@render children?.()}
16
- </div>
24
+ </svelte:element>
@@ -1,6 +1,4 @@
1
- declare const Card: import("svelte").Component<{
2
- children?: any;
3
- class?: string;
4
- } & Record<string, any>, {}, "">;
1
+ import type { CardProps } from "../types/Card.js";
2
+ declare const Card: import("svelte").Component<CardProps, {}, "">;
5
3
  type Card = ReturnType<typeof Card>;
6
4
  export default Card;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { FloatingInputProps } from "../types/FloatingInput.js";
3
3
  import { twMerge } from "tailwind-merge";
4
+ import Text from "./Text.svelte";
4
5
 
5
6
  let {
6
7
  children = undefined,
@@ -29,7 +30,7 @@
29
30
  let originalLabelClass = "left-2 z-0";
30
31
  let originalLabelClassInput = "top-1/2 transform -translate-y-1/2";
31
32
  let originalLabelClassTextArea = "top-2";
32
- let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]";
33
+ let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]!";
33
34
 
34
35
  let invalidClass = "border border-red-500 focus:ring-red-500";
35
36
 
@@ -52,9 +53,9 @@
52
53
  </script>
53
54
 
54
55
  <div class={combinedDivClass}>
55
- <label for={id} class={combinedLabelClass}>
56
+ <Text tag="label" for={id} class={combinedLabelClass}>
56
57
  {@render children?.()}
57
- </label>
58
+ </Text>
58
59
  {#if isTextArea}
59
60
  <textarea
60
61
  {id}
@@ -70,7 +71,7 @@
70
71
  bind:value={value}
71
72
  onfocus={handleFocus}
72
73
  onblur={handleBlur}
73
- class={combinedClass}
74
+ class={combinedClass}
74
75
  {...restProps}
75
76
  />
76
77
  {/if}
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { FloatingSelectProps } from "../types/FloatingSelect.js";
3
3
  import { twMerge } from "tailwind-merge";
4
+ import Text from "./Text.svelte";
4
5
 
5
6
  let {
6
7
  children = undefined,
@@ -17,8 +18,7 @@
17
18
  let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
18
19
  let defaultDivClass = "relative w-fit";
19
20
 
20
- let originalLabelClass = "left-2 top-1/2 transform -translate-y-1/2 z-0";
21
- let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]";
21
+ let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]!";
22
22
 
23
23
  let combinedLabelClass = $derived(twMerge(defaultLabelClass, selectedLabelClass, className));
24
24
  let combinedSelectClass = $derived(twMerge(defaultSelectClass, className));
@@ -26,9 +26,9 @@
26
26
  </script>
27
27
 
28
28
  <div class={combinedDivClass}>
29
- <label for={id} class={combinedLabelClass}>
29
+ <Text tag="label" for={id} class={combinedLabelClass}>
30
30
  {@render children?.()}
31
- </label>
31
+ </Text>
32
32
  <select {id} class={combinedSelectClass} {...restProps} bind:value={value}>
33
33
  {#each options as option}
34
34
  <option value={option.value} class={optionClass}>
@@ -1,16 +1,39 @@
1
1
  <script lang="ts">
2
+ import type { TextProps } from "../types/Text.js";
2
3
  import { twMerge } from "tailwind-merge";
3
4
 
4
5
  let {
5
6
  children = undefined,
6
7
  class: className = "",
8
+ tag = "p",
7
9
  ...restProps
8
- } = $props();
10
+ }: TextProps = $props();
11
+
12
+ const tagStyles = {
13
+ "p": "text-base",
14
+ "div": "text-base",
15
+ "span": "text-base",
16
+ "label": "text-sm",
17
+ "strong": "text-base font-bold",
18
+ "em": "text-base italic",
19
+ "small": "text-sm",
20
+ "blockquote": "border-l-4 border-gray-500 pl-2 opacity-70",
21
+ "pre": "font-mono bg-sub-background px-3 py-2 rounded overflow-x-auto whitespace-pre",
22
+ "code": "font-mono bg-sub-background px-3 py-2 rounded inline-block",
23
+ "a": "text-blue-400 hover:text-blue-500 hover:underline",
24
+ "li": "text-base list-disc list-inside",
25
+ "h1": "text-6xl font-extrabold",
26
+ "h2": "text-5xl font-bold",
27
+ "h3": "text-4xl font-semibold",
28
+ "h4": "text-3xl font-medium",
29
+ "h5": "text-2xl font-medium",
30
+ "h6": "text-xl font-medium"
31
+ };
9
32
 
10
33
  let defaultClass = "text-main-text";
11
- let combinedClass = $derived(twMerge(defaultClass, className));
34
+ let combinedClass = $derived(twMerge(defaultClass, className, tagStyles[tag] || ""));
12
35
  </script>
13
36
 
14
- <p class={combinedClass}>
37
+ <svelte:element this={tag} class={combinedClass} {...restProps}>
15
38
  {@render children?.()}
16
- </p>
39
+ </svelte:element>
@@ -1,6 +1,4 @@
1
- declare const Text: import("svelte").Component<{
2
- children?: any;
3
- class?: string;
4
- } & Record<string, any>, {}, "">;
1
+ import type { TextProps } from "../types/Text.js";
2
+ declare const Text: import("svelte").Component<TextProps, {}, "">;
5
3
  type Text = ReturnType<typeof Text>;
6
4
  export default Text;
@@ -3,6 +3,7 @@
3
3
  import { onMount } from "svelte";
4
4
 
5
5
  import type { DisplaySegment, TypewriterProps } from "../types/Typewriter.d.js";
6
+ import Text from "./Text.svelte";
6
7
 
7
8
  let {
8
9
  actions,
@@ -66,7 +67,7 @@
66
67
  <div class={combinedClass} {...restProps}>
67
68
  {#each displaySegments as segment}
68
69
  {#key segment}
69
- <span style="color: {segment.color}">{segment.text}</span>
70
+ <Text tag="span" style="color: {segment.color}">{segment.text}</Text>
70
71
  {/key}
71
72
  {/each}
72
73
  </div>
@@ -30,8 +30,8 @@
30
30
 
31
31
  html.dark {
32
32
  --vpcui-color-main-background: #121212;
33
- --vpcui-color-sub-background: #161616;
34
- --vpcui-color-sub-background-hover: #1c1c1c;
33
+ --vpcui-color-sub-background: #1c1c1c;
34
+ --vpcui-color-sub-background-hover: #242424;
35
35
  --vpcui-color-main-text: #fff;
36
36
  --vpcui-color-sub-text: #aaa;
37
37
  --vpcui-color-form-input-background: #1c1c1c;
@@ -0,0 +1,6 @@
1
+ export interface CardProps {
2
+ children?: any;
3
+ class?: string;
4
+ href?: string;
5
+ [key: string]: any;
6
+ }
@@ -0,0 +1,8 @@
1
+ type TextTagOptions = "p" | "div" | "span" | "label" | "strong" | "em" | "small" | "blockquote" | "pre" | "code" | "a" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
2
+
3
+ export interface TextProps {
4
+ children?: any;
5
+ class?: string;
6
+ tag?: TextTagOptions;
7
+ [key: string]: any;
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",