@caseparts-org/caseblocks 0.0.272 → 0.0.273
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
._qty-
|
|
1
|
+
._qty-container_1mse4_1{display:flex;flex-direction:row;align-items:center}._qty-container_1mse4_1>button{font-size:1.25rem;border:1px solid var(--border-border-primary);background-color:#fff;box-sizing:border-box}._qty-container_1mse4_1>input{text-align:center;font-size:var(--font-size-md);border:1px solid var(--border-border-primary);box-sizing:border-box;outline:none}._qty-container_1mse4_1>input::-webkit-outer-spin-button,._qty-container_1mse4_1>input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._qty-container_1mse4_1>input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}._decrease-btn_1mse4_35{position:relative;left:2px;z-index:0;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer;border-top-left-radius:4px;border-bottom-left-radius:4px}._increase-btn_1mse4_48{position:relative;left:-2px;z-index:0;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer;border-top-right-radius:4px;border-bottom-right-radius:4px}._decrease-btn_1mse4_35._button-sm_1mse4_61{border-top-left-radius:2px;border-bottom-left-radius:2px}._increase-btn_1mse4_48._button-sm_1mse4_61{border-top-right-radius:2px;border-bottom-right-radius:2px}._decrease-btn_1mse4_35:disabled,._increase-btn_1mse4_48:disabled{pointer-events:none}._decrease-btn_1mse4_35:disabled svg,._increase-btn_1mse4_48:disabled svg{fill:var(--color-neutrals-neutral-4)}._button-sm_1mse4_61{width:1.25rem;height:1.25rem}._button-md_1mse4_84{width:2rem;height:2rem}._button-lg_1mse4_88{width:2.5rem;height:2.5rem}._qty-input-sm_1mse4_92{width:2.5rem;height:1.25rem}._qty-input-md_1mse4_96{width:2.5rem;height:2rem}._qty-input-lg_1mse4_100{width:3rem;height:2.5rem}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsxs as g, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as r } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import { Icon as l } from "../../atoms/Icon/Icon.js";
|
|
4
|
-
import { getHideAtStyles as
|
|
4
|
+
import { getHideAtStyles as v } from "../../atoms/HideAt.js";
|
|
5
5
|
import '../../assets/QuantityInput.css';const s = {
|
|
6
|
-
"qty-container": "_qty-
|
|
7
|
-
"decrease-btn": "_decrease-
|
|
8
|
-
"increase-btn": "_increase-
|
|
9
|
-
"button-sm": "_button-
|
|
10
|
-
"button-md": "_button-
|
|
11
|
-
"button-lg": "_button-
|
|
12
|
-
"qty-input-sm": "_qty-input-
|
|
13
|
-
"qty-input-md": "_qty-input-
|
|
14
|
-
"qty-input-lg": "_qty-input-
|
|
6
|
+
"qty-container": "_qty-container_1mse4_1",
|
|
7
|
+
"decrease-btn": "_decrease-btn_1mse4_35",
|
|
8
|
+
"increase-btn": "_increase-btn_1mse4_48",
|
|
9
|
+
"button-sm": "_button-sm_1mse4_61",
|
|
10
|
+
"button-md": "_button-md_1mse4_84",
|
|
11
|
+
"button-lg": "_button-lg_1mse4_88",
|
|
12
|
+
"qty-input-sm": "_qty-input-sm_1mse4_92",
|
|
13
|
+
"qty-input-md": "_qty-input-md_1mse4_96",
|
|
14
|
+
"qty-input-lg": "_qty-input-lg_1mse4_100"
|
|
15
15
|
};
|
|
16
|
-
function
|
|
16
|
+
function $({
|
|
17
17
|
quantity: o = 1,
|
|
18
18
|
onQuantityChange: _,
|
|
19
19
|
min: e = 1,
|
|
20
20
|
max: n = 9999,
|
|
21
21
|
className: b,
|
|
22
|
-
wrapperClassName:
|
|
23
|
-
hideAt:
|
|
24
|
-
size:
|
|
25
|
-
...
|
|
22
|
+
wrapperClassName: m,
|
|
23
|
+
hideAt: d,
|
|
24
|
+
size: c = "md",
|
|
25
|
+
...p
|
|
26
26
|
}) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
_(
|
|
30
|
-
}, f = () => u(o - 1),
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
27
|
+
const y = (t) => (e !== void 0 && t < e && (t = e), n !== void 0 && n !== void 0 && t > n && (t = n), t), u = (t) => {
|
|
28
|
+
const i = y(Number.isNaN(t) ? e ?? 1 : t);
|
|
29
|
+
_(i);
|
|
30
|
+
}, f = () => u(o - 1), N = () => u(o + 1);
|
|
31
|
+
return /* @__PURE__ */ g("div", { className: r(s["qty-container"], v(d), m), children: [
|
|
32
|
+
/* @__PURE__ */ a(
|
|
33
33
|
"button",
|
|
34
34
|
{
|
|
35
35
|
type: "button",
|
|
36
|
-
className:
|
|
36
|
+
className: r(s["decrease-btn"], s[`button-${c}`]),
|
|
37
37
|
onClick: f,
|
|
38
38
|
disabled: o <= (e ?? 1),
|
|
39
39
|
"aria-label": "Decrease quantity",
|
|
40
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ a(l, { iconKey: "fa-solid fa-minus", size: c === "sm" ? "3xs" : "xs" })
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ a(
|
|
44
44
|
"input",
|
|
45
45
|
{
|
|
46
|
-
className:
|
|
46
|
+
className: r(s["qty-input"], s[`qty-input-${c}`], b),
|
|
47
47
|
type: "number",
|
|
48
48
|
min: e,
|
|
49
49
|
max: n,
|
|
50
50
|
value: o,
|
|
51
51
|
onFocus: (t) => t.currentTarget.select(),
|
|
52
52
|
onChange: (t) => {
|
|
53
|
-
const
|
|
54
|
-
u(Number.isNaN(
|
|
53
|
+
const i = parseInt(t.target.value, 10);
|
|
54
|
+
u(Number.isNaN(i) ? e ?? 1 : i);
|
|
55
55
|
},
|
|
56
56
|
"aria-label": "Quantity",
|
|
57
|
-
...
|
|
57
|
+
...p
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ a(
|
|
61
61
|
"button",
|
|
62
62
|
{
|
|
63
63
|
type: "button",
|
|
64
|
-
className:
|
|
65
|
-
onClick:
|
|
64
|
+
className: r(s["increase-btn"], s[`button-${c}`]),
|
|
65
|
+
onClick: N,
|
|
66
66
|
disabled: n !== void 0 && o >= n,
|
|
67
67
|
"aria-label": "Increase quantity",
|
|
68
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ a(l, { iconKey: "fa-solid fa-plus", size: c === "sm" ? "3xs" : "xs" })
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
] });
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
|
-
|
|
74
|
+
$ as QuantityInput
|
|
75
75
|
};
|