@hashrytech/quick-components-kit 0.1.1 → 0.3.0

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 CHANGED
@@ -1,14 +1,19 @@
1
- # quick-components-kit
1
+ # @hashrytech/quick-components-kit
2
2
 
3
- ## 0.1.1
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: adding textinput component
8
+
9
+ ## 0.2.1
4
10
 
5
11
  ### Patch Changes
6
12
 
7
- - Moving changeset to dev dependency
8
- - Testing publish config update
13
+ - Removing private from package.json
9
14
 
10
- ## 0.1.0
15
+ ## 0.2.0
11
16
 
12
17
  ### Minor Changes
13
18
 
14
- - Initial testing and setup
19
+ - Repo formatting and inclusion of actions
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Hashry Tech
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hashry Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # quick-components-kit
2
- A Svelte component library and toolset
2
+ A Svelte component library and toolkit
3
3
 
4
4
  ## Install
5
5
 
@@ -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
  ```
@@ -1,22 +1,22 @@
1
- <script lang="ts">
2
- export let type: 'button' | 'submit' | 'reset' = 'button';
3
- export let variant: 'primary' | 'secondary' | 'danger' = 'primary';
4
- export let size: 'sm' | 'md' | 'lg' = 'md';
5
- export let disabled: boolean = false;
6
- export let className: string = ''; // Allow extra classes
7
- </script>
8
-
9
- <button
10
- type={type}
11
- class={`inline-flex items-center justify-center font-medium rounded-md
12
- ${variant === 'primary' ? 'bg-blue-600 text-white hover:bg-blue-700' : ''}
13
- ${variant === 'secondary' ? 'bg-gray-200 text-gray-800 hover:bg-gray-300' : ''}
14
- ${variant === 'danger' ? 'bg-red-600 text-white hover:bg-red-700' : ''}
15
- ${size === 'sm' ? 'px-2 py-1 text-sm' : ''}
16
- ${size === 'md' ? 'px-4 py-2 text-base' : ''}
17
- ${size === 'lg' ? 'px-6 py-3 text-lg' : ''}
18
- ${disabled ? 'opacity-50 cursor-not-allowed' : ''}
19
- ${className}`}
20
- disabled={disabled}>
21
- <slot />
22
- </button>
1
+ <script lang="ts">
2
+ export let type: 'button' | 'submit' | 'reset' = 'button';
3
+ export let variant: 'primary' | 'secondary' | 'danger' = 'primary';
4
+ export let size: 'sm' | 'md' | 'lg' = 'md';
5
+ export let disabled: boolean = false;
6
+ export let className: string = ''; // Allow extra classes
7
+ </script>
8
+
9
+ <button
10
+ type={type}
11
+ class={`inline-flex items-center justify-center font-medium rounded-md
12
+ ${variant === 'primary' ? 'bg-blue-600 text-white hover:bg-blue-700' : ''}
13
+ ${variant === 'secondary' ? 'bg-gray-200 text-gray-800 hover:bg-gray-300' : ''}
14
+ ${variant === 'danger' ? 'bg-red-600 text-white hover:bg-red-700' : ''}
15
+ ${size === 'sm' ? 'px-2 py-1 text-sm' : ''}
16
+ ${size === 'md' ? 'px-4 py-2 text-base' : ''}
17
+ ${size === 'lg' ? 'px-6 py-3 text-lg' : ''}
18
+ ${disabled ? 'opacity-50 cursor-not-allowed' : ''}
19
+ ${className}`}
20
+ disabled={disabled}>
21
+ <slot />
22
+ </button>
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './button/index.js';
2
- export * from './text-box/index.js';
2
+ export * from './text-input/index.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Reexport your entry components here
2
2
  // lib/index.js
3
3
  export * from './button/index.js';
4
- export * from './text-box/index.js';
4
+ export * from './text-input/index.js';
5
5
  // Add more components here...
@@ -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
@@ -1,101 +1,43 @@
1
1
  {
2
- "name": "@hashrytech/quick-components-kit",
3
- "description": "A Svelte component library and toolset",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
- },
8
- "version": "0.1.1",
9
- "license": "MIT",
10
- "author": "Hashry Tech",
11
- "scripts": {
12
- "dev": "vite dev",
13
- "build": "vite build && npm run prepack",
14
- "preview": "vite preview",
15
- "prepare": "svelte-kit sync || echo ''",
16
- "prepack": "svelte-kit sync && svelte-package && publint",
17
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
18
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
19
- "format": "prettier --write .",
20
- "lint": "prettier --check . && eslint .",
21
- "test:unit": "vitest",
22
- "test": "npm run test:unit -- --run && npm run test:e2e",
23
- "test:e2e": "playwright test",
24
- "storybook": "storybook dev -p 6006",
25
- "build-storybook": "storybook build",
26
- "package": "svelte-package"
27
- },
28
- "files": [
29
- "dist",
30
- "!dist/**/*.test.*",
31
- "!dist/**/*.spec.*",
32
- "LICENSE",
33
- "README.md",
34
- "CHANGELOG.md"
35
- ],
36
- "sideEffects": [
37
- "**/*.css"
38
- ],
39
- "publishConfig": {
40
- "access": "public",
41
- "devDependencies": {},
42
- "scripts": {}
43
- },
44
- "svelte": "./dist/index.js",
45
- "types": "./dist/index.d.ts",
46
- "type": "module",
47
- "exports": {
48
- ".": {
49
- "types": "./dist/index.d.ts",
50
- "svelte": "./dist/index.js"
51
- }
52
- },
53
- "peerDependencies": {
54
- "svelte": "^5.0.0"
55
- },
56
- "devDependencies": {
57
- "@changesets/cli": "^2.29.4",
58
- "@chromatic-com/storybook": "^4.0.0",
59
- "@eslint/compat": "^1.2.9",
60
- "@eslint/js": "^9.27.0",
61
- "@playwright/test": "^1.52.0",
62
- "@storybook/addon-a11y": "^9.0.0",
63
- "@storybook/addon-docs": "^9.0.0",
64
- "@storybook/addon-svelte-csf": "^5.0.3",
65
- "@storybook/addon-vitest": "^9.0.0",
66
- "@storybook/sveltekit": "^9.0.0",
67
- "@sveltejs/adapter-auto": "^6.0.1",
68
- "@sveltejs/kit": "^2.21.1",
69
- "@sveltejs/package": "^2.3.11",
70
- "@sveltejs/vite-plugin-svelte": "^5.0.3",
71
- "@tailwindcss/forms": "^0.5.10",
72
- "@tailwindcss/vite": "^4.1.8",
73
- "@testing-library/jest-dom": "^6.6.3",
74
- "@testing-library/svelte": "^5.2.8",
75
- "@types/node": "^22",
76
- "@vitest/browser": "^3.1.4",
77
- "@vitest/coverage-v8": "^3.1.4",
78
- "eslint": "^9.27.0",
79
- "eslint-config-prettier": "^10.1.5",
80
- "eslint-plugin-storybook": "^9.0.0",
81
- "eslint-plugin-svelte": "^3.9.0",
82
- "globals": "^16.2.0",
83
- "jsdom": "^26.1.0",
84
- "playwright": "^1.52.0",
85
- "prettier": "^3.5.3",
86
- "prettier-plugin-svelte": "^3.4.0",
87
- "prettier-plugin-tailwindcss": "^0.6.11",
88
- "publint": "^0.3.12",
89
- "storybook": "^9.0.0",
90
- "svelte": "^5.33.5",
91
- "svelte-check": "^4.2.1",
92
- "tailwindcss": "^4.1.8",
93
- "typescript": "^5.8.3",
94
- "typescript-eslint": "^8.33.0",
95
- "vite": "^6.3.5",
96
- "vitest": "^3.1.4"
97
- },
98
- "keywords": [
99
- "svelte"
100
- ]
101
- }
2
+ "name": "@hashrytech/quick-components-kit",
3
+ "description": "A Svelte component library and toolset",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
+ },
8
+ "version": "0.3.0",
9
+ "license": "MIT",
10
+ "author": "Hashry Tech",
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.test.*",
14
+ "!dist/**/*.spec.*",
15
+ "LICENSE",
16
+ "README.md",
17
+ "CHANGELOG.md"
18
+ ],
19
+ "sideEffects": [
20
+ "**/*.css"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "svelte": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "svelte": "./dist/index.js"
32
+ }
33
+ },
34
+ "peerDependencies": {
35
+ "svelte": "^5.0.0"
36
+ },
37
+ "keywords": [
38
+ "svelte"
39
+ ],
40
+ "dependencies": {
41
+ "tailwind-merge": "^3.3.0"
42
+ }
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
- }
@@ -1 +0,0 @@
1
- export { default as TextBox } from './TextBox.svelte';
@@ -1 +0,0 @@
1
- export { default as TextBox } from './TextBox.svelte';