@rpcbase/ui 0.251.0 → 0.252.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist/index150.js +3 -3
  2. package/dist/index156.js +1 -1
  3. package/dist/index163.js +2 -2
  4. package/dist/index164.js +7 -7
  5. package/dist/index167.js +1 -1
  6. package/dist/index169.js +1 -1
  7. package/dist/index172.js +3 -3
  8. package/dist/index175.js +1 -1
  9. package/dist/index176.js +4 -4
  10. package/dist/index182.js +1 -1
  11. package/dist/index184.js +4 -4
  12. package/dist/index185.js +13 -13
  13. package/dist/index188.js +5 -5
  14. package/dist/index189.js +1 -1
  15. package/dist/index192.js +2 -2
  16. package/dist/index193.js +6 -6
  17. package/dist/index254.js +155 -20
  18. package/dist/index254.js.map +1 -1
  19. package/dist/index255.js +31 -65
  20. package/dist/index255.js.map +1 -1
  21. package/dist/index256.js +11 -6
  22. package/dist/index256.js.map +1 -1
  23. package/dist/index257.js +49 -5
  24. package/dist/index257.js.map +1 -1
  25. package/dist/index258.js +9 -11
  26. package/dist/index258.js.map +1 -1
  27. package/dist/index259.js +11 -3
  28. package/dist/index259.js.map +1 -1
  29. package/dist/index260.js +41 -48
  30. package/dist/index260.js.map +1 -1
  31. package/dist/index261.js +98 -4
  32. package/dist/index261.js.map +1 -1
  33. package/dist/index262.js +84 -27
  34. package/dist/index262.js.map +1 -1
  35. package/dist/index263.js +103 -14
  36. package/dist/index263.js.map +1 -1
  37. package/dist/index264.js +52 -5
  38. package/dist/index264.js.map +1 -1
  39. package/dist/index265.js +11 -21
  40. package/dist/index265.js.map +1 -1
  41. package/dist/index266.js +4 -53
  42. package/dist/index266.js.map +1 -1
  43. package/dist/index267.js +37 -20
  44. package/dist/index267.js.map +1 -1
  45. package/dist/index268.js +8 -41
  46. package/dist/index268.js.map +1 -1
  47. package/dist/index269.js +132 -36
  48. package/dist/index269.js.map +1 -1
  49. package/dist/index270.js +18 -46
  50. package/dist/index270.js.map +1 -1
  51. package/dist/index271.js +14 -19
  52. package/dist/index271.js.map +1 -1
  53. package/dist/index272.js +3 -70
  54. package/dist/index272.js.map +1 -1
  55. package/dist/index273.js +34 -15
  56. package/dist/index273.js.map +1 -1
  57. package/dist/index274.js +20 -3
  58. package/dist/index274.js.map +1 -1
  59. package/dist/index275.js +9 -11
  60. package/dist/index275.js.map +1 -1
  61. package/dist/index276.js +8 -13
  62. package/dist/index276.js.map +1 -1
  63. package/dist/index277.js +20 -19
  64. package/dist/index277.js.map +1 -1
  65. package/dist/index278.js +65 -35
  66. package/dist/index278.js.map +1 -1
  67. package/dist/index279.js +6 -239
  68. package/dist/index279.js.map +1 -1
  69. package/dist/index280.js +5 -252
  70. package/dist/index280.js.map +1 -1
  71. package/dist/index281.js +10 -67
  72. package/dist/index281.js.map +1 -1
  73. package/dist/index282.js +3 -99
  74. package/dist/index282.js.map +1 -1
  75. package/dist/index283.js +47 -80
  76. package/dist/index283.js.map +1 -1
  77. package/dist/index284.js +4 -4
  78. package/dist/index284.js.map +1 -1
  79. package/dist/index285.js +27 -27
  80. package/dist/index285.js.map +1 -1
  81. package/dist/index286.js +16 -16
  82. package/dist/index286.js.map +1 -1
  83. package/dist/index287.js +6 -35
  84. package/dist/index287.js.map +1 -1
  85. package/dist/index288.js +21 -17
  86. package/dist/index288.js.map +1 -1
  87. package/dist/index289.js +53 -3
  88. package/dist/index289.js.map +1 -1
  89. package/dist/index290.js +20 -26
  90. package/dist/index290.js.map +1 -1
  91. package/dist/index291.js +40 -27
  92. package/dist/index291.js.map +1 -1
  93. package/dist/index292.js +40 -4
  94. package/dist/index292.js.map +1 -1
  95. package/dist/index293.js +46 -79
  96. package/dist/index293.js.map +1 -1
  97. package/dist/index294.js +19 -271
  98. package/dist/index294.js.map +1 -1
  99. package/dist/index295.js +70 -11
  100. package/dist/index295.js.map +1 -1
  101. package/dist/index296.js +18 -11
  102. package/dist/index296.js.map +1 -1
  103. package/dist/index297.js +3 -25
  104. package/dist/index297.js.map +1 -1
  105. package/dist/index298.js +11 -16
  106. package/dist/index298.js.map +1 -1
  107. package/dist/index299.js +12 -124
  108. package/dist/index299.js.map +1 -1
  109. package/dist/index300.js +18 -5
  110. package/dist/index300.js.map +1 -1
  111. package/dist/index301.js +35 -64
  112. package/dist/index301.js.map +1 -1
  113. package/dist/index302.js +240 -14
  114. package/dist/index302.js.map +1 -1
  115. package/dist/index303.js +252 -7
  116. package/dist/index303.js.map +1 -1
  117. package/dist/index304.js +68 -5
  118. package/dist/index304.js.map +1 -1
  119. package/dist/index305.js +99 -3
  120. package/dist/index305.js.map +1 -1
  121. package/dist/index306.js +83 -10
  122. package/dist/index306.js.map +1 -1
  123. package/dist/index307.js +3 -7
  124. package/dist/index307.js.map +1 -1
  125. package/dist/index308.js +24 -128
  126. package/dist/index308.js.map +1 -1
  127. package/dist/index309.js +16 -399
  128. package/dist/index309.js.map +1 -1
  129. package/dist/index310.js +35 -5
  130. package/dist/index310.js.map +1 -1
  131. package/dist/index311.js +16 -51
  132. package/dist/index311.js.map +1 -1
  133. package/dist/index312.js +3 -11
  134. package/dist/index312.js.map +1 -1
  135. package/dist/index313.js +22 -23
  136. package/dist/index313.js.map +1 -1
  137. package/dist/index314.js +27 -10
  138. package/dist/index314.js.map +1 -1
  139. package/dist/index315.js +4 -33
  140. package/dist/index315.js.map +1 -1
  141. package/dist/index316.js +78 -11
  142. package/dist/index316.js.map +1 -1
  143. package/dist/index317.js +268 -45
  144. package/dist/index317.js.map +1 -1
  145. package/dist/index318.js +11 -9
  146. package/dist/index318.js.map +1 -1
  147. package/dist/index319.js +10 -11
  148. package/dist/index319.js.map +1 -1
  149. package/dist/index320.js +25 -43
  150. package/dist/index320.js.map +1 -1
  151. package/dist/index321.js +15 -96
  152. package/dist/index321.js.map +1 -1
  153. package/dist/index322.js +122 -83
  154. package/dist/index322.js.map +1 -1
  155. package/dist/index323.js +4 -104
  156. package/dist/index323.js.map +1 -1
  157. package/dist/index324.js +60 -47
  158. package/dist/index324.js.map +1 -1
  159. package/dist/index325.js +13 -11
  160. package/dist/index325.js.map +1 -1
  161. package/dist/index326.js +7 -4
  162. package/dist/index326.js.map +1 -1
  163. package/dist/index327.js +5 -37
  164. package/dist/index327.js.map +1 -1
  165. package/dist/index328.js +3 -8
  166. package/dist/index328.js.map +1 -1
  167. package/dist/index329.js +10 -154
  168. package/dist/index329.js.map +1 -1
  169. package/dist/index330.js +7 -135
  170. package/dist/index330.js.map +1 -1
  171. package/dist/index331.js +133 -17
  172. package/dist/index331.js.map +1 -1
  173. package/dist/index332.js +398 -14
  174. package/dist/index332.js.map +1 -1
  175. package/dist/index333.js +5 -4
  176. package/dist/index333.js.map +1 -1
  177. package/dist/index334.js +50 -34
  178. package/dist/index334.js.map +1 -1
  179. package/dist/index335.js +11 -20
  180. package/dist/index335.js.map +1 -1
  181. package/dist/index336.js +27 -9
  182. package/dist/index336.js.map +1 -1
  183. package/dist/index337.js +11 -8
  184. package/dist/index337.js.map +1 -1
  185. package/dist/index338.js +2 -2
  186. package/dist/index348.js +2 -2
  187. package/dist/index350.js +4 -4
  188. package/dist/index358.js +5 -5
  189. package/dist/index359.js +1 -1
  190. package/dist/index365.js +5 -4
  191. package/dist/index365.js.map +1 -1
  192. package/dist/index366.js +20 -5
  193. package/dist/index366.js.map +1 -1
  194. package/dist/index367.js +4 -3
  195. package/dist/index367.js.map +1 -1
  196. package/dist/index368.js +5 -11
  197. package/dist/index368.js.map +1 -1
  198. package/dist/index369.js +3 -21
  199. package/dist/index369.js.map +1 -1
  200. package/dist/index370.js +11 -44
  201. package/dist/index370.js.map +1 -1
  202. package/dist/index371.js +20 -17
  203. package/dist/index371.js.map +1 -1
  204. package/dist/index372.js +45 -5
  205. package/dist/index372.js.map +1 -1
  206. package/dist/index373.js +15 -198
  207. package/dist/index373.js.map +1 -1
  208. package/dist/index374.js +5 -74
  209. package/dist/index374.js.map +1 -1
  210. package/dist/index375.js +192 -115
  211. package/dist/index375.js.map +1 -1
  212. package/dist/index376.js +73 -4
  213. package/dist/index376.js.map +1 -1
  214. package/dist/index377.js +122 -19
  215. package/dist/index377.js.map +1 -1
  216. package/dist/index379.js +3 -3
  217. package/dist/index380.js +3 -3
  218. package/dist/index382.js +1 -1
  219. package/dist/index384.js +1 -1
  220. package/dist/index385.js +2 -2
  221. package/dist/index388.js +1 -1
  222. package/dist/index389.js +2 -2
  223. package/dist/index413.js +1 -1
  224. package/dist/index423.js +1 -1
  225. package/dist/index424.js +1 -1
  226. package/dist/index427.js +1 -1
  227. package/dist/index428.js +1 -1
  228. package/dist/index434.js +2 -2
  229. package/dist/index436.js +2 -2
  230. package/dist/index49.js +30 -30
  231. package/dist/index50.js +21 -21
  232. package/dist/index51.js +1 -1
  233. package/dist/index52.js +8 -8
  234. package/dist/index53.js +2 -2
  235. package/dist/index55.js +16 -16
  236. package/dist/index56.js +4 -4
  237. package/dist/index57.js +3 -3
  238. package/dist/index58.js +7 -7
  239. package/dist/index59.js +4 -4
  240. package/dist/index60.js +12 -12
  241. package/dist/index61.js +2 -2
  242. package/dist/index62.js +2 -2
  243. package/package.json +1 -1
