@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 m, jsx as c } from "react/jsx-runtime";
2
- import { R as O } from "../../index-CbTU3cnP.js";
3
- import u, { forwardRef as b, useId as z, useCallback as w } from "react";
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 _, buttonVariants as j, numberInputVariants as E } from "./NumberInput.variants.js";
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 = b(function(e, i) {
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__ */ u.createElement("svg", v({
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__ */ u.createElement("line", {
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 h() {
61
- return h = Object.assign || function(e) {
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
- }, h.apply(this, arguments);
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 = b(function(e, i) {
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__ */ u.createElement("svg", h({
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__ */ u.createElement("line", {
100
+ }, l), /* @__PURE__ */ c.createElement("line", {
101
101
  x1: "12",
102
102
  y1: "5",
103
103
  x2: "12",
104
104
  y2: "19"
105
- }), /* @__PURE__ */ u.createElement("line", {
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 = b(
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(), p = o ?? P, k = z(), I = w(() => {
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 = w(() => {
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__ */ m("div", { className: "flex flex-col gap-1", children: [
136
- i ? /* @__PURE__ */ c(
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: p
144
+ E({
145
+ theme: m
143
146
  })
144
147
  ),
145
148
  children: i
146
149
  }
147
150
  ) : null,
148
- /* @__PURE__ */ m("div", { className: "flex items-center", role: "presentation", children: [
149
- /* @__PURE__ */ m(
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: p, button: "rigth" })
158
+ j({ theme: m, button: "rigth" })
156
159
  ),
157
160
  children: [
158
- /* @__PURE__ */ c(d, { className: "w-4 h-4" }),
159
- /* @__PURE__ */ c(O, { children: "Decrement" })
161
+ /* @__PURE__ */ u(d, { className: "w-4 h-4" }),
162
+ /* @__PURE__ */ u(w, { children: "Decrement" })
160
163
  ]
161
164
  }
162
165
  ),
163
- /* @__PURE__ */ c(
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
- E({ className: e, theme: p })
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__ */ m(
180
+ /* @__PURE__ */ p(
178
181
  "button",
179
182
  {
180
183
  type: "button",
181
184
  onClick: N,
182
185
  className: y(
183
- j({ theme: p, button: "left" })
186
+ j({ theme: m, button: "left" })
184
187
  ),
185
188
  children: [
186
- /* @__PURE__ */ c(g, { className: "w-4 h-4" }),
187
- /* @__PURE__ */ c(O, { children: "Increment" })
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
@@ -320,7 +320,7 @@ declare interface NumberInputProps extends VariantProps<typeof numberInputVarian
320
320
  max?: number;
321
321
  min?: number;
322
322
  name?: string;
323
- value: number;
323
+ value?: number;
324
324
  onChange?: ({ target: { value } }: {
325
325
  target: {
326
326
  value: number;
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.16",
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.17",
5
+ "version": "0.0.12-alpha.18",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",