hamzus-ui 0.0.180 → 0.0.182

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.180",
3
+ "version": "0.0.182",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -0,0 +1,72 @@
1
+ <script>
2
+ import IconButton from "@hamzus-ui/IconButton/IconButton.svelte";
3
+ import { onMount } from "svelte";
4
+
5
+ export let min = 0
6
+ export let value = 1
7
+ export let name = ""
8
+ export let required = false
9
+ export let onChange = undefined
10
+
11
+ $: if (min > value) {
12
+ value = min
13
+ }
14
+
15
+ function minus() {
16
+ if(value === min)return;
17
+
18
+ value--
19
+
20
+ if (onChange !== undefined) onChange(value)
21
+ }
22
+
23
+ function plus() {
24
+ value ++
25
+
26
+ if (onChange !== undefined) onChange(value)
27
+ }
28
+ </script>
29
+
30
+ <div class="quantity-selector">
31
+ <input class="input" type="number" {value} {name} {required}>
32
+ <IconButton variant="ghost" onClick={minus}>
33
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
34
+ <path d="M18 12.75H6C5.59 12.75 5.25 12.41 5.25 12C5.25 11.59 5.59 11.25 6 11.25H18C18.41 11.25 18.75 11.59 18.75 12C18.75 12.41 18.41 12.75 18 12.75Z" fill="#292D32"/>
35
+ </svg>
36
+ </IconButton>
37
+ <h4 class="quantity">{value}</h4>
38
+ <IconButton variant="ghost" onClick={plus}>
39
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
40
+ <path d="M18 12.75H6C5.59 12.75 5.25 12.41 5.25 12C5.25 11.59 5.59 11.25 6 11.25H18C18.41 11.25 18.75 11.59 18.75 12C18.75 12.41 18.41 12.75 18 12.75Z" fill="#292D32"/>
41
+ <path d="M12 18.75C11.59 18.75 11.25 18.41 11.25 18V6C11.25 5.59 11.59 5.25 12 5.25C12.41 5.25 12.75 5.59 12.75 6V18C12.75 18.41 12.41 18.75 12 18.75Z" fill="#292D32"/>
42
+ </svg>
43
+ </IconButton>
44
+ </div>
45
+
46
+ <style>
47
+ .quantity-selector {
48
+ display: flex;
49
+ align-items: center;
50
+ column-gap: var(--pad-m);
51
+ background-color: var(--bg-blur);
52
+ width: fit-content;
53
+ border-radius: var(--radius-m);
54
+ }
55
+
56
+ .quantity-selector > h4 {
57
+ width: 25px;
58
+ text-align: center;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ }
63
+
64
+ .input {
65
+ display: none;
66
+ }
67
+
68
+ .quantity-selector:has( .input:user-invalid) {
69
+ outline: 1px solid var(--red);
70
+ background-color: var(--red-b);
71
+ }
72
+ </style>
@@ -140,6 +140,10 @@ export const data = {
140
140
  label:"input",
141
141
  href:"/input",
142
142
  },
143
+ {
144
+ label:"input nombre",
145
+ href:"/input-number",
146
+ },
143
147
  {
144
148
  label:"selection",
145
149
  href:"/selector",