@simplybusiness/mobius 10.4.2 → 10.4.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 (73) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/components/Popover/Arrow.js +43 -0
  3. package/dist/cjs/components/Popover/Arrow.js.map +7 -0
  4. package/dist/cjs/components/Popover/Popover.js +258 -83
  5. package/dist/cjs/components/Popover/Popover.js.map +4 -4
  6. package/dist/cjs/components/Popover/index.js +258 -83
  7. package/dist/cjs/components/Popover/index.js.map +4 -4
  8. package/dist/cjs/components/Popover/useAutoUpdate.js +53 -0
  9. package/dist/cjs/components/Popover/useAutoUpdate.js.map +7 -0
  10. package/dist/cjs/components/Popover/useFloatingPosition.js +128 -0
  11. package/dist/cjs/components/Popover/useFloatingPosition.js.map +7 -0
  12. package/dist/cjs/components/Popover/useOutsidePress.js +46 -0
  13. package/dist/cjs/components/Popover/useOutsidePress.js.map +7 -0
  14. package/dist/cjs/components/index.js +422 -245
  15. package/dist/cjs/components/index.js.map +4 -4
  16. package/dist/cjs/index.js +422 -245
  17. package/dist/cjs/index.js.map +4 -4
  18. package/dist/cjs/meta.json +316 -32
  19. package/dist/esm/chunk-26KZYRE6.js +108 -0
  20. package/dist/esm/chunk-26KZYRE6.js.map +7 -0
  21. package/dist/esm/chunk-CAL44W47.js +23 -0
  22. package/dist/esm/chunk-CAL44W47.js.map +7 -0
  23. package/dist/esm/{chunk-PEEQNAIN.js → chunk-DMYDWKKA.js} +4 -4
  24. package/dist/esm/chunk-K3ECDAUR.js +33 -0
  25. package/dist/esm/chunk-K3ECDAUR.js.map +7 -0
  26. package/dist/esm/{chunk-GJBH37DH.js → chunk-KFHPI67N.js} +4 -4
  27. package/dist/esm/{chunk-F5ELD54X.js → chunk-LGZWQZLS.js} +2 -2
  28. package/dist/esm/{chunk-OAG5T7NC.js → chunk-NEFRXIFY.js} +4 -4
  29. package/dist/esm/chunk-VZ3IWSK6.js +158 -0
  30. package/dist/esm/chunk-VZ3IWSK6.js.map +7 -0
  31. package/dist/esm/chunk-WYJP7HVL.js +26 -0
  32. package/dist/esm/chunk-WYJP7HVL.js.map +7 -0
  33. package/dist/esm/components/AddressLookup/AddressLookup.js +4 -4
  34. package/dist/esm/components/AddressLookup/index.js +6 -6
  35. package/dist/esm/components/Breadcrumbs/index.js +3 -3
  36. package/dist/esm/components/Checkbox/index.js +1 -1
  37. package/dist/esm/components/Combobox/Combobox.js +3 -3
  38. package/dist/esm/components/Combobox/index.js +3 -3
  39. package/dist/esm/components/Drawer/index.js +3 -3
  40. package/dist/esm/components/Modal/index.js +3 -3
  41. package/dist/esm/components/Popover/Arrow.js +8 -0
  42. package/dist/esm/components/Popover/Arrow.js.map +7 -0
  43. package/dist/esm/components/Popover/Popover.js +5 -1
  44. package/dist/esm/components/Popover/index.js +5 -1
  45. package/dist/esm/components/Popover/useAutoUpdate.js +8 -0
  46. package/dist/esm/components/Popover/useAutoUpdate.js.map +7 -0
  47. package/dist/esm/components/Popover/useFloatingPosition.js +8 -0
  48. package/dist/esm/components/Popover/useFloatingPosition.js.map +7 -0
  49. package/dist/esm/components/Popover/useOutsidePress.js +8 -0
  50. package/dist/esm/components/Popover/useOutsidePress.js.map +7 -0
  51. package/dist/esm/components/index.js +77 -73
  52. package/dist/esm/index.js +77 -73
  53. package/dist/esm/meta.json +3737 -3401
  54. package/dist/tsconfig.build.tsbuildinfo +1 -1
  55. package/dist/types/components/Popover/Arrow.d.ts +9 -0
  56. package/dist/types/components/Popover/useAutoUpdate.d.ts +9 -0
  57. package/dist/types/components/Popover/useFloatingPosition.d.ts +17 -0
  58. package/dist/types/components/Popover/useOutsidePress.d.ts +9 -0
  59. package/package.json +1 -2
  60. package/src/components/Popover/Arrow.tsx +25 -0
  61. package/src/components/Popover/Popover.characterization.test.tsx +269 -0
  62. package/src/components/Popover/Popover.stories.tsx +40 -3
  63. package/src/components/Popover/Popover.test.tsx +6 -2
  64. package/src/components/Popover/Popover.tsx +87 -81
  65. package/src/components/Popover/useAutoUpdate.ts +43 -0
  66. package/src/components/Popover/useFloatingPosition.ts +177 -0
  67. package/src/components/Popover/useOutsidePress.ts +31 -0
  68. package/dist/esm/chunk-O5YEU5TG.js +0 -155
  69. package/dist/esm/chunk-O5YEU5TG.js.map +0 -7
  70. /package/dist/esm/{chunk-PEEQNAIN.js.map → chunk-DMYDWKKA.js.map} +0 -0
  71. /package/dist/esm/{chunk-GJBH37DH.js.map → chunk-KFHPI67N.js.map} +0 -0
  72. /package/dist/esm/{chunk-F5ELD54X.js.map → chunk-LGZWQZLS.js.map} +0 -0
  73. /package/dist/esm/{chunk-OAG5T7NC.js.map → chunk-NEFRXIFY.js.map} +0 -0
