@simplybusiness/mobius 9.1.2 → 9.2.0

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.
@@ -836,22 +836,22 @@
836
836
  "format": "esm"
837
837
  },
838
838
  "src/components/Combobox/useComboboxOptions.ts": {
839
- "bytes": 2726,
839
+ "bytes": 3075,
840
840
  "imports": [
841
841
  {
842
- "path": "react",
842
+ "path": "@simplybusiness/mobius-hooks",
843
843
  "kind": "import-statement",
844
844
  "external": true
845
845
  },
846
846
  {
847
- "path": "src/components/Combobox/utils.tsx",
847
+ "path": "react",
848
848
  "kind": "import-statement",
849
- "original": "./utils"
849
+ "external": true
850
850
  },
851
851
  {
852
- "path": "@simplybusiness/mobius-hooks",
852
+ "path": "src/components/Combobox/utils.tsx",
853
853
  "kind": "import-statement",
854
- "external": true
854
+ "original": "./utils"
855
855
  }
856
856
  ],
857
857
  "format": "esm"
@@ -2832,7 +2832,7 @@
2832
2832
  "format": "esm"
2833
2833
  },
2834
2834
  "src/components/Text/Text.tsx": {
2835
- "bytes": 1697,
2835
+ "bytes": 1709,
2836
2836
  "imports": [
2837
2837
  {
2838
2838
  "path": "classnames/dedupe",
@@ -3559,7 +3559,7 @@
3559
3559
  "imports": [],
3560
3560
  "exports": [],
3561
3561
  "inputs": {},
3562
- "bytes": 352291
3562
+ "bytes": 352764
3563
3563
  },
3564
3564
  "dist/cjs/index.js": {
3565
3565
  "imports": [
@@ -3779,12 +3779,12 @@
3779
3779
  "external": true
3780
3780
  },
3781
3781
  {
3782
- "path": "react",
3782
+ "path": "@simplybusiness/mobius-hooks",
3783
3783
  "kind": "require-call",
3784
3784
  "external": true
3785
3785
  },
3786
3786
  {
3787
- "path": "@simplybusiness/mobius-hooks",
3787
+ "path": "react",
3788
3788
  "kind": "require-call",
3789
3789
  "external": true
3790
3790
  },
@@ -4793,7 +4793,7 @@
4793
4793
  "bytesInOutput": 2569
4794
4794
  },
4795
4795
  "src/components/Combobox/useComboboxOptions.ts": {
4796
- "bytesInOutput": 2380
4796
+ "bytesInOutput": 2613
4797
4797
  },
4798
4798
  "src/components/Combobox/Combobox.tsx": {
4799
4799
  "bytesInOutput": 11892
@@ -5171,7 +5171,7 @@
5171
5171
  "bytesInOutput": 2413
5172
5172
  }
5173
5173
  },
5174
- "bytes": 213830
5174
+ "bytes": 214063
5175
5175
  }
5176
5176
  }
5177
5177
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TextField
4
- } from "./chunk-YUDNS4SZ.js";
4
+ } from "./chunk-XGQ4SX2S.js";
5
5
 
6
6
  // src/components/MaskedField/MaskedField.tsx
7
7
  import { useCallback, useEffect } from "react";
@@ -139,4 +139,4 @@ MaskedField.displayName = "MaskedField";
139
139
  export {
140
140
  MaskedField
141
141
  };
142
- //# sourceMappingURL=MaskedField-FRCJBGMX.js.map
142
+ //# sourceMappingURL=MaskedField-U2CL5FHC.js.map
@@ -488,7 +488,7 @@ import { useCallback as useCallback4, useState as useState9 } from "react";
488
488
  // src/components/Combobox/Combobox.tsx
489
489
  import { useOnUnmount } from "@simplybusiness/mobius-hooks";
490
490
  import classNames14 from "classnames/dedupe";
491
- import { useEffect as useEffect6, useId as useId4, useRef as useRef4, useState as useState8 } from "react";
491
+ import { useEffect as useEffect6, useId as useId4, useRef as useRef5, useState as useState8 } from "react";
492
492
 
493
493
  // src/hooks/useBreakpoint/useBreakpoint.tsx
