@valerius_petrini/corekit-ui 0.1.86 → 0.1.88

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.
@@ -38,6 +38,6 @@
38
38
  {/snippet}
39
39
 
40
40
  <Story name="Default" args={{ variant: "bordered", size: "md", footer, header }}>
41
- <Text tag="h2" class="text-2xl font-bold mb-4">Customizable Card</Text>
41
+ <Text tag="h2" class="mb-2">Customizable Card</Text>
42
42
  <Text class="mb-4">This is a customizable card component. You can add any content here and style it as needed.</Text>
43
43
  </Story>
@@ -0,0 +1,11 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Skeleton from "./index.svelte";
4
+
5
+ const { Story } = defineMeta({
6
+ title: "Components/Display/Skeleton",
7
+ component: Skeleton,
8
+ });
9
+ </script>
10
+
11
+ <Story name="Default"></Story>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Index = InstanceType<typeof Index>;
18
+ export default Index;
@@ -0,0 +1,23 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Checkbox from "./index.svelte";
4
+ import { colorStyles, colorStyleTypes } from "../../../styles/color.js";
5
+ import { sizeStyles } from "../../../styles/size.js";
6
+
7
+ const { Story } = defineMeta({
8
+ title: "Components/Inputs/Checkbox",
9
+ component: Checkbox,
10
+ argTypes: {
11
+ size: {
12
+ control: "select",
13
+ options: sizeStyles,
14
+ },
15
+ radius: {
16
+ control: "select",
17
+ options: sizeStyles,
18
+ }
19
+ },
20
+ });
21
+ </script>
22
+
23
+ <Story name="Default" args={{ label: "Input Label" }}></Story>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Index = InstanceType<typeof Index>;
18
+ export default Index;
@@ -19,7 +19,7 @@
19
19
  ...restProps
20
20
  }: CheckboxProps = $props();
21
21
 
22
- let defaultClass = "z-20 bg-form-input-background text-main-text rounded-lg outline-none focus:ring-2 focus:ring-blue-500 transition-all";
22
+ let defaultClass = "w-4 h-4 z-20 bg-form-background text-main-text rounded outline-none transition-all checked:bg-blue-500";
23
23
  let defaultLabelClass = "block text-sub-text font-medium";
24
24
  let defaultDivClass = "relative flex items-center gap-2";
25
25
 
@@ -28,7 +28,7 @@
28
28
  let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
29
29
  </script>
30
30
 
31
- <div class={combinedDivClass}>
31
+ <Text tag="label" for={id} class={combinedDivClass}>
32
32
  <input
33
33
  type="checkbox"
34
34
  id={id}
@@ -36,7 +36,28 @@
36
36
  class={combinedClass}
37
37
  {...restProps}
38
38
  bind:this={element}/>
39
- <Text tag="label" for={id} class={combinedLabelClass}>
40
- {label}
41
- </Text>
42
- </div>
39
+ {label}
40
+ </Text>
41
+
42
+ <style>
43
+ input[type="checkbox"] {
44
+ appearance: none;
45
+ }
46
+
47
+ input[type="checkbox"]:checked::before {
48
+ transform: scale(1);
49
+ }
50
+
51
+ input[type="checkbox"]::before {
52
+ content: "";
53
+ width: 80%;
54
+ height: 80%;
55
+ margin: 1.5px;
56
+ transform: scale(0);
57
+ transform-origin: bottom left;
58
+ transition: 150ms transform ease-in-out;
59
+ display: block;
60
+ background-color: white;
61
+ clip-path: polygon(14% 44%, 0% 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
62
+ }
63
+ </style>
@@ -0,0 +1,33 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Select from "./index.svelte";
4
+ import { sizeStyles } from "../../../styles/size.js";
5
+
6
+ const { Story } = defineMeta({
7
+ title: "Components/Inputs/Select",
8
+ component: Select,
9
+ argTypes: {
10
+ size: {
11
+ control: "select",
12
+ options: sizeStyles,
13
+ },
14
+ radius: {
15
+ control: "select",
16
+ options: sizeStyles,
17
+ },
18
+ type: {
19
+ control: "select",
20
+ options: ["text", "password", "email", "number", "search", "tel", "url"],
21
+ },
22
+ },
23
+ });
24
+ </script>
25
+
26
+ <Story name="Default" args={{ label: "Input Label", placeholder: "Select an Item", options: [
27
+ { label: "Option 1", value: "option1" },
28
+ { label: "Option 2", value: "option2" },
29
+ { label: "Option 3", value: "option3" },
30
+ { label: "Option 4", value: "option4" },
31
+ { label: "Option 5", value: "option5" },
32
+ { label: "Option 6", value: "option6" },
33
+ ]}}></Story>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Index = InstanceType<typeof Index>;
18
+ export default Index;
@@ -13,6 +13,7 @@
13
13
  children = undefined,
14
14
  class: className = "",
15
15
  element = $bindable(),
16
+ placeholder = "",
16
17
  label = "",
17
18
  labelClass = "",
18
19
  divClass = "",
@@ -77,6 +78,9 @@
77
78
  bind:value={value}
78
79
  style={customStyle}
79
80
  {...restProps}>
81
+ {#if placeholder}
82
+ <option value="" disabled selected>{placeholder}</option>
83
+ {/if}
80
84
  {#each options as option}
81
85
  <option value={option.value}>{option.label}</option>
82
86
  {/each}
@@ -4,4 +4,5 @@ export interface SelectProps extends BaseInputProps {
4
4
  value: any;
5
5
  label: string;
6
6
  }[];
7
+ placeholder: string;
7
8
  }
@@ -0,0 +1,16 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Link from "./index.svelte";
4
+
5
+ const { Story } = defineMeta({
6
+ title: "Components/Typography/Link",
7
+ component: Link,
8
+ argTypes: {
9
+
10
+ }
11
+ });
12
+ </script>
13
+
14
+ <Story name="Default" args={{ href: "https://example.com" }}>
15
+ The quick brown fox jumps over the lazy dog.
16
+ </Story>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Index = InstanceType<typeof Index>;
18
+ export default Index;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import { sizeStyleParts, type SizeStyleTheme } from "../../../styles/size";
3
+ import { getLinkProps } from "../../../utils/link.js";
4
+ import { multiAction } from "../../../utils/multiAction.js";
5
+ import type { TextProps } from "./types.js";
6
+ import { twMerge } from "tailwind-merge";
7
+
8
+ let {
9
+ children = undefined,
10
+ class: className = "",
11
+ element = $bindable(),
12
+ href = "",
13
+ external = false,
14
+ size = "none",
15
+ use = [],
16
+ ...restProps
17
+ }: TextProps = $props();
18
+
19
+ let combinedClass = $derived(twMerge(
20
+ "text-main-text font-body text-link decoration-link/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-link text-base",
21
+ sizeStyleParts[size as SizeStyleTheme]?.text || "",
22
+ className
23
+ ));
24
+ </script>
25
+
26
+ <a bind:this={element} {href} class={combinedClass} {...restProps} use:multiAction={use} {...getLinkProps(href, external, false)}>
27
+ {@render children?.()}
28
+ </a>
@@ -0,0 +1,4 @@
1
+ import type { TextProps } from "./types.ts";
2
+ declare const Index: import("svelte").Component<TextProps, {}, "element">;
3
+ type Index = ReturnType<typeof Index>;
4
+ export default Index;
@@ -0,0 +1,7 @@
1
+ import type { SizeStyle } from "../../../styles/size.ts";
2
+ import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
3
+ export interface TextProps extends BaseComponentProps {
4
+ href?: string;
5
+ external?: boolean;
6
+ size?: SizeStyle;
7
+ }
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { sizeStyleParts, textStyle, type SizeStyleTheme } from "../../../styles/size";
3
+ import { multiAction } from "../../../utils/multiAction.js";
3
4
  import type { TextProps } from "./types.js";
4
5
  import { twMerge } from "tailwind-merge";
5
6
 
@@ -8,59 +9,43 @@
8
9
  class: className = "",
9
10
  element = $bindable(),
10
11
  tag = "p",
11
- shrink = undefined,
12
12
  size = "none",
13
+ use = [],
13
14
  ...restProps
14
15
  }: TextProps = $props();
15
16
 
16
- const tagStyles: Record<string, { class: string; size: keyof typeof textStyle }> = {
17
- "p": { class: "", size: "text-base" },
18
- "div": { class: "", size: "text-base" },
19
- "span": { class: "", size: "text-base" },
20
- "label": { class: "text-sub-text font-semibold", size: "text-xs" },
21
- "strong": { class: "font-bold", size: "text-base" },
22
- "b": { class: "font-bold", size: "text-base" },
23
- "em": { class: "italic", size: "text-base" },
24
- "i": { class: "italic", size: "text-base" },
25
- "u": { class: "underline", size: "text-base" },
26
- "small": { class: "", size: "text-sm" },
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 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
- "li": { class: "text-base list-disc list-inside", size: "text-base" },
32
- "h1": { class: "font-bold font-display", size: "text-4xl" },
33
- "h2": { class: "font-bold font-display", size: "text-3xl" },
34
- "h3": { class: "font-semibold font-display", size: "text-2xl" },
35
- "h4": { class: "font-semibold font-display", size: "text-xl" },
36
- "h5": { class: "font-medium font-display", size: "text-lg" },
37
- "h6": { class: "font-normal font-display", size: "text-base" }
17
+ const tagStyles: Record<string, string> = {
18
+ "p": "text-base",
19
+ "div": " text-base",
20
+ "span": " text-base",
21
+ "label": "text-sub-text font-semibold text-xs",
22
+ "strong": "font-bold text-base",
23
+ "b": "font-bold text-base",
24
+ "em": "italic text-base",
25
+ "i": "italic text-base",
26
+ "u": "underline text-base",
27
+ "small": " text-sm",
28
+ "blockquote": "border-l-4 border-gray-500 pl-2 opacity-70 text-base",
29
+ "pre": "font-mono bg-sub-background px-3 py-2 rounded overflow-x-auto whitespace-pre text-base",
30
+ "code": "font-mono bg-sub-background px-1 rounded inline-block text-base",
31
+ "a": "text-link decoration-link/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-link text-base",
32
+ "li": "text-base list-disc list-inside text-base",
33
+ "h1": "font-bold font-display text-4xl",
34
+ "h2": "font-bold font-display text-3xl",
35
+ "h3": "font-semibold font-display text-2xl",
36
+ "h4": "font-semibold font-display text-xl",
37
+ "h5": "font-medium font-display text-lg",
38
+ "h6": "font-normal font-display text-base"
38
39
  };
39
40
 
40
- function getTextSizeInRem(): string {
41
- if (size !== "none") {
42
- const sizeKey = (sizeStyleParts[size as SizeStyleTheme]?.text ?? "text-base") as keyof typeof textStyle;
43
- return textStyle[sizeKey] ?? textStyle["text-base"];
44
- }
45
-
46
- return textStyle[tagStyles[tag]?.size || "text-base"] ?? textStyle["text-base"];
47
- }
48
-
49
- let shrinkStyle = $derived(shrink
50
- ? `font-size: clamp(8px, ${shrink}cqi, ${getTextSizeInRem()}); white-space: nowrap; display: block; width: fit-content;`
51
- : ""
52
- );
53
-
54
- let defaultClass = "text-main-text font-body";
55
41
  let combinedClass = $derived(twMerge(
56
- defaultClass,
57
- tagStyles[tag]?.class || "",
58
- tagStyles[tag]?.size || "",
42
+ "text-main-text font-body",
43
+ tagStyles[tag],
59
44
  sizeStyleParts[size as SizeStyleTheme]?.text || "",
60
45
  className
61
46
  ));
62
47
  </script>
63
48
 
64
- <svelte:element bind:this={element} this={tag} style={shrinkStyle} class={combinedClass} {...restProps}>
49
+ <svelte:element bind:this={element} this={tag} class={combinedClass} {...restProps} use:multiAction={use}>
65
50
  {@render children?.()}
66
51
  </svelte:element>
@@ -3,7 +3,6 @@ import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
3
3
  type TextTagOptions = "p" | "div" | "span" | "label" | "strong" | "em" | "b" | "i" | "u" | "small" | "blockquote" | "pre" | "code" | "a" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4
4
  export interface TextProps extends BaseComponentProps {
5
5
  tag?: TextTagOptions;
6
- shrink?: number;
7
6
  size?: SizeStyle;
8
7
  }
9
8
  export {};
@@ -1,4 +1,5 @@
1
1
  export { default as Text } from "./Text/index.svelte";
2
+ export { default as Link } from "./Link/index.svelte";
2
3
  export { default as Typewriter } from "./Typewriter/index.svelte";
3
4
  export type { TextProps } from "./Text/types.ts";
4
5
  export type { TypewriterAction, DisplaySegment } from "./Typewriter/types.ts";
@@ -1,2 +1,3 @@
1
1
  export { default as Text } from "./Text/index.svelte";
2
+ export { default as Link } from "./Link/index.svelte";
2
3
  export { default as Typewriter } from "./Typewriter/index.svelte";
@@ -19,6 +19,7 @@
19
19
  --color-form-hover: var(--vpcui-form-hover);
20
20
  --color-form-border: var(--vpcui-form-border);
21
21
  --color-sub-background-border-hover: var(--vpcui-sub-background-border-hover);
22
+ --color-link: var(--vpcui-link);
22
23
 
23
24
  --color-primary: var(--vpcui-primary);
24
25
  --color-secondary: var(--vpcui-secondary);
@@ -93,8 +94,10 @@
93
94
  --vpcui-loader-btn-color: rgba(255, 255, 255, 0.25);
94
95
 
95
96
  --vpcui-font-display: ui-serif, Georgia, serif;
96
- --vpcui-font-body: ui-sans-serif, system-ui sans-serif;
97
+ --vpcui-font-body: ui-sans-serif, system-ui, sans-serif;
97
98
  --vpcui-font-mono: ui-monospace, monospace;
99
+
100
+ --vpcui-link: #2673f1;
98
101
  }
99
102
 
100
103
  html.dark {
@@ -122,6 +125,8 @@ html.dark {
122
125
  --vpcui-form-hover: var(--vpcui-dark-200);
123
126
 
124
127
  --vpcui-loader-btn-color: rgba(0, 0, 0, 0.25);
128
+
129
+ --vpcui-link: #4a90e2;
125
130
  }
126
131
 
127
132
  html {
@@ -1,9 +1,11 @@
1
+ import type { Action } from "svelte/action";
1
2
  import type { SizeStyle } from "../styles/size";
2
3
  import type { Component } from "svelte";
3
4
  export interface BaseComponentProps {
4
5
  children?: any;
5
6
  class?: string;
6
7
  element?: HTMLElement;
8
+ use?: [Action, any?][];
7
9
  [key: string]: any;
8
10
  }
9
11
  export type InputVariant = "default" | "floating";
@@ -0,0 +1,4 @@
1
+ import type { Action } from "svelte/action";
2
+ export declare function multiAction(node: HTMLElement, actions: [Action, any?][]): {
3
+ destroy(): void;
4
+ };
@@ -0,0 +1,8 @@
1
+ export function multiAction(node, actions) {
2
+ const instances = actions.map(([action, params]) => action(node, params));
3
+ return {
4
+ destroy() {
5
+ instances.forEach(isnt => isnt?.destroy?.());
6
+ }
7
+ };
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.86",
3
+ "version": "0.1.88",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",