package/dist/index274.js CHANGED
@@ -1,7 +1,24 @@
1
- function u(t, l, r = (e, n) => e === n) {
2
- return t.length === l.length && t.every((e, n) => r(e, l[n]));
1
+ import s, { isPhoneContextValid as x, PLUS_SIGN as F, RFC3966_PREFIX_ as a, RFC3966_PHONE_CONTEXT_ as d, RFC3966_ISDN_SUBADDRESS_ as m } from "./index366.js";
2
+ import v from "./index262.js";
3
+ function S(r, _) {
4
+ var f = _.extractFormattedPhoneNumber, e = s(r);
5
+ if (!x(e))
6
+ throw new v("NOT_A_NUMBER");
7
+ var t;
8
+ if (e === null)
9
+ t = f(r) || "";
10
+ else {
11
+ t = "", e.charAt(0) === F && (t += e);
12
+ var n = r.indexOf(a), o;
13
+ n >= 0 ? o = n + a.length : o = 0;
14
+ var h = r.indexOf(d);
15
+ t += r.substring(o, h);
16
+ }
17
+ var i = t.indexOf(m);
18
+ if (i > 0 && (t = t.substring(0, i)), t !== "")
19
+ return t;
3
20
  }
4
21
  export {
5
- u as areArraysEqual
22
+ S as default
6
23
  };
7
24
  //# sourceMappingURL=index274.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index274.js","sources":["../../../node_modules/@base-ui/react/internals/areArraysEqual.mjs"],"sourcesContent":["export function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {\n return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));\n}"],"names":["areArraysEqual","array1","array2","itemComparer","a","b","value","index"],"mappings":"AAAO,SAASA,EAAeC,GAAQC,GAAQC,IAAe,CAACC,GAAGC,MAAMD,MAAMC,GAAG;AAC/E,SAAOJ,EAAO,WAAWC,EAAO,UAAUD,EAAO,MAAM,CAACK,GAAOC,MAAUJ,EAAaG,GAAOJ,EAAOK,CAAK,CAAC,CAAC;AAC7G;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index274.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js"],"sourcesContent":["import extractPhoneContext, { isPhoneContextValid, PLUS_SIGN, RFC3966_PREFIX_, RFC3966_PHONE_CONTEXT_, RFC3966_ISDN_SUBADDRESS_ } from './extractPhoneContext.js';\nimport ParseError from '../ParseError.js';\n\n/**\r\n * @param {string} numberToParse\r\n * @param {string} nationalNumber\r\n * @return {}\r\n */\nexport default function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {\n var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;\n var phoneContext = extractPhoneContext(numberToParse);\n if (!isPhoneContextValid(phoneContext)) {\n throw new ParseError('NOT_A_NUMBER');\n }\n var phoneNumberString;\n if (phoneContext === null) {\n // Extract a possible number from the string passed in.\n // (this strips leading characters that could not be the start of a phone number)\n phoneNumberString = extractFormattedPhoneNumber(numberToParse) || '';\n } else {\n phoneNumberString = '';\n\n // If the phone context contains a phone number prefix, we need to capture\n // it, whereas domains will be ignored.\n if (phoneContext.charAt(0) === PLUS_SIGN) {\n phoneNumberString += phoneContext;\n }\n\n // Now append everything between the \"tel:\" prefix and the phone-context.\n // This should include the national number, an optional extension or\n // isdn-subaddress component. Note we also handle the case when \"tel:\" is\n // missing, as we have seen in some of the phone number inputs.\n // In that case, we append everything from the beginning.\n var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);\n var indexOfNationalNumber;\n // RFC 3966 \"tel:\" prefix is preset at this stage because\n // `isPhoneContextValid()` requires it to be present.\n /* istanbul ignore else */\n if (indexOfRfc3966Prefix >= 0) {\n indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;\n } else {\n indexOfNationalNumber = 0;\n }\n var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);\n phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);\n }\n\n // Delete the isdn-subaddress and everything after it if it is present.\n // Note extension won't appear at the same time with isdn-subaddress\n // according to paragraph 5.3 of the RFC3966 spec.\n var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);\n if (indexOfIsdn > 0) {\n phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);\n }\n // If both phone context and isdn-subaddress are absent but other\n // parameters are present, the parameters are left in nationalNumber.\n // This is because we are concerned about deleting content from a potential\n // number string when there is no strong evidence that the number is\n // actually written in RFC3966.\n\n if (phoneNumberString !== '') {\n return phoneNumberString;\n }\n}\n//# sourceMappingURL=extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map"],"names":["extractFormattedPhoneNumberFromPossibleRfc3966NumberUri","numberToParse","_ref","extractFormattedPhoneNumber","phoneContext","extractPhoneContext","isPhoneContextValid","ParseError","phoneNumberString","PLUS_SIGN","indexOfRfc3966Prefix","RFC3966_PREFIX_","indexOfNationalNumber","indexOfPhoneContext","RFC3966_PHONE_CONTEXT_","indexOfIsdn","RFC3966_ISDN_SUBADDRESS_"],"mappings":";;AAQe,SAASA,EAAwDC,GAAeC,GAAM;AACnG,MAAIC,IAA8BD,EAAK,6BACnCE,IAAeC,EAAoBJ,CAAa;AACpD,MAAI,CAACK,EAAoBF,CAAY;AACnC,UAAM,IAAIG,EAAW,cAAc;AAErC,MAAIC;AACJ,MAAIJ,MAAiB;AAGnB,IAAAI,IAAoBL,EAA4BF,CAAa,KAAK;AAAA,OAC7D;AACL,IAAAO,IAAoB,IAIhBJ,EAAa,OAAO,CAAC,MAAMK,MAC7BD,KAAqBJ;AAQvB,QAAIM,IAAuBT,EAAc,QAAQU,CAAe,GAC5DC;AAIJ,IAAIF,KAAwB,IAC1BE,IAAwBF,IAAuBC,EAAgB,SAE/DC,IAAwB;AAE1B,QAAIC,IAAsBZ,EAAc,QAAQa,CAAsB;AACtE,IAAAN,KAAqBP,EAAc,UAAUW,GAAuBC,CAAmB;AAAA,EACzF;AAKA,MAAIE,IAAcP,EAAkB,QAAQQ,CAAwB;AAUpE,MATID,IAAc,MAChBP,IAAoBA,EAAkB,UAAU,GAAGO,CAAW,IAQ5DP,MAAsB;AACxB,WAAOA;AAEX;","x_google_ignoreList":[0]}
package/dist/index275.js CHANGED
@@ -1,15 +1,13 @@
1
- import * as c from "react";
2
- import { useIsoLayoutEffect as o } from "./index261.js";
3
- import { useStableCallback as f } from "./index262.js";
4
- function u(r, n) {
5
- const t = c.useRef(r), e = f(n);
6
- o(() => {
7
- t.current !== r && e(t.current);
8
- }, [r, e]), o(() => {
9
- t.current = r;
10
- }, [r]);
1
+ import f from "./index163.js";
2
+ var u = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
3
+ function D(t, r, a) {
4
+ var e = new f(a);
5
+ if (e.selectNumberingPlan(t || r), e.defaultIDDPrefix())
6
+ return e.defaultIDDPrefix();
7
+ if (u.test(e.IDDPrefix()))
8
+ return e.IDDPrefix();
11
9
  }
12
10
  export {
13
- u as useValueChanged
11
+ D as default
14
12
  };
15
13
  //# sourceMappingURL=index275.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index275.js","sources":["../../../node_modules/@base-ui/react/internals/useValueChanged.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport function useValueChanged(value, onChange) {\n const valueRef = React.useRef(value);\n const onChangeCallback = useStableCallback(onChange);\n useIsoLayoutEffect(() => {\n if (valueRef.current === value) {\n return;\n }\n onChangeCallback(valueRef.current);\n }, [value, onChangeCallback]);\n useIsoLayoutEffect(() => {\n valueRef.current = value;\n }, [value]);\n}"],"names":["useValueChanged","value","onChange","valueRef","React","onChangeCallback","useStableCallback","useIsoLayoutEffect"],"mappings":";;;AAKO,SAASA,EAAgBC,GAAOC,GAAU;AAC/C,QAAMC,IAAWC,EAAM,OAAOH,CAAK,GAC7BI,IAAmBC,EAAkBJ,CAAQ;AACnD,EAAAK,EAAmB,MAAM;AACvB,IAAIJ,EAAS,YAAYF,KAGzBI,EAAiBF,EAAS,OAAO;AAAA,EACnC,GAAG,CAACF,GAAOI,CAAgB,CAAC,GAC5BE,EAAmB,MAAM;AACvB,IAAAJ,EAAS,UAAUF;AAAA,EACrB,GAAG,CAACA,CAAK,CAAC;AACZ;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index275.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js"],"sourcesContent":["import Metadata from '../metadata.js';\n\n/**\r\n * Pattern that makes it easy to distinguish whether a region has a single\r\n * international dialing prefix or not. If a region has a single international\r\n * prefix (e.g. 011 in USA), it will be represented as a string that contains\r\n * a sequence of ASCII digits, and possibly a tilde, which signals waiting for\r\n * the tone. If there are multiple available international prefixes in a\r\n * region, they will be represented as a regex string that always contains one\r\n * or more characters that are not ASCII digits or a tilde.\r\n */\nvar SINGLE_IDD_PREFIX_REG_EXP = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/;\n\n// If the `country` supports IDD calling, it returns a preferred IDD prefix.\n// If the `country` doesn't support IDD calling, it returns `undefined`.\nexport default function getIddPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country || callingCode);\n if (countryMetadata.defaultIDDPrefix()) {\n return countryMetadata.defaultIDDPrefix();\n }\n if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n}\n//# sourceMappingURL=getIddPrefix.js.map"],"names":["SINGLE_IDD_PREFIX_REG_EXP","getIddPrefix","country","callingCode","metadata","countryMetadata","Metadata"],"mappings":";AAWA,IAAIA,IAA4B;AAIjB,SAASC,EAAaC,GAASC,GAAaC,GAAU;AACnE,MAAIC,IAAkB,IAAIC,EAASF,CAAQ;AAE3C,MADAC,EAAgB,oBAAoBH,KAAWC,CAAW,GACtDE,EAAgB;AAClB,WAAOA,EAAgB,iBAAgB;AAEzC,MAAIL,EAA0B,KAAKK,EAAgB,UAAS,CAAE;AAC5D,WAAOA,EAAgB,UAAS;AAEpC;","x_google_ignoreList":[0]}
package/dist/index276.js CHANGED
@@ -1,17 +1,12 @@
1
- import { clamp as s } from "./index305.js";
2
- const f = 1;
3
- function a(n, t) {
4
- return Math.max(0, n - t);
5
- }
6
- function u(n, t) {
7
- if (t <= 0)
8
- return 0;
9
- const r = s(n, 0, t), e = r, c = t - r, o = e <= f, i = c <= f;
10
- return o && i ? e <= c ? 0 : t : o ? 0 : i ? t : r;
1
+ import { VALID_DIGITS as A } from "./index159.js";
2
+ var g = ";ext=", t = function(a) {
3
+ return "([".concat(A, "]{1,").concat(a, "})");
4
+ };
5
+ function D(x) {
6
+ var a = "20", o = "15", i = "9", F = "6", n = "[  \\t,]*", e = "[:\\..]?[  \\t,-]*", r = "#?", s = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", E = "(?:[xx##~~]|int|int)", l = "[- ]+", u = "[  \\t]*", v = "(?:,{2}|;)", b = g + t(a), m = n + s + e + t(a) + r, p = n + E + e + t(i) + r, L = l + t(F) + "#", f = u + v + e + t(o) + r, c = u + "(?:,)+" + e + t(i) + r;
7
+ return b + "|" + m + "|" + p + "|" + L + "|" + f + "|" + c;
11
8
  }
12
9
  export {
13
- f as SCROLL_EDGE_TOLERANCE_PX,
14
- a as getMaxScrollOffset,
15
- u as normalizeScrollOffset
10
+ D as default
16
11
  };
17
12
  //# sourceMappingURL=index276.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index276.js","sources":["../../../node_modules/@base-ui/react/utils/scrollEdges.mjs"],"sourcesContent":["import { clamp } from \"../internals/clamp.mjs\";\nexport const SCROLL_EDGE_TOLERANCE_PX = 1;\nexport function getMaxScrollOffset(scrollSize, clientSize) {\n return Math.max(0, scrollSize - clientSize);\n}\nexport function normalizeScrollOffset(value, max) {\n if (max <= 0) {\n return 0;\n }\n const clamped = clamp(value, 0, max);\n const startDistance = clamped;\n const endDistance = max - clamped;\n const withinStartTolerance = startDistance <= SCROLL_EDGE_TOLERANCE_PX;\n const withinEndTolerance = endDistance <= SCROLL_EDGE_TOLERANCE_PX;\n if (withinStartTolerance && withinEndTolerance) {\n return startDistance <= endDistance ? 0 : max;\n }\n if (withinStartTolerance) {\n return 0;\n }\n if (withinEndTolerance) {\n return max;\n }\n return clamped;\n}"],"names":["SCROLL_EDGE_TOLERANCE_PX","getMaxScrollOffset","scrollSize","clientSize","normalizeScrollOffset","value","max","clamped","clamp","startDistance","endDistance","withinStartTolerance","withinEndTolerance"],"mappings":";AACY,MAACA,IAA2B;AACjC,SAASC,EAAmBC,GAAYC,GAAY;AACzD,SAAO,KAAK,IAAI,GAAGD,IAAaC,CAAU;AAC5C;AACO,SAASC,EAAsBC,GAAOC,GAAK;AAChD,MAAIA,KAAO;AACT,WAAO;AAET,QAAMC,IAAUC,EAAMH,GAAO,GAAGC,CAAG,GAC7BG,IAAgBF,GAChBG,IAAcJ,IAAMC,GACpBI,IAAuBF,KAAiBT,GACxCY,IAAqBF,KAAeV;AAC1C,SAAIW,KAAwBC,IACnBH,KAAiBC,IAAc,IAAIJ,IAExCK,IACK,IAELC,IACKN,IAEFC;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index276.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js"],"sourcesContent":["import { VALID_DIGITS } from '../../constants.js';\n\n// The RFC 3966 format for extensions.\nvar RFC3966_EXTN_PREFIX = ';ext=';\n\n/**\r\n * Helper method for constructing regular expressions for parsing. Creates\r\n * an expression that captures up to max_length digits.\r\n * @return {string} RegEx pattern to capture extension digits.\r\n */\nvar getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {\n return \"([\".concat(VALID_DIGITS, \"]{1,\").concat(maxLength, \"})\");\n};\n\n/**\r\n * Helper initialiser method to create the regular-expression pattern to match\r\n * extensions.\r\n * Copy-pasted from Google's `libphonenumber`:\r\n * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766\r\n * @return {string} RegEx pattern to capture extensions.\r\n */\nexport default function createExtensionPattern(purpose) {\n // We cap the maximum length of an extension based on the ambiguity of the way\n // the extension is prefixed. As per ITU, the officially allowed length for\n // extensions is actually 40, but we don't support this since we haven't seen real\n // examples and this introduces many false interpretations as the extension labels\n // are not standardized.\n /** @type {string} */\n var extLimitAfterExplicitLabel = '20';\n /** @type {string} */\n var extLimitAfterLikelyLabel = '15';\n /** @type {string} */\n var extLimitAfterAmbiguousChar = '9';\n /** @type {string} */\n var extLimitWhenNotSure = '6';\n\n /** @type {string} */\n var possibleSeparatorsBetweenNumberAndExtLabel = \"[ \\xA0\\\\t,]*\";\n // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.\n /** @type {string} */\n var possibleCharsAfterExtLabel = \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\";\n /** @type {string} */\n var optionalExtnSuffix = \"#?\";\n\n // Here the extension is called out in more explicit way, i.e mentioning it obvious\n // patterns like \"ext.\".\n /** @type {string} */\n var explicitExtLabels = \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\\u0434\\u043E\\u0431|anexo)\";\n // One-character symbols that can be used to indicate an extension, and less\n // commonly used or more ambiguous extension labels.\n /** @type {string} */\n var ambiguousExtLabels = \"(?:[x\\uFF58#\\uFF03~\\uFF5E]|int|\\uFF49\\uFF4E\\uFF54)\";\n // When extension is not separated clearly.\n /** @type {string} */\n var ambiguousSeparator = \"[- ]+\";\n // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching\n // comma as extension label may have it.\n /** @type {string} */\n var possibleSeparatorsNumberExtLabelNoComma = \"[ \\xA0\\\\t]*\";\n // \",,\" is commonly used for auto dialling the extension when connected. First\n // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do\n // not repeat it here. Semi-colon works in Iphone and Android also to pop up a\n // button with the extension number following.\n /** @type {string} */\n var autoDiallingAndExtLabelsFound = \"(?:,{2}|;)\";\n\n /** @type {string} */\n var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);\n /** @type {string} */\n var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;\n /** @type {string} */\n var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n /** @type {string} */\n var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + \"#\";\n\n /** @type {string} */\n var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;\n /** @type {string} */\n var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + \"(?:,)+\" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n\n // The first regular expression covers RFC 3966 format, where the extension is added\n // using \";ext=\". The second more generic where extension is mentioned with explicit\n // labels like \"ext:\". In both the above cases we allow more numbers in extension than\n // any other extension labels. The third one captures when single character extension\n // labels or less commonly used labels are used. In such cases we capture fewer\n // extension digits in order to reduce the chance of falsely interpreting two\n // numbers beside each other as a number + extension. The fourth one covers the\n // special case of American numbers where the extension is written with a hash\n // at the end, such as \"- 503#\". The fifth one is exclusively for extension\n // autodialling formats which are used when dialling and in this case we accept longer\n // extensions. The last one is more liberal on the number of commas that acts as\n // extension labels, so we have a strict cap on the number of digits in such extensions.\n return rfcExtn + \"|\" + explicitExtn + \"|\" + ambiguousExtn + \"|\" + americanStyleExtnWithSuffix + \"|\" + autoDiallingExtn + \"|\" + onlyCommasExtn;\n}\n//# sourceMappingURL=createExtensionPattern.js.map"],"names":["RFC3966_EXTN_PREFIX","getExtensionDigitsPattern","maxLength","VALID_DIGITS","createExtensionPattern","purpose","extLimitAfterExplicitLabel","extLimitAfterLikelyLabel","extLimitAfterAmbiguousChar","extLimitWhenNotSure","possibleSeparatorsBetweenNumberAndExtLabel","possibleCharsAfterExtLabel","optionalExtnSuffix","explicitExtLabels","ambiguousExtLabels","ambiguousSeparator","possibleSeparatorsNumberExtLabelNoComma","autoDiallingAndExtLabelsFound","rfcExtn","explicitExtn","ambiguousExtn","americanStyleExtnWithSuffix","autoDiallingExtn","onlyCommasExtn"],"mappings":";AAGA,IAAIA,IAAsB,SAOtBC,IAA4B,SAAmCC,GAAW;AAC5E,SAAO,KAAK,OAAOC,GAAc,MAAM,EAAE,OAAOD,GAAW,IAAI;AACjE;AASe,SAASE,EAAuBC,GAAS;AAOtD,MAAIC,IAA6B,MAE7BC,IAA2B,MAE3BC,IAA6B,KAE7BC,IAAsB,KAGtBC,IAA6C,aAG7CC,IAA6B,sBAE7BC,IAAqB,MAKrBC,IAAoB,iDAIpBC,IAAqB,wBAGrBC,IAAqB,SAIrBC,IAA0C,YAM1CC,IAAgC,cAGhCC,IAAUlB,IAAsBC,EAA0BK,CAA0B,GAEpFa,IAAeT,IAA6CG,IAAoBF,IAA6BV,EAA0BK,CAA0B,IAAIM,GAErKQ,IAAgBV,IAA6CI,IAAqBH,IAA6BV,EAA0BO,CAA0B,IAAII,GAEvKS,IAA8BN,IAAqBd,EAA0BQ,CAAmB,IAAI,KAGpGa,IAAmBN,IAA0CC,IAAgCN,IAA6BV,EAA0BM,CAAwB,IAAIK,GAEhLW,IAAiBP,IAA0C,WAAWL,IAA6BV,EAA0BO,CAA0B,IAAII;AAc/J,SAAOM,IAAU,MAAMC,IAAe,MAAMC,IAAgB,MAAMC,IAA8B,MAAMC,IAAmB,MAAMC;AACjI;","x_google_ignoreList":[0]}
package/dist/index277.js CHANGED
@@ -1,22 +1,23 @@
1
- import * as c from "react";
2
- import { s as u } from "./index409.js";
3
- import { w as i } from "./index410.js";
4
- import { isReactVersionAtLeast as S } from "./index349.js";
5
- const a = S(19), m = a ? f : l;
6
- function g(t, e, r, n, o) {
7
- return m(t, e, r, n, o);
8
- }
9
- function p(t, e, r, n, o) {
10
- const s = c.useCallback(() => e(t.getSnapshot(), r, n, o), [t, e, r, n, o]);
11
- return u.useSyncExternalStore(t.subscribe, s, s);
12
- }
13
- function f(t, e, r, n, o) {
14
- return p(t, e, r, n, o);
15
- }
16
- function l(t, e, r, n, o) {
17
- return i.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getSnapshot, (s) => e(s, r, n, o));
18
- }
1
+ const i = {
2
+ clipPath: "inset(50%)",
3
+ overflow: "hidden",
4
+ whiteSpace: "nowrap",
5
+ border: 0,
6
+ padding: 0,
7
+ width: 1,
8
+ height: 1,
9
+ margin: -1
10
+ }, e = {
11
+ ...i,
12
+ position: "fixed",
13
+ top: 0,
14
+ left: 0
15
+ }, t = {
16
+ ...i,
17
+ position: "absolute"
18
+ };
19
19
  export {
20
- g as useStore
20
+ e as visuallyHidden,
21
+ t as visuallyHiddenInput
21
22
  };
22
23
  //# sourceMappingURL=index277.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index277.js","sources":["../../../node_modules/@base-ui/utils/store/useStore.mjs"],"sourcesContent":["import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}"],"names":["canUseRawUseSyncExternalStore","isReactVersionAtLeast","useStoreImplementation","useStoreFast","useStoreLegacy","useStore","store","selector","a1","a2","a3","useStoreR19","getSelection","React","useSyncExternalStore","useSyncExternalStoreWithSelector","state"],"mappings":";;;;AASA,MAAMA,IAAgCC,EAAsB,EAAE,GACxDC,IAAyBF,IAAgCG,IAAeC;AACvE,SAASC,EAASC,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AACpD,SAAOR,EAAuBI,GAAOC,GAAUC,GAAIC,GAAIC,CAAE;AAC3D;AACA,SAASC,EAAYL,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AAChD,QAAME,IAAeC,EAAM,YAAY,MAAMN,EAASD,EAAM,eAAeE,GAAIC,GAAIC,CAAE,GAAG,CAACJ,GAAOC,GAAUC,GAAIC,GAAIC,CAAE,CAAC;AACrH,SAAOI,EAAAA,qBAAqBR,EAAM,WAAWM,GAAcA,CAAY;AACzE;AAkDA,SAAST,EAAaG,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AAI/C,SAAOC,EAAYL,GAAOC,GAAUC,GAAIC,GAAIC,CAAE;AA8BlD;AACA,SAASN,EAAeE,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AACnD,SAAOK,EAAAA,iCAAiCT,EAAM,WAAWA,EAAM,aAAaA,EAAM,aAAa,CAAAU,MAAST,EAASS,GAAOR,GAAIC,GAAIC,CAAE,CAAC;AACrI;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index277.js","sources":["../../../node_modules/@base-ui/utils/visuallyHidden.mjs"],"sourcesContent":["const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};"],"names":["visuallyHiddenBase","visuallyHidden","visuallyHiddenInput"],"mappings":"AAAA,MAAMA,IAAqB;AAAA,EACzB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV,GACaC,IAAiB;AAAA,EAC5B,GAAGD;AAAA,EACH,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AACR,GACaE,IAAsB;AAAA,EACjC,GAAGF;AAAA,EACH,UAAU;AACZ;","x_google_ignoreList":[0]}
package/dist/index278.js CHANGED
@@ -1,40 +1,70 @@
1
- import { isElement as l } from "./index308.js";
2
- import { useId as c } from "./index347.js";
3
- import { useIsoLayoutEffect as a } from "./index261.js";
4
- import { useRefWithInit as m } from "./index256.js";
5
- import { useFloatingParentNodeId as u } from "./index386.js";
6
- import { FloatingRootStore as p } from "./index388.js";
7
- import { PopupTriggerMap as d } from "./index360.js";
8
- function y(s) {
9
- const {
10
- open: o = !1,
11
- onOpenChange: f,
12
- elements: e = {}
13
- } = s, r = c(), i = u() != null;
14
- if (process.env.NODE_ENV !== "production") {
15
- const n = e.reference;
16
- n && !l(n) && console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
1
+ import { useRefWithInit as r } from "./index279.js";
2
+ function b(n, e, c, t) {
3
+ const l = r(i).current;
4
+ return s(l, n, e, c, t) && o(l, [n, e, c, t]), l.callback;
5
+ }
6
+ function h(n) {
7
+ const e = r(i).current;
8
+ return f(e, n) && o(e, n), e.callback;
9
+ }
10
+ function i() {
11
+ return {
12
+ callback: null,
13
+ cleanup: null,
14
+ refs: []
15
+ };
16
+ }
17
+ function s(n, e, c, t, l) {
18
+ return n.refs[0] !== e || n.refs[1] !== c || n.refs[2] !== t || n.refs[3] !== l;
19
+ }
20
+ function f(n, e) {
21
+ return n.refs.length !== e.length || n.refs.some((c, t) => c !== e[t]);
22
+ }
23
+ function o(n, e) {
24
+ if (n.refs = e, e.every((c) => c == null)) {
25
+ n.callback = null;
26
+ return;
17
27
  }
18
- const t = m(() => new p({
19
- open: o,
20
- transitionStatus: void 0,
21
- onOpenChange: f,
22
- referenceElement: e.reference ?? null,
23
- floatingElement: e.floating ?? null,
24
- triggerElements: new d(),
25
- floatingId: r,
26
- syncOnly: !1,
27
- nested: i
28
- })).current;
29
- return a(() => {
30
- const n = {
31
- open: o,
32
- floatingId: r
33
- };
34
- e.reference !== void 0 && (n.referenceElement = e.reference, n.domReferenceElement = l(e.reference) ? e.reference : null), e.floating !== void 0 && (n.floatingElement = e.floating), t.update(n);
35
- }, [o, r, e.reference, e.floating, t]), t.context.onOpenChange = f, t.context.nested = i, t;
28
+ n.callback = (c) => {
29
+ if (n.cleanup && (n.cleanup(), n.cleanup = null), c != null) {
30
+ const t = Array(e.length).fill(null);
31
+ for (let l = 0; l < e.length; l += 1) {
32
+ const u = e[l];
33
+ if (u != null)
34
+ switch (typeof u) {
35
+ case "function": {
36
+ const a = u(c);
37
+ typeof a == "function" && (t[l] = a);
38
+ break;
39
+ }
40
+ case "object": {
41
+ u.current = c;
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ n.cleanup = () => {
47
+ for (let l = 0; l < e.length; l += 1) {
48
+ const u = e[l];
49
+ if (u != null)
50
+ switch (typeof u) {
51
+ case "function": {
52
+ const a = t[l];
53
+ typeof a == "function" ? a() : u(null);
54
+ break;
55
+ }
56
+ case "object": {
57
+ u.current = null;
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ };
63
+ }
64
+ };
36
65
  }
37
66
  export {
38
- y as useFloatingRootContext
67
+ b as useMergedRefs,
68
+ h as useMergedRefsN
39
69
  };
40
70
  //# sourceMappingURL=index278.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index278.js","sources":["../../../node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs"],"sourcesContent":["'use client';\n\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { useFloatingParentNodeId } from \"../components/FloatingTree.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange,\n elements = {}\n } = options;\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== 'production') {\n const optionDomReference = elements.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');\n }\n }\n const store = useRefWithInit(() => new FloatingRootStore({\n open,\n transitionStatus: undefined,\n onOpenChange,\n referenceElement: elements.reference ?? null,\n floatingElement: elements.floating ?? null,\n triggerElements: new PopupTriggerMap(),\n floatingId,\n syncOnly: false,\n nested\n })).current;\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId\n };\n\n // Only sync elements that are defined to avoid overwriting existing ones\n if (elements.reference !== undefined) {\n valuesToSync.referenceElement = elements.reference;\n valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;\n }\n if (elements.floating !== undefined) {\n valuesToSync.floatingElement = elements.floating;\n }\n store.update(valuesToSync);\n }, [open, floatingId, elements.reference, elements.floating, store]);\n store.context.onOpenChange = onOpenChange;\n store.context.nested = nested;\n return store;\n}"],"names":["useFloatingRootContext","options","open","onOpenChange","elements","floatingId","useId","nested","useFloatingParentNodeId","optionDomReference","isElement","store","useRefWithInit","FloatingRootStore","PopupTriggerMap","useIsoLayoutEffect","valuesToSync"],"mappings":";;;;;;;AASO,SAASA,EAAuBC,GAAS;AAC9C,QAAM;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,cAAAC;AAAA,IACA,UAAAC,IAAW,CAAA;AAAA,EACf,IAAMH,GACEI,IAAaC,EAAK,GAClBC,IAASC,EAAuB,KAAM;AAC5C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAMC,IAAqBL,EAAS;AACpC,IAAIK,KAAsB,CAACC,EAAUD,CAAkB,KACrD,QAAQ,MAAM,qEAAqE,0EAA0E,UAAU;AAAA,EAE3K;AACA,QAAME,IAAQC,EAAe,MAAM,IAAIC,EAAkB;AAAA,IACvD,MAAAX;AAAA,IACA,kBAAkB;AAAA,IAClB,cAAAC;AAAA,IACA,kBAAkBC,EAAS,aAAa;AAAA,IACxC,iBAAiBA,EAAS,YAAY;AAAA,IACtC,iBAAiB,IAAIU,EAAe;AAAA,IACpC,YAAAT;AAAA,IACA,UAAU;AAAA,IACV,QAAAE;AAAA,EACJ,CAAG,CAAC,EAAE;AACJ,SAAAQ,EAAmB,MAAM;AACvB,UAAMC,IAAe;AAAA,MACnB,MAAAd;AAAA,MACA,YAAAG;AAAA,IACN;AAGI,IAAID,EAAS,cAAc,WACzBY,EAAa,mBAAmBZ,EAAS,WACzCY,EAAa,sBAAsBN,EAAUN,EAAS,SAAS,IAAIA,EAAS,YAAY,OAEtFA,EAAS,aAAa,WACxBY,EAAa,kBAAkBZ,EAAS,WAE1CO,EAAM,OAAOK,CAAY;AAAA,EAC3B,GAAG,CAACd,GAAMG,GAAYD,EAAS,WAAWA,EAAS,UAAUO,CAAK,CAAC,GACnEA,EAAM,QAAQ,eAAeR,GAC7BQ,EAAM,QAAQ,SAASJ,GAChBI;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index278.js","sources":["../../../node_modules/@base-ui/utils/useMergedRefs.mjs"],"sourcesContent":["import { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}"],"names":["useMergedRefs","a","b","d","forkRef","useRefWithInit","createForkRef","didChange","update","useMergedRefsN","refs","didChangeN","c","newRefs","ref","index","instance","cleanupCallbacks","i","refCleanup","cleanupCallback"],"mappings":";AAUO,SAASA,EAAcC,GAAGC,GAAG,GAAGC,GAAG;AACxC,QAAMC,IAAUC,EAAeC,CAAa,EAAE;AAC9C,SAAIC,EAAUH,GAASH,GAAGC,GAAG,GAAGC,CAAC,KAC/BK,EAAOJ,GAAS,CAACH,GAAGC,GAAG,GAAGC,CAAC,CAAC,GAEvBC,EAAQ;AACjB;AAOO,SAASK,EAAeC,GAAM;AACnC,QAAMN,IAAUC,EAAeC,CAAa,EAAE;AAC9C,SAAIK,EAAWP,GAASM,CAAI,KAC1BF,EAAOJ,GAASM,CAAI,GAEfN,EAAQ;AACjB;AACA,SAASE,IAAgB;AACvB,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM,CAAA;AAAA,EACV;AACA;AACA,SAASC,EAAUH,GAASH,GAAGC,GAAGU,GAAGT,GAAG;AAEtC,SAAOC,EAAQ,KAAK,CAAC,MAAMH,KAAKG,EAAQ,KAAK,CAAC,MAAMF,KAAKE,EAAQ,KAAK,CAAC,MAAMQ,KAAKR,EAAQ,KAAK,CAAC,MAAMD;AACxG;AACA,SAASQ,EAAWP,GAASS,GAAS;AACpC,SAAOT,EAAQ,KAAK,WAAWS,EAAQ,UAAUT,EAAQ,KAAK,KAAK,CAACU,GAAKC,MAAUD,MAAQD,EAAQE,CAAK,CAAC;AAC3G;AACA,SAASP,EAAOJ,GAASM,GAAM;AAE7B,MADAN,EAAQ,OAAOM,GACXA,EAAK,MAAM,CAAAI,MAAOA,KAAO,IAAI,GAAG;AAClC,IAAAV,EAAQ,WAAW;AACnB;AAAA,EACF;AACA,EAAAA,EAAQ,WAAW,CAAAY,MAAY;AAK7B,QAJIZ,EAAQ,YACVA,EAAQ,QAAO,GACfA,EAAQ,UAAU,OAEhBY,KAAY,MAAM;AACpB,YAAMC,IAAmB,MAAMP,EAAK,MAAM,EAAE,KAAK,IAAI;AACrD,eAASQ,IAAI,GAAGA,IAAIR,EAAK,QAAQQ,KAAK,GAAG;AACvC,cAAMJ,IAAMJ,EAAKQ,CAAC;AAClB,YAAIJ,KAAO;AAGX,kBAAQ,OAAOA,GAAG;AAAA,YAChB,KAAK,YACH;AACE,oBAAMK,IAAaL,EAAIE,CAAQ;AAC/B,cAAI,OAAOG,KAAe,eACxBF,EAAiBC,CAAC,IAAIC;AAExB;AAAA,YACF;AAAA,YACF,KAAK,UACH;AACE,cAAAL,EAAI,UAAUE;AACd;AAAA,YACF;AAAA,UAEZ;AAAA,MACM;AACA,MAAAZ,EAAQ,UAAU,MAAM;AACtB,iBAASc,IAAI,GAAGA,IAAIR,EAAK,QAAQQ,KAAK,GAAG;AACvC,gBAAMJ,IAAMJ,EAAKQ,CAAC;AAClB,cAAIJ,KAAO;AAGX,oBAAQ,OAAOA,GAAG;AAAA,cAChB,KAAK,YACH;AACE,sBAAMM,IAAkBH,EAAiBC,CAAC;AAC1C,gBAAI,OAAOE,KAAoB,aAC7BA,EAAe,IAEfN,EAAI,IAAI;AAEV;AAAA,cACF;AAAA,cACF,KAAK,UACH;AACE,gBAAAA,EAAI,UAAU;AACd;AAAA,cACF;AAAA,YAEd;AAAA,QACQ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","x_google_ignoreList":[0]}
package/dist/index279.js CHANGED
@@ -1,243 +1,10 @@
1
- import * as l from "react";
2
- import { addEventListener as i } from "./index300.js";
3
- import { mergeCleanups as G } from "./index378.js";
4
- import { ownerDocument as fe } from "./index284.js";
5
- import { useStableCallback as p } from "./index262.js";
6
- import { useTimeout as de, Timeout as pe } from "./index285.js";
7
- import { isElement as _, isShadowRoot as Be, isLastTraversableNode as J, getParentNode as ve, isHTMLElement as Ae, getComputedStyle as He } from "./index308.js";
8
- import { useFloatingTree as Ne } from "./index386.js";
9
- import { createChangeEventDetails as Q } from "./index175.js";
10
- import { createAttribute as Le } from "./index383.js";
11
- import { isEventTargetWithin as Z, isRootElement as Fe } from "./index290.js";
12
- import { isReactEvent as $e } from "./index313.js";
13
- import { getNodeChildren as me } from "./index381.js";
14
- import { getTarget as z, contains as B } from "./index291.js";
15
- import { triggerPress as qe, escapeKey as Ve, outsidePress as Ue } from "./index177.js";
16
- import { webkit as je } from "./index310.js";
17
- function Ge() {
18
- return !1;
19
- }
20
- function Je(f) {
21
- return {
22
- escapeKey: typeof f == "boolean" ? f : f?.escapeKey ?? !1,
23
- outsidePress: typeof f == "boolean" ? f : f?.outsidePress ?? !0
24
- };
25
- }
26
- function dt(f, he = {}) {
27
- const {
28
- enabled: m = !0,
29
- escapeKey: v = !0,
30
- outsidePress: I = !0,
31
- outsidePressEvent: ge = "sloppy",
32
- referencePress: ye = Ge,
33
- bubbles: Pe,
34
- externalTree: Ee
35
- } = he, n = "rootStore" in f ? f.rootStore : f, C = n.useState("open"), ee = n.useState("floatingElement"), {
36
- dataRef: h
37
- } = n.context, S = Ne(Ee), Te = p(typeof I == "function" ? I : () => !1), y = typeof I == "function" ? Te : I, te = y !== !1, re = p(() => ge), {
38
- escapeKey: K,
39
- outsidePress: ne
40
- } = Je(Pe), O = l.useRef(!1), X = l.useRef(!1), P = l.useRef(!1), A = l.useRef(!1), H = l.useRef(""), s = l.useRef(null), D = de(), se = de(), g = p(() => {
41
- se.clear(), h.current.insideReactTree = !1;
42
- }), N = p((r) => {
43
- const a = h.current.floatingContext?.nodeId;
44
- return (S ? me(S.nodesRef.current, a) : []).some((x) => x.context?.open && !x.context.dataRef.current[r]);
45
- }), E = p((r) => Z(r, n.select("floatingElement")) || Z(r, n.select("domReferenceElement"))), L = p((r) => {
46
- ye() && n.setOpen(!1, Q(qe, r.nativeEvent));
47
- }), b = p((r) => {
48
- if (!C || !m || !v || r.key !== "Escape" || A.current || !K && N("__escapeKeyBubbles"))
49
- return;
50
- const a = $e(r) ? r.nativeEvent : r, w = Q(Ve, a);
51
- n.setOpen(!1, w), w.isCanceled || r.preventDefault(), !K && !w.isPropagationAllowed && r.stopPropagation();
52
- }), T = p(() => {
53
- h.current.insideReactTree = !0, se.start(0, g);
54
- }), F = p((r) => {
55
- if (!C || !m || r.button !== 0)
56
- return;
57
- const a = z(r.nativeEvent);
58
- B(n.select("floatingElement"), a) && (O.current || (O.current = !0, X.current = !1));
59
- }), $ = p((r) => {
60
- !C || !m || (r.defaultPrevented || r.nativeEvent.defaultPrevented) && O.current && (X.current = !0);
61
- });
62
- l.useEffect(() => {
63
- if (!C || !m)
64
- return;
65
- h.current.__escapeKeyBubbles = K, h.current.__outsidePressBubbles = ne;
66
- const r = new pe(), a = new pe();
67
- function w() {
68
- r.clear(), A.current = !0;
69
- }
70
- function x() {
71
- r.start(
72
- // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
73
- // Only apply to WebKit for the test to remain 0ms.
74
- je ? 5 : 0,
75
- () => {
76
- A.current = !1;
77
- }
78
- );
79
- }
80
- function ce() {
81
- P.current = !0, a.start(0, () => {
82
- P.current = !1;
83
- });
84
- }
85
- function ie() {
86
- O.current = !1, X.current = !1;
87
- }
88
- function R() {
89
- const e = H.current, t = e === "pen" || !e ? "mouse" : e, o = re(), c = typeof o == "function" ? o() : o;
90
- return typeof c == "string" ? c : c[t];
91
- }
92
- function Re(e) {
93
- const t = R();
94
- return t === "intentional" && e.type !== "click" || t === "sloppy" && e.type === "click";
95
- }
96
- function ue(e) {
97
- const t = h.current.floatingContext?.nodeId, o = S && me(S.nodesRef.current, t).some((c) => Z(e, c.context?.elements.floating));
98
- return E(e) || o;
99
- }
100
- function W(e) {
101
- if (Re(e)) {
102
- e.type !== "click" && !E(e) && (a.clear(), P.current = !1), g();
103
- return;
104
- }
105
- if (h.current.insideReactTree) {
106
- g();
107
- return;
108
- }
109
- const t = z(e), o = `[${Le("inert")}]`, c = _(t) ? t.getRootNode() : null, k = Array.from((Be(c) ? c : fe(n.select("floatingElement"))).querySelectorAll(o)), ae = n.context.triggerElements;
110
- if (t && (ae.hasElement(t) || ae.hasMatchingElement((d) => B(d, t))))
111
- return;
112
- let M = _(t) ? t : null;
113
- for (; M && !J(M); ) {
114
- const d = ve(M);
115
- if (J(d) || !_(d))
116
- break;
117
- M = d;
118
- }
119
- if (!(k.length && _(t) && !Fe(t) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
120
- !B(t, n.select("floatingElement")) && // If the target root element contains none of the markers, then the
121
- // element was injected after the floating element rendered.
122
- k.every((d) => !B(M, d)))) {
123
- if (Ae(t) && !("touches" in e)) {
124
- const d = J(t), j = He(t), le = /auto|scroll/, Ie = d || le.test(j.overflowX), Ke = d || le.test(j.overflowY), Xe = Ie && t.clientWidth > 0 && t.scrollWidth > t.clientWidth, xe = Ke && t.clientHeight > 0 && t.scrollHeight > t.clientHeight, We = j.direction === "rtl", Ye = xe && (We ? e.offsetX <= t.offsetWidth - t.clientWidth : e.offsetX > t.clientWidth), _e = Xe && e.offsetY > t.clientHeight;
125
- if (Ye || _e)
126
- return;
127
- }
128
- if (!ue(e)) {
129
- if (R() === "intentional" && P.current) {
130
- a.clear(), P.current = !1;
131
- return;
132
- }
133
- typeof y == "function" && !y(e) || N("__outsidePressBubbles") || (n.setOpen(!1, Q(Ue, e)), g());
134
- }
135
- }
136
- }
137
- function be(e) {
138
- R() !== "sloppy" || e.pointerType === "touch" || !n.select("open") || !m || E(e) || W(e);
139
- }
140
- function we(e) {
141
- if (R() !== "sloppy" || !n.select("open") || !m || E(e))
142
- return;
143
- const t = e.touches[0];
144
- t && (s.current = {
145
- startTime: Date.now(),
146
- startX: t.clientX,
147
- startY: t.clientY,
148
- dismissOnTouchEnd: !1,
149
- dismissOnMouseDown: !0
150
- }, D.start(1e3, () => {
151
- s.current && (s.current.dismissOnTouchEnd = !1, s.current.dismissOnMouseDown = !1);
152
- }));
153
- }
154
- function Y(e, t) {
155
- const o = z(e);
156
- if (!o)
157
- return;
158
- const c = i(o, e.type, () => {
159
- t(e), c();
160
- });
161
- }
162
- function Ce(e) {
163
- H.current = "touch", Y(e, we);
164
- }
165
- function V(e) {
166
- D.clear(), e.type === "pointerdown" && (H.current = e.pointerType), !(e.type === "mousedown" && s.current && !s.current.dismissOnMouseDown) && Y(e, (t) => {
167
- t.type === "pointerdown" ? be(t) : W(t);
168
- });
169
- }
170
- function U(e) {
171
- if (!O.current)
172
- return;
173
- const t = X.current;
174
- if (ie(), R() === "intentional") {
175
- if (e.type === "pointercancel") {
176
- t && ce();
177
- return;
178
- }
179
- if (!ue(e)) {
180
- if (t) {
181
- ce();
182
- return;
183
- }
184
- typeof y == "function" && !y(e) || (a.clear(), P.current = !0, g());
185
- }
186
- }
187
- }
188
- function Se(e) {
189
- if (R() !== "sloppy" || !s.current || E(e))
190
- return;
191
- const t = e.touches[0];
192
- if (!t)
193
- return;
194
- const o = Math.abs(t.clientX - s.current.startX), c = Math.abs(t.clientY - s.current.startY), k = Math.sqrt(o * o + c * c);
195
- k > 5 && (s.current.dismissOnTouchEnd = !0), k > 10 && (W(e), D.clear(), s.current = null);
196
- }
197
- function Oe(e) {
198
- Y(e, Se);
199
- }
200
- function De(e) {
201
- R() !== "sloppy" || !s.current || E(e) || (s.current.dismissOnTouchEnd && W(e), D.clear(), s.current = null);
202
- }
203
- function ke(e) {
204
- Y(e, De);
205
- }
206
- const u = fe(ee), Me = G(v && G(i(u, "keydown", b), i(u, "compositionstart", w), i(u, "compositionend", x)), te && G(i(u, "click", V, !0), i(u, "pointerdown", V, !0), i(u, "pointerup", U, !0), i(u, "pointercancel", U, !0), i(u, "mousedown", V, !0), i(u, "mouseup", U, !0), i(u, "touchstart", Ce, !0), i(u, "touchmove", Oe, !0), i(u, "touchend", ke, !0)));
207
- return () => {
208
- Me(), r.clear(), a.clear(), ie(), P.current = !1;
209
- };
210
- }, [h, ee, v, te, y, C, m, K, ne, b, g, re, N, E, S, n, D]), l.useEffect(g, [y, g]);
211
- const q = l.useMemo(() => ({
212
- onKeyDown: b,
213
- onPointerDown: L,
214
- onClick: L
215
- }), [b, L]), oe = l.useMemo(() => ({
216
- onKeyDown: b,
217
- // `onMouseDown` may be blocked if `event.preventDefault()` is called in
218
- // `onPointerDown`, such as with <NumberField.ScrubArea>.
219
- // See https://github.com/mui/base-ui/pull/3379
220
- onPointerDown: $,
221
- onMouseDown: $,
222
- onClickCapture: T,
223
- onMouseDownCapture(r) {
224
- T(), F(r);
225
- },
226
- onPointerDownCapture(r) {
227
- T(), F(r);
228
- },
229
- onMouseUpCapture: T,
230
- onTouchEndCapture: T,
231
- onTouchMoveCapture: T
232
- }), [b, T, F, $]);
233
- return l.useMemo(() => m ? {
234
- reference: q,
235
- floating: oe,
236
- trigger: q
237
- } : {}, [m, q, oe]);
1
+ import * as c from "react";
2
+ const e = {};
3
+ function f(r, n) {
4
+ const t = c.useRef(e);
5
+ return t.current === e && (t.current = r(n)), t;
238
6
  }
239
7
  export {
240
- Je as normalizeProp,
241
- dt as useDismiss
8
+ f as useRefWithInit
242
9
  };
243
10
  //# sourceMappingURL=index279.js.map