@konstructio/ui 0.0.12-alpha.17 → 0.0.12-alpha.18
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,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { R as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as p, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { R as w } from "../../index-CbTU3cnP.js";
|
|
3
|
+
import c, { forwardRef as h, useId as z, useCallback as O } from "react";
|
|
4
4
|
import { cn as y } from "../../utils/index.js";
|
|
5
|
-
import { labelVariants as
|
|
5
|
+
import { labelVariants as E, buttonVariants as j, numberInputVariants as _ } from "./NumberInput.variants.js";
|
|
6
6
|
import { P as a } from "../../index-C5psggHV.js";
|
|
7
7
|
import { useTheme as T } from "../../contexts/theme.hook.js";
|
|
8
8
|
function v() {
|
|
@@ -32,9 +32,9 @@ function L(e, i) {
|
|
|
32
32
|
n = t[o], !(i.indexOf(n) >= 0) && (r[n] = e[n]);
|
|
33
33
|
return r;
|
|
34
34
|
}
|
|
35
|
-
var d =
|
|
35
|
+
var d = h(function(e, i) {
|
|
36
36
|
var r = e.color, t = r === void 0 ? "currentColor" : r, n = e.size, o = n === void 0 ? 24 : n, l = $(e, ["color", "size"]);
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ c.createElement("svg", v({
|
|
38
38
|
ref: i,
|
|
39
39
|
xmlns: "http://www.w3.org/2000/svg",
|
|
40
40
|
width: o,
|
|
@@ -45,7 +45,7 @@ var d = b(function(e, i) {
|
|
|
45
45
|
strokeWidth: "2",
|
|
46
46
|
strokeLinecap: "round",
|
|
47
47
|
strokeLinejoin: "round"
|
|
48
|
-
}, l), /* @__PURE__ */
|
|
48
|
+
}, l), /* @__PURE__ */ c.createElement("line", {
|
|
49
49
|
x1: "5",
|
|
50
50
|
y1: "12",
|
|
51
51
|
x2: "19",
|
|
@@ -57,15 +57,15 @@ d.propTypes = {
|
|
|
57
57
|
size: a.oneOfType([a.string, a.number])
|
|
58
58
|
};
|
|
59
59
|
d.displayName = "Minus";
|
|
60
|
-
function
|
|
61
|
-
return
|
|
60
|
+
function b() {
|
|
61
|
+
return b = Object.assign || function(e) {
|
|
62
62
|
for (var i = 1; i < arguments.length; i++) {
|
|
63
63
|
var r = arguments[i];
|
|
64
64
|
for (var t in r)
|
|
65
65
|
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
66
66
|
}
|
|
67
67
|
return e;
|
|
68
|
-
},
|
|
68
|
+
}, b.apply(this, arguments);
|
|
69
69
|
}
|
|
70
70
|
function W(e, i) {
|
|
71
71
|
if (e == null) return {};
|
|
@@ -84,9 +84,9 @@ function V(e, i) {
|
|
|
84
84
|
n = t[o], !(i.indexOf(n) >= 0) && (r[n] = e[n]);
|
|
85
85
|
return r;
|
|
86
86
|
}
|
|
87
|
-
var g =
|
|
87
|
+
var g = h(function(e, i) {
|
|
88
88
|
var r = e.color, t = r === void 0 ? "currentColor" : r, n = e.size, o = n === void 0 ? 24 : n, l = W(e, ["color", "size"]);
|
|
89
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ c.createElement("svg", b({
|
|
90
90
|
ref: i,
|
|
91
91
|
xmlns: "http://www.w3.org/2000/svg",
|
|
92
92
|
width: o,
|
|
@@ -97,12 +97,12 @@ var g = b(function(e, i) {
|
|
|
97
97
|
strokeWidth: "2",
|
|
98
98
|
strokeLinecap: "round",
|
|
99
99
|
strokeLinejoin: "round"
|
|
100
|
-
}, l), /* @__PURE__ */
|
|
100
|
+
}, l), /* @__PURE__ */ c.createElement("line", {
|
|
101
101
|
x1: "12",
|
|
102
102
|
y1: "5",
|
|
103
103
|
x2: "12",
|
|
104
104
|
y2: "19"
|
|
105
|
-
}), /* @__PURE__ */
|
|
105
|
+
}), /* @__PURE__ */ c.createElement("line", {
|
|
106
106
|
x1: "5",
|
|
107
107
|
y1: "12",
|
|
108
108
|
x2: "19",
|
|
@@ -114,7 +114,7 @@ g.propTypes = {
|
|
|
114
114
|
size: a.oneOfType([a.string, a.number])
|
|
115
115
|
};
|
|
116
116
|
g.displayName = "Plus";
|
|
117
|
-
const A =
|
|
117
|
+
const A = h(
|
|
118
118
|
({
|
|
119
119
|
className: e,
|
|
120
120
|
label: i,
|
|
@@ -125,42 +125,45 @@ const A = b(
|
|
|
125
125
|
value: l,
|
|
126
126
|
onChange: s
|
|
127
127
|
}, x) => {
|
|
128
|
-
const { theme: P } = T(),
|
|
128
|
+
const { theme: P } = T(), m = o ?? P, k = z();
|
|
129
|
+
if (typeof l != "number")
|
|
130
|
+
throw new Error("count must be a number");
|
|
131
|
+
const I = O(() => {
|
|
129
132
|
let f = 0;
|
|
130
133
|
t === 1 / 0 ? f = l - 1 : f = Math.max(t, l - 1), s == null || s({ target: { value: f } });
|
|
131
|
-
}, [l, t, s]), N =
|
|
134
|
+
}, [l, t, s]), N = O(() => {
|
|
132
135
|
let f = 0;
|
|
133
136
|
r === -1 / 0 ? f = l + 1 : f = Math.min(r, l + 1), s == null || s({ target: { value: f } });
|
|
134
137
|
}, [l, r, s]);
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
i ? /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: [
|
|
139
|
+
i ? /* @__PURE__ */ u(
|
|
137
140
|
"label",
|
|
138
141
|
{
|
|
139
142
|
htmlFor: n ?? k,
|
|
140
143
|
className: y(
|
|
141
|
-
|
|
142
|
-
theme:
|
|
144
|
+
E({
|
|
145
|
+
theme: m
|
|
143
146
|
})
|
|
144
147
|
),
|
|
145
148
|
children: i
|
|
146
149
|
}
|
|
147
150
|
) : null,
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ p("div", { className: "flex items-center", role: "presentation", children: [
|
|
152
|
+
/* @__PURE__ */ p(
|
|
150
153
|
"button",
|
|
151
154
|
{
|
|
152
155
|
type: "button",
|
|
153
156
|
onClick: I,
|
|
154
157
|
className: y(
|
|
155
|
-
j({ theme:
|
|
158
|
+
j({ theme: m, button: "rigth" })
|
|
156
159
|
),
|
|
157
160
|
children: [
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ u(d, { className: "w-4 h-4" }),
|
|
162
|
+
/* @__PURE__ */ u(w, { children: "Decrement" })
|
|
160
163
|
]
|
|
161
164
|
}
|
|
162
165
|
),
|
|
163
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ u(
|
|
164
167
|
"input",
|
|
165
168
|
{
|
|
166
169
|
ref: x,
|
|
@@ -168,23 +171,23 @@ const A = b(
|
|
|
168
171
|
value: l,
|
|
169
172
|
name: n,
|
|
170
173
|
className: y(
|
|
171
|
-
|
|
174
|
+
_({ className: e, theme: m })
|
|
172
175
|
),
|
|
173
176
|
readOnly: !0,
|
|
174
177
|
"aria-label": typeof i == "string" ? i : "number input"
|
|
175
178
|
}
|
|
176
179
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ p(
|
|
178
181
|
"button",
|
|
179
182
|
{
|
|
180
183
|
type: "button",
|
|
181
184
|
onClick: N,
|
|
182
185
|
className: y(
|
|
183
|
-
j({ theme:
|
|
186
|
+
j({ theme: m, button: "left" })
|
|
184
187
|
),
|
|
185
188
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ u(g, { className: "w-4 h-4" }),
|
|
190
|
+
/* @__PURE__ */ u(w, { children: "Increment" })
|
|
188
191
|
]
|
|
189
192
|
}
|
|
190
193
|
)
|
package/dist/index.d.ts
CHANGED
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.12-alpha.
|
|
5
|
+
"version": "0.0.12-alpha.17",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.12-alpha.
|
|
5
|
+
"version": "0.0.12-alpha.18",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|