@hashrytech/quick-components-kit 0.13.2 → 0.13.4

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,5 +1,17 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.13.4
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: changing inputClasses prop for TextInput to just class
8
+
9
+ ## 0.13.3
10
+
11
+ ### Patch Changes
12
+
13
+ - patch: updating disabled state for button
14
+
3
15
  ## 0.13.2
4
16
 
5
17
  ### Patch Changes
@@ -3,8 +3,10 @@
3
3
  import type { ClassNameValue } from 'tailwind-merge';
4
4
 
5
5
  export type ButtonProps = {
6
+ disabled?: boolean;
6
7
  children?: Snippet;
7
8
  icon?: Snippet;
9
+ loadingIcon?: Snippet;
8
10
  onclick?: (event: MouseEvent) => void;
9
11
  class?: ClassNameValue;
10
12
  };
@@ -14,13 +16,15 @@
14
16
  <script lang="ts">
15
17
  import {twMerge} from 'tailwind-merge';
16
18
 
17
- let {children, icon, onclick, ...props}: ButtonProps = $props();
19
+ let { disabled=$bindable(), children, icon, loadingIcon, onclick, ...props }: ButtonProps = $props();
18
20
 
19
21
  </script>
20
22
 
21
- <button class={twMerge("flex flex-row items-center gap-2 px-4 py-2 bg-button-primary hover:bg-button-primary-hover rounded-primary w-fit cursor-pointer text-white focus:outline-focus-primary", props.class)}
23
+ <button {disabled} class={twMerge("flex flex-row items-center gap-2 px-4 py-2 bg-button-primary hover:bg-button-primary-hover rounded-primary w-fit cursor-pointer text-white focus:outline-focus-primary",
24
+ "disabled:bg-button-primary/60 disabled:cursor-default", props.class)}
22
25
  {onclick}>
