@hashrytech/quick-components-kit 0.2.1 → 0.3.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/CHANGELOG.md +12 -0
- package/README.md +48 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/quick-components-kit-plugin.d.ts +2 -0
- package/dist/quick-components-kit-plugin.js +10 -0
- package/dist/text-input/TextInput.svelte +85 -0
- package/dist/text-input/TextInput.svelte.d.ts +47 -0
- package/dist/text-input/index.d.ts +1 -0
- package/dist/text-input/index.js +1 -0
- package/package.json +5 -2
- package/dist/text-box/TextBox.svelte +0 -1
- package/dist/text-box/TextBox.svelte.d.ts +0 -26
- package/dist/text-box/index.d.ts +0 -1
- package/dist/text-box/index.js +0 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -13,4 +13,52 @@ or via yarn:
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
yarn add @hashrytech/quick-components-kit
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configurations
|
|
19
|
+
Set default theme values for primary and secondary variables:
|
|
20
|
+
- Color gradient
|
|
21
|
+
- Shadow
|
|
22
|
+
- Border radius
|
|
23
|
+
|
|
24
|
+
## Default Theme
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
@theme {
|
|
28
|
+
|
|
29
|
+
--breakpoint-xs: 480px;
|
|
30
|
+
--breakpoint-xxs: 400px;
|
|
31
|
+
--breakpoint-xxxs: 360px;
|
|
32
|
+
--breakpoint-xxxxs: 320px;
|
|
33
|
+
|
|
34
|
+
--color-primary-50: oklch(0.967 0.07 95.38);
|
|
35
|
+
--color-primary-100: oklch(0.933 0.094 95.47);
|
|
36
|
+
--color-primary-200: oklch(0.864 0.128 95.3);
|
|
37
|
+
--color-primary-300: oklch(0.767 0.165 95.31);
|
|
38
|
+
--color-primary-400: oklch(0.678 0.19 95.1);
|
|
39
|
+
--color-primary-500: oklch(0.608 0.2 94.82);
|
|
40
|
+
--color-primary-600: oklch(0.496 0.17 94.91);
|
|
41
|
+
--color-primary-700: oklch(0.397 0.145 94.53);
|
|
42
|
+
--color-primary-800: oklch(0.326 0.123 94.55);
|
|
43
|
+
--color-primary-900: oklch(0.282 0.106 94.7);
|
|
44
|
+
--color-primary-950: oklch(0.161 0.081 94.91);
|
|
45
|
+
|
|
46
|
+
--color-secondary-50: oklch(0.972 0.037 19.87);
|
|
47
|
+
--color-secondary-100: oklch(0.945 0.046 19.95);
|
|
48
|
+
--color-secondary-200: oklch(0.868 0.092 19.81);
|
|
49
|
+
--color-secondary-300: oklch(0.749 0.158 20.04);
|
|
50
|
+
--color-secondary-400: oklch(0.618 0.226 20.19);
|
|
51
|
+
--color-secondary-500: oklch(0.519 0.26 20.31);
|
|
52
|
+
--color-secondary-600: oklch(0.437 0.229 20.44);
|
|
53
|
+
--color-secondary-700: oklch(0.352 0.197 20.45);
|
|
54
|
+
--color-secondary-800: oklch(0.293 0.172 20.38);
|
|
55
|
+
--color-secondary-900: oklch(0.252 0.15 20.25);
|
|
56
|
+
--color-secondary-950: oklch(0.131 0.098 19.98);
|
|
57
|
+
|
|
58
|
+
--shadow-primary: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
59
|
+
--shadow-secondary: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
60
|
+
|
|
61
|
+
--radius-primary: 0.5rem;
|
|
62
|
+
--radius-secondary: 0.375rem;
|
|
63
|
+
}
|
|
16
64
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './button/index.js';
|
|
2
|
-
export * from './text-
|
|
2
|
+
export * from './text-input/index.js';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const quiickComponentsKitPlugin = plugin(function () {
|
|
4
|
+
// Optional: Add custom utilities
|
|
5
|
+
}, {
|
|
6
|
+
content: [
|
|
7
|
+
path.join(__dirname, '**/*.{svelte,js,ts}')
|
|
8
|
+
]
|
|
9
|
+
});
|
|
10
|
+
export default quiickComponentsKitPlugin;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Predefined size classes for the TextBox input.
|
|
7
|
+
* - "sm": h-[2.05rem] text-sm placeholder:text-sm
|
|
8
|
+
* - "md": h-[2.375rem] text-sm placeholder:text-sm
|
|
9
|
+
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
10
|
+
*/
|
|
11
|
+
export type TextInputSize = "sm" | "md" | "lg";
|
|
12
|
+
export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "url";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Props for the TextBox component.
|
|
16
|
+
*
|
|
17
|
+
* @prop {string} id - The unique ID of the input field.
|
|
18
|
+
* @prop {string} [name] - The name attribute for form submission.
|
|
19
|
+
* @prop {string} [value] - The bound value of the input.
|
|
20
|
+
* @prop {string} [placeholder] - Placeholder text.
|
|
21
|
+
* @prop {string} [labelText] - Optional label text.
|
|
22
|
+
* @prop {ClassNameValue} [inputStyle] - Additional Tailwind classes to apply to the input. Example: "border-red-500 text-green-600"
|
|
23
|
+
* @prop {TextInputSize} [size] - Size variant ("sm", "md", "lg") with predefined Tailwind styles.
|
|
24
|
+
* - "sm": h-[2.05rem] text-sm placeholder:text-sm
|
|
25
|
+
* - "md": h-[2.375rem] text-sm placeholder:text-sm
|
|
26
|
+
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
27
|
+
* @prop {() => void} [onchange] - Event handler for change events.
|
|
28
|
+
* @prop {() => void} [onmouseup] - Event handler for mouseup events.
|
|
29
|
+
* @prop {Snippet} [label] - Custom label snippet.
|
|
30
|
+
*/
|
|
31
|
+
export type TextInputProps = {
|
|
32
|
+
id: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
value?: string;
|
|
35
|
+
type?: TextInputType;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
labelText?: string;
|
|
38
|
+
inputStyle?: ClassNameValue;
|
|
39
|
+
size?: TextInputSize;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
required?: boolean;
|
|
42
|
+
error?: string;
|
|
43
|
+
onchange?: () => void;
|
|
44
|
+
onmouseup?: () => void;
|
|
45
|
+
label?: Snippet;
|
|
46
|
+
icon?: Snippet;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
import { twMerge } from 'tailwind-merge';
|
|
54
|
+
|
|
55
|
+
let { id, type="text", name="", value="", placeholder="", labelText, size="md", inputStyle="", disabled=false, required=false, error, onchange, onmouseup, label, icon}: TextInputProps = $props();
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Predefined size classes for the TextBox input.
|
|
59
|
+
* - "sm": h-[2.05rem] text-sm placeholder:text-sm
|
|
60
|
+
* - "md": h-[2.375rem] text-sm placeholder:text-sm
|
|
61
|
+
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
62
|
+
*/
|
|
63
|
+
let sizeStyle: Record<TextInputSize, string> = {
|
|
64
|
+
sm: "h-[2.05rem] text-sm placeholder:text-sm",
|
|
65
|
+
md: "h-[2.375rem] text-sm placeholder:text-sm",
|
|
66
|
+
lg: "h-[2.8rem] text-lg placeholder:text-lg"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div class="flex flex-col gap-1 w-full">
|
|
72
|
+
{#if label}{@render label()}{:else}{#if labelText}<label for={id} class="text-sm font-medium text-neutral-600 ml-1">{labelText}</label>{/if}{/if}
|
|
73
|
+
<div class="relative">
|
|
74
|
+
{#if icon}<div class="absolute inset-y-0 left-0 flex items-center justify-center rounded-l-primary m-0.5 w-10">{@render icon()}</div>{/if}
|
|
75
|
+
<input {disabled} {required} {type} {id} {name} {placeholder} {onchange} {onmouseup} bind:value
|
|
76
|
+
class={twMerge("rounded-primary border-neutral-300 focus:border-primary-500 focus:ring-primary-500 placeholder:opacity-50 disabled:bg-neutral-300/30 disabled:border-gray-300/30",
|
|
77
|
+
error ? "bg-red-50 border-red-300 ring-red-300" : "",
|
|
78
|
+
icon ? "pl-10" : "",
|
|
79
|
+
sizeStyle[size], inputStyle)}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
{#if error}
|
|
83
|
+
<p class="text-sm text-red-500 mt-0.5 bg-red-100/30 px-2 rounded-primary">This is a an error message that is larger and bigger.</p>
|
|
84
|
+
{/if}
|
|
85
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
/**
|
|
4
|
+
* Predefined size classes for the TextBox input.
|
|
5
|
+
* - "sm": h-[2.05rem] text-sm placeholder:text-sm
|
|
6
|
+
* - "md": h-[2.375rem] text-sm placeholder:text-sm
|
|
7
|
+
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
8
|
+
*/
|
|
9
|
+
export type TextInputSize = "sm" | "md" | "lg";
|
|
10
|
+
export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "url";
|
|
11
|
+
/**
|
|
12
|
+
* Props for the TextBox component.
|
|
13
|
+
*
|
|
14
|
+
* @prop {string} id - The unique ID of the input field.
|
|
15
|
+
* @prop {string} [name] - The name attribute for form submission.
|
|
16
|
+
* @prop {string} [value] - The bound value of the input.
|
|
17
|
+
* @prop {string} [placeholder] - Placeholder text.
|
|
18
|
+
* @prop {string} [labelText] - Optional label text.
|
|
19
|
+
* @prop {ClassNameValue} [inputStyle] - Additional Tailwind classes to apply to the input. Example: "border-red-500 text-green-600"
|
|
20
|
+
* @prop {TextInputSize} [size] - Size variant ("sm", "md", "lg") with predefined Tailwind styles.
|
|
21
|
+
* - "sm": h-[2.05rem] text-sm placeholder:text-sm
|
|
22
|
+
* - "md": h-[2.375rem] text-sm placeholder:text-sm
|
|
23
|
+
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
24
|
+
* @prop {() => void} [onchange] - Event handler for change events.
|
|
25
|
+
* @prop {() => void} [onmouseup] - Event handler for mouseup events.
|
|
26
|
+
* @prop {Snippet} [label] - Custom label snippet.
|
|
27
|
+
*/
|
|
28
|
+
export type TextInputProps = {
|
|
29
|
+
id: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
value?: string;
|
|
32
|
+
type?: TextInputType;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
labelText?: string;
|
|
35
|
+
inputStyle?: ClassNameValue;
|
|
36
|
+
size?: TextInputSize;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
required?: boolean;
|
|
39
|
+
error?: string;
|
|
40
|
+
onchange?: () => void;
|
|
41
|
+
onmouseup?: () => void;
|
|
42
|
+
label?: Snippet;
|
|
43
|
+
icon?: Snippet;
|
|
44
|
+
};
|
|
45
|
+
declare const TextInput: import("svelte").Component<TextInputProps, {}, "">;
|
|
46
|
+
type TextInput = ReturnType<typeof TextInput>;
|
|
47
|
+
export default TextInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextInput } from './TextInput.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextInput } from './TextInput.svelte';
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/hashrytech/quick-components-kit.git"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.3.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Hashry Tech",
|
|
11
11
|
"files": [
|
|
@@ -36,5 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"svelte"
|
|
39
|
-
]
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"tailwind-merge": "^3.3.0"
|
|
42
|
+
}
|
|
40
43
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>Hello</p>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default TextBox;
|
|
2
|
-
type TextBox = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const TextBox: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
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> {
|
|
15
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
-
$$bindings?: Bindings;
|
|
17
|
-
} & Exports;
|
|
18
|
-
(internal: unknown, props: {
|
|
19
|
-
$$events?: Events;
|
|
20
|
-
$$slots?: Slots;
|
|
21
|
-
}): Exports & {
|
|
22
|
-
$set?: any;
|
|
23
|
-
$on?: any;
|
|
24
|
-
};
|
|
25
|
-
z_$$bindings?: Bindings;
|
|
26
|
-
}
|
package/dist/text-box/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TextBox } from './TextBox.svelte';
|
package/dist/text-box/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TextBox } from './TextBox.svelte';
|