@fairmint/ui 0.2.24 → 0.2.25

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.
@@ -19315,6 +19315,36 @@ const NumberInput = factory((_props, ref) => {
19315
19315
  );
19316
19316
  setTimeout(() => adjustCursor(inputRef.current?.value.length), 0);
19317
19317
  };
19318
+ const handlePaste = (event) => {
19319
+ const pastedText = event.clipboardData.getData("text");
19320
+ const _decimalSeparator = others.decimalSeparator || ".";
19321
+ const separatorsToReplace = (allowedDecimalSeparators || [".", ","]).filter(
19322
+ (s) => s !== _decimalSeparator
19323
+ );
19324
+ if (separatorsToReplace.some((s) => pastedText.includes(s))) {
19325
+ event.preventDefault();
19326
+ let modifiedText = pastedText;
19327
+ separatorsToReplace.forEach((s) => {
19328
+ modifiedText = modifiedText.split(s).join(_decimalSeparator);
19329
+ });
19330
+ const input = inputRef.current;
19331
+ if (input) {
19332
+ const start = input.selectionStart ?? 0;
19333
+ const end = input.selectionEnd ?? 0;
19334
+ const currentValue = input.value;
19335
+ const newValue = currentValue.substring(0, start) + modifiedText + currentValue.substring(end);
19336
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
19337
+ window.HTMLInputElement.prototype,
19338
+ "value"
19339
+ )?.set;
19340
+ nativeInputValueSetter?.call(input, newValue);
19341
+ input.dispatchEvent(new Event("change", { bubbles: true }));
19342
+ const cursorPos = start + modifiedText.length;
19343
+ setTimeout(() => adjustCursor(cursorPos), 0);
19344
+ }
19345
+ }
19346
+ others.onPaste?.(event);
19347
+ };
19318
19348
  const handleKeyDown = (event) => {
19319
19349
  onKeyDown?.(event);
19320
19350
  if (readOnly || !withKeyboardEvents) {
@@ -19439,6 +19469,7 @@ const NumberInput = factory((_props, ref) => {
19439
19469
  unstyled,
19440
19470
  __staticSelector: "NumberInput",
19441
19471
  decimalScale: allowDecimal ? decimalScale : 0,
19472
+ onPaste: handlePaste,
19442
19473
  onKeyDown: handleKeyDown,
19443
19474
  onKeyDownCapture: handleKeyDownCapture,
19444
19475
  rightSectionPointerEvents: rightSectionPointerEvents ?? (disabled ? "none" : void 0),
@@ -19928,6 +19959,7 @@ const PasswordInput$1 = factory((_props, ref) => {
19928
19959
  classNames: resolvedClassNames,
19929
19960
  styles: resolvedStyles,
19930
19961
  __staticSelector: "PasswordInput",
19962
+ __stylesApiProps: props,
19931
19963
  unstyled,
19932
19964
  withAsterisk,
19933
19965
  inputWrapperOrder,
@@ -19953,6 +19985,7 @@ const PasswordInput$1 = factory((_props, ref) => {
19953
19985
  radius,
19954
19986
  disabled,
19955
19987
  __staticSelector: "PasswordInput",
19988
+ __stylesApiProps: props,
19956
19989
  rightSectionWidth,
19957
19990
  rightSection: rightSection ?? visibilityToggleButton,
19958
19991
  variant,
@@ -20826,7 +20859,9 @@ const Tooltip$1 = factory((_props, ref) => {
20826
20859
  });
20827
20860
  const child = getSingleElementChild(children);
20828
20861
  if (!target && !child) {
20829
- return null;
20862
+ throw new Error(
20863
+ "[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
20864
+ );
20830
20865
  }
20831
20866
  if (target) {
20832
20867
  const transition2 = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });