@uzum-tech/ui 2.0.1 → 2.0.3

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.
Files changed (58) hide show
  1. package/dist/index.js +319 -92
  2. package/dist/index.mjs +319 -92
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +2 -2
  5. package/es/chat/src/ChatParts/MainArea.mjs +3 -1
  6. package/es/components.d.ts +51 -0
  7. package/es/input-number/src/InputNumber.d.ts +14 -0
  8. package/es/input-number/src/InputNumber.mjs +121 -48
  9. package/es/input-number/src/constants.d.ts +14 -0
  10. package/es/input-number/src/constants.mjs +15 -0
  11. package/es/input-number/src/interface.d.ts +4 -0
  12. package/es/input-number/src/utils.d.ts +12 -0
  13. package/es/input-number/src/utils.mjs +89 -1
  14. package/es/mapping-card/src/MappingCardList.d.ts +2 -0
  15. package/es/mapping-card/src/MappingCardList.mjs +11 -2
  16. package/es/mapping-card/src/interface.d.ts +3 -0
  17. package/es/mapping-card/src/interface.mjs +2 -1
  18. package/es/mapping-card/src/styles/index.cssr.mjs +8 -1
  19. package/es/modal/src/BodyWrapper.d.ts +39 -0
  20. package/es/modal/src/Modal.d.ts +56 -0
  21. package/es/modal/src/ModalEnvironment.d.ts +39 -0
  22. package/es/modal/src/presetProps.d.ts +18 -1
  23. package/es/modal/src/presetProps.mjs +2 -1
  24. package/es/notification/src/NotificationEnvironment.d.ts +4 -0
  25. package/es/notification/src/NotificationEnvironment.mjs +45 -9
  26. package/es/notification/src/NotificationProvider.d.ts +2 -0
  27. package/es/notification/src/styles/index.cssr.d.ts +1 -2
  28. package/es/notification/src/styles/index.cssr.mjs +13 -23
  29. package/es/version.d.ts +1 -1
  30. package/es/version.mjs +1 -1
  31. package/lib/chat/src/ChatParts/MainArea.js +45 -43
  32. package/lib/components.d.ts +51 -0
  33. package/lib/input-number/src/InputNumber.d.ts +14 -0
  34. package/lib/input-number/src/InputNumber.js +128 -51
  35. package/lib/input-number/src/constants.d.ts +14 -0
  36. package/lib/input-number/src/constants.js +18 -0
  37. package/lib/input-number/src/interface.d.ts +4 -0
  38. package/lib/input-number/src/utils.d.ts +12 -0
  39. package/lib/input-number/src/utils.js +112 -1
  40. package/lib/mapping-card/src/MappingCardList.d.ts +2 -0
  41. package/lib/mapping-card/src/MappingCardList.js +9 -4
  42. package/lib/mapping-card/src/interface.d.ts +3 -0
  43. package/lib/mapping-card/src/interface.js +2 -1
  44. package/lib/mapping-card/src/styles/index.cssr.js +8 -1
  45. package/lib/modal/src/BodyWrapper.d.ts +39 -0
  46. package/lib/modal/src/Modal.d.ts +56 -0
  47. package/lib/modal/src/ModalEnvironment.d.ts +39 -0
  48. package/lib/modal/src/presetProps.d.ts +18 -1
  49. package/lib/modal/src/presetProps.js +2 -1
  50. package/lib/notification/src/NotificationEnvironment.d.ts +4 -0
  51. package/lib/notification/src/NotificationEnvironment.js +46 -9
  52. package/lib/notification/src/NotificationProvider.d.ts +2 -0
  53. package/lib/notification/src/styles/index.cssr.d.ts +1 -2
  54. package/lib/notification/src/styles/index.cssr.js +13 -23
  55. package/lib/version.d.ts +1 -1
  56. package/lib/version.js +1 -1
  57. package/package.json +4 -1
  58. package/web-types.json +8 -1
package/dist/index.js CHANGED
@@ -54618,7 +54618,7 @@
54618
54618
  const chat = selectedChatRef.value;
54619
54619
  const keyId = toKeyString(chat?.id);
54620
54620
  const keyTitle = toKeyString(chat?.title);
54621
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header-inner` }, /* @__PURE__ */ vue.h(
54621
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header-inner` }, /* @__PURE__ */ vue.h(
54622
54622
  "div",
54623
54623
  {
54624
54624
  class: `${mergedClsPrefixRef.value}-chat-main__header-title-wrap`
@@ -54761,7 +54761,7 @@
54761
54761
  return buttons;
54762
54762
  })
54763
54763
  }
54764
- ));
54764
+ )));
54765
54765
  };
54766
54766
  const renderMessages = () => {
54767
54767
  return /* @__PURE__ */ vue.h(
@@ -80928,6 +80928,7 @@
80928
80928
  }
80929
80929
 
80930
80930
  const presetProps = {
80931
+ ...cardBaseProps,
80931
80932
  // put dialog props after since I want the card to unbordered by default
80932
80933
  ...dialogProps,
80933
80934
  size: {
@@ -91216,14 +91217,23 @@
91216
91217
  }
91217
91218
  });
91218
91219
 
91219
- var style$z = c$1([cB("input-number-suffix", `
91220
- display: inline-block;
91221
- margin-right: 10px;
91222
- `), cB("input-number-prefix", `
91223
- display: inline-block;
91224
- margin-left: 10px;
91225
- `)]);
91226
-
91220
+ const MAX_AMOUNT_INPUT_DIGITS = 16;
91221
+ var InputNumberRegex = /* @__PURE__ */(InputNumberRegex2 => {
91222
+ InputNumberRegex2["INPUT_WIP_VALUE"] = "^(-)?\\d+.*(\\.|0)$";
91223
+ InputNumberRegex2["INPUT_LEADING_DOT_WIP_VALUE"] = "^\\.\\d+$";
91224
+ InputNumberRegex2["AMOUNT_INPUT"] = "^-?[\\d\\s]*\\.?\\d*$";
91225
+ InputNumberRegex2["AMOUNT_VALUE"] = "^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$";
91226
+ InputNumberRegex2["AMOUNT_RAW_LEADING_DOT"] = "^-?\\.\\d*$";
91227
+ InputNumberRegex2["WHITESPACE"] = "\\s";
91228
+ InputNumberRegex2["NON_DIGIT"] = "\\D";
91229
+ InputNumberRegex2["LEADING_ZEROS"] = "^0+(?=\\d)";
91230
+ InputNumberRegex2["NON_ZERO_DIGIT"] = "[1-9]";
91231
+ InputNumberRegex2["TRAILING_ZERO_FRACTION"] = "\\.?0+$";
91232
+ InputNumberRegex2["THOUSANDS_SEPARATOR"] = "\\B(?=(\\d{3})+(?!\\d))";
91233
+ return InputNumberRegex2;
91234
+ })(InputNumberRegex || {});
91235
+
91236
+ const MAX_SAFE_INTEGER_LIMIT = String(Number.MAX_SAFE_INTEGER);
91227
91237
  function parse(value) {
91228
91238
  if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") {
91229
91239
  return null;
@@ -91231,7 +91241,7 @@
91231
91241
  return Number(value);
91232
91242
  }
91233
91243
  function isWipValue(value) {
91234
- return value.includes(".") && (/^(-)?\d+.*(\.|0)$/.test(value) || /^\.\d+$/.test(value));
91244
+ return value.includes(".") && (new RegExp(InputNumberRegex.INPUT_WIP_VALUE).test(value) || new RegExp(InputNumberRegex.INPUT_LEADING_DOT_WIP_VALUE).test(value));
91235
91245
  }
91236
91246
  function validator(value) {
91237
91247
  if (value === void 0 || value === null) return true;
@@ -91255,6 +91265,100 @@
91255
91265
  }
91256
91266
  }
91257
91267
  }
91268
+ function getPrecision(value) {
91269
+ const fraction = String(value).split(".")[1];
91270
+ return fraction ? fraction.length : 0;
91271
+ }
91272
+ function stripAmountFormatting(value) {
91273
+ return String(value).replace(new RegExp(InputNumberRegex.WHITESPACE, "g"), "").trim();
91274
+ }
91275
+ function isValidAmountInput(value) {
91276
+ return value === "" || new RegExp(InputNumberRegex.AMOUNT_INPUT).test(value);
91277
+ }
91278
+ function isAmountInputWithinDigitLimit(value, maxDigits = MAX_AMOUNT_INPUT_DIGITS) {
91279
+ return value.replace(new RegExp(InputNumberRegex.NON_DIGIT, "g"), "").length <= maxDigits;
91280
+ }
91281
+ function getRejectedSelectionRange(prevDisplayedValue, attemptedDisplayedValue, selectionStart, selectionEnd) {
91282
+ const removedLength = Math.max(0, attemptedDisplayedValue.length - prevDisplayedValue.length);
91283
+ return {
91284
+ start: Math.min(prevDisplayedValue.length, Math.max(0, selectionStart - removedLength)),
91285
+ end: Math.min(prevDisplayedValue.length, Math.max(0, selectionEnd - removedLength))
91286
+ };
91287
+ }
91288
+ function exceedsMaxSafeAmountValue(numberString) {
91289
+ const normalized = numberString.startsWith("-") ? numberString.slice(1) : numberString;
91290
+ const [integerPart = "0", fractionPart = ""] = normalized.split(".");
91291
+ const normalizedIntegerPart = integerPart.replace(new RegExp(InputNumberRegex.LEADING_ZEROS), "");
91292
+ return normalizedIntegerPart.length > MAX_SAFE_INTEGER_LIMIT.length || normalizedIntegerPart.length === MAX_SAFE_INTEGER_LIMIT.length && (normalizedIntegerPart > MAX_SAFE_INTEGER_LIMIT || normalizedIntegerPart === MAX_SAFE_INTEGER_LIMIT && new RegExp(InputNumberRegex.NON_ZERO_DIGIT).test(fractionPart));
91293
+ }
91294
+ function parseAmount(input) {
91295
+ if (input === void 0 || input === null) return null;
91296
+ const numberString = stripAmountFormatting(input);
91297
+ if (new RegExp(InputNumberRegex.AMOUNT_VALUE).test(numberString)) {
91298
+ if (exceedsMaxSafeAmountValue(numberString)) return Number.NaN;
91299
+ return Number(numberString);
91300
+ }
91301
+ return numberString === "" ? null : Number.NaN;
91302
+ }
91303
+ function formatAmount(value, precision) {
91304
+ if (value === void 0 || value === null) return "";
91305
+ let stringValue = String(value);
91306
+ if (precision !== void 0) {
91307
+ stringValue = value.toFixed(precision).replace(new RegExp(InputNumberRegex.TRAILING_ZERO_FRACTION), "");
91308
+ }
91309
+ const negative = stringValue.startsWith("-");
91310
+ if (negative) stringValue = stringValue.slice(1);
91311
+ const [integerPart, fractionPart] = stringValue.split(".");
91312
+ const integerWithSeparator = integerPart.replace(new RegExp(InputNumberRegex.THOUSANDS_SEPARATOR, "g"), " ");
91313
+ return `${negative ? "-" : ""}${integerWithSeparator}${fractionPart ? `.${fractionPart}` : ""}`;
91314
+ }
91315
+ function formattedToRawIndex(formatted, caret) {
91316
+ let raw = 0;
91317
+ for (let i = 0; i < Math.min(caret, formatted.length); i++) {
91318
+ if (formatted[i] !== " ") raw++;
91319
+ }
91320
+ return raw;
91321
+ }
91322
+ function rawIndexToCaret(formatted, rawIndex) {
91323
+ if (rawIndex <= 0) return 0;
91324
+ let raw = 0;
91325
+ for (let i = 0; i < formatted.length; i++) {
91326
+ if (formatted[i] !== " ") raw++;
91327
+ if (raw === rawIndex) return i + 1;
91328
+ }
91329
+ return formatted.length;
91330
+ }
91331
+ function isRawWipValue(formatted) {
91332
+ return isWipValue(stripAmountFormatting(formatted));
91333
+ }
91334
+ function mapSelectionAfterFormat(formatted, newFormatted, selectionStart, selectionEnd) {
91335
+ const rawStart = formattedToRawIndex(formatted, selectionStart);
91336
+ const rawEnd = formattedToRawIndex(formatted, selectionEnd);
91337
+ const rawInput = stripAmountFormatting(formatted);
91338
+ if (new RegExp(InputNumberRegex.AMOUNT_RAW_LEADING_DOT).test(rawInput)) {
91339
+ const {
91340
+ length
91341
+ } = newFormatted;
91342
+ return {
91343
+ start: length,
91344
+ end: length
91345
+ };
91346
+ }
91347
+ const newStart = rawIndexToCaret(newFormatted, rawStart);
91348
+ const newEnd = rawIndexToCaret(newFormatted, rawEnd);
91349
+ return {
91350
+ start: newStart,
91351
+ end: newEnd
91352
+ };
91353
+ }
91354
+
91355
+ var style$z = c$1([cB("input-number-suffix", `
91356
+ display: inline-block;
91357
+ margin-right: 10px;
91358
+ `), cB("input-number-prefix", `
91359
+ display: inline-block;
91360
+ margin-left: 10px;
91361
+ `)]);
91258
91362
 
91259
91363
  const HOLDING_CHANGE_THRESHOLD = 800;
91260
91364
  const HOLDING_CHANGE_INTERVAL = 100;
@@ -91305,6 +91409,10 @@
91305
91409
  type: Boolean,
91306
91410
  default: true
91307
91411
  },
91412
+ type: {
91413
+ type: String,
91414
+ default: "default"
91415
+ },
91308
91416
  parse: Function,
91309
91417
  format: Function,
91310
91418
  precision: Number,
@@ -91354,10 +91462,6 @@
91354
91462
  uncontrolledValueRef
91355
91463
  );
91356
91464
  const displayedValueRef = vue.ref("");
91357
- const getPrecision = (value) => {
91358
- const fraction = String(value).split(".")[1];
91359
- return fraction ? fraction.length : 0;
91360
- };
91361
91465
  const getMaxPrecision = (currentValue) => {
91362
91466
  const precisions = [props.min, props.max, props.step, currentValue].map(
91363
91467
  (value) => {
@@ -91393,6 +91497,39 @@
91393
91497
  return parsedNumber;
91394
91498
  else return null;
91395
91499
  });
91500
+ const isAmountTypeRef = useMemo(() => props.type === "amount");
91501
+ const showButtonRef = useMemo(() => {
91502
+ return isAmountTypeRef.value ? false : props.showButton;
91503
+ });
91504
+ const effectiveParse = (input) => {
91505
+ if (props.parse) return props.parse(input);
91506
+ if (isAmountTypeRef.value) return parseAmount(input);
91507
+ return parse(input);
91508
+ };
91509
+ const effectiveFormat = (value, precision) => {
91510
+ if (props.format && value !== void 0) return props.format(value);
91511
+ if (isAmountTypeRef.value) return formatAmount(value, precision);
91512
+ return format(value, precision);
91513
+ };
91514
+ const doUpdateValue = (value) => {
91515
+ const { value: mergedValue } = mergedValueRef;
91516
+ if (value === mergedValue) {
91517
+ deriveDisplayedValueFromValue();
91518
+ return;
91519
+ }
91520
+ const {
91521
+ "onUpdate:value": _onUpdateValue,
91522
+ onUpdateValue,
91523
+ onChange
91524
+ } = props;
91525
+ const { triggerFormInput, triggerFormChange } = formItem;
91526
+ if (onChange) call(onChange, value);
91527
+ if (onUpdateValue) call(onUpdateValue, value);
91528
+ if (_onUpdateValue) call(_onUpdateValue, value);
91529
+ uncontrolledValueRef.value = value;
91530
+ triggerFormInput();
91531
+ triggerFormChange();
91532
+ };
91396
91533
  const deriveValueFromDisplayedValue = ({
91397
91534
  offset,
91398
91535
  doUpdateIfValid,
@@ -91403,7 +91540,7 @@
91403
91540
  if (isInputing && isWipValue(displayedValue)) {
91404
91541
  return false;
91405
91542
  }
91406
- const parsedValue = (props.parse || parse)(displayedValue);
91543
+ const parsedValue = effectiveParse(displayedValue);
91407
91544
  if (parsedValue === null) {
91408
91545
  if (doUpdateIfValid)
91409
91546
  doUpdateValue(null);
@@ -91445,43 +91582,70 @@
91445
91582
  const deriveDisplayedValueFromValue = () => {
91446
91583
  const { value: mergedValue } = mergedValueRef;
91447
91584
  if (validator(mergedValue)) {
91448
- const { format: formatProp, precision } = props;
91449
- if (formatProp) {
91450
- displayedValueRef.value = formatProp(mergedValue);
91451
- } else {
91452
- if (mergedValue === null || precision === void 0 || getPrecision(mergedValue) > precision) {
91453
- displayedValueRef.value = format(mergedValue, void 0);
91454
- } else {
91455
- displayedValueRef.value = format(mergedValue, precision);
91456
- }
91457
- }
91585
+ const { precision } = props;
91586
+ displayedValueRef.value = effectiveFormat(
91587
+ mergedValue,
91588
+ mergedValue === null ? void 0 : precision
91589
+ );
91458
91590
  } else {
91459
91591
  displayedValueRef.value = String(mergedValue);
91460
91592
  }
91461
91593
  };
91462
- deriveDisplayedValueFromValue();
91463
- function doUpdateValue(value) {
91464
- const { value: mergedValue } = mergedValueRef;
91465
- if (value === mergedValue) {
91466
- deriveDisplayedValueFromValue();
91467
- return;
91594
+ const computeValueToFormat = (prev, derived) => {
91595
+ if (derived !== false && derived !== null) return derived;
91596
+ if (!isAmountTypeRef.value) return null;
91597
+ const parsed = effectiveParse(prev);
91598
+ if (parsed === null || Number.isNaN(parsed)) return null;
91599
+ return parsed;
91600
+ };
91601
+ const setInputValueSelection = (value, selectionStart, selectionEnd) => {
91602
+ const inputElement = inputInstRef.value?.inputElRef;
91603
+ if (!inputElement) return;
91604
+ inputElement.value = value;
91605
+ inputElement.setSelectionRange(selectionStart, selectionEnd);
91606
+ };
91607
+ const applyFormatted = (prev, valueNumber) => {
91608
+ const inputElement = inputInstRef.value?.inputElRef;
91609
+ const selectionStart = inputElement?.selectionStart ?? prev.length;
91610
+ const selectionEnd = inputElement?.selectionEnd ?? selectionStart;
91611
+ const newFormatted = effectiveFormat(valueNumber, props.precision);
91612
+ displayedValueRef.value = newFormatted;
91613
+ void vue.nextTick(() => {
91614
+ const { start, end } = mapSelectionAfterFormat(
91615
+ prev,
91616
+ newFormatted,
91617
+ selectionStart,
91618
+ selectionEnd
91619
+ );
91620
+ inputElement?.setSelectionRange(start, end);
91621
+ });
91622
+ };
91623
+ const restoreRejectedAmountInput = (prevDisplayedValue, attemptedDisplayedValue) => {
91624
+ const inputElement = inputInstRef.value?.inputElRef;
91625
+ const selectionStart = inputElement?.selectionStart ?? attemptedDisplayedValue.length;
91626
+ const selectionEnd = inputElement?.selectionEnd ?? selectionStart;
91627
+ const { start, end } = getRejectedSelectionRange(
91628
+ prevDisplayedValue,
91629
+ attemptedDisplayedValue,
91630
+ selectionStart,
91631
+ selectionEnd
91632
+ );
91633
+ displayedValueRef.value = prevDisplayedValue;
91634
+ setInputValueSelection(prevDisplayedValue, start, end);
91635
+ void vue.nextTick(() => {
91636
+ setInputValueSelection(prevDisplayedValue, start, end);
91637
+ });
91638
+ };
91639
+ const shouldRejectAmountInput = (value) => {
91640
+ if (!isValidAmountInput(value)) return true;
91641
+ if (!isAmountInputWithinDigitLimit(value, MAX_AMOUNT_INPUT_DIGITS)) {
91642
+ return true;
91468
91643
  }
91469
- const {
91470
- "onUpdate:value": _onUpdateValue,
91471
- onUpdateValue,
91472
- onChange
91473
- } = props;
91474
- const { triggerFormInput, triggerFormChange } = formItem;
91475
- if (onChange)
91476
- call(onChange, value);
91477
- if (onUpdateValue)
91478
- call(onUpdateValue, value);
91479
- if (_onUpdateValue)
91480
- call(_onUpdateValue, value);
91481
- uncontrolledValueRef.value = value;
91482
- triggerFormInput();
91483
- triggerFormChange();
91484
- }
91644
+ if (props.precision === void 0) return false;
91645
+ const parsedValue = effectiveParse(value);
91646
+ return parsedValue !== null && !Number.isNaN(parsedValue) && getPrecision(parsedValue) > props.precision;
91647
+ };
91648
+ deriveDisplayedValueFromValue();
91485
91649
  const displayedValueInvalidRef = useMemo(() => {
91486
91650
  const derivedValue = deriveValueFromDisplayedValue({
91487
91651
  offset: 0,
@@ -91733,15 +91897,30 @@
91733
91897
  }
91734
91898
  }
91735
91899
  }
91900
+ const shouldTryFormat = () => props.updateValueOnInput && !props.format && !props.parse && (props.precision === void 0 || isAmountTypeRef.value);
91736
91901
  function handleUpdateDisplayedValue(value) {
91902
+ const prevDisplayedValue = displayedValueRef.value;
91903
+ const prevFormatted = value;
91904
+ if (isAmountTypeRef.value) {
91905
+ if (shouldRejectAmountInput(value)) {
91906
+ restoreRejectedAmountInput(prevDisplayedValue, value);
91907
+ return;
91908
+ }
91909
+ }
91737
91910
  displayedValueRef.value = value;
91738
- if (props.updateValueOnInput && !props.format && !props.parse && props.precision === void 0) {
91739
- deriveValueFromDisplayedValue({
91740
- offset: 0,
91741
- doUpdateIfValid: true,
91742
- isInputing: true,
91743
- fixPrecision: false
91744
- });
91911
+ if (!shouldTryFormat()) return;
91912
+ if (isAmountTypeRef.value) {
91913
+ if (isRawWipValue(prevFormatted)) return;
91914
+ }
91915
+ const derived = deriveValueFromDisplayedValue({
91916
+ offset: 0,
91917
+ doUpdateIfValid: true,
91918
+ isInputing: true,
91919
+ fixPrecision: false
91920
+ });
91921
+ const valueToFormat = computeValueToFormat(prevFormatted, derived);
91922
+ if (valueToFormat !== null && isAmountTypeRef.value) {
91923
+ applyFormatted(prevFormatted, valueToFormat);
91745
91924
  }
91746
91925
  }
91747
91926
  vue.watch(mergedValueRef, () => {
@@ -91774,6 +91953,7 @@
91774
91953
  displayedValue: displayedValueRef,
91775
91954
  addable: addableRef,
91776
91955
  minusable: minusableRef,
91956
+ showButton: showButtonRef,
91777
91957
  mergedStatus: mergedStatusRef,
91778
91958
  handleFocus,
91779
91959
  handleBlur,
@@ -95247,7 +95427,8 @@
95247
95427
  gap: {
95248
95428
  type: Number,
95249
95429
  default: 16
95250
- }
95430
+ },
95431
+ emptyProps: Object
95251
95432
  };
95252
95433
 
95253
95434
  var MappingCardBody = vue.defineComponent({
@@ -96012,9 +96193,16 @@
96012
96193
  color: var(--u-arrow-color);
96013
96194
  font-size: 16px;
96014
96195
  flex-shrink: 0;
96015
- `)]), cB("mapping-card-list", [cE("pagination", `
96016
- margin-top: 16px;
96017
- `)])]);
96196
+ `)]), cB("mapping-card-list", `
96197
+ display: flex;
96198
+ justify-content: space-between;
96199
+ flex-direction: column;
96200
+ height: 100%;
96201
+ `, [cE("pagination", `
96202
+ margin-top: 16px;
96203
+ `), cE("empty", `
96204
+ margin: auto;
96205
+ `)])]);
96018
96206
 
96019
96207
  var _UMappingCard = vue.defineComponent({
96020
96208
  name: "MappingCard",
@@ -96105,8 +96293,18 @@
96105
96293
  };
96106
96294
  },
96107
96295
  render() {
96108
- const { mergedClsPrefix, mergedPagination, gap, items } = this;
96109
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-mapping-card-list` }, /* @__PURE__ */ vue.h(
96296
+ const {
96297
+ mergedClsPrefix,
96298
+ mergedPagination,
96299
+ gap,
96300
+ items,
96301
+ emptyProps,
96302
+ $slots
96303
+ } = this;
96304
+ const isEmpty = !items.length;
96305
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-mapping-card-list` }, isEmpty ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-mapping-card-list__empty` }, resolveSlot($slots.empty, () => [
96306
+ /* @__PURE__ */ vue.h(UEmpty$1, { size: "large", ...emptyProps })
96307
+ ])) : /* @__PURE__ */ vue.h(
96110
96308
  _UFlex,
96111
96309
  {
96112
96310
  vertical: true,
@@ -111201,6 +111399,7 @@
111201
111399
  const notificationEnvOptions = {
111202
111400
  ...notificationProps,
111203
111401
  duration: Number,
111402
+ pauseOnVisibilityChange: Boolean,
111204
111403
  onClose: Function,
111205
111404
  onLeave: Function,
111206
111405
  onAfterEnter: Function,
@@ -111230,10 +111429,45 @@
111230
111429
  const { wipTransitionCountRef } = vue.inject(notificationProviderInjectionKey);
111231
111430
  const showRef = vue.ref(true);
111232
111431
  let timerId = null;
111432
+ let remainingDuration = null;
111433
+ let timerStartedAt = null;
111434
+ let timerPausedForVisibility = false;
111435
+ function clearTimer() {
111436
+ if (timerId !== null) {
111437
+ window.clearTimeout(timerId);
111438
+ timerId = null;
111439
+ }
111440
+ }
111233
111441
  function hide() {
111234
111442
  showRef.value = false;
111235
- if (timerId) {
111236
- window.clearTimeout(timerId);
111443
+ clearTimer();
111444
+ }
111445
+ function startTimer(duration) {
111446
+ clearTimer();
111447
+ remainingDuration = duration;
111448
+ timerStartedAt = Date.now();
111449
+ timerId = window.setTimeout(hide, duration);
111450
+ }
111451
+ function handleVisibilityChange() {
111452
+ if (document.visibilityState === "hidden") {
111453
+ if (timerId !== null) {
111454
+ clearTimer();
111455
+ if (timerStartedAt !== null && remainingDuration !== null) {
111456
+ remainingDuration = Math.max(
111457
+ 0,
111458
+ remainingDuration - (Date.now() - timerStartedAt)
111459
+ );
111460
+ }
111461
+ timerStartedAt = null;
111462
+ timerPausedForVisibility = true;
111463
+ }
111464
+ } else if (timerPausedForVisibility) {
111465
+ timerPausedForVisibility = false;
111466
+ if (remainingDuration !== null && remainingDuration > 0) {
111467
+ startTimer(remainingDuration);
111468
+ } else {
111469
+ hide();
111470
+ }
111237
111471
  }
111238
111472
  }
111239
111473
  function handleBeforeEnter(el) {
@@ -111282,16 +111516,13 @@
111282
111516
  function setHideTimeout() {
111283
111517
  const { duration } = props;
111284
111518
  if (duration) {
111285
- timerId = window.setTimeout(hide, duration);
111519
+ startTimer(duration);
111286
111520
  }
111287
111521
  }
111288
111522
  function handleMouseenter(e) {
111289
111523
  if (e.currentTarget !== e.target)
111290
111524
  return;
111291
- if (timerId !== null) {
111292
- window.clearTimeout(timerId);
111293
- timerId = null;
111294
- }
111525
+ clearTimer();
111295
111526
  }
111296
111527
  function handleMouseleave(e) {
111297
111528
  if (e.currentTarget !== e.target)
@@ -111312,9 +111543,15 @@
111312
111543
  }
111313
111544
  vue.onMounted(() => {
111314
111545
  if (props.duration) {
111315
- timerId = window.setTimeout(hide, props.duration);
111546
+ startTimer(props.duration);
111547
+ }
111548
+ if (props.pauseOnVisibilityChange) {
111549
+ document.addEventListener("visibilitychange", handleVisibilityChange);
111316
111550
  }
111317
111551
  });
111552
+ vue.onBeforeUnmount(() => {
111553
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
111554
+ });
111318
111555
  return {
111319
111556
  show: showRef,
111320
111557
  hide,
@@ -111360,12 +111597,16 @@
111360
111597
  var style = c$1([cB("notification-container", `
111361
111598
  z-index: 4000;
111362
111599
  position: fixed;
111600
+ left: 0;
111601
+ right: 0;
111363
111602
  overflow: visible;
111364
111603
  display: flex;
111365
111604
  flex-direction: column;
111366
111605
  align-items: flex-end;
111606
+ pointer-events: none;
111367
111607
  `, [c$1(">", [cB("scrollbar", `
111368
- width: initial;
111608
+ width: -moz-fit-content;
111609
+ width: fit-content;
111369
111610
  overflow: visible;
111370
111611
  height: -moz-fit-content !important;
111371
111612
  height: fit-content !important;
@@ -111391,8 +111632,7 @@
111391
111632
  margin-bottom: 0;
111392
111633
  margin-top: 12px;
111393
111634
  `)]), cM("top, bottom", `
111394
- left: 50%;
111395
- transform: translateX(-50%);
111635
+ align-items: center;
111396
111636
  `, [cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111397
111637
  transform: scale(0.85);
111398
111638
  `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
@@ -111401,15 +111641,11 @@
111401
111641
  transform-origin: top center;
111402
111642
  `)]), cM("bottom", [cB("notification-wrapper", `
111403
111643
  transform-origin: bottom center;
111404
- `)]), cM("top-right", `
111405
- right: 0;
111406
- `, [placementTransformStyle("top-right")]), cM("top-left", `
111407
- left: 0;
111408
- `, [placementTransformStyle("top-left")]), cM("bottom-right", `
111409
- right: 0;
111410
- `, [placementTransformStyle("bottom-right")]), cM("bottom-left", `
111411
- left: 0;
111412
- `, [placementTransformStyle("bottom-left")]), cM("scrollable", [cM("top-right", `
111644
+ `)]), cM("top-right, bottom-right", `
111645
+ align-items: flex-end;
111646
+ `), cM("top-left, bottom-left", `
111647
+ align-items: flex-start;
111648
+ `), cM("scrollable", [cM("top-right", `
111413
111649
  top: 0;
111414
111650
  `), cM("top-left", `
111415
111651
  top: 0;
@@ -111446,6 +111682,7 @@
111446
111682
  `)]), cB("notification", `
111447
111683
  background-color: var(--u-color);
111448
111684
  color: var(--u-text-color);
111685
+ pointer-events: auto;
111449
111686
  transition:
111450
111687
  background-color .3s var(--u-bezier),
111451
111688
  color .3s var(--u-bezier),
@@ -111544,16 +111781,6 @@
111544
111781
  `, [c$1("&:first-child", {
111545
111782
  margin: 0
111546
111783
  })])])])])]);
111547
- function placementTransformStyle(placement) {
111548
- const direction = placement.split("-")[1];
111549
- const transformXEnter = direction === "left" ? "calc(-100%)" : "calc(100%)";
111550
- const transformXLeave = "0";
111551
- return cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111552
- transform: translate(${transformXEnter}, 0);
111553
- `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
111554
- transform: translate(${transformXLeave}, 0);
111555
- `)]);
111556
- }
111557
111784
 
111558
111785
  const notificationApiInjectionKey = createInjectionKey("u-notification-api");
111559
111786
  const notificationProviderProps = {
@@ -112398,7 +112625,7 @@
112398
112625
  });
112399
112626
  }
112400
112627
 
112401
- var version = "2.0.0";
112628
+ var version = "2.0.3";
112402
112629
 
112403
112630
  function create({
112404
112631
  componentPrefix = "U",