23
26
  {#if icon}<span class="w-10">{@render icon()}</span>{/if}
27
+ {#if loadingIcon}<span class="w-10">{@render loadingIcon()}</span>{/if}
24
28
  {@render children?.()}
25
29
  </button>
26
30
 
@@ -1,11 +1,13 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { ClassNameValue } from 'tailwind-merge';
3
3
  export type ButtonProps = {
4
+ disabled?: boolean;
4
5
  children?: Snippet;
5
6
  icon?: Snippet;
7
+ loadingIcon?: Snippet;
6
8
  onclick?: (event: MouseEvent) => void;
7
9
  class?: ClassNameValue;
8
10
  };
9
- declare const Button: import("svelte").Component<ButtonProps, {}, "">;
11
+ declare const Button: import("svelte").Component<ButtonProps, {}, "disabled">;
10
12
  type Button = ReturnType<typeof Button>;
11
13
  export default Button;
@@ -19,12 +19,12 @@
19
19
  </script>
20
20
 
21
21
  <script lang="ts">
22
- let { links, preload=true, reload=false, divClasses, ...props }: TabNavigationProps = $props();
22
+ let { links=$bindable(), preload=true, reload=false, divClasses, ...props }: TabNavigationProps = $props();
23
23
  </script>
24
24
 
25
25
  <div class={twMerge("flex flex-row flex-wrap gap-4 justify-start xxxs:justify-center items-start py-2 px-4 mt-8 font-semibold", divClasses)}>
26
26
  {#each links as link}
27
- <a class={twMerge("px-4 py-1 hover:border-primary-secondary-500 hover:border-b-2 text-gray-900 bg-transparent hover:bg-transparent rounded-none", link.active ? "border-primary-600 border-b-2": "", props.class)}
27
+ <a class={twMerge("px-4 py-1 hover:border-secondary-500 hover:border-b-2 text-gray-900 bg-transparent hover:bg-transparent rounded-none", link.active ? "border-primary-600 border-b-2": "", props.class)}
28
28
  data-sveltekit-reload={reload} data-sveltekit-preload-data={preload ? 'hover' : false}
29
29
  href={link.href}>
30
30
  {link.text}
@@ -11,6 +11,6 @@ export type TabNavigationProps = {
11
11
  divClasses?: ClassNameValue;
12
12
  class?: ClassNameValue;
13
13
  };
14
- declare const TabNavigation: import("svelte").Component<TabNavigationProps, {}, "">;
14
+ declare const TabNavigation: import("svelte").Component<TabNavigationProps, {}, "links">;
15
15
  type TabNavigation = ReturnType<typeof TabNavigation>;
16
16
  export default TabNavigation;
@@ -18,8 +18,7 @@
18
18
  * @prop {string} [name] - The name attribute for form submission.
19
19
  * @prop {string} [value] - The bound value of the input.
20
20
  * @prop {string} [placeholder] - Placeholder text.
21
- * @prop {string} [labelText] - Optional label text.
22
- * @prop {ClassNameValue} [inputClasses] - Additional Tailwind classes to apply to the input. Example: "border-red-500 text-green-600"
21
+ * @prop {string} [labelText] - Optional label text.
23
22
  * @prop {TextInputSize} [size] - Size variant ("sm", "md", "lg") with predefined Tailwind styles.
24
23
  * - "sm": h-[2.05rem] text-sm placeholder:text-sm
25
24
  * - "md": h-[2.375rem] text-sm placeholder:text-sm
@@ -27,6 +26,7 @@
27
26
  * @prop {() => void} [onchange] - Event handler for change events.
28
27
  * @prop {() => void} [onmouseup] - Event handler for mouseup events.
29
28
  * @prop {Snippet} [label] - Custom label snippet.
29
+ * @prop {Snippet} [class] - Css classes for the input element.
30
30
  */
31
31
  export type TextInputProps = {
32
32
  id: string;
@@ -34,8 +34,7 @@
34
34
  value?: string;
35
35
  type?: TextInputType;
36
36
  placeholder?: string;
37
- labelText?: string;
38
- inputClasses?: ClassNameValue;
37
+ labelText?: string;
39
38
  size?: TextInputSize;
40
39
  disabled?: boolean;
41
40
  required?: boolean;
@@ -44,6 +43,7 @@
44
43
  onmouseup?: () => void;
45
44
  label?: Snippet;
46
45
  icon?: Snippet;
46
+ class?: ClassNameValue;
47
47
  };
48
48
 
49
49
 
@@ -52,7 +52,7 @@
52
52
  <script lang="ts">
53
53
  import { twMerge } from 'tailwind-merge';
54
54
 
55
- let { id, type="text", name="", value=$bindable(""), placeholder="", labelText, size="md", inputClasses="", disabled=false, required=false, error, onchange, onmouseup, label, icon}: TextInputProps = $props();
55
+ let { id, type="text", name="", value=$bindable(""), placeholder="", labelText, size="md", disabled=false, required=false, error, onchange, onmouseup, label, icon, ...props}: TextInputProps = $props();
56
56
 
57
57
  /**
58
58
  * Predefined size classes for the TextBox input.
@@ -76,7 +76,7 @@
76
76
  class={twMerge("rounded-primary border-border-primary focus:border-primary-500 focus:ring-primary-500 placeholder:opacity-50 disabled:bg-neutral-300/30 disabled:border-gray-300/30",
77
77
  error ? "bg-red-50 border-red-300 ring-red-300" : "",
78
78
  icon ? "pl-10" : "",
79
- sizeStyle[size], inputClasses)}
79
+ sizeStyle[size], props.class)}
80
80
  />
81
81
  </div>
82
82
  {#if error}
@@ -16,7 +16,6 @@ export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "
16
16
  * @prop {string} [value] - The bound value of the input.
17
17
  * @prop {string} [placeholder] - Placeholder text.
18
18
  * @prop {string} [labelText] - Optional label text.
19
- * @prop {ClassNameValue} [inputClasses] - Additional Tailwind classes to apply to the input. Example: "border-red-500 text-green-600"
20
19
  * @prop {TextInputSize} [size] - Size variant ("sm", "md", "lg") with predefined Tailwind styles.
21
20
  * - "sm": h-[2.05rem] text-sm placeholder:text-sm
22
21
  * - "md": h-[2.375rem] text-sm placeholder:text-sm
@@ -24,6 +23,7 @@ export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "
24
23
  * @prop {() => void} [onchange] - Event handler for change events.
25
24
  * @prop {() => void} [onmouseup] - Event handler for mouseup events.
26
25
  * @prop {Snippet} [label] - Custom label snippet.
26
+ * @prop {Snippet} [class] - Css classes for the input element.
27
27
  */
28
28
  export type TextInputProps = {
29
29
  id: string;
@@ -32,7 +32,6 @@ export type TextInputProps = {
32
32
  type?: TextInputType;
33
33
  placeholder?: string;
34
34
  labelText?: string;
35
- inputClasses?: ClassNameValue;
36
35
  size?: TextInputSize;
37
36
  disabled?: boolean;
38
37
  required?: boolean;
@@ -41,6 +40,7 @@ export type TextInputProps = {
41
40
  onmouseup?: () => void;
42
41
  label?: Snippet;
43
42
  icon?: Snippet;
43
+ class?: ClassNameValue;
44
44
  };
45
45
  declare const TextInput: import("svelte").Component<TextInputProps, {}, "value">;
46
46
  type TextInput = ReturnType<typeof TextInput>;
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.13.2",
8
+ "version": "0.13.4",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [