@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.mjs CHANGED
@@ -54614,7 +54614,7 @@ var ChatMainArea = defineComponent({
54614
54614
  const chat = selectedChatRef.value;
54615
54615
  const keyId = toKeyString(chat?.id);
54616
54616
  const keyTitle = toKeyString(chat?.title);
54617
- return /* @__PURE__ */ h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header-inner` }, /* @__PURE__ */ h(
54617
+ return /* @__PURE__ */ h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header-inner` }, /* @__PURE__ */ h(
54618
54618
  "div",
54619
54619
  {
54620
54620
  class: `${mergedClsPrefixRef.value}-chat-main__header-title-wrap`
@@ -54757,7 +54757,7 @@ var ChatMainArea = defineComponent({
54757
54757
  return buttons;
54758
54758
  })
54759
54759
  }
54760
- ));
54760
+ )));
54761
54761
  };
54762
54762
  const renderMessages = () => {
54763
54763
  return /* @__PURE__ */ h(
@@ -80924,6 +80924,7 @@ function useDragModal(draggablePropsRef, options) {
80924
80924
  }
80925
80925
 
80926
80926
  const presetProps = {
80927
+ ...cardBaseProps,
80927
80928
  // put dialog props after since I want the card to unbordered by default
80928
80929
  ...dialogProps,
80929
80930
  size: {
@@ -91212,14 +91213,23 @@ var _UInfiniteScroll = defineComponent({
91212
91213
  }
91213
91214
  });
91214
91215
 
91215
- var style$z = c$1([cB("input-number-suffix", `
91216
- display: inline-block;
91217
- margin-right: 10px;
91218
- `), cB("input-number-prefix", `
91219
- display: inline-block;
91220
- margin-left: 10px;
91221
- `)]);
91222
-
91216
+ const MAX_AMOUNT_INPUT_DIGITS = 16;
91217
+ var InputNumberRegex = /* @__PURE__ */(InputNumberRegex2 => {
91218
+ InputNumberRegex2["INPUT_WIP_VALUE"] = "^(-)?\\d+.*(\\.|0)$";
91219
+ InputNumberRegex2["INPUT_LEADING_DOT_WIP_VALUE"] = "^\\.\\d+$";
91220
+ InputNumberRegex2["AMOUNT_INPUT"] = "^-?[\\d\\s]*\\.?\\d*$";
91221
+ InputNumberRegex2["AMOUNT_VALUE"] = "^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$";
91222
+ InputNumberRegex2["AMOUNT_RAW_LEADING_DOT"] = "^-?\\.\\d*$";
91223
+ InputNumberRegex2["WHITESPACE"] = "\\s";
91224
+ InputNumberRegex2["NON_DIGIT"] = "\\D";
91225
+ InputNumberRegex2["LEADING_ZEROS"] = "^0+(?=\\d)";
91226
+ InputNumberRegex2["NON_ZERO_DIGIT"] = "[1-9]";
91227
+ InputNumberRegex2["TRAILING_ZERO_FRACTION"] = "\\.?0+$";
91228
+ InputNumberRegex2["THOUSANDS_SEPARATOR"] = "\\B(?=(\\d{3})+(?!\\d))";
91229
+ return InputNumberRegex2;
91230
+ })(InputNumberRegex || {});
91231
+
91232
+ const MAX_SAFE_INTEGER_LIMIT = String(Number.MAX_SAFE_INTEGER);
91223
91233
  function parse(value) {
91224
91234
  if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") {
91225
91235
  return null;
@@ -91227,7 +91237,7 @@ function parse(value) {
91227
91237
  return Number(value);
91228
91238
  }
91229
91239
  function isWipValue(value) {
91230
- return value.includes(".") && (/^(-)?\d+.*(\.|0)$/.test(value) || /^\.\d+$/.test(value));
91240
+ return value.includes(".") && (new RegExp(InputNumberRegex.INPUT_WIP_VALUE).test(value) || new RegExp(InputNumberRegex.INPUT_LEADING_DOT_WIP_VALUE).test(value));
91231
91241
  }
91232
91242
  function validator(value) {
91233
91243
  if (value === void 0 || value === null) return true;
@@ -91251,6 +91261,100 @@ function parseNumber(number) {
91251
91261
  }
91252
91262
  }
91253
91263
  }
91264
+ function getPrecision(value) {
91265
+ const fraction = String(value).split(".")[1];
91266
+ return fraction ? fraction.length : 0;
91267
+ }
91268
+ function stripAmountFormatting(value) {
91269
+ return String(value).replace(new RegExp(InputNumberRegex.WHITESPACE, "g"), "").trim();
91270
+ }
91271
+ function isValidAmountInput(value) {
91272
+ return value === "" || new RegExp(InputNumberRegex.AMOUNT_INPUT).test(value);
91273
+ }
91274
+ function isAmountInputWithinDigitLimit(value, maxDigits = MAX_AMOUNT_INPUT_DIGITS) {
91275
+ return value.replace(new RegExp(InputNumberRegex.NON_DIGIT, "g"), "").length <= maxDigits;
91276
+ }
91277
+ function getRejectedSelectionRange(prevDisplayedValue, attemptedDisplayedValue, selectionStart, selectionEnd) {
91278
+ const removedLength = Math.max(0, attemptedDisplayedValue.length - prevDisplayedValue.length);
91279
+ return {
91280
+ start: Math.min(prevDisplayedValue.length, Math.max(0, selectionStart - removedLength)),
91281
+ end: Math.min(prevDisplayedValue.length, Math.max(0, selectionEnd - removedLength))
91282
+ };
91283
+ }
91284
+ function exceedsMaxSafeAmountValue(numberString) {
91285
+ const normalized = numberString.startsWith("-") ? numberString.slice(1) : numberString;
91286
+ const [integerPart = "0", fractionPart = ""] = normalized.split(".");
91287
+ const normalizedIntegerPart = integerPart.replace(new RegExp(InputNumberRegex.LEADING_ZEROS), "");
91288
+ 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));
91289
+ }
91290
+ function parseAmount(input) {
91291
+ if (input === void 0 || input === null) return null;
91292
+ const numberString = stripAmountFormatting(input);
91293
+ if (new RegExp(InputNumberRegex.AMOUNT_VALUE).test(numberString)) {
91294
+ if (exceedsMaxSafeAmountValue(numberString)) return Number.NaN;
91295
+ return Number(numberString);
91296
+ }
91297
+ return numberString === "" ? null : Number.NaN;
91298
+ }
91299
+ function formatAmount(value, precision) {
91300
+ if (value === void 0 || value === null) return "";
91301
+ let stringValue = String(value);
91302
+ if (precision !== void 0) {
91303
+ stringValue = value.toFixed(precision).replace(new RegExp(InputNumberRegex.TRAILING_ZERO_FRACTION), "");
91304
+ }
91305
+ const negative = stringValue.startsWith("-");
91306
+ if (negative) stringValue = stringValue.slice(1);
91307
+ const [integerPart, fractionPart] = stringValue.split(".");
91308
+ const integerWithSeparator = integerPart.replace(new RegExp(InputNumberRegex.THOUSANDS_SEPARATOR, "g"), " ");
91309
+ return `${negative ? "-" : ""}${integerWithSeparator}${fractionPart ? `.${fractionPart}` : ""}`;
91310
+ }
91311
+ function formattedToRawIndex(formatted, caret) {
91312
+ let raw = 0;
91313
+ for (let i = 0; i < Math.min(caret, formatted.length); i++) {
91314
+ if (formatted[i] !== " ") raw++;
91315
+ }
91316
+ return raw;
91317
+ }
91318
+ function rawIndexToCaret(formatted, rawIndex) {
91319
+ if (rawIndex <= 0) return 0;
91320
+ let raw = 0;
91321
+ for (let i = 0; i < formatted.length; i++) {
91322
+ if (formatted[i] !== " ") raw++;
91323
+ if (raw === rawIndex) return i + 1;
91324
+ }
91325
+ return formatted.length;
91326
+ }
91327
+ function isRawWipValue(formatted) {
91328
+ return isWipValue(stripAmountFormatting(formatted));
91329
+ }
91330
+ function mapSelectionAfterFormat(formatted, newFormatted, selectionStart, selectionEnd) {
91331
+ const rawStart = formattedToRawIndex(formatted, selectionStart);
91332
+ const rawEnd = formattedToRawIndex(formatted, selectionEnd);
91333
+ const rawInput = stripAmountFormatting(formatted);
91334
+ if (new RegExp(InputNumberRegex.AMOUNT_RAW_LEADING_DOT).test(rawInput)) {
91335
+ const {
91336
+ length
91337
+ } = newFormatted;
91338
+ return {
91339
+ start: length,
91340
+ end: length
91341
+ };
91342
+ }
91343
+ const newStart = rawIndexToCaret(newFormatted, rawStart);
91344
+ const newEnd = rawIndexToCaret(newFormatted, rawEnd);
91345
+ return {
91346
+ start: newStart,
91347
+ end: newEnd
91348
+ };
91349
+ }
91350
+
91351
+ var style$z = c$1([cB("input-number-suffix", `
91352
+ display: inline-block;
91353
+ margin-right: 10px;
91354
+ `), cB("input-number-prefix", `
91355
+ display: inline-block;
91356
+ margin-left: 10px;
91357
+ `)]);
91254
91358
 
91255
91359
  const HOLDING_CHANGE_THRESHOLD = 800;
91256
91360
  const HOLDING_CHANGE_INTERVAL = 100;
@@ -91301,6 +91405,10 @@ const inputNumberProps = {
91301
91405
  type: Boolean,
91302
91406
  default: true
91303
91407
  },
91408
+ type: {
91409
+ type: String,
91410
+ default: "default"
91411
+ },
91304
91412
  parse: Function,
91305
91413
  format: Function,
91306
91414
  precision: Number,
@@ -91350,10 +91458,6 @@ var _UInputNumber = defineComponent({
91350
91458
  uncontrolledValueRef
91351
91459
  );
91352
91460
  const displayedValueRef = ref("");
91353
- const getPrecision = (value) => {
91354
- const fraction = String(value).split(".")[1];
91355
- return fraction ? fraction.length : 0;
91356
- };
91357
91461
  const getMaxPrecision = (currentValue) => {
91358
91462
  const precisions = [props.min, props.max, props.step, currentValue].map(
91359
91463
  (value) => {
@@ -91389,6 +91493,39 @@ var _UInputNumber = defineComponent({
91389
91493
  return parsedNumber;
91390
91494
  else return null;
91391
91495
  });
91496
+ const isAmountTypeRef = useMemo(() => props.type === "amount");
91497
+ const showButtonRef = useMemo(() => {
91498
+ return isAmountTypeRef.value ? false : props.showButton;
91499
+ });
91500
+ const effectiveParse = (input) => {
91501
+ if (props.parse) return props.parse(input);
91502
+ if (isAmountTypeRef.value) return parseAmount(input);
91503
+ return parse(input);
91504
+ };
91505
+ const effectiveFormat = (value, precision) => {
91506
+ if (props.format && value !== void 0) return props.format(value);
91507
+ if (isAmountTypeRef.value) return formatAmount(value, precision);
91508
+ return format(value, precision);
91509
+ };
91510
+ const doUpdateValue = (value) => {
91511
+ const { value: mergedValue } = mergedValueRef;
91512
+ if (value === mergedValue) {
91513
+ deriveDisplayedValueFromValue();
91514
+ return;
91515
+ }
91516
+ const {
91517
+ "onUpdate:value": _onUpdateValue,
91518
+ onUpdateValue,
91519
+ onChange
91520
+ } = props;
91521
+ const { triggerFormInput, triggerFormChange } = formItem;
91522
+ if (onChange) call(onChange, value);
91523
+ if (onUpdateValue) call(onUpdateValue, value);
91524
+ if (_onUpdateValue) call(_onUpdateValue, value);
91525
+ uncontrolledValueRef.value = value;
91526
+ triggerFormInput();
91527
+ triggerFormChange();
91528
+ };
91392
91529
  const deriveValueFromDisplayedValue = ({
91393
91530
  offset,
91394
91531
  doUpdateIfValid,
@@ -91399,7 +91536,7 @@ var _UInputNumber = defineComponent({
91399
91536
  if (isInputing && isWipValue(displayedValue)) {
91400
91537
  return false;
91401
91538
  }
91402
- const parsedValue = (props.parse || parse)(displayedValue);
91539
+ const parsedValue = effectiveParse(displayedValue);
91403
91540
  if (parsedValue === null) {
91404
91541
  if (doUpdateIfValid)
91405
91542
  doUpdateValue(null);
@@ -91441,43 +91578,70 @@ var _UInputNumber = defineComponent({
91441
91578
  const deriveDisplayedValueFromValue = () => {
91442
91579
  const { value: mergedValue } = mergedValueRef;
91443
91580
  if (validator(mergedValue)) {
91444
- const { format: formatProp, precision } = props;
91445
- if (formatProp) {
91446
- displayedValueRef.value = formatProp(mergedValue);
91447
- } else {
91448
- if (mergedValue === null || precision === void 0 || getPrecision(mergedValue) > precision) {
91449
- displayedValueRef.value = format(mergedValue, void 0);
91450
- } else {
91451
- displayedValueRef.value = format(mergedValue, precision);
91452
- }
91453
- }
91581
+ const { precision } = props;
91582
+ displayedValueRef.value = effectiveFormat(
91583
+ mergedValue,
91584
+ mergedValue === null ? void 0 : precision
91585
+ );
91454
91586
  } else {
91455
91587
  displayedValueRef.value = String(mergedValue);
91456
91588
  }
91457
91589
  };
91458
- deriveDisplayedValueFromValue();
91459
- function doUpdateValue(value) {
91460
- const { value: mergedValue } = mergedValueRef;
91461
- if (value === mergedValue) {
91462
- deriveDisplayedValueFromValue();
91463
- return;
91590
+ const computeValueToFormat = (prev, derived) => {
91591
+ if (derived !== false && derived !== null) return derived;
91592
+ if (!isAmountTypeRef.value) return null;
91593
+ const parsed = effectiveParse(prev);
91594
+ if (parsed === null || Number.isNaN(parsed)) return null;
91595
+ return parsed;
91596
+ };
91597
+ const setInputValueSelection = (value, selectionStart, selectionEnd) => {
91598
+ const inputElement = inputInstRef.value?.inputElRef;
91599
+ if (!inputElement) return;
91600
+ inputElement.value = value;
91601
+ inputElement.setSelectionRange(selectionStart, selectionEnd);
91602
+ };
91603
+ const applyFormatted = (prev, valueNumber) => {
91604
+ const inputElement = inputInstRef.value?.inputElRef;
91605
+ const selectionStart = inputElement?.selectionStart ?? prev.length;
91606
+ const selectionEnd = inputElement?.selectionEnd ?? selectionStart;
91607
+ const newFormatted = effectiveFormat(valueNumber, props.precision);
91608
+ displayedValueRef.value = newFormatted;
91609
+ void nextTick(() => {
91610
+ const { start, end } = mapSelectionAfterFormat(
91611
+ prev,
91612
+ newFormatted,
91613
+ selectionStart,
91614
+ selectionEnd
91615
+ );
91616
+ inputElement?.setSelectionRange(start, end);
91617
+ });
91618
+ };
91619
+ const restoreRejectedAmountInput = (prevDisplayedValue, attemptedDisplayedValue) => {
91620
+ const inputElement = inputInstRef.value?.inputElRef;
91621
+ const selectionStart = inputElement?.selectionStart ?? attemptedDisplayedValue.length;
91622
+ const selectionEnd = inputElement?.selectionEnd ?? selectionStart;
91623
+ const { start, end } = getRejectedSelectionRange(
91624
+ prevDisplayedValue,
91625
+ attemptedDisplayedValue,
91626
+ selectionStart,
91627
+ selectionEnd
91628
+ );
91629
+ displayedValueRef.value = prevDisplayedValue;
91630
+ setInputValueSelection(prevDisplayedValue, start, end);
91631
+ void nextTick(() => {
91632
+ setInputValueSelection(prevDisplayedValue, start, end);
91633
+ });
91634
+ };
91635
+ const shouldRejectAmountInput = (value) => {
91636
+ if (!isValidAmountInput(value)) return true;
91637
+ if (!isAmountInputWithinDigitLimit(value, MAX_AMOUNT_INPUT_DIGITS)) {
91638
+ return true;
91464
91639
  }
91465
- const {
91466
- "onUpdate:value": _onUpdateValue,
91467
- onUpdateValue,
91468
- onChange
91469
- } = props;
91470
- const { triggerFormInput, triggerFormChange } = formItem;
91471
- if (onChange)
91472
- call(onChange, value);
91473
- if (onUpdateValue)
91474
- call(onUpdateValue, value);
91475
- if (_onUpdateValue)
91476
- call(_onUpdateValue, value);
91477
- uncontrolledValueRef.value = value;
91478
- triggerFormInput();
91479
- triggerFormChange();
91480
- }
91640
+ if (props.precision === void 0) return false;
91641
+ const parsedValue = effectiveParse(value);
91642
+ return parsedValue !== null && !Number.isNaN(parsedValue) && getPrecision(parsedValue) > props.precision;
91643
+ };
91644
+ deriveDisplayedValueFromValue();
91481
91645
  const displayedValueInvalidRef = useMemo(() => {
91482
91646
  const derivedValue = deriveValueFromDisplayedValue({
91483
91647
  offset: 0,
@@ -91729,15 +91893,30 @@ var _UInputNumber = defineComponent({
91729
91893
  }
91730
91894
  }
91731
91895
  }
91896
+ const shouldTryFormat = () => props.updateValueOnInput && !props.format && !props.parse && (props.precision === void 0 || isAmountTypeRef.value);
91732
91897
  function handleUpdateDisplayedValue(value) {
91898
+ const prevDisplayedValue = displayedValueRef.value;
91899
+ const prevFormatted = value;
91900
+ if (isAmountTypeRef.value) {
91901
+ if (shouldRejectAmountInput(value)) {
91902
+ restoreRejectedAmountInput(prevDisplayedValue, value);
91903
+ return;
91904
+ }
91905
+ }
91733
91906
  displayedValueRef.value = value;
91734
- if (props.updateValueOnInput && !props.format && !props.parse && props.precision === void 0) {
91735
- deriveValueFromDisplayedValue({
91736
- offset: 0,
91737
- doUpdateIfValid: true,
91738
- isInputing: true,
91739
- fixPrecision: false
91740
- });
91907
+ if (!shouldTryFormat()) return;
91908
+ if (isAmountTypeRef.value) {
91909
+ if (isRawWipValue(prevFormatted)) return;
91910
+ }
91911
+ const derived = deriveValueFromDisplayedValue({
91912
+ offset: 0,
91913
+ doUpdateIfValid: true,
91914
+ isInputing: true,
91915
+ fixPrecision: false
91916
+ });
91917
+ const valueToFormat = computeValueToFormat(prevFormatted, derived);
91918
+ if (valueToFormat !== null && isAmountTypeRef.value) {
91919
+ applyFormatted(prevFormatted, valueToFormat);
91741
91920
  }
91742
91921
  }
91743
91922
  watch(mergedValueRef, () => {
@@ -91770,6 +91949,7 @@ var _UInputNumber = defineComponent({
91770
91949
  displayedValue: displayedValueRef,
91771
91950
  addable: addableRef,
91772
91951
  minusable: minusableRef,
91952
+ showButton: showButtonRef,
91773
91953
  mergedStatus: mergedStatusRef,
91774
91954
  handleFocus,
91775
91955
  handleBlur,
@@ -95243,7 +95423,8 @@ const mappingCardListProps = {
95243
95423
  gap: {
95244
95424
  type: Number,
95245
95425
  default: 16
95246
- }
95426
+ },
95427
+ emptyProps: Object
95247
95428
  };
95248
95429
 
95249
95430
  var MappingCardBody = defineComponent({
@@ -96008,9 +96189,16 @@ var style$o = c$1([cB("mapping-card", `
96008
96189
  color: var(--u-arrow-color);
96009
96190
  font-size: 16px;
96010
96191
  flex-shrink: 0;
96011
- `)]), cB("mapping-card-list", [cE("pagination", `
96012
- margin-top: 16px;
96013
- `)])]);
96192
+ `)]), cB("mapping-card-list", `
96193
+ display: flex;
96194
+ justify-content: space-between;
96195
+ flex-direction: column;
96196
+ height: 100%;
96197
+ `, [cE("pagination", `
96198
+ margin-top: 16px;
96199
+ `), cE("empty", `
96200
+ margin: auto;
96201
+ `)])]);
96014
96202
 
96015
96203
  var _UMappingCard = defineComponent({
96016
96204
  name: "MappingCard",
@@ -96101,8 +96289,18 @@ var _UMappingCardList = defineComponent({
96101
96289
  };
96102
96290
  },
96103
96291
  render() {
96104
- const { mergedClsPrefix, mergedPagination, gap, items } = this;
96105
- return /* @__PURE__ */ h("div", { class: `${mergedClsPrefix}-mapping-card-list` }, /* @__PURE__ */ h(
96292
+ const {
96293
+ mergedClsPrefix,
96294
+ mergedPagination,
96295
+ gap,
96296
+ items,
96297
+ emptyProps,
96298
+ $slots
96299
+ } = this;
96300
+ const isEmpty = !items.length;
96301
+ return /* @__PURE__ */ h("div", { class: `${mergedClsPrefix}-mapping-card-list` }, isEmpty ? /* @__PURE__ */ h("div", { class: `${mergedClsPrefix}-mapping-card-list__empty` }, resolveSlot($slots.empty, () => [
96302
+ /* @__PURE__ */ h(UEmpty$1, { size: "large", ...emptyProps })
96303
+ ])) : /* @__PURE__ */ h(
96106
96304
  _UFlex,
96107
96305
  {
96108
96306
  vertical: true,
@@ -111197,6 +111395,7 @@ const Notification = defineComponent({
111197
111395
  const notificationEnvOptions = {
111198
111396
  ...notificationProps,
111199
111397
  duration: Number,
111398
+ pauseOnVisibilityChange: Boolean,
111200
111399
  onClose: Function,
111201
111400
  onLeave: Function,
111202
111401
  onAfterEnter: Function,
@@ -111226,10 +111425,45 @@ const NotificationEnvironment = defineComponent({
111226
111425
  const { wipTransitionCountRef } = inject(notificationProviderInjectionKey);
111227
111426
  const showRef = ref(true);
111228
111427
  let timerId = null;
111428
+ let remainingDuration = null;
111429
+ let timerStartedAt = null;
111430
+ let timerPausedForVisibility = false;
111431
+ function clearTimer() {
111432
+ if (timerId !== null) {
111433
+ window.clearTimeout(timerId);
111434
+ timerId = null;
111435
+ }
111436
+ }
111229
111437
  function hide() {
111230
111438
  showRef.value = false;
111231
- if (timerId) {
111232
- window.clearTimeout(timerId);
111439
+ clearTimer();
111440
+ }
111441
+ function startTimer(duration) {
111442
+ clearTimer();
111443
+ remainingDuration = duration;
111444
+ timerStartedAt = Date.now();
111445
+ timerId = window.setTimeout(hide, duration);
111446
+ }
111447
+ function handleVisibilityChange() {
111448
+ if (document.visibilityState === "hidden") {
111449
+ if (timerId !== null) {
111450
+ clearTimer();
111451
+ if (timerStartedAt !== null && remainingDuration !== null) {
111452
+ remainingDuration = Math.max(
111453
+ 0,
111454
+ remainingDuration - (Date.now() - timerStartedAt)
111455
+ );
111456
+ }
111457
+ timerStartedAt = null;
111458
+ timerPausedForVisibility = true;
111459
+ }
111460
+ } else if (timerPausedForVisibility) {
111461
+ timerPausedForVisibility = false;
111462
+ if (remainingDuration !== null && remainingDuration > 0) {
111463
+ startTimer(remainingDuration);
111464
+ } else {
111465
+ hide();
111466
+ }
111233
111467
  }
111234
111468
  }
111235
111469
  function handleBeforeEnter(el) {
@@ -111278,16 +111512,13 @@ const NotificationEnvironment = defineComponent({
111278
111512
  function setHideTimeout() {
111279
111513
  const { duration } = props;
111280
111514
  if (duration) {
111281
- timerId = window.setTimeout(hide, duration);
111515
+ startTimer(duration);
111282
111516
  }
111283
111517
  }
111284
111518
  function handleMouseenter(e) {
111285
111519
  if (e.currentTarget !== e.target)
111286
111520
  return;
111287
- if (timerId !== null) {
111288
- window.clearTimeout(timerId);
111289
- timerId = null;
111290
- }
111521
+ clearTimer();
111291
111522
  }
111292
111523
  function handleMouseleave(e) {
111293
111524
  if (e.currentTarget !== e.target)
@@ -111308,9 +111539,15 @@ const NotificationEnvironment = defineComponent({
111308
111539
  }
111309
111540
  onMounted(() => {
111310
111541
  if (props.duration) {
111311
- timerId = window.setTimeout(hide, props.duration);
111542
+ startTimer(props.duration);
111543
+ }
111544
+ if (props.pauseOnVisibilityChange) {
111545
+ document.addEventListener("visibilitychange", handleVisibilityChange);
111312
111546
  }
111313
111547
  });
111548
+ onBeforeUnmount(() => {
111549
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
111550
+ });
111314
111551
  return {
111315
111552
  show: showRef,
111316
111553
  hide,
@@ -111356,12 +111593,16 @@ const NotificationEnvironment = defineComponent({
111356
111593
  var style = c$1([cB("notification-container", `
111357
111594
  z-index: 4000;
111358
111595
  position: fixed;
111596
+ left: 0;
111597
+ right: 0;
111359
111598
  overflow: visible;
111360
111599
  display: flex;
111361
111600
  flex-direction: column;
111362
111601
  align-items: flex-end;
111602
+ pointer-events: none;
111363
111603
  `, [c$1(">", [cB("scrollbar", `
111364
- width: initial;
111604
+ width: -moz-fit-content;
111605
+ width: fit-content;
111365
111606
  overflow: visible;
111366
111607
  height: -moz-fit-content !important;
111367
111608
  height: fit-content !important;
@@ -111387,8 +111628,7 @@ var style = c$1([cB("notification-container", `
111387
111628
  margin-bottom: 0;
111388
111629
  margin-top: 12px;
111389
111630
  `)]), cM("top, bottom", `
111390
- left: 50%;
111391
- transform: translateX(-50%);
111631
+ align-items: center;
111392
111632
  `, [cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111393
111633
  transform: scale(0.85);
111394
111634
  `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
@@ -111397,15 +111637,11 @@ var style = c$1([cB("notification-container", `
111397
111637
  transform-origin: top center;
111398
111638
  `)]), cM("bottom", [cB("notification-wrapper", `
111399
111639
  transform-origin: bottom center;
111400
- `)]), cM("top-right", `
111401
- right: 0;
111402
- `, [placementTransformStyle("top-right")]), cM("top-left", `
111403
- left: 0;
111404
- `, [placementTransformStyle("top-left")]), cM("bottom-right", `
111405
- right: 0;
111406
- `, [placementTransformStyle("bottom-right")]), cM("bottom-left", `
111407
- left: 0;
111408
- `, [placementTransformStyle("bottom-left")]), cM("scrollable", [cM("top-right", `
111640
+ `)]), cM("top-right, bottom-right", `
111641
+ align-items: flex-end;
111642
+ `), cM("top-left, bottom-left", `
111643
+ align-items: flex-start;
111644
+ `), cM("scrollable", [cM("top-right", `
111409
111645
  top: 0;
111410
111646
  `), cM("top-left", `
111411
111647
  top: 0;
@@ -111442,6 +111678,7 @@ var style = c$1([cB("notification-container", `
111442
111678
  `)]), cB("notification", `
111443
111679
  background-color: var(--u-color);
111444
111680
  color: var(--u-text-color);
111681
+ pointer-events: auto;
111445
111682
  transition:
111446
111683
  background-color .3s var(--u-bezier),
111447
111684
  color .3s var(--u-bezier),
@@ -111540,16 +111777,6 @@ var style = c$1([cB("notification-container", `
111540
111777
  `, [c$1("&:first-child", {
111541
111778
  margin: 0
111542
111779
  })])])])])]);
111543
- function placementTransformStyle(placement) {
111544
- const direction = placement.split("-")[1];
111545
- const transformXEnter = direction === "left" ? "calc(-100%)" : "calc(100%)";
111546
- const transformXLeave = "0";
111547
- return cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111548
- transform: translate(${transformXEnter}, 0);
111549
- `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
111550
- transform: translate(${transformXLeave}, 0);
111551
- `)]);
111552
- }
111553
111780
 
111554
111781
  const notificationApiInjectionKey = createInjectionKey("u-notification-api");
111555
111782
  const notificationProviderProps = {
@@ -112394,7 +112621,7 @@ function useThemeVars() {
112394
112621
  });
112395
112622
  }
112396
112623
 
112397
- var version = "2.0.0";
112624
+ var version = "2.0.3";
112398
112625
 
112399
112626
  function create({
112400
112627
  componentPrefix = "U",