494
494
  import {
@@ -1253,8 +1253,8 @@ function useComboboxHighlight(options) {
1253
1253
  }
1254
1254
 
1255
1255
  // src/components/Combobox/useComboboxOptions.ts
1256
- import { useEffect as useEffect5, useState as useState7 } from "react";
1257
1256
  import { useDebouncedValue as useDebouncedValue2 } from "@simplybusiness/mobius-hooks";
1257
+ import { useEffect as useEffect5, useRef as useRef4, useState as useState7 } from "react";
1258
1258
  function useComboboxOptions({
1259
1259
  options,
1260
1260
  asyncOptions,
@@ -1272,6 +1272,10 @@ function useComboboxOptions({
1272
1272
  );
1273
1273
  const [isLoading, setIsLoading] = useState7(false);
1274
1274
  const [error3, setError] = useState7(null);
1275
+ const asyncOptionsRef = useRef4(asyncOptions);
1276
+ asyncOptionsRef.current = asyncOptions;
1277
+ const onSearchedRef = useRef4(onSearched);
1278
+ onSearchedRef.current = onSearched;
1275
1279
  useEffect5(() => {
1276
1280
  const controller = new AbortController();
1277
1281
  const { signal } = controller;
@@ -1279,14 +1283,16 @@ function useComboboxOptions({
1279
1283
  setIsLoading(true);
1280
1284
  setError(null);
1281
1285
  try {
1282
- if (asyncOptions) {
1286
+ if (asyncOptionsRef.current) {
1283
1287
  if (debouncedInputValue.length < minSearchLength) {
1284
1288
  setFilteredOptions(void 0);
1285
1289
  return;
1286
1290
  }
1287
- const result = await asyncOptions(debouncedInputValue, { signal });
1291
+ const result = await asyncOptionsRef.current(debouncedInputValue, {
1292
+ signal
1293
+ });
1288
1294
  setFilteredOptions(result);
1289
- onSearched?.(debouncedInputValue);
1295
+ onSearchedRef.current?.(debouncedInputValue);
1290
1296
  } else if (options) {
1291
1297
  setFilteredOptions(filterOptions(options, debouncedInputValue));
1292
1298
  } else {
@@ -1312,11 +1318,9 @@ function useComboboxOptions({
1312
1318
  }, [
1313
1319
  debouncedInputValue,
1314
1320
  options,
1315
- asyncOptions,
1316
1321
  delay,
1317
1322
  minSearchLength,
1318
- skipNextDebounceRef,
1319
- onSearched
1323
+ skipNextDebounceRef
1320
1324
  ]);
1321
1325
  function updateFilteredOptions(newOptions) {
1322
1326
  setIsLoading(true);
@@ -1358,8 +1362,8 @@ var ComboboxInner = ({
1358
1362
  errorMessage,
1359
1363
  ...otherProps
1360
1364
  } = props;
1361
- const skipNextDebounceRef = useRef4(false);
1362
- const fallbackRef = useRef4(null);
1365
+ const skipNextDebounceRef = useRef5(false);
1366
+ const fallbackRef = useRef5(null);
1363
1367
  const [inputValue, setInputValue] = useState8(defaultValue || "");
1364
1368
  const [isOpen, setIsOpen] = useState8(false);
1365
1369
  const [isChanging, setIsChanging] = useState8(false);
@@ -1386,9 +1390,9 @@ var ComboboxInner = ({
1386
1390
  const inputRef = ref || fallbackRef;
1387
1391
  const listboxId = useId4();
1388
1392
  const statusId = useId4();
1389
- const blurTimeoutRef = useRef4(null);
1390
- const userInteractedRef = useRef4(false);
1391
- const justSelectedRef = useRef4(false);
1393
+ const blurTimeoutRef = useRef5(null);
1394
+ const userInteractedRef = useRef5(false);
1395
+ const justSelectedRef = useRef5(false);
1392
1396
  const { down } = useBreakpoint();
1393
1397
  const isMobile = down("md");
1394
1398
  useEffect6(() => {
@@ -2045,7 +2049,7 @@ var Button = ({ ref, ...props }) => {
2045
2049
  Button.displayName = "Button";
2046
2050
 
2047
2051
  // src/components/Checkbox/Checkbox.tsx
2048
- import { useRef as useRef5, useId as useId5, useState as useState10, useEffect as useEffect7 } from "react";
2052
+ import { useRef as useRef6, useId as useId5, useState as useState10, useEffect as useEffect7 } from "react";
2049
2053
  import classNames20 from "classnames/dedupe";
2050
2054
  import { squareTick, square } from "@simplybusiness/icons";
2051
2055
  import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -2069,7 +2073,7 @@ var Checkbox = ({ ref, ...props }) => {
2069
2073
  ...rest
2070
2074
  } = props;
2071
2075
  const [checked, setChecked] = useState10(defaultSelected);
2072
- const fallbackRef = useRef5(null);
2076
+ const fallbackRef = useRef6(null);
2073
2077
  const refObj = ref || fallbackRef;
2074
2078
  const inputId = useId5();
2075
2079
  const isControlled = typeof selected === "boolean";
@@ -2156,7 +2160,7 @@ import {
2156
2160
  isValidElement,
2157
2161
  useEffect as useEffect8,
2158
2162
  useId as useId6,
2159
- useRef as useRef6,
2163
+ useRef as useRef7,
2160
2164
  useState as useState11
2161
2165
  } from "react";
2162
2166
  import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
@@ -2178,8 +2182,8 @@ var CheckboxGroup = ({ ref, ...props }) => {
2178
2182
  ...rest
2179
2183
  } = props;
2180
2184
  const [selected, setSelected] = useState11(defaultValue);
2181
- const isInitializedRef = useRef6(false);
2182
- const prevDefaultValueRef = useRef6(defaultValue);
2185
+ const isInitializedRef = useRef7(false);
2186
+ const prevDefaultValueRef = useRef7(defaultValue);
2183
2187
  useEffect8(() => {
2184
2188
  const hasChanged = defaultValue.length !== prevDefaultValueRef.current.length || defaultValue.some(
2185
2189
  (val, index) => val !== prevDefaultValueRef.current[index]
@@ -2295,7 +2299,7 @@ Container.displayName = "Container";
2295
2299
 
2296
2300
  // src/components/DateField/DateField.tsx
2297
2301
  import classNames23 from "classnames/dedupe";
2298
- import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
2302
+ import { useEffect as useEffect9, useRef as useRef8, useState as useState12 } from "react";
2299
2303
 
2300
2304
  // src/components/DateField/validation.ts
2301
2305
  var convertToDateFormat = (date, format) => {
@@ -2345,7 +2349,7 @@ var DateField = ({ ref, ...props }) => {
2345
2349
  } = props;
2346
2350
  const [error3, setError] = useState12(errorMessage);
2347
2351
  const [isInvalid, setIsInvalid] = useState12(void 0);
2348
- const localRef = useRef7(null);
2352
+ const localRef = useRef8(null);
2349
2353
  const classes = classNames23("mobius-date-field", className);
2350
2354
  const formattedMin = min ? convertToDateFormat(min, format) : void 0;
2351
2355
  const formattedMax = max ? convertToDateFormat(max, format) : void 0;
@@ -2418,7 +2422,7 @@ Content.displayName = "Content";
2418
2422
 
2419
2423
  // src/components/Drawer/Drawer.tsx
2420
2424
  import classNames24 from "classnames/dedupe";
2421
- import { useEffect as useEffect10, useId as useId7, useMemo as useMemo2, useRef as useRef8, useState as useState13 } from "react";
2425
+ import { useEffect as useEffect10, useId as useId7, useMemo as useMemo2, useRef as useRef9, useState as useState13 } from "react";
2422
2426
 
2423
2427
  // src/components/Drawer/DrawerContext.tsx
2424
2428
  import { createContext } from "react";
@@ -2443,7 +2447,7 @@ var Drawer = ({ ref, ...props }) => {
2443
2447
  onClose,
2444
2448
  children
2445
2449
  } = props;
2446
- const dialogRef = useRef8(null);
2450
+ const dialogRef = useRef9(null);
2447
2451
  const [shouldTransition, setShouldTransition] = useState13(false);
2448
2452
  const { close } = useDialog({
2449
2453
  ref: dialogRef,
@@ -3027,7 +3031,7 @@ Header2.displayName = "Header";
3027
3031
 
3028
3032
  // src/components/Modal/Modal.tsx
3029
3033
  import classNames37 from "classnames/dedupe";
3030
- import { useEffect as useEffect12, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
3034
+ import { useEffect as useEffect12, useMemo as useMemo3, useRef as useRef10, useState as useState16 } from "react";
3031
3035
  import { jsx as jsx44 } from "react/jsx-runtime";
3032
3036
  var TRANSITION_CSS_VARIABLE2 = "--modal-transition-duration";
3033
3037
  var Modal = ({ ref, ...props }) => {
@@ -3046,7 +3050,7 @@ var Modal = ({ ref, ...props }) => {
3046
3050
  useEffect12(() => {
3047
3051
  setShouldTransition(supportsDialog());
3048
3052
  }, []);
3049
- const dialogRef = useRef9(null);
3053
+ const dialogRef = useRef10(null);
3050
3054
  const { close } = useDialog({
3051
3055
  ref: dialogRef,
3052
3056
  isOpen,
@@ -3099,7 +3103,7 @@ Modal2.displayName = "Modal";
3099
3103
 
3100
3104
  // src/components/NumberField/NumberField.tsx
3101
3105
  import classNames38 from "classnames/dedupe";
3102
- import { useCallback as useCallback5, useEffect as useEffect13, useRef as useRef10 } from "react";
3106
+ import { useCallback as useCallback5, useEffect as useEffect13, useRef as useRef11 } from "react";
3103
3107
  import { jsx as jsx45 } from "react/jsx-runtime";
3104
3108
  var NumberField = ({ ref, ...props }) => {
3105
3109
  const {
@@ -3116,7 +3120,7 @@ var NumberField = ({ ref, ...props }) => {
3116
3120
  onBlur: customOnBlur,
3117
3121
  ...rest
3118
3122
  } = otherProps;
3119
- const focusedInputRef = useRef10(null);
3123
+ const focusedInputRef = useRef11(null);
3120
3124
  const wheelHandler = useCallback5((ev) => ev.preventDefault(), []);
3121
3125
  useEffect13(() => {
3122
3126
  return () => {
@@ -3199,7 +3203,7 @@ Option2.displayName = "Option";
3199
3203
 
3200
3204
  // src/components/PasswordField/PasswordField.tsx
3201
3205
  import classNames39 from "classnames/dedupe";
3202
- import { useRef as useRef11, useState as useState17 } from "react";
3206
+ import { useRef as useRef12, useState as useState17 } from "react";
3203
3207
 
3204
3208
  // src/components/PasswordField/ShowHideButton.tsx
3205
3209
  import { eye, eyeSlash } from "@simplybusiness/icons";
@@ -3232,7 +3236,7 @@ var PasswordField = ({
3232
3236
  const [show, setShow] = useState17(false);
3233
3237
  const type = show ? "text" : "password";
3234
3238
  const classes = classNames39("mobius-password-field", className);
3235
- const localRef = useRef11(null);
3239
+ const localRef = useRef12(null);
3236
3240
  const handleShowHideButtonClick = () => {
3237
3241
  const selectionStart = localRef.current?.selectionStart;
3238
3242
  const selectionEnd = localRef.current?.selectionEnd;
@@ -3271,13 +3275,13 @@ import {
3271
3275
  } from "@floating-ui/react";
3272
3276
  import { cross as cross3 } from "@simplybusiness/icons";
3273
3277
  import classNames40 from "classnames/dedupe";
3274
- import { cloneElement as cloneElement9, useRef as useRef12, useState as useState18 } from "react";
3278
+ import { cloneElement as cloneElement9, useRef as useRef13, useState as useState18 } from "react";
3275
3279
  import { useWindowEvent as useWindowEvent2 } from "@simplybusiness/mobius-hooks";
3276
3280
  import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs23 } from "react/jsx-runtime";
3277
3281
  var OFFSET_FROM_CONTENT_DEFAULT = 10;
3278
3282
  var Popover = (props) => {
3279
3283
  const { trigger, children, onOpen, onClose, className } = props;
3280
- const arrowRef = useRef12(null);
3284
+ const arrowRef = useRef13(null);
3281
3285
  const [isOpen, setIsOpen] = useState18(false);
3282
3286
  const { refs, floatingStyles, context } = useFloating({
3283
3287
  open: isOpen,
@@ -3489,7 +3493,7 @@ import {
3489
3493
  isValidElement as isValidElement5,
3490
3494
  useLayoutEffect,
3491
3495
  useMemo as useMemo4,
3492
- useRef as useRef13
3496
+ useRef as useRef14
3493
3497
  } from "react";
3494
3498
  import { Fragment as Fragment5, jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
3495
3499
  var Radio = ({ ref, ...props }) => {
@@ -3515,8 +3519,8 @@ var Radio = ({ ref, ...props }) => {
3515
3519
  const isMultiline = label && children;
3516
3520
  const isControlled = selected !== void 0;
3517
3521
  const isChecked = isControlled ? selected === value : defaultChecked;
3518
- const contentRef = useRef13(null);
3519
- const prevOverflowRef = useRef13({
3522
+ const contentRef = useRef14(null);
3523
+ const prevOverflowRef = useRef14({
3520
3524
  vertical: false,
3521
3525
  horizontal: false
3522
3526
  });
@@ -3614,7 +3618,7 @@ import {
3614
3618
  useCallback as useCallback6,
3615
3619
  useEffect as useEffect14,
3616
3620
  useId as useId10,
3617
- useRef as useRef14,
3621
+ useRef as useRef15,
3618
3622
  useState as useState19
3619
3623
  } from "react";
3620
3624
  import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -3646,7 +3650,7 @@ var RadioGroup = ({ ref, ...props }) => {
3646
3650
  } = props;
3647
3651
  const defaultSelected = getDefaultVal(children, value || defaultValue);
3648
3652
  const [selected, setSelected] = useState19(defaultSelected);
3649
- const overflowsRef = useRef14({});
3653
+ const overflowsRef = useRef15({});
3650
3654
  const [hasOverflow, setHasOverflow] = useState19(false);
3651
3655
  useEffect14(() => {
3652
3656
  if (value !== void 0) {
@@ -3859,7 +3863,7 @@ Select.displayName = "Select";
3859
3863
 
3860
3864
  // src/components/Slider/Slider.tsx
3861
3865
  import classNames47 from "classnames/dedupe";
3862
- import { useRef as useRef15, useState as useState20 } from "react";
3866
+ import { useRef as useRef16, useState as useState20 } from "react";
3863
3867
 
3864
3868
  // src/components/Slider/helpers.ts
3865
3869
  import { useCallback as useCallback7, useMemo as useMemo5 } from "react";
@@ -3892,7 +3896,7 @@ var Slider = (props) => {
3892
3896
  formatOptions,
3893
3897
  isDisabled = false
3894
3898
  } = props;
3895
- const trackRef = useRef15(null);
3899
+ const trackRef = useRef16(null);
3896
3900
  const [currentValue, setCurrentValue] = useState20(
3897
3901
  value || defaultValue || 0
3898
3902
  );
@@ -4404,7 +4408,7 @@ Toaster.displayName = "Toaster";
4404
4408
 
4405
4409
  // src/components/Trust/Trust.tsx
4406
4410
  import classNames62 from "classnames/dedupe";
4407
- import { useEffect as useEffect17, useRef as useRef16, useState as useState22 } from "react";
4411
+ import { useEffect as useEffect17, useRef as useRef17, useState as useState22 } from "react";
4408
4412
 
4409
4413
  // src/components/Trust/constants.ts
4410
4414
  var REQUIRED_TRUSTPILOT_CLASS_NAME = "trustpilot-widget";
@@ -4481,7 +4485,7 @@ var Trust = ({ ref, ...props }) => {
4481
4485
  className
4482
4486
  } = props;
4483
4487
  const [isMounted, setIsMounted] = useState22(false);
4484
- const trustRef = useRef16(null);
4488
+ const trustRef = useRef17(null);
4485
4489
  const {
4486
4490
  templateId,
4487
4491
  className: variantClassName,
@@ -4541,7 +4545,7 @@ var Trust = ({ ref, ...props }) => {
4541
4545
 
4542
4546
  // src/components/ExpandableText/ExpandableText.tsx
4543
4547
  import classNames63 from "classnames/dedupe";
4544
- import { useEffect as useEffect18, useId as useId12, useRef as useRef17, useState as useState23 } from "react";
4548
+ import { useEffect as useEffect18, useId as useId12, useRef as useRef18, useState as useState23 } from "react";
4545
4549
  import { jsx as jsx74, jsxs as jsxs34 } from "react/jsx-runtime";
4546
4550
  var ExpandableText = ({ ref, ...props }) => {
4547
4551
  const {
@@ -4558,7 +4562,7 @@ var ExpandableText = ({ ref, ...props }) => {
4558
4562
  } = props;
4559
4563
  const [isExpanded, setIsExpanded] = useState23(false);
4560
4564
  const [isCollapsed, setIsCollapsed] = useState23(false);
4561
- const textRef = useRef17(null);
4565
+ const textRef = useRef18(null);
4562
4566
  const { down } = useBreakpoint();
4563
4567
  const baseId = useId12();
4564
4568
  const expandButtonId = `expandable-text-expand-${baseId}`;
@@ -4628,7 +4632,7 @@ ExpandableText.displayName = "ExpandableText";
4628
4632
  // src/components/MaskedField/index.tsx
4629
4633
  import loadable from "@loadable/component";
4630
4634
  import { jsx as jsx75 } from "react/jsx-runtime";
4631
- var LoadableMaskedField = loadable(() => import("./MaskedField-FRCJBGMX.js"), {
4635
+ var LoadableMaskedField = loadable(() => import("./MaskedField-U2CL5FHC.js"), {
4632
4636
  resolveComponent: (mod) => mod.MaskedField
4633
4637
  });
4634
4638
  function MaskedField(props) {
@@ -4732,4 +4736,4 @@ export {
4732
4736
  ExpandableText,
4733
4737
  MaskedField
4734
4738
  };
4735
- //# sourceMappingURL=chunk-YUDNS4SZ.js.map
4739
+ //# sourceMappingURL=chunk-XGQ4SX2S.js.map