@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.
@@ -19333,6 +19333,36 @@ const NumberInput = factory((_props, ref) => {
19333
19333
  );
19334
19334
  setTimeout(() => adjustCursor(inputRef.current?.value.length), 0);
19335
19335
  };
19336
+ const handlePaste = (event) => {
19337
+ const pastedText = event.clipboardData.getData("text");
19338
+ const _decimalSeparator = others.decimalSeparator || ".";
19339
+ const separatorsToReplace = (allowedDecimalSeparators || [".", ","]).filter(
19340
+ (s) => s !== _decimalSeparator
19341
+ );
19342
+ if (separatorsToReplace.some((s) => pastedText.includes(s))) {
19343
+ event.preventDefault();
19344
+ let modifiedText = pastedText;
19345
+ separatorsToReplace.forEach((s) => {
19346
+ modifiedText = modifiedText.split(s).join(_decimalSeparator);
19347
+ });
19348
+ const input = inputRef.current;
19349
+ if (input) {
19350
+ const start = input.selectionStart ?? 0;
19351
+ const end = input.selectionEnd ?? 0;
19352
+ const currentValue = input.value;
19353
+ const newValue = currentValue.substring(0, start) + modifiedText + currentValue.substring(end);
19354
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
19355
+ window.HTMLInputElement.prototype,
19356
+ "value"
19357
+ )?.set;
19358
+ nativeInputValueSetter?.call(input, newValue);
19359
+ input.dispatchEvent(new Event("change", { bubbles: true }));
19360
+ const cursorPos = start + modifiedText.length;
19361
+ setTimeout(() => adjustCursor(cursorPos), 0);
19362
+ }
19363
+ }
19364
+ others.onPaste?.(event);
19365
+ };
19336
19366
  const handleKeyDown = (event) => {
19337
19367
  onKeyDown?.(event);
19338
19368
  if (readOnly || !withKeyboardEvents) {
@@ -19457,6 +19487,7 @@ const NumberInput = factory((_props, ref) => {
19457
19487
  unstyled,
19458
19488
  __staticSelector: "NumberInput",
19459
19489
  decimalScale: allowDecimal ? decimalScale : 0,
19490
+ onPaste: handlePaste,
19460
19491
  onKeyDown: handleKeyDown,
19461
19492
  onKeyDownCapture: handleKeyDownCapture,
19462
19493
  rightSectionPointerEvents: rightSectionPointerEvents ?? (disabled ? "none" : void 0),
@@ -19946,6 +19977,7 @@ const PasswordInput$1 = factory((_props, ref) => {
19946
19977
  classNames: resolvedClassNames,
19947
19978
  styles: resolvedStyles,
19948
19979
  __staticSelector: "PasswordInput",
19980
+ __stylesApiProps: props,
19949
19981
  unstyled,
19950
19982
  withAsterisk,
19951
19983
  inputWrapperOrder,
@@ -19971,6 +20003,7 @@ const PasswordInput$1 = factory((_props, ref) => {
19971
20003
  radius,
19972
20004
  disabled,
19973
20005
  __staticSelector: "PasswordInput",
20006
+ __stylesApiProps: props,
19974
20007
  rightSectionWidth,
19975
20008
  rightSection: rightSection ?? visibilityToggleButton,
19976
20009
  variant,
@@ -20844,7 +20877,9 @@ const Tooltip$1 = factory((_props, ref) => {
20844
20877
  });
20845
20878
  const child = getSingleElementChild(children);
20846
20879
  if (!target && !child) {
20847
- return null;
20880
+ throw new Error(
20881
+ "[@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"
20882
+ );
20848
20883
  }
20849
20884
  if (target) {
20850
20885
  const transition2 = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });