@konstructio/ui 0.0.12-alpha.18 → 0.0.12-alpha.19

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,23 +1,23 @@
1
- import { jsxs as p, jsx as u } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as u } from "react/jsx-runtime";
2
2
  import { R as w } from "../../index-CbTU3cnP.js";
3
- import c, { forwardRef as h, useId as z, useCallback as O } from "react";
4
- import { cn as y } from "../../utils/index.js";
5
- import { labelVariants as E, buttonVariants as j, numberInputVariants as _ } from "./NumberInput.variants.js";
6
- import { P as a } from "../../index-C5psggHV.js";
7
- import { useTheme as T } from "../../contexts/theme.hook.js";
8
- function v() {
9
- return v = Object.assign || function(e) {
3
+ import p, { forwardRef as d, useId as _, useCallback as j } from "react";
4
+ import { cn as v } from "../../utils/index.js";
5
+ import { labelVariants as E, buttonVariants as x, numberInputVariants as T } from "./NumberInput.variants.js";
6
+ import { P as s } from "../../index-C5psggHV.js";
7
+ import { useTheme as $ } from "../../contexts/theme.hook.js";
8
+ function h() {
9
+ return h = Object.assign || function(e) {
10
10
  for (var i = 1; i < arguments.length; i++) {
11
11
  var r = arguments[i];
12
12
  for (var t in r)
13
13
  Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
14
14
  }
15
15
  return e;
16
- }, v.apply(this, arguments);
16
+ }, h.apply(this, arguments);
17
17
  }
18
- function $(e, i) {
18
+ function L(e, i) {
19
19
  if (e == null) return {};
20
- var r = L(e, i), t, n;
20
+ var r = W(e, i), t, n;
21
21
  if (Object.getOwnPropertySymbols) {
22
22
  var o = Object.getOwnPropertySymbols(e);
23
23
  for (n = 0; n < o.length; n++)
@@ -25,16 +25,16 @@ function $(e, i) {
25
25
  }
26
26
  return r;
27
27
  }
28
- function L(e, i) {
28
+ function W(e, i) {
29
29
  if (e == null) return {};
30
30
  var r = {}, t = Object.keys(e), n, o;
31
31
  for (o = 0; o < t.length; o++)
32
32
  n = t[o], !(i.indexOf(n) >= 0) && (r[n] = e[n]);
33
33
  return r;
34
34
  }
35
- var d = h(function(e, i) {
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__ */ c.createElement("svg", v({
35
+ var g = d(function(e, i) {
36
+ var r = e.color, t = r === void 0 ? "currentColor" : r, n = e.size, o = n === void 0 ? 24 : n, f = L(e, ["color", "size"]);
37
+ return /* @__PURE__ */ p.createElement("svg", h({
38
38
  ref: i,
39
39
  xmlns: "http://www.w3.org/2000/svg",
40
40
  width: o,
@@ -45,18 +45,18 @@ var d = h(function(e, i) {
45
45
  strokeWidth: "2",
46
46
  strokeLinecap: "round",
47
47
  strokeLinejoin: "round"
48
- }, l), /* @__PURE__ */ c.createElement("line", {
48
+ }, f), /* @__PURE__ */ p.createElement("line", {
49
49
  x1: "5",
50
50
  y1: "12",
51
51
  x2: "19",
52
52
  y2: "12"
53
53
  }));
54
54
  });
55
- d.propTypes = {
56
- color: a.string,
57
- size: a.oneOfType([a.string, a.number])
55
+ g.propTypes = {
56
+ color: s.string,
57
+ size: s.oneOfType([s.string, s.number])
58
58
  };
59
- d.displayName = "Minus";
59
+ g.displayName = "Minus";
60
60
  function b() {
61
61
  return b = Object.assign || function(e) {
62
62
  for (var i = 1; i < arguments.length; i++) {
@@ -67,9 +67,9 @@ function b() {
67
67
  return e;
68
68
  }, b.apply(this, arguments);
69
69
  }
70
- function W(e, i) {
70
+ function V(e, i) {
71
71
  if (e == null) return {};
72
- var r = V(e, i), t, n;
72
+ var r = M(e, i), t, n;
73
73
  if (Object.getOwnPropertySymbols) {
74
74
  var o = Object.getOwnPropertySymbols(e);
75
75
  for (n = 0; n < o.length; n++)
@@ -77,16 +77,16 @@ function W(e, i) {
77
77
  }
78
78
  return r;
79
79
  }
80
- function V(e, i) {
80
+ function M(e, i) {
81
81
  if (e == null) return {};
82
82
  var r = {}, t = Object.keys(e), n, o;
83
83
  for (o = 0; o < t.length; o++)
84
84
  n = t[o], !(i.indexOf(n) >= 0) && (r[n] = e[n]);
85
85
  return r;
86
86
  }
87
- var g = h(function(e, i) {
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__ */ c.createElement("svg", b({
87
+ var O = d(function(e, i) {
88
+ var r = e.color, t = r === void 0 ? "currentColor" : r, n = e.size, o = n === void 0 ? 24 : n, f = V(e, ["color", "size"]);
89
+ return /* @__PURE__ */ p.createElement("svg", b({
90
90
  ref: i,
91
91
  xmlns: "http://www.w3.org/2000/svg",
92
92
  width: o,
@@ -97,24 +97,24 @@ var g = h(function(e, i) {
97
97
  strokeWidth: "2",
98
98
  strokeLinecap: "round",
99
99
  strokeLinejoin: "round"
100
- }, l), /* @__PURE__ */ c.createElement("line", {
100
+ }, f), /* @__PURE__ */ p.createElement("line", {
101
101
  x1: "12",
102
102
  y1: "5",
103
103
  x2: "12",
104
104
  y2: "19"
105
- }), /* @__PURE__ */ c.createElement("line", {
105
+ }), /* @__PURE__ */ p.createElement("line", {
106
106
  x1: "5",
107
107
  y1: "12",
108
108
  x2: "19",
109
109
  y2: "12"
110
110
  }));
111
111
  });
112
- g.propTypes = {
113
- color: a.string,
114
- size: a.oneOfType([a.string, a.number])
112
+ O.propTypes = {
113
+ color: s.string,
114
+ size: s.oneOfType([s.string, s.number])
115
115
  };
116
- g.displayName = "Plus";
117
- const A = h(
116
+ O.displayName = "Plus";
117
+ const G = d(
118
118
  ({
119
119
  className: e,
120
120
  label: i,
@@ -122,25 +122,22 @@ const A = h(
122
122
  min: t = 1 / 0,
123
123
  name: n,
124
124
  theme: o,
125
- value: l,
126
- onChange: s
127
- }, x) => {
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(() => {
132
- let f = 0;
133
- t === 1 / 0 ? f = l - 1 : f = Math.max(t, l - 1), s == null || s({ target: { value: f } });
134
- }, [l, t, s]), N = O(() => {
135
- let f = 0;
136
- r === -1 / 0 ? f = l + 1 : f = Math.min(r, l + 1), s == null || s({ target: { value: f } });
137
- }, [l, r, s]);
138
- return /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: [
125
+ value: f,
126
+ onChange: l
127
+ }, P) => {
128
+ const { theme: k } = $(), m = o ?? k, I = _(), a = f ?? 0, N = j(() => {
129
+ let c = 0;
130
+ t === 1 / 0 ? c = a - 1 : c = Math.max(t, a - 1), l == null || l({ target: { value: c } });
131
+ }, [a, t, l]), z = j(() => {
132
+ let c = 0;
133
+ r === -1 / 0 ? c = a + 1 : c = Math.min(r, a + 1), l == null || l({ target: { value: c } });
134
+ }, [a, r, l]);
135
+ return /* @__PURE__ */ y("div", { className: "flex flex-col gap-1", children: [
139
136
  i ? /* @__PURE__ */ u(
140
137
  "label",
141
138
  {
142
- htmlFor: n ?? k,
143
- className: y(
139
+ htmlFor: n ?? I,
140
+ className: v(
144
141
  E({
145
142
  theme: m
146
143
  })
@@ -148,17 +145,17 @@ const A = h(
148
145
  children: i
149
146
  }
150
147
  ) : null,
151
- /* @__PURE__ */ p("div", { className: "flex items-center", role: "presentation", children: [
152
- /* @__PURE__ */ p(
148
+ /* @__PURE__ */ y("div", { className: "flex items-center", role: "presentation", children: [
149
+ /* @__PURE__ */ y(
153
150
  "button",
154
151
  {
155
152
  type: "button",
156
- onClick: I,
157
- className: y(
158
- j({ theme: m, button: "rigth" })
153
+ onClick: N,
154
+ className: v(
155
+ x({ theme: m, button: "rigth" })
159
156
  ),
160
157
  children: [
161
- /* @__PURE__ */ u(d, { className: "w-4 h-4" }),
158
+ /* @__PURE__ */ u(g, { className: "w-4 h-4" }),
162
159
  /* @__PURE__ */ u(w, { children: "Decrement" })
163
160
  ]
164
161
  }
@@ -166,27 +163,27 @@ const A = h(
166
163
  /* @__PURE__ */ u(
167
164
  "input",
168
165
  {
169
- ref: x,
166
+ ref: P,
170
167
  type: "number",
171
- value: l,
168
+ value: a,
172
169
  name: n,
173
- className: y(
174
- _({ className: e, theme: m })
170
+ className: v(
171
+ T({ className: e, theme: m })
175
172
  ),
176
173
  readOnly: !0,
177
174
  "aria-label": typeof i == "string" ? i : "number input"
178
175
  }
179
176
  ),
180
- /* @__PURE__ */ p(
177
+ /* @__PURE__ */ y(
181
178
  "button",
182
179
  {
183
180
  type: "button",
184
- onClick: N,
185
- className: y(
186
- j({ theme: m, button: "left" })
181
+ onClick: z,
182
+ className: v(
183
+ x({ theme: m, button: "left" })
187
184
  ),
188
185
  children: [
189
- /* @__PURE__ */ u(g, { className: "w-4 h-4" }),
186
+ /* @__PURE__ */ u(O, { className: "w-4 h-4" }),
190
187
  /* @__PURE__ */ u(w, { children: "Increment" })
191
188
  ]
192
189
  }
@@ -196,5 +193,5 @@ const A = h(
196
193
  }
197
194
  );
198
195
  export {
199
- A as NumberInput
196
+ G as NumberInput
200
197
  };
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.17",
5
+ "version": "0.0.12-alpha.18",
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.18",
5
+ "version": "0.0.12-alpha.19",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",