@hashrytech/quick-components-kit 0.19.0 → 0.19.2
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 +13 -0
- package/README.md +6 -0
- package/dist/components/select/Select.svelte +2 -2
- package/dist/components/select/Select.svelte.d.ts +1 -1
- package/dist/components/text-input/TextInput.svelte +19 -12
- package/dist/components/text-input/TextInput.svelte.d.ts +6 -2
- package/dist/modules/api-proxy.d.ts +2 -0
- package/dist/modules/api-proxy.js +3 -1
- package/dist/ui/order-product-line-item/order-product-line-item-1/OrderProductLineItem1.svelte +74 -0
- package/dist/ui/order-product-line-item/order-product-line-item-1/OrderProductLineItem1.svelte.d.ts +15 -0
- package/dist/ui/order-product-line-item/order-product-line-item-1/index.d.ts +1 -0
- package/dist/ui/order-product-line-item/order-product-line-item-1/index.js +1 -0
- package/dist/ui/searchbox/Searchbox.svelte +2 -2
- package/dist/ui/searchbox/Searchbox.svelte.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
# @hashrytech/quick-components-kit
|
|
2
2
|
|
|
3
|
+
## 0.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- patch: minor change to TextInput styling
|
|
8
|
+
|
|
9
|
+
## 0.19.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix padding for TextInput and add prepend for api proxy
|
|
14
|
+
|
|
3
15
|
## 0.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
6
18
|
|
|
7
19
|
- Update: adding ui components and refactoring textbox and select components
|
|
20
|
+
|
|
8
21
|
## 0.18.1
|
|
9
22
|
|
|
10
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -15,6 +15,12 @@ or via yarn:
|
|
|
15
15
|
yarn add @hashrytech/quick-components-kit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## To Update Version
|
|
19
|
+
```bash
|
|
20
|
+
npm run change
|
|
21
|
+
npm run version
|
|
22
|
+
```
|
|
23
|
+
|
|
18
24
|
## Configurations
|
|
19
25
|
Set default theme values for primary and secondary variables:
|
|
20
26
|
- Color gradient
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
export type Option = {
|
|
6
6
|
value: string | number;
|
|
7
|
-
|
|
7
|
+
key: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
{@render optionsSnippet?.()}
|
|
84
84
|
{#each options as option}
|
|
85
85
|
<option value={option.value} disabled={option.disabled} class={twMerge("", optionsClass)}>
|
|
86
|
-
{option.
|
|
86
|
+
{option.key}
|
|
87
87
|
</option>
|
|
88
88
|
{/each}
|
|
89
89
|
</select>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { FullAutoFill } from 'svelte/elements';
|
|
3
|
+
import type { FullAutoFill, HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export type TextInputSize = "sm" | "md" | "lg";
|
|
13
13
|
export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "url" | "search";
|
|
14
|
+
export type InputMode = "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Props for the TextBox component.
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
export type TextInputProps = {
|
|
33
34
|
id: string;
|
|
34
35
|
name?: string;
|
|
35
|
-
value?: string;
|
|
36
|
+
value?: string|number;
|
|
36
37
|
type?: TextInputType;
|
|
37
38
|
placeholder?: string;
|
|
38
39
|
labelText?: string;
|
|
@@ -46,8 +47,11 @@
|
|
|
46
47
|
secondDivClass?: ClassNameValue;
|
|
47
48
|
thirdDivClass?: ClassNameValue;
|
|
48
49
|
autocomplete?: FullAutoFill | null;
|
|
50
|
+
inputmode?: InputMode;
|
|
51
|
+
min?: number;
|
|
52
|
+
max?: number;
|
|
49
53
|
debounceDelay?: number;
|
|
50
|
-
onInput?: (value: string) => void;
|
|
54
|
+
onInput?: (value: string|number) => void;
|
|
51
55
|
onchange?: (event: Event) => void;
|
|
52
56
|
onmouseup?: () => void;
|
|
53
57
|
label?: Snippet;
|
|
@@ -79,6 +83,9 @@
|
|
|
79
83
|
secondDivClass,
|
|
80
84
|
thirdDivClass,
|
|
81
85
|
autocomplete,
|
|
86
|
+
inputmode,
|
|
87
|
+
min,
|
|
88
|
+
max,
|
|
82
89
|
debounceDelay=300, //ms
|
|
83
90
|
onchange,
|
|
84
91
|
onInput,
|
|
@@ -95,15 +102,15 @@
|
|
|
95
102
|
* - "lg": h-[2.8rem] text-lg placeholder:text-lg
|
|
96
103
|
*/
|
|
97
104
|
let sizeStyle: Record<TextInputSize, string> = {
|
|
98
|
-
sm: "text-sm placeholder:text-sm",
|
|
99
|
-
md: "text-sm placeholder:text-sm",
|
|
100
|
-
lg: "text-base placeholder:text-base"
|
|
105
|
+
sm: "text-sm placeholder:text-sm px-2.5",
|
|
106
|
+
md: "text-sm placeholder:text-sm px-2.5",
|
|
107
|
+
lg: "text-base placeholder:text-base px-3"
|
|
101
108
|
};
|
|
102
109
|
|
|
103
110
|
let textBoxStyle: Record<TextInputSize, string> = {
|
|
104
|
-
sm: "h-[2.05rem]
|
|
111
|
+
sm: "h-[2.05rem]",
|
|
105
112
|
md: "h-[2.375rem]",
|
|
106
|
-
lg: "h-[2.8rem]
|
|
113
|
+
lg: "h-[2.8rem]"
|
|
107
114
|
};
|
|
108
115
|
|
|
109
116
|
const directionClass = {
|
|
@@ -135,15 +142,15 @@
|
|
|
135
142
|
{#if !label && labelText}<label for={id} class={twMerge("text-sm font-medium text-primary-label-text ml-1", labelClass)}>{labelText}</label>{/if}
|
|
136
143
|
|
|
137
144
|
<!-- Text Box -->
|
|
138
|
-
<div class={twMerge("flex flex-row items-center rounded-primary border border-primary-input-border
|
|
145
|
+
<div class={twMerge("flex flex-row items-center rounded-primary border border-primary-input-border focus-within:ring focus-within:border-primary-focus focus-within:ring-primary-focus has-[input:disabled]:bg-neutral-300/30 has-[input:disabled]:border-neutral-300/30",
|
|
139
146
|
error ? "bg-red-50 border-red-300" : "", textBoxStyle[size], thirdDivClass)}>
|
|
140
147
|
|
|
141
|
-
{#if leftIcon}<div class="h-full flex flex-col items-center justify-center">{@render leftIcon()}</div>{/if}
|
|
148
|
+
{#if leftIcon}<div class="h-full flex flex-col items-center justify-center pl-2">{@render leftIcon()}</div>{/if}
|
|
142
149
|
|
|
143
|
-
<input {disabled} {required} {type} {id} name={name ? name: id} {placeholder} {onmouseup} bind:value {autocomplete} oninput={handleInput}
|
|
150
|
+
<input {disabled} {required} {type} {id} name={name ? name: id} {placeholder} {onmouseup} bind:value {autocomplete} {inputmode} {min} {max} oninput={handleInput}
|
|
144
151
|
class={twMerge("border-0 focus:border-0 focus:ring-0 active:border-0 outline-none p-0 bg-transparent placeholder:text-neutral-600/50 h-full w-full", sizeStyle[size], restProps.class)} />
|
|
145
152
|
|
|
146
|
-
{#if rightIcon}<div class="h-full flex flex-col items-center justify-center">{@render rightIcon()}</div>{/if}
|
|
153
|
+
{#if rightIcon}<div class="h-full flex flex-col items-center justify-center pr-2">{@render rightIcon()}</div>{/if}
|
|
147
154
|
</div>
|
|
148
155
|
|
|
149
156
|
</div>
|
|
@@ -9,6 +9,7 @@ import type { ClassNameValue } from 'tailwind-merge';
|
|
|
9
9
|
*/
|
|
10
10
|
export type TextInputSize = "sm" | "md" | "lg";
|
|
11
11
|
export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "url" | "search";
|
|
12
|
+
export type InputMode = "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
12
13
|
/**
|
|
13
14
|
* Props for the TextBox component.
|
|
14
15
|
*
|
|
@@ -29,7 +30,7 @@ export type TextInputType = "text" | "password" | "number" | "email" | "tel" | "
|
|
|
29
30
|
export type TextInputProps = {
|
|
30
31
|
id: string;
|
|
31
32
|
name?: string;
|
|
32
|
-
value?: string;
|
|
33
|
+
value?: string | number;
|
|
33
34
|
type?: TextInputType;
|
|
34
35
|
placeholder?: string;
|
|
35
36
|
labelText?: string;
|
|
@@ -43,8 +44,11 @@ export type TextInputProps = {
|
|
|
43
44
|
secondDivClass?: ClassNameValue;
|
|
44
45
|
thirdDivClass?: ClassNameValue;
|
|
45
46
|
autocomplete?: FullAutoFill | null;
|
|
47
|
+
inputmode?: InputMode;
|
|
48
|
+
min?: number;
|
|
49
|
+
max?: number;
|
|
46
50
|
debounceDelay?: number;
|
|
47
|
-
onInput?: (value: string) => void;
|
|
51
|
+
onInput?: (value: string | number) => void;
|
|
48
52
|
onchange?: (event: Event) => void;
|
|
49
53
|
onmouseup?: () => void;
|
|
50
54
|
label?: Snippet;
|
|
@@ -15,6 +15,8 @@ export interface RestApiProxyConfig {
|
|
|
15
15
|
safeResponseHeaders?: string[];
|
|
16
16
|
/** Optional function to extract token from session */
|
|
17
17
|
extractToken?: (locals: App.Locals) => string | undefined;
|
|
18
|
+
/** Optional path to prepend to the proxied path */
|
|
19
|
+
prependPath?: string;
|
|
18
20
|
/** Optional flag to enable debug logging */
|
|
19
21
|
debug?: boolean;
|
|
20
22
|
}
|
|
@@ -11,7 +11,9 @@ export function createProxyHandlers(config) {
|
|
|
11
11
|
const path = event.params.path;
|
|
12
12
|
const queryString = event.url.searchParams.toString();
|
|
13
13
|
const slash = config.appendSlash ? '/' : '';
|
|
14
|
-
const
|
|
14
|
+
const prepend = config.prependPath ? `/${config.prependPath}/` : '/';
|
|
15
|
+
const fullPath = `${prepend}${path}${slash}${queryString ? `?${queryString}` : ''}`;
|
|
16
|
+
console.log("Full Path:", fullPath);
|
|
15
17
|
const url = `${config.host}${fullPath}`;
|
|
16
18
|
if (config.debug)
|
|
17
19
|
console.debug(`API Proxy: Proxying ${event.request.method} request to: ${url}`);
|
package/dist/ui/order-product-line-item/order-product-line-item-1/OrderProductLineItem1.svelte
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import TextInput from '../../../components/text-input/TextInput.svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
|
|
5
|
+
export type OrderProduct = {
|
|
6
|
+
name: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
price: string;
|
|
9
|
+
class?: ClassNameValue;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ShoppingCartList1Props = {
|
|
13
|
+
orderProduct: OrderProduct;
|
|
14
|
+
index: number;
|
|
15
|
+
class?: ClassNameValue;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
|
|
22
|
+
let { orderProduct, index=0, ...restProps }: ShoppingCartList1Props = $props();
|
|
23
|
+
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class="rounded-primary border border-primary-input-border p-2">
|
|
27
|
+
<div class="flex gap-4">
|
|
28
|
+
<img src="https://placehold.co/120" alt="Product" class="h-24 w-24 rounded-primary object-cover flex-shrink-0" loading="lazy" />
|
|
29
|
+
<div class="min-w-0 flex-1">
|
|
30
|
+
<div class="flex items-start justify-between gap-3">
|
|
31
|
+
<div class="min-w-0">
|
|
32
|
+
<h3 class="text-base font-medium text-neutral-900 truncate">{orderProduct.name}</h3>
|
|
33
|
+
<p class="text-sm text-neutral-500 mt-0.5">Color: Black • Size: One Size</p>
|
|
34
|
+
</div>
|
|
35
|
+
<p class="text-base font-semibold text-neutral-900">{orderProduct.price}</p>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class="mt-3 flex flex-wrap items-center gap-3">
|
|
40
|
+
<!-- Quantity -->
|
|
41
|
+
<label class="sr-only" for={"qtyId" + index}>Quantity</label>
|
|
42
|
+
<div class="inline-flex items-center gap-2">
|
|
43
|
+
<button type="button" class="p-0.5 text-neutral-700 hover:bg-primary-button-hover cursor-pointer text-2xl rounded-full" aria-label="Increase quantity">
|
|
44
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="size-5" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11V13H19V11H5Z"></path></svg>
|
|
45
|
+
</button>
|
|
46
|
+
<TextInput bind:value={orderProduct.quantity} id={"qtyId" + index} type="number" inputmode="numeric" min={1} class="w-12 text-center" />
|
|
47
|
+
<button type="button" class="p-0.5 text-neutral-700 hover:bg-primary-button-hover cursor-pointer text-2xl rounded-full" aria-label="Increase quantity">
|
|
48
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="size-5" viewBox="0 0 24 24" fill="currentColor"><path d="M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"></path></svg>
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- Actions -->
|
|
53
|
+
<button type="button" class="text-sm text-red-600 hover:text-red-700 cursor-pointer" aria-label="Remove item">
|
|
54
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="size-6 text-neutral-600 hover:text-red-500" viewBox="0 0 24 24" fill="currentColor"><path d="M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z"></path></svg>
|
|
55
|
+
</button>
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<!-- Price breakdown (mobile) -->
|
|
62
|
+
<div class="mt-3 border-t border-primary-input-border pt-3 text-sm text-neutral-500 md:hidden">
|
|
63
|
+
<div class="flex justify-between">
|
|
64
|
+
<span>Item</span><span>$120.00</span>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="flex justify-between">
|
|
68
|
+
<span>Qty</span><span>1</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="flex justify-between font-medium text-neutral-800">
|
|
71
|
+
<span>Line total</span><span>$120.00</span>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
package/dist/ui/order-product-line-item/order-product-line-item-1/OrderProductLineItem1.svelte.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
|
+
export type OrderProduct = {
|
|
3
|
+
name: string;
|
|
4
|
+
quantity: number;
|
|
5
|
+
price: string;
|
|
6
|
+
class?: ClassNameValue;
|
|
7
|
+
};
|
|
8
|
+
export type ShoppingCartList1Props = {
|
|
9
|
+
orderProduct: OrderProduct;
|
|
10
|
+
index: number;
|
|
11
|
+
class?: ClassNameValue;
|
|
12
|
+
};
|
|
13
|
+
declare const OrderProductLineItem1: import("svelte").Component<ShoppingCartList1Props, {}, "">;
|
|
14
|
+
type OrderProductLineItem1 = ReturnType<typeof OrderProductLineItem1>;
|
|
15
|
+
export default OrderProductLineItem1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import TextInput from '../../components/text-input/TextInput.svelte';
|
|
3
|
-
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
|
|
5
5
|
export type ProductListNavigation1Props = {
|
|
6
6
|
searchTerm?: string;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
thirdDivClass?: string;
|
|
10
10
|
class?: ClassNameValue;
|
|
11
11
|
onclick?: (event: Event) => void;
|
|
12
|
-
onInput?: (value: string) => void
|
|
12
|
+
onInput?: (value: string|number) => void
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
</script>
|
|
@@ -6,7 +6,7 @@ export type ProductListNavigation1Props = {
|
|
|
6
6
|
thirdDivClass?: string;
|
|
7
7
|
class?: ClassNameValue;
|
|
8
8
|
onclick?: (event: Event) => void;
|
|
9
|
-
onInput?: (value: string) => void;
|
|
9
|
+
onInput?: (value: string | number) => void;
|
|
10
10
|
};
|
|
11
11
|
declare const Searchbox: import("svelte").Component<ProductListNavigation1Props, {}, "searchTerm">;
|
|
12
12
|
type Searchbox = ReturnType<typeof Searchbox>;
|