@ceed/ads 0.0.92 → 0.0.94

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.
package/framer/index.js CHANGED
@@ -1281,7 +1281,7 @@ var require_react_is3 = __commonJS({
1281
1281
 
1282
1282
  // src/framer-entrypoint.ts
1283
1283
  import { ControlType as ControlType30 } from "framer";
1284
- import React184 from "react";
1284
+ import React185 from "react";
1285
1285
 
1286
1286
  // ../../node_modules/@mui/joy/colors/colors.js
1287
1287
  var colors = {
@@ -36886,7 +36886,7 @@ var Container = forwardRef84(function Container2(props, ref) {
36886
36886
  Container.displayName = "Container";
36887
36887
 
36888
36888
  // src/components/CurrencyInput/CurrencyInput.tsx
36889
- import React179, { useCallback as useCallback27, useState as useState26 } from "react";
36889
+ import React178, { useCallback as useCallback26, useState as useState26 } from "react";
36890
36890
 
36891
36891
  // ../../node_modules/tslib/tslib.es6.mjs
36892
36892
  var extendStatics = function(d, b) {
@@ -40219,382 +40219,2191 @@ var IntlMessageFormat = (
40219
40219
  }()
40220
40220
  );
40221
40221
 
40222
- // ../../node_modules/imask/esm/core/utils.js
40223
- function isString(str) {
40224
- return typeof str === "string" || str instanceof String;
40222
+ // ../../node_modules/intl-messageformat/lib/index.js
40223
+ var lib_default = IntlMessageFormat;
40224
+
40225
+ // ../../node_modules/react-number-format/dist/react-number-format.es.js
40226
+ import React177, { useState as useState25, useMemo as useMemo35, useRef as useRef43, useEffect as useEffect36, useLayoutEffect as useLayoutEffect3 } from "react";
40227
+ function __rest2(s, e) {
40228
+ var t = {};
40229
+ for (var p in s) {
40230
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) {
40231
+ t[p] = s[p];
40232
+ }
40233
+ }
40234
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") {
40235
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40236
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) {
40237
+ t[p[i]] = s[p[i]];
40238
+ }
40239
+ }
40240
+ }
40241
+ return t;
40225
40242
  }
40226
- function isObject(obj) {
40227
- var _obj$constructor;
40228
- return typeof obj === "object" && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === "Object";
40243
+ var SourceType;
40244
+ (function(SourceType2) {
40245
+ SourceType2["event"] = "event";
40246
+ SourceType2["props"] = "prop";
40247
+ })(SourceType || (SourceType = {}));
40248
+ function noop() {
40229
40249
  }
40230
- function pick(obj, keys) {
40231
- if (Array.isArray(keys))
40232
- return pick(obj, (_4, k) => keys.includes(k));
40233
- return Object.entries(obj).reduce((acc, _ref) => {
40234
- let [k, v] = _ref;
40235
- if (keys(v, k))
40236
- acc[k] = v;
40237
- return acc;
40238
- }, {});
40250
+ function memoizeOnce(cb) {
40251
+ var lastArgs;
40252
+ var lastValue = void 0;
40253
+ return function() {
40254
+ var args = [], len = arguments.length;
40255
+ while (len--)
40256
+ args[len] = arguments[len];
40257
+ if (lastArgs && args.length === lastArgs.length && args.every(function(value, index) {
40258
+ return value === lastArgs[index];
40259
+ })) {
40260
+ return lastValue;
40261
+ }
40262
+ lastArgs = args;
40263
+ lastValue = cb.apply(void 0, args);
40264
+ return lastValue;
40265
+ };
40239
40266
  }
40240
- var DIRECTION = {
40241
- NONE: "NONE",
40242
- LEFT: "LEFT",
40243
- FORCE_LEFT: "FORCE_LEFT",
40244
- RIGHT: "RIGHT",
40245
- FORCE_RIGHT: "FORCE_RIGHT"
40246
- };
40247
- function forceDirection(direction) {
40248
- switch (direction) {
40249
- case DIRECTION.LEFT:
40250
- return DIRECTION.FORCE_LEFT;
40251
- case DIRECTION.RIGHT:
40252
- return DIRECTION.FORCE_RIGHT;
40253
- default:
40254
- return direction;
40255
- }
40267
+ function charIsNumber(char2) {
40268
+ return !!(char2 || "").match(/\d/);
40256
40269
  }
40257
- function escapeRegExp(str) {
40258
- return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
40270
+ function isNil(val) {
40271
+ return val === null || val === void 0;
40259
40272
  }
40260
- function objectIncludes(b, a) {
40261
- if (a === b)
40262
- return true;
40263
- const arrA = Array.isArray(a), arrB = Array.isArray(b);
40264
- let i;
40265
- if (arrA && arrB) {
40266
- if (a.length != b.length)
40267
- return false;
40268
- for (i = 0; i < a.length; i++)
40269
- if (!objectIncludes(a[i], b[i]))
40270
- return false;
40271
- return true;
40272
- }
40273
- if (arrA != arrB)
40274
- return false;
40275
- if (a && b && typeof a === "object" && typeof b === "object") {
40276
- const dateA = a instanceof Date, dateB = b instanceof Date;
40277
- if (dateA && dateB)
40278
- return a.getTime() == b.getTime();
40279
- if (dateA != dateB)
40280
- return false;
40281
- const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
40282
- if (regexpA && regexpB)
40283
- return a.toString() == b.toString();
40284
- if (regexpA != regexpB)
40285
- return false;
40286
- const keys = Object.keys(a);
40287
- for (i = 0; i < keys.length; i++)
40288
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
40289
- return false;
40290
- for (i = 0; i < keys.length; i++)
40291
- if (!objectIncludes(b[keys[i]], a[keys[i]]))
40292
- return false;
40293
- return true;
40294
- } else if (a && b && typeof a === "function" && typeof b === "function") {
40295
- return a.toString() === b.toString();
40296
- }
40297
- return false;
40273
+ function isNanValue(val) {
40274
+ return typeof val === "number" && isNaN(val);
40298
40275
  }
40299
-
40300
- // ../../node_modules/imask/esm/core/action-details.js
40301
- var ActionDetails = class {
40302
- /** Current input value */
40303
- /** Current cursor position */
40304
- /** Old input value */
40305
- /** Old selection */
40306
- constructor(opts) {
40307
- Object.assign(this, opts);
40308
- while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {
40309
- --this.oldSelection.start;
40276
+ function isNotValidValue(val) {
40277
+ return isNil(val) || isNanValue(val) || typeof val === "number" && !isFinite(val);
40278
+ }
40279
+ function escapeRegExp(str) {
40280
+ return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
40281
+ }
40282
+ function getThousandsGroupRegex(thousandsGroupStyle) {
40283
+ switch (thousandsGroupStyle) {
40284
+ case "lakh":
40285
+ return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
40286
+ case "wan":
40287
+ return /(\d)(?=(\d{4})+(?!\d))/g;
40288
+ case "thousand":
40289
+ default:
40290
+ return /(\d)(?=(\d{3})+(?!\d))/g;
40291
+ }
40292
+ }
40293
+ function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
40294
+ var thousandsGroupRegex = getThousandsGroupRegex(thousandsGroupStyle);
40295
+ var index = str.search(/[1-9]/);
40296
+ index = index === -1 ? str.length : index;
40297
+ return str.substring(0, index) + str.substring(index, str.length).replace(thousandsGroupRegex, "$1" + thousandSeparator);
40298
+ }
40299
+ function usePersistentCallback(cb) {
40300
+ var callbackRef = useRef43(cb);
40301
+ callbackRef.current = cb;
40302
+ var persistentCbRef = useRef43(function() {
40303
+ var args = [], len = arguments.length;
40304
+ while (len--)
40305
+ args[len] = arguments[len];
40306
+ return callbackRef.current.apply(callbackRef, args);
40307
+ });
40308
+ return persistentCbRef.current;
40309
+ }
40310
+ function splitDecimal(numStr, allowNegative) {
40311
+ if (allowNegative === void 0)
40312
+ allowNegative = true;
40313
+ var hasNegation = numStr[0] === "-";
40314
+ var addNegation = hasNegation && allowNegative;
40315
+ numStr = numStr.replace("-", "");
40316
+ var parts = numStr.split(".");
40317
+ var beforeDecimal = parts[0];
40318
+ var afterDecimal = parts[1] || "";
40319
+ return {
40320
+ beforeDecimal,
40321
+ afterDecimal,
40322
+ hasNegation,
40323
+ addNegation
40324
+ };
40325
+ }
40326
+ function fixLeadingZero(numStr) {
40327
+ if (!numStr) {
40328
+ return numStr;
40329
+ }
40330
+ var isNegative = numStr[0] === "-";
40331
+ if (isNegative) {
40332
+ numStr = numStr.substring(1, numStr.length);
40333
+ }
40334
+ var parts = numStr.split(".");
40335
+ var beforeDecimal = parts[0].replace(/^0+/, "") || "0";
40336
+ var afterDecimal = parts[1] || "";
40337
+ return (isNegative ? "-" : "") + beforeDecimal + (afterDecimal ? "." + afterDecimal : "");
40338
+ }
40339
+ function limitToScale(numStr, scale, fixedDecimalScale) {
40340
+ var str = "";
40341
+ var filler = fixedDecimalScale ? "0" : "";
40342
+ for (var i = 0; i <= scale - 1; i++) {
40343
+ str += numStr[i] || filler;
40344
+ }
40345
+ return str;
40346
+ }
40347
+ function repeat(str, count) {
40348
+ return Array(count + 1).join(str);
40349
+ }
40350
+ function toNumericString(num) {
40351
+ var _num = num + "";
40352
+ var sign = _num[0] === "-" ? "-" : "";
40353
+ if (sign) {
40354
+ _num = _num.substring(1);
40355
+ }
40356
+ var ref = _num.split(/[eE]/g);
40357
+ var coefficient = ref[0];
40358
+ var exponent = ref[1];
40359
+ exponent = Number(exponent);
40360
+ if (!exponent) {
40361
+ return sign + coefficient;
40362
+ }
40363
+ coefficient = coefficient.replace(".", "");
40364
+ var decimalIndex = 1 + exponent;
40365
+ var coffiecientLn = coefficient.length;
40366
+ if (decimalIndex < 0) {
40367
+ coefficient = "0." + repeat("0", Math.abs(decimalIndex)) + coefficient;
40368
+ } else if (decimalIndex >= coffiecientLn) {
40369
+ coefficient = coefficient + repeat("0", decimalIndex - coffiecientLn);
40370
+ } else {
40371
+ coefficient = (coefficient.substring(0, decimalIndex) || "0") + "." + coefficient.substring(decimalIndex);
40372
+ }
40373
+ return sign + coefficient;
40374
+ }
40375
+ function roundToPrecision(numStr, scale, fixedDecimalScale) {
40376
+ if (["", "-"].indexOf(numStr) !== -1) {
40377
+ return numStr;
40378
+ }
40379
+ var shouldHaveDecimalSeparator = (numStr.indexOf(".") !== -1 || fixedDecimalScale) && scale;
40380
+ var ref = splitDecimal(numStr);
40381
+ var beforeDecimal = ref.beforeDecimal;
40382
+ var afterDecimal = ref.afterDecimal;
40383
+ var hasNegation = ref.hasNegation;
40384
+ var floatValue = parseFloat("0." + (afterDecimal || "0"));
40385
+ var floatValueStr = afterDecimal.length <= scale ? "0." + afterDecimal : floatValue.toFixed(scale);
40386
+ var roundedDecimalParts = floatValueStr.split(".");
40387
+ var intPart = beforeDecimal;
40388
+ if (beforeDecimal && Number(roundedDecimalParts[0])) {
40389
+ intPart = beforeDecimal.split("").reverse().reduce(function(roundedStr, current, idx) {
40390
+ if (roundedStr.length > idx) {
40391
+ return (Number(roundedStr[0]) + Number(current)).toString() + roundedStr.substring(1, roundedStr.length);
40392
+ }
40393
+ return current + roundedStr;
40394
+ }, roundedDecimalParts[0]);
40395
+ }
40396
+ var decimalPart = limitToScale(roundedDecimalParts[1] || "", scale, fixedDecimalScale);
40397
+ var negation = hasNegation ? "-" : "";
40398
+ var decimalSeparator = shouldHaveDecimalSeparator ? "." : "";
40399
+ return "" + negation + intPart + decimalSeparator + decimalPart;
40400
+ }
40401
+ function setCaretPosition(el, caretPos) {
40402
+ el.value = el.value;
40403
+ if (el !== null) {
40404
+ if (el.createTextRange) {
40405
+ var range = el.createTextRange();
40406
+ range.move("character", caretPos);
40407
+ range.select();
40408
+ return true;
40310
40409
  }
40311
- if (this.insertedCount) {
40312
- while (this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end)) {
40313
- if (this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end)
40314
- ++this.oldSelection.end;
40315
- else
40316
- ++this.cursorPos;
40317
- }
40410
+ if (el.selectionStart || el.selectionStart === 0) {
40411
+ el.focus();
40412
+ el.setSelectionRange(caretPos, caretPos);
40413
+ return true;
40318
40414
  }
40415
+ el.focus();
40416
+ return false;
40319
40417
  }
40320
- /** Start changing position */
40321
- get startChangePos() {
40322
- return Math.min(this.cursorPos, this.oldSelection.start);
40418
+ }
40419
+ var findChangeRange = memoizeOnce(function(prevValue, newValue) {
40420
+ var i = 0, j = 0;
40421
+ var prevLength = prevValue.length;
40422
+ var newLength = newValue.length;
40423
+ while (prevValue[i] === newValue[i] && i < prevLength) {
40424
+ i++;
40323
40425
  }
40324
- /** Inserted symbols count */
40325
- get insertedCount() {
40326
- return this.cursorPos - this.startChangePos;
40426
+ while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] && newLength - j > i && prevLength - j > i) {
40427
+ j++;
40327
40428
  }
40328
- /** Inserted symbols */
40329
- get inserted() {
40330
- return this.value.substr(this.startChangePos, this.insertedCount);
40429
+ return {
40430
+ from: { start: i, end: prevLength - j },
40431
+ to: { start: i, end: newLength - j }
40432
+ };
40433
+ });
40434
+ function clamp2(num, min2, max2) {
40435
+ return Math.min(Math.max(num, min2), max2);
40436
+ }
40437
+ function geInputCaretPosition(el) {
40438
+ return Math.max(el.selectionStart, el.selectionEnd);
40439
+ }
40440
+ function addInputMode() {
40441
+ return typeof navigator !== "undefined" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
40442
+ }
40443
+ function getDefaultChangeMeta(value) {
40444
+ return {
40445
+ from: {
40446
+ start: 0,
40447
+ end: 0
40448
+ },
40449
+ to: {
40450
+ start: 0,
40451
+ end: value.length
40452
+ },
40453
+ lastValue: ""
40454
+ };
40455
+ }
40456
+ function defaultIsCharacterSame(ref) {
40457
+ var currentValue = ref.currentValue;
40458
+ var formattedValue = ref.formattedValue;
40459
+ var currentValueIndex = ref.currentValueIndex;
40460
+ var formattedValueIndex = ref.formattedValueIndex;
40461
+ return currentValue[currentValueIndex] === formattedValue[formattedValueIndex];
40462
+ }
40463
+ function getCaretPosition(newFormattedValue, lastFormattedValue, curValue, curCaretPos, boundary, isValidInputCharacter, isCharacterSame) {
40464
+ if (isCharacterSame === void 0)
40465
+ isCharacterSame = defaultIsCharacterSame;
40466
+ var firstAllowedPosition = boundary.findIndex(function(b) {
40467
+ return b;
40468
+ });
40469
+ var prefixFormat = newFormattedValue.slice(0, firstAllowedPosition);
40470
+ if (!lastFormattedValue && !curValue.startsWith(prefixFormat)) {
40471
+ lastFormattedValue = prefixFormat;
40472
+ curValue = prefixFormat + curValue;
40473
+ curCaretPos = curCaretPos + prefixFormat.length;
40474
+ }
40475
+ var curValLn = curValue.length;
40476
+ var formattedValueLn = newFormattedValue.length;
40477
+ var addedIndexMap = {};
40478
+ var indexMap = new Array(curValLn);
40479
+ for (var i = 0; i < curValLn; i++) {
40480
+ indexMap[i] = -1;
40481
+ for (var j = 0, jLn = formattedValueLn; j < jLn; j++) {
40482
+ var isCharSame = isCharacterSame({
40483
+ currentValue: curValue,
40484
+ lastValue: lastFormattedValue,
40485
+ formattedValue: newFormattedValue,
40486
+ currentValueIndex: i,
40487
+ formattedValueIndex: j
40488
+ });
40489
+ if (isCharSame && addedIndexMap[j] !== true) {
40490
+ indexMap[i] = j;
40491
+ addedIndexMap[j] = true;
40492
+ break;
40493
+ }
40494
+ }
40331
40495
  }
40332
- /** Removed symbols count */
40333
- get removedCount() {
40334
- return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
40335
- this.oldValue.length - this.value.length, 0);
40496
+ var pos = curCaretPos;
40497
+ while (pos < curValLn && (indexMap[pos] === -1 || !isValidInputCharacter(curValue[pos]))) {
40498
+ pos++;
40336
40499
  }
40337
- /** Removed symbols */
40338
- get removed() {
40339
- return this.oldValue.substr(this.startChangePos, this.removedCount);
40500
+ var endIndex = pos === curValLn || indexMap[pos] === -1 ? formattedValueLn : indexMap[pos];
40501
+ pos = curCaretPos - 1;
40502
+ while (pos > 0 && indexMap[pos] === -1) {
40503
+ pos--;
40340
40504
  }
40341
- /** Unchanged head symbols */
40342
- get head() {
40343
- return this.value.substring(0, this.startChangePos);
40505
+ var startIndex = pos === -1 || indexMap[pos] === -1 ? 0 : indexMap[pos] + 1;
40506
+ if (startIndex > endIndex) {
40507
+ return endIndex;
40344
40508
  }
40345
- /** Unchanged tail symbols */
40346
- get tail() {
40347
- return this.value.substring(this.startChangePos + this.insertedCount);
40509
+ return curCaretPos - startIndex < endIndex - curCaretPos ? startIndex : endIndex;
40510
+ }
40511
+ function getCaretPosInBoundary(value, caretPos, boundary, direction) {
40512
+ var valLn = value.length;
40513
+ caretPos = clamp2(caretPos, 0, valLn);
40514
+ if (direction === "left") {
40515
+ while (caretPos >= 0 && !boundary[caretPos]) {
40516
+ caretPos--;
40517
+ }
40518
+ if (caretPos === -1) {
40519
+ caretPos = boundary.indexOf(true);
40520
+ }
40521
+ } else {
40522
+ while (caretPos <= valLn && !boundary[caretPos]) {
40523
+ caretPos++;
40524
+ }
40525
+ if (caretPos > valLn) {
40526
+ caretPos = boundary.lastIndexOf(true);
40527
+ }
40348
40528
  }
40349
- /** Remove direction */
40350
- get removeDirection() {
40351
- if (!this.removedCount || this.insertedCount)
40352
- return DIRECTION.NONE;
40353
- return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
40354
- this.oldSelection.end === this.oldSelection.start ? DIRECTION.RIGHT : DIRECTION.LEFT;
40529
+ if (caretPos === -1) {
40530
+ caretPos = valLn;
40355
40531
  }
40356
- };
40357
-
40358
- // ../../node_modules/imask/esm/core/holder.js
40359
- function IMask(el, opts) {
40360
- return new IMask.InputMask(el, opts);
40361
- }
40362
-
40363
- // ../../node_modules/imask/esm/masked/factory.js
40364
- function maskedClass(mask) {
40365
- if (mask == null)
40366
- throw new Error("mask property should be defined");
40367
- if (mask instanceof RegExp)
40368
- return IMask.MaskedRegExp;
40369
- if (isString(mask))
40370
- return IMask.MaskedPattern;
40371
- if (mask === Date)
40372
- return IMask.MaskedDate;
40373
- if (mask === Number)
40374
- return IMask.MaskedNumber;
40375
- if (Array.isArray(mask) || mask === Array)
40376
- return IMask.MaskedDynamic;
40377
- if (IMask.Masked && mask.prototype instanceof IMask.Masked)
40378
- return mask;
40379
- if (IMask.Masked && mask instanceof IMask.Masked)
40380
- return mask.constructor;
40381
- if (mask instanceof Function)
40382
- return IMask.MaskedFunction;
40383
- console.warn("Mask not found for mask", mask);
40384
- return IMask.Masked;
40532
+ return caretPos;
40385
40533
  }
40386
- function normalizeOpts(opts) {
40387
- if (!opts)
40388
- throw new Error("Options in not defined");
40389
- if (IMask.Masked) {
40390
- if (opts.prototype instanceof IMask.Masked)
40391
- return {
40392
- mask: opts
40393
- };
40394
- const _a2 = opts instanceof IMask.Masked ? {
40395
- mask: opts
40396
- } : isObject(opts) && opts.mask instanceof IMask.Masked ? opts : {}, {
40397
- mask = void 0
40398
- } = _a2, instanceOpts = __objRest(_a2, [
40399
- "mask"
40400
- ]);
40401
- if (mask) {
40402
- const _mask = mask.mask;
40403
- return __spreadValues(__spreadProps(__spreadValues({}, pick(mask, (_4, k) => !k.startsWith("_"))), {
40404
- mask: mask.constructor,
40405
- _mask
40406
- }), instanceOpts);
40534
+ function caretUnknownFormatBoundary(formattedValue) {
40535
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function() {
40536
+ return true;
40537
+ });
40538
+ for (var i = 0, ln = boundaryAry.length; i < ln; i++) {
40539
+ boundaryAry[i] = Boolean(charIsNumber(formattedValue[i]) || charIsNumber(formattedValue[i - 1]));
40540
+ }
40541
+ return boundaryAry;
40542
+ }
40543
+ function useInternalValues(value, defaultValue, valueIsNumericString, format2, removeFormatting2, onValueChange) {
40544
+ if (onValueChange === void 0)
40545
+ onValueChange = noop;
40546
+ var getValues = usePersistentCallback(function(value2, valueIsNumericString2) {
40547
+ var formattedValue, numAsString;
40548
+ if (isNotValidValue(value2)) {
40549
+ numAsString = "";
40550
+ formattedValue = "";
40551
+ } else if (typeof value2 === "number" || valueIsNumericString2) {
40552
+ numAsString = typeof value2 === "number" ? toNumericString(value2) : value2;
40553
+ formattedValue = format2(numAsString);
40554
+ } else {
40555
+ numAsString = removeFormatting2(value2, void 0);
40556
+ formattedValue = format2(numAsString);
40557
+ }
40558
+ return { formattedValue, numAsString };
40559
+ });
40560
+ var ref = useState25(function() {
40561
+ return getValues(isNil(value) ? defaultValue : value, valueIsNumericString);
40562
+ });
40563
+ var values2 = ref[0];
40564
+ var setValues = ref[1];
40565
+ var _onValueChange = function(newValues2, sourceInfo) {
40566
+ if (newValues2.formattedValue !== values2.formattedValue) {
40567
+ setValues({
40568
+ formattedValue: newValues2.formattedValue,
40569
+ numAsString: newValues2.value
40570
+ });
40407
40571
  }
40572
+ onValueChange(newValues2, sourceInfo);
40573
+ };
40574
+ var _value = value;
40575
+ var _valueIsNumericString = valueIsNumericString;
40576
+ if (isNil(value)) {
40577
+ _value = values2.numAsString;
40578
+ _valueIsNumericString = true;
40408
40579
  }
40409
- if (!isObject(opts))
40410
- return {
40411
- mask: opts
40412
- };
40413
- return __spreadValues({}, opts);
40580
+ var newValues = getValues(_value, _valueIsNumericString);
40581
+ useMemo35(function() {
40582
+ setValues(newValues);
40583
+ }, [newValues.formattedValue]);
40584
+ return [values2, _onValueChange];
40414
40585
  }
40415
- function createMask(opts) {
40416
- if (IMask.Masked && opts instanceof IMask.Masked)
40417
- return opts;
40418
- const nOpts = normalizeOpts(opts);
40419
- const MaskedClass = maskedClass(nOpts.mask);
40420
- if (!MaskedClass)
40421
- throw new Error("Masked class is not found for provided mask " + nOpts.mask + ", appropriate module needs to be imported manually before creating mask.");
40422
- if (nOpts.mask === MaskedClass)
40423
- delete nOpts.mask;
40424
- if (nOpts._mask) {
40425
- nOpts.mask = nOpts._mask;
40426
- delete nOpts._mask;
40427
- }
40428
- return new MaskedClass(nOpts);
40586
+ function defaultRemoveFormatting(value) {
40587
+ return value.replace(/[^0-9]/g, "");
40429
40588
  }
40430
- IMask.createMask = createMask;
40431
-
40432
- // ../../node_modules/imask/esm/controls/mask-element.js
40433
- var MaskElement = class {
40434
- /** */
40435
- /** */
40436
- /** */
40437
- /** Safely returns selection start */
40438
- get selectionStart() {
40439
- let start2;
40440
- try {
40441
- start2 = this._unsafeSelectionStart;
40442
- } catch (e) {
40589
+ function defaultFormat(value) {
40590
+ return value;
40591
+ }
40592
+ function NumberFormatBase(props) {
40593
+ var type = props.type;
40594
+ if (type === void 0)
40595
+ type = "text";
40596
+ var displayType = props.displayType;
40597
+ if (displayType === void 0)
40598
+ displayType = "input";
40599
+ var customInput = props.customInput;
40600
+ var renderText = props.renderText;
40601
+ var getInputRef = props.getInputRef;
40602
+ var format2 = props.format;
40603
+ if (format2 === void 0)
40604
+ format2 = defaultFormat;
40605
+ var removeFormatting2 = props.removeFormatting;
40606
+ if (removeFormatting2 === void 0)
40607
+ removeFormatting2 = defaultRemoveFormatting;
40608
+ var defaultValue = props.defaultValue;
40609
+ var valueIsNumericString = props.valueIsNumericString;
40610
+ var onValueChange = props.onValueChange;
40611
+ var isAllowed = props.isAllowed;
40612
+ var onChange = props.onChange;
40613
+ if (onChange === void 0)
40614
+ onChange = noop;
40615
+ var onKeyDown = props.onKeyDown;
40616
+ if (onKeyDown === void 0)
40617
+ onKeyDown = noop;
40618
+ var onMouseUp = props.onMouseUp;
40619
+ if (onMouseUp === void 0)
40620
+ onMouseUp = noop;
40621
+ var onFocus = props.onFocus;
40622
+ if (onFocus === void 0)
40623
+ onFocus = noop;
40624
+ var onBlur = props.onBlur;
40625
+ if (onBlur === void 0)
40626
+ onBlur = noop;
40627
+ var propValue = props.value;
40628
+ var getCaretBoundary2 = props.getCaretBoundary;
40629
+ if (getCaretBoundary2 === void 0)
40630
+ getCaretBoundary2 = caretUnknownFormatBoundary;
40631
+ var isValidInputCharacter = props.isValidInputCharacter;
40632
+ if (isValidInputCharacter === void 0)
40633
+ isValidInputCharacter = charIsNumber;
40634
+ var isCharacterSame = props.isCharacterSame;
40635
+ var otherProps = __rest2(props, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]);
40636
+ var ref = useInternalValues(propValue, defaultValue, Boolean(valueIsNumericString), format2, removeFormatting2, onValueChange);
40637
+ var ref_0 = ref[0];
40638
+ var formattedValue = ref_0.formattedValue;
40639
+ var numAsString = ref_0.numAsString;
40640
+ var onFormattedValueChange = ref[1];
40641
+ var lastUpdatedValue = useRef43({ formattedValue, numAsString });
40642
+ var _onValueChange = function(values2, source) {
40643
+ lastUpdatedValue.current = { formattedValue: values2.formattedValue, numAsString: values2.value };
40644
+ onFormattedValueChange(values2, source);
40645
+ };
40646
+ var ref$1 = useState25(false);
40647
+ var mounted = ref$1[0];
40648
+ var setMounted = ref$1[1];
40649
+ var focusedElm = useRef43(null);
40650
+ var timeout = useRef43({
40651
+ setCaretTimeout: null,
40652
+ focusTimeout: null
40653
+ });
40654
+ useEffect36(function() {
40655
+ setMounted(true);
40656
+ return function() {
40657
+ clearTimeout(timeout.current.setCaretTimeout);
40658
+ clearTimeout(timeout.current.focusTimeout);
40659
+ };
40660
+ }, []);
40661
+ var _format = format2;
40662
+ var getValueObject = function(formattedValue2, numAsString2) {
40663
+ var floatValue = parseFloat(numAsString2);
40664
+ return {
40665
+ formattedValue: formattedValue2,
40666
+ value: numAsString2,
40667
+ floatValue: isNaN(floatValue) ? void 0 : floatValue
40668
+ };
40669
+ };
40670
+ var setPatchedCaretPosition = function(el, caretPos, currentValue) {
40671
+ if (el.selectionStart === 0 && el.selectionEnd === el.value.length) {
40672
+ return;
40443
40673
  }
40444
- return start2 != null ? start2 : this.value.length;
40445
- }
40446
- /** Safely returns selection end */
40447
- get selectionEnd() {
40448
- let end2;
40449
- try {
40450
- end2 = this._unsafeSelectionEnd;
40451
- } catch (e) {
40674
+ setCaretPosition(el, caretPos);
40675
+ timeout.current.setCaretTimeout = setTimeout(function() {
40676
+ if (el.value === currentValue && el.selectionStart !== caretPos) {
40677
+ setCaretPosition(el, caretPos);
40678
+ }
40679
+ }, 0);
40680
+ };
40681
+ var correctCaretPosition = function(value, caretPos, direction) {
40682
+ return getCaretPosInBoundary(value, caretPos, getCaretBoundary2(value), direction);
40683
+ };
40684
+ var getNewCaretPosition = function(inputValue, newFormattedValue, caretPos) {
40685
+ var caretBoundary = getCaretBoundary2(newFormattedValue);
40686
+ var updatedCaretPos = getCaretPosition(newFormattedValue, formattedValue, inputValue, caretPos, caretBoundary, isValidInputCharacter, isCharacterSame);
40687
+ updatedCaretPos = getCaretPosInBoundary(newFormattedValue, updatedCaretPos, caretBoundary);
40688
+ return updatedCaretPos;
40689
+ };
40690
+ var updateValueAndCaretPosition = function(params) {
40691
+ var newFormattedValue = params.formattedValue;
40692
+ if (newFormattedValue === void 0)
40693
+ newFormattedValue = "";
40694
+ var input = params.input;
40695
+ var source = params.source;
40696
+ var event = params.event;
40697
+ var numAsString2 = params.numAsString;
40698
+ var caretPos;
40699
+ if (input) {
40700
+ var inputValue = params.inputValue || input.value;
40701
+ var currentCaretPosition2 = geInputCaretPosition(input);
40702
+ input.value = newFormattedValue;
40703
+ caretPos = getNewCaretPosition(inputValue, newFormattedValue, currentCaretPosition2);
40704
+ if (caretPos !== void 0) {
40705
+ setPatchedCaretPosition(input, caretPos, newFormattedValue);
40706
+ }
40707
+ }
40708
+ if (newFormattedValue !== formattedValue) {
40709
+ _onValueChange(getValueObject(newFormattedValue, numAsString2), { event, source });
40710
+ }
40711
+ };
40712
+ useEffect36(function() {
40713
+ var ref2 = lastUpdatedValue.current;
40714
+ var lastFormattedValue = ref2.formattedValue;
40715
+ var lastNumAsString = ref2.numAsString;
40716
+ if (formattedValue !== lastFormattedValue && (formattedValue !== numAsString || lastFormattedValue !== lastNumAsString)) {
40717
+ _onValueChange(getValueObject(formattedValue, numAsString), {
40718
+ event: void 0,
40719
+ source: SourceType.props
40720
+ });
40452
40721
  }
40453
- return end2 != null ? end2 : this.value.length;
40454
- }
40455
- /** Safely sets element selection */
40456
- select(start2, end2) {
40457
- if (start2 == null || end2 == null || start2 === this.selectionStart && end2 === this.selectionEnd)
40722
+ }, [formattedValue, numAsString]);
40723
+ var currentCaretPosition = focusedElm.current ? geInputCaretPosition(focusedElm.current) : void 0;
40724
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect3 : useEffect36;
40725
+ useIsomorphicLayoutEffect(function() {
40726
+ var input = focusedElm.current;
40727
+ if (formattedValue !== lastUpdatedValue.current.formattedValue && input) {
40728
+ var caretPos = getNewCaretPosition(lastUpdatedValue.current.formattedValue, formattedValue, currentCaretPosition);
40729
+ input.value = formattedValue;
40730
+ setPatchedCaretPosition(input, caretPos, formattedValue);
40731
+ }
40732
+ }, [formattedValue]);
40733
+ var formatInputValue = function(inputValue, event, source) {
40734
+ var changeRange = findChangeRange(formattedValue, inputValue);
40735
+ var changeMeta = Object.assign(Object.assign({}, changeRange), { lastValue: formattedValue });
40736
+ var _numAsString = removeFormatting2(inputValue, changeMeta);
40737
+ var _formattedValue = _format(_numAsString);
40738
+ _numAsString = removeFormatting2(_formattedValue, void 0);
40739
+ if (isAllowed && !isAllowed(getValueObject(_formattedValue, _numAsString))) {
40740
+ var input = event.target;
40741
+ var currentCaretPosition2 = geInputCaretPosition(input);
40742
+ var caretPos = getNewCaretPosition(inputValue, formattedValue, currentCaretPosition2);
40743
+ input.value = formattedValue;
40744
+ setPatchedCaretPosition(input, caretPos, formattedValue);
40745
+ return false;
40746
+ }
40747
+ updateValueAndCaretPosition({
40748
+ formattedValue: _formattedValue,
40749
+ numAsString: _numAsString,
40750
+ inputValue,
40751
+ event,
40752
+ source,
40753
+ input: event.target
40754
+ });
40755
+ return true;
40756
+ };
40757
+ var _onChange = function(e) {
40758
+ var el = e.target;
40759
+ var inputValue = el.value;
40760
+ var changed = formatInputValue(inputValue, e, SourceType.event);
40761
+ if (changed) {
40762
+ onChange(e);
40763
+ }
40764
+ };
40765
+ var _onKeyDown = function(e) {
40766
+ var el = e.target;
40767
+ var key = e.key;
40768
+ var selectionStart = el.selectionStart;
40769
+ var selectionEnd = el.selectionEnd;
40770
+ var value = el.value;
40771
+ if (value === void 0)
40772
+ value = "";
40773
+ var expectedCaretPosition;
40774
+ if (key === "ArrowLeft" || key === "Backspace") {
40775
+ expectedCaretPosition = Math.max(selectionStart - 1, 0);
40776
+ } else if (key === "ArrowRight") {
40777
+ expectedCaretPosition = Math.min(selectionStart + 1, value.length);
40778
+ } else if (key === "Delete") {
40779
+ expectedCaretPosition = selectionStart;
40780
+ }
40781
+ if (expectedCaretPosition === void 0 || selectionStart !== selectionEnd) {
40782
+ onKeyDown(e);
40458
40783
  return;
40459
- try {
40460
- this._unsafeSelect(start2, end2);
40461
- } catch (e) {
40462
40784
  }
40785
+ var newCaretPosition = expectedCaretPosition;
40786
+ if (key === "ArrowLeft" || key === "ArrowRight") {
40787
+ var direction = key === "ArrowLeft" ? "left" : "right";
40788
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, direction);
40789
+ if (newCaretPosition !== expectedCaretPosition) {
40790
+ e.preventDefault();
40791
+ }
40792
+ } else if (key === "Delete" && !isValidInputCharacter(value[expectedCaretPosition])) {
40793
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, "right");
40794
+ } else if (key === "Backspace" && !isValidInputCharacter(value[expectedCaretPosition])) {
40795
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, "left");
40796
+ }
40797
+ if (newCaretPosition !== expectedCaretPosition) {
40798
+ setPatchedCaretPosition(el, newCaretPosition, value);
40799
+ }
40800
+ if (e.isUnitTestRun) {
40801
+ setPatchedCaretPosition(el, newCaretPosition, value);
40802
+ }
40803
+ onKeyDown(e);
40804
+ };
40805
+ var _onMouseUp = function(e) {
40806
+ var el = e.target;
40807
+ var correctCaretPositionIfRequired = function() {
40808
+ var selectionStart = el.selectionStart;
40809
+ var selectionEnd = el.selectionEnd;
40810
+ var value = el.value;
40811
+ if (value === void 0)
40812
+ value = "";
40813
+ if (selectionStart === selectionEnd) {
40814
+ var caretPosition = correctCaretPosition(value, selectionStart);
40815
+ if (caretPosition !== selectionStart) {
40816
+ setPatchedCaretPosition(el, caretPosition, value);
40817
+ }
40818
+ }
40819
+ };
40820
+ correctCaretPositionIfRequired();
40821
+ requestAnimationFrame(function() {
40822
+ correctCaretPositionIfRequired();
40823
+ });
40824
+ onMouseUp(e);
40825
+ };
40826
+ var _onFocus = function(e) {
40827
+ if (e.persist) {
40828
+ e.persist();
40829
+ }
40830
+ var el = e.target;
40831
+ var currentTarget = e.currentTarget;
40832
+ focusedElm.current = el;
40833
+ timeout.current.focusTimeout = setTimeout(function() {
40834
+ var selectionStart = el.selectionStart;
40835
+ var selectionEnd = el.selectionEnd;
40836
+ var value = el.value;
40837
+ if (value === void 0)
40838
+ value = "";
40839
+ var caretPosition = correctCaretPosition(value, selectionStart);
40840
+ if (caretPosition !== selectionStart && !(selectionStart === 0 && selectionEnd === value.length)) {
40841
+ setPatchedCaretPosition(el, caretPosition, value);
40842
+ }
40843
+ onFocus(Object.assign(Object.assign({}, e), { currentTarget }));
40844
+ }, 0);
40845
+ };
40846
+ var _onBlur = function(e) {
40847
+ focusedElm.current = null;
40848
+ clearTimeout(timeout.current.focusTimeout);
40849
+ clearTimeout(timeout.current.setCaretTimeout);
40850
+ onBlur(e);
40851
+ };
40852
+ var inputMode = mounted && addInputMode() ? "numeric" : void 0;
40853
+ var inputProps = Object.assign({ inputMode }, otherProps, {
40854
+ type,
40855
+ value: formattedValue,
40856
+ onChange: _onChange,
40857
+ onKeyDown: _onKeyDown,
40858
+ onMouseUp: _onMouseUp,
40859
+ onFocus: _onFocus,
40860
+ onBlur: _onBlur
40861
+ });
40862
+ if (displayType === "text") {
40863
+ return renderText ? React177.createElement(React177.Fragment, null, renderText(formattedValue, otherProps) || null) : React177.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue);
40864
+ } else if (customInput) {
40865
+ var CustomInput = customInput;
40866
+ return React177.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
40867
+ }
40868
+ return React177.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
40869
+ }
40870
+ function format(numStr, props) {
40871
+ var decimalScale = props.decimalScale;
40872
+ var fixedDecimalScale = props.fixedDecimalScale;
40873
+ var prefix2 = props.prefix;
40874
+ if (prefix2 === void 0)
40875
+ prefix2 = "";
40876
+ var suffix = props.suffix;
40877
+ if (suffix === void 0)
40878
+ suffix = "";
40879
+ var allowNegative = props.allowNegative;
40880
+ var thousandsGroupStyle = props.thousandsGroupStyle;
40881
+ if (thousandsGroupStyle === void 0)
40882
+ thousandsGroupStyle = "thousand";
40883
+ if (numStr === "" || numStr === "-") {
40884
+ return numStr;
40885
+ }
40886
+ var ref = getSeparators(props);
40887
+ var thousandSeparator = ref.thousandSeparator;
40888
+ var decimalSeparator = ref.decimalSeparator;
40889
+ var hasDecimalSeparator = decimalScale !== 0 && numStr.indexOf(".") !== -1 || decimalScale && fixedDecimalScale;
40890
+ var ref$1 = splitDecimal(numStr, allowNegative);
40891
+ var beforeDecimal = ref$1.beforeDecimal;
40892
+ var afterDecimal = ref$1.afterDecimal;
40893
+ var addNegation = ref$1.addNegation;
40894
+ if (decimalScale !== void 0) {
40895
+ afterDecimal = limitToScale(afterDecimal, decimalScale, !!fixedDecimalScale);
40896
+ }
40897
+ if (thousandSeparator) {
40898
+ beforeDecimal = applyThousandSeparator(beforeDecimal, thousandSeparator, thousandsGroupStyle);
40899
+ }
40900
+ if (prefix2) {
40901
+ beforeDecimal = prefix2 + beforeDecimal;
40902
+ }
40903
+ if (suffix) {
40904
+ afterDecimal = afterDecimal + suffix;
40905
+ }
40906
+ if (addNegation) {
40907
+ beforeDecimal = "-" + beforeDecimal;
40908
+ }
40909
+ numStr = beforeDecimal + (hasDecimalSeparator && decimalSeparator || "") + afterDecimal;
40910
+ return numStr;
40911
+ }
40912
+ function getSeparators(props) {
40913
+ var decimalSeparator = props.decimalSeparator;
40914
+ if (decimalSeparator === void 0)
40915
+ decimalSeparator = ".";
40916
+ var thousandSeparator = props.thousandSeparator;
40917
+ var allowedDecimalSeparators = props.allowedDecimalSeparators;
40918
+ if (thousandSeparator === true) {
40919
+ thousandSeparator = ",";
40920
+ }
40921
+ if (!allowedDecimalSeparators) {
40922
+ allowedDecimalSeparators = [decimalSeparator, "."];
40463
40923
  }
40464
- /** */
40465
- get isActive() {
40466
- return false;
40467
- }
40468
- /** */
40469
- /** */
40470
- /** */
40471
- };
40472
- IMask.MaskElement = MaskElement;
40473
-
40474
- // ../../node_modules/imask/esm/controls/html-mask-element.js
40475
- var KEY_Z = 90;
40476
- var KEY_Y = 89;
40477
- var HTMLMaskElement = class extends MaskElement {
40478
- /** HTMLElement to use mask on */
40479
- constructor(input) {
40480
- super();
40481
- this.input = input;
40482
- this._onKeydown = this._onKeydown.bind(this);
40483
- this._onInput = this._onInput.bind(this);
40484
- this._onBeforeinput = this._onBeforeinput.bind(this);
40485
- this._onCompositionEnd = this._onCompositionEnd.bind(this);
40924
+ return {
40925
+ decimalSeparator,
40926
+ thousandSeparator,
40927
+ allowedDecimalSeparators
40928
+ };
40929
+ }
40930
+ function handleNegation(value, allowNegative) {
40931
+ if (value === void 0)
40932
+ value = "";
40933
+ var negationRegex = new RegExp("(-)");
40934
+ var doubleNegationRegex = new RegExp("(-)(.)*(-)");
40935
+ var hasNegation = negationRegex.test(value);
40936
+ var removeNegation = doubleNegationRegex.test(value);
40937
+ value = value.replace(/-/g, "");
40938
+ if (hasNegation && !removeNegation && allowNegative) {
40939
+ value = "-" + value;
40486
40940
  }
40487
- get rootElement() {
40488
- var _this$input$getRootNo, _this$input$getRootNo2, _this$input;
40489
- return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) == null ? void 0 : _this$input$getRootNo2.call(_this$input)) != null ? _this$input$getRootNo : document;
40941
+ return value;
40942
+ }
40943
+ function getNumberRegex(decimalSeparator, global2) {
40944
+ return new RegExp("(^-)|[0-9]|" + escapeRegExp(decimalSeparator), global2 ? "g" : void 0);
40945
+ }
40946
+ function isNumericString(val, prefix2, suffix) {
40947
+ if (val === "") {
40948
+ return true;
40490
40949
  }
40491
- /** Is element in focus */
40492
- get isActive() {
40493
- return this.input === this.rootElement.activeElement;
40950
+ return !(prefix2 === null || prefix2 === void 0 ? void 0 : prefix2.match(/\d/)) && !(suffix === null || suffix === void 0 ? void 0 : suffix.match(/\d/)) && typeof val === "string" && !isNaN(Number(val));
40951
+ }
40952
+ function removeFormatting(value, changeMeta, props) {
40953
+ var assign2;
40954
+ if (changeMeta === void 0)
40955
+ changeMeta = getDefaultChangeMeta(value);
40956
+ var allowNegative = props.allowNegative;
40957
+ var prefix2 = props.prefix;
40958
+ if (prefix2 === void 0)
40959
+ prefix2 = "";
40960
+ var suffix = props.suffix;
40961
+ if (suffix === void 0)
40962
+ suffix = "";
40963
+ var decimalScale = props.decimalScale;
40964
+ var from2 = changeMeta.from;
40965
+ var to = changeMeta.to;
40966
+ var start2 = to.start;
40967
+ var end2 = to.end;
40968
+ var ref = getSeparators(props);
40969
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
40970
+ var decimalSeparator = ref.decimalSeparator;
40971
+ var isBeforeDecimalSeparator = value[end2] === decimalSeparator;
40972
+ if (charIsNumber(value) && (value === prefix2 || value === suffix) && changeMeta.lastValue === "") {
40973
+ return value;
40494
40974
  }
40495
- /** Binds HTMLElement events to mask internal events */
40496
- bindEvents(handlers) {
40497
- this.input.addEventListener("keydown", this._onKeydown);
40498
- this.input.addEventListener("input", this._onInput);
40499
- this.input.addEventListener("beforeinput", this._onBeforeinput);
40500
- this.input.addEventListener("compositionend", this._onCompositionEnd);
40501
- this.input.addEventListener("drop", handlers.drop);
40502
- this.input.addEventListener("click", handlers.click);
40503
- this.input.addEventListener("focus", handlers.focus);
40504
- this.input.addEventListener("blur", handlers.commit);
40505
- this._handlers = handlers;
40975
+ if (end2 - start2 === 1 && allowedDecimalSeparators.indexOf(value[start2]) !== -1) {
40976
+ var separator = decimalScale === 0 ? "" : decimalSeparator;
40977
+ value = value.substring(0, start2) + separator + value.substring(start2 + 1, value.length);
40978
+ }
40979
+ var stripNegation = function(value2, start3, end3) {
40980
+ var hasNegation2 = false;
40981
+ var hasDoubleNegation = false;
40982
+ if (prefix2.startsWith("-")) {
40983
+ hasNegation2 = false;
40984
+ } else if (value2.startsWith("--")) {
40985
+ hasNegation2 = false;
40986
+ hasDoubleNegation = true;
40987
+ } else if (suffix.startsWith("-") && value2.length === suffix.length) {
40988
+ hasNegation2 = false;
40989
+ } else if (value2[0] === "-") {
40990
+ hasNegation2 = true;
40991
+ }
40992
+ var charsToRemove = hasNegation2 ? 1 : 0;
40993
+ if (hasDoubleNegation) {
40994
+ charsToRemove = 2;
40995
+ }
40996
+ if (charsToRemove) {
40997
+ value2 = value2.substring(charsToRemove);
40998
+ start3 -= charsToRemove;
40999
+ end3 -= charsToRemove;
41000
+ }
41001
+ return { value: value2, start: start3, end: end3, hasNegation: hasNegation2 };
41002
+ };
41003
+ var toMetadata = stripNegation(value, start2, end2);
41004
+ var hasNegation = toMetadata.hasNegation;
41005
+ assign2 = toMetadata, value = assign2.value, start2 = assign2.start, end2 = assign2.end;
41006
+ var ref$1 = stripNegation(changeMeta.lastValue, from2.start, from2.end);
41007
+ var fromStart = ref$1.start;
41008
+ var fromEnd = ref$1.end;
41009
+ var lastValue = ref$1.value;
41010
+ var updatedSuffixPart = value.substring(start2, end2);
41011
+ if (value.length && lastValue.length && (fromStart > lastValue.length - suffix.length || fromEnd < prefix2.length) && !(updatedSuffixPart && suffix.startsWith(updatedSuffixPart))) {
41012
+ value = lastValue;
41013
+ }
41014
+ var startIndex = 0;
41015
+ if (value.startsWith(prefix2)) {
41016
+ startIndex += prefix2.length;
41017
+ } else if (start2 < prefix2.length) {
41018
+ startIndex = start2;
41019
+ }
41020
+ value = value.substring(startIndex);
41021
+ end2 -= startIndex;
41022
+ var endIndex = value.length;
41023
+ var suffixStartIndex = value.length - suffix.length;
41024
+ if (value.endsWith(suffix)) {
41025
+ endIndex = suffixStartIndex;
41026
+ } else if (end2 > suffixStartIndex) {
41027
+ endIndex = end2;
41028
+ } else if (end2 > value.length - suffix.length) {
41029
+ endIndex = end2;
41030
+ }
41031
+ value = value.substring(0, endIndex);
41032
+ value = handleNegation(hasNegation ? "-" + value : value, allowNegative);
41033
+ value = (value.match(getNumberRegex(decimalSeparator, true)) || []).join("");
41034
+ var firstIndex = value.indexOf(decimalSeparator);
41035
+ value = value.replace(new RegExp(escapeRegExp(decimalSeparator), "g"), function(match2, index) {
41036
+ return index === firstIndex ? "." : "";
41037
+ });
41038
+ var ref$2 = splitDecimal(value, allowNegative);
41039
+ var beforeDecimal = ref$2.beforeDecimal;
41040
+ var afterDecimal = ref$2.afterDecimal;
41041
+ var addNegation = ref$2.addNegation;
41042
+ if (to.end - to.start < from2.end - from2.start && beforeDecimal === "" && isBeforeDecimalSeparator && !parseFloat(afterDecimal)) {
41043
+ value = addNegation ? "-" : "";
40506
41044
  }
40507
- _onKeydown(e) {
40508
- if (this._handlers.redo && (e.keyCode === KEY_Z && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === KEY_Y && e.ctrlKey)) {
40509
- e.preventDefault();
40510
- return this._handlers.redo(e);
41045
+ return value;
41046
+ }
41047
+ function getCaretBoundary(formattedValue, props) {
41048
+ var prefix2 = props.prefix;
41049
+ if (prefix2 === void 0)
41050
+ prefix2 = "";
41051
+ var suffix = props.suffix;
41052
+ if (suffix === void 0)
41053
+ suffix = "";
41054
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function() {
41055
+ return true;
41056
+ });
41057
+ var hasNegation = formattedValue[0] === "-";
41058
+ boundaryAry.fill(false, 0, prefix2.length + (hasNegation ? 1 : 0));
41059
+ var valLn = formattedValue.length;
41060
+ boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
41061
+ return boundaryAry;
41062
+ }
41063
+ function validateAndUpdateProps(props) {
41064
+ var ref = getSeparators(props);
41065
+ var thousandSeparator = ref.thousandSeparator;
41066
+ var decimalSeparator = ref.decimalSeparator;
41067
+ var prefix2 = props.prefix;
41068
+ if (prefix2 === void 0)
41069
+ prefix2 = "";
41070
+ var allowNegative = props.allowNegative;
41071
+ if (allowNegative === void 0)
41072
+ allowNegative = true;
41073
+ if (thousandSeparator === decimalSeparator) {
41074
+ throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " + thousandSeparator + ' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ' + decimalSeparator + " (default value for decimalSeparator is .)\n ");
41075
+ }
41076
+ if (prefix2.startsWith("-") && allowNegative) {
41077
+ console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: " + prefix2 + "\n allowNegative: " + allowNegative + "\n ");
41078
+ allowNegative = false;
41079
+ }
41080
+ return Object.assign(Object.assign({}, props), { allowNegative });
41081
+ }
41082
+ function useNumericFormat(props) {
41083
+ props = validateAndUpdateProps(props);
41084
+ var _decimalSeparator = props.decimalSeparator;
41085
+ var _allowedDecimalSeparators = props.allowedDecimalSeparators;
41086
+ var thousandsGroupStyle = props.thousandsGroupStyle;
41087
+ var suffix = props.suffix;
41088
+ var allowNegative = props.allowNegative;
41089
+ var allowLeadingZeros = props.allowLeadingZeros;
41090
+ var onKeyDown = props.onKeyDown;
41091
+ if (onKeyDown === void 0)
41092
+ onKeyDown = noop;
41093
+ var onBlur = props.onBlur;
41094
+ if (onBlur === void 0)
41095
+ onBlur = noop;
41096
+ var thousandSeparator = props.thousandSeparator;
41097
+ var decimalScale = props.decimalScale;
41098
+ var fixedDecimalScale = props.fixedDecimalScale;
41099
+ var prefix2 = props.prefix;
41100
+ if (prefix2 === void 0)
41101
+ prefix2 = "";
41102
+ var defaultValue = props.defaultValue;
41103
+ var value = props.value;
41104
+ var valueIsNumericString = props.valueIsNumericString;
41105
+ var onValueChange = props.onValueChange;
41106
+ var restProps = __rest2(props, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]);
41107
+ var ref = getSeparators(props);
41108
+ var decimalSeparator = ref.decimalSeparator;
41109
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
41110
+ var _format = function(numStr) {
41111
+ return format(numStr, props);
41112
+ };
41113
+ var _removeFormatting = function(inputValue, changeMeta) {
41114
+ return removeFormatting(inputValue, changeMeta, props);
41115
+ };
41116
+ var _value = isNil(value) ? defaultValue : value;
41117
+ var _valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : isNumericString(_value, prefix2, suffix);
41118
+ if (!isNil(value)) {
41119
+ _valueIsNumericString = _valueIsNumericString || typeof value === "number";
41120
+ } else if (!isNil(defaultValue)) {
41121
+ _valueIsNumericString = _valueIsNumericString || typeof defaultValue === "number";
41122
+ }
41123
+ var roundIncomingValueToPrecision = function(value2) {
41124
+ if (isNotValidValue(value2)) {
41125
+ return value2;
41126
+ }
41127
+ if (typeof value2 === "number") {
41128
+ value2 = toNumericString(value2);
41129
+ }
41130
+ if (_valueIsNumericString && typeof decimalScale === "number") {
41131
+ return roundToPrecision(value2, decimalScale, Boolean(fixedDecimalScale));
41132
+ }
41133
+ return value2;
41134
+ };
41135
+ var ref$1 = useInternalValues(roundIncomingValueToPrecision(value), roundIncomingValueToPrecision(defaultValue), Boolean(_valueIsNumericString), _format, _removeFormatting, onValueChange);
41136
+ var ref$1_0 = ref$1[0];
41137
+ var numAsString = ref$1_0.numAsString;
41138
+ var formattedValue = ref$1_0.formattedValue;
41139
+ var _onValueChange = ref$1[1];
41140
+ var _onKeyDown = function(e) {
41141
+ var el = e.target;
41142
+ var key = e.key;
41143
+ var selectionStart = el.selectionStart;
41144
+ var selectionEnd = el.selectionEnd;
41145
+ var value2 = el.value;
41146
+ if (value2 === void 0)
41147
+ value2 = "";
41148
+ if (selectionStart !== selectionEnd) {
41149
+ onKeyDown(e);
41150
+ return;
40511
41151
  }
40512
- if (this._handlers.undo && e.keyCode === KEY_Z && (e.metaKey || e.ctrlKey)) {
40513
- e.preventDefault();
40514
- return this._handlers.undo(e);
41152
+ if (key === "Backspace" && value2[0] === "-" && selectionStart === prefix2.length + 1 && allowNegative) {
41153
+ setCaretPosition(el, 1);
40515
41154
  }
40516
- if (!e.isComposing)
40517
- this._handlers.selectionChange(e);
40518
- }
40519
- _onBeforeinput(e) {
40520
- if (e.inputType === "historyUndo" && this._handlers.undo) {
40521
- e.preventDefault();
40522
- return this._handlers.undo(e);
41155
+ if (decimalScale && fixedDecimalScale) {
41156
+ if (key === "Backspace" && value2[selectionStart - 1] === decimalSeparator) {
41157
+ setCaretPosition(el, selectionStart - 1);
41158
+ e.preventDefault();
41159
+ } else if (key === "Delete" && value2[selectionStart] === decimalSeparator) {
41160
+ e.preventDefault();
41161
+ }
40523
41162
  }
40524
- if (e.inputType === "historyRedo" && this._handlers.redo) {
40525
- e.preventDefault();
40526
- return this._handlers.redo(e);
41163
+ if ((allowedDecimalSeparators === null || allowedDecimalSeparators === void 0 ? void 0 : allowedDecimalSeparators.includes(key)) && value2[selectionStart] === decimalSeparator) {
41164
+ setCaretPosition(el, selectionStart + 1);
40527
41165
  }
41166
+ var _thousandSeparator = thousandSeparator === true ? "," : thousandSeparator;
41167
+ if (key === "Backspace" && value2[selectionStart - 1] === _thousandSeparator) {
41168
+ setCaretPosition(el, selectionStart - 1);
41169
+ }
41170
+ if (key === "Delete" && value2[selectionStart] === _thousandSeparator) {
41171
+ setCaretPosition(el, selectionStart + 1);
41172
+ }
41173
+ onKeyDown(e);
41174
+ };
41175
+ var _onBlur = function(e) {
41176
+ var _value2 = numAsString;
41177
+ if (!_value2.match(/\d/g)) {
41178
+ _value2 = "";
41179
+ }
41180
+ if (!allowLeadingZeros) {
41181
+ _value2 = fixLeadingZero(_value2);
41182
+ }
41183
+ if (fixedDecimalScale && decimalScale) {
41184
+ _value2 = roundToPrecision(_value2, decimalScale, fixedDecimalScale);
41185
+ }
41186
+ if (_value2 !== numAsString) {
41187
+ var formattedValue2 = format(_value2, props);
41188
+ _onValueChange({
41189
+ formattedValue: formattedValue2,
41190
+ value: _value2,
41191
+ floatValue: parseFloat(_value2)
41192
+ }, {
41193
+ event: e,
41194
+ source: SourceType.event
41195
+ });
41196
+ }
41197
+ onBlur(e);
41198
+ };
41199
+ var isValidInputCharacter = function(inputChar) {
41200
+ if (inputChar === decimalSeparator) {
41201
+ return true;
41202
+ }
41203
+ return charIsNumber(inputChar);
41204
+ };
41205
+ var isCharacterSame = function(ref2) {
41206
+ var currentValue = ref2.currentValue;
41207
+ var lastValue = ref2.lastValue;
41208
+ var formattedValue2 = ref2.formattedValue;
41209
+ var currentValueIndex = ref2.currentValueIndex;
41210
+ var formattedValueIndex = ref2.formattedValueIndex;
41211
+ var curChar = currentValue[currentValueIndex];
41212
+ var newChar = formattedValue2[formattedValueIndex];
41213
+ var typedRange = findChangeRange(lastValue, currentValue);
41214
+ var to = typedRange.to;
41215
+ if (currentValueIndex >= to.start && currentValueIndex < to.end && allowedDecimalSeparators && allowedDecimalSeparators.includes(curChar) && newChar === decimalSeparator) {
41216
+ return true;
41217
+ }
41218
+ return curChar === newChar;
41219
+ };
41220
+ return Object.assign(Object.assign({}, restProps), {
41221
+ value: formattedValue,
41222
+ valueIsNumericString: false,
41223
+ isValidInputCharacter,
41224
+ isCharacterSame,
41225
+ onValueChange: _onValueChange,
41226
+ format: _format,
41227
+ removeFormatting: _removeFormatting,
41228
+ getCaretBoundary: function(formattedValue2) {
41229
+ return getCaretBoundary(formattedValue2, props);
41230
+ },
41231
+ onKeyDown: _onKeyDown,
41232
+ onBlur: _onBlur
41233
+ });
41234
+ }
41235
+ function NumericFormat(props) {
41236
+ var numericFormatProps = useNumericFormat(props);
41237
+ return React177.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
41238
+ }
41239
+
41240
+ // ../../node_modules/@mui/icons-material/esm/InfoOutlined.js
41241
+ import { jsx as _jsx108 } from "react/jsx-runtime";
41242
+ var InfoOutlined_default = createSvgIcon2(/* @__PURE__ */ _jsx108("path", {
41243
+ d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
41244
+ }), "InfoOutlined");
41245
+
41246
+ // src/components/Input/Input.tsx
41247
+ import { motion as motion15 } from "framer-motion";
41248
+ var MotionInput = motion15(Input_default);
41249
+ var Input3 = (props) => {
41250
+ const _a2 = props, {
41251
+ label,
41252
+ helperText,
41253
+ error,
41254
+ style: style4,
41255
+ size,
41256
+ color: color2,
41257
+ disabled,
41258
+ required
41259
+ } = _a2, innerProps = __objRest(_a2, [
41260
+ "label",
41261
+ "helperText",
41262
+ "error",
41263
+ "style",
41264
+ "size",
41265
+ "color",
41266
+ "disabled",
41267
+ "required"
41268
+ ]);
41269
+ if (label) {
41270
+ return /* @__PURE__ */ jsxs2(
41271
+ FormControl_default2,
41272
+ {
41273
+ required,
41274
+ color: color2,
41275
+ size,
41276
+ error,
41277
+ disabled,
41278
+ children: [
41279
+ /* @__PURE__ */ jsx2(FormLabel_default2, { children: label }),
41280
+ /* @__PURE__ */ jsx2(MotionInput, __spreadValues({}, innerProps)),
41281
+ helperText && /* @__PURE__ */ jsx2(FormHelperText_default2, { children: helperText })
41282
+ ]
41283
+ }
41284
+ );
40528
41285
  }
40529
- _onCompositionEnd(e) {
40530
- this._handlers.input(e);
40531
- }
40532
- _onInput(e) {
40533
- if (!e.isComposing)
40534
- this._handlers.input(e);
40535
- }
40536
- /** Unbinds HTMLElement events to mask internal events */
40537
- unbindEvents() {
40538
- this.input.removeEventListener("keydown", this._onKeydown);
40539
- this.input.removeEventListener("input", this._onInput);
40540
- this.input.removeEventListener("beforeinput", this._onBeforeinput);
40541
- this.input.removeEventListener("compositionend", this._onCompositionEnd);
40542
- this.input.removeEventListener("drop", this._handlers.drop);
40543
- this.input.removeEventListener("click", this._handlers.click);
40544
- this.input.removeEventListener("focus", this._handlers.focus);
40545
- this.input.removeEventListener("blur", this._handlers.commit);
40546
- this._handlers = {};
40547
- }
41286
+ return /* @__PURE__ */ jsx2(
41287
+ MotionInput,
41288
+ __spreadValues({
41289
+ required,
41290
+ color: color2,
41291
+ size,
41292
+ disabled
41293
+ }, innerProps)
41294
+ );
40548
41295
  };
40549
- IMask.HTMLMaskElement = HTMLMaskElement;
41296
+ Input3.displayName = "Input";
40550
41297
 
40551
- // ../../node_modules/imask/esm/controls/html-input-mask-element.js
40552
- var HTMLInputMaskElement = class extends HTMLMaskElement {
40553
- /** InputElement to use mask on */
40554
- constructor(input) {
40555
- super(input);
40556
- this.input = input;
40557
- }
40558
- /** Returns InputElement selection start */
40559
- get _unsafeSelectionStart() {
40560
- return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
40561
- }
40562
- /** Returns InputElement selection end */
40563
- get _unsafeSelectionEnd() {
40564
- return this.input.selectionEnd;
40565
- }
40566
- /** Sets InputElement selection */
40567
- _unsafeSelect(start2, end2) {
40568
- this.input.setSelectionRange(start2, end2);
40569
- }
40570
- get value() {
40571
- return this.input.value;
40572
- }
40573
- set value(value) {
40574
- this.input.value = value;
40575
- }
41298
+ // src/components/Input/index.ts
41299
+ var Input_default2 = Input3;
41300
+
41301
+ // src/components/CurrencyInput/hooks/use-currency-setting.ts
41302
+ var useCurrencySetting = (currencyCode = "usd") => {
41303
+ const [symbol, thousandSeparator, decimalSeparator] = new lib_default(
41304
+ `{amount, number, ::currency/${currencyCode} unit-width-narrow}`
41305
+ ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
41306
+ return {
41307
+ symbol: `${symbol} `,
41308
+ thousandSeparator,
41309
+ decimalSeparator,
41310
+ placeholder: decimalSeparator ? `${symbol} 0${decimalSeparator}00` : `${symbol} 0`,
41311
+ fixedDecimalScale: !!decimalSeparator
41312
+ };
40576
41313
  };
40577
- IMask.HTMLMaskElement = HTMLMaskElement;
40578
41314
 
40579
- // ../../node_modules/imask/esm/controls/html-contenteditable-mask-element.js
40580
- var HTMLContenteditableMaskElement = class extends HTMLMaskElement {
40581
- /** Returns HTMLElement selection start */
40582
- get _unsafeSelectionStart() {
40583
- const root = this.rootElement;
40584
- const selection = root.getSelection && root.getSelection();
40585
- const anchorOffset = selection && selection.anchorOffset;
40586
- const focusOffset = selection && selection.focusOffset;
40587
- if (focusOffset == null || anchorOffset == null || anchorOffset < focusOffset) {
40588
- return anchorOffset;
40589
- }
40590
- return focusOffset;
40591
- }
40592
- /** Returns HTMLElement selection end */
40593
- get _unsafeSelectionEnd() {
40594
- const root = this.rootElement;
40595
- const selection = root.getSelection && root.getSelection();
40596
- const anchorOffset = selection && selection.anchorOffset;
40597
- const focusOffset = selection && selection.focusOffset;
41315
+ // src/components/CurrencyInput/CurrencyInput.tsx
41316
+ var TextMaskAdapter = React178.forwardRef(
41317
+ function TextMaskAdapter2(props, ref) {
41318
+ const _a2 = props, { onChange } = _a2, innerProps = __objRest(_a2, ["onChange"]);
41319
+ return /* @__PURE__ */ jsx2(
41320
+ NumericFormat,
41321
+ __spreadProps(__spreadValues({}, innerProps), {
41322
+ onValueChange: ({ floatValue }) => {
41323
+ onChange == null ? void 0 : onChange({
41324
+ target: { name: props.name, value: floatValue == null ? void 0 : floatValue.toString() }
41325
+ });
41326
+ },
41327
+ valueIsNumericString: true,
41328
+ getInputRef: ref,
41329
+ decimalScale: 2
41330
+ })
41331
+ );
41332
+ }
41333
+ );
41334
+ var CurrencyInput = React178.forwardRef(function CurrencyInput2(props, ref) {
41335
+ const _a2 = props, {
41336
+ currency = "usd",
41337
+ max: max2 = 1e5,
41338
+ name,
41339
+ onChange,
41340
+ label,
41341
+ error,
41342
+ helperText,
41343
+ required,
41344
+ disabled
41345
+ } = _a2, innerProps = __objRest(_a2, [
41346
+ "currency",
41347
+ "max",
41348
+ "name",
41349
+ "onChange",
41350
+ "label",
41351
+ "error",
41352
+ "helperText",
41353
+ "required",
41354
+ "disabled"
41355
+ ]);
41356
+ const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale } = useCurrencySetting(currency);
41357
+ const [value, setValue] = useState26(props.value);
41358
+ const [isOverLimit, setIsOverLimit] = useState26(
41359
+ !!props.value && props.value > Number(max2)
41360
+ );
41361
+ const handleChange = useCallback26(
41362
+ (event) => {
41363
+ const amount = Number(event.target.value);
41364
+ setValue(amount);
41365
+ onChange == null ? void 0 : onChange(__spreadProps(__spreadValues({}, event), { target: { name, value: amount } }));
41366
+ if (amount > Number(max2)) {
41367
+ setIsOverLimit(true);
41368
+ } else {
41369
+ setIsOverLimit(false);
41370
+ }
41371
+ },
41372
+ []
41373
+ );
41374
+ const currencyFormatter = /* @__PURE__ */ jsx2(
41375
+ Input_default2,
41376
+ __spreadProps(__spreadValues({}, innerProps), {
41377
+ size: "sm",
41378
+ ref,
41379
+ value,
41380
+ placeholder,
41381
+ onChange: handleChange,
41382
+ disabled,
41383
+ required,
41384
+ slotProps: {
41385
+ input: {
41386
+ component: TextMaskAdapter,
41387
+ decimalSeparator,
41388
+ thousandSeparator,
41389
+ prefix: symbol,
41390
+ fixedDecimalScale
41391
+ }
41392
+ },
41393
+ sx: {
41394
+ fontFamily: "monospace"
41395
+ }
41396
+ })
41397
+ );
41398
+ if (label) {
41399
+ return /* @__PURE__ */ jsxs2(
41400
+ FormControl_default2,
41401
+ {
41402
+ size: "sm",
41403
+ disabled,
41404
+ required,
41405
+ error: error || isOverLimit,
41406
+ children: [
41407
+ /* @__PURE__ */ jsx2(FormLabel_default2, { children: label }),
41408
+ currencyFormatter,
41409
+ isOverLimit ? /* @__PURE__ */ jsxs2(FormHelperText_default2, { children: [
41410
+ /* @__PURE__ */ jsx2(InfoOutlined_default, {}),
41411
+ new IntlMessageFormat(
41412
+ `limit: {amount, number, ::currency/${currency} unit-width-narrow}`
41413
+ ).format({ amount: max2 })
41414
+ ] }) : helperText && /* @__PURE__ */ jsx2(FormHelperText_default2, { children: helperText })
41415
+ ]
41416
+ }
41417
+ );
41418
+ }
41419
+ return currencyFormatter;
41420
+ });
41421
+
41422
+ // src/components/DataTable/DataTable.tsx
41423
+ import {
41424
+ useCallback as useCallback27,
41425
+ useEffect as useEffect37,
41426
+ useMemo as useMemo36,
41427
+ useRef as useRef44,
41428
+ useState as useState27
41429
+ } from "react";
41430
+
41431
+ // src/components/Sheet/Sheet.tsx
41432
+ import { motion as motion16 } from "framer-motion";
41433
+ var MotionSheet = motion16(Sheet_default);
41434
+ var Sheet3 = MotionSheet;
41435
+ Sheet3.displayName = "Sheet";
41436
+
41437
+ // src/components/Sheet/index.ts
41438
+ var Sheet_default2 = Sheet3;
41439
+
41440
+ // src/components/Table/Table.tsx
41441
+ var Table3 = (props) => {
41442
+ const _a2 = props, { children } = _a2, inheritProps = __objRest(_a2, ["children"]);
41443
+ return /* @__PURE__ */ jsx2(Table_default, __spreadProps(__spreadValues({}, inheritProps), { children }));
41444
+ };
41445
+ Table3.displayName = "Table";
41446
+ function TableHead(props) {
41447
+ const {
41448
+ headCells,
41449
+ showCheckbox,
41450
+ onCheckboxChange,
41451
+ slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
41452
+ slotProps: { checkbox: checkboxProps = {} } = {}
41453
+ } = props;
41454
+ return /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
41455
+ showCheckbox && /* @__PURE__ */ jsx2(
41456
+ "th",
41457
+ {
41458
+ style: {
41459
+ width: "40px",
41460
+ textAlign: "center"
41461
+ },
41462
+ children: /* @__PURE__ */ jsx2(RenderCheckbox, __spreadValues({ onChange: onCheckboxChange }, checkboxProps))
41463
+ }
41464
+ ),
41465
+ headCells.map((headCell) => /* @__PURE__ */ jsx2(
41466
+ "th",
41467
+ {
41468
+ style: {
41469
+ width: headCell.width,
41470
+ minWidth: headCell.minWidth,
41471
+ maxWidth: headCell.maxWidth,
41472
+ textAlign: headCell.numeric ? "right" : "left"
41473
+ },
41474
+ children: headCell.label
41475
+ },
41476
+ headCell.label
41477
+ ))
41478
+ ] }) });
41479
+ }
41480
+ TableHead.displayName = "TableHead";
41481
+ function TableBody(props) {
41482
+ const {
41483
+ rows,
41484
+ cellOrder,
41485
+ rowOptions,
41486
+ showCheckbox,
41487
+ onCheckboxChange,
41488
+ slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
41489
+ slotProps: { checkbox: checkboxProps = {} } = {}
41490
+ } = props;
41491
+ return /* @__PURE__ */ jsx2("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs2("tr", { children: [
41492
+ showCheckbox && /* @__PURE__ */ jsx2(
41493
+ "td",
41494
+ {
41495
+ style: {
41496
+ textAlign: "center"
41497
+ },
41498
+ children: /* @__PURE__ */ jsx2(
41499
+ RenderCheckbox,
41500
+ __spreadValues({
41501
+ onChange: (event) => onCheckboxChange == null ? void 0 : onCheckboxChange(event, rowIndex)
41502
+ }, checkboxProps)
41503
+ )
41504
+ }
41505
+ ),
41506
+ cellOrder.map((cellKey) => {
41507
+ var _a2;
41508
+ return /* @__PURE__ */ jsx2(
41509
+ "td",
41510
+ {
41511
+ style: {
41512
+ textAlign: ((_a2 = rowOptions == null ? void 0 : rowOptions[cellKey]) == null ? void 0 : _a2.numeric) ? "right" : "left"
41513
+ },
41514
+ children: row[cellKey]
41515
+ },
41516
+ cellKey
41517
+ );
41518
+ })
41519
+ ] }, rowIndex)) });
41520
+ }
41521
+ TableBody.displayName = "TableBody";
41522
+
41523
+ // src/components/DataTable/DataTable.tsx
41524
+ var OverlayWrapper = styled_default2("tr", {
41525
+ name: "DataTable",
41526
+ slot: "overlayWrapper"
41527
+ })({
41528
+ position: "sticky",
41529
+ top: `calc(var(--unstable_TableCell-height, 32px))`,
41530
+ left: 0,
41531
+ right: 0,
41532
+ zIndex: 1,
41533
+ "& > td": {
41534
+ height: 0,
41535
+ padding: 0,
41536
+ border: "none !important"
41537
+ }
41538
+ });
41539
+ var numberFormatter = (value) => "Intl" in window ? new Intl.NumberFormat().format(value) : value;
41540
+ function TablePagination(props) {
41541
+ const {
41542
+ paginationModel: { page, pageSize: pageSize2 },
41543
+ rowCount,
41544
+ onPageChange
41545
+ } = props;
41546
+ const firstPage = 1;
41547
+ const lastPage = Math.ceil(rowCount / pageSize2);
41548
+ const beforePages = [page - 2, page - 1].filter((p) => p > 1);
41549
+ const afterPages = [page + 1, page + 2].filter((p) => p <= lastPage - 1);
41550
+ const isMoreAfterPages = lastPage > 1 && page < lastPage - 3;
41551
+ const isMoreBeforePages = lastPage > 1 && page > 4;
41552
+ return /* @__PURE__ */ jsx2(
41553
+ Stack_default2,
41554
+ {
41555
+ direction: "row",
41556
+ spacing: 1,
41557
+ sx: {
41558
+ pt: 1,
41559
+ pb: 1
41560
+ },
41561
+ justifyContent: "end",
41562
+ alignItems: "center",
41563
+ children: /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 0.5, alignItems: "center", children: [
41564
+ /* @__PURE__ */ jsx2(
41565
+ IconButton_default2,
41566
+ {
41567
+ size: "sm",
41568
+ variant: "plain",
41569
+ color: "neutral",
41570
+ onClick: () => onPageChange(page - 1),
41571
+ disabled: page === firstPage,
41572
+ "aria-label": "Previous page",
41573
+ children: /* @__PURE__ */ jsx2(ChevronLeft_default, {})
41574
+ }
41575
+ ),
41576
+ page !== firstPage && /* @__PURE__ */ jsx2(
41577
+ Button_default2,
41578
+ {
41579
+ size: "sm",
41580
+ variant: "plain",
41581
+ color: "neutral",
41582
+ onClick: () => onPageChange(firstPage),
41583
+ children: firstPage
41584
+ }
41585
+ ),
41586
+ isMoreBeforePages && /* @__PURE__ */ jsx2(
41587
+ Button_default2,
41588
+ {
41589
+ size: "sm",
41590
+ variant: "plain",
41591
+ color: "neutral",
41592
+ onClick: () => onPageChange(page - 3),
41593
+ children: "..."
41594
+ }
41595
+ ),
41596
+ beforePages.map((p) => /* @__PURE__ */ jsx2(
41597
+ Button_default2,
41598
+ {
41599
+ size: "sm",
41600
+ variant: "plain",
41601
+ color: "neutral",
41602
+ onClick: () => onPageChange(p),
41603
+ children: p
41604
+ },
41605
+ p
41606
+ )),
41607
+ /* @__PURE__ */ jsx2(Button_default2, { variant: "soft", size: "sm", children: page }),
41608
+ afterPages.map((p) => /* @__PURE__ */ jsx2(
41609
+ Button_default2,
41610
+ {
41611
+ size: "sm",
41612
+ variant: "plain",
41613
+ color: "neutral",
41614
+ onClick: () => onPageChange(p),
41615
+ children: p
41616
+ },
41617
+ p
41618
+ )),
41619
+ isMoreAfterPages && /* @__PURE__ */ jsx2(
41620
+ Button_default2,
41621
+ {
41622
+ size: "sm",
41623
+ variant: "plain",
41624
+ color: "neutral",
41625
+ onClick: () => onPageChange(page + 3),
41626
+ children: "..."
41627
+ }
41628
+ ),
41629
+ page !== lastPage && /* @__PURE__ */ jsx2(
41630
+ Button_default2,
41631
+ {
41632
+ size: "sm",
41633
+ variant: "plain",
41634
+ color: "neutral",
41635
+ onClick: () => onPageChange(lastPage),
41636
+ children: lastPage
41637
+ }
41638
+ ),
41639
+ /* @__PURE__ */ jsx2(
41640
+ IconButton_default2,
41641
+ {
41642
+ size: "sm",
41643
+ variant: "plain",
41644
+ color: "neutral",
41645
+ onClick: () => onPageChange(page + 1),
41646
+ disabled: page === lastPage,
41647
+ "aria-label": "Next page",
41648
+ children: /* @__PURE__ */ jsx2(ChevronRight_default, {})
41649
+ }
41650
+ )
41651
+ ] })
41652
+ }
41653
+ );
41654
+ }
41655
+ var Resizer = (ref) => /* @__PURE__ */ jsx2(
41656
+ Box_default2,
41657
+ {
41658
+ sx: {
41659
+ position: "absolute",
41660
+ top: 0,
41661
+ right: 0,
41662
+ bottom: 0,
41663
+ width: "4px",
41664
+ cursor: "col-resize"
41665
+ },
41666
+ onMouseDown: (e) => {
41667
+ var _a2;
41668
+ const initialX = e.clientX;
41669
+ const initialWidth = (_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().width;
41670
+ const onMouseMove = (e2) => {
41671
+ if (initialWidth && initialX) {
41672
+ ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
41673
+ }
41674
+ };
41675
+ const onMouseUp = () => {
41676
+ document.removeEventListener("mousemove", onMouseMove);
41677
+ document.removeEventListener("mouseup", onMouseUp);
41678
+ };
41679
+ document.addEventListener("mousemove", onMouseMove);
41680
+ document.addEventListener("mouseup", onMouseUp);
41681
+ }
41682
+ }
41683
+ );
41684
+ var HeadCell = (props) => {
41685
+ var _a2, _b, _c;
41686
+ const ref = useRef44(null);
41687
+ const style4 = {
41688
+ width: props.width,
41689
+ minWidth: (_a2 = props.minWidth) != null ? _a2 : "50px",
41690
+ maxWidth: props.maxWidth,
41691
+ textAlign: props.type === "number" ? "end" : "start",
41692
+ position: props.stickyHeader ? void 0 : "relative"
41693
+ };
41694
+ const resizer = ((_b = props.resizable) != null ? _b : true) ? Resizer(ref) : null;
41695
+ return /* @__PURE__ */ jsxs2("th", { ref, style: style4, children: [
41696
+ (_c = props.headerName) != null ? _c : props.field,
41697
+ resizer
41698
+ ] }, props.field);
41699
+ };
41700
+ function useDataTableRenderer({
41701
+ rows,
41702
+ columns,
41703
+ rowCount: totalRowsProp,
41704
+ paginationMode,
41705
+ paginationModel,
41706
+ onPaginationModelChange,
41707
+ selectionModel = [],
41708
+ onSelectionModelChange,
41709
+ getId: _getId,
41710
+ isTotalSelected: _isTotalSelected
41711
+ }) {
41712
+ const [page, setPage] = useState27((paginationModel == null ? void 0 : paginationModel.page) || 1);
41713
+ const pageSize2 = (paginationModel == null ? void 0 : paginationModel.pageSize) || 20;
41714
+ const getId = useCallback27(
41715
+ (row, index) => {
41716
+ var _a2, _b;
41717
+ return (_b = (_a2 = _getId == null ? void 0 : _getId(row)) != null ? _a2 : row == null ? void 0 : row.id) != null ? _b : `${(index || 0) + (page - 1) * pageSize2}`;
41718
+ },
41719
+ [_getId != null ? _getId : page, pageSize2]
41720
+ );
41721
+ const selectedModelSet = useMemo36(
41722
+ () => new Set(selectionModel),
41723
+ [selectionModel]
41724
+ );
41725
+ const dataInPage = useMemo36(
41726
+ () => paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize2, (page - 1) * pageSize2 + pageSize2),
41727
+ [rows, page, pageSize2, paginationMode]
41728
+ );
41729
+ const isAllSelected = useMemo36(
41730
+ () => dataInPage.length > 0 && dataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
41731
+ [dataInPage, selectedModelSet, page, pageSize2, getId]
41732
+ );
41733
+ const rowCount = totalRowsProp || rows.length;
41734
+ const isTotalSelected = useMemo36(
41735
+ () => _isTotalSelected != null ? _isTotalSelected : rowCount > 0 && selectionModel.length === rowCount,
41736
+ [_isTotalSelected, selectionModel, rowCount]
41737
+ );
41738
+ const handlePageChange = useCallback27(
41739
+ (newPage) => {
41740
+ setPage(newPage);
41741
+ onPaginationModelChange == null ? void 0 : onPaginationModelChange({ page: newPage, pageSize: pageSize2 });
41742
+ },
41743
+ [onPaginationModelChange]
41744
+ );
41745
+ useEffect37(() => {
41746
+ handlePageChange(1);
41747
+ }, [rowCount]);
41748
+ useEffect37(() => {
41749
+ if (page > Math.ceil(rowCount / pageSize2)) {
41750
+ handlePageChange(Math.ceil(rowCount / pageSize2));
41751
+ }
41752
+ }, [rowCount, pageSize2]);
41753
+ useEffect37(() => {
41754
+ onSelectionModelChange == null ? void 0 : onSelectionModelChange([]);
41755
+ }, [page]);
41756
+ return {
41757
+ rowCount,
41758
+ page,
41759
+ pageSize: pageSize2,
41760
+ onPaginationModelChange: handlePageChange,
41761
+ getId,
41762
+ HeadCell,
41763
+ dataInPage,
41764
+ isAllSelected,
41765
+ // all rows are selected on this page
41766
+ isTotalSelected,
41767
+ isSelectedRow: useCallback27(
41768
+ (model) => selectedModelSet.has(model),
41769
+ [selectedModelSet]
41770
+ ),
41771
+ onAllCheckboxChange: useCallback27(() => {
41772
+ onSelectionModelChange == null ? void 0 : onSelectionModelChange(isAllSelected ? [] : dataInPage.map(getId));
41773
+ }, [isAllSelected, dataInPage, onSelectionModelChange]),
41774
+ onCheckboxChange: useCallback27(
41775
+ (event, selectedModel) => {
41776
+ if (selectedModelSet.has(selectedModel)) {
41777
+ const newSelectionModel = selectionModel.filter(
41778
+ (model) => model !== selectedModel
41779
+ );
41780
+ onSelectionModelChange == null ? void 0 : onSelectionModelChange(newSelectionModel);
41781
+ } else {
41782
+ const newSelectionModel = [...selectionModel, selectedModel];
41783
+ onSelectionModelChange == null ? void 0 : onSelectionModelChange(newSelectionModel);
41784
+ }
41785
+ },
41786
+ [selectionModel, onSelectionModelChange]
41787
+ ),
41788
+ columns: useMemo36(
41789
+ () => columns || // fallback
41790
+ Object.keys(rows[0] || {}).map((key) => ({
41791
+ field: key
41792
+ })),
41793
+ [rows, columns]
41794
+ ),
41795
+ onTotalSelect: useCallback27(() => {
41796
+ onSelectionModelChange == null ? void 0 : onSelectionModelChange(
41797
+ isTotalSelected ? [] : rows.map(getId),
41798
+ !isTotalSelected
41799
+ );
41800
+ }, [isTotalSelected, rows, onSelectionModelChange])
41801
+ };
41802
+ }
41803
+ function DataTable(props) {
41804
+ const _a2 = props, {
41805
+ rows,
41806
+ checkboxSelection,
41807
+ selectionModel,
41808
+ onSelectionModelChange,
41809
+ rowCount: _4,
41810
+ columns: __,
41811
+ onPaginationModelChange: ___,
41812
+ paginationMode: ____,
41813
+ paginationModel: paginationModel,
41814
+ loading,
41815
+ slots: {
41816
+ checkbox: RenderCheckbox = Checkbox_default2,
41817
+ toolbar: Toolbar,
41818
+ footer: Footer,
41819
+ loadingOverlay: LoadingOverlay = () => /* @__PURE__ */ jsx2(LinearProgress_default, { value: 8, variant: "plain" })
41820
+ } = {},
41821
+ slotProps: {
41822
+ checkbox: checkboxProps = {},
41823
+ toolbar: toolbarProps,
41824
+ background: backgroundProps = {}
41825
+ } = {}
41826
+ } = _a2, innerProps = __objRest(_a2, [
41827
+ "rows",
41828
+ "checkboxSelection",
41829
+ "selectionModel",
41830
+ "onSelectionModelChange",
41831
+ "rowCount",
41832
+ // rowCount is used in useDataTableRenderer
41833
+ "columns",
41834
+ // columns is used in useDataTableRenderer
41835
+ "onPaginationModelChange",
41836
+ // onPaginationModelChange is used in useDataTableRenderer
41837
+ "paginationMode",
41838
+ // paginationMode is used in useDataTableRenderer
41839
+ "paginationModel",
41840
+ "loading",
41841
+ "slots",
41842
+ "slotProps"
41843
+ ]);
41844
+ const {
41845
+ columns,
41846
+ isAllSelected,
41847
+ isSelectedRow,
41848
+ onAllCheckboxChange,
41849
+ onCheckboxChange,
41850
+ getId,
41851
+ rowCount,
41852
+ page,
41853
+ pageSize: pageSize2,
41854
+ onPaginationModelChange,
41855
+ dataInPage,
41856
+ isTotalSelected,
41857
+ onTotalSelect,
41858
+ HeadCell: HeadCell2
41859
+ } = useDataTableRenderer(props);
41860
+ return /* @__PURE__ */ jsxs2(Box_default2, { children: [
41861
+ /* @__PURE__ */ jsxs2(
41862
+ Stack_default2,
41863
+ {
41864
+ direction: "row",
41865
+ sx: {
41866
+ pt: 1,
41867
+ pb: 1
41868
+ },
41869
+ justifyContent: "space-between",
41870
+ alignItems: "center",
41871
+ children: [
41872
+ !!checkboxSelection && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, children: [
41873
+ !isAllSelected && /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
41874
+ numberFormatter((selectionModel == null ? void 0 : selectionModel.length) || 0),
41875
+ " items selected"
41876
+ ] }),
41877
+ isAllSelected && !isTotalSelected && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, alignItems: "center", children: [
41878
+ /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
41879
+ "All ",
41880
+ numberFormatter((selectionModel == null ? void 0 : selectionModel.length) || 0),
41881
+ " items on this page are selected."
41882
+ ] }),
41883
+ /* @__PURE__ */ jsxs2(Button_default2, { size: "sm", variant: "plain", onClick: onTotalSelect, children: [
41884
+ "Select all ",
41885
+ numberFormatter(rowCount != null ? rowCount : rows.length),
41886
+ " items"
41887
+ ] })
41888
+ ] }),
41889
+ isTotalSelected && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, alignItems: "center", children: [
41890
+ /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
41891
+ "All ",
41892
+ numberFormatter(rowCount != null ? rowCount : rows.length),
41893
+ " items are selected."
41894
+ ] }),
41895
+ /* @__PURE__ */ jsx2(
41896
+ Button_default2,
41897
+ {
41898
+ size: "sm",
41899
+ variant: "plain",
41900
+ color: "danger",
41901
+ onClick: onTotalSelect,
41902
+ children: "Cancel"
41903
+ }
41904
+ )
41905
+ ] })
41906
+ ] }),
41907
+ Toolbar && /* @__PURE__ */ jsx2(Toolbar, __spreadValues({}, toolbarProps || {}))
41908
+ ]
41909
+ }
41910
+ ),
41911
+ /* @__PURE__ */ jsx2(
41912
+ Sheet_default2,
41913
+ __spreadProps(__spreadValues({
41914
+ variant: "outlined",
41915
+ sx: {
41916
+ overflow: "auto",
41917
+ width: "100%",
41918
+ boxShadow: "sm",
41919
+ borderRadius: "sm"
41920
+ }
41921
+ }, backgroundProps), {
41922
+ children: /* @__PURE__ */ jsxs2(Table3, __spreadProps(__spreadValues({}, innerProps), { children: [
41923
+ /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
41924
+ checkboxSelection && /* @__PURE__ */ jsx2(
41925
+ "th",
41926
+ {
41927
+ style: {
41928
+ width: "40px",
41929
+ textAlign: "center"
41930
+ },
41931
+ children: /* @__PURE__ */ jsx2(
41932
+ RenderCheckbox,
41933
+ __spreadValues({
41934
+ onChange: onAllCheckboxChange,
41935
+ checked: isAllSelected,
41936
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected
41937
+ }, checkboxProps)
41938
+ )
41939
+ }
41940
+ ),
41941
+ columns.map((c) => /* @__PURE__ */ jsx2(
41942
+ HeadCell2,
41943
+ __spreadValues({
41944
+ stickyHeader: props.stickyHeader
41945
+ }, c),
41946
+ c.field
41947
+ ))
41948
+ ] }) }),
41949
+ /* @__PURE__ */ jsxs2("tbody", { children: [
41950
+ /* @__PURE__ */ jsx2(OverlayWrapper, { children: !!loading && /* @__PURE__ */ jsx2("td", { children: /* @__PURE__ */ jsx2(
41951
+ Box_default2,
41952
+ {
41953
+ sx: {
41954
+ position: "absolute",
41955
+ top: 0,
41956
+ left: 0,
41957
+ right: 0
41958
+ },
41959
+ children: /* @__PURE__ */ jsx2(LoadingOverlay, {})
41960
+ }
41961
+ ) }) }),
41962
+ /* @__PURE__ */ jsx2(OverlayWrapper, {}),
41963
+ dataInPage.map((row, rowIndex) => {
41964
+ const rowId = getId(row, rowIndex);
41965
+ return /* @__PURE__ */ jsxs2(
41966
+ "tr",
41967
+ {
41968
+ role: checkboxSelection ? "checkbox" : void 0,
41969
+ tabIndex: checkboxSelection ? -1 : void 0,
41970
+ onClick: checkboxSelection ? (e) => onCheckboxChange(e, rowId) : void 0,
41971
+ "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
41972
+ children: [
41973
+ checkboxSelection && /* @__PURE__ */ jsx2(
41974
+ "th",
41975
+ {
41976
+ scope: "row",
41977
+ style: {
41978
+ textAlign: "center"
41979
+ },
41980
+ children: /* @__PURE__ */ jsx2(
41981
+ RenderCheckbox,
41982
+ __spreadValues({
41983
+ onChange: (e) => onCheckboxChange(e, rowId),
41984
+ checked: isSelectedRow(rowId)
41985
+ }, checkboxProps)
41986
+ )
41987
+ }
41988
+ ),
41989
+ columns.map((column2) => {
41990
+ var _a3, _b;
41991
+ return /* @__PURE__ */ jsx2(
41992
+ "td",
41993
+ {
41994
+ style: {
41995
+ textAlign: column2.type === "number" ? "end" : "start"
41996
+ },
41997
+ children: (_b = (_a3 = column2.renderCell) == null ? void 0 : _a3.call(column2, {
41998
+ row,
41999
+ value: row[column2.field],
42000
+ id: rowId
42001
+ })) != null ? _b : row[column2.field]
42002
+ },
42003
+ column2.field
42004
+ );
42005
+ })
42006
+ ]
42007
+ },
42008
+ rowId
42009
+ );
42010
+ })
42011
+ ] }),
42012
+ Footer && /* @__PURE__ */ jsx2(Footer, {})
42013
+ ] }))
42014
+ })
42015
+ ),
42016
+ /* @__PURE__ */ jsx2(
42017
+ TablePagination,
42018
+ {
42019
+ paginationModel: useMemo36(() => ({ page, pageSize: pageSize2 }), [page, pageSize2]),
42020
+ rowCount,
42021
+ onPageChange: onPaginationModelChange
42022
+ }
42023
+ )
42024
+ ] });
42025
+ }
42026
+ DataTable.displayName = "DataTable";
42027
+
42028
+ // src/components/DatePicker/DatePicker.tsx
42029
+ import React182, { forwardRef as forwardRef85, useCallback as useCallback29, useState as useState29 } from "react";
42030
+
42031
+ // ../../node_modules/imask/esm/core/utils.js
42032
+ function isString(str) {
42033
+ return typeof str === "string" || str instanceof String;
42034
+ }
42035
+ function isObject(obj) {
42036
+ var _obj$constructor;
42037
+ return typeof obj === "object" && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === "Object";
42038
+ }
42039
+ function pick(obj, keys) {
42040
+ if (Array.isArray(keys))
42041
+ return pick(obj, (_4, k) => keys.includes(k));
42042
+ return Object.entries(obj).reduce((acc, _ref) => {
42043
+ let [k, v] = _ref;
42044
+ if (keys(v, k))
42045
+ acc[k] = v;
42046
+ return acc;
42047
+ }, {});
42048
+ }
42049
+ var DIRECTION = {
42050
+ NONE: "NONE",
42051
+ LEFT: "LEFT",
42052
+ FORCE_LEFT: "FORCE_LEFT",
42053
+ RIGHT: "RIGHT",
42054
+ FORCE_RIGHT: "FORCE_RIGHT"
42055
+ };
42056
+ function forceDirection(direction) {
42057
+ switch (direction) {
42058
+ case DIRECTION.LEFT:
42059
+ return DIRECTION.FORCE_LEFT;
42060
+ case DIRECTION.RIGHT:
42061
+ return DIRECTION.FORCE_RIGHT;
42062
+ default:
42063
+ return direction;
42064
+ }
42065
+ }
42066
+ function escapeRegExp2(str) {
42067
+ return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
42068
+ }
42069
+ function objectIncludes(b, a) {
42070
+ if (a === b)
42071
+ return true;
42072
+ const arrA = Array.isArray(a), arrB = Array.isArray(b);
42073
+ let i;
42074
+ if (arrA && arrB) {
42075
+ if (a.length != b.length)
42076
+ return false;
42077
+ for (i = 0; i < a.length; i++)
42078
+ if (!objectIncludes(a[i], b[i]))
42079
+ return false;
42080
+ return true;
42081
+ }
42082
+ if (arrA != arrB)
42083
+ return false;
42084
+ if (a && b && typeof a === "object" && typeof b === "object") {
42085
+ const dateA = a instanceof Date, dateB = b instanceof Date;
42086
+ if (dateA && dateB)
42087
+ return a.getTime() == b.getTime();
42088
+ if (dateA != dateB)
42089
+ return false;
42090
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
42091
+ if (regexpA && regexpB)
42092
+ return a.toString() == b.toString();
42093
+ if (regexpA != regexpB)
42094
+ return false;
42095
+ const keys = Object.keys(a);
42096
+ for (i = 0; i < keys.length; i++)
42097
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
42098
+ return false;
42099
+ for (i = 0; i < keys.length; i++)
42100
+ if (!objectIncludes(b[keys[i]], a[keys[i]]))
42101
+ return false;
42102
+ return true;
42103
+ } else if (a && b && typeof a === "function" && typeof b === "function") {
42104
+ return a.toString() === b.toString();
42105
+ }
42106
+ return false;
42107
+ }
42108
+
42109
+ // ../../node_modules/imask/esm/core/action-details.js
42110
+ var ActionDetails = class {
42111
+ /** Current input value */
42112
+ /** Current cursor position */
42113
+ /** Old input value */
42114
+ /** Old selection */
42115
+ constructor(opts) {
42116
+ Object.assign(this, opts);
42117
+ while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {
42118
+ --this.oldSelection.start;
42119
+ }
42120
+ if (this.insertedCount) {
42121
+ while (this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end)) {
42122
+ if (this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end)
42123
+ ++this.oldSelection.end;
42124
+ else
42125
+ ++this.cursorPos;
42126
+ }
42127
+ }
42128
+ }
42129
+ /** Start changing position */
42130
+ get startChangePos() {
42131
+ return Math.min(this.cursorPos, this.oldSelection.start);
42132
+ }
42133
+ /** Inserted symbols count */
42134
+ get insertedCount() {
42135
+ return this.cursorPos - this.startChangePos;
42136
+ }
42137
+ /** Inserted symbols */
42138
+ get inserted() {
42139
+ return this.value.substr(this.startChangePos, this.insertedCount);
42140
+ }
42141
+ /** Removed symbols count */
42142
+ get removedCount() {
42143
+ return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
42144
+ this.oldValue.length - this.value.length, 0);
42145
+ }
42146
+ /** Removed symbols */
42147
+ get removed() {
42148
+ return this.oldValue.substr(this.startChangePos, this.removedCount);
42149
+ }
42150
+ /** Unchanged head symbols */
42151
+ get head() {
42152
+ return this.value.substring(0, this.startChangePos);
42153
+ }
42154
+ /** Unchanged tail symbols */
42155
+ get tail() {
42156
+ return this.value.substring(this.startChangePos + this.insertedCount);
42157
+ }
42158
+ /** Remove direction */
42159
+ get removeDirection() {
42160
+ if (!this.removedCount || this.insertedCount)
42161
+ return DIRECTION.NONE;
42162
+ return (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
42163
+ this.oldSelection.end === this.oldSelection.start ? DIRECTION.RIGHT : DIRECTION.LEFT;
42164
+ }
42165
+ };
42166
+
42167
+ // ../../node_modules/imask/esm/core/holder.js
42168
+ function IMask(el, opts) {
42169
+ return new IMask.InputMask(el, opts);
42170
+ }
42171
+
42172
+ // ../../node_modules/imask/esm/masked/factory.js
42173
+ function maskedClass(mask) {
42174
+ if (mask == null)
42175
+ throw new Error("mask property should be defined");
42176
+ if (mask instanceof RegExp)
42177
+ return IMask.MaskedRegExp;
42178
+ if (isString(mask))
42179
+ return IMask.MaskedPattern;
42180
+ if (mask === Date)
42181
+ return IMask.MaskedDate;
42182
+ if (mask === Number)
42183
+ return IMask.MaskedNumber;
42184
+ if (Array.isArray(mask) || mask === Array)
42185
+ return IMask.MaskedDynamic;
42186
+ if (IMask.Masked && mask.prototype instanceof IMask.Masked)
42187
+ return mask;
42188
+ if (IMask.Masked && mask instanceof IMask.Masked)
42189
+ return mask.constructor;
42190
+ if (mask instanceof Function)
42191
+ return IMask.MaskedFunction;
42192
+ console.warn("Mask not found for mask", mask);
42193
+ return IMask.Masked;
42194
+ }
42195
+ function normalizeOpts(opts) {
42196
+ if (!opts)
42197
+ throw new Error("Options in not defined");
42198
+ if (IMask.Masked) {
42199
+ if (opts.prototype instanceof IMask.Masked)
42200
+ return {
42201
+ mask: opts
42202
+ };
42203
+ const _a2 = opts instanceof IMask.Masked ? {
42204
+ mask: opts
42205
+ } : isObject(opts) && opts.mask instanceof IMask.Masked ? opts : {}, {
42206
+ mask = void 0
42207
+ } = _a2, instanceOpts = __objRest(_a2, [
42208
+ "mask"
42209
+ ]);
42210
+ if (mask) {
42211
+ const _mask = mask.mask;
42212
+ return __spreadValues(__spreadProps(__spreadValues({}, pick(mask, (_4, k) => !k.startsWith("_"))), {
42213
+ mask: mask.constructor,
42214
+ _mask
42215
+ }), instanceOpts);
42216
+ }
42217
+ }
42218
+ if (!isObject(opts))
42219
+ return {
42220
+ mask: opts
42221
+ };
42222
+ return __spreadValues({}, opts);
42223
+ }
42224
+ function createMask(opts) {
42225
+ if (IMask.Masked && opts instanceof IMask.Masked)
42226
+ return opts;
42227
+ const nOpts = normalizeOpts(opts);
42228
+ const MaskedClass = maskedClass(nOpts.mask);
42229
+ if (!MaskedClass)
42230
+ throw new Error("Masked class is not found for provided mask " + nOpts.mask + ", appropriate module needs to be imported manually before creating mask.");
42231
+ if (nOpts.mask === MaskedClass)
42232
+ delete nOpts.mask;
42233
+ if (nOpts._mask) {
42234
+ nOpts.mask = nOpts._mask;
42235
+ delete nOpts._mask;
42236
+ }
42237
+ return new MaskedClass(nOpts);
42238
+ }
42239
+ IMask.createMask = createMask;
42240
+
42241
+ // ../../node_modules/imask/esm/controls/mask-element.js
42242
+ var MaskElement = class {
42243
+ /** */
42244
+ /** */
42245
+ /** */
42246
+ /** Safely returns selection start */
42247
+ get selectionStart() {
42248
+ let start2;
42249
+ try {
42250
+ start2 = this._unsafeSelectionStart;
42251
+ } catch (e) {
42252
+ }
42253
+ return start2 != null ? start2 : this.value.length;
42254
+ }
42255
+ /** Safely returns selection end */
42256
+ get selectionEnd() {
42257
+ let end2;
42258
+ try {
42259
+ end2 = this._unsafeSelectionEnd;
42260
+ } catch (e) {
42261
+ }
42262
+ return end2 != null ? end2 : this.value.length;
42263
+ }
42264
+ /** Safely sets element selection */
42265
+ select(start2, end2) {
42266
+ if (start2 == null || end2 == null || start2 === this.selectionStart && end2 === this.selectionEnd)
42267
+ return;
42268
+ try {
42269
+ this._unsafeSelect(start2, end2);
42270
+ } catch (e) {
42271
+ }
42272
+ }
42273
+ /** */
42274
+ get isActive() {
42275
+ return false;
42276
+ }
42277
+ /** */
42278
+ /** */
42279
+ /** */
42280
+ };
42281
+ IMask.MaskElement = MaskElement;
42282
+
42283
+ // ../../node_modules/imask/esm/controls/html-mask-element.js
42284
+ var KEY_Z = 90;
42285
+ var KEY_Y = 89;
42286
+ var HTMLMaskElement = class extends MaskElement {
42287
+ /** HTMLElement to use mask on */
42288
+ constructor(input) {
42289
+ super();
42290
+ this.input = input;
42291
+ this._onKeydown = this._onKeydown.bind(this);
42292
+ this._onInput = this._onInput.bind(this);
42293
+ this._onBeforeinput = this._onBeforeinput.bind(this);
42294
+ this._onCompositionEnd = this._onCompositionEnd.bind(this);
42295
+ }
42296
+ get rootElement() {
42297
+ var _this$input$getRootNo, _this$input$getRootNo2, _this$input;
42298
+ return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) == null ? void 0 : _this$input$getRootNo2.call(_this$input)) != null ? _this$input$getRootNo : document;
42299
+ }
42300
+ /** Is element in focus */
42301
+ get isActive() {
42302
+ return this.input === this.rootElement.activeElement;
42303
+ }
42304
+ /** Binds HTMLElement events to mask internal events */
42305
+ bindEvents(handlers) {
42306
+ this.input.addEventListener("keydown", this._onKeydown);
42307
+ this.input.addEventListener("input", this._onInput);
42308
+ this.input.addEventListener("beforeinput", this._onBeforeinput);
42309
+ this.input.addEventListener("compositionend", this._onCompositionEnd);
42310
+ this.input.addEventListener("drop", handlers.drop);
42311
+ this.input.addEventListener("click", handlers.click);
42312
+ this.input.addEventListener("focus", handlers.focus);
42313
+ this.input.addEventListener("blur", handlers.commit);
42314
+ this._handlers = handlers;
42315
+ }
42316
+ _onKeydown(e) {
42317
+ if (this._handlers.redo && (e.keyCode === KEY_Z && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === KEY_Y && e.ctrlKey)) {
42318
+ e.preventDefault();
42319
+ return this._handlers.redo(e);
42320
+ }
42321
+ if (this._handlers.undo && e.keyCode === KEY_Z && (e.metaKey || e.ctrlKey)) {
42322
+ e.preventDefault();
42323
+ return this._handlers.undo(e);
42324
+ }
42325
+ if (!e.isComposing)
42326
+ this._handlers.selectionChange(e);
42327
+ }
42328
+ _onBeforeinput(e) {
42329
+ if (e.inputType === "historyUndo" && this._handlers.undo) {
42330
+ e.preventDefault();
42331
+ return this._handlers.undo(e);
42332
+ }
42333
+ if (e.inputType === "historyRedo" && this._handlers.redo) {
42334
+ e.preventDefault();
42335
+ return this._handlers.redo(e);
42336
+ }
42337
+ }
42338
+ _onCompositionEnd(e) {
42339
+ this._handlers.input(e);
42340
+ }
42341
+ _onInput(e) {
42342
+ if (!e.isComposing)
42343
+ this._handlers.input(e);
42344
+ }
42345
+ /** Unbinds HTMLElement events to mask internal events */
42346
+ unbindEvents() {
42347
+ this.input.removeEventListener("keydown", this._onKeydown);
42348
+ this.input.removeEventListener("input", this._onInput);
42349
+ this.input.removeEventListener("beforeinput", this._onBeforeinput);
42350
+ this.input.removeEventListener("compositionend", this._onCompositionEnd);
42351
+ this.input.removeEventListener("drop", this._handlers.drop);
42352
+ this.input.removeEventListener("click", this._handlers.click);
42353
+ this.input.removeEventListener("focus", this._handlers.focus);
42354
+ this.input.removeEventListener("blur", this._handlers.commit);
42355
+ this._handlers = {};
42356
+ }
42357
+ };
42358
+ IMask.HTMLMaskElement = HTMLMaskElement;
42359
+
42360
+ // ../../node_modules/imask/esm/controls/html-input-mask-element.js
42361
+ var HTMLInputMaskElement = class extends HTMLMaskElement {
42362
+ /** InputElement to use mask on */
42363
+ constructor(input) {
42364
+ super(input);
42365
+ this.input = input;
42366
+ }
42367
+ /** Returns InputElement selection start */
42368
+ get _unsafeSelectionStart() {
42369
+ return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
42370
+ }
42371
+ /** Returns InputElement selection end */
42372
+ get _unsafeSelectionEnd() {
42373
+ return this.input.selectionEnd;
42374
+ }
42375
+ /** Sets InputElement selection */
42376
+ _unsafeSelect(start2, end2) {
42377
+ this.input.setSelectionRange(start2, end2);
42378
+ }
42379
+ get value() {
42380
+ return this.input.value;
42381
+ }
42382
+ set value(value) {
42383
+ this.input.value = value;
42384
+ }
42385
+ };
42386
+ IMask.HTMLMaskElement = HTMLMaskElement;
42387
+
42388
+ // ../../node_modules/imask/esm/controls/html-contenteditable-mask-element.js
42389
+ var HTMLContenteditableMaskElement = class extends HTMLMaskElement {
42390
+ /** Returns HTMLElement selection start */
42391
+ get _unsafeSelectionStart() {
42392
+ const root = this.rootElement;
42393
+ const selection = root.getSelection && root.getSelection();
42394
+ const anchorOffset = selection && selection.anchorOffset;
42395
+ const focusOffset = selection && selection.focusOffset;
42396
+ if (focusOffset == null || anchorOffset == null || anchorOffset < focusOffset) {
42397
+ return anchorOffset;
42398
+ }
42399
+ return focusOffset;
42400
+ }
42401
+ /** Returns HTMLElement selection end */
42402
+ get _unsafeSelectionEnd() {
42403
+ const root = this.rootElement;
42404
+ const selection = root.getSelection && root.getSelection();
42405
+ const anchorOffset = selection && selection.anchorOffset;
42406
+ const focusOffset = selection && selection.focusOffset;
40598
42407
  if (focusOffset == null || anchorOffset == null || anchorOffset > focusOffset) {
40599
42408
  return anchorOffset;
40600
42409
  }
@@ -42098,7 +43907,7 @@ var MaskedPattern = class _MaskedPattern extends Masked {
42098
43907
  if (bName) {
42099
43908
  const _a2 = normalizeOpts(this.blocks[bName]), {
42100
43909
  expose,
42101
- repeat
43910
+ repeat: repeat2
42102
43911
  } = _a2, bOpts = __objRest(_a2, [
42103
43912
  "expose",
42104
43913
  "repeat"
@@ -42111,10 +43920,10 @@ var MaskedPattern = class _MaskedPattern extends Masked {
42111
43920
  overwrite: this.overwrite,
42112
43921
  autofix: this.autofix
42113
43922
  }, bOpts), {
42114
- repeat,
43923
+ repeat: repeat2,
42115
43924
  parent: this
42116
43925
  });
42117
- const maskedBlock = repeat != null ? new IMask.RepeatBlock(
43926
+ const maskedBlock = repeat2 != null ? new IMask.RepeatBlock(
42118
43927
  blockOpts
42119
43928
  /* TODO */
42120
43929
  ) : createMask(blockOpts);
@@ -43183,10 +44992,10 @@ var MaskedNumber = class _MaskedNumber2 extends Masked {
43183
44992
  _updateRegExps() {
43184
44993
  const start2 = "^" + (this.allowNegative ? "[+|\\-]?" : "");
43185
44994
  const mid = "\\d*";
43186
- const end2 = (this.scale ? "(" + escapeRegExp(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
44995
+ const end2 = (this.scale ? "(" + escapeRegExp2(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
43187
44996
  this._numberRegExp = new RegExp(start2 + mid + end2);
43188
- this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(escapeRegExp).join("") + "]", "g");
43189
- this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), "g");
44997
+ this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(escapeRegExp2).join("") + "]", "g");
44998
+ this._thousandsSeparatorRegExp = new RegExp(escapeRegExp2(this.thousandsSeparator), "g");
43190
44999
  }
43191
45000
  _removeThousandsSeparators(value) {
43192
45001
  return value.replace(this._thousandsSeparatorRegExp, "");
@@ -43422,1185 +45231,392 @@ var MaskedNumber = class _MaskedNumber2 extends Masked {
43422
45231
  }
43423
45232
  get allowPositive() {
43424
45233
  return this.min != null && this.min > 0 || this.max != null && this.max > 0;
43425
- }
43426
- typedValueEquals(value) {
43427
- return (super.typedValueEquals(value) || _MaskedNumber2.EMPTY_VALUES.includes(value) && _MaskedNumber2.EMPTY_VALUES.includes(this.typedValue)) && !(value === 0 && this.value === "");
43428
- }
43429
- };
43430
- _MaskedNumber = MaskedNumber;
43431
- MaskedNumber.UNMASKED_RADIX = ".";
43432
- MaskedNumber.EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
43433
- MaskedNumber.DEFAULTS = __spreadProps(__spreadValues({}, Masked.DEFAULTS), {
43434
- mask: Number,
43435
- radix: ",",
43436
- thousandsSeparator: "",
43437
- mapToRadix: [_MaskedNumber.UNMASKED_RADIX],
43438
- min: Number.MIN_SAFE_INTEGER,
43439
- max: Number.MAX_SAFE_INTEGER,
43440
- scale: 2,
43441
- normalizeZeros: true,
43442
- padFractionalZeros: false,
43443
- parse: Number,
43444
- format: (n) => n.toLocaleString("en-US", {
43445
- useGrouping: false,
43446
- maximumFractionDigits: 20
43447
- })
43448
- });
43449
- IMask.MaskedNumber = MaskedNumber;
43450
-
43451
- // ../../node_modules/imask/esm/masked/pipe.js
43452
- var PIPE_TYPE = {
43453
- MASKED: "value",
43454
- UNMASKED: "unmaskedValue",
43455
- TYPED: "typedValue"
43456
- };
43457
- function createPipe(arg, from2, to) {
43458
- if (from2 === void 0) {
43459
- from2 = PIPE_TYPE.MASKED;
43460
- }
43461
- if (to === void 0) {
43462
- to = PIPE_TYPE.MASKED;
43463
- }
43464
- const masked = createMask(arg);
43465
- return (value) => masked.runIsolated((m) => {
43466
- m[from2] = value;
43467
- return m[to];
43468
- });
43469
- }
43470
- function pipe(value, mask, from2, to) {
43471
- return createPipe(mask, from2, to)(value);
43472
- }
43473
- IMask.PIPE_TYPE = PIPE_TYPE;
43474
- IMask.createPipe = createPipe;
43475
- IMask.pipe = pipe;
43476
-
43477
- // ../../node_modules/imask/esm/masked/repeat.js
43478
- var RepeatBlock = class extends MaskedPattern {
43479
- get repeatFrom() {
43480
- var _ref;
43481
- return (_ref = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === Infinity ? 0 : this.repeat) != null ? _ref : 0;
43482
- }
43483
- get repeatTo() {
43484
- var _ref2;
43485
- return (_ref2 = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? _ref2 : Infinity;
43486
- }
43487
- constructor(opts) {
43488
- super(opts);
43489
- }
43490
- updateOptions(opts) {
43491
- super.updateOptions(opts);
43492
- }
43493
- _update(opts) {
43494
- var _ref3, _ref4, _this$_blocks;
43495
- const _a2 = normalizeOpts(opts), {
43496
- repeat
43497
- } = _a2, blockOpts = __objRest(_a2, [
43498
- "repeat"
43499
- ]);
43500
- this._blockOpts = Object.assign({}, this._blockOpts, blockOpts);
43501
- const block = createMask(this._blockOpts);
43502
- this.repeat = (_ref3 = (_ref4 = repeat != null ? repeat : block.repeat) != null ? _ref4 : this.repeat) != null ? _ref3 : Infinity;
43503
- super._update({
43504
- mask: "m".repeat(Math.max(this.repeatTo === Infinity && ((_this$_blocks = this._blocks) == null ? void 0 : _this$_blocks.length) || 0, this.repeatFrom)),
43505
- blocks: {
43506
- m: block
43507
- },
43508
- eager: block.eager,
43509
- overwrite: block.overwrite,
43510
- skipInvalid: block.skipInvalid,
43511
- lazy: block.lazy,
43512
- placeholderChar: block.placeholderChar,
43513
- displayChar: block.displayChar
43514
- });
43515
- }
43516
- _allocateBlock(bi) {
43517
- if (bi < this._blocks.length)
43518
- return this._blocks[bi];
43519
- if (this.repeatTo === Infinity || this._blocks.length < this.repeatTo) {
43520
- this._blocks.push(createMask(this._blockOpts));
43521
- this.mask += "m";
43522
- return this._blocks[this._blocks.length - 1];
43523
- }
43524
- }
43525
- _appendCharRaw(ch, flags) {
43526
- if (flags === void 0) {
43527
- flags = {};
43528
- }
43529
- const details = new ChangeDetails();
43530
- for (
43531
- let bi = (_this$_mapPosToBlock$ = (_this$_mapPosToBlock = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : _this$_mapPosToBlock.index) != null ? _this$_mapPosToBlock$ : Math.max(this._blocks.length - 1, 0), block, allocated;
43532
- // try to get a block or
43533
- // try to allocate a new block if not allocated already
43534
- block = (_this$_blocks$bi = this._blocks[bi]) != null ? _this$_blocks$bi : allocated = !allocated && this._allocateBlock(bi);
43535
- ++bi
43536
- ) {
43537
- var _this$_mapPosToBlock$, _this$_mapPosToBlock, _this$_blocks$bi, _flags$_beforeTailSta;
43538
- const blockDetails = block._appendChar(ch, __spreadProps(__spreadValues({}, flags), {
43539
- _beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null || (_flags$_beforeTailSta = _flags$_beforeTailSta._blocks) == null ? void 0 : _flags$_beforeTailSta[bi]
43540
- }));
43541
- if (blockDetails.skip && allocated) {
43542
- this._blocks.pop();
43543
- this.mask = this.mask.slice(1);
43544
- break;
43545
- }
43546
- details.aggregate(blockDetails);
43547
- if (blockDetails.consumed)
43548
- break;
43549
- }
43550
- return details;
43551
- }
43552
- _trimEmptyTail(fromPos, toPos) {
43553
- var _this$_mapPosToBlock2, _this$_mapPosToBlock3;
43554
- if (fromPos === void 0) {
43555
- fromPos = 0;
43556
- }
43557
- const firstBlockIndex = Math.max(((_this$_mapPosToBlock2 = this._mapPosToBlock(fromPos)) == null ? void 0 : _this$_mapPosToBlock2.index) || 0, this.repeatFrom, 0);
43558
- let lastBlockIndex;
43559
- if (toPos != null)
43560
- lastBlockIndex = (_this$_mapPosToBlock3 = this._mapPosToBlock(toPos)) == null ? void 0 : _this$_mapPosToBlock3.index;
43561
- if (lastBlockIndex == null)
43562
- lastBlockIndex = this._blocks.length - 1;
43563
- let removeCount = 0;
43564
- for (let blockIndex = lastBlockIndex; firstBlockIndex <= blockIndex; --blockIndex, ++removeCount) {
43565
- if (this._blocks[blockIndex].unmaskedValue)
43566
- break;
43567
- }
43568
- if (removeCount) {
43569
- this._blocks.splice(lastBlockIndex - removeCount + 1, removeCount);
43570
- this.mask = this.mask.slice(removeCount);
43571
- }
43572
- }
43573
- reset() {
43574
- super.reset();
43575
- this._trimEmptyTail();
43576
- }
43577
- remove(fromPos, toPos) {
43578
- if (fromPos === void 0) {
43579
- fromPos = 0;
43580
- }
43581
- if (toPos === void 0) {
43582
- toPos = this.displayValue.length;
43583
- }
43584
- const removeDetails = super.remove(fromPos, toPos);
43585
- this._trimEmptyTail(fromPos, toPos);
43586
- return removeDetails;
43587
- }
43588
- totalInputPositions(fromPos, toPos) {
43589
- if (fromPos === void 0) {
43590
- fromPos = 0;
43591
- }
43592
- if (toPos == null && this.repeatTo === Infinity)
43593
- return Infinity;
43594
- return super.totalInputPositions(fromPos, toPos);
43595
- }
43596
- get state() {
43597
- return super.state;
43598
- }
43599
- set state(state) {
43600
- this._blocks.length = state._blocks.length;
43601
- this.mask = this.mask.slice(0, this._blocks.length);
43602
- super.state = state;
43603
- }
43604
- };
43605
- IMask.RepeatBlock = RepeatBlock;
43606
-
43607
- // ../../node_modules/imask/esm/index.js
43608
- try {
43609
- globalThis.IMask = IMask;
43610
- } catch (e) {
43611
- }
43612
-
43613
- // ../../node_modules/react-imask/esm/input.js
43614
- import React178 from "react";
43615
-
43616
- // ../../node_modules/react-imask/esm/mixin.js
43617
- var import_prop_types92 = __toESM(require_prop_types(), 1);
43618
- import React177 from "react";
43619
- var MASK_PROPS = {
43620
- // common
43621
- mask: import_prop_types92.default.oneOfType([import_prop_types92.default.array, import_prop_types92.default.func, import_prop_types92.default.string, import_prop_types92.default.instanceOf(RegExp), import_prop_types92.default.oneOf([Date, Number, IMask.Masked]), import_prop_types92.default.instanceOf(IMask.Masked)]),
43622
- value: import_prop_types92.default.any,
43623
- unmask: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["typed"])]),
43624
- prepare: import_prop_types92.default.func,
43625
- prepareChar: import_prop_types92.default.func,
43626
- validate: import_prop_types92.default.func,
43627
- commit: import_prop_types92.default.func,
43628
- overwrite: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["shift"])]),
43629
- eager: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["append", "remove"])]),
43630
- skipInvalid: import_prop_types92.default.bool,
43631
- // events
43632
- onAccept: import_prop_types92.default.func,
43633
- onComplete: import_prop_types92.default.func,
43634
- // pattern
43635
- placeholderChar: import_prop_types92.default.string,
43636
- displayChar: import_prop_types92.default.string,
43637
- lazy: import_prop_types92.default.bool,
43638
- definitions: import_prop_types92.default.object,
43639
- blocks: import_prop_types92.default.object,
43640
- // enum
43641
- enum: import_prop_types92.default.arrayOf(import_prop_types92.default.string),
43642
- // range
43643
- maxLength: import_prop_types92.default.number,
43644
- from: import_prop_types92.default.number,
43645
- to: import_prop_types92.default.number,
43646
- // date
43647
- pattern: import_prop_types92.default.string,
43648
- format: import_prop_types92.default.func,
43649
- parse: import_prop_types92.default.func,
43650
- autofix: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["pad"])]),
43651
- // number
43652
- radix: import_prop_types92.default.string,
43653
- thousandsSeparator: import_prop_types92.default.string,
43654
- mapToRadix: import_prop_types92.default.arrayOf(import_prop_types92.default.string),
43655
- scale: import_prop_types92.default.number,
43656
- normalizeZeros: import_prop_types92.default.bool,
43657
- padFractionalZeros: import_prop_types92.default.bool,
43658
- min: import_prop_types92.default.oneOfType([import_prop_types92.default.number, import_prop_types92.default.instanceOf(Date)]),
43659
- max: import_prop_types92.default.oneOfType([import_prop_types92.default.number, import_prop_types92.default.instanceOf(Date)]),
43660
- // dynamic
43661
- dispatch: import_prop_types92.default.func,
43662
- // ref
43663
- inputRef: import_prop_types92.default.oneOfType([import_prop_types92.default.func, import_prop_types92.default.shape({
43664
- current: import_prop_types92.default.object
43665
- })])
43666
- };
43667
- var MASK_PROPS_NAMES = Object.keys(MASK_PROPS).filter((p) => p !== "value");
43668
- var NON_MASK_OPTIONS_NAMES = ["value", "unmask", "onAccept", "onComplete", "inputRef"];
43669
- var MASK_OPTIONS_NAMES = MASK_PROPS_NAMES.filter((pName) => NON_MASK_OPTIONS_NAMES.indexOf(pName) < 0);
43670
- function IMaskMixin(ComposedComponent) {
43671
- var _Class;
43672
- const MaskedComponent = (_Class = class MaskedComponent extends React177.Component {
43673
- constructor(props) {
43674
- super(props);
43675
- this._inputRef = this._inputRef.bind(this);
43676
- }
43677
- componentDidMount() {
43678
- if (!this.props.mask)
43679
- return;
43680
- this.initMask();
43681
- }
43682
- componentDidUpdate() {
43683
- const props = this.props;
43684
- const maskOptions = this._extractMaskOptionsFromProps(props);
43685
- if (maskOptions.mask) {
43686
- if (this.maskRef) {
43687
- this.maskRef.updateOptions(maskOptions);
43688
- if ("value" in props && props.value !== void 0)
43689
- this.maskValue = props.value;
43690
- } else {
43691
- this.initMask(maskOptions);
43692
- }
43693
- } else {
43694
- this.destroyMask();
43695
- if ("value" in props && props.value !== void 0) {
43696
- var _this$element;
43697
- if ((_this$element = this.element) != null && _this$element.isContentEditable && this.element.tagName !== "INPUT" && this.element.tagName !== "TEXTAREA")
43698
- this.element.textContent = props.value;
43699
- else
43700
- this.element.value = props.value;
43701
- }
43702
- }
43703
- }
43704
- componentWillUnmount() {
43705
- this.destroyMask();
43706
- }
43707
- _inputRef(el) {
43708
- this.element = el;
43709
- if (this.props.inputRef) {
43710
- if (Object.prototype.hasOwnProperty.call(this.props.inputRef, "current"))
43711
- this.props.inputRef.current = el;
43712
- else
43713
- this.props.inputRef(el);
43714
- }
43715
- }
43716
- initMask(maskOptions) {
43717
- if (maskOptions === void 0) {
43718
- maskOptions = this._extractMaskOptionsFromProps(this.props);
43719
- }
43720
- this.maskRef = IMask(this.element, maskOptions).on("accept", this._onAccept.bind(this)).on("complete", this._onComplete.bind(this));
43721
- if ("value" in this.props && this.props.value !== void 0)
43722
- this.maskValue = this.props.value;
43723
- }
43724
- destroyMask() {
43725
- if (this.maskRef) {
43726
- this.maskRef.destroy();
43727
- delete this.maskRef;
43728
- }
43729
- }
43730
- _extractMaskOptionsFromProps(props) {
43731
- const cloneProps = __objRest(props, []);
43732
- Object.keys(cloneProps).filter((prop) => MASK_OPTIONS_NAMES.indexOf(prop) < 0).forEach((nonMaskProp) => {
43733
- delete cloneProps[nonMaskProp];
43734
- });
43735
- return cloneProps;
43736
- }
43737
- _extractNonMaskProps(props) {
43738
- const cloneProps = __objRest(props, []);
43739
- MASK_PROPS_NAMES.forEach((maskProp) => {
43740
- if (maskProp !== "maxLength")
43741
- delete cloneProps[maskProp];
43742
- });
43743
- if (!("defaultValue" in cloneProps))
43744
- cloneProps.defaultValue = props.mask ? "" : cloneProps.value;
43745
- delete cloneProps.value;
43746
- return cloneProps;
43747
- }
43748
- get maskValue() {
43749
- if (!this.maskRef)
43750
- return "";
43751
- if (this.props.unmask === "typed")
43752
- return this.maskRef.typedValue;
43753
- if (this.props.unmask)
43754
- return this.maskRef.unmaskedValue;
43755
- return this.maskRef.value;
43756
- }
43757
- set maskValue(value) {
43758
- if (!this.maskRef)
43759
- return;
43760
- value = value == null && this.props.unmask !== "typed" ? "" : value;
43761
- if (this.props.unmask === "typed")
43762
- this.maskRef.typedValue = value;
43763
- else if (this.props.unmask)
43764
- this.maskRef.unmaskedValue = value;
43765
- else
43766
- this.maskRef.value = value;
43767
- }
43768
- _onAccept(e) {
43769
- if (this.props.onAccept && this.maskRef)
43770
- this.props.onAccept(this.maskValue, this.maskRef, e);
43771
- }
43772
- _onComplete(e) {
43773
- if (this.props.onComplete && this.maskRef)
43774
- this.props.onComplete(this.maskValue, this.maskRef, e);
43775
- }
43776
- render() {
43777
- return React177.createElement(ComposedComponent, __spreadProps(__spreadValues({}, this._extractNonMaskProps(this.props)), {
43778
- inputRef: this._inputRef
43779
- }));
43780
- }
43781
- }, _Class.displayName = void 0, _Class.propTypes = void 0, _Class);
43782
- const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || "Component";
43783
- MaskedComponent.displayName = "IMask(" + nestedComponentName + ")";
43784
- MaskedComponent.propTypes = MASK_PROPS;
43785
- return React177.forwardRef((props, ref) => React177.createElement(MaskedComponent, __spreadProps(__spreadValues({}, props), {
43786
- ref
43787
- })));
43788
- }
43789
-
43790
- // ../../node_modules/react-imask/esm/input.js
43791
- var IMaskInputClass = IMaskMixin((_ref) => {
43792
- let _a2 = _ref, {
43793
- inputRef
43794
- } = _a2, props = __objRest(_a2, [
43795
- "inputRef"
43796
- ]);
43797
- return React178.createElement("input", __spreadProps(__spreadValues({}, props), {
43798
- ref: inputRef
43799
- }));
43800
- });
43801
- var IMaskInputFn = (props, ref) => React178.createElement(IMaskInputClass, __spreadProps(__spreadValues({}, props), {
43802
- ref
43803
- }));
43804
- var IMaskInput = React178.forwardRef(IMaskInputFn);
43805
-
43806
- // ../../node_modules/react-imask/esm/hook.js
43807
- import { useRef as useRef43, useState as useState25, useCallback as useCallback26, useEffect as useEffect36 } from "react";
43808
-
43809
- // ../../node_modules/react-imask/esm/index.js
43810
- import "react";
43811
-
43812
- // ../../node_modules/@mui/icons-material/esm/InfoOutlined.js
43813
- import { jsx as _jsx108 } from "react/jsx-runtime";
43814
- var InfoOutlined_default = createSvgIcon2(/* @__PURE__ */ _jsx108("path", {
43815
- d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
43816
- }), "InfoOutlined");
43817
-
43818
- // src/components/Input/Input.tsx
43819
- import { motion as motion15 } from "framer-motion";
43820
- var MotionInput = motion15(Input_default);
43821
- var Input3 = (props) => {
43822
- const _a2 = props, {
43823
- label,
43824
- helperText,
43825
- error,
43826
- style: style4,
43827
- size,
43828
- color: color2,
43829
- disabled,
43830
- required
43831
- } = _a2, innerProps = __objRest(_a2, [
43832
- "label",
43833
- "helperText",
43834
- "error",
43835
- "style",
43836
- "size",
43837
- "color",
43838
- "disabled",
43839
- "required"
43840
- ]);
43841
- if (label) {
43842
- return /* @__PURE__ */ jsxs2(
43843
- FormControl_default2,
43844
- {
43845
- required,
43846
- color: color2,
43847
- size,
43848
- error,
43849
- disabled,
43850
- children: [
43851
- /* @__PURE__ */ jsx2(FormLabel_default2, { children: label }),
43852
- /* @__PURE__ */ jsx2(MotionInput, __spreadValues({}, innerProps)),
43853
- helperText && /* @__PURE__ */ jsx2(FormHelperText_default2, { children: helperText })
43854
- ]
43855
- }
43856
- );
43857
- }
43858
- return /* @__PURE__ */ jsx2(
43859
- MotionInput,
43860
- __spreadValues({
43861
- required,
43862
- color: color2,
43863
- size,
43864
- disabled
43865
- }, innerProps)
43866
- );
45234
+ }
45235
+ typedValueEquals(value) {
45236
+ return (super.typedValueEquals(value) || _MaskedNumber2.EMPTY_VALUES.includes(value) && _MaskedNumber2.EMPTY_VALUES.includes(this.typedValue)) && !(value === 0 && this.value === "");
45237
+ }
43867
45238
  };
43868
- Input3.displayName = "Input";
45239
+ _MaskedNumber = MaskedNumber;
45240
+ MaskedNumber.UNMASKED_RADIX = ".";
45241
+ MaskedNumber.EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
45242
+ MaskedNumber.DEFAULTS = __spreadProps(__spreadValues({}, Masked.DEFAULTS), {
45243
+ mask: Number,
45244
+ radix: ",",
45245
+ thousandsSeparator: "",
45246
+ mapToRadix: [_MaskedNumber.UNMASKED_RADIX],
45247
+ min: Number.MIN_SAFE_INTEGER,
45248
+ max: Number.MAX_SAFE_INTEGER,
45249
+ scale: 2,
45250
+ normalizeZeros: true,
45251
+ padFractionalZeros: false,
45252
+ parse: Number,
45253
+ format: (n) => n.toLocaleString("en-US", {
45254
+ useGrouping: false,
45255
+ maximumFractionDigits: 20
45256
+ })
45257
+ });
45258
+ IMask.MaskedNumber = MaskedNumber;
43869
45259
 
43870
- // src/components/Input/index.ts
43871
- var Input_default2 = Input3;
45260
+ // ../../node_modules/imask/esm/masked/pipe.js
45261
+ var PIPE_TYPE = {
45262
+ MASKED: "value",
45263
+ UNMASKED: "unmaskedValue",
45264
+ TYPED: "typedValue"
45265
+ };
45266
+ function createPipe(arg, from2, to) {
45267
+ if (from2 === void 0) {
45268
+ from2 = PIPE_TYPE.MASKED;
45269
+ }
45270
+ if (to === void 0) {
45271
+ to = PIPE_TYPE.MASKED;
45272
+ }
45273
+ const masked = createMask(arg);
45274
+ return (value) => masked.runIsolated((m) => {
45275
+ m[from2] = value;
45276
+ return m[to];
45277
+ });
45278
+ }
45279
+ function pipe(value, mask, from2, to) {
45280
+ return createPipe(mask, from2, to)(value);
45281
+ }
45282
+ IMask.PIPE_TYPE = PIPE_TYPE;
45283
+ IMask.createPipe = createPipe;
45284
+ IMask.pipe = pipe;
43872
45285
 
