@hashrytech/quick-components-kit 0.19.9 → 0.19.10

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,11 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.19.10
4
+
5
+ ### Patch Changes
6
+
7
+ - add: Adding Icon component and button support
8
+
3
9
  ## 0.19.9
4
10
 
5
11
  ### Patch Changes
@@ -5,6 +5,8 @@
5
5
  export type ButtonProps = {
6
6
  disabled?: boolean;
7
7
  children?: Snippet;
8
+ cssIcon?: string;
9
+ cssIconClass?: ClassNameValue;
8
10
  icon?: Snippet;
9
11
  loadingIcon?: Snippet;
10
12
  loading?: boolean;
@@ -16,15 +18,17 @@
16
18
 
17
19
  <script lang="ts">
18
20
  import {twMerge} from 'tailwind-merge';
21
+ import { Icon } from '../icon/index.js';
19
22
 
20
- let { disabled=$bindable(), loading=$bindable(false), children, icon, loadingIcon, onclick, ...props }: ButtonProps = $props();
23
+ let { disabled=$bindable(), loading=$bindable(false), children, cssIcon, cssIconClass, icon, loadingIcon, onclick, ...props }: ButtonProps = $props();
21
24
 
22
25
  </script>
23
26
 
24
27
  <button {disabled} class={twMerge("flex flex-row items-center gap-2 px-4 py-2 focus:outline-primary-focus bg-primary-button hover:bg-primary-button-hover rounded-primary cursor-pointer focus:ring-primary-focus focus:ring",
25
28
  "disabled:bg-primary-button/60 disabled:cursor-default", props.class)}
26
- {onclick}>
27
- {#if loadingIcon && loading}
29
+ {onclick}>
30
+ {#if cssIcon}<Icon icon={cssIcon} class={twMerge(loading ? "animate-spin" : "", cssIconClass)} />
31
+ {:else if loadingIcon && loading}
28
32
  <span class="shrink-0 animate-spin font-semibold">{@render loadingIcon()}</span>
29
33
  {:else if icon}
30
34
  {@render icon()}
@@ -3,6 +3,8 @@ import type { ClassNameValue } from 'tailwind-merge';
3
3
  export type ButtonProps = {
4
4
  disabled?: boolean;
5
5
  children?: Snippet;
6
+ cssIcon?: string;
7
+ cssIconClass?: ClassNameValue;
6
8
  icon?: Snippet;
7
9
  loadingIcon?: Snippet;
8
10
  loading?: boolean;
@@ -0,0 +1,27 @@
1
+ <script lang="ts" module>
2
+ import type { ClassNameValue } from 'tailwind-merge';
3
+ /**
4
+ * Props for the Icon component. See instructions: https://iconify.design/docs/usage/css/tailwind/tailwind4/
5
+ *
6
+ * @prop {string} icon - The icon string to be used in the span, example: icon-[ion--add-circle]
7
+ * @prop {() => void} [onclick] - Event handler for click events.
8
+ * @prop {Snippet} [class] - Css classes for the input element.
9
+ */
10
+ export type IconProps = {
11
+ icon: string;
12
+ onclick?: (event: MouseEvent) => void;
13
+ class?: ClassNameValue;
14
+ };
15
+
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ import {twMerge} from 'tailwind-merge';
20
+
21
+ let { icon, onclick, ...restProps }: IconProps = $props();
22
+
23
+ </script>
24
+
25
+ <span class={twMerge("block shrink-0", icon, restProps.class)}></span>
26
+
27
+
@@ -0,0 +1,16 @@
1
+ import type { ClassNameValue } from 'tailwind-merge';
2
+ /**
3
+ * Props for the Icon component. See instructions: https://iconify.design/docs/usage/css/tailwind/tailwind4/
4
+ *
5
+ * @prop {string} icon - The icon string to be used in the span, example: icon-[ion--add-circle]
6
+ * @prop {() => void} [onclick] - Event handler for click events.
7
+ * @prop {Snippet} [class] - Css classes for the input element.
8
+ */
9
+ export type IconProps = {
10
+ icon: string;
11
+ onclick?: (event: MouseEvent) => void;
12
+ class?: ClassNameValue;
13
+ };
14
+ declare const Icon: import("svelte").Component<IconProps, {}, "">;
15
+ type Icon = ReturnType<typeof Icon>;
16
+ export default Icon;
@@ -0,0 +1 @@
1
+ export { default as Icon, type IconProps } from './Icon.svelte';
@@ -0,0 +1 @@
1
+ export { default as Icon } from './Icon.svelte';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './components/icon/index.js';
1
2
  export * from './components/text-input/index.js';
2
3
  export * from './components/text-area/index.js';
3
4
  export * from './components/button/index.js';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Reexport your entry components here
2
2
  // lib/index.js
3
+ export * from './components/icon/index.js';
3
4
  export * from './components/text-input/index.js';
4
5
  export * from './components/text-area/index.js';
5
6
  export * from './components/button/index.js';
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.19.9",
8
+ "version": "0.19.10",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [