@rubenpazch/numeric-up-picker 2.0.0

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.
@@ -0,0 +1,702 @@
1
+ import require$$0, { useState, useMemo } from 'react';
2
+
3
+ var jsxRuntime = {exports: {}};
4
+
5
+ var reactJsxRuntime_production = {};
6
+
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.js
10
+ *
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ var hasRequiredReactJsxRuntime_production;
18
+
19
+ function requireReactJsxRuntime_production () {
20
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
21
+ hasRequiredReactJsxRuntime_production = 1;
22
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
23
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
24
+ function jsxProd(type, config, maybeKey) {
25
+ var key = null;
26
+ void 0 !== maybeKey && (key = "" + maybeKey);
27
+ void 0 !== config.key && (key = "" + config.key);
28
+ if ("key" in config) {
29
+ maybeKey = {};
30
+ for (var propName in config)
31
+ "key" !== propName && (maybeKey[propName] = config[propName]);
32
+ } else maybeKey = config;
33
+ config = maybeKey.ref;
34
+ return {
35
+ $$typeof: REACT_ELEMENT_TYPE,
36
+ type: type,
37
+ key: key,
38
+ ref: void 0 !== config ? config : null,
39
+ props: maybeKey
40
+ };
41
+ }
42
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
43
+ reactJsxRuntime_production.jsx = jsxProd;
44
+ reactJsxRuntime_production.jsxs = jsxProd;
45
+ return reactJsxRuntime_production;
46
+ }
47
+
48
+ var reactJsxRuntime_development = {};
49
+
50
+ /**
51
+ * @license React
52
+ * react-jsx-runtime.development.js
53
+ *
54
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE file in the root directory of this source tree.
58
+ */
59
+
60
+ var hasRequiredReactJsxRuntime_development;
61
+
62
+ function requireReactJsxRuntime_development () {
63
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
64
+ hasRequiredReactJsxRuntime_development = 1;
65
+ "production" !== process.env.NODE_ENV &&
66
+ (function () {
67
+ function getComponentNameFromType(type) {
68
+ if (null == type) return null;
69
+ if ("function" === typeof type)
70
+ return type.$$typeof === REACT_CLIENT_REFERENCE
71
+ ? null
72
+ : type.displayName || type.name || null;
73
+ if ("string" === typeof type) return type;
74
+ switch (type) {
75
+ case REACT_FRAGMENT_TYPE:
76
+ return "Fragment";
77
+ case REACT_PROFILER_TYPE:
78
+ return "Profiler";
79
+ case REACT_STRICT_MODE_TYPE:
80
+ return "StrictMode";
81
+ case REACT_SUSPENSE_TYPE:
82
+ return "Suspense";
83
+ case REACT_SUSPENSE_LIST_TYPE:
84
+ return "SuspenseList";
85
+ case REACT_ACTIVITY_TYPE:
86
+ return "Activity";
87
+ }
88
+ if ("object" === typeof type)
89
+ switch (
90
+ ("number" === typeof type.tag &&
91
+ console.error(
92
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
93
+ ),
94
+ type.$$typeof)
95
+ ) {
96
+ case REACT_PORTAL_TYPE:
97
+ return "Portal";
98
+ case REACT_CONTEXT_TYPE:
99
+ return type.displayName || "Context";
100
+ case REACT_CONSUMER_TYPE:
101
+ return (type._context.displayName || "Context") + ".Consumer";
102
+ case REACT_FORWARD_REF_TYPE:
103
+ var innerType = type.render;
104
+ type = type.displayName;
105
+ type ||
106
+ ((type = innerType.displayName || innerType.name || ""),
107
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
108
+ return type;
109
+ case REACT_MEMO_TYPE:
110
+ return (
111
+ (innerType = type.displayName || null),
112
+ null !== innerType
113
+ ? innerType
114
+ : getComponentNameFromType(type.type) || "Memo"
115
+ );
116
+ case REACT_LAZY_TYPE:
117
+ innerType = type._payload;
118
+ type = type._init;
119
+ try {
120
+ return getComponentNameFromType(type(innerType));
121
+ } catch (x) {}
122
+ }
123
+ return null;
124
+ }
125
+ function testStringCoercion(value) {
126
+ return "" + value;
127
+ }
128
+ function checkKeyStringCoercion(value) {
129
+ try {
130
+ testStringCoercion(value);
131
+ var JSCompiler_inline_result = !1;
132
+ } catch (e) {
133
+ JSCompiler_inline_result = true;
134
+ }
135
+ if (JSCompiler_inline_result) {
136
+ JSCompiler_inline_result = console;
137
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
138
+ var JSCompiler_inline_result$jscomp$0 =
139
+ ("function" === typeof Symbol &&
140
+ Symbol.toStringTag &&
141
+ value[Symbol.toStringTag]) ||
142
+ value.constructor.name ||
143
+ "Object";
144
+ JSCompiler_temp_const.call(
145
+ JSCompiler_inline_result,
146
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
147
+ JSCompiler_inline_result$jscomp$0
148
+ );
149
+ return testStringCoercion(value);
150
+ }
151
+ }
152
+ function getTaskName(type) {
153
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
154
+ if (
155
+ "object" === typeof type &&
156
+ null !== type &&
157
+ type.$$typeof === REACT_LAZY_TYPE
158
+ )
159
+ return "<...>";
160
+ try {
161
+ var name = getComponentNameFromType(type);
162
+ return name ? "<" + name + ">" : "<...>";
163
+ } catch (x) {
164
+ return "<...>";
165
+ }
166
+ }
167
+ function getOwner() {
168
+ var dispatcher = ReactSharedInternals.A;
169
+ return null === dispatcher ? null : dispatcher.getOwner();
170
+ }
171
+ function UnknownOwner() {
172
+ return Error("react-stack-top-frame");
173
+ }
174
+ function hasValidKey(config) {
175
+ if (hasOwnProperty.call(config, "key")) {
176
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
177
+ if (getter && getter.isReactWarning) return false;
178
+ }
179
+ return void 0 !== config.key;
180
+ }
181
+ function defineKeyPropWarningGetter(props, displayName) {
182
+ function warnAboutAccessingKey() {
183
+ specialPropKeyWarningShown ||
184
+ ((specialPropKeyWarningShown = true),
185
+ console.error(
186
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
187
+ displayName
188
+ ));
189
+ }
190
+ warnAboutAccessingKey.isReactWarning = true;
191
+ Object.defineProperty(props, "key", {
192
+ get: warnAboutAccessingKey,
193
+ configurable: true
194
+ });
195
+ }
196
+ function elementRefGetterWithDeprecationWarning() {
197
+ var componentName = getComponentNameFromType(this.type);
198
+ didWarnAboutElementRef[componentName] ||
199
+ ((didWarnAboutElementRef[componentName] = true),
200
+ console.error(
201
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
202
+ ));
203
+ componentName = this.props.ref;
204
+ return void 0 !== componentName ? componentName : null;
205
+ }
206
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
207
+ var refProp = props.ref;
208
+ type = {
209
+ $$typeof: REACT_ELEMENT_TYPE,
210
+ type: type,
211
+ key: key,
212
+ props: props,
213
+ _owner: owner
214
+ };
215
+ null !== (void 0 !== refProp ? refProp : null)
216
+ ? Object.defineProperty(type, "ref", {
217
+ enumerable: false,
218
+ get: elementRefGetterWithDeprecationWarning
219
+ })
220
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
221
+ type._store = {};
222
+ Object.defineProperty(type._store, "validated", {
223
+ configurable: false,
224
+ enumerable: false,
225
+ writable: true,
226
+ value: 0
227
+ });
228
+ Object.defineProperty(type, "_debugInfo", {
229
+ configurable: false,
230
+ enumerable: false,
231
+ writable: true,
232
+ value: null
233
+ });
234
+ Object.defineProperty(type, "_debugStack", {
235
+ configurable: false,
236
+ enumerable: false,
237
+ writable: true,
238
+ value: debugStack
239
+ });
240
+ Object.defineProperty(type, "_debugTask", {
241
+ configurable: false,
242
+ enumerable: false,
243
+ writable: true,
244
+ value: debugTask
245
+ });
246
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
247
+ return type;
248
+ }
249
+ function jsxDEVImpl(
250
+ type,
251
+ config,
252
+ maybeKey,
253
+ isStaticChildren,
254
+ debugStack,
255
+ debugTask
256
+ ) {
257
+ var children = config.children;
258
+ if (void 0 !== children)
259
+ if (isStaticChildren)
260
+ if (isArrayImpl(children)) {
261
+ for (
262
+ isStaticChildren = 0;
263
+ isStaticChildren < children.length;
264
+ isStaticChildren++
265
+ )
266
+ validateChildKeys(children[isStaticChildren]);
267
+ Object.freeze && Object.freeze(children);
268
+ } else
269
+ console.error(
270
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
271
+ );
272
+ else validateChildKeys(children);
273
+ if (hasOwnProperty.call(config, "key")) {
274
+ children = getComponentNameFromType(type);
275
+ var keys = Object.keys(config).filter(function (k) {
276
+ return "key" !== k;
277
+ });
278
+ isStaticChildren =
279
+ 0 < keys.length
280
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
281
+ : "{key: someKey}";
282
+ didWarnAboutKeySpread[children + isStaticChildren] ||
283
+ ((keys =
284
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
285
+ console.error(
286
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
287
+ isStaticChildren,
288
+ children,
289
+ keys,
290
+ children
291
+ ),
292
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
293
+ }
294
+ children = null;
295
+ void 0 !== maybeKey &&
296
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
297
+ hasValidKey(config) &&
298
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
299
+ if ("key" in config) {
300
+ maybeKey = {};
301
+ for (var propName in config)
302
+ "key" !== propName && (maybeKey[propName] = config[propName]);
303
+ } else maybeKey = config;
304
+ children &&
305
+ defineKeyPropWarningGetter(
306
+ maybeKey,
307
+ "function" === typeof type
308
+ ? type.displayName || type.name || "Unknown"
309
+ : type
310
+ );
311
+ return ReactElement(
312
+ type,
313
+ children,
314
+ maybeKey,
315
+ getOwner(),
316
+ debugStack,
317
+ debugTask
318
+ );
319
+ }
320
+ function validateChildKeys(node) {
321
+ isValidElement(node)
322
+ ? node._store && (node._store.validated = 1)
323
+ : "object" === typeof node &&
324
+ null !== node &&
325
+ node.$$typeof === REACT_LAZY_TYPE &&
326
+ ("fulfilled" === node._payload.status
327
+ ? isValidElement(node._payload.value) &&
328
+ node._payload.value._store &&
329
+ (node._payload.value._store.validated = 1)
330
+ : node._store && (node._store.validated = 1));
331
+ }
332
+ function isValidElement(object) {
333
+ return (
334
+ "object" === typeof object &&
335
+ null !== object &&
336
+ object.$$typeof === REACT_ELEMENT_TYPE
337
+ );
338
+ }
339
+ var React = require$$0,
340
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
341
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
342
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
343
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
344
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
345
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
346
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
347
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
348
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
349
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
350
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
351
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
352
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
353
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
354
+ ReactSharedInternals =
355
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
356
+ hasOwnProperty = Object.prototype.hasOwnProperty,
357
+ isArrayImpl = Array.isArray,
358
+ createTask = console.createTask
359
+ ? console.createTask
360
+ : function () {
361
+ return null;
362
+ };
363
+ React = {
364
+ react_stack_bottom_frame: function (callStackForError) {
365
+ return callStackForError();
366
+ }
367
+ };
368
+ var specialPropKeyWarningShown;
369
+ var didWarnAboutElementRef = {};
370
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
371
+ React,
372
+ UnknownOwner
373
+ )();
374
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
375
+ var didWarnAboutKeySpread = {};
376
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
377
+ reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
378
+ var trackActualOwner =
379
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
380
+ return jsxDEVImpl(
381
+ type,
382
+ config,
383
+ maybeKey,
384
+ false,
385
+ trackActualOwner
386
+ ? Error("react-stack-top-frame")
387
+ : unknownOwnerDebugStack,
388
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
389
+ );
390
+ };
391
+ reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
392
+ var trackActualOwner =
393
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
394
+ return jsxDEVImpl(
395
+ type,
396
+ config,
397
+ maybeKey,
398
+ true,
399
+ trackActualOwner
400
+ ? Error("react-stack-top-frame")
401
+ : unknownOwnerDebugStack,
402
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
403
+ );
404
+ };
405
+ })();
406
+ return reactJsxRuntime_development;
407
+ }
408
+
409
+ var hasRequiredJsxRuntime;
410
+
411
+ function requireJsxRuntime () {
412
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
413
+ hasRequiredJsxRuntime = 1;
414
+
415
+ if (process.env.NODE_ENV === 'production') {
416
+ jsxRuntime.exports = requireReactJsxRuntime_production();
417
+ } else {
418
+ jsxRuntime.exports = requireReactJsxRuntime_development();
419
+ }
420
+ return jsxRuntime.exports;
421
+ }
422
+
423
+ var jsxRuntimeExports = requireJsxRuntime();
424
+
425
+ var r,s={exports:{}},o={};var t,l,n={};
426
+ /**
427
+ * @license React
428
+ * react-jsx-runtime.development.js
429
+ *
430
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
431
+ *
432
+ * This source code is licensed under the MIT license found in the
433
+ * LICENSE file in the root directory of this source tree.
434
+ */function a(){return t||(t=1,"production"!==process.env.NODE_ENV&&function(){function r(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===$?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case x:return "Fragment";case v:return "Profiler";case p:return "StrictMode";case k:return "Suspense";case y:return "SuspenseList";case C:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case u:return "Portal";case g:return e.displayName||"Context";case f:return (e._context.displayName||"Context")+".Consumer";case j:var s=e.render;return (e=e.displayName)||(e=""!==(e=s.displayName||s.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case L:return null!==(s=e.displayName||null)?s:r(e.type)||"Memo";case N:s=e._payload,e=e._init;try{return r(e(s))}catch(e){}}return null}function s(e){return ""+e}function o(e){try{s(e);var r=!1;}catch(e){r=true;}if(r){var o=(r=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),s(e)}}function t(e){if(e===x)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===N)return "<...>";try{var s=r(e);return s?"<"+s+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function a(){var e=r(this.type);return W[e]||(W[e]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function i(e,s,t,l,n,i){var h,m=s.children;if(void 0!==m)if(l)if(M(m)){for(l=0;l<m.length;l++)c(m[l]);Object.freeze&&Object.freeze(m);}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else c(m);if(z.call(s,"key")){m=r(e);var u=Object.keys(s).filter(function(e){return "key"!==e});l=0<u.length?"{key: someKey, "+u.join(": ..., ")+": ...}":"{key: someKey}",V[m+l]||(u=0<u.length?"{"+u.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',l,m,u,m),V[m+l]=true);}if(m=null,void 0!==t&&(o(t),m=""+t),function(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(s)&&(o(s.key),m=""+s.key),"key"in s)for(var x in t={},s)"key"!==x&&(t[x]=s[x]);else t=s;return m&&function(e,r){function s(){d||(d=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r));}s.isReactWarning=true,Object.defineProperty(e,"key",{get:s,configurable:true});}(t,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,s,o,t,l){var n=s.ref;return e={$$typeof:w,type:e,key:r,props:s,_owner:o},null!==(void 0!==n?n:null)?Object.defineProperty(e,"ref",{enumerable:false,get:a}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,m,t,null===(h=b.A)?null:h.getOwner(),n,i)}function c(e){h(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===N&&("fulfilled"===e._payload.status?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function h(e){return "object"==typeof e&&null!==e&&e.$$typeof===w}var d,m=require$$0,w=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),g=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),b=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,M=Array.isArray,B=console.createTask?console.createTask:function(){return null},W={},_=(m={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(m,l)(),H=B(t(l)),V={};n.Fragment=x,n.jsx=function(e,r,s){var o=1e4>b.recentlyCreatedOwnerStacks++;return i(e,r,s,false,o?Error("react-stack-top-frame"):_,o?B(t(e)):H)},n.jsxs=function(e,r,s){var o=1e4>b.recentlyCreatedOwnerStacks++;return i(e,r,s,true,o?Error("react-stack-top-frame"):_,o?B(t(e)):H)};}()),n}var i=(l||(l=1,"production"===process.env.NODE_ENV?s.exports=function(){if(r)return o;r=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function t(r,s,o){var t=null;if(void 0!==o&&(t=""+o),void 0!==s.key&&(t=""+s.key),"key"in s)for(var l in o={},s)"key"!==l&&(o[l]=s[l]);else o=s;return s=o.ref,{$$typeof:e,type:r,key:t,ref:void 0!==s?s:null,props:o}}return o.Fragment=s,o.jsx=t,o.jsxs=t,o}():s.exports=a()),s.exports);function m({className:e="",size:r="md"}){const s=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:s,"aria-label":"Check",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}function g({className:e="",size:r="md",color:s="currentColor"}){return i.jsx("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`,fill:"none",stroke:s,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function R({className:e="",size:r="md",color:s="currentColor"}){return i.jsx("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`,fill:"none",stroke:s,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M5 12h14"})})}function U({className:e="",size:r="md"}){const s=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,"aria-label":"Plus",children:i.jsx("path",{d:"M12 4v16m8-8H4"})})}
435
+
436
+ // CSS to hide native number input spinners
437
+ const hideSpinnersStyle = `
438
+ input[type="number"]::-webkit-outer-spin-button,
439
+ input[type="number"]::-webkit-inner-spin-button {
440
+ -webkit-appearance: none;
441
+ margin: 0;
442
+ }
443
+ input[type="number"] {
444
+ -moz-appearance: textfield;
445
+ }
446
+ `;
447
+ function NumericUpPicker({ label, value, onChange, onBlur, onFocus, placeholder, min, max, step = 0.01, error, hint, warning, disabled = false, className = '', required = false, useMinAsDefault = false, alwaysNegative = false, integerOnly = false, showSign = false, defaultToZero = false, clearable = false, onClear, }) {
448
+ // Track if the field has been touched (user has focused on it)
449
+ const [hasBeenTouched, setHasBeenTouched] = useState(false);
450
+ const numValue = typeof value === 'string' ? parseFloat(value) || 0 : value;
451
+ // Format display value with sign if showSign is true
452
+ const displayValue = useMemo(() => {
453
+ if (!showSign || value === '' || value === '-' || value === null || value === undefined)
454
+ return value || '';
455
+ const strValue = value.toString();
456
+ const numVal = parseFloat(strValue);
457
+ if (isNaN(numVal))
458
+ return value;
459
+ if (numVal > 0 && !strValue.startsWith('+')) {
460
+ return `+${strValue}`;
461
+ }
462
+ return value;
463
+ }, [value, showSign]);
464
+ const handleIncrement = () => {
465
+ // If value is empty or invalid, start from 0 if defaultToZero, otherwise from min (or 0 if no min)
466
+ if (value === '' || value === '-' || value === null || value === undefined) {
467
+ const startValue = defaultToZero ? 0 : min !== undefined ? min : 0;
468
+ if (integerOnly) {
469
+ onChange(Math.round(startValue).toString());
470
+ }
471
+ else {
472
+ onChange(startValue.toFixed(2));
473
+ }
474
+ return;
475
+ }
476
+ const newValue = numValue + step;
477
+ if (max === undefined || newValue <= max) {
478
+ if (integerOnly) {
479
+ onChange(Math.round(newValue).toString());
480
+ }
481
+ else {
482
+ const formattedValue = newValue.toFixed(2);
483
+ // If alwaysNegative, ensure the value has a negative sign
484
+ onChange(alwaysNegative && newValue > 0 ? `-${formattedValue}` : formattedValue);
485
+ }
486
+ }
487
+ };
488
+ const handleDecrement = () => {
489
+ // If value is empty or invalid, start from 0 if defaultToZero, otherwise from max (or 0 if no max)
490
+ if (value === '' || value === '-' || value === null || value === undefined) {
491
+ const startValue = defaultToZero ? 0 : max !== undefined ? max : 0;
492
+ if (integerOnly) {
493
+ onChange(Math.round(startValue).toString());
494
+ }
495
+ else {
496
+ onChange(startValue.toFixed(2));
497
+ }
498
+ return;
499
+ }
500
+ const newValue = numValue - step;
501
+ if (min === undefined || newValue >= min) {
502
+ if (integerOnly) {
503
+ onChange(Math.round(newValue).toString());
504
+ }
505
+ else if (alwaysNegative) {
506
+ // For alwaysNegative fields, work with absolute value
507
+ const formattedValue = Math.abs(newValue).toFixed(2);
508
+ onChange(`-${formattedValue}`);
509
+ }
510
+ else {
511
+ onChange(newValue.toFixed(2));
512
+ }
513
+ }
514
+ };
515
+ const handleKeyDown = (e) => {
516
+ // Handle arrow up/down keys for incrementing/decrementing
517
+ if (e.key === 'ArrowUp') {
518
+ e.preventDefault(); // Prevent cursor movement
519
+ handleIncrement();
520
+ }
521
+ else if (e.key === 'ArrowDown') {
522
+ e.preventDefault(); // Prevent cursor movement
523
+ handleDecrement();
524
+ }
525
+ };
526
+ const handleFocus = (e) => {
527
+ // Mark field as touched when user focuses on it
528
+ setHasBeenTouched(true);
529
+ // Auto-select all content when focusing
530
+ e.target.select();
531
+ onFocus?.();
532
+ };
533
+ const handleDirectInput = (e) => {
534
+ let inputValue = e.target.value;
535
+ // For showSign, remove the plus sign before processing
536
+ if (showSign) {
537
+ inputValue = inputValue.replace(/^\+/, '');
538
+ }
539
+ // For alwaysNegative fields, ensure value always starts with minus sign
540
+ if (alwaysNegative) {
541
+ // Remove any existing minus signs
542
+ inputValue = inputValue.replace(/-/g, '');
543
+ // Allow empty input
544
+ if (inputValue === '') {
545
+ onChange('-');
546
+ return;
547
+ }
548
+ // Add minus sign at the beginning
549
+ inputValue = `-${inputValue}`;
550
+ }
551
+ // Allow empty input (user deleted content)
552
+ if (inputValue === '' || inputValue === '-') {
553
+ onChange(inputValue);
554
+ return;
555
+ }
556
+ // Allow typing decimals and negative signs
557
+ onChange(inputValue);
558
+ };
559
+ const handleClear = () => {
560
+ onChange('');
561
+ onClear?.();
562
+ };
563
+ const handleBlurWithValidation = () => {
564
+ const inputValue = value.toString();
565
+ // If empty, handle based on required and useMinAsDefault flags
566
+ if (inputValue === '' || inputValue === '-') {
567
+ // For optional fields (!required), allow empty values
568
+ if (!required) {
569
+ onChange('');
570
+ onBlur?.();
571
+ return;
572
+ }
573
+ // For required fields, only apply useMinAsDefault if the field has been touched
574
+ if (useMinAsDefault && hasBeenTouched && min !== undefined) {
575
+ if (integerOnly) {
576
+ onChange(Math.round(min).toString());
577
+ }
578
+ else {
579
+ const formattedValue = Math.abs(min).toFixed(2);
580
+ onChange(alwaysNegative ? `-${formattedValue}` : min.toFixed(2));
581
+ }
582
+ }
583
+ else if (!useMinAsDefault && min !== undefined) {
584
+ // For required fields without useMinAsDefault, set to min
585
+ if (integerOnly) {
586
+ onChange(Math.round(min).toString());
587
+ }
588
+ else {
589
+ const formattedValue = Math.abs(min).toFixed(2);
590
+ onChange(alwaysNegative ? `-${formattedValue}` : min.toFixed(2));
591
+ }
592
+ }
593
+ else if (!hasBeenTouched) {
594
+ // If never touched, keep it empty
595
+ onChange('');
596
+ }
597
+ else {
598
+ onChange(integerOnly ? '0' : alwaysNegative ? '-0.00' : '0.00');
599
+ }
600
+ onBlur?.();
601
+ return;
602
+ }
603
+ // Parse the input value (remove negative sign if present for alwaysNegative fields)
604
+ let numericValue = alwaysNegative
605
+ ? parseFloat(inputValue.replace(/^-/, ''))
606
+ : parseFloat(inputValue);
607
+ // If not a valid number, reset to min or 0
608
+ if (isNaN(numericValue)) {
609
+ if (useMinAsDefault && min !== undefined) {
610
+ if (integerOnly) {
611
+ onChange(Math.round(min).toString());
612
+ }
613
+ else {
614
+ const formattedValue = Math.abs(min).toFixed(2);
615
+ onChange(alwaysNegative ? `-${formattedValue}` : min.toFixed(2));
616
+ }
617
+ }
618
+ else if (min !== undefined) {
619
+ if (integerOnly) {
620
+ onChange(Math.round(min).toString());
621
+ }
622
+ else {
623
+ const formattedValue = Math.abs(min).toFixed(2);
624
+ onChange(alwaysNegative ? `-${formattedValue}` : min.toFixed(2));
625
+ }
626
+ }
627
+ else {
628
+ onChange(integerOnly ? '0' : alwaysNegative ? '-0.00' : '0.00');
629
+ }
630
+ onBlur?.();
631
+ return;
632
+ }
633
+ // For alwaysNegative fields, work with absolute values for min/max comparison
634
+ if (alwaysNegative) {
635
+ // Clamp the absolute value within the absolute range
636
+ const absMin = Math.abs(max ?? -0.25); // max is the least negative (closest to 0)
637
+ const absMax = Math.abs(min ?? -10); // min is the most negative (farthest from 0)
638
+ if (numericValue < absMin) {
639
+ numericValue = absMin;
640
+ }
641
+ if (numericValue > absMax) {
642
+ numericValue = absMax;
643
+ }
644
+ onChange(`-${numericValue.toFixed(2)}`);
645
+ onBlur?.();
646
+ return;
647
+ }
648
+ // Apply useMinAsDefault logic: if value is below min, set to min
649
+ if (useMinAsDefault && min !== undefined && numericValue < min) {
650
+ onChange(integerOnly ? Math.round(min).toString() : min.toFixed(2));
651
+ onBlur?.();
652
+ return;
653
+ }
654
+ // Clamp the value within the range
655
+ let constrainedValue = numericValue;
656
+ if (min !== undefined && constrainedValue < min) {
657
+ constrainedValue = min;
658
+ }
659
+ if (max !== undefined && constrainedValue > max) {
660
+ constrainedValue = max;
661
+ }
662
+ // Format and send the constrained value
663
+ if (integerOnly) {
664
+ onChange(Math.round(constrainedValue).toString());
665
+ }
666
+ else {
667
+ onChange(constrainedValue.toFixed(2));
668
+ }
669
+ onBlur?.();
670
+ };
671
+ // Disable buttons only if value is not empty and at min/max
672
+ // When value is empty, allow both buttons (they will set to min/max)
673
+ const isEmpty = value === '' || value === '-' || value === null || value === undefined;
674
+ // For alwaysNegative fields, we compare absolute values
675
+ const isAtMin = !isEmpty &&
676
+ (alwaysNegative
677
+ ? min !== undefined && Math.abs(numValue) >= Math.abs(min)
678
+ : min !== undefined && numValue <= min);
679
+ const isAtMax = !isEmpty &&
680
+ (alwaysNegative
681
+ ? max !== undefined && Math.abs(numValue) <= Math.abs(max)
682
+ : max !== undefined && numValue >= max);
683
+ return (jsxRuntimeExports.jsxs("div", { className: className, children: [jsxRuntimeExports.jsx("style", { children: hideSpinnersStyle }), label && (jsxRuntimeExports.jsxs("label", { className: `block text-sm font-medium mb-2 ${error ? 'text-red-700' : 'text-gray-700'}`, children: [label, required && jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })] })), jsxRuntimeExports.jsxs("div", { className: `flex items-center justify-between h-12 rounded-lg border-2 transition-all ${error
684
+ ? 'border-red-500 bg-red-50'
685
+ : disabled
686
+ ? 'border-gray-300 bg-gray-100 opacity-50 cursor-not-allowed'
687
+ : 'border-gray-300 bg-gray-50'}`, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: handleDecrement, disabled: disabled || isAtMin, className: `flex-shrink-0 w-12 h-full flex items-center justify-center border-r border-gray-300 transition-all ${error
688
+ ? 'text-red-500'
689
+ : disabled || isAtMin
690
+ ? 'opacity-40 cursor-not-allowed text-gray-400'
691
+ : 'hover:bg-gray-100 active:bg-gray-200 text-gray-600'}`, title: "Decrease value", "aria-label": "Decrease", children: jsxRuntimeExports.jsx(R, { size: "md" }) }), jsxRuntimeExports.jsxs("div", { className: "flex-1 flex items-center justify-center relative", children: [jsxRuntimeExports.jsx("input", { type: "text", step: step, min: min, max: max, value: displayValue, onChange: handleDirectInput, onBlur: handleBlurWithValidation, onFocus: handleFocus, onKeyDown: handleKeyDown, placeholder: placeholder, disabled: disabled, className: `text-center bg-transparent text-lg font-semibold placeholder-gray-400 focus:outline-none border-none ${error ? 'text-red-700' : 'text-gray-900'} ${clearable && !isEmpty ? 'w-20 pr-6' : 'w-16'}`, style: {
692
+ WebkitAppearance: 'none',
693
+ MozAppearance: 'textfield',
694
+ appearance: 'none',
695
+ } }), clearable && !isEmpty && !disabled && (jsxRuntimeExports.jsx("button", { type: "button", onClick: handleClear, className: "absolute right-1 top-1/2 -translate-y-1/2 w-5 h-5 flex items-center justify-center rounded-full hover:bg-gray-200 active:bg-gray-300 transition-colors text-gray-500 hover:text-gray-700", title: "Clear value", "aria-label": "Clear", children: jsxRuntimeExports.jsx(g, { size: "sm", className: "w-3 h-3" }) }))] }), jsxRuntimeExports.jsx("button", { type: "button", onClick: handleIncrement, disabled: disabled || isAtMax, className: `flex-shrink-0 w-12 h-full flex items-center justify-center border-l border-gray-300 transition-all ${error
696
+ ? 'text-red-500'
697
+ : disabled || isAtMax
698
+ ? 'opacity-40 cursor-not-allowed text-gray-400'
699
+ : 'hover:bg-gray-100 active:bg-gray-200 text-gray-600'}`, title: "Increase value", "aria-label": "Increase", children: jsxRuntimeExports.jsx(U, { size: "md" }) })] }), error && (jsxRuntimeExports.jsxs("div", { className: "mt-2 flex items-start gap-1.5", children: [jsxRuntimeExports.jsx(m, { size: "sm", className: "text-red-500 flex-shrink-0 mt-0.5" }), jsxRuntimeExports.jsx("p", { className: "text-sm text-red-600 font-medium", children: error })] })), warning && !error && (jsxRuntimeExports.jsxs("div", { className: "mt-2 flex items-start gap-1.5", children: [jsxRuntimeExports.jsx("div", { className: "w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5 flex items-center justify-center", children: jsxRuntimeExports.jsx("span", { className: "text-xs font-bold", children: "!" }) }), jsxRuntimeExports.jsx("p", { className: "text-sm text-amber-700", children: warning })] })), hint && !error && !warning && jsxRuntimeExports.jsx("p", { className: "mt-2 text-xs text-gray-500", children: hint })] }));
700
+ }
701
+
702
+ export { NumericUpPicker as default };