43873
- // src/components/CurrencyInput/CurrencyInput.tsx
43874
- function getCurrencySymbol(currencyCode) {
43875
- const formatted = new Intl.NumberFormat("en-us", {
43876
- style: "currency",
43877
- currency: currencyCode
43878
- }).format(0);
43879
- return formatted.replace(/[\d\s.,]/g, "");
43880
- }
43881
- var TextMaskAdapter = React179.forwardRef(
43882
- function TextMaskAdapter2(props, ref) {
43883
- const _a2 = props, { onChange, currency } = _a2, innerProps = __objRest(_a2, ["onChange", "currency"]);
43884
- const [value, setValue] = useState26(props.value || 0);
43885
- const currencySymbol = getCurrencySymbol(currency);
43886
- return /* @__PURE__ */ jsx2(
43887
- IMaskInput,
43888
- __spreadProps(__spreadValues({}, innerProps), {
43889
- inputRef: ref,
43890
- mask: `${currencySymbol}num`,
43891
- lazy: false,
43892
- overwrite: true,
43893
- onAccept: (value2) => {
43894
- setValue(Number(value2));
43895
- onChange({
43896
- target: {
43897
- name: props.name,
43898
- value: value2
43899
- }
43900
- });
43901
- },
43902
- value: value.toString(),
43903
- unmask: true,
43904
- blocks: {
43905
- num: {
43906
- mask: Number,
43907
- thousandsSeparator: ",",
43908
- radix: ".",
43909
- expose: true,
43910
- scale: 2,
43911
- padFractionalZeros: currency !== "krw"
43912
- }
43913
- },
43914
- placeholder: `${currencySymbol}0.00`
43915
- })
43916
- );
45286
+ // ../../node_modules/imask/esm/masked/repeat.js
45287
+ var RepeatBlock = class extends MaskedPattern {
45288
+ get repeatFrom() {
45289
+ var _ref;
45290
+ return (_ref = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === Infinity ? 0 : this.repeat) != null ? _ref : 0;
43917
45291
  }
43918
- );
43919
- var CurrencyInput = React179.forwardRef(
43920
- function CurrencyInput2(props, ref) {
43921
- const _a2 = props, {
43922
- currency = "usd",
43923
- max: max2 = 1e5,
43924
- name,
43925
- onChange,
43926
- label,
43927
- error,
43928
- helperText,
43929
- required,
43930
- disabled
43931
- } = _a2, innerProps = __objRest(_a2, [
43932
- "currency",
43933
- "max",
43934
- "name",
43935
- "onChange",
43936
- "label",
43937
- "error",
43938
- "helperText",
43939
- "required",
43940
- "disabled"
45292
+ get repeatTo() {
45293
+ var _ref2;
45294
+ return (_ref2 = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? _ref2 : Infinity;
45295
+ }
45296
+ constructor(opts) {
45297
+ super(opts);
45298
+ }
45299
+ updateOptions(opts) {
45300
+ super.updateOptions(opts);
45301
+ }
45302
+ _update(opts) {
45303
+ var _ref3, _ref4, _this$_blocks;
45304
+ const _a2 = normalizeOpts(opts), {
45305
+ repeat: repeat2
45306
+ } = _a2, blockOpts = __objRest(_a2, [
45307
+ "repeat"
43941
45308
  ]);
43942
- const [isOverLimit, setIsOverLimit] = useState26(
43943
- !!props.value && props.value > Number(max2)
43944
- );
43945
- const handleChange = useCallback27(
43946
- (event) => {
43947
- const amount = Number(event.target.value);
43948
- onChange == null ? void 0 : onChange(__spreadProps(__spreadValues({}, event), { target: { name, value: amount } }));
43949
- if (amount > Number(max2)) {
43950
- setIsOverLimit(true);
43951
- } else {
43952
- setIsOverLimit(false);
43953
- }
45309
+ this._blockOpts = Object.assign({}, this._blockOpts, blockOpts);
45310
+ const block = createMask(this._blockOpts);
45311
+ this.repeat = (_ref3 = (_ref4 = repeat2 != null ? repeat2 : block.repeat) != null ? _ref4 : this.repeat) != null ? _ref3 : Infinity;
45312
+ super._update({
45313
+ mask: "m".repeat(Math.max(this.repeatTo === Infinity && ((_this$_blocks = this._blocks) == null ? void 0 : _this$_blocks.length) || 0, this.repeatFrom)),
45314
+ blocks: {
45315
+ m: block
43954
45316
  },
43955
- []
43956
- );
43957
- const currencyFormatter = /* @__PURE__ */ jsx2(
43958
- Input_default2,
43959
- __spreadValues({
43960
- size: "sm",
43961
- ref,
43962
- onChange: handleChange,
43963
- disabled,
43964
- required,
43965
- slotProps: { input: { component: TextMaskAdapter, currency, max: max2 } },
43966
- sx: {
43967
- fontFamily: "monospace"
43968
- }
43969
- }, innerProps)
43970
- );
43971
- if (label) {
43972
- return /* @__PURE__ */ jsxs2(
43973
- FormControl_default2,
43974
- {
43975
- size: "sm",
43976
- disabled,
43977
- required,
43978
- error: error || isOverLimit,
43979
- children: [
43980
- /* @__PURE__ */ jsx2(FormLabel_default2, { children: label }),
43981
- currencyFormatter,
43982
- isOverLimit ? /* @__PURE__ */ jsxs2(FormHelperText_default2, { children: [
43983
- /* @__PURE__ */ jsx2(InfoOutlined_default, {}),
43984
- new IntlMessageFormat(
43985
- `limit: {amount, number, ::currency/${currency} unit-width-narrow}`
43986
- ).format({ amount: max2 })
43987
- ] }) : helperText && /* @__PURE__ */ jsx2(FormHelperText_default2, { children: helperText })
43988
- ]
43989
- }
43990
- );
45317
+ eager: block.eager,
45318
+ overwrite: block.overwrite,
45319
+ skipInvalid: block.skipInvalid,
45320
+ lazy: block.lazy,
45321
+ placeholderChar: block.placeholderChar,
45322
+ displayChar: block.displayChar
45323
+ });
45324
+ }
45325
+ _allocateBlock(bi) {
45326
+ if (bi < this._blocks.length)
45327
+ return this._blocks[bi];
45328
+ if (this.repeatTo === Infinity || this._blocks.length < this.repeatTo) {
45329
+ this._blocks.push(createMask(this._blockOpts));
45330
+ this.mask += "m";
45331
+ return this._blocks[this._blocks.length - 1];
43991
45332
  }
43992
- return currencyFormatter;
43993
45333
  }
43994
- );
43995
-
43996
- // src/components/DataTable/DataTable.tsx
43997
- import {
43998
- useCallback as useCallback28,
43999
- useEffect as useEffect37,
44000
- useMemo as useMemo35,
44001
- useRef as useRef44,
44002
- useState as useState27
44003
- } from "react";
44004
-
44005
- // src/components/Sheet/Sheet.tsx
44006
- import { motion as motion16 } from "framer-motion";
44007
- var MotionSheet = motion16(Sheet_default);
44008
- var Sheet3 = MotionSheet;
44009
- Sheet3.displayName = "Sheet";
44010
-
44011
- // src/components/Sheet/index.ts
44012
- var Sheet_default2 = Sheet3;
44013
-
44014
- // src/components/Table/Table.tsx
44015
- var Table3 = (props) => {
44016
- const _a2 = props, { children } = _a2, inheritProps = __objRest(_a2, ["children"]);
44017
- return /* @__PURE__ */ jsx2(Table_default, __spreadProps(__spreadValues({}, inheritProps), { children }));
44018
- };
44019
- Table3.displayName = "Table";
44020
- function TableHead(props) {
44021
- const {
44022
- headCells,
44023
- showCheckbox,
44024
- onCheckboxChange,
44025
- slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
44026
- slotProps: { checkbox: checkboxProps = {} } = {}
44027
- } = props;
44028
- return /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
44029
- showCheckbox && /* @__PURE__ */ jsx2(
44030
- "th",
44031
- {
44032
- style: {
44033
- width: "40px",
44034
- textAlign: "center"
44035
- },
44036
- children: /* @__PURE__ */ jsx2(RenderCheckbox, __spreadValues({ onChange: onCheckboxChange }, checkboxProps))
44037
- }
44038
- ),
44039
- headCells.map((headCell) => /* @__PURE__ */ jsx2(
44040
- "th",
44041
- {
44042
- style: {
44043
- width: headCell.width,
44044
- minWidth: headCell.minWidth,
44045
- maxWidth: headCell.maxWidth,
44046
- textAlign: headCell.numeric ? "right" : "left"
44047
- },
44048
- children: headCell.label
44049
- },
44050
- headCell.label
44051
- ))
44052
- ] }) });
44053
- }
44054
- TableHead.displayName = "TableHead";
44055
- function TableBody(props) {
44056
- const {
44057
- rows,
44058
- cellOrder,
44059
- rowOptions,
44060
- showCheckbox,
44061
- onCheckboxChange,
44062
- slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
44063
- slotProps: { checkbox: checkboxProps = {} } = {}
44064
- } = props;
44065
- return /* @__PURE__ */ jsx2("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs2("tr", { children: [
44066
- showCheckbox && /* @__PURE__ */ jsx2(
44067
- "td",
44068
- {
44069
- style: {
44070
- textAlign: "center"
44071
- },
44072
- children: /* @__PURE__ */ jsx2(
44073
- RenderCheckbox,
44074
- __spreadValues({
44075
- onChange: (event) => onCheckboxChange == null ? void 0 : onCheckboxChange(event, rowIndex)
44076
- }, checkboxProps)
44077
- )
45334
+ _appendCharRaw(ch, flags) {
45335
+ if (flags === void 0) {
45336
+ flags = {};
45337
+ }
45338
+ const details = new ChangeDetails();
45339
+ for (
45340
+ let bi = (_this$_mapPosToBlock$ = (_this$_mapPosToBlock = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : _this$_mapPosToBlock.index) != null ? _this$_mapPosToBlock$ : Math.max(this._blocks.length - 1, 0), block, allocated;
45341
+ // try to get a block or
45342
+ // try to allocate a new block if not allocated already
45343
+ block = (_this$_blocks$bi = this._blocks[bi]) != null ? _this$_blocks$bi : allocated = !allocated && this._allocateBlock(bi);
45344
+ ++bi
45345
+ ) {
45346
+ var _this$_mapPosToBlock$, _this$_mapPosToBlock, _this$_blocks$bi, _flags$_beforeTailSta;
45347
+ const blockDetails = block._appendChar(ch, __spreadProps(__spreadValues({}, flags), {
45348
+ _beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null || (_flags$_beforeTailSta = _flags$_beforeTailSta._blocks) == null ? void 0 : _flags$_beforeTailSta[bi]
45349
+ }));
45350
+ if (blockDetails.skip && allocated) {
45351
+ this._blocks.pop();
45352
+ this.mask = this.mask.slice(1);
45353
+ break;
44078
45354
  }
44079
- ),
44080
- cellOrder.map((cellKey) => {
44081
- var _a2;
44082
- return /* @__PURE__ */ jsx2(
44083
- "td",
44084
- {
44085
- style: {
44086
- textAlign: ((_a2 = rowOptions == null ? void 0 : rowOptions[cellKey]) == null ? void 0 : _a2.numeric) ? "right" : "left"
44087
- },
44088
- children: row[cellKey]
44089
- },
44090
- cellKey
44091
- );
44092
- })
44093
- ] }, rowIndex)) });
44094
- }
44095
- TableBody.displayName = "TableBody";
44096
-
44097
- // src/components/DataTable/DataTable.tsx
44098
- var OverlayWrapper = styled_default2("tr", {
44099
- name: "DataTable",
44100
- slot: "overlayWrapper"
44101
- })({
44102
- position: "sticky",
44103
- top: `calc(var(--unstable_TableCell-height, 32px))`,
44104
- left: 0,
44105
- right: 0,
44106
- zIndex: 1,
44107
- "& > td": {
44108
- height: 0,
44109
- padding: 0,
44110
- border: "none !important"
45355
+ details.aggregate(blockDetails);
45356
+ if (blockDetails.consumed)
45357
+ break;
45358
+ }
45359
+ return details;
44111
45360
  }
44112
- });
44113
- var numberFormatter = (value) => "Intl" in window ? new Intl.NumberFormat().format(value) : value;
44114
- function TablePagination(props) {
44115
- const {
44116
- paginationModel: { page, pageSize: pageSize2 },
44117
- rowCount,
44118
- onPageChange
44119
- } = props;
44120
- const firstPage = 1;
44121
- const lastPage = Math.ceil(rowCount / pageSize2);
44122
- const beforePages = [page - 2, page - 1].filter((p) => p > 1);
44123
- const afterPages = [page + 1, page + 2].filter((p) => p <= lastPage - 1);
44124
- const isMoreAfterPages = lastPage > 1 && page < lastPage - 3;
44125
- const isMoreBeforePages = lastPage > 1 && page > 4;
44126
- return /* @__PURE__ */ jsx2(
44127
- Stack_default2,
44128
- {
44129
- direction: "row",
44130
- spacing: 1,
44131
- sx: {
44132
- pt: 1,
44133
- pb: 1
44134
- },
44135
- justifyContent: "end",
44136
- alignItems: "center",
44137
- children: /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 0.5, alignItems: "center", children: [
44138
- /* @__PURE__ */ jsx2(
44139
- IconButton_default2,
44140
- {
44141
- size: "sm",
44142
- variant: "plain",
44143
- color: "neutral",
44144
- onClick: () => onPageChange(page - 1),
44145
- disabled: page === firstPage,
44146
- "aria-label": "Previous page",
44147
- children: /* @__PURE__ */ jsx2(ChevronLeft_default, {})
44148
- }
44149
- ),
44150
- page !== firstPage && /* @__PURE__ */ jsx2(
44151
- Button_default2,
44152
- {
44153
- size: "sm",
44154
- variant: "plain",
44155
- color: "neutral",
44156
- onClick: () => onPageChange(firstPage),
44157
- children: firstPage
44158
- }
44159
- ),
44160
- isMoreBeforePages && /* @__PURE__ */ jsx2(
44161
- Button_default2,
44162
- {
44163
- size: "sm",
44164
- variant: "plain",
44165
- color: "neutral",
44166
- onClick: () => onPageChange(page - 3),
44167
- children: "..."
44168
- }
44169
- ),
44170
- beforePages.map((p) => /* @__PURE__ */ jsx2(
44171
- Button_default2,
44172
- {
44173
- size: "sm",
44174
- variant: "plain",
44175
- color: "neutral",
44176
- onClick: () => onPageChange(p),
44177
- children: p
44178
- },
44179
- p
44180
- )),
44181
- /* @__PURE__ */ jsx2(Button_default2, { variant: "soft", size: "sm", children: page }),
44182
- afterPages.map((p) => /* @__PURE__ */ jsx2(
44183
- Button_default2,
44184
- {
44185
- size: "sm",
44186
- variant: "plain",
44187
- color: "neutral",
44188
- onClick: () => onPageChange(p),
44189
- children: p
44190
- },
44191
- p
44192
- )),
44193
- isMoreAfterPages && /* @__PURE__ */ jsx2(
44194
- Button_default2,
44195
- {
44196
- size: "sm",
44197
- variant: "plain",
44198
- color: "neutral",
44199
- onClick: () => onPageChange(page + 3),
44200
- children: "..."
44201
- }
44202
- ),
44203
- page !== lastPage && /* @__PURE__ */ jsx2(
44204
- Button_default2,
44205
- {
44206
- size: "sm",
44207
- variant: "plain",
44208
- color: "neutral",
44209
- onClick: () => onPageChange(lastPage),
44210
- children: lastPage
44211
- }
44212
- ),
44213
- /* @__PURE__ */ jsx2(
44214
- IconButton_default2,
44215
- {
44216
- size: "sm",
44217
- variant: "plain",
44218
- color: "neutral",
44219
- onClick: () => onPageChange(page + 1),
44220
- disabled: page === lastPage,
44221
- "aria-label": "Next page",
44222
- children: /* @__PURE__ */ jsx2(ChevronRight_default, {})
44223
- }
44224
- )
44225
- ] })
45361
+ _trimEmptyTail(fromPos, toPos) {
45362
+ var _this$_mapPosToBlock2, _this$_mapPosToBlock3;
45363
+ if (fromPos === void 0) {
45364
+ fromPos = 0;
44226
45365
  }
44227
- );
44228
- }
44229
- var Resizer = (ref) => /* @__PURE__ */ jsx2(
44230
- Box_default2,
44231
- {
44232
- sx: {
44233
- position: "absolute",
44234
- top: 0,
44235
- right: 0,
44236
- bottom: 0,
44237
- width: "4px",
44238
- cursor: "col-resize"
44239
- },
44240
- onMouseDown: (e) => {
44241
- var _a2;
44242
- const initialX = e.clientX;
44243
- const initialWidth = (_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().width;
44244
- const onMouseMove = (e2) => {
44245
- if (initialWidth && initialX) {
44246
- ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
44247
- }
44248
- };
44249
- const onMouseUp = () => {
44250
- document.removeEventListener("mousemove", onMouseMove);
44251
- document.removeEventListener("mouseup", onMouseUp);
44252
- };
44253
- document.addEventListener("mousemove", onMouseMove);
44254
- document.addEventListener("mouseup", onMouseUp);
45366
+ const firstBlockIndex = Math.max(((_this$_mapPosToBlock2 = this._mapPosToBlock(fromPos)) == null ? void 0 : _this$_mapPosToBlock2.index) || 0, this.repeatFrom, 0);
45367
+ let lastBlockIndex;
45368
+ if (toPos != null)
45369
+ lastBlockIndex = (_this$_mapPosToBlock3 = this._mapPosToBlock(toPos)) == null ? void 0 : _this$_mapPosToBlock3.index;
45370
+ if (lastBlockIndex == null)
45371
+ lastBlockIndex = this._blocks.length - 1;
45372
+ let removeCount = 0;
45373
+ for (let blockIndex = lastBlockIndex; firstBlockIndex <= blockIndex; --blockIndex, ++removeCount) {
45374
+ if (this._blocks[blockIndex].unmaskedValue)
45375
+ break;
45376
+ }
45377
+ if (removeCount) {
45378
+ this._blocks.splice(lastBlockIndex - removeCount + 1, removeCount);
45379
+ this.mask = this.mask.slice(removeCount);
44255
45380
  }
44256
45381
  }
44257
- );
44258
- var HeadCell = (props) => {
44259
- var _a2, _b, _c;
44260
- const ref = useRef44(null);
44261
- const style4 = {
44262
- width: props.width,
44263
- minWidth: (_a2 = props.minWidth) != null ? _a2 : "50px",
44264
- maxWidth: props.maxWidth,
44265
- textAlign: props.type === "number" ? "end" : "start",
44266
- position: props.stickyHeader ? void 0 : "relative"
44267
- };
44268
- const resizer = ((_b = props.resizable) != null ? _b : true) ? Resizer(ref) : null;
44269
- return /* @__PURE__ */ jsxs2("th", { ref, style: style4, children: [
44270
- (_c = props.headerName) != null ? _c : props.field,
44271
- resizer
44272
- ] }, props.field);
45382
+ reset() {
45383
+ super.reset();
45384
+ this._trimEmptyTail();
45385
+ }
45386
+ remove(fromPos, toPos) {
45387
+ if (fromPos === void 0) {
45388
+ fromPos = 0;
45389
+ }
45390
+ if (toPos === void 0) {
45391
+ toPos = this.displayValue.length;
45392
+ }
45393
+ const removeDetails = super.remove(fromPos, toPos);
45394
+ this._trimEmptyTail(fromPos, toPos);
45395
+ return removeDetails;
45396
+ }
45397
+ totalInputPositions(fromPos, toPos) {
45398
+ if (fromPos === void 0) {
45399
+ fromPos = 0;
45400
+ }
45401
+ if (toPos == null && this.repeatTo === Infinity)
45402
+ return Infinity;
45403
+ return super.totalInputPositions(fromPos, toPos);
45404
+ }
45405
+ get state() {
45406
+ return super.state;
45407
+ }
45408
+ set state(state) {
45409
+ this._blocks.length = state._blocks.length;
45410
+ this.mask = this.mask.slice(0, this._blocks.length);
45411
+ super.state = state;
45412
+ }
45413
+ };
45414
+ IMask.RepeatBlock = RepeatBlock;
45415
+
45416
+ // ../../node_modules/imask/esm/index.js
45417
+ try {
45418
+ globalThis.IMask = IMask;
45419
+ } catch (e) {
45420
+ }
45421
+
45422
+ // ../../node_modules/react-imask/esm/input.js
45423
+ import React181 from "react";
45424
+
45425
+ // ../../node_modules/react-imask/esm/mixin.js
45426
+ var import_prop_types92 = __toESM(require_prop_types(), 1);
45427
+ import React180 from "react";
45428
+ var MASK_PROPS = {
45429
+ // common
45430
+ mask: import_prop_types92.default.oneOfType([import_prop_types92.default.array, import_prop_types92.default.func, import_prop_types92.default.string, import_prop_types92.default.instanceOf(RegExp), import_prop_types92.default.oneOf([Date, Number, IMask.Masked]), import_prop_types92.default.instanceOf(IMask.Masked)]),
45431
+ value: import_prop_types92.default.any,
45432
+ unmask: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["typed"])]),
45433
+ prepare: import_prop_types92.default.func,
45434
+ prepareChar: import_prop_types92.default.func,
45435
+ validate: import_prop_types92.default.func,
45436
+ commit: import_prop_types92.default.func,
45437
+ overwrite: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["shift"])]),
45438
+ eager: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["append", "remove"])]),
45439
+ skipInvalid: import_prop_types92.default.bool,
45440
+ // events
45441
+ onAccept: import_prop_types92.default.func,
45442
+ onComplete: import_prop_types92.default.func,
45443
+ // pattern
45444
+ placeholderChar: import_prop_types92.default.string,
45445
+ displayChar: import_prop_types92.default.string,
45446
+ lazy: import_prop_types92.default.bool,
45447
+ definitions: import_prop_types92.default.object,
45448
+ blocks: import_prop_types92.default.object,
45449
+ // enum
45450
+ enum: import_prop_types92.default.arrayOf(import_prop_types92.default.string),
45451
+ // range
45452
+ maxLength: import_prop_types92.default.number,
45453
+ from: import_prop_types92.default.number,
45454
+ to: import_prop_types92.default.number,
45455
+ // date
45456
+ pattern: import_prop_types92.default.string,
45457
+ format: import_prop_types92.default.func,
45458
+ parse: import_prop_types92.default.func,
45459
+ autofix: import_prop_types92.default.oneOfType([import_prop_types92.default.bool, import_prop_types92.default.oneOf(["pad"])]),
45460
+ // number
45461
+ radix: import_prop_types92.default.string,
45462
+ thousandsSeparator: import_prop_types92.default.string,
45463
+ mapToRadix: import_prop_types92.default.arrayOf(import_prop_types92.default.string),
45464
+ scale: import_prop_types92.default.number,
45465
+ normalizeZeros: import_prop_types92.default.bool,
45466
+ padFractionalZeros: import_prop_types92.default.bool,
45467
+ min: import_prop_types92.default.oneOfType([import_prop_types92.default.number, import_prop_types92.default.instanceOf(Date)]),
45468
+ max: import_prop_types92.default.oneOfType([import_prop_types92.default.number, import_prop_types92.default.instanceOf(Date)]),
45469
+ // dynamic
45470
+ dispatch: import_prop_types92.default.func,
45471
+ // ref
45472
+ inputRef: import_prop_types92.default.oneOfType([import_prop_types92.default.func, import_prop_types92.default.shape({
45473
+ current: import_prop_types92.default.object
45474
+ })])
44273
45475
  };