@@ -2447,14 +2447,53 @@
2447
2447
  ],
2448
2448
  "format": "esm"
2449
2449
  },
2450
- "src/components/Popover/Popover.tsx": {
2451
- "bytes": 4803,
2450
+ "src/components/Popover/Arrow.tsx": {
2451
+ "bytes": 554,
2452
2452
  "imports": [
2453
2453
  {
2454
- "path": "@floating-ui/react",
2454
+ "path": "react/jsx-runtime",
2455
2455
  "kind": "import-statement",
2456
2456
  "external": true
2457
- },
2457
+ }
2458
+ ],
2459
+ "format": "esm"
2460
+ },
2461
+ "src/components/Popover/useAutoUpdate.ts": {
2462
+ "bytes": 1202,
2463
+ "imports": [
2464
+ {
2465
+ "path": "react",
2466
+ "kind": "import-statement",
2467
+ "external": true
2468
+ }
2469
+ ],
2470
+ "format": "esm"
2471
+ },
2472
+ "src/components/Popover/useFloatingPosition.ts": {
2473
+ "bytes": 5982,
2474
+ "imports": [
2475
+ {
2476
+ "path": "react",
2477
+ "kind": "import-statement",
2478
+ "external": true
2479
+ }
2480
+ ],
2481
+ "format": "esm"
2482
+ },
2483
+ "src/components/Popover/useOutsidePress.ts": {
2484
+ "bytes": 917,
2485
+ "imports": [
2486
+ {
2487
+ "path": "react",
2488
+ "kind": "import-statement",
2489
+ "external": true
2490
+ }
2491
+ ],
2492
+ "format": "esm"
2493
+ },
2494
+ "src/components/Popover/Popover.tsx": {
2495
+ "bytes": 5165,
2496
+ "imports": [
2458
2497
  {
2459
2498
  "path": "@simplybusiness/icons",
2460
2499
  "kind": "import-statement",
@@ -2470,6 +2509,11 @@
2470
2509
  "kind": "import-statement",
2471
2510
  "external": true
2472
2511
  },
2512
+ {
2513
+ "path": "react-dom",
2514
+ "kind": "import-statement",
2515
+ "external": true
2516
+ },
2473
2517
  {
2474
2518
  "path": "@simplybusiness/mobius-hooks",
2475
2519
  "kind": "import-statement",
@@ -2485,6 +2529,26 @@
2485
2529
  "kind": "import-statement",
2486
2530
  "original": "../Icon"
2487
2531
  },
2532
+ {
2533
+ "path": "src/components/Popover/Arrow.tsx",
2534
+ "kind": "import-statement",
2535
+ "original": "./Arrow"
2536
+ },
2537
+ {
2538
+ "path": "src/components/Popover/useAutoUpdate.ts",
2539
+ "kind": "import-statement",
2540
+ "original": "./useAutoUpdate"
2541
+ },
2542
+ {
2543
+ "path": "src/components/Popover/useFloatingPosition.ts",
2544
+ "kind": "import-statement",
2545
+ "original": "./useFloatingPosition"
2546
+ },
2547
+ {
2548
+ "path": "src/components/Popover/useOutsidePress.ts",
2549
+ "kind": "import-statement",
2550
+ "original": "./useOutsidePress"
2551
+ },
2488
2552
  {
2489
2553
  "path": "@simplybusiness/mobius/src/components/Popover/Popover.css",
2490
2554
  "kind": "import-statement",
@@ -3877,7 +3941,7 @@
3877
3941
  "imports": [],
3878
3942
  "exports": [],
3879
3943
  "inputs": {},
3880
- "bytes": 334257
3944
+ "bytes": 347467
3881
3945
  },
3882
3946
  "dist/cjs/index.js": {
3883
3947
  "imports": [
@@ -4747,22 +4811,22 @@
4747
4811
  "external": true
4748
4812
  },
4749
4813
  {
4750
- "path": "@floating-ui/react",
4814
+ "path": "@simplybusiness/icons",
4751
4815
  "kind": "require-call",
4752
4816
  "external": true
4753
4817
  },
4754
4818
  {
4755
- "path": "@simplybusiness/icons",
4819
+ "path": "classnames/dedupe",
4756
4820
  "kind": "require-call",
4757
4821
  "external": true
4758
4822
  },
4759
4823
  {
4760
- "path": "classnames/dedupe",
4824
+ "path": "react",
4761
4825
  "kind": "require-call",
4762
4826
  "external": true
4763
4827
  },
4764
4828
  {
4765
- "path": "react",
4829
+ "path": "react-dom",
4766
4830
  "kind": "require-call",
4767
4831
  "external": true
4768
4832
  },
@@ -4771,6 +4835,26 @@
4771
4835
  "kind": "require-call",
4772
4836
  "external": true
4773
4837
  },
4838
+ {
4839
+ "path": "react/jsx-runtime",
4840
+ "kind": "require-call",
4841
+ "external": true
4842
+ },
4843
+ {
4844
+ "path": "react",
4845
+ "kind": "require-call",
4846
+ "external": true
4847
+ },
4848
+ {
4849
+ "path": "react",
4850
+ "kind": "require-call",
4851
+ "external": true
4852
+ },
4853
+ {
4854
+ "path": "react",
4855
+ "kind": "require-call",
4856
+ "external": true
4857
+ },
4774
4858
  {
4775
4859
  "path": "@simplybusiness/mobius/src/components/Popover/Popover.css",
4776
4860
  "kind": "require-call",
@@ -5466,7 +5550,19 @@
5466
5550
  "bytesInOutput": 644
5467
5551
  },
5468
5552
  "src/components/Popover/Popover.tsx": {
5469
- "bytesInOutput": 4540
5553
+ "bytesInOutput": 4561
5554
+ },
5555
+ "src/components/Popover/Arrow.tsx": {
5556
+ "bytesInOutput": 488
5557
+ },
5558
+ "src/components/Popover/useAutoUpdate.ts": {
5559
+ "bytesInOutput": 925
5560
+ },
5561
+ "src/components/Popover/useFloatingPosition.ts": {
5562
+ "bytesInOutput": 3631
5563
+ },
5564
+ "src/components/Popover/useOutsidePress.ts": {
5565
+ "bytesInOutput": 632
5470
5566
  },
5471
5567
  "src/components/Progress/Progress.tsx": {
5472
5568
  "bytesInOutput": 3632
@@ -5556,7 +5652,7 @@
5556
5652
  "bytesInOutput": 916
5557
5653
  }
5558
5654
  },
5559
- "bytes": 185637
5655
+ "bytes": 191550
5560
5656
  },
5561
5657
  "dist/cjs/utils/changeCSS.js.map": {
5562
5658
  "imports": [],
@@ -6486,7 +6582,7 @@
6486
6582
  "imports": [],
6487
6583
  "exports": [],
6488
6584
  "inputs": {},
6489
- "bytes": 336191
6585
+ "bytes": 349413
6490
6586
  },
6491
6587
  "dist/cjs/components/index.js": {
6492
6588
  "imports": [
@@ -7356,22 +7452,22 @@
7356
7452
  "external": true
7357
7453
  },
7358
7454
  {
7359
- "path": "@floating-ui/react",
7455
+ "path": "@simplybusiness/icons",
7360
7456
  "kind": "require-call",
7361
7457
  "external": true
7362
7458
  },
7363
7459
  {
7364
- "path": "@simplybusiness/icons",
7460
+ "path": "classnames/dedupe",
7365
7461
  "kind": "require-call",
7366
7462
  "external": true
7367
7463
  },
7368
7464
  {
7369
- "path": "classnames/dedupe",
7465
+ "path": "react",
7370
7466
  "kind": "require-call",
7371
7467
  "external": true
7372
7468
  },
7373
7469
  {
7374
- "path": "react",
7470
+ "path": "react-dom",
7375
7471
  "kind": "require-call",
7376
7472
  "external": true
7377
7473
  },
@@ -7380,6 +7476,26 @@
7380
7476
  "kind": "require-call",
7381
7477
  "external": true
7382
7478
  },
7479
+ {
7480
+ "path": "react/jsx-runtime",
7481
+ "kind": "require-call",
7482
+ "external": true
7483
+ },
7484
+ {
7485
+ "path": "react",
7486
+ "kind": "require-call",
7487
+ "external": true
7488
+ },
7489
+ {
7490
+ "path": "react",
7491
+ "kind": "require-call",
7492
+ "external": true
7493
+ },
7494
+ {
7495
+ "path": "react",
7496
+ "kind": "require-call",
7497
+ "external": true
7498
+ },
7383
7499
  {
7384
7500
  "path": "@simplybusiness/mobius/src/components/Popover/Popover.css",
7385
7501
  "kind": "require-call",
@@ -8075,7 +8191,19 @@
8075
8191
  "bytesInOutput": 644
8076
8192
  },
8077
8193
  "src/components/Popover/Popover.tsx": {
8078
- "bytesInOutput": 4540
8194
+ "bytesInOutput": 4561
8195
+ },
8196
+ "src/components/Popover/Arrow.tsx": {
8197
+ "bytesInOutput": 488
8198
+ },
8199
+ "src/components/Popover/useAutoUpdate.ts": {
8200
+ "bytesInOutput": 925
8201
+ },
8202
+ "src/components/Popover/useFloatingPosition.ts": {
8203
+ "bytesInOutput": 3631
8204
+ },
8205
+ "src/components/Popover/useOutsidePress.ts": {
8206
+ "bytesInOutput": 632
8079
8207
  },
8080
8208
  "src/components/Progress/Progress.tsx": {
8081
8209
  "bytesInOutput": 3632
@@ -8165,7 +8293,7 @@
8165
8293
  "bytesInOutput": 916
8166
8294
  }
8167
8295
  },
8168
- "bytes": 185563
8296
+ "bytes": 191476
8169
8297
  },
8170
8298
  "dist/cjs/components/VisuallyHidden/VisuallyHidden.js.map": {
8171
8299
  "imports": [],
@@ -11474,19 +11602,106 @@
11474
11602
  },
11475
11603
  "bytes": 6579
11476
11604
  },
11477
- "dist/cjs/components/Popover/Popover.js.map": {
11605
+ "dist/cjs/components/Popover/useAutoUpdate.js.map": {
11478
11606
  "imports": [],
11479
11607
  "exports": [],
11480
11608
  "inputs": {},
11481
- "bytes": 18953
11609
+ "bytes": 2036
11482
11610
  },
11483
- "dist/cjs/components/Popover/Popover.js": {
11611
+ "dist/cjs/components/Popover/useAutoUpdate.js": {
11484
11612
  "imports": [
11485
11613
  {
11486
- "path": "@floating-ui/react",
11614
+ "path": "react",
11487
11615
  "kind": "require-call",
11488
11616
  "external": true
11489
- },
11617
+ }
11618
+ ],
11619
+ "exports": [],
11620
+ "entryPoint": "src/components/Popover/useAutoUpdate.ts",
11621
+ "inputs": {
11622
+ "src/components/Popover/useAutoUpdate.ts": {
11623
+ "bytesInOutput": 1082
11624
+ }
11625
+ },
11626
+ "bytes": 1967
11627
+ },
11628
+ "dist/cjs/components/Popover/useFloatingPosition.js.map": {
11629
+ "imports": [],
11630
+ "exports": [],
11631
+ "inputs": {},
11632
+ "bytes": 8595
11633
+ },
11634
+ "dist/cjs/components/Popover/useFloatingPosition.js": {
11635
+ "imports": [
11636
+ {
11637
+ "path": "react",
11638
+ "kind": "require-call",
11639
+ "external": true
11640
+ }
11641
+ ],
11642
+ "exports": [],
11643
+ "entryPoint": "src/components/Popover/useFloatingPosition.ts",
11644
+ "inputs": {
11645
+ "src/components/Popover/useFloatingPosition.ts": {
11646
+ "bytesInOutput": 3816
11647
+ }
11648
+ },
11649
+ "bytes": 4713
11650
+ },
11651
+ "dist/cjs/components/Popover/useOutsidePress.js.map": {
11652
+ "imports": [],
11653
+ "exports": [],
11654
+ "inputs": {},
11655
+ "bytes": 1561
11656
+ },
11657
+ "dist/cjs/components/Popover/useOutsidePress.js": {
11658
+ "imports": [
11659
+ {
11660
+ "path": "react",
11661
+ "kind": "require-call",
11662
+ "external": true
11663
+ }
11664
+ ],
11665
+ "exports": [],
11666
+ "entryPoint": "src/components/Popover/useOutsidePress.ts",
11667
+ "inputs": {
11668
+ "src/components/Popover/useOutsidePress.ts": {
11669
+ "bytesInOutput": 799
11670
+ }
11671
+ },
11672
+ "bytes": 1688
11673
+ },
11674
+ "dist/cjs/components/Popover/Arrow.js.map": {
11675
+ "imports": [],
11676
+ "exports": [],
11677
+ "inputs": {},
11678
+ "bytes": 1066
11679
+ },
11680
+ "dist/cjs/components/Popover/Arrow.js": {
11681
+ "imports": [
11682
+ {
11683
+ "path": "react/jsx-runtime",
11684
+ "kind": "require-call",
11685
+ "external": true
11686
+ }
11687
+ ],
11688
+ "exports": [],
11689
+ "entryPoint": "src/components/Popover/Arrow.tsx",
11690
+ "inputs": {
11691
+ "src/components/Popover/Arrow.tsx": {
11692
+ "bytesInOutput": 603
11693
+ }
11694
+ },
11695
+ "bytes": 1473
11696
+ },
11697
+ "dist/cjs/components/Popover/Popover.js.map": {
11698
+ "imports": [],
11699
+ "exports": [],
11700
+ "inputs": {},
11701
+ "bytes": 32184
11702
+ },
11703
+ "dist/cjs/components/Popover/Popover.js": {
11704
+ "imports": [
11490
11705
  {
11491
11706
  "path": "@simplybusiness/icons",
11492
11707
  "kind": "require-call",
@@ -11502,6 +11717,11 @@
11502
11717
  "kind": "require-call",
11503
11718
  "external": true
11504
11719
  },
11720
+ {
11721
+ "path": "react-dom",
11722
+ "kind": "require-call",
11723
+ "external": true
11724
+ },
11505
11725
  {
11506
11726
  "path": "@simplybusiness/mobius-hooks",
11507
11727
  "kind": "require-call",
@@ -11567,6 +11787,26 @@
11567
11787
  "kind": "require-call",
11568
11788
  "external": true
11569
11789
  },
11790
+ {
11791
+ "path": "react/jsx-runtime",
11792
+ "kind": "require-call",
11793
+ "external": true
11794
+ },
11795
+ {
11796
+ "path": "react",
11797
+ "kind": "require-call",
11798
+ "external": true
11799
+ },
11800
+ {
11801
+ "path": "react",
11802
+ "kind": "require-call",
11803
+ "external": true
11804
+ },
11805
+ {
11806
+ "path": "react",
11807
+ "kind": "require-call",
11808
+ "external": true
11809
+ },
11570
11810
  {
11571
11811
  "path": "@simplybusiness/mobius/src/components/Popover/Popover.css",
11572
11812
  "kind": "require-call",
@@ -11582,7 +11822,7 @@
11582
11822
  "entryPoint": "src/components/Popover/Popover.tsx",
11583
11823
  "inputs": {
11584
11824
  "src/components/Popover/Popover.tsx": {
11585
- "bytesInOutput": 4623
11825
+ "bytesInOutput": 4652
11586
11826
  },
11587
11827
  "src/components/Button/Button.tsx": {
11588
11828
  "bytesInOutput": 1133
@@ -11601,35 +11841,47 @@
11601
11841
  },
11602
11842
  "src/components/Button/Success.tsx": {
11603
11843
  "bytesInOutput": 561
11844
+ },
11845
+ "src/components/Popover/Arrow.tsx": {
11846
+ "bytesInOutput": 485
11847
+ },
11848
+ "src/components/Popover/useAutoUpdate.ts": {
11849
+ "bytesInOutput": 923
11850
+ },
11851
+ "src/components/Popover/useFloatingPosition.ts": {
11852
+ "bytesInOutput": 3628
11853
+ },
11854
+ "src/components/Popover/useOutsidePress.ts": {
11855
+ "bytesInOutput": 630
11604
11856
  }
11605
11857
  },
11606
- "bytes": 12170
11858
+ "bytes": 18042
11607
11859
  },
11608
11860
  "dist/cjs/components/Popover/index.js.map": {
11609
11861
  "imports": [],
11610
11862
  "exports": [],
11611
11863
  "inputs": {},
11612
- "bytes": 19037
11864
+ "bytes": 32268
11613
11865
  },
11614
11866
  "dist/cjs/components/Popover/index.js": {
11615
11867
  "imports": [
11616
11868
  {
11617
- "path": "@floating-ui/react",
11869
+ "path": "@simplybusiness/icons",
11618
11870
  "kind": "require-call",
11619
11871
  "external": true
11620
11872
  },
11621
11873
  {
11622
- "path": "@simplybusiness/icons",
11874
+ "path": "classnames/dedupe",
11623
11875
  "kind": "require-call",
11624
11876
  "external": true
11625
11877
  },
11626
11878
  {
11627
- "path": "classnames/dedupe",
11879
+ "path": "react",
11628
11880
  "kind": "require-call",
11629
11881
  "external": true
11630
11882
  },
11631
11883
  {
11632
- "path": "react",
11884
+ "path": "react-dom",
11633
11885
  "kind": "require-call",
11634
11886
  "external": true
11635
11887
  },
@@ -11698,6 +11950,26 @@
11698
11950
  "kind": "require-call",
11699
11951
  "external": true
11700
11952
  },
11953
+ {
11954
+ "path": "react/jsx-runtime",
11955
+ "kind": "require-call",
11956
+ "external": true
11957
+ },
11958
+ {
11959
+ "path": "react",
11960
+ "kind": "require-call",
11961
+ "external": true
11962
+ },
11963
+ {
11964
+ "path": "react",
11965
+ "kind": "require-call",
11966
+ "external": true
11967
+ },
11968
+ {
11969
+ "path": "react",
11970
+ "kind": "require-call",
11971
+ "external": true
11972
+ },
11701
11973
  {
11702
11974
  "path": "@simplybusiness/mobius/src/components/Popover/Popover.css",
11703
11975
  "kind": "require-call",
@@ -11716,7 +11988,7 @@
11716
11988
  "bytesInOutput": 131
11717
11989
  },
11718
11990
  "src/components/Popover/Popover.tsx": {
11719
- "bytesInOutput": 4492
11991
+ "bytesInOutput": 4521
11720
11992
  },
11721
11993
  "src/components/Button/Button.tsx": {
11722
11994
  "bytesInOutput": 1133
@@ -11735,9 +12007,21 @@
11735
12007
  },
11736
12008
  "src/components/Button/Success.tsx": {
11737
12009
  "bytesInOutput": 561
12010
+ },
12011
+ "src/components/Popover/Arrow.tsx": {
12012
+ "bytesInOutput": 485
12013
+ },
12014
+ "src/components/Popover/useAutoUpdate.ts": {
12015
+ "bytesInOutput": 923
12016
+ },
12017
+ "src/components/Popover/useFloatingPosition.ts": {
12018
+ "bytesInOutput": 3628
12019
+ },
12020
+ "src/components/Popover/useOutsidePress.ts": {
12021
+ "bytesInOutput": 630
11738
12022
  }
11739
12023
  },
11740
- "bytes": 12205
12024
+ "bytes": 18077
11741
12025
  },
11742
12026
  "dist/cjs/components/PasswordField/PasswordField.js.map": {
11743
12027
  "imports": [],
@@ -0,0 +1,108 @@
1
+ // src/components/Popover/useFloatingPosition.ts
2
+ import { useCallback, useLayoutEffect } from "react";
3
+ var ABSOLUTE_FLOATING_STYLES = {
4
+ position: "absolute",
5
+ top: 0,
6
+ left: 0,
7
+ width: "max-content"
8
+ };
9
+ var FIXED_FLOATING_STYLES = {
10
+ position: "fixed",
11
+ top: 0,
12
+ left: 0,
13
+ width: "max-content"
14
+ };
15
+ var INITIAL_ARROW_STYLES = {
16
+ position: "absolute"
17
+ };
18
+ var VIEWPORT_PADDING = 0;
19
+ var createsFixedContainingBlock = (el) => {
20
+ const style = window.getComputedStyle(el);
21
+ return style.transform !== "none" || style.filter !== "none" || style.backdropFilter !== "none" || style.perspective !== "none" || /\b(transform|filter|perspective)\b/.test(style.willChange);
22
+ };
23
+ var useFloatingPosition = ({
24
+ referenceRef,
25
+ floatingRef,
26
+ arrowRef,
27
+ isOpen,
28
+ offsetPx,
29
+ arrowWidth,
30
+ useFixedStrategy
31
+ }) => {
32
+ const update = useCallback(() => {
33
+ const reference = referenceRef.current;
34
+ const floating = floatingRef.current;
35
+ if (!reference || !floating) return;
36
+ const refRect = reference.getBoundingClientRect();
37
+ const floatingWidth = floating.offsetWidth;
38
+ const floatingHeight = floating.offsetHeight;
39
+ const scrollX = useFixedStrategy ? 0 : window.scrollX;
40
+ const scrollY = useFixedStrategy ? 0 : window.scrollY;
41
+ const parent = floating.parentElement;
42
+ const parentIsCb = useFixedStrategy && !!parent && createsFixedContainingBlock(parent);
43
+ const boundsRect = parentIsCb ? parent.getBoundingClientRect() : {
44
+ left: 0,
45
+ top: 0,
46
+ right: window.innerWidth,
47
+ bottom: window.innerHeight
48
+ };
49
+ const bottomTopViewport = refRect.bottom + offsetPx;
50
+ const topTopViewport = refRect.top - floatingHeight - offsetPx;
51
+ const overflowsBottom = bottomTopViewport + floatingHeight > boundsRect.bottom;
52
+ const fitsTop = topTopViewport >= boundsRect.top;
53
+ const nextPlacement = overflowsBottom && fitsTop ? "top" : "bottom";
54
+ const topViewport = nextPlacement === "bottom" ? bottomTopViewport : topTopViewport;
55
+ const rawLeftViewport = refRect.left + refRect.width / 2 - floatingWidth / 2;
56
+ const minLeftViewport = boundsRect.left + VIEWPORT_PADDING;
57
+ const maxLeftViewport = Math.max(
58
+ minLeftViewport,
59
+ boundsRect.right - floatingWidth - VIEWPORT_PADDING
60
+ );
61
+ const leftViewport = Math.min(
62
+ Math.max(minLeftViewport, rawLeftViewport),
63
+ maxLeftViewport
64
+ );
65
+ const cbOffsetLeft = parentIsCb ? boundsRect.left : 0;
66
+ const cbOffsetTop = parentIsCb ? boundsRect.top : 0;
67
+ floating.style.top = `${topViewport + scrollY - cbOffsetTop}px`;
68
+ floating.style.left = `${leftViewport + scrollX - cbOffsetLeft}px`;
69
+ const arrow = arrowRef.current;
70
+ if (!arrow) return;
71
+ const arrowHalf = arrowWidth / 2;
72
+ const refCenterX = refRect.left + refRect.width / 2;
73
+ const rawArrowLeft = refCenterX - leftViewport - arrowHalf;
74
+ const maxArrowLeft = Math.max(0, floatingWidth - arrowWidth);
75
+ const arrowLeft = Math.min(Math.max(0, rawArrowLeft), maxArrowLeft);
76
+ arrow.style.left = `${arrowLeft}px`;
77
+ if (nextPlacement === "bottom") {
78
+ arrow.style.bottom = "100%";
79
+ arrow.style.top = "";
80
+ arrow.style.transform = "rotate(180deg)";
81
+ } else {
82
+ arrow.style.top = "100%";
83
+ arrow.style.bottom = "";
84
+ arrow.style.transform = "";
85
+ }
86
+ }, [
87
+ referenceRef,
88
+ floatingRef,
89
+ arrowRef,
90
+ offsetPx,
91
+ arrowWidth,
92
+ useFixedStrategy
93
+ ]);
94
+ useLayoutEffect(() => {
95
+ if (!isOpen) return;
96
+ update();
97
+ }, [isOpen, update]);
98
+ return {
99
+ initialFloatingStyles: useFixedStrategy ? FIXED_FLOATING_STYLES : ABSOLUTE_FLOATING_STYLES,
100
+ initialArrowStyles: INITIAL_ARROW_STYLES,
101
+ update
102
+ };
103
+ };
104
+
105
+ export {
106
+ useFloatingPosition
107
+ };
108
+ //# sourceMappingURL=chunk-26KZYRE6.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/Popover/useFloatingPosition.ts"],
4
+ "sourcesContent": ["import type { CSSProperties, RefObject } from \"react\";\nimport { useCallback, useLayoutEffect } from \"react\";\n\ntype Placement = \"bottom\" | \"top\";\n\ninterface UseFloatingPositionArgs {\n referenceRef: RefObject<HTMLElement | null>;\n floatingRef: RefObject<HTMLDivElement | null>;\n arrowRef: RefObject<SVGSVGElement | null>;\n isOpen: boolean;\n offsetPx: number;\n arrowWidth: number;\n useFixedStrategy: boolean;\n}\n\ninterface UseFloatingPositionResult {\n initialFloatingStyles: CSSProperties;\n initialArrowStyles: CSSProperties;\n update: () => void;\n}\n\n// Two positioning strategies:\n// - `absolute` + document-relative coords (viewport rect + window.scrollY/X)\n// when portalled to document.body. The initial containing block is the\n// document, so absolute coords pin to the trigger and scroll natively.\n// - `fixed` + viewport coords when portalled inside a <dialog> (top-layer).\n// The dialog's own box would otherwise become the containing block for an\n// `absolute` child, throwing off coordinates and triggering `overflow: hidden`\n// clipping. `fixed` keeps the containing block as the viewport.\nconst ABSOLUTE_FLOATING_STYLES: CSSProperties = {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"max-content\",\n};\n\nconst FIXED_FLOATING_STYLES: CSSProperties = {\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"max-content\",\n};\n\nconst INITIAL_ARROW_STYLES: CSSProperties = {\n position: \"absolute\",\n};\n\nconst VIEWPORT_PADDING = 0;\n\n// Properties that make an ancestor the containing block for a `position: fixed`\n// descendant, overriding the initial viewport containing block. When the portal\n// target (dialog) has any of these, `position: fixed` coords are interpreted\n// relative to the dialog's box, not the viewport \u2014 we compensate by subtracting\n// the dialog's viewport offset.\nconst createsFixedContainingBlock = (el: HTMLElement): boolean => {\n const style = window.getComputedStyle(el);\n return (\n style.transform !== \"none\" ||\n style.filter !== \"none\" ||\n style.backdropFilter !== \"none\" ||\n style.perspective !== \"none\" ||\n /\\b(transform|filter|perspective)\\b/.test(style.willChange)\n );\n};\n\nexport const useFloatingPosition = ({\n referenceRef,\n floatingRef,\n arrowRef,\n isOpen,\n offsetPx,\n arrowWidth,\n useFixedStrategy,\n}: UseFloatingPositionArgs): UseFloatingPositionResult => {\n // Writes styles directly to the DOM (bypassing React state) so scroll/resize\n // handlers can update position in the same event-frame the browser uses to\n // paint the scroll, eliminating the re-render lag that shows up as a\n // trigger-vs-popover parallax on fast scroll.\n const update = useCallback(() => {\n const reference = referenceRef.current;\n const floating = floatingRef.current;\n if (!reference || !floating) return;\n\n const refRect = reference.getBoundingClientRect();\n const floatingWidth = floating.offsetWidth;\n const floatingHeight = floating.offsetHeight;\n const scrollX = useFixedStrategy ? 0 : window.scrollX;\n const scrollY = useFixedStrategy ? 0 : window.scrollY;\n\n // Clamp to the portal target's bounds when the dialog is a containing\n // block (its own `overflow: hidden` would clip the popover). Otherwise\n // clamp to the viewport.\n const parent = floating.parentElement;\n const parentIsCb =\n useFixedStrategy && !!parent && createsFixedContainingBlock(parent);\n const boundsRect = parentIsCb\n ? parent.getBoundingClientRect()\n : {\n left: 0,\n top: 0,\n right: window.innerWidth,\n bottom: window.innerHeight,\n };\n\n const bottomTopViewport = refRect.bottom + offsetPx;\n const topTopViewport = refRect.top - floatingHeight - offsetPx;\n const overflowsBottom =\n bottomTopViewport + floatingHeight > boundsRect.bottom;\n const fitsTop = topTopViewport >= boundsRect.top;\n const nextPlacement: Placement =\n overflowsBottom && fitsTop ? \"top\" : \"bottom\";\n\n const topViewport =\n nextPlacement === \"bottom\" ? bottomTopViewport : topTopViewport;\n\n const rawLeftViewport =\n refRect.left + refRect.width / 2 - floatingWidth / 2;\n const minLeftViewport = boundsRect.left + VIEWPORT_PADDING;\n const maxLeftViewport = Math.max(\n minLeftViewport,\n boundsRect.right - floatingWidth - VIEWPORT_PADDING,\n );\n const leftViewport = Math.min(\n Math.max(minLeftViewport, rawLeftViewport),\n maxLeftViewport,\n );\n\n // Subtract containing-block offset when the dialog is the CB, so\n // `position: fixed` coords land at the intended viewport position.\n const cbOffsetLeft = parentIsCb ? boundsRect.left : 0;\n const cbOffsetTop = parentIsCb ? boundsRect.top : 0;\n\n floating.style.top = `${topViewport + scrollY - cbOffsetTop}px`;\n floating.style.left = `${leftViewport + scrollX - cbOffsetLeft}px`;\n\n const arrow = arrowRef.current;\n if (!arrow) return;\n\n // Arrow coords are relative to the floating element, so scroll cancels out.\n const arrowHalf = arrowWidth / 2;\n const refCenterX = refRect.left + refRect.width / 2;\n const rawArrowLeft = refCenterX - leftViewport - arrowHalf;\n const maxArrowLeft = Math.max(0, floatingWidth - arrowWidth);\n const arrowLeft = Math.min(Math.max(0, rawArrowLeft), maxArrowLeft);\n\n arrow.style.left = `${arrowLeft}px`;\n if (nextPlacement === \"bottom\") {\n arrow.style.bottom = \"100%\";\n arrow.style.top = \"\";\n arrow.style.transform = \"rotate(180deg)\";\n } else {\n arrow.style.top = \"100%\";\n arrow.style.bottom = \"\";\n arrow.style.transform = \"\";\n }\n }, [\n referenceRef,\n floatingRef,\n arrowRef,\n offsetPx,\n arrowWidth,\n useFixedStrategy,\n ]);\n\n useLayoutEffect(() => {\n if (!isOpen) return;\n update();\n }, [isOpen, update]);\n\n return {\n initialFloatingStyles: useFixedStrategy\n ? FIXED_FLOATING_STYLES\n : ABSOLUTE_FLOATING_STYLES,\n initialArrowStyles: INITIAL_ARROW_STYLES,\n update,\n };\n};\n"],
5
+ "mappings": ";AACA,SAAS,aAAa,uB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