@wello-dev/core 1.0.4 → 1.0.6

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/dist/{chunk-FIAJMBSD.js → chunk-2TFJ4SMR.js} +3 -3
  2. package/dist/chunk-2TFJ4SMR.js.map +1 -0
  3. package/dist/{chunk-6U4Y3AUT.js → chunk-2WHZJI3S.js} +3 -3
  4. package/dist/{chunk-F2FJLMJF.js → chunk-652ZEQV7.js} +4 -4
  5. package/dist/{chunk-YQOS23WP.js → chunk-7EINGVGG.js} +2 -2
  6. package/dist/{chunk-YOL5PMHU.js → chunk-7S7RIVCI.js} +2 -2
  7. package/dist/{chunk-PPKKOBHB.js → chunk-A76QHCP5.js} +2 -2
  8. package/dist/{chunk-TJUOXXLK.js → chunk-BZPG4NZ6.js} +2 -2
  9. package/dist/chunk-DRSBB5T4.js +206 -0
  10. package/dist/chunk-DRSBB5T4.js.map +1 -0
  11. package/dist/{chunk-HGYIOR5F.js → chunk-ESMDK5GY.js} +2 -2
  12. package/dist/{chunk-GD5URO3H.js → chunk-FSR3OEUP.js} +4 -4
  13. package/dist/{chunk-52P4CIAK.js → chunk-HBBXBVK6.js} +2 -2
  14. package/dist/{chunk-63PSLIW5.js → chunk-K3B2RENY.js} +2 -2
  15. package/dist/{chunk-ZTOAB4HM.js → chunk-NGXT7GNE.js} +2 -2
  16. package/dist/{chunk-O4MQLZEH.js → chunk-NH26XE7T.js} +2 -2
  17. package/dist/{chunk-7GLDYLJ6.js → chunk-O6A7IBIW.js} +2 -2
  18. package/dist/{chunk-F4OMXH3E.js → chunk-QCMTAQSP.js} +17 -10
  19. package/dist/chunk-QCMTAQSP.js.map +1 -0
  20. package/dist/{chunk-2XGMU4QA.js → chunk-RVFCTNPD.js} +20 -4
  21. package/dist/chunk-RVFCTNPD.js.map +1 -0
  22. package/dist/{chunk-KEYIOWAG.js → chunk-TIVOXLDX.js} +3 -3
  23. package/dist/{chunk-KEYIOWAG.js.map → chunk-TIVOXLDX.js.map} +1 -1
  24. package/dist/{chunk-QZFPW75D.js → chunk-XBLREJCR.js} +30 -3
  25. package/dist/chunk-XBLREJCR.js.map +1 -0
  26. package/dist/{chunk-K2Q5Q6WQ.js → chunk-YRKCM3OL.js} +10 -6
  27. package/dist/chunk-YRKCM3OL.js.map +1 -0
  28. package/dist/components/ColorPicker/ColorInput.js +4 -4
  29. package/dist/components/Combobox/Combobox.js +4 -4
  30. package/dist/components/Combobox/Select.js +5 -5
  31. package/dist/components/Combobox/TagsInput.js +5 -5
  32. package/dist/components/Dialog/Dialog.js +2 -2
  33. package/dist/components/Dropzone/Dropzone.js +4 -4
  34. package/dist/components/Menu/Menu.js +4 -4
  35. package/dist/components/Modal/Drawer.js +3 -3
  36. package/dist/components/Modal/Modal.js +3 -3
  37. package/dist/components/Modal/ModalBase.js +2 -2
  38. package/dist/components/NumberFormatter/NumberFormatter.js +1 -1
  39. package/dist/components/PhoneInput/PhoneInput.js +6 -6
  40. package/dist/components/Popover/Popover.js +3 -3
  41. package/dist/components/Portal/Portal.js +1 -1
  42. package/dist/components/TextInput/TextInput.js +2 -2
  43. package/dist/components/Tooltip/Tooltip.js +3 -3
  44. package/dist/index.cjs +163 -95
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +7 -2
  47. package/dist/index.d.ts +7 -2
  48. package/dist/index.js +114 -114
  49. package/dist/shadcn/Command.js +6 -6
  50. package/dist/shadcn/Dialog.js +5 -5
  51. package/dist/shadcn/Floating.js +6 -6
  52. package/dist/styles.css +123 -15
  53. package/package.json +1 -1
  54. package/dist/chunk-2XGMU4QA.js.map +0 -1
  55. package/dist/chunk-F4OMXH3E.js.map +0 -1
  56. package/dist/chunk-FIAJMBSD.js.map +0 -1
  57. package/dist/chunk-K2Q5Q6WQ.js.map +0 -1
  58. package/dist/chunk-QZFPW75D.js.map +0 -1
  59. package/dist/chunk-YHPHWOAE.js +0 -192
  60. package/dist/chunk-YHPHWOAE.js.map +0 -1
  61. /package/dist/{chunk-6U4Y3AUT.js.map → chunk-2WHZJI3S.js.map} +0 -0
  62. /package/dist/{chunk-F2FJLMJF.js.map → chunk-652ZEQV7.js.map} +0 -0
  63. /package/dist/{chunk-YQOS23WP.js.map → chunk-7EINGVGG.js.map} +0 -0
  64. /package/dist/{chunk-YOL5PMHU.js.map → chunk-7S7RIVCI.js.map} +0 -0
  65. /package/dist/{chunk-PPKKOBHB.js.map → chunk-A76QHCP5.js.map} +0 -0
  66. /package/dist/{chunk-TJUOXXLK.js.map → chunk-BZPG4NZ6.js.map} +0 -0
  67. /package/dist/{chunk-HGYIOR5F.js.map → chunk-ESMDK5GY.js.map} +0 -0
  68. /package/dist/{chunk-GD5URO3H.js.map → chunk-FSR3OEUP.js.map} +0 -0
  69. /package/dist/{chunk-52P4CIAK.js.map → chunk-HBBXBVK6.js.map} +0 -0
  70. /package/dist/{chunk-63PSLIW5.js.map → chunk-K3B2RENY.js.map} +0 -0
  71. /package/dist/{chunk-ZTOAB4HM.js.map → chunk-NGXT7GNE.js.map} +0 -0
  72. /package/dist/{chunk-O4MQLZEH.js.map → chunk-NH26XE7T.js.map} +0 -0
  73. /package/dist/{chunk-7GLDYLJ6.js.map → chunk-O6A7IBIW.js.map} +0 -0
package/dist/styles.css CHANGED
@@ -28,10 +28,25 @@
28
28
  -moz-osx-font-smoothing: grayscale;
29
29
  }
30
30
 
31
- /* Negative tracking breaks Arabic joining in overlays / toasts */
31
+ /*
32
+ * Negative tracking / uppercase / synthetic bold break Arabic joining.
33
+ * Scope to RTL so Latin marketing type can keep tight tracking.
34
+ */
32
35
  [dir="rtl"] [data-wello-portal],
33
- [dir="rtl"] .wello-notifications-toaster {
36
+ [dir="rtl"] .wello-notifications-toaster,
37
+ [dir="rtl"] .wello-Combobox-dropdown,
38
+ [dir="rtl"] .wello-Select-dropdown,
39
+ [dir="rtl"] .wello-Menu-dropdown,
40
+ [dir="rtl"] .wello-Popover-dropdown,
41
+ [dir="rtl"] .wello-Tooltip-tooltip {
42
+ letter-spacing: normal;
43
+ font-synthesis: none;
44
+ }
45
+ [dir="rtl"] .wello-Badge-root,
46
+ [dir="rtl"] .wello-Switch-trackLabel,
47
+ [dir="rtl"] .wello-Chip-label {
34
48
  letter-spacing: normal;
49
+ text-transform: none;
35
50
  }
36
51
  }
37
52
 
@@ -3886,6 +3901,7 @@
3886
3901
  font-family: var(--wello-font-family);
3887
3902
  font-size: var(--badge-fz);
3888
3903
  font-weight: 700;
3904
+ font-synthesis: none;
3889
3905
  letter-spacing: 0.025em;
3890
3906
  line-height: calc(var(--badge-height) - 2px);
3891
3907
  text-transform: uppercase;
@@ -3893,6 +3909,10 @@
3893
3909
  white-space: nowrap;
3894
3910
  -webkit-tap-highlight-color: transparent;
3895
3911
  }
3912
+ [dir="rtl"] .wello-Badge-root {
3913
+ letter-spacing: normal;
3914
+ text-transform: none;
3915
+ }
3896
3916
  .wello-Badge-root:where([data-size="xs"]) {
3897
3917
  --badge-height: 1rem;
3898
3918
  --badge-padding-x: 0.375rem;
@@ -4439,7 +4459,10 @@
4439
4459
  padding: 0.4375rem var(--wello-spacing-sm);
4440
4460
  border-radius: calc(var(--popover-radius, var(--wello-radius-default)) - 0.125rem);
4441
4461
  color: var(--menu-item-color, var(--wello-color-text));
4462
+ font-family: var(--wello-font-family);
4442
4463
  font-size: var(--wello-font-size-sm);
4464
+ font-synthesis: none;
4465
+ letter-spacing: normal;
4443
4466
  text-align: start;
4444
4467
  user-select: none;
4445
4468
  }
@@ -4945,7 +4968,9 @@
4945
4968
  color: var(--wello-color-bright);
4946
4969
  font-family: var(--wello-font-family);
4947
4970
  font-size: var(--wello-font-size-sm);
4948
- font-weight: 600;
4971
+ font-weight: 500;
4972
+ font-synthesis: none;
4973
+ letter-spacing: normal;
4949
4974
  line-height: 1.4;
4950
4975
  user-select: none;
4951
4976
  }
@@ -5525,11 +5550,16 @@
5525
5550
  padding-inline: calc(var(--switch-thumb) + 0.25rem) 0.4rem;
5526
5551
  color: var(--wello-color-dimmed);
5527
5552
  font-size: calc(var(--switch-height) * 0.42);
5528
- font-weight: 600;
5553
+ font-weight: 500;
5554
+ font-synthesis: none;
5555
+ letter-spacing: normal;
5529
5556
  text-align: center;
5530
5557
  text-transform: uppercase;
5531
5558
  user-select: none;
5532
5559
  }
5560
+ [dir="rtl"] .wello-Switch-trackLabel {
5561
+ text-transform: none;
5562
+ }
5533
5563
  .wello-Switch-input:checked + .wello-Switch-track {
5534
5564
  border-color: var(--switch-color);
5535
5565
  background: var(--switch-color);
@@ -5998,6 +6028,8 @@
5998
6028
  font-family: inherit;
5999
6029
  font-size: var(--wello-font-size-sm);
6000
6030
  font-weight: 500;
6031
+ font-synthesis: none;
6032
+ letter-spacing: normal;
6001
6033
  line-height: 1.35;
6002
6034
  cursor: var(--wello-cursor-type);
6003
6035
  user-select: none;
@@ -6029,7 +6061,7 @@
6029
6061
  .wello-Combobox-option:where([data-checked]) {
6030
6062
  background: color-mix(in oklab, var(--wello-primary-color) 14%, transparent);
6031
6063
  color: var(--wello-color-text);
6032
- font-weight: 600;
6064
+ font-weight: 500;
6033
6065
  box-shadow:
6034
6066
  inset var(--_option-bar) 0 0 0 var(--wello-primary-color),
6035
6067
  inset 0 0 0 1px color-mix(in oklab, var(--wello-primary-color) 22%, transparent);
@@ -6365,8 +6397,15 @@
6365
6397
  min-width: 0;
6366
6398
  }
6367
6399
  .wello-Select-optionLabel {
6400
+ min-width: 0;
6368
6401
  overflow: hidden;
6369
6402
  text-overflow: ellipsis;
6403
+ letter-spacing: normal;
6404
+ font-synthesis: none;
6405
+ }
6406
+ .wello-Select-check,
6407
+ .wello-Select-box {
6408
+ flex-shrink: 0;
6370
6409
  }
6371
6410
  .wello-Select-optionDescription {
6372
6411
  color: var(--wello-color-dimmed);
@@ -6477,6 +6516,8 @@
6477
6516
  border-radius: 999px;
6478
6517
  background: var(--wello-color-body);
6479
6518
  font-family: var(--wello-font-family);
6519
+ /* International numbers are always LTR: [flag+code | national digits]. */
6520
+ direction: ltr;
6480
6521
  transition:
6481
6522
  border-color 300ms ease,
6482
6523
  box-shadow 300ms ease;
@@ -6491,10 +6532,6 @@
6491
6532
  0 0 0 2px color-mix(in oklab, var(--wello-primary-color) 50%, transparent),
6492
6533
  0 10px 15px -3px color-mix(in oklab, var(--wello-primary-color) 20%, transparent);
6493
6534
  }
6494
- /* Dial code stays on the visual left (start of an international number) in RTL too. */
6495
- [dir="rtl"] .wello-PhoneInput-field {
6496
- flex-direction: row-reverse;
6497
- }
6498
6535
  .wello-PhoneInput-field[data-error] {
6499
6536
  border-color: var(--wello-color-error);
6500
6537
  }
@@ -6506,11 +6543,14 @@
6506
6543
  opacity: 0.6;
6507
6544
  }
6508
6545
 
6509
- /* Dial code */
6546
+ /* Dial code — shrink-wrap; never steal the national-number column */
6510
6547
  .wello-PhoneInput-code {
6511
- flex: none;
6548
+ position: relative;
6549
+ z-index: 1;
6550
+ flex: 0 0 auto;
6512
6551
  display: flex;
6513
6552
  align-items: stretch;
6553
+ max-width: 45%;
6514
6554
  border-inline-end: 1px solid var(--wello-color-border);
6515
6555
  background: var(--wello-color-surface-muted);
6516
6556
  transition: background-color 150ms ease;
@@ -6527,15 +6567,25 @@
6527
6567
  }
6528
6568
  .wello-PhoneInput-code .wello-Select-root {
6529
6569
  display: flex;
6570
+ width: auto;
6571
+ max-width: 100%;
6572
+ }
6573
+ /*
6574
+ * Input defaults to width:100%. Inside the dial-code cell that resolves against the
6575
+ * phone field and stretches the Select over the national input (ghost digits / overlap).
6576
+ */
6577
+ .wello-PhoneInput-code .wello-Input-wrapper,
6578
+ .wello-PhoneInput-code .wello-Select-trigger,
6579
+ .wello-PhoneInput-code .wello-Input-input {
6580
+ width: auto;
6581
+ min-width: 0;
6582
+ max-width: 100%;
6530
6583
  }
6531
- /* Force LTR chrome so flag + digits + chevron stay in phone order on Arabic pages. */
6532
6584
  .wello-PhoneInput-code .wello-Input-wrapper,
6533
6585
  .wello-PhoneInput-code .wello-Select-trigger {
6534
6586
  direction: ltr;
6535
6587
  }
6536
6588
  .wello-PhoneInput-code .wello-Select-trigger.wello-Input-input {
6537
- width: auto;
6538
- min-width: 0;
6539
6589
  height: var(--phone-height);
6540
6590
  min-height: var(--phone-height);
6541
6591
  padding-inline: 0.75rem 2rem;
@@ -6544,12 +6594,22 @@
6544
6594
  background: transparent;
6545
6595
  box-shadow: none;
6546
6596
  font-family: var(--wello-font-family);
6597
+ font-variant-numeric: tabular-nums;
6598
+ letter-spacing: normal;
6599
+ font-synthesis: none;
6547
6600
  }
6548
6601
  .wello-PhoneInput-code .wello-Select-trigger.wello-Input-input:focus,
6549
6602
  .wello-PhoneInput-code .wello-Select-trigger.wello-Input-input:focus-within {
6550
6603
  border: 0;
6551
6604
  box-shadow: none;
6552
6605
  }
6606
+ .wello-PhoneInput-code .wello-Select-value,
6607
+ .wello-PhoneInput-code .wello-Input-placeholder {
6608
+ display: inline-flex;
6609
+ align-items: center;
6610
+ overflow: hidden;
6611
+ white-space: nowrap;
6612
+ }
6553
6613
  .wello-PhoneInput-single {
6554
6614
  display: inline-flex;
6555
6615
  align-items: center;
@@ -6563,6 +6623,8 @@
6563
6623
  gap: 0.375rem;
6564
6624
  direction: ltr;
6565
6625
  font-family: var(--wello-font-family);
6626
+ font-synthesis: none;
6627
+ letter-spacing: normal;
6566
6628
  }
6567
6629
  .wello-PhoneInput-flag {
6568
6630
  flex: none;
@@ -6577,11 +6639,15 @@
6577
6639
  font-size: var(--wello-font-size-sm);
6578
6640
  font-variant-numeric: tabular-nums;
6579
6641
  font-weight: 500;
6642
+ font-synthesis: none;
6643
+ letter-spacing: normal;
6580
6644
  }
6581
6645
 
6582
6646
  /* Number */
6583
6647
  .wello-PhoneInput-input {
6584
- flex: 1;
6648
+ position: relative;
6649
+ z-index: 0;
6650
+ flex: 1 1 auto;
6585
6651
  box-sizing: border-box;
6586
6652
  width: 100%;
6587
6653
  min-width: 0;
@@ -6592,6 +6658,8 @@
6592
6658
  color: var(--wello-color-text);
6593
6659
  font-family: var(--wello-font-family);
6594
6660
  font-size: var(--wello-font-size-sm);
6661
+ font-synthesis: none;
6662
+ letter-spacing: normal;
6595
6663
  outline: 0;
6596
6664
  }
6597
6665
  .wello-PhoneInput-input::placeholder {
@@ -6613,6 +6681,35 @@
6613
6681
  .wello-PhoneInput-error[data-code] {
6614
6682
  margin-inline-start: auto;
6615
6683
  }
6684
+
6685
+ /*
6686
+ * Portaled country list — always LTR (flag + dial code). Without this, RTL pages
6687
+ * pack options to the end and the check overlaps the digits. Portal root may be
6688
+ * dir=rtl (synced from <html>), so override the RTL option-bar flip explicitly.
6689
+ */
6690
+ .wello-PhoneInput-dropdown.wello-PhoneInput-dropdown {
6691
+ direction: ltr;
6692
+ min-width: 12rem;
6693
+ }
6694
+ .wello-PhoneInput-dropdown .wello-Combobox-option,
6695
+ .wello-PhoneInput-dropdown .wello-Select-option {
6696
+ direction: ltr;
6697
+ justify-content: flex-start;
6698
+ --_option-bar: 3px;
6699
+ }
6700
+ .wello-PhoneInput-dropdown .wello-Select-optionLabel,
6701
+ .wello-PhoneInput-dropdown .wello-Select-optionBody {
6702
+ display: flex;
6703
+ flex: 1;
6704
+ min-width: 0;
6705
+ justify-content: flex-start;
6706
+ }
6707
+ .wello-PhoneInput-dropdown .wello-Select-check,
6708
+ .wello-PhoneInput-dropdown .wello-Combobox-optionCheck {
6709
+ flex: none;
6710
+ margin-inline-start: 0.5rem;
6711
+ margin-inline-end: 0;
6712
+ }
6616
6713
  }
6617
6714
 
6618
6715
  /* ColorPicker.css */
@@ -8123,11 +8220,15 @@
8123
8220
  color: var(--wello-color-text);
8124
8221
  font-size: 0.9375rem;
8125
8222
  font-weight: 600;
8223
+ font-synthesis: none;
8126
8224
  letter-spacing: -0.01em;
8127
8225
  line-height: 1.35;
8128
8226
  text-overflow: ellipsis;
8129
8227
  white-space: nowrap;
8130
8228
  }
8229
+ [dir="rtl"] .wello-sd-title {
8230
+ letter-spacing: normal;
8231
+ }
8131
8232
  .wello-sd-body {
8132
8233
  position: relative;
8133
8234
  z-index: 1;
@@ -8252,9 +8353,13 @@
8252
8353
  .wello-sd-alert .wello-sd-part-title {
8253
8354
  color: var(--wello-color-text);
8254
8355
  font-size: 1.125rem;
8356
+ font-synthesis: none;
8255
8357
  letter-spacing: -0.015em;
8256
8358
  line-height: 1.375;
8257
8359
  }
8360
+ [dir="rtl"] .wello-sd-alert .wello-sd-part-title {
8361
+ letter-spacing: normal;
8362
+ }
8258
8363
  .wello-sd-alert .wello-sd-part-description {
8259
8364
  max-width: 65ch;
8260
8365
  margin-inline: auto;
@@ -8413,6 +8518,9 @@
8413
8518
  font-size: var(--wello-font-size-xs);
8414
8519
  letter-spacing: 0.08em;
8415
8520
  }
8521
+ [dir="rtl"] .wello-sm-shortcut {
8522
+ letter-spacing: normal;
8523
+ }
8416
8524
  [dir="rtl"] .wello-sm-sub-chevron {
8417
8525
  transform: scaleX(-1);
8418
8526
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wello-dev/core",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "React UI components: theme, Styles API, style props, dark mode and RTL",
5
5
  "homepage": "https://wello-dev.vercel.app/",
6
6
  "author": "Mohamed Wael <mohamedwael4553@gmail.com>",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Combobox/Select.tsx"],"sourcesContent":["import { useWelloLabels } from \"../../core/provider/labels\";\nimport { forwardRef, isValidElement, type ReactElement, type Ref, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { useEndpointLoaders } from \"../../core/api/api\";\nimport { useWelloTheme } from \"../../core/provider/WelloProvider\";\nimport { useProps, useStyles, type StylesApiProps } from \"../../core/styles-api/styles-api\";\nimport { cx } from \"../../core/utils\";\nimport { EmptyState } from \"../EmptyState/EmptyState\";\nimport type { ComboboxItem } from \"../Field/Field\";\nimport { Input, InputBase, type InputBaseProps } from \"../Input/Input\";\nimport { Loader } from \"../Loader/Loader\";\nimport {\n CheckIcon,\n Combobox,\n ComboboxChevron,\n ComboboxClearButton,\n ComboboxDropdown,\n ComboboxGroup,\n ComboboxOption,\n ComboboxOptions,\n ComboboxSearch,\n ComboboxTarget,\n useCombobox,\n type ComboboxProps,\n} from \"./Combobox\";\n\n// ── Types ────────────────────────────────────────────────────────────────────────────────\n\n/** An option: `value` + `label`, or any record read through `valueKey` / `labelKey`. */\nexport interface SelectOption {\n value?: unknown;\n /** Text, an element, or anything `getOptionLabel` understands */\n label?: unknown;\n disabled?: boolean;\n /** Shown in the closed field instead of the label */\n displayLabel?: ReactNode;\n /** Text to search, when the label isn't text */\n searchText?: string;\n /** Second line, under the label */\n description?: ReactNode;\n /** Before the text: image, icon, avatar */\n leftSection?: ReactNode;\n /** After the text: price, badge, count */\n rightSection?: ReactNode;\n [key: string]: unknown;\n}\n\nexport type SelectEntry = string | number | SelectOption;\n/** Options: any record type works, read in `renderOption` with its own fields. */\nexport type SelectData<T = any> = Array<string | number | T | { group: string; items: Array<string | number | T> }>;\n\n/** Parts for `classNames`, `styles`, `vars` and `attributes`. */\nexport type SelectStylesNames =\n | \"root\" | \"label\" | \"description\" | \"error\" | \"wrapper\" | \"input\" | \"section\"\n | \"value\" | \"pills\" | \"pill\" | \"sections\" | \"clear\"\n | \"dropdown\" | \"dropdownHeader\" | \"dropdownFooter\"\n | \"searchWrap\" | \"searchBox\" | \"searchIcon\" | \"search\" | \"searchClear\" | \"spinner\"\n | \"options\" | \"option\" | \"optionBody\" | \"optionLabel\" | \"optionDescription\" | \"optionSection\" | \"check\" | \"box\"\n | \"group\" | \"groupLabel\"\n | \"state\" | \"empty\" | \"footer\" | \"count\" | \"allLoaded\";\n\n/** What `renderOption` and `renderValue` get. */\nexport interface SelectRenderInput<T = any> {\n /** The option as you passed it */\n option: T;\n /** The value as text */\n value: string;\n /** What would be shown by default */\n label: ReactNode;\n checked: boolean;\n disabled: boolean;\n /** Current search text */\n search: string;\n}\n\n/** What the dropdown slots and `renderFooter` get. */\nexport interface SelectDropdownState {\n close: () => void;\n search: string;\n shown: number;\n total?: number;\n hasMore: boolean;\n loading: boolean;\n}\n\nexport interface LoadOptionsInput {\n search: string;\n /** Starts at 1 */\n page: number;\n pageSize: number;\n /** Aborted when a newer request starts */\n signal: AbortSignal;\n}\n/** A page of options. `hasMore` wins over `total`; with neither, a full page means there may be more. */\nexport type LoadOptionsResult<T = any> = Array<string | number | T> | { items: Array<string | number | T>; total?: number; hasMore?: boolean };\n\n/** One entry after normalizing. `label` is the searchable text, as `filter` expects. */\nexport interface SelectItem extends ComboboxItem {\n node: ReactNode;\n display: ReactNode;\n option: SelectEntry;\n record: SelectOption;\n}\n\nexport type SelectFilter = (options: { items: ComboboxItem[]; search: string; limit?: number }) => ComboboxItem[];\n\ninterface SelectBaseProps<T = any> extends Omit<InputBaseProps, \"value\" | \"defaultValue\" | \"onChange\" | \"onBlur\" | keyof StylesApiProps<string>>, StylesApiProps<SelectStylesNames> {\n /** Options. Plain strings, `{ value, label }`, records or `{ group, items }` */\n data?: SelectData<T>;\n /** shared/ui name of `data` */\n options?: SelectData<T>;\n /** Key of the value in a record, when it has no `value`. Default: 'id' */\n valueKey?: string;\n /** Key of the label in a record, when it has no `label`. Default: 'name' */\n labelKey?: string;\n /** Turns an option into what's shown: translate it, pick the language… */\n getOptionLabel?: (option: T) => ReactNode;\n\n /**\n * Address of the list on your API (`\"users\"`, `\"cities?per_page=50\"`): the only thing needed to fetch options.\n * The base address, headers and error callback come from the theme's `api`. Pages on scroll, search with debounce.\n */\n endpoint?: string | null;\n /** With `endpoint`: more query parameters. Changing them restarts the list */\n params?: Record<string, unknown>;\n /** With `endpoint`: use `api.generalBaseURL` */\n general?: boolean;\n /** With `endpoint`: turn the whole answer into the list of options, when `{ data: [...] }`, `{ items: [...] }` or an array doesn't fit */\n select?: (data: any) => Array<string | number | T>;\n /** With `endpoint`: fetch the option of the current value from `endpoint/{value}` when it isn't in the loaded pages. Default: true */\n hasShow?: boolean;\n /** With `endpoint`: address of one option, or `null` to skip. Default: numeric values only, `endpoint/{value}` */\n showEndpoint?: (value: string, endpoint: string) => string | null;\n /** Fetch options: pages on scroll, search with debounce, late answers ignored */\n loadOptions?: (input: LoadOptionsInput) => Promise<LoadOptionsResult<T>> | LoadOptionsResult<T>;\n /** Fetch one option by value, when the current value isn't in the loaded pages */\n loadOption?: (value: string) => Promise<string | number | T | null | undefined> | string | number | T | null | undefined;\n /** Change it to refetch from page 1 and forget the options (dependent selects) */\n loadKey?: string | number | null;\n /** With `loadOptions`. Default: true */\n enabled?: boolean;\n /** With `loadOptions`: filter what's loaded instead of sending the search */\n localSearch?: boolean;\n /** With `loadOptions`, ms. Default: 300 */\n debounceMs?: number;\n /** Options per page, also for `data`. Default: 20 */\n pageSize?: number;\n onLoadError?: (error: unknown) => void;\n\n /** Own fetching: the first load is running */\n loading?: boolean;\n /** Own fetching: scrolling down calls `onLoadMore` */\n hasMore?: boolean;\n onLoadMore?: () => void;\n /** Own fetching: total shown in the footer */\n total?: number;\n\n /** Search box in the dropdown. Default: true */\n searchable?: boolean;\n /** shared/ui name of `searchable` */\n hasSearch?: boolean;\n searchValue?: string;\n defaultSearchValue?: string;\n /** Fires at every key. For server search, debounce it and pass `filter={({ items }) => items}` */\n onSearchChange?: (value: string) => void;\n /** Cleans the search text before it's used */\n transformSearch?: (search: string) => string;\n filter?: SelectFilter;\n /** Most options shown */\n limit?: number;\n\n /** Shows a × */\n clearable?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n /** Hidden input name, for forms */\n name?: string;\n onBlur?: () => void;\n /** Dropdown height, including search and footer. Default: 400 */\n maxDropdownHeight?: number | string;\n /** Counter under the list. Default: true */\n withFooter?: boolean;\n withCheckIcon?: boolean;\n /** Default: 'left' */\n checkIconPosition?: \"left\" | \"right\";\n /** Own content of an option, instead of label, description and sections. The check mark stays; `withCheckIcon={false}` removes it */\n renderOption?: (input: SelectRenderInput<T>) => ReactNode;\n /** Own content of the closed field. With `multiple`: of each pill */\n renderValue?: (input: SelectRenderInput<T>) => ReactNode;\n /** Props per option: class, style, data attributes, by its state */\n getOptionProps?: (option: T, state: { checked: boolean; disabled: boolean }) => Record<string, unknown> | undefined;\n /** Own check mark of the chosen option */\n checkIcon?: ReactNode;\n /** Own search icon */\n searchIcon?: ReactNode;\n /** Above the list: tabs, filters, an action */\n dropdownHeader?: ReactNode | ((state: SelectDropdownState) => ReactNode);\n /** Under the list: \"Add new\", links… */\n dropdownFooter?: ReactNode | ((state: SelectDropdownState) => ReactNode);\n /** Own counter row, instead of the built-in one */\n renderFooter?: (state: SelectDropdownState) => ReactNode;\n /** Open or close from outside */\n dropdownOpened?: boolean;\n defaultDropdownOpened?: boolean;\n comboboxProps?: Partial<ComboboxProps>;\n onDropdownOpen?: () => void;\n onDropdownClose?: () => void;\n /** Gets the full option of the current value, also when it's first found after loading */\n onOptionSelect?: (option: string | number | T) => void;\n /** Change it to fire `onOptionSelect` again for the same value (e.g. after a form reset) */\n resyncToken?: string | number | null;\n\n nothingFoundMessage?: ReactNode;\n searchPlaceholder?: string;\n loadingMessage?: ReactNode;\n loadingMoreMessage?: ReactNode;\n allLoadedMessage?: ReactNode;\n errorMessage?: ReactNode;\n}\n\nexport interface SingleSelectProps<T = any> extends SelectBaseProps<T> {\n multiple?: false;\n value?: unknown;\n defaultValue?: string | number | null;\n /** Value and its option */\n onChange?: (value: any, option: string | number | T | null) => void;\n /** shadcn name: only when there is a value */\n onValueChange?: (value: string) => void;\n /** Clicking the chosen option again clears it. Default: true */\n allowDeselect?: boolean;\n /** Value after clearing. Use `\"\"` for string schemas. Default: null */\n emptyValue?: string | null;\n}\n\nexport interface MultiSelectProps<T = any> extends SelectBaseProps<T> {\n multiple?: true;\n value?: unknown;\n defaultValue?: Array<string | number>;\n onChange?: (value: any, options: Array<string | number | T>) => void;\n /** Most values that can be picked */\n maxValues?: number;\n /** Picked options leave the list */\n hidePickedOptions?: boolean;\n /** Pills in the closed field, the rest become +N. Default: 3 */\n maxDisplayedValues?: number;\n}\n\nexport type SelectProps<T = any> = SingleSelectProps<T> | MultiSelectProps<T>;\n\n// ── Options ──────────────────────────────────────────────────────────────────────────────\n\n/** Compares by text; `{ id }` objects count as their id. */\nfunction comparable(value: unknown): string {\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"object\" && \"id\" in value) return String((value as { id: unknown }).id);\n return String(value);\n}\n\ninterface LabelOptions {\n valueKey: string;\n labelKey: string;\n getOptionLabel?: (option: any) => ReactNode;\n}\n\nfunction toSelectItem(entry: SelectEntry, keys: LabelOptions): SelectItem {\n const record: SelectOption = typeof entry === \"object\" ? entry : { value: entry, label: String(entry) };\n const value = comparable(record.value ?? record[keys.valueKey]);\n const raw = record.label ?? record[keys.labelKey];\n const plain = typeof raw === \"string\" || typeof raw === \"number\" || isValidElement(raw) ? (raw as ReactNode) : value;\n const node = keys.getOptionLabel ? keys.getOptionLabel(record) : plain;\n const text = typeof node === \"string\" || typeof node === \"number\" ? String(node) : typeof raw === \"string\" ? raw : value;\n const label = record.searchText ?? (typeof record.description === \"string\" ? `${text} ${record.description}` : text);\n return { value, label, node, display: record.displayLabel ?? node, disabled: record.disabled, option: entry, record };\n}\n\ninterface SelectGroupData {\n group: string;\n items: SelectItem[];\n}\n\nfunction toGroups(data: SelectData | undefined, keys: LabelOptions): SelectGroupData[] {\n const groups: SelectGroupData[] = [];\n let loose: SelectGroupData | null = null;\n for (const entry of data ?? []) {\n if (typeof entry === \"object\" && \"group\" in entry && Array.isArray(entry.items)) {\n loose = null;\n groups.push({ group: String(entry.group), items: (entry.items as SelectEntry[]).map((item) => toSelectItem(item, keys)) });\n } else {\n if (!loose) groups.push((loose = { group: \"\", items: [] }));\n loose.items.push(toSelectItem(entry as SelectEntry, keys));\n }\n }\n return groups;\n}\n\nconst matchLabelOrValue: SelectFilter = ({ items, search }) => {\n const query = search.trim().toLowerCase();\n return query ? items.filter((item) => item.label.toLowerCase().includes(query) || item.value.toLowerCase().includes(query)) : items;\n};\n\n// ── Remote options ───────────────────────────────────────────────────────────────────────\n\nfunction useDebouncedValue<T>(value: T, ms: number) {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), ms);\n return () => clearTimeout(timer);\n }, [value, ms]);\n return debounced;\n}\n\ninterface RemoteInput {\n loadOptions: SelectBaseProps[\"loadOptions\"];\n loadOption: SelectBaseProps[\"loadOption\"];\n onLoadError: SelectBaseProps[\"onLoadError\"];\n getValue: (entry: SelectEntry) => string;\n query: string;\n pageSize: number;\n enabled: boolean;\n loadKey: SelectBaseProps[\"loadKey\"];\n /** Values that should have an option */\n values: string[];\n isKnown: (value: string) => boolean;\n}\n\nconst NO_ENTRIES: SelectEntry[] = [];\n\nfunction useRemoteOptions(input: RemoteInput) {\n const { loadOptions, pageSize, enabled, loadKey, query, values } = input;\n const latest = useRef(input);\n latest.current = input;\n const [options, setOptions] = useState<SelectEntry[]>([]);\n const [pinned, setPinned] = useState<SelectEntry[]>([]);\n const [total, setTotal] = useState<number | undefined>();\n const [hasMore, setHasMore] = useState(false);\n const [loading, setLoading] = useState(false);\n const [failed, setFailed] = useState(false);\n const [settled, setSettled] = useState(false);\n const page = useRef(1);\n const loaded = useRef<SelectEntry[]>([]);\n const request =useRef<{ id: number; controller?: AbortController }>({ id: 0 });\n const requested = useRef(new Set<string>());\n const remote = !!loadOptions;\n\n const fetchPage = useCallback((target: number, search: string) => {\n const { loadOptions: load, pageSize: size } = latest.current;\n if (!load) return;\n request.current.controller?.abort();\n const controller = new AbortController();\n const id = request.current.id + 1;\n request.current = { id, controller };\n setLoading(true);\n setFailed(false);\n page.current = target;\n Promise.resolve()\n .then(() => load({ search, page: target, pageSize: size, signal: controller.signal }))\n .then((result) => {\n if (request.current.id !== id) return;\n const items = Array.isArray(result) ? result : result.items;\n const meta: { total?: number; hasMore?: boolean } = Array.isArray(result) ? {} : result;\n const getValue = latest.current.getValue;\n const previous = target === 1 ? [] : loaded.current;\n const seen = new Set(previous.map(getValue));\n const fresh = items.filter((item) => !seen.has(getValue(item)));\n const next = [...previous, ...fresh];\n loaded.current = next;\n setOptions(next);\n setTotal(meta.total);\n // A page with nothing new ends it, whatever the numbers say.\n setHasMore(target > 1 && !fresh.length ? false : (meta.hasMore ?? (meta.total !== undefined ? meta.total > next.length : items.length >= size)));\n setLoading(false);\n setSettled(true);\n })\n .catch((error) => {\n if (request.current.id !== id) return;\n setLoading(false);\n setFailed(true);\n setSettled(true);\n latest.current.onLoadError?.(error);\n });\n }, []);\n\n const scope = useRef(loadKey);\n useEffect(() => {\n if (scope.current !== loadKey) {\n scope.current = loadKey;\n loaded.current = [];\n setOptions([]);\n setPinned([]);\n setTotal(undefined);\n setHasMore(false);\n setSettled(false);\n requested.current.clear();\n }\n if (!remote || !enabled) {\n request.current.controller?.abort();\n request.current = { id: request.current.id + 1 };\n setLoading(false);\n return;\n }\n fetchPage(1, query);\n return () => {\n request.current.controller?.abort();\n request.current = { id: request.current.id + 1 };\n };\n }, [remote, enabled, loadKey, query, pageSize, fetchPage]);\n\n // The value may not be in the pages loaded so far: ask for it, once.\n const missing = values.join(\"\\u0000\");\n useEffect(() => {\n const { loadOption, isKnown } = latest.current;\n if (!loadOption || !settled || !enabled) return;\n const scopeAtStart = scope.current;\n for (const value of values) {\n if (!value || isKnown(value) || requested.current.has(value)) continue;\n requested.current.add(value);\n Promise.resolve()\n .then(() => loadOption(value))\n .then((option) => {\n if (option !== null && option !== undefined && scope.current === scopeAtStart) setPinned((list) => [...list, option]);\n })\n .catch(() => undefined);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [missing, settled, enabled, options.length]);\n\n // Until the effect above resets them, the options belong to the previous `loadKey`.\n const stale = scope.current !== loadKey;\n return {\n options: stale ? NO_ENTRIES : options,\n pinned: stale ? NO_ENTRIES : pinned,\n total,\n hasMore,\n loading,\n failed,\n loadMore: () => {\n if (hasMore && !loading) fetchPage(page.current + 1, query);\n },\n retry: () => fetchPage(1, query),\n };\n}\n\n// ── Icons ────────────────────────────────────────────────────────────────────────────────\n\nfunction SearchIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg viewBox=\"0 0 24 24\" width=\"1rem\" height=\"1rem\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" {...props}>\n <path d=\"m21 21-4.3-4.3\" />\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n </svg>\n );\n}\n\n// ── Select ───────────────────────────────────────────────────────────────────────────────\n\n/**\n * Trigger + dropdown with search, check marks, pages on scroll and a counter. Single or\n * `multiple`, static or fetched. Accepts react-hook-form's `{...field}`.\n *\n * @example\n * <Select label=\"City\" data={cities} clearable value={city} onChange={setCity} />\n * <Select multiple {...field} data={categories} />\n * <Select\n * {...field}\n * loadOptions={({ search, page, pageSize, signal }) => api.users({ search, page, per_page: pageSize, signal }).then((r) => ({ items: r.data, total: r.meta.total }))}\n * loadOption={(id) => api.user(id)}\n * loadKey={cityId}\n * />\n */\nconst SelectRoot = forwardRef<HTMLButtonElement, SelectProps>(function Select(allProps, ref) {\n const labels = useWelloLabels();\n const merged = useProps(\"Select\", {}, allProps as SingleSelectProps & MultiSelectProps & { onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void; onKeyDown?: unknown });\n const {\n multiple,\n classNames,\n styles,\n vars,\n attributes,\n unstyled,\n renderValue,\n getOptionProps,\n checkIcon,\n searchIcon,\n dropdownHeader,\n dropdownFooter,\n renderFooter,\n dropdownOpened,\n defaultDropdownOpened,\n data,\n options: optionsProp,\n valueKey = \"id\",\n labelKey = \"name\",\n getOptionLabel,\n value: controlled,\n defaultValue,\n onChange,\n onBlur,\n endpoint,\n params,\n general,\n select,\n hasShow = true,\n showEndpoint,\n loadOptions: loadOptionsProp,\n loadOption: loadOptionProp,\n loadKey: loadKeyProp,\n enabled = true,\n localSearch,\n debounceMs = 300,\n pageSize = 20,\n onLoadError,\n loading: loadingProp,\n hasMore: hasMoreProp,\n onLoadMore,\n total: totalProp,\n searchable,\n hasSearch,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n transformSearch,\n filter = matchLabelOrValue,\n limit,\n clearable,\n readOnly,\n disabled,\n placeholder,\n name,\n maxDropdownHeight = 400,\n withFooter = true,\n withCheckIcon = true,\n checkIconPosition = \"left\",\n renderOption,\n comboboxProps,\n onDropdownOpen,\n onDropdownClose,\n onOptionSelect,\n resyncToken,\n nothingFoundMessage = labels.noResults,\n searchPlaceholder = labels.search,\n loadingMessage = labels.loading,\n loadingMoreMessage = labels.loadingMore,\n allLoadedMessage = labels.allLoaded,\n errorMessage = labels.loadError,\n rightSection,\n radius = \"2rem\",\n className,\n required,\n withAsterisk,\n onClick,\n onKeyDown: _ignoredKeyDown,\n ...rest\n } = merged;\n const { allowDeselect = true, emptyValue = null, onValueChange, maxValues, hidePickedOptions, maxDisplayedValues = 3, ...props } = rest as typeof rest & SingleSelectProps & MultiSelectProps;\n const withSearch = searchable ?? hasSearch ?? true;\n // With only an `endpoint`: the requests are made here, from the theme's `api`.\n const fromEndpoint = useEndpointLoaders({ endpoint, params, general, select, hasShow: hasShow && !multiple, showEndpoint });\n const loadOptions = loadOptionsProp ?? fromEndpoint.loadOptions;\n const loadOption = loadOptionProp ?? fromEndpoint.loadOption;\n const loadKey = loadKeyProp ?? fromEndpoint.loadKey;\n\n // Every part, with the input's parts passed on to InputBase.\n const theme = useWelloTheme();\n const partClasses = typeof classNames === \"function\" ? classNames(theme, merged) : classNames;\n const partStyles = typeof styles === \"function\" ? styles(theme, merged) : styles;\n const getStyles = useStyles<SelectStylesNames, typeof merged>({ name: \"Select\", props: merged, classNames: partClasses, styles: partStyles, vars, attributes, unstyled });\n\n // Value\n const [internal, setInternal] = useState<unknown>(defaultValue ?? (multiple ? [] : null));\n const current = controlled !== undefined ? controlled : internal;\n const values = useMemo(() => {\n if (!multiple) return current === null || current === \"\" ? [] : [comparable(current)].filter(Boolean);\n const list = Array.isArray(current) ? current : current === null || current === undefined || current === \"\" ? [] : [current];\n return list.map(comparable);\n }, [current, multiple]);\n\n // Search\n const [searchInternal, setSearchInternal] = useState(defaultSearchValue ?? \"\");\n const search = searchValue ?? searchInternal;\n const setSearch = (next: string) => {\n if (searchValue === undefined) setSearchInternal(next);\n if (next !== search) onSearchChange?.(next);\n };\n const query = (transformSearch ? transformSearch(search) : search).trim();\n const debouncedQuery = useDebouncedValue(query, debounceMs);\n\n // Options\n const keys: LabelOptions = { valueKey, labelKey, getOptionLabel };\n const isRemote = !!loadOptions || !!onLoadMore;\n const known = useRef(new Map<string, SelectItem>());\n const scope = useRef(loadKey);\n if (scope.current !== loadKey) {\n scope.current = loadKey;\n known.current = new Map();\n }\n const remote = useRemoteOptions({\n loadOptions,\n loadOption,\n onLoadError,\n getValue: (entry) => toSelectItem(entry, keys).value,\n query: localSearch ? \"\" : debouncedQuery,\n pageSize,\n enabled,\n loadKey,\n values,\n isKnown: (value) => known.current.has(value),\n });\n\n const groups = useMemo(() => {\n if (!loadOptions) return toGroups(data ?? optionsProp, keys);\n const items = remote.options.map((entry) => toSelectItem(entry, keys));\n const inList = new Set(items.map((item) => item.value));\n const pinned = query ? [] : remote.pinned.map((entry) => toSelectItem(entry, keys)).filter((item) => !inList.has(item.value));\n return [{ group: \"\", items: [...pinned, ...items] }];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [data, optionsProp, !!loadOptions, remote.options, remote.pinned, valueKey, labelKey, getOptionLabel, query]);\n\n // What the value shows. Fetched options are remembered, so searching doesn't blank it.\n const lookup = useMemo(() => {\n const map = isRemote ? known.current : new Map<string, SelectItem>();\n for (const group of groups) for (const item of group.items) map.set(item.value, item);\n for (const entry of remote.pinned) {\n const item = toSelectItem(entry, keys);\n map.set(item.value, item);\n }\n return map;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [groups, isRemote, remote.pinned]);\n const selected = values.map((value) => lookup.get(value)).filter((item): item is SelectItem => !!item);\n\n // Filter first, then page: searching must reach every option.\n const filterLocally = !loadOptions || !!localSearch;\n const filtered = useMemo(() => {\n const exclude = hidePickedOptions ? values : undefined;\n let left = limit ?? Infinity;\n const out: SelectGroupData[] = [];\n for (const group of groups) {\n const candidates = exclude ? group.items.filter((item) => !exclude.includes(item.value)) : group.items;\n const matches = (filterLocally ? filter({ items: candidates, search: query }) : candidates) as SelectItem[];\n const items = matches.slice(0, Math.max(0, left));\n left -= items.length;\n if (items.length) out.push({ group: group.group, items });\n }\n return out;\n }, [groups, filterLocally, filter, query, limit, hidePickedOptions, values]);\n const filteredCount = filtered.reduce((sum, group) => sum + group.items.length, 0);\n\n const [visibleCount, setVisibleCount] = useState(pageSize);\n useEffect(() => setVisibleCount(pageSize), [query, pageSize, loadKey]);\n const shown = useMemo(() => {\n if (isRemote) return filtered;\n let left = visibleCount;\n const out: SelectGroupData[] = [];\n for (const group of filtered) {\n if (left <= 0) break;\n out.push({ group: group.group, items: group.items.slice(0, left) });\n left -= group.items.length;\n }\n return out;\n }, [filtered, isRemote, visibleCount]);\n const shownCount = shown.reduce((sum, group) => sum + group.items.length, 0);\n\n const hasMore = loadOptions ? remote.hasMore : onLoadMore ? !!hasMoreProp : filteredCount > visibleCount;\n const fetching = !!loadingProp || remote.loading;\n const total = loadOptions ? remote.total : onLoadMore || totalProp !== undefined ? totalProp : filteredCount;\n const loadMore = () => {\n if (!hasMore || fetching) return;\n if (loadOptions) remote.loadMore();\n else if (onLoadMore) onLoadMore();\n else setVisibleCount((count) => count + pageSize);\n };\n\n // Dropdown\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (remote.failed) remote.retry();\n combobox.selectActiveOption();\n // The dropdown is hidden until it's measured, and hidden elements can't take focus.\n if (withSearch) {\n let tries = 0;\n const focus = () => {\n const input = combobox.searchRef.current;\n input?.focus();\n if (document.activeElement !== input && tries++ < 20) requestAnimationFrame(focus);\n };\n requestAnimationFrame(focus);\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n setSearch(\"\");\n onBlur?.();\n },\n });\n const opened = combobox.dropdownOpened;\n\n // A short first page never scrolls, so it has to ask for the next one itself.\n useEffect(() => {\n if (!opened || !hasMore || fetching) return;\n const frame = requestAnimationFrame(() => {\n const list = combobox.listRef.current;\n if (list && list.scrollHeight <= list.clientHeight + 1) loadMore();\n });\n return () => cancelAnimationFrame(frame);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [opened, hasMore, fetching, shownCount]);\n\n // The list remounts per search, so highlight after the new one is on screen.\n const firstOption = shown[0]?.items[0]?.value;\n useEffect(() => {\n if (opened && query) combobox.selectFirstOption();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [opened, query, firstOption]);\n\n // Tell the parent about the option of the current value, once per value.\n const notified = useRef<string | null>(null);\n const latestSelect = useRef(onOptionSelect);\n latestSelect.current = onOptionSelect;\n useEffect(() => {\n notified.current = null;\n }, [resyncToken]);\n const singleSelected = !multiple ? selected[0] : undefined;\n useEffect(() => {\n if (multiple) return;\n if (!singleSelected) {\n if (!values.length) notified.current = null;\n return;\n }\n if (notified.current === singleSelected.value) return;\n notified.current = singleSelected.value;\n latestSelect.current?.(singleSelected.option);\n }, [multiple, singleSelected, values.length, resyncToken]);\n\n const setSingle = (next: string | null) => {\n if (controlled === undefined) setInternal(next);\n onChange?.(next ?? emptyValue, next === null ? null : (lookup.get(next)?.option ?? null));\n if (next !== null) onValueChange?.(next);\n };\n const setMany = (next: string[]) => {\n if (controlled === undefined) setInternal(next);\n onChange?.(next, next.map((value) => lookup.get(value)?.option).filter((option): option is SelectEntry => option !== undefined));\n };\n const clear = () => {\n if (multiple) setMany([]);\n else setSingle(null);\n onBlur?.();\n };\n\n const canClear = clearable && values.length > 0 && !disabled && !readOnly;\n const renderInput = (item: SelectItem, checked: boolean): SelectRenderInput => ({ option: typeof item.option === \"object\" ? item.option : item.record, value: item.value, label: item.node, checked, disabled: !!item.disabled, search });\n const option = (item: SelectItem) => {\n const checked = values.includes(item.value);\n const extra = getOptionProps?.(item.option, { checked, disabled: !!item.disabled });\n const { className: extraClass, style: extraStyle, ...extraProps } = (extra ?? {}) as { className?: string; style?: React.CSSProperties };\n const mark = !withCheckIcon ? null : multiple ? (\n <span {...getStyles(\"box\")} data-checked={checked || undefined} aria-hidden>\n {checked && (checkIcon ?? <CheckIcon size={12} />)}\n </span>\n ) : (\n <span {...getStyles(\"check\")} data-checked={checked || undefined} aria-hidden>\n {checkIcon ?? <CheckIcon />}\n </span>\n );\n return (\n <ComboboxOption key={item.value} value={item.value} active={checked} disabled={item.disabled} {...getStyles(\"option\", { className: extraClass, style: extraStyle })} {...extraProps}>\n {checkIconPosition === \"left\" && mark}\n {renderOption ? (\n <span {...getStyles(\"optionBody\")}>{renderOption(renderInput(item, checked))}</span>\n ) : (\n <>\n {!!item.record.leftSection && <span {...getStyles(\"optionSection\")} data-position=\"left\">{item.record.leftSection}</span>}\n <span {...getStyles(\"optionBody\")}>\n <span {...getStyles(\"optionLabel\")}>{item.node}</span>\n {!!item.record.description && <span {...getStyles(\"optionDescription\")}>{item.record.description}</span>}\n </span>\n {!!item.record.rightSection && <span {...getStyles(\"optionSection\")} data-position=\"right\">{item.record.rightSection}</span>}\n </>\n )}\n {checkIconPosition === \"right\" && mark}\n </ComboboxOption>\n );\n };\n\n const dropdownState: SelectDropdownState = {\n close: () => {\n combobox.closeDropdown();\n combobox.focusTarget();\n },\n search,\n shown: shownCount,\n total,\n hasMore,\n loading: fetching,\n };\n const slot = (content: SelectBaseProps[\"dropdownHeader\"]) => (typeof content === \"function\" ? content(dropdownState) : content);\n const firstLoad = fetching && !shownCount;\n return (\n <Combobox\n store={combobox}\n unstyled={unstyled}\n {...comboboxProps}\n onOptionSubmit={(next) => {\n if (multiple) {\n if (values.includes(next)) setMany(values.filter((value) => value !== next));\n else if (maxValues === undefined || values.length < maxValues) setMany([...values, next]);\n return;\n }\n if (next === values[0]) {\n if (allowDeselect) setSingle(null);\n } else setSingle(next);\n combobox.closeDropdown();\n combobox.focusTarget();\n }}\n >\n <ComboboxTarget targetType=\"button\">\n <InputBase\n __staticSelector=\"Select\"\n component=\"button\"\n type=\"button\"\n ref={ref}\n radius={radius}\n pointer\n disabled={disabled}\n withAsterisk={required || withAsterisk}\n unstyled={unstyled}\n classNames={partClasses}\n styles={partStyles}\n className={cx(!unstyled && \"wello-Select-trigger\", className)}\n rightSectionPointerEvents=\"none\"\n rightSectionWidth={canClear ? \"3.5rem\" : undefined}\n rightSection={\n rightSection ?? (\n <span {...getStyles(\"sections\")}>\n {canClear && <ComboboxClearButton {...getStyles(\"clear\")} onClear={clear} />}\n <ComboboxChevron />\n </span>\n )\n }\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented && !readOnly) combobox.toggleDropdown();\n }}\n onBlur={() => {\n if (!opened) onBlur?.();\n }}\n {...(props as object)}\n >\n {multiple && selected.length ? (\n <span {...getStyles(\"pills\")}>\n {selected.slice(0, maxDisplayedValues).map((item) => (\n <span key={item.value} {...getStyles(\"pill\")}>\n {renderValue ? renderValue(renderInput(item, true)) : item.node}\n </span>\n ))}\n {selected.length > maxDisplayedValues && <span {...getStyles(\"pill\")}>+{selected.length - maxDisplayedValues}</span>}\n </span>\n ) : !multiple && selected.length ? (\n <span {...getStyles(\"value\")}>{renderValue ? renderValue(renderInput(selected[0], true)) : selected[0].display}</span>\n ) : (\n <Input.Placeholder>{placeholder}</Input.Placeholder>\n )}\n </InputBase>\n </ComboboxTarget>\n\n <ComboboxDropdown {...getStyles(\"dropdown\", { style: { maxHeight: maxDropdownHeight } })}>\n {withSearch && (\n <div {...getStyles(\"searchWrap\")}>\n <label {...getStyles(\"searchBox\")}>\n {searchIcon ?? <SearchIcon {...getStyles(\"searchIcon\")} />}\n <ComboboxSearch\n {...getStyles(\"search\")}\n placeholder={searchPlaceholder}\n value={search}\n onChange={(event) => setSearch(event.currentTarget.value)}\n onKeyDown={(event) => {\n // Inside a form, Enter must not submit it.\n if (event.key === \"Enter\") event.preventDefault();\n if (event.key === \"Enter\" && combobox.listRef.current?.querySelector(\"[data-combobox-selected]\")) combobox.clickSelectedOption();\n if (event.key === \"Enter\") event.stopPropagation();\n if (event.key === \"Tab\" || event.key === \"Escape\") combobox.focusTarget();\n }}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n />\n {fetching && <Loader color=\"currentColor\" size={14} {...getStyles(\"spinner\")} />}\n {search && (\n <button type=\"button\" {...getStyles(\"searchClear\")} aria-label={labels.clearSearch} onMouseDown={(event) => event.preventDefault()} onClick={() => setSearch(\"\")}>\n <svg viewBox=\"0 0 24 24\" width=\"0.875rem\" height=\"0.875rem\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2.25} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </button>\n )}\n </label>\n </div>\n )}\n {dropdownHeader && <div {...getStyles(\"dropdownHeader\")}>{slot(dropdownHeader)}</div>}\n\n {firstLoad ? (\n <div {...getStyles(\"state\")}>\n <Loader color=\"currentColor\" size={16} />\n {loadingMessage}\n </div>\n ) : !shownCount ? (\n <div {...getStyles(\"empty\")}>\n <EmptyState withBorder={false}>{remote.failed ? errorMessage : nothingFoundMessage}</EmptyState>\n </div>\n ) : (\n <>\n <ComboboxOptions\n key={`${loadKey ?? \"\"}|${query}`}\n mah=\"none\"\n {...getStyles(\"options\")}\n aria-multiselectable={multiple || undefined}\n {...({\n onScroll: (event: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, clientHeight, scrollHeight } = event.currentTarget;\n if ((scrollTop + clientHeight) / scrollHeight > 0.8) loadMore();\n },\n onWheel: (event: React.WheelEvent) => event.stopPropagation(),\n } as object)}\n >\n {shown.map((group, index) =>\n group.group ? (\n <ComboboxGroup key={`${group.group}-${index}`} label={group.group} {...getStyles(\"group\")} labelProps={getStyles(\"groupLabel\")}>\n {group.items.map(option)}\n </ComboboxGroup>\n ) : (\n group.items.map(option)\n ),\n )}\n </ComboboxOptions>\n {renderFooter\n ? renderFooter(dropdownState)\n : withFooter &&\n (fetching ? (\n <div {...getStyles(\"footer\")} data-loading>\n <Loader color=\"currentColor\" size={14} />\n {loadingMoreMessage}\n </div>\n ) : (\n <div {...getStyles(\"footer\")}>\n <span {...getStyles(\"count\")}>\n {shownCount}\n {total ? ` / ${total}` : \"\"}\n </span>\n {!hasMore && <span {...getStyles(\"allLoaded\")}>{allLoadedMessage}</span>}\n </div>\n ))}\n </>\n )}\n {dropdownFooter && <div {...getStyles(\"dropdownFooter\")}>{slot(dropdownFooter)}</div>}\n </ComboboxDropdown>\n {name && <input type=\"hidden\" name={name} value={values.join(\",\")} />}\n </Combobox>\n );\n});\nSelectRoot.displayName = \"Select\";\n\n/**\n * One option can be any shape: `description`, `leftSection`, `rightSection`, or `renderOption`.\n * Every part takes `classNames` and `styles`.\n *\n * @example\n * <Select options={[{ value: 1, label: \"Pro\", description: \"Monthly\", rightSection: \"$29\" }]} />\n * <Select<Plan> options={plans} renderOption={({ option }) => <PlanRow plan={option} />} classNames={{ option: \"rounded-none\" }} />\n */\nexport const Select = SelectRoot as unknown as (<T = any>(props: SelectProps<T> & { ref?: Ref<HTMLButtonElement> }) => ReactElement | null) & { displayName?: string };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,gBAA6C,aAAa,WAAW,SAAS,QAAQ,gBAAgC;AA4bvI,SAuUM,UAtUJ,KADF;AAlMJ,SAAS,WAAW,OAAwB;AAC1C,MAAI,UAAU,UAAa,UAAU,KAAM,QAAO;AAClD,MAAI,OAAO,UAAU,YAAY,QAAQ,MAAO,QAAO,OAAQ,MAA0B,EAAE;AAC3F,SAAO,OAAO,KAAK;AACrB;AAQA,SAAS,aAAa,OAAoB,MAAgC;AACxE,QAAM,SAAuB,OAAO,UAAU,WAAW,QAA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,SAAS,CAAC,UAA4B,MAAM,gBAAgB;AAAA,gBAC9D;AAAA,gBAEC,gBAAM;AAAA,kBAAI,CAAC,OAAO,UACjB,MAAM,QACJ,oBAAC,iBAA8C,OAAO,MAAM,OAAQ,GAAG,UAAU,OAAO,GAAG,YAAY,UAAU,YAAY,GAC1H,gBAAM,MAAM,IAAI,MAAM,KADL,GAAG,MAAM,KAAK,IAAI,KAAK,EAE3C,IAEA,MAAM,MAAM,IAAI,MAAM;AAAA,gBAE1B;AAAA;AAAA,cApBK,GAAG,WAAW,EAAE,IAAI,KAAK;AAAA,YAqBhC;AAAA,YACC,eACG,aAAa,aAAa,IAC1B,eACC,WACC,qBAAC,SAAK,GAAG,UAAU,QAAQ,GAAG,gBAAY,MACxC;AAAA,kCAAC,UAAO,OAAM,gBAAe,MAAM,IAAI;AAAA,cACtC;AAAA,eACH,IAEA,qBAAC,SAAK,GAAG,UAAU,QAAQ,GACzB;AAAA,mCAAC,UAAM,GAAG,UAAU,OAAO,GACxB;AAAA;AAAA,gBACA,QAAQ,MAAM,KAAK,KAAK;AAAA,iBAC3B;AAAA,cACC,CAAC,WAAW,oBAAC,UAAM,GAAG,UAAU,WAAW,GAAI,4BAAiB;AAAA,eACnE;AAAA,aAER;AAAA,UAED,kBAAkB,oBAAC,SAAK,GAAG,UAAU,gBAAgB,GAAI,eAAK,cAAc,GAAE;AAAA,WACjF;AAAA,QACC,QAAQ,oBAAC,WAAM,MAAK,UAAS,MAAY,OAAO,OAAO,KAAK,GAAG,GAAG;AAAA;AAAA;AAAA,EACrE;AAEJ,CAAC;AACD,WAAW,cAAc;AAUlB,IAAMC,UAAS;","names":["option","Select"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/overlay/use-floating.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\n\nexport type FloatingSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type FloatingPosition = FloatingSide | `${FloatingSide}-start` | `${FloatingSide}-end`;\n\nexport interface UseFloatingOptions {\n opened: boolean;\n /** Default: 'bottom' */\n position?: FloatingPosition;\n /** Gap between target and dropdown, px. Default: 8 */\n offset?: number;\n /** Move to the opposite side when there is no room. Default: true */\n flip?: boolean;\n /** Slide along the target to stay in the viewport. Default: true */\n shift?: boolean;\n /** Distance kept from the viewport edges, px. Default: 8 */\n padding?: number;\n /** RTL swaps start / end on top and bottom */\n dir?: \"ltr\" | \"rtl\";\n /** Arrow size, for keeping it inside rounded corners */\n arrowSize?: number;\n /** Space between the arrow and the dropdown corner. Default: 5 */\n arrowOffset?: number;\n /** Arrow at the side edge or centered on the target. Default: 'side' */\n arrowPosition?: \"side\" | \"center\";\n onPositionChange?: (position: FloatingPosition) => void;\n /** Stay on the side it opened on, instead of flipping while scrolling. Default: true */\n preventPositionChangeWhenVisible?: boolean;\n}\n\nexport interface FloatingState {\n x: number;\n y: number;\n /** Final position after flipping */\n placement: FloatingPosition;\n arrowX?: number;\n arrowY?: number;\n /** Target size, for `width=\"target\"` */\n referenceWidth: number;\n ready: boolean;\n /** The target is scrolled out of sight */\n referenceHidden: boolean;\n}\n\nconst OPPOSITE: Record<FloatingSide, FloatingSide> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n\nfunction split(position: FloatingPosition): [FloatingSide, \"start\" | \"center\" | \"end\"] {\n const [side, align] = position.split(\"-\") as [FloatingSide, \"start\" | \"end\" | undefined];\n return [side, align ?? \"center\"];\n}\n\n/** Coordinates of a dropdown for a side / alignment, in viewport (fixed) coordinates. */\nfunction place(ref: DOMRect, width: number, height: number, side: FloatingSide, align: \"start\" | \"center\" | \"end\", offset: number) {\n let x = 0;\n let y = 0;\n if (side === \"top\" || side === \"bottom\") {\n y = side === \"bottom\" ? ref.bottom + offset : ref.top - offset - height;\n x = align === \"start\" ? ref.left : align === \"end\" ? ref.right - width : ref.left + ref.width / 2 - width / 2;\n } else {\n x = side === \"right\" ? ref.right + offset : ref.left - offset - width;\n y = align === \"start\" ? ref.top : align === \"end\" ? ref.bottom - height : ref.top + ref.height / 2 - height / 2;\n }\n return { x, y };\n}\n\n/**\n * Positions a floating element next to a reference element (position: fixed), with flip,\n * shift and an arrow. Updates on scroll, resize and size changes.\n */\nexport function useFloating(options: UseFloatingOptions) {\n const {\n opened,\n position = \"bottom\",\n offset = 8,\n flip = true,\n shift = true,\n padding = 8,\n dir = \"ltr\",\n arrowSize = 0,\n arrowOffset = 5,\n arrowPosition = \"side\",\n onPositionChange,\n preventPositionChangeWhenVisible = true,\n } = options;\n const reference = useRef<HTMLElement | null>(null);\n const floating = useRef<HTMLElement | null>(null);\n const [state, setState] = useState<FloatingState>({ x: 0, y: 0, placement: position, referenceWidth: 0, ready: false, referenceHidden: false });\n const lastPlacement = useRef(position);\n const lockedSide = useRef<FloatingSide | null>(null);\n const changed = useRef(onPositionChange);\n changed.current = onPositionChange;\n\n const update = useCallback(() => {\n const ref = reference.current;\n const el = floating.current;\n if (!ref || !el) return;\n const rect = ref.getBoundingClientRect();\n const width = el.offsetWidth;\n const height = el.offsetHeight;\n const vw = document.documentElement.clientWidth;\n const vh = document.documentElement.clientHeight;\n let [side, align] = split(position);\n if (dir === \"rtl\" && (side === \"top\" || side === \"bottom\") && align !== \"center\") {\n align = align === \"start\" ? \"end\" : \"start\";\n }\n\n const locked = preventPositionChangeWhenVisible ? lockedSide.current : null;\n if (locked) side = locked;\n let { x, y } = place(rect, width, height, side, align, offset);\n if (flip && !locked) {\n const overflows = (s: FloatingSide, px: number, py: number) =>\n s === \"bottom\" ? py + height > vh - padding : s === \"top\" ? py < padding : s === \"right\" ? px + width > vw - padding : px < padding;\n if (overflows(side, x, y)) {\n const other = OPPOSITE[side];\n const flipped = place(rect, width, height, other, align, offset);\n const room = (s: FloatingSide) =>\n s === \"bottom\" ? vh - rect.bottom : s === \"top\" ? rect.top : s === \"right\" ? vw - rect.right : rect.left;\n if (!overflows(other, flipped.x, flipped.y) || room(other) > room(side)) {\n side = other;\n ({ x, y } = flipped);\n }\n }\n }\n if (shift) {\n if (side === \"top\" || side === \"bottom\") x = Math.min(Math.max(x, padding), Math.max(padding, vw - width - padding));\n else y = Math.min(Math.max(y, padding), Math.max(padding, vh - height - padding));\n }\n\n // Nothing measured yet means it isn't really open, so it may still pick a side.\n if (width > 0) lockedSide.current = side;\n\n // Outside the viewport, or cut off by a scrolling parent.\n let referenceHidden = rect.bottom <= 0 || rect.top >= vh || rect.right <= 0 || rect.left >= vw;\n for (let parent = ref.parentElement; parent && !referenceHidden && parent !== document.body; parent = parent.parentElement) {\n const style = getComputedStyle(parent);\n if (style.overflowX === \"visible\" && style.overflowY === \"visible\") continue;\n const box = parent.getBoundingClientRect();\n referenceHidden = rect.bottom <= box.top || rect.top >= box.bottom || rect.right <= box.left || rect.left >= box.right;\n }\n\n // Arrow: points at the target, kept away from the rounded corners.\n let arrowX: number | undefined;\n let arrowY: number | undefined;\n if (arrowSize) {\n const min = arrowOffset + arrowSize;\n if (side === \"top\" || side === \"bottom\") {\n const target =\n arrowPosition === \"center\" || align === \"center\"\n ? rect.left + rect.width / 2 - x\n : align === \"start\"\n ? Math.min(rect.width / 2, min + arrowSize) + (rect.left - x)\n : rect.right - x - Math.min(rect.width / 2, min + arrowSize);\n arrowX = Math.min(Math.max(target, min), width - min);\n } else {\n const target =\n arrowPosition === \"center\" || align === \"center\"\n ? rect.top + rect.height / 2 - y\n : align === \"start\"\n ? Math.min(rect.height / 2, min + arrowSize) + (rect.top - y)\n : rect.bottom - y - Math.min(rect.height / 2, min + arrowSize);\n arrowY = Math.min(Math.max(target, min), height - min);\n }\n }\n\n const placement = (align === \"center\" ? side : `${side}-${align}`) as FloatingPosition;\n if (placement !== lastPlacement.current) {\n lastPlacement.current = placement;\n changed.current?.(placement);\n }\n setState((prev) =>\n prev.referenceHidden === referenceHidden && prev.x === x && prev.y === y && prev.placement === placement && prev.arrowX === arrowX && prev.arrowY === arrowY && prev.referenceWidth === rect.width && prev.ready\n ? prev\n : { x, y, placement, arrowX, arrowY, referenceWidth: rect.width, ready: true, referenceHidden },\n );\n }, [position, offset, flip, shift, padding, dir, arrowSize, arrowOffset, arrowPosition, preventPositionChangeWhenVisible]);\n\n useLayoutEffect(() => {\n lockedSide.current = null;\n if (opened) update();\n else setState((prev) => (prev.ready ? { ...prev, ready: false } : prev));\n }, [opened, update]);\n\n useEffect(() => {\n if (!opened) return;\n let frame = requestAnimationFrame(update);\n const onChange = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(update);\n };\n window.addEventListener(\"scroll\", onChange, true);\n window.addEventListener(\"resize\", onChange);\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(onChange) : null;\n if (reference.current) observer?.observe(reference.current);\n if (floating.current) observer?.observe(floating.current);\n return () => {\n cancelAnimationFrame(frame);\n window.removeEventListener(\"scroll\", onChange, true);\n window.removeEventListener(\"resize\", onChange);\n observer?.disconnect();\n };\n }, [opened, update]);\n\n // React calls an old ref callback with null and the new one with the node on every render when the\n // callback changes, so only a different node counts. Measuring here on each render can feed itself.\n const setReference = useCallback(\n (node: HTMLElement | null) => {\n if (!node || node === reference.current) return;\n reference.current = node;\n if (opened) update();\n },\n [opened, update],\n );\n const setFloating = useCallback(\n (node: HTMLElement | null) => {\n if (!node || node === floating.current) return;\n floating.current = node;\n update();\n },\n [update],\n );\n return { ...state, update, reference, floating, setReference, setFloating };\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,WAAW,iBAAiB,QAAQ,gBAAgB;AA4C1E,IAAM,WAA+C,EAAE,KAAK,UAAU,QAAQ,OAAO,MAAM,SAAS,OAAO,OAAO;AAElH,SAAS,MAAM,UAAwE;AACrF,QAAM,CAAC,MAAM,KAAK,IAAI,SAAS,MAAM,GAAG;AACxC,SAAO,CAAC,MAAM,SAAS,QAAQ;AACjC;AAGA,SAAS,MAAM,KAAc,OAAe,QAAgB,MAAoB,OAAmC,QAAgB;AACjI,MAAI,IAAI;AACR,MAAI,IAAI;AACR,MAAI,SAAS,SAAS,SA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AC5B,UAAI,CAAC,QAAQ,SAAS,UAAU,QAAS;AACzC,gBAAU,UAAU;AACpB,UAAI,OAAQ,QAAO;AAAA,IACrB;AAAA,IACA,CAAC,QAAQ,MAAM;AAAA,EACjB;AACA,QAAM,cAAc;AAAA,IAClB,CAAC,SAA6B;AAC5B,UAAI,CAAC,QAAQ,SAAS,SAAS,QAAS;AACxC,eAAS,UAAU;AACnB,aAAO;AAAA,IACT;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACA,SAAO,EAAE,GAAG,OAAO,QAAQ,WAAW,UAAU,cAAc,YAAY;AAC5E;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useProps } from \"../../core/styles-api/styles-api\";\n\nexport interface PortalProps {\n /** Element or selector to render into. Default: a new `<div>` in `document.body` */\n target?: HTMLElement | string | null;\n /** Share one container `<div>` between every portal without a target. Default: true */\n reuseTargetNode?: boolean;\n /** Class / id on the created container */\n className?: string;\n id?: string;\n children?: ReactNode;\n}\n\nlet sharedNode: HTMLDivElement | null = null;\n\n/** Keep portal roots aligned with `<html dir>` so RTL PhoneInput / Select menus match. */\nfunction syncPortalDir(el: HTMLElement) {\n const dir = document.documentElement.getAttribute(\"dir\");\n if (dir) el.setAttribute(\"dir\", dir);\n else el.removeAttribute(\"dir\");\n}\n\n/**\n * Renders children elsewhere in the DOM (body by default), after the first client render.\n *\n * @example\n * <Portal><div className=\"toast\">…</div></Portal>\n */\nexport function Portal(_props: PortalProps) {\n const { target, reuseTargetNode, className, id, children } = useProps(\"Portal\", { reuseTargetNode: true }, _props);\n const [node, setNode] = useState<HTMLElement | null>(null);\n const created = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (target) {\n const el = typeof target === \"string\" ? document.querySelector<HTMLElement>(target) : target;\n if (el) syncPortalDir(el);\n setNode(el);\n return;\n }\n // Your own class or id needs its own element.\n if (reuseTargetNode && !className && !id) {\n if (!sharedNode || !sharedNode.isConnected) {\n sharedNode = document.createElement(\"div\");\n sharedNode.setAttribute(\"data-wello-portal\", \"shared\");\n document.body.appendChild(sharedNode);\n }\n syncPortalDir(sharedNode);\n setNode(sharedNode);\n return;\n }\n const div = document.createElement(\"div\");\n div.setAttribute(\"data-wello-portal\", \"\");\n if (className) div.className = className;\n if (id) div.id = id;\n syncPortalDir(div);\n document.body.appendChild(div);\n created.current = div;\n setNode(div);\n return () => {\n div.remove();\n created.current = null;\n };\n }, [target, reuseTargetNode, className, id]);\n\n // Dir can change while a dropdown is open (language switch).\n useEffect(() => {\n if (!node) return;\n syncPortalDir(node);\n const observer = new MutationObserver(() => syncPortalDir(node));\n observer.observe(document.documentElement, { attributes: true, attributeFilter: [\"dir\"] });\n return () => observer.disconnect();\n }, [node]);\n\n return node ? createPortal(children, node) : null;\n}\n\n/** `withinPortal` helper used by overlays: portal or inline. */\nexport function OptionalPortal({ withinPortal = true, children, ...props }: PortalProps & { withinPortal?: boolean }) {\n return withinPortal ? <Portal {...props}>{children}</Portal> : <>{children}</>;\n}\n"],"mappings":";;;;;;AAAA,SAAS,WAAW,QAAQ,gBAAgC;AAC5D,SAAS,oBAAoB;AAgFL,SAAyC,UAAzC;AAlExB,IAAI,aAAoC;AAGxC,SAAS,cAAc,IAAiB;AACtC,QAAM,MAAM,SAAS,gBAAgB,aAAa,KAAK;AACvD,MAAI,IAAK,IAAG,aAAa,OAAO,GAAG;AAAA,MAC9B,IAAG,gBAAgB,KAAK;AAC/B;AAQO,SAAS,OAAO,QAAqB;AAC1C,QAAM,EAAE,QAAQ,iBAAiB,WAAW,IAAI,SAAS,IAAI,SAAS,UAAU,EAAE,iBAAiB,KAAK,GAAG,MAAM;AACjH,QAAM,CAAC,MAAM,OAAO,IAAI,SAA6B,IAAI;AACzD,QAAM,UAAU,OAA8B,IAAI;AAElD,YAAU,MAAM;AACd,QAAI,QAAQ;AACV,YAA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Content":["import {\n cloneElement,\n createContext,\n isValidElement,\n useContext,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { Box, type BoxProps } from \"../../core/Box/Box\";\nimport { factory } from \"../../core/factory/factory\";\nimport { useClickOutside, useEscape, useFocusTrap } from \"../../core/overlay/focus\";\nimport { useFloating, type FloatingPosition } from \"../../core/overlay/use-floating\";\nimport { useDirection } from \"../../core/provider/WelloProvider\";\nimport {\n useComponentStyles,\n useProps,\n type GetStyles,\n type StylesApiProps,\n} from \"../../core/styles-api/styles-api\";\nimport type { WelloRadius, WelloShadow } from \"../../core/theme/types\";\nimport { getRadius, getShadow, rem } from \"../../core/theme/units\";\nimport { mergeRefs, useId } from \"../../core/utils\";\nimport { OptionalPortal, type PortalProps } from \"../Portal/Portal\";\nimport { Transition, type TransitionProps } from \"../Transition/Transition\";\n\nexport type PopoverStylesNames = \"dropdown\" | \"arrow\";\nexport type PopoverWidth = \"target\" | \"auto\" | number | (string & {});\n\nexport interface PopoverBaseProps {\n /** Default: 'bottom' */\n position?: FloatingPosition;\n /** Default: 8 */\n offset?: number;\n /** `'target'` = same width as the target. Default: 'max-content' */\n width?: PopoverWidth;\n withArrow?: boolean;\n /** Default: 7 */\n arrowSize?: number;\n /** Default: 5 */\n arrowOffset?: number;\n /** Default: 0 */\n arrowRadius?: number;\n /** Default: 'side' */\n arrowPosition?: \"side\" | \"center\";\n /** Default: true */\n withinPortal?: boolean;\n portalProps?: Omit<PortalProps, \"children\">;\n /** Default: 300 */\n zIndex?: number | string;\n radius?: WelloRadius;\n /** Default: 'md' */\n shadow?: WelloShadow;\n /** Default: { transition: 'fade', duration: 150 } */\n transitionProps?: Omit<TransitionProps, \"mounted\" | \"children\">;\n /** Keep the dropdown in the DOM while closed */\n keepMounted?: boolean;\n /** Flip / shift to stay on screen. Default: both true */\n middlewares?: { flip?: boolean; shift?: boolean };\n onPositionChange?: (position: FloatingPosition) => void;\n /** Hide the dropdown */\n disabled?: boolean;\n /** Hide it while the target is scrolled out of sight. Default: true */\n hideDetached?: boolean;\n /** Stay on the side it opened on, instead of flipping while scrolling. Default: true */\n preventPositionChangeWhenVisible?: boolean;\n}\n\nexport interface PopoverProps\n extends PopoverBaseProps, StylesApiProps<PopoverStylesNames, PopoverProps> {\n /** Controlled state */\n opened?: boolean;\n defaultOpened?: boolean;\n onChange?: (opened: boolean) => void;\n onOpen?: () => void;\n onClose?: () => void;\n /** Keep Tab inside the dropdown */\n trapFocus?: boolean;\n /** Focus the target back on close. Default: false */\n returnFocus?: boolean;\n /** Default: true */\n closeOnEscape?: boolean;\n /** Default: true */\n closeOnClickOutside?: boolean;\n /** Default: ['mousedown', 'touchstart'] */\n clickOutsideEvents?: string[];\n /** aria roles on target / dropdown. Default: true */\n withRoles?: boolean;\n /** Base id of the dropdown */\n id?: string;\n /** Close on Escape / click outside does nothing; you control it */\n children?: ReactNode;\n /** Set by Menu */\n __staticSelector?: string;\n __role?: string;\n}\n\ninterface PopoverContextValue {\n opened: boolean;\n open: () => void;\n close: () => void;\n toggle: () => void;\n floating: ReturnType<typeof useFloating>;\n targetRef: React.MutableRefObject<HTMLElement | null>;\n dropdownRef: React.MutableRefObject<HTMLElement | null>;\n getStyles: GetStyles<PopoverStylesNames>;\n props: PopoverProps;\n id: string;\n /** Nested popovers register their dropdown so clicks in them don't close this one */\n registerChild: (ref: React.MutableRefObject<HTMLElement | null>) => () => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nexport function usePopoverContext() {\n const context = useContext(PopoverContext);\n if (!context) throw new Error(\"Popover.Target / Popover.Dropdown must be inside <Popover>\");\n return context;\n}\n\n/** Root of a popover; use `Popover.Target` and `Popover.Dropdown` inside. */\nexport function Popover(_props: PopoverProps) {\n const props = useProps(\n \"Popover\",\n {\n position: \"bottom\",\n offset: 8,\n width: \"max-content\",\n hideDetached: true,\n preventPositionChangeWhenVisible: true,\n arrowSize: 7,\n arrowOffset: 5,\n arrowRadius: 0,\n arrowPosition: \"side\",\n withinPortal: true,\n zIndex: 300,\n shadow: \"md\",\n closeOnEscape: true,\n closeOnClickOutside: true,\n withRoles: true,\n returnFocus: false,\n },\n _props,\n );\n const name = props.__staticSelector ?? \"Popover\";\n const [getStyles] = useComponentStyles(name, props, {\n rootSelector: \"dropdown\",\n varsResolver: (_theme, p) => ({\n dropdown: {\n \"--popover-radius\": p.radius === undefined ? undefined : getRadius(p.radius),\n \"--popover-shadow\": getShadow(p.shadow),\n },\n }),\n });\n const [internal, setInternal] = useState(!!props.defaultOpened);\n const opened = !props.disabled && (props.opened ?? internal);\n const setOpened = (next: boolean) => {\n if (next === opened) return;\n if (props.opened === undefined) setInternal(next);\n props.onChange?.(next);\n (next ? props.onOpen : props.onClose)?.();\n };\n const { dir } = useDirection();\n const floating = useFloating({\n opened,\n position: props.position,\n offset: props.offset! + (props.withArrow ? props.arrowSize! / 2 : 0),\n flip: props.middlewares?.flip ?? true,\n shift: props.middlewares?.shift ?? true,\n dir,\n arrowSize: props.withArrow ? props.arrowSize : 0,\n arrowOffset: props.arrowOffset,\n arrowPosition: props.arrowPosition,\n onPositionChange: props.onPositionChange,\n preventPositionChangeWhenVisible: props.preventPositionChangeWhenVisible,\n });\n const targetRef = useRef<HTMLElement | null>(null);\n const dropdownRef = useRef<HTMLElement | null>(null);\n const id = useId(props.id);\n const children = useRef(new Set<React.MutableRefObject<HTMLElement | null>>());\n const parent = useContext(PopoverContext);\n useEffect(() => parent?.registerChild(dropdownRef), [parent]);\n\n useClickOutside(\n () => props.closeOnClickOutside && setOpened(false),\n () => [targetRef, dropdownRef, ...children.current],\n opened,\n props.clickOutsideEvents,\n );\n useEscape(() => {\n if (props.closeOnEscape) {\n setOpened(false);\n targetRef.current?.focus();\n }\n }, opened);\n\n return (\n <PopoverContext.Provider\n value={{\n opened,\n open: () => setOpened(true),\n close: () => setOpened(false),\n toggle: () => setOpened(!opened),\n floating,\n targetRef,\n dropdownRef,\n getStyles,\n props,\n id,\n // Ancestors learn about nested dropdowns too, at any depth.\n registerChild: (ref) => {\n children.current.add(ref);\n const up = parent?.registerChild(ref);\n return () => {\n children.current.delete(ref);\n up?.();\n };\n },\n }}\n >\n {props.children}\n </PopoverContext.Provider>\n );\n}\n\nexport interface PopoverTargetProps {\n /** One element; receives ref, onClick and aria attributes */\n children: ReactElement;\n /** Prop the ref goes to. Default: 'ref' */\n refProp?: string;\n /** Set aria-haspopup, aria-expanded and aria-controls on the target. Default: the popover's `withRoles` */\n withRoles?: boolean;\n /** Extra props merged into the child */\n popupType?: string;\n}\n\nexport function PopoverTarget({\n children,\n refProp = \"ref\",\n popupType = \"dialog\",\n withRoles,\n}: PopoverTargetProps) {\n const context = usePopoverContext();\n if (!isValidElement(children)) throw new Error(\"Popover.Target needs one element child\");\n const child = children as ReactElement<Record<string, any>>;\n const roles = (withRoles ?? context.props.withRoles)\n ? {\n \"aria-haspopup\": popupType,\n \"aria-expanded\": context.opened,\n \"aria-controls\": context.opened ? `${context.id}-dropdown` : undefined,\n id: child.props.id ?? `${context.id}-target`,\n }\n : {};\n return cloneElement(child, {\n ...roles,\n \"data-expanded\": context.opened || undefined,\n [refProp]: mergeRefs(context.targetRef, context.floating.setReference, child.props.ref),\n onClick: (event: React.MouseEvent) => {\n child.props.onClick?.(event);\n if (!event.defaultPrevented && !context.props.__role) context.toggle();\n },\n });\n}\n\nexport interface PopoverDropdownProps extends BoxProps {\n children?: ReactNode;\n className?: string;\n}\n\nexport const PopoverDropdown = factory<{\n props: PopoverDropdownProps;\n ref: HTMLDivElement;\n stylesNames: \"dropdown\";\n}>(({ children, className, style, ...others }, ref) => {\n const context = usePopoverContext();\n const { props, floating } = context;\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n useFocusTrap(dropdownRef, context.opened && !!props.trapFocus, props.returnFocus);\n const width =\n props.width === \"target\"\n ? floating.referenceWidth\n : props.width === \"auto\"\n ? undefined\n : rem(props.width as number | string);\n return (\n <OptionalPortal withinPortal={props.withinPortal} {...props.portalProps}>\n <Transition\n mounted={context.opened}\n keepMounted={props.keepMounted}\n transition=\"fade\"\n duration={150}\n {...props.transitionProps}\n >\n {(transitionStyles) => {\n const dropdown = context.getStyles(\"dropdown\", { className });\n return (\n <Box\n ref={mergeRefs(ref, dropdownRef, context.dropdownRef, floating.setFloating)}\n id={`${context.id}-dropdown`}\n role={props.withRoles ? (props.__role ?? \"dialog\") : undefined}\n aria-labelledby={props.withRoles ? `${context.id}-target` : undefined}\n tabIndex={-1}\n {...dropdown}\n data-position={floating.placement}\n style={{\n ...transitionStyles,\n ...dropdown.style,\n position: \"fixed\",\n top: floating.y,\n left: floating.x,\n width,\n zIndex: props.zIndex as CSSProperties[\"zIndex\"],\n // Invisible until measured, so it doesn't flash at 0,0.\n visibility: floating.ready && !(props.hideDetached && floating.referenceHidden)\n ? (transitionStyles.visibility as CSSProperties[\"visibility\"])\n : \"hidden\",\n ...(typeof style === \"object\" ? style : undefined),\n }}\n {...others}\n >\n {children}\n {props.withArrow && (\n <div\n {...context.getStyles(\"arrow\")}\n data-position={floating.placement}\n style={{\n ...context.getStyles(\"arrow\").style,\n [\"--_arrow\" as string]: `${props.arrowSize}px`,\n width: props.arrowSize,\n height: props.arrowSize,\n borderRadius: props.arrowRadius,\n left:\n floating.arrowX !== undefined\n ? floating.arrowX - props.arrowSize! / 2\n : undefined,\n top:\n floating.arrowY !== undefined\n ? floating.arrowY - props.arrowSize! / 2\n : undefined,\n }}\n />\n )}\n </Box>\n );\n }}\n </Transition>\n </OptionalPortal>\n );\n});\nPopoverDropdown.displayName = \"PopoverDropdown\";\n\nPopover.Target = PopoverTarget;\nPopover.Dropdown = PopoverDropdown;\nPopover.displayName = \"Popover\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AA6LH,cAmGQ,YAnGR;AArFJ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