44274
- function useDataTableRenderer({
44275
- rows,
44276
- columns,
44277
- rowCount: totalRowsProp,
44278
- paginationMode,
44279
- paginationModel,
44280
- onPaginationModelChange,
44281
- selectionModel = [],
44282
- onSelectionModelChange,
44283
- getId: _getId,
44284
- isTotalSelected: _isTotalSelected
44285
- }) {
44286
- const [page, setPage] = useState27((paginationModel == null ? void 0 : paginationModel.page) || 1);
44287
- const pageSize2 = (paginationModel == null ? void 0 : paginationModel.pageSize) || 20;
44288
- const getId = useCallback28(
44289
- (row, index) => {
44290
- var _a2, _b;
44291
- return (_b = (_a2 = _getId == null ? void 0 : _getId(row)) != null ? _a2 : row == null ? void 0 : row.id) != null ? _b : `${(index || 0) + (page - 1) * pageSize2}`;
44292
- },
44293
- [_getId != null ? _getId : page, pageSize2]
44294
- );
44295
- const selectedModelSet = useMemo35(
44296
- () => new Set(selectionModel),
44297
- [selectionModel]
44298
- );
44299
- const dataInPage = useMemo35(
44300
- () => paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize2, (page - 1) * pageSize2 + pageSize2),
44301
- [rows, page, pageSize2, paginationMode]
44302
- );
44303
- const isAllSelected = useMemo35(
44304
- () => dataInPage.length > 0 && dataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
44305
- [dataInPage, selectedModelSet, page, pageSize2, getId]
44306
- );
44307
- const rowCount = totalRowsProp || rows.length;
44308
- const isTotalSelected = useMemo35(
44309
- () => _isTotalSelected != null ? _isTotalSelected : rowCount > 0 && selectionModel.length === rowCount,
44310
- [_isTotalSelected, selectionModel, rowCount]
44311
- );
44312
- const handlePageChange = useCallback28(
44313
- (newPage) => {
44314
- setPage(newPage);
44315
- onPaginationModelChange == null ? void 0 : onPaginationModelChange({ page: newPage, pageSize: pageSize2 });
44316
- },
44317
- [onPaginationModelChange]
44318
- );
44319
- useEffect37(() => {
44320
- handlePageChange(1);
44321
- }, [rowCount]);
44322
- useEffect37(() => {
44323
- if (page > Math.ceil(rowCount / pageSize2)) {
44324
- handlePageChange(Math.ceil(rowCount / pageSize2));
45476
+ var MASK_PROPS_NAMES = Object.keys(MASK_PROPS).filter((p) => p !== "value");
45477
+ var NON_MASK_OPTIONS_NAMES = ["value", "unmask", "onAccept", "onComplete", "inputRef"];
45478
+ var MASK_OPTIONS_NAMES = MASK_PROPS_NAMES.filter((pName) => NON_MASK_OPTIONS_NAMES.indexOf(pName) < 0);
45479
+ function IMaskMixin(ComposedComponent) {
45480
+ var _Class;
45481
+ const MaskedComponent = (_Class = class MaskedComponent extends React180.Component {
45482
+ constructor(props) {
45483
+ super(props);
45484
+ this._inputRef = this._inputRef.bind(this);
44325
45485
  }
44326
- }, [rowCount, pageSize2]);
44327
- useEffect37(() => {
44328
- onSelectionModelChange == null ? void 0 : onSelectionModelChange([]);
44329
- }, [page]);
44330
- return {
44331
- rowCount,
44332
- page,
44333
- pageSize: pageSize2,
44334
- onPaginationModelChange: handlePageChange,
44335
- getId,
44336
- HeadCell,
44337
- dataInPage,
44338
- isAllSelected,
44339
- // all rows are selected on this page
44340
- isTotalSelected,
44341
- isSelectedRow: useCallback28(
44342
- (model) => selectedModelSet.has(model),
44343
- [selectedModelSet]
44344
- ),
44345
- onAllCheckboxChange: useCallback28(() => {
44346
- onSelectionModelChange == null ? void 0 : onSelectionModelChange(isAllSelected ? [] : dataInPage.map(getId));
44347
- }, [isAllSelected, dataInPage, onSelectionModelChange]),
44348
- onCheckboxChange: useCallback28(
44349
- (event, selectedModel) => {
44350
- if (selectedModelSet.has(selectedModel)) {
44351
- const newSelectionModel = selectionModel.filter(
44352
- (model) => model !== selectedModel
44353
- );
44354
- onSelectionModelChange == null ? void 0 : onSelectionModelChange(newSelectionModel);
45486
+ componentDidMount() {
45487
+ if (!this.props.mask)
45488
+ return;
45489
+ this.initMask();
45490
+ }
45491
+ componentDidUpdate() {
45492
+ const props = this.props;
45493
+ const maskOptions = this._extractMaskOptionsFromProps(props);
45494
+ if (maskOptions.mask) {
45495
+ if (this.maskRef) {
45496
+ this.maskRef.updateOptions(maskOptions);
45497
+ if ("value" in props && props.value !== void 0)
45498
+ this.maskValue = props.value;
44355
45499
  } else {
44356
- const newSelectionModel = [...selectionModel, selectedModel];
44357
- onSelectionModelChange == null ? void 0 : onSelectionModelChange(newSelectionModel);
45500
+ this.initMask(maskOptions);
44358
45501
  }
44359
- },
44360
- [selectionModel, onSelectionModelChange]
44361
- ),
44362
- columns: useMemo35(
44363
- () => columns || // fallback
44364
- Object.keys(rows[0] || {}).map((key) => ({
44365
- field: key
44366
- })),
44367
- [rows, columns]
44368
- ),
44369
- onTotalSelect: useCallback28(() => {
44370
- onSelectionModelChange == null ? void 0 : onSelectionModelChange(
44371
- isTotalSelected ? [] : rows.map(getId),
44372
- !isTotalSelected
44373
- );
44374
- }, [isTotalSelected, rows, onSelectionModelChange])
44375
- };
44376
- }
44377
- function DataTable(props) {
44378
- const _a2 = props, {
44379
- rows,
44380
- checkboxSelection,
44381
- selectionModel,
44382
- onSelectionModelChange,
44383
- rowCount: _4,
44384
- columns: __,
44385
- onPaginationModelChange: ___,
44386
- paginationMode: ____,
44387
- paginationModel: paginationModel,
44388
- loading,
44389
- slots: {
44390
- checkbox: RenderCheckbox = Checkbox_default2,
44391
- toolbar: Toolbar,
44392
- footer: Footer,
44393
- loadingOverlay: LoadingOverlay = () => /* @__PURE__ */ jsx2(LinearProgress_default, { value: 8, variant: "plain" })
44394
- } = {},
44395
- slotProps: {
44396
- checkbox: checkboxProps = {},
44397
- toolbar: toolbarProps,
44398
- background: backgroundProps = {}
44399
- } = {}
44400
- } = _a2, innerProps = __objRest(_a2, [
44401
- "rows",
44402
- "checkboxSelection",
44403
- "selectionModel",
44404
- "onSelectionModelChange",
44405
- "rowCount",
44406
- // rowCount is used in useDataTableRenderer
44407
- "columns",
44408
- // columns is used in useDataTableRenderer
44409
- "onPaginationModelChange",
44410
- // onPaginationModelChange is used in useDataTableRenderer
44411
- "paginationMode",
44412
- // paginationMode is used in useDataTableRenderer
44413
- "paginationModel",
44414
- "loading",
44415
- "slots",
44416
- "slotProps"
44417
- ]);
44418
- const {
44419
- columns,
44420
- isAllSelected,
44421
- isSelectedRow,
44422
- onAllCheckboxChange,
44423
- onCheckboxChange,
44424
- getId,
44425
- rowCount,
44426
- page,
44427
- pageSize: pageSize2,
44428
- onPaginationModelChange,
44429
- dataInPage,
44430
- isTotalSelected,
44431
- onTotalSelect,
44432
- HeadCell: HeadCell2
44433
- } = useDataTableRenderer(props);
44434
- return /* @__PURE__ */ jsxs2(Box_default2, { children: [
44435
- /* @__PURE__ */ jsxs2(
44436
- Stack_default2,
44437
- {
44438
- direction: "row",
44439
- sx: {
44440
- pt: 1,
44441
- pb: 1
44442
- },
44443
- justifyContent: "space-between",
44444
- alignItems: "center",
44445
- children: [
44446
- !!checkboxSelection && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, children: [
44447
- !isAllSelected && /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
44448
- numberFormatter((selectionModel == null ? void 0 : selectionModel.length) || 0),
44449
- " items selected"
44450
- ] }),
44451
- isAllSelected && !isTotalSelected && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, alignItems: "center", children: [
44452
- /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
44453
- "All ",
44454
- numberFormatter((selectionModel == null ? void 0 : selectionModel.length) || 0),
44455
- " items on this page are selected."
44456
- ] }),
44457
- /* @__PURE__ */ jsxs2(Button_default2, { size: "sm", variant: "plain", onClick: onTotalSelect, children: [
44458
- "Select all ",
44459
- numberFormatter(rowCount != null ? rowCount : rows.length),
44460
- " items"
44461
- ] })
44462
- ] }),
44463
- isTotalSelected && /* @__PURE__ */ jsxs2(Stack_default2, { direction: "row", spacing: 1, alignItems: "center", children: [
44464
- /* @__PURE__ */ jsxs2(Typography_default2, { level: "body-xs", children: [
44465
- "All ",
44466
- numberFormatter(rowCount != null ? rowCount : rows.length),
44467
- " items are selected."
44468
- ] }),
44469
- /* @__PURE__ */ jsx2(
44470
- Button_default2,
44471
- {
44472
- size: "sm",
44473
- variant: "plain",
44474
- color: "danger",
44475
- onClick: onTotalSelect,
44476
- children: "Cancel"
44477
- }
44478
- )
44479
- ] })
44480
- ] }),
44481
- Toolbar && /* @__PURE__ */ jsx2(Toolbar, __spreadValues({}, toolbarProps || {}))
44482
- ]
44483
- }
44484
- ),
44485
- /* @__PURE__ */ jsx2(
44486
- Sheet_default2,
44487
- __spreadProps(__spreadValues({
44488
- variant: "outlined",
44489
- sx: {
44490
- overflow: "auto",
44491
- width: "100%",
44492
- boxShadow: "sm",
44493
- borderRadius: "sm"
45502
+ } else {
45503
+ this.destroyMask();
45504
+ if ("value" in props && props.value !== void 0) {
45505
+ var _this$element;
45506
+ if ((_this$element = this.element) != null && _this$element.isContentEditable && this.element.tagName !== "INPUT" && this.element.tagName !== "TEXTAREA")
45507
+ this.element.textContent = props.value;
45508
+ else
45509
+ this.element.value = props.value;
44494
45510
  }
44495
- }, backgroundProps), {
44496
- children: /* @__PURE__ */ jsxs2(Table3, __spreadProps(__spreadValues({}, innerProps), { children: [
44497
- /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
44498
- checkboxSelection && /* @__PURE__ */ jsx2(
44499
- "th",
44500
- {
44501
- style: {
44502
- width: "40px",
44503
- textAlign: "center"
44504
- },
44505
- children: /* @__PURE__ */ jsx2(
44506
- RenderCheckbox,
44507
- __spreadValues({
44508
- onChange: onAllCheckboxChange,
44509
- checked: isAllSelected,
44510
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected
44511
- }, checkboxProps)
44512
- )
44513
- }
44514
- ),
44515
- columns.map((c) => /* @__PURE__ */ jsx2(
44516
- HeadCell2,
44517
- __spreadValues({
44518
- stickyHeader: props.stickyHeader
44519
- }, c),
44520
- c.field
44521
- ))
44522
- ] }) }),
44523
- /* @__PURE__ */ jsxs2("tbody", { children: [
44524
- /* @__PURE__ */ jsx2(OverlayWrapper, { children: !!loading && /* @__PURE__ */ jsx2("td", { children: /* @__PURE__ */ jsx2(
44525
- Box_default2,
44526
- {
44527
- sx: {
44528
- position: "absolute",
44529
- top: 0,
44530
- left: 0,
44531
- right: 0
44532
- },
44533
- children: /* @__PURE__ */ jsx2(LoadingOverlay, {})
44534
- }
44535
- ) }) }),
44536
- /* @__PURE__ */ jsx2(OverlayWrapper, {}),
44537
- dataInPage.map((row, rowIndex) => {
44538
- const rowId = getId(row, rowIndex);
44539
- return /* @__PURE__ */ jsxs2(
44540
- "tr",
44541
- {
44542
- role: checkboxSelection ? "checkbox" : void 0,
44543
- tabIndex: checkboxSelection ? -1 : void 0,
44544
- onClick: checkboxSelection ? (e) => onCheckboxChange(e, rowId) : void 0,
44545
- "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
44546
- children: [
44547
- checkboxSelection && /* @__PURE__ */ jsx2(
44548
- "th",
44549
- {
44550
- scope: "row",
44551
- style: {
44552
- textAlign: "center"
44553
- },
44554
- children: /* @__PURE__ */ jsx2(
44555
- RenderCheckbox,
44556
- __spreadValues({
44557
- onChange: (e) => onCheckboxChange(e, rowId),
44558
- checked: isSelectedRow(rowId)
44559
- }, checkboxProps)
44560
- )
44561
- }
44562
- ),
44563
- columns.map((column2) => {
44564
- var _a3, _b;
44565
- return /* @__PURE__ */ jsx2(
44566
- "td",
44567
- {
44568
- style: {
44569
- textAlign: column2.type === "number" ? "end" : "start"
44570
- },
44571
- children: (_b = (_a3 = column2.renderCell) == null ? void 0 : _a3.call(column2, {
44572
- row,
44573
- value: row[column2.field],
44574
- id: rowId
44575
- })) != null ? _b : row[column2.field]
44576
- },
44577
- column2.field
44578
- );
44579
- })
44580
- ]
44581
- },
44582
- rowId
44583
- );
44584
- })
44585
- ] }),
44586
- Footer && /* @__PURE__ */ jsx2(Footer, {})
44587
- ] }))
44588
- })
44589
- ),
44590
- /* @__PURE__ */ jsx2(
44591
- TablePagination,
44592
- {
44593
- paginationModel: useMemo35(() => ({ page, pageSize: pageSize2 }), [page, pageSize2]),
44594
- rowCount,
44595
- onPageChange: onPaginationModelChange
44596
45511
  }
44597
- )
44598
- ] });
45512
+ }
45513
+ componentWillUnmount() {
45514
+ this.destroyMask();
45515
+ }
45516
+ _inputRef(el) {
45517
+ this.element = el;
45518
+ if (this.props.inputRef) {
45519
+ if (Object.prototype.hasOwnProperty.call(this.props.inputRef, "current"))
45520
+ this.props.inputRef.current = el;
45521
+ else
45522
+ this.props.inputRef(el);
45523
+ }
45524
+ }
45525
+ initMask(maskOptions) {
45526
+ if (maskOptions === void 0) {
45527
+ maskOptions = this._extractMaskOptionsFromProps(this.props);
45528
+ }
45529
+ this.maskRef = IMask(this.element, maskOptions).on("accept", this._onAccept.bind(this)).on("complete", this._onComplete.bind(this));
45530
+ if ("value" in this.props && this.props.value !== void 0)
45531
+ this.maskValue = this.props.value;
45532
+ }
45533
+ destroyMask() {
45534
+ if (this.maskRef) {
45535
+ this.maskRef.destroy();
45536
+ delete this.maskRef;
45537
+ }
45538
+ }
45539
+ _extractMaskOptionsFromProps(props) {
45540
+ const cloneProps = __objRest(props, []);
45541
+ Object.keys(cloneProps).filter((prop) => MASK_OPTIONS_NAMES.indexOf(prop) < 0).forEach((nonMaskProp) => {
45542
+ delete cloneProps[nonMaskProp];
45543
+ });
45544
+ return cloneProps;
45545
+ }
45546
+ _extractNonMaskProps(props) {
45547
+ const cloneProps = __objRest(props, []);
45548
+ MASK_PROPS_NAMES.forEach((maskProp) => {
45549
+ if (maskProp !== "maxLength")
45550
+ delete cloneProps[maskProp];
45551
+ });
45552
+ if (!("defaultValue" in cloneProps))
45553
+ cloneProps.defaultValue = props.mask ? "" : cloneProps.value;
45554
+ delete cloneProps.value;
45555
+ return cloneProps;
45556
+ }
45557
+ get maskValue() {
45558
+ if (!this.maskRef)
45559
+ return "";
45560
+ if (this.props.unmask === "typed")
45561
+ return this.maskRef.typedValue;
45562
+ if (this.props.unmask)
45563
+ return this.maskRef.unmaskedValue;
45564
+ return this.maskRef.value;
45565
+ }
45566
+ set maskValue(value) {
45567
+ if (!this.maskRef)
45568
+ return;
45569
+ value = value == null && this.props.unmask !== "typed" ? "" : value;
45570
+ if (this.props.unmask === "typed")
45571
+ this.maskRef.typedValue = value;
45572
+ else if (this.props.unmask)
45573
+ this.maskRef.unmaskedValue = value;
45574
+ else
45575
+ this.maskRef.value = value;
45576
+ }
45577
+ _onAccept(e) {
45578
+ if (this.props.onAccept && this.maskRef)
45579
+ this.props.onAccept(this.maskValue, this.maskRef, e);
45580
+ }
45581
+ _onComplete(e) {
45582
+ if (this.props.onComplete && this.maskRef)
45583
+ this.props.onComplete(this.maskValue, this.maskRef, e);
45584
+ }
45585
+ render() {
45586
+ return React180.createElement(ComposedComponent, __spreadProps(__spreadValues({}, this._extractNonMaskProps(this.props)), {
45587
+ inputRef: this._inputRef
45588
+ }));
45589
+ }
45590
+ }, _Class.displayName = void 0, _Class.propTypes = void 0, _Class);
45591
+ const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || "Component";
45592
+ MaskedComponent.displayName = "IMask(" + nestedComponentName + ")";
45593
+ MaskedComponent.propTypes = MASK_PROPS;
45594
+ return React180.forwardRef((props, ref) => React180.createElement(MaskedComponent, __spreadProps(__spreadValues({}, props), {
45595
+ ref
45596
+ })));
44599
45597
  }
44600
- DataTable.displayName = "DataTable";
44601
45598
 
44602
- // src/components/DatePicker/DatePicker.tsx
44603
- import React181, { forwardRef as forwardRef85, useCallback as useCallback29, useState as useState28 } from "react";
45599
+ // ../../node_modules/react-imask/esm/input.js
45600
+ var IMaskInputClass = IMaskMixin((_ref) => {
45601
+ let _a2 = _ref, {
45602
+ inputRef
45603
+ } = _a2, props = __objRest(_a2, [
45604
+ "inputRef"
45605
+ ]);
45606
+ return React181.createElement("input", __spreadProps(__spreadValues({}, props), {
45607
+ ref: inputRef
45608
+ }));
45609
+ });
45610
+ var IMaskInputFn = (props, ref) => React181.createElement(IMaskInputClass, __spreadProps(__spreadValues({}, props), {
45611
+ ref
45612
+ }));
45613
+ var IMaskInput = React181.forwardRef(IMaskInputFn);
45614
+
45615
+ // ../../node_modules/react-imask/esm/hook.js
45616
+ import { useRef as useRef45, useState as useState28, useCallback as useCallback28, useEffect as useEffect38 } from "react";
45617
+
45618
+ // ../../node_modules/react-imask/esm/index.js
45619
+ import "react";
44604
45620
 
44605
45621
  // ../../node_modules/@mui/icons-material/esm/CalendarToday.js
44606
45622
  import { jsx as _jsx109 } from "react/jsx-runtime";
@@ -44649,7 +45665,7 @@ var formatValueString = (date) => {
44649
45665
  month = "0" + month;
44650
45666
  return [year, month, day].join("/");
44651
45667
  };
44652
- var TextMaskAdapter3 = React181.forwardRef(
45668
+ var TextMaskAdapter3 = React182.forwardRef(
44653
45669
  function TextMaskAdapter4(props, ref) {
44654
45670
  const _a2 = props, { onChange } = _a2, other = __objRest(_a2, ["onChange"]);
44655
45671
  return /* @__PURE__ */ jsx2(
@@ -44708,8 +45724,8 @@ var DatePicker = forwardRef85(
44708
45724
  disablePast,
44709
45725
  required
44710
45726
  } = props;
44711
- const [value, setValue] = useState28(props.value || "");
44712
- const [anchorEl, setAnchorEl] = useState28(null);
45727
+ const [value, setValue] = useState29(props.value || "");
45728
+ const [anchorEl, setAnchorEl] = useState29(null);
44713
45729
  const open = Boolean(anchorEl);
44714
45730
  const handleChange = useCallback29(
44715
45731
  (event) => {
@@ -44820,7 +45836,7 @@ var DatePicker = forwardRef85(
44820
45836
  DatePicker.displayName = "DatePicker";
44821
45837
 
44822
45838
  // src/components/DateRangePicker/DateRangePicker.tsx
44823
- import React182, { forwardRef as forwardRef86, useCallback as useCallback30, useMemo as useMemo36, useState as useState29 } from "react";
45839
+ import React183, { forwardRef as forwardRef86, useCallback as useCallback30, useMemo as useMemo37, useState as useState30 } from "react";
44824
45840
  var StyledPopper2 = styled_default2(Popper, {
44825
45841
  name: "DateRangePicker",
44826
45842
  slot: "popper"
@@ -44868,7 +45884,7 @@ var parseDate = (str) => {
44868
45884
  )
44869
45885
  ];
44870
45886
  };
44871
- var TextMaskAdapter5 = React182.forwardRef(
45887
+ var TextMaskAdapter5 = React183.forwardRef(
44872
45888
  function TextMaskAdapter6(props, ref) {
44873
45889
  const _a2 = props, { onChange } = _a2, other = __objRest(_a2, ["onChange"]);
44874
45890
  return /* @__PURE__ */ jsx2(
@@ -44920,10 +45936,10 @@ var DateRangePicker = forwardRef86(
44920
45936
  disablePast,
44921
45937
  required
44922
45938
  } = props;
44923
- const [value, setValue] = useState29(props.value || "");
44924
- const [anchorEl, setAnchorEl] = useState29(null);
45939
+ const [value, setValue] = useState30(props.value || "");
45940
+ const [anchorEl, setAnchorEl] = useState30(null);
44925
45941
  const open = Boolean(anchorEl);
44926
- const calendarValue = useMemo36(
45942
+ const calendarValue = useMemo37(
44927
45943
  () => value ? parseDate(value) : void 0,
44928
45944
  [value]
44929
45945
  );
@@ -45137,7 +46153,7 @@ var Grid2 = MotionGrid;
45137
46153
  Grid2.displayName = "Grid";
45138
46154
 
45139
46155
  // src/components/MonthRangePicker/MonthRangePicker.tsx
45140
- import React183, { forwardRef as forwardRef87, useCallback as useCallback31, useMemo as useMemo37, useState as useState30 } from "react";
46156
+ import React184, { forwardRef as forwardRef87, useCallback as useCallback31, useMemo as useMemo38, useState as useState31 } from "react";
45141
46157
  var StyledPopper3 = styled_default2(Popper, {
45142
46158
  name: "MonthRangePicker",
45143
46159
  slot: "popper"
@@ -45174,7 +46190,7 @@ var parseDate2 = (str) => {
45174
46190
  new Date(Number(yearMonthDay2[0]), Number(yearMonthDay2[1]) - 1)
45175
46191
  ];
45176
46192
  };
45177
- var TextMaskAdapter7 = React183.forwardRef(
46193
+ var TextMaskAdapter7 = React184.forwardRef(
45178
46194
  function TextMaskAdapter8(props, ref) {
45179
46195
  const _a2 = props, { onChange } = _a2, other = __objRest(_a2, ["onChange"]);
45180
46196
  return /* @__PURE__ */ jsx2(
@@ -45220,10 +46236,10 @@ var MonthRangePicker = forwardRef87(
45220
46236
  disablePast,
45221
46237
  required
45222
46238
  } = props;
45223
- const [value, setValue] = useState30(props.value || "");
45224
- const [anchorEl, setAnchorEl] = useState30(null);
46239
+ const [value, setValue] = useState31(props.value || "");
46240
+ const [anchorEl, setAnchorEl] = useState31(null);
45225
46241
  const open = Boolean(anchorEl);
45226
- const calendarValue = useMemo37(
46242
+ const calendarValue = useMemo38(
45227
46243
  () => value ? parseDate2(value) : void 0,
45228
46244
  [value]
45229
46245
  );
@@ -45364,7 +46380,8 @@ function Select3(props) {
45364
46380
  size,
45365
46381
  color: color2,
45366
46382
  disabled,
45367
- required
46383
+ required,
46384
+ onChange
45368
46385
  } = _a2, innerProps = __objRest(_a2, [
45369
46386
  "label",
45370
46387
  "helperText",
@@ -45372,8 +46389,29 @@ function Select3(props) {
45372
46389
  "size",
45373
46390
  "color",
45374
46391
  "disabled",
45375
- "required"
46392
+ "required",
46393
+ "onChange"
45376
46394
  ]);
46395
+ const handleChange = (event, newValue) => {
46396
+ var _a3;
46397
+ const _event = event || { target: {} };
46398
+ const newEvent = __spreadProps(__spreadValues({}, _event), {
46399
+ // @ts-expect-error target에 name이 있을 수 있다.
46400
+ target: { name: (_a3 = _event.target) == null ? void 0 : _a3.name, value: newValue || void 0 }
46401
+ });
46402
+ console.log(newEvent);
46403
+ onChange == null ? void 0 : onChange(newEvent);
46404
+ };
46405
+ const select = /* @__PURE__ */ jsx2(
46406
+ Select_default,
46407
+ __spreadProps(__spreadValues({}, innerProps), {
46408
+ required,
46409
+ disabled,
46410
+ size,
46411
+ color: color2,
46412
+ onChange: handleChange
46413
+ })
46414
+ );
45377
46415
  if (label) {
45378
46416
  return /* @__PURE__ */ jsxs2(
45379
46417
  FormControl_default2,
@@ -45385,21 +46423,13 @@ function Select3(props) {
45385
46423
  error,
45386
46424
  children: [
45387
46425
  /* @__PURE__ */ jsx2(FormLabel_default2, { children: label }),
45388
- /* @__PURE__ */ jsx2(Select_default, __spreadValues({}, innerProps)),
46426
+ select,
45389
46427
  helperText && /* @__PURE__ */ jsx2(FormHelperText_default2, { children: helperText })
45390
46428
  ]
45391
46429
  }
45392
46430
  );
45393
46431
  }
45394
- return /* @__PURE__ */ jsx2(
45395
- Select_default,
45396
- __spreadValues({
45397
- required,
45398
- disabled,
45399
- size,
45400
- color: color2
45401
- }, innerProps)
45402
- );
46432
+ return select;
45403
46433
  }
45404
46434
  Select3.displayName = "Select";
45405
46435
 
@@ -45447,7 +46477,11 @@ import { motion as motion27 } from "framer-motion";
45447
46477
  var MotionTabs = motion27(Tabs_default);
45448
46478
  var Tabs3 = MotionTabs;
45449
46479
  Tabs3.displayName = "Tabs";
45450
- var MotionTab = motion27(Tab_default);
46480
+ var MotionTab = styled_default2(motion27(Tab_default))(({ theme }) => ({
46481
+ [`&:not(.${tabClasses_default.selected})`]: {
46482
+ color: theme.palette.neutral[700]
46483
+ }
46484
+ }));
45451
46485
  var Tab3 = MotionTab;
45452
46486
  Tab3.displayName = "Tab";
45453
46487
  var MotionTabList = motion27(TabList_default);
@@ -46020,8 +47054,7 @@ var currencyInputPropertyControls = {
46020
47054
  },
46021
47055
  max: {
46022
47056
  title: "Max",
46023
- type: ControlType11.Number,
46024
- defaultValue: void 0
47057
+ type: ControlType11.String
46025
47058
  }
46026
47059
  };
46027
47060
 
@@ -46904,7 +47937,7 @@ var withCommonControls = (Component) => {
46904
47937
  });
46905
47938
  }
46906
47939
  return components.reduce((acc, { Component: Component2, props: props2 }) => {
46907
- return [React184.createElement(Component2, props2, ...acc)];
47940
+ return [React185.createElement(Component2, props2, ...acc)];
46908
47941
  }, []);
46909
47942
  };
46910
47943
  };