@alfalab/core-components-select 14.3.5 → 15.0.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 (416) hide show
  1. package/Component.desktop.d.ts +19 -0
  2. package/{Component.js → Component.desktop.js} +6 -6
  3. package/Component.mobile-ebda875c.d.ts +6 -0
  4. package/Component.mobile-f1f15074.d.ts +387 -0
  5. package/Component.mobile.d.ts +41 -0
  6. package/Component.mobile.js +62 -0
  7. package/Component.modal.mobile.d.ts +60 -0
  8. package/Component.modal.mobile.js +62 -0
  9. package/Component.responsive.d.ts +1 -1
  10. package/Component.responsive.js +26 -25
  11. package/components/arrow/Component.js +1 -1
  12. package/components/arrow/index.css +3 -3
  13. package/components/base-checkmark/Component.js +1 -1
  14. package/components/base-checkmark/index.css +4 -4
  15. package/components/base-option/Component.js +1 -1
  16. package/components/base-option/index.css +13 -13
  17. package/components/base-select/Component.js +6 -6
  18. package/components/base-select/index.css +8 -8
  19. package/components/base-select/index.js +1 -1
  20. package/components/base-select-mobile/Component.d.ts +3 -3
  21. package/components/base-select-mobile/Component.js +13 -9
  22. package/components/base-select-mobile/footer/Component.js +4 -4
  23. package/components/base-select-mobile/footer/index.css +5 -5
  24. package/components/base-select-mobile/footer/index.js +1 -1
  25. package/components/base-select-mobile/index.css +13 -11
  26. package/components/base-select-mobile/index.js +1 -2
  27. package/components/checkmark/Component.js +1 -1
  28. package/components/checkmark/index.css +10 -10
  29. package/components/checkmark-mobile/Component.js +1 -1
  30. package/components/checkmark-mobile/index.css +6 -6
  31. package/components/field/Component.d.ts +8 -1
  32. package/components/field/Component.js +19 -16
  33. package/components/field/index.css +38 -11
  34. package/components/field/index.js +0 -1
  35. package/components/index.d.ts +0 -2
  36. package/components/index.js +4 -19
  37. package/components/optgroup/Component.js +1 -1
  38. package/components/optgroup/index.css +6 -6
  39. package/components/option/Component.js +1 -1
  40. package/components/option/index.css +20 -20
  41. package/components/options-list/Component.js +1 -1
  42. package/components/options-list/index.css +9 -9
  43. package/components/virtual-options-list/Component.js +1 -1
  44. package/components/virtual-options-list/index.css +15 -15
  45. package/cssm/Component.desktop.d.ts +19 -0
  46. package/cssm/{Component.js → Component.desktop.js} +6 -6
  47. package/cssm/Component.mobile-ebda875c.d.ts +6 -0
  48. package/cssm/Component.mobile-f1f15074.d.ts +387 -0
  49. package/cssm/Component.mobile.d.ts +41 -0
  50. package/cssm/Component.mobile.js +74 -0
  51. package/cssm/Component.modal.mobile.d.ts +60 -0
  52. package/cssm/Component.modal.mobile.js +74 -0
  53. package/cssm/Component.responsive.d.ts +1 -1
  54. package/cssm/Component.responsive.js +30 -33
  55. package/cssm/components/base-select/Component.js +5 -5
  56. package/cssm/components/base-select/index.js +1 -1
  57. package/cssm/components/base-select-mobile/Component.d.ts +3 -3
  58. package/cssm/components/base-select-mobile/Component.js +12 -8
  59. package/cssm/components/base-select-mobile/footer/Component.js +3 -3
  60. package/cssm/components/base-select-mobile/footer/index.js +1 -1
  61. package/cssm/components/base-select-mobile/index.js +1 -2
  62. package/cssm/components/base-select-mobile/index.module.css +4 -2
  63. package/cssm/components/field/Component.d.ts +8 -1
  64. package/cssm/components/field/Component.js +18 -15
  65. package/cssm/components/field/index.js +0 -1
  66. package/cssm/components/field/index.module.css +31 -4
  67. package/cssm/components/index.d.ts +0 -2
  68. package/cssm/components/index.js +7 -28
  69. package/cssm/desktop-63dec22f.d.ts +6 -0
  70. package/cssm/desktop.d.ts +2 -0
  71. package/cssm/desktop.js +44 -0
  72. package/cssm/hook-97e6e688.d.ts +16 -0
  73. package/cssm/hook-97e6e688.js +110 -0
  74. package/{esm/hook-b4e70cb0.d.ts → cssm/hook-9ea9e32c.d.ts} +9 -7
  75. package/cssm/index-ebda875c.d.ts +20 -60
  76. package/cssm/index.d.ts +2 -5
  77. package/cssm/index.js +34 -61
  78. package/cssm/mobile-96988a65.d.ts +2 -0
  79. package/cssm/mobile.d.ts +5 -4
  80. package/cssm/mobile.js +15 -24
  81. package/cssm/presets/index.d.ts +1 -1
  82. package/cssm/presets/index.js +8 -36
  83. package/cssm/presets/useLazyLoading/hook.js +900 -4
  84. package/cssm/presets/useSelectWithApply/hook.js +9 -48
  85. package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -42
  86. package/cssm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +3 -3
  87. package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  88. package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +10 -49
  89. package/cssm/shared.d.ts +5 -0
  90. package/cssm/shared.js +77 -0
  91. package/cssm/typings-9211a437.d.ts +95 -0
  92. package/cssm/typings-baf4875b.d.ts +52 -0
  93. package/desktop-63dec22f.d.ts +6 -0
  94. package/desktop.d.ts +2 -0
  95. package/{responsive.js → desktop.js} +5 -19
  96. package/esm/Component.desktop.d.ts +19 -0
  97. package/esm/{Component.js → Component.desktop.js} +6 -6
  98. package/esm/Component.mobile-ebda875c.d.ts +6 -0
  99. package/esm/Component.mobile-f1f15074.d.ts +387 -0
  100. package/esm/Component.mobile.d.ts +41 -0
  101. package/esm/Component.mobile.js +54 -0
  102. package/esm/Component.modal.mobile.d.ts +60 -0
  103. package/esm/Component.modal.mobile.js +54 -0
  104. package/esm/Component.responsive.d.ts +1 -1
  105. package/esm/Component.responsive.js +26 -25
  106. package/esm/components/arrow/Component.js +1 -1
  107. package/esm/components/arrow/index.css +3 -3
  108. package/esm/components/base-checkmark/Component.js +1 -1
  109. package/esm/components/base-checkmark/index.css +4 -4
  110. package/esm/components/base-option/Component.js +1 -1
  111. package/esm/components/base-option/index.css +13 -13
  112. package/esm/components/base-select/Component.js +2 -2
  113. package/esm/components/base-select/index.css +8 -8
  114. package/esm/components/base-select/index.js +1 -1
  115. package/esm/components/base-select-mobile/Component.d.ts +3 -3
  116. package/esm/components/base-select-mobile/Component.js +9 -5
  117. package/esm/components/base-select-mobile/footer/Component.js +4 -4
  118. package/esm/components/base-select-mobile/footer/index.css +5 -5
  119. package/esm/components/base-select-mobile/footer/index.js +1 -1
  120. package/esm/components/base-select-mobile/index.css +13 -11
  121. package/esm/components/base-select-mobile/index.js +1 -2
  122. package/esm/components/checkmark/Component.js +1 -1
  123. package/esm/components/checkmark/index.css +10 -10
  124. package/esm/components/checkmark-mobile/Component.js +1 -1
  125. package/esm/components/checkmark-mobile/index.css +6 -6
  126. package/esm/components/field/Component.d.ts +8 -1
  127. package/esm/components/field/Component.js +19 -16
  128. package/esm/components/field/index.css +38 -11
  129. package/esm/components/field/index.js +0 -1
  130. package/esm/components/index.d.ts +0 -2
  131. package/esm/components/index.js +4 -17
  132. package/esm/components/optgroup/Component.js +1 -1
  133. package/esm/components/optgroup/index.css +6 -6
  134. package/esm/components/option/Component.js +1 -1
  135. package/esm/components/option/index.css +20 -20
  136. package/esm/components/options-list/Component.js +1 -1
  137. package/esm/components/options-list/index.css +9 -9
  138. package/esm/components/virtual-options-list/Component.js +1 -1
  139. package/esm/components/virtual-options-list/index.css +15 -15
  140. package/esm/desktop-63dec22f.d.ts +6 -0
  141. package/esm/desktop.d.ts +2 -0
  142. package/esm/{responsive.js → desktop.js} +4 -18
  143. package/esm/hook-326a5cea.d.ts +16 -0
  144. package/esm/hook-326a5cea.js +102 -0
  145. package/{cssm/hook-b4e70cb0.d.ts → esm/hook-9ea9e32c.d.ts} +9 -7
  146. package/esm/index-ebda875c.d.ts +20 -60
  147. package/esm/index.d.ts +2 -5
  148. package/esm/index.js +27 -29
  149. package/esm/mobile-96988a65.d.ts +2 -0
  150. package/esm/mobile.d.ts +5 -4
  151. package/esm/mobile.js +12 -16
  152. package/esm/presets/index.d.ts +1 -1
  153. package/esm/presets/index.js +6 -25
  154. package/esm/presets/useLazyLoading/hook.js +899 -4
  155. package/esm/presets/useSelectWithApply/hook.js +7 -33
  156. package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
  157. package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
  158. package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  159. package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  160. package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  161. package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  162. package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
  163. package/esm/presets/useSelectWithLoading/hook.js +1 -1
  164. package/esm/presets/useSelectWithLoading/index.css +2 -2
  165. package/esm/shared.d.ts +5 -0
  166. package/esm/shared.js +37 -0
  167. package/esm/typings-9211a437.d.ts +95 -0
  168. package/esm/typings-baf4875b.d.ts +52 -0
  169. package/hook-6e94be9c.d.ts +16 -0
  170. package/hook-6e94be9c.js +110 -0
  171. package/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +9 -7
  172. package/index-ebda875c.d.ts +20 -60
  173. package/index.d.ts +2 -5
  174. package/index.js +28 -51
  175. package/mobile-96988a65.d.ts +2 -0
  176. package/mobile.d.ts +5 -4
  177. package/mobile.js +14 -18
  178. package/modern/Component.desktop.d.ts +19 -0
  179. package/modern/{Component.js → Component.desktop.js} +7 -4
  180. package/modern/Component.mobile-ebda875c.d.ts +6 -0
  181. package/modern/Component.mobile-f1f15074.d.ts +387 -0
  182. package/modern/Component.mobile.d.ts +41 -0
  183. package/modern/Component.mobile.js +61 -0
  184. package/modern/Component.modal.mobile.d.ts +60 -0
  185. package/modern/Component.modal.mobile.js +61 -0
  186. package/modern/Component.responsive.d.ts +1 -1
  187. package/modern/Component.responsive.js +26 -25
  188. package/modern/components/arrow/Component.js +1 -1
  189. package/modern/components/arrow/index.css +3 -3
  190. package/modern/components/base-checkmark/Component.js +1 -1
  191. package/modern/components/base-checkmark/index.css +4 -4
  192. package/modern/components/base-option/Component.js +1 -1
  193. package/modern/components/base-option/index.css +13 -13
  194. package/modern/components/base-select/Component.js +2 -2
  195. package/modern/components/base-select/index.css +8 -8
  196. package/modern/components/base-select/index.js +1 -1
  197. package/modern/components/base-select-mobile/Component.d.ts +3 -3
  198. package/modern/components/base-select-mobile/Component.js +9 -5
  199. package/modern/components/base-select-mobile/footer/Component.js +4 -4
  200. package/modern/components/base-select-mobile/footer/index.css +5 -5
  201. package/modern/components/base-select-mobile/footer/index.js +1 -1
  202. package/modern/components/base-select-mobile/index.css +13 -11
  203. package/modern/components/base-select-mobile/index.js +1 -2
  204. package/modern/components/checkmark/Component.js +1 -1
  205. package/modern/components/checkmark/index.css +10 -10
  206. package/modern/components/checkmark-mobile/Component.js +1 -1
  207. package/modern/components/checkmark-mobile/index.css +6 -6
  208. package/modern/components/field/Component.d.ts +8 -1
  209. package/modern/components/field/Component.js +17 -14
  210. package/modern/components/field/index.css +38 -11
  211. package/modern/components/field/index.js +0 -1
  212. package/modern/components/index.d.ts +0 -2
  213. package/modern/components/index.js +4 -17
  214. package/modern/components/optgroup/Component.js +1 -1
  215. package/modern/components/optgroup/index.css +6 -6
  216. package/modern/components/option/Component.js +1 -1
  217. package/modern/components/option/index.css +20 -20
  218. package/modern/components/options-list/Component.js +1 -1
  219. package/modern/components/options-list/index.css +9 -9
  220. package/modern/components/virtual-options-list/Component.js +1 -1
  221. package/modern/components/virtual-options-list/index.css +15 -15
  222. package/modern/desktop-63dec22f.d.ts +6 -0
  223. package/modern/desktop.d.ts +2 -0
  224. package/modern/{responsive.js → desktop.js} +4 -18
  225. package/modern/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +9 -7
  226. package/modern/hook-e0fd0350.d.ts +16 -0
  227. package/modern/{Component-5c16a908.js → hook-e0fd0350.js} +3 -66
  228. package/modern/index-ebda875c.d.ts +20 -60
  229. package/modern/index.d.ts +2 -5
  230. package/modern/index.js +27 -29
  231. package/modern/mobile-96988a65.d.ts +2 -0
  232. package/modern/mobile.d.ts +5 -4
  233. package/modern/mobile.js +12 -16
  234. package/modern/presets/index.d.ts +1 -1
  235. package/modern/presets/index.js +6 -25
  236. package/modern/presets/useLazyLoading/hook.js +899 -4
  237. package/modern/presets/useSelectWithApply/hook.js +7 -33
  238. package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
  239. package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
  240. package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  241. package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  242. package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  243. package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  244. package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
  245. package/modern/presets/useSelectWithLoading/hook.js +1 -1
  246. package/modern/presets/useSelectWithLoading/index.css +2 -2
  247. package/modern/shared.d.ts +5 -0
  248. package/modern/shared.js +36 -0
  249. package/modern/typings-9211a437.d.ts +95 -0
  250. package/modern/typings-baf4875b.d.ts +52 -0
  251. package/package.json +37 -12
  252. package/presets/index.d.ts +1 -1
  253. package/presets/index.js +6 -25
  254. package/presets/useLazyLoading/hook.js +899 -4
  255. package/presets/useSelectWithApply/hook.js +7 -33
  256. package/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
  257. package/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
  258. package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  259. package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  260. package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  261. package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  262. package/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
  263. package/presets/useSelectWithLoading/hook.js +1 -1
  264. package/presets/useSelectWithLoading/index.css +2 -2
  265. package/shared.d.ts +5 -0
  266. package/shared.js +63 -0
  267. package/src/Component.desktop.tsx +52 -0
  268. package/src/Component.mobile.tsx +149 -0
  269. package/src/Component.modal.mobile.tsx +144 -0
  270. package/src/Component.responsive.tsx +59 -0
  271. package/src/components/arrow/Component.tsx +12 -0
  272. package/src/components/arrow/index.module.css +15 -0
  273. package/src/components/arrow/index.ts +1 -0
  274. package/src/components/base-checkmark/Component.tsx +33 -0
  275. package/src/components/base-checkmark/index.module.css +18 -0
  276. package/src/components/base-checkmark/index.ts +1 -0
  277. package/src/components/base-option/Component.tsx +57 -0
  278. package/src/components/base-option/index.module.css +67 -0
  279. package/src/components/base-option/index.ts +1 -0
  280. package/src/components/base-select/Component.tsx +478 -0
  281. package/src/components/base-select/index.module.css +68 -0
  282. package/src/components/base-select/index.ts +1 -0
  283. package/src/components/base-select-mobile/Component.tsx +486 -0
  284. package/src/components/base-select-mobile/footer/Component.tsx +46 -0
  285. package/src/components/base-select-mobile/footer/index.module.css +23 -0
  286. package/src/components/base-select-mobile/footer/index.ts +1 -0
  287. package/src/components/base-select-mobile/index.module.css +48 -0
  288. package/src/components/base-select-mobile/index.ts +1 -0
  289. package/src/components/checkmark/Component.tsx +56 -0
  290. package/src/components/checkmark/index.module.css +48 -0
  291. package/src/components/checkmark/index.ts +1 -0
  292. package/src/components/checkmark-mobile/Component.tsx +18 -0
  293. package/src/components/checkmark-mobile/index.module.css +28 -0
  294. package/src/components/checkmark-mobile/index.ts +1 -0
  295. package/src/components/field/Component.tsx +110 -0
  296. package/src/components/field/index.module.css +60 -0
  297. package/src/components/field/index.ts +1 -0
  298. package/src/components/index.ts +8 -0
  299. package/src/components/native-select/Component.tsx +60 -0
  300. package/src/components/native-select/index.ts +1 -0
  301. package/src/components/optgroup/Component.tsx +15 -0
  302. package/src/components/optgroup/index.module.css +30 -0
  303. package/src/components/optgroup/index.ts +1 -0
  304. package/src/components/option/Component.tsx +65 -0
  305. package/src/components/option/index.module.css +108 -0
  306. package/src/components/option/index.ts +1 -0
  307. package/src/components/options-list/Component.tsx +140 -0
  308. package/src/components/options-list/index.module.css +40 -0
  309. package/src/components/options-list/index.ts +1 -0
  310. package/src/components/virtual-options-list/Component.tsx +217 -0
  311. package/src/components/virtual-options-list/index.module.css +76 -0
  312. package/src/components/virtual-options-list/index.ts +1 -0
  313. package/src/consts.ts +1 -0
  314. package/src/desktop.ts +1 -0
  315. package/src/index.ts +4 -0
  316. package/src/mobile.ts +5 -0
  317. package/src/presets/index.ts +3 -0
  318. package/src/presets/useLazyLoading/hook.tsx +309 -0
  319. package/src/presets/useSelectWithApply/hook.tsx +154 -0
  320. package/src/presets/useSelectWithApply/options-list-with-apply/Component.tsx +106 -0
  321. package/src/presets/useSelectWithApply/options-list-with-apply/footer/Component.tsx +37 -0
  322. package/src/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css +11 -0
  323. package/src/presets/useSelectWithApply/options-list-with-apply/header/Component.tsx +26 -0
  324. package/src/presets/useSelectWithApply/options-list-with-apply/header/index.module.css +9 -0
  325. package/src/presets/useSelectWithApply/options-list-with-apply/index.ts +1 -0
  326. package/src/presets/useSelectWithLoading/hook.tsx +40 -0
  327. package/src/shared.ts +5 -0
  328. package/src/typings.ts +691 -0
  329. package/src/utils.ts +154 -0
  330. package/src/vars.css +57 -0
  331. package/typings-9211a437.d.ts +95 -0
  332. package/typings-baf4875b.d.ts +52 -0
  333. package/Component-1e06de61.d.ts +0 -108
  334. package/Component-1e06de61.js +0 -165
  335. package/Component-3885b0d7.d.ts +0 -169
  336. package/Component.d.ts +0 -104
  337. package/Component.mobile-b2c0420d.d.ts +0 -93
  338. package/components/select-mobile/Component.d.ts +0 -0
  339. package/components/select-mobile/Component.js +0 -49
  340. package/components/select-mobile/index.d.ts +0 -1
  341. package/components/select-mobile/index.js +0 -49
  342. package/components/select-modal-mobile/Component.d.ts +0 -0
  343. package/components/select-modal-mobile/Component.js +0 -49
  344. package/components/select-modal-mobile/index.d.ts +0 -1
  345. package/components/select-modal-mobile/index.js +0 -49
  346. package/cssm/Component-3885b0d7.d.ts +0 -169
  347. package/cssm/Component-4727d474.d.ts +0 -108
  348. package/cssm/Component-4727d474.js +0 -175
  349. package/cssm/Component.d.ts +0 -104
  350. package/cssm/Component.mobile-b2c0420d.d.ts +0 -93
  351. package/cssm/components/select-mobile/Component.d.ts +0 -0
  352. package/cssm/components/select-mobile/Component.js +0 -66
  353. package/cssm/components/select-mobile/index.d.ts +0 -1
  354. package/cssm/components/select-mobile/index.js +0 -66
  355. package/cssm/components/select-modal-mobile/Component.d.ts +0 -0
  356. package/cssm/components/select-modal-mobile/Component.js +0 -66
  357. package/cssm/components/select-modal-mobile/index.d.ts +0 -1
  358. package/cssm/components/select-modal-mobile/index.js +0 -66
  359. package/cssm/getDataTestId-5c876d98.d.ts +0 -2
  360. package/cssm/getDataTestId-5c876d98.js +0 -8
  361. package/cssm/index-3885b0d7.d.ts +0 -3
  362. package/cssm/intersection-observer-9ec5cf59.d.ts +0 -1
  363. package/cssm/intersection-observer-9ec5cf59.js +0 -893
  364. package/cssm/responsive.d.ts +0 -2
  365. package/cssm/responsive.js +0 -67
  366. package/cssm/types-ebda875c.d.ts +0 -113
  367. package/esm/Component-16af9d1e.d.ts +0 -108
  368. package/esm/Component-16af9d1e.js +0 -155
  369. package/esm/Component-3885b0d7.d.ts +0 -169
  370. package/esm/Component.d.ts +0 -104
  371. package/esm/Component.mobile-b2c0420d.d.ts +0 -93
  372. package/esm/components/select-mobile/Component.d.ts +0 -0
  373. package/esm/components/select-mobile/Component.js +0 -41
  374. package/esm/components/select-mobile/index.d.ts +0 -1
  375. package/esm/components/select-mobile/index.js +0 -41
  376. package/esm/components/select-modal-mobile/Component.d.ts +0 -0
  377. package/esm/components/select-modal-mobile/Component.js +0 -41
  378. package/esm/components/select-modal-mobile/index.d.ts +0 -1
  379. package/esm/components/select-modal-mobile/index.js +0 -41
  380. package/esm/getDataTestId-1a678b16.d.ts +0 -2
  381. package/esm/getDataTestId-1a678b16.js +0 -6
  382. package/esm/index-3885b0d7.d.ts +0 -3
  383. package/esm/intersection-observer-4e5bb99c.d.ts +0 -1
  384. package/esm/intersection-observer-4e5bb99c.js +0 -891
  385. package/esm/presets/useLazyLoading/index.css +0 -8
  386. package/esm/responsive.d.ts +0 -2
  387. package/esm/types-ebda875c.d.ts +0 -113
  388. package/getDataTestId-3f974970.d.ts +0 -2
  389. package/getDataTestId-3f974970.js +0 -8
  390. package/index-3885b0d7.d.ts +0 -3
  391. package/intersection-observer-411362a8.d.ts +0 -1
  392. package/intersection-observer-411362a8.js +0 -893
  393. package/modern/Component-3885b0d7.d.ts +0 -169
  394. package/modern/Component-5c16a908.d.ts +0 -108
  395. package/modern/Component.d.ts +0 -104
  396. package/modern/Component.mobile-b2c0420d.d.ts +0 -93
  397. package/modern/components/select-mobile/Component.d.ts +0 -0
  398. package/modern/components/select-mobile/Component.js +0 -40
  399. package/modern/components/select-mobile/index.d.ts +0 -1
  400. package/modern/components/select-mobile/index.js +0 -40
  401. package/modern/components/select-modal-mobile/Component.d.ts +0 -0
  402. package/modern/components/select-modal-mobile/Component.js +0 -40
  403. package/modern/components/select-modal-mobile/index.d.ts +0 -1
  404. package/modern/components/select-modal-mobile/index.js +0 -40
  405. package/modern/getDataTestId-c17bfb0c.d.ts +0 -2
  406. package/modern/getDataTestId-c17bfb0c.js +0 -6
  407. package/modern/index-3885b0d7.d.ts +0 -3
  408. package/modern/intersection-observer-4e5bb99c.d.ts +0 -1
  409. package/modern/intersection-observer-4e5bb99c.js +0 -891
  410. package/modern/presets/useLazyLoading/index.css +0 -8
  411. package/modern/responsive.d.ts +0 -2
  412. package/modern/types-ebda875c.d.ts +0 -113
  413. package/presets/useLazyLoading/index.css +0 -8
  414. package/responsive.d.ts +0 -2
  415. package/types-ebda875c.d.ts +0 -113
  416. /package/{cssm/presets/useLazyLoading → src/presets/useSelectWithLoading}/index.module.css +0 -0
@@ -1,891 +0,0 @@
1
- /**
2
- * Copyright 2016 Google Inc. All Rights Reserved.
3
- *
4
- * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
5
- *
6
- * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
7
- *
8
- */
9
- (function () {
10
- // Exit early if we're not running in a browser.
11
- if (typeof window !== 'object') {
12
- return;
13
- }
14
- // Exit early if all IntersectionObserver and IntersectionObserverEntry
15
- // features are natively supported.
16
- if ('IntersectionObserver' in window &&
17
- 'IntersectionObserverEntry' in window &&
18
- 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
19
- // Minimal polyfill for Edge 15's lack of `isIntersecting`
20
- // See: https://github.com/w3c/IntersectionObserver/issues/211
21
- if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
22
- Object.defineProperty(window.IntersectionObserverEntry.prototype, 'isIntersecting', {
23
- get: function () {
24
- return this.intersectionRatio > 0;
25
- }
26
- });
27
- }
28
- return;
29
- }
30
- /**
31
- * Returns the embedding frame element, if any.
32
- * @param {!Document} doc
33
- * @return {!Element}
34
- */
35
- function getFrameElement(doc) {
36
- try {
37
- return doc.defaultView && doc.defaultView.frameElement || null;
38
- }
39
- catch (e) {
40
- // Ignore the error.
41
- return null;
42
- }
43
- }
44
- /**
45
- * A local reference to the root document.
46
- */
47
- var document = (function (startDoc) {
48
- var doc = startDoc;
49
- var frame = getFrameElement(doc);
50
- while (frame) {
51
- doc = frame.ownerDocument;
52
- frame = getFrameElement(doc);
53
- }
54
- return doc;
55
- })(window.document);
56
- /**
57
- * An IntersectionObserver registry. This registry exists to hold a strong
58
- * reference to IntersectionObserver instances currently observing a target
59
- * element. Without this registry, instances without another reference may be
60
- * garbage collected.
61
- */
62
- var registry = [];
63
- /**
64
- * The signal updater for cross-origin intersection. When not null, it means
65
- * that the polyfill is configured to work in a cross-origin mode.
66
- * @type {function(DOMRect|ClientRect, DOMRect|ClientRect)}
67
- */
68
- var crossOriginUpdater = null;
69
- /**
70
- * The current cross-origin intersection. Only used in the cross-origin mode.
71
- * @type {DOMRect|ClientRect}
72
- */
73
- var crossOriginRect = null;
74
- /**
75
- * Creates the global IntersectionObserverEntry constructor.
76
- * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
77
- * @param {Object} entry A dictionary of instance properties.
78
- * @constructor
79
- */
80
- function IntersectionObserverEntry(entry) {
81
- this.time = entry.time;
82
- this.target = entry.target;
83
- this.rootBounds = ensureDOMRect(entry.rootBounds);
84
- this.boundingClientRect = ensureDOMRect(entry.boundingClientRect);
85
- this.intersectionRect = ensureDOMRect(entry.intersectionRect || getEmptyRect());
86
- this.isIntersecting = !!entry.intersectionRect;
87
- // Calculates the intersection ratio.
88
- var targetRect = this.boundingClientRect;
89
- var targetArea = targetRect.width * targetRect.height;
90
- var intersectionRect = this.intersectionRect;
91
- var intersectionArea = intersectionRect.width * intersectionRect.height;
92
- // Sets intersection ratio.
93
- if (targetArea) {
94
- // Round the intersection ratio to avoid floating point math issues:
95
- // https://github.com/w3c/IntersectionObserver/issues/324
96
- this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));
97
- }
98
- else {
99
- // If area is zero and is intersecting, sets to 1, otherwise to 0
100
- this.intersectionRatio = this.isIntersecting ? 1 : 0;
101
- }
102
- }
103
- /**
104
- * Creates the global IntersectionObserver constructor.
105
- * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
106
- * @param {Function} callback The function to be invoked after intersection
107
- * changes have queued. The function is not invoked if the queue has
108
- * been emptied by calling the `takeRecords` method.
109
- * @param {Object=} opt_options Optional configuration options.
110
- * @constructor
111
- */
112
- function IntersectionObserver(callback, opt_options) {
113
- var options = opt_options || {};
114
- if (typeof callback != 'function') {
115
- throw new Error('callback must be a function');
116
- }
117
- if (options.root &&
118
- options.root.nodeType != 1 &&
119
- options.root.nodeType != 9) {
120
- throw new Error('root must be a Document or Element');
121
- }
122
- // Binds and throttles `this._checkForIntersections`.
123
- this._checkForIntersections = throttle(this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);
124
- // Private properties.
125
- this._callback = callback;
126
- this._observationTargets = [];
127
- this._queuedEntries = [];
128
- this._rootMarginValues = this._parseRootMargin(options.rootMargin);
129
- // Public properties.
130
- this.thresholds = this._initThresholds(options.threshold);
131
- this.root = options.root || null;
132
- this.rootMargin = this._rootMarginValues.map(function (margin) {
133
- return margin.value + margin.unit;
134
- }).join(' ');
135
- /** @private @const {!Array<!Document>} */
136
- this._monitoringDocuments = [];
137
- /** @private @const {!Array<function()>} */
138
- this._monitoringUnsubscribes = [];
139
- }
140
- /**
141
- * The minimum interval within which the document will be checked for
142
- * intersection changes.
143
- */
144
- IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;
145
- /**
146
- * The frequency in which the polyfill polls for intersection changes.
147
- * this can be updated on a per instance basis and must be set prior to
148
- * calling `observe` on the first target.
149
- */
150
- IntersectionObserver.prototype.POLL_INTERVAL = null;
151
- /**
152
- * Use a mutation observer on the root element
153
- * to detect intersection changes.
154
- */
155
- IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;
156
- /**
157
- * Sets up the polyfill in the cross-origin mode. The result is the
158
- * updater function that accepts two arguments: `boundingClientRect` and
159
- * `intersectionRect` - just as these fields would be available to the
160
- * parent via `IntersectionObserverEntry`. This function should be called
161
- * each time the iframe receives intersection information from the parent
162
- * window, e.g. via messaging.
163
- * @return {function(DOMRect|ClientRect, DOMRect|ClientRect)}
164
- */
165
- IntersectionObserver._setupCrossOriginUpdater = function () {
166
- if (!crossOriginUpdater) {
167
- /**
168
- * @param {DOMRect|ClientRect} boundingClientRect
169
- * @param {DOMRect|ClientRect} intersectionRect
170
- */
171
- crossOriginUpdater = function (boundingClientRect, intersectionRect) {
172
- if (!boundingClientRect || !intersectionRect) {
173
- crossOriginRect = getEmptyRect();
174
- }
175
- else {
176
- crossOriginRect = convertFromParentRect(boundingClientRect, intersectionRect);
177
- }
178
- registry.forEach(function (observer) {
179
- observer._checkForIntersections();
180
- });
181
- };
182
- }
183
- return crossOriginUpdater;
184
- };
185
- /**
186
- * Resets the cross-origin mode.
187
- */
188
- IntersectionObserver._resetCrossOriginUpdater = function () {
189
- crossOriginUpdater = null;
190
- crossOriginRect = null;
191
- };
192
- /**
193
- * Starts observing a target element for intersection changes based on
194
- * the thresholds values.
195
- * @param {Element} target The DOM element to observe.
196
- */
197
- IntersectionObserver.prototype.observe = function (target) {
198
- var isTargetAlreadyObserved = this._observationTargets.some(function (item) {
199
- return item.element == target;
200
- });
201
- if (isTargetAlreadyObserved) {
202
- return;
203
- }
204
- if (!(target && target.nodeType == 1)) {
205
- throw new Error('target must be an Element');
206
- }
207
- this._registerInstance();
208
- this._observationTargets.push({ element: target, entry: null });
209
- this._monitorIntersections(target.ownerDocument);
210
- this._checkForIntersections();
211
- };
212
- /**
213
- * Stops observing a target element for intersection changes.
214
- * @param {Element} target The DOM element to observe.
215
- */
216
- IntersectionObserver.prototype.unobserve = function (target) {
217
- this._observationTargets =
218
- this._observationTargets.filter(function (item) {
219
- return item.element != target;
220
- });
221
- this._unmonitorIntersections(target.ownerDocument);
222
- if (this._observationTargets.length == 0) {
223
- this._unregisterInstance();
224
- }
225
- };
226
- /**
227
- * Stops observing all target elements for intersection changes.
228
- */
229
- IntersectionObserver.prototype.disconnect = function () {
230
- this._observationTargets = [];
231
- this._unmonitorAllIntersections();
232
- this._unregisterInstance();
233
- };
234
- /**
235
- * Returns any queue entries that have not yet been reported to the
236
- * callback and clears the queue. This can be used in conjunction with the
237
- * callback to obtain the absolute most up-to-date intersection information.
238
- * @return {Array} The currently queued entries.
239
- */
240
- IntersectionObserver.prototype.takeRecords = function () {
241
- var records = this._queuedEntries.slice();
242
- this._queuedEntries = [];
243
- return records;
244
- };
245
- /**
246
- * Accepts the threshold value from the user configuration object and
247
- * returns a sorted array of unique threshold values. If a value is not
248
- * between 0 and 1 and error is thrown.
249
- * @private
250
- * @param {Array|number=} opt_threshold An optional threshold value or
251
- * a list of threshold values, defaulting to [0].
252
- * @return {Array} A sorted list of unique and valid threshold values.
253
- */
254
- IntersectionObserver.prototype._initThresholds = function (opt_threshold) {
255
- var threshold = opt_threshold || [0];
256
- if (!Array.isArray(threshold))
257
- threshold = [threshold];
258
- return threshold.sort().filter(function (t, i, a) {
259
- if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {
260
- throw new Error('threshold must be a number between 0 and 1 inclusively');
261
- }
262
- return t !== a[i - 1];
263
- });
264
- };
265
- /**
266
- * Accepts the rootMargin value from the user configuration object
267
- * and returns an array of the four margin values as an object containing
268
- * the value and unit properties. If any of the values are not properly
269
- * formatted or use a unit other than px or %, and error is thrown.
270
- * @private
271
- * @param {string=} opt_rootMargin An optional rootMargin value,
272
- * defaulting to '0px'.
273
- * @return {Array<Object>} An array of margin objects with the keys
274
- * value and unit.
275
- */
276
- IntersectionObserver.prototype._parseRootMargin = function (opt_rootMargin) {
277
- var marginString = opt_rootMargin || '0px';
278
- var margins = marginString.split(/\s+/).map(function (margin) {
279
- var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin);
280
- if (!parts) {
281
- throw new Error('rootMargin must be specified in pixels or percent');
282
- }
283
- return { value: parseFloat(parts[1]), unit: parts[2] };
284
- });
285
- // Handles shorthand.
286
- margins[1] = margins[1] || margins[0];
287
- margins[2] = margins[2] || margins[0];
288
- margins[3] = margins[3] || margins[1];
289
- return margins;
290
- };
291
- /**
292
- * Starts polling for intersection changes if the polling is not already
293
- * happening, and if the page's visibility state is visible.
294
- * @param {!Document} doc
295
- * @private
296
- */
297
- IntersectionObserver.prototype._monitorIntersections = function (doc) {
298
- var win = doc.defaultView;
299
- if (!win) {
300
- // Already destroyed.
301
- return;
302
- }
303
- if (this._monitoringDocuments.indexOf(doc) != -1) {
304
- // Already monitoring.
305
- return;
306
- }
307
- // Private state for monitoring.
308
- var callback = this._checkForIntersections;
309
- var monitoringInterval = null;
310
- var domObserver = null;
311
- // If a poll interval is set, use polling instead of listening to
312
- // resize and scroll events or DOM mutations.
313
- if (this.POLL_INTERVAL) {
314
- monitoringInterval = win.setInterval(callback, this.POLL_INTERVAL);
315
- }
316
- else {
317
- addEvent(win, 'resize', callback, true);
318
- addEvent(doc, 'scroll', callback, true);
319
- if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in win) {
320
- domObserver = new win.MutationObserver(callback);
321
- domObserver.observe(doc, {
322
- attributes: true,
323
- childList: true,
324
- characterData: true,
325
- subtree: true
326
- });
327
- }
328
- }
329
- this._monitoringDocuments.push(doc);
330
- this._monitoringUnsubscribes.push(function () {
331
- // Get the window object again. When a friendly iframe is destroyed, it
332
- // will be null.
333
- var win = doc.defaultView;
334
- if (win) {
335
- if (monitoringInterval) {
336
- win.clearInterval(monitoringInterval);
337
- }
338
- removeEvent(win, 'resize', callback, true);
339
- }
340
- removeEvent(doc, 'scroll', callback, true);
341
- if (domObserver) {
342
- domObserver.disconnect();
343
- }
344
- });
345
- // Also monitor the parent.
346
- var rootDoc = (this.root && (this.root.ownerDocument || this.root)) || document;
347
- if (doc != rootDoc) {
348
- var frame = getFrameElement(doc);
349
- if (frame) {
350
- this._monitorIntersections(frame.ownerDocument);
351
- }
352
- }
353
- };
354
- /**
355
- * Stops polling for intersection changes.
356
- * @param {!Document} doc
357
- * @private
358
- */
359
- IntersectionObserver.prototype._unmonitorIntersections = function (doc) {
360
- var index = this._monitoringDocuments.indexOf(doc);
361
- if (index == -1) {
362
- return;
363
- }
364
- var rootDoc = (this.root && (this.root.ownerDocument || this.root)) || document;
365
- // Check if any dependent targets are still remaining.
366
- var hasDependentTargets = this._observationTargets.some(function (item) {
367
- var itemDoc = item.element.ownerDocument;
368
- // Target is in this context.
369
- if (itemDoc == doc) {
370
- return true;
371
- }
372
- // Target is nested in this context.
373
- while (itemDoc && itemDoc != rootDoc) {
374
- var frame = getFrameElement(itemDoc);
375
- itemDoc = frame && frame.ownerDocument;
376
- if (itemDoc == doc) {
377
- return true;
378
- }
379
- }
380
- return false;
381
- });
382
- if (hasDependentTargets) {
383
- return;
384
- }
385
- // Unsubscribe.
386
- var unsubscribe = this._monitoringUnsubscribes[index];
387
- this._monitoringDocuments.splice(index, 1);
388
- this._monitoringUnsubscribes.splice(index, 1);
389
- unsubscribe();
390
- // Also unmonitor the parent.
391
- if (doc != rootDoc) {
392
- var frame = getFrameElement(doc);
393
- if (frame) {
394
- this._unmonitorIntersections(frame.ownerDocument);
395
- }
396
- }
397
- };
398
- /**
399
- * Stops polling for intersection changes.
400
- * @param {!Document} doc
401
- * @private
402
- */
403
- IntersectionObserver.prototype._unmonitorAllIntersections = function () {
404
- var unsubscribes = this._monitoringUnsubscribes.slice(0);
405
- this._monitoringDocuments.length = 0;
406
- this._monitoringUnsubscribes.length = 0;
407
- for (var i = 0; i < unsubscribes.length; i++) {
408
- unsubscribes[i]();
409
- }
410
- };
411
- /**
412
- * Scans each observation target for intersection changes and adds them
413
- * to the internal entries queue. If new entries are found, it
414
- * schedules the callback to be invoked.
415
- * @private
416
- */
417
- IntersectionObserver.prototype._checkForIntersections = function () {
418
- if (!this.root && crossOriginUpdater && !crossOriginRect) {
419
- // Cross origin monitoring, but no initial data available yet.
420
- return;
421
- }
422
- var rootIsInDom = this._rootIsInDom();
423
- var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect();
424
- this._observationTargets.forEach(function (item) {
425
- var target = item.element;
426
- var targetRect = getBoundingClientRect(target);
427
- var rootContainsTarget = this._rootContainsTarget(target);
428
- var oldEntry = item.entry;
429
- var intersectionRect = rootIsInDom && rootContainsTarget &&
430
- this._computeTargetAndRootIntersection(target, targetRect, rootRect);
431
- var rootBounds = null;
432
- if (!this._rootContainsTarget(target)) {
433
- rootBounds = getEmptyRect();
434
- }
435
- else if (!crossOriginUpdater || this.root) {
436
- rootBounds = rootRect;
437
- }
438
- var newEntry = item.entry = new IntersectionObserverEntry({
439
- time: now(),
440
- target: target,
441
- boundingClientRect: targetRect,
442
- rootBounds: rootBounds,
443
- intersectionRect: intersectionRect
444
- });
445
- if (!oldEntry) {
446
- this._queuedEntries.push(newEntry);
447
- }
448
- else if (rootIsInDom && rootContainsTarget) {
449
- // If the new entry intersection ratio has crossed any of the
450
- // thresholds, add a new entry.
451
- if (this._hasCrossedThreshold(oldEntry, newEntry)) {
452
- this._queuedEntries.push(newEntry);
453
- }
454
- }
455
- else {
456
- // If the root is not in the DOM or target is not contained within
457
- // root but the previous entry for this target had an intersection,
458
- // add a new record indicating removal.
459
- if (oldEntry && oldEntry.isIntersecting) {
460
- this._queuedEntries.push(newEntry);
461
- }
462
- }
463
- }, this);
464
- if (this._queuedEntries.length) {
465
- this._callback(this.takeRecords(), this);
466
- }
467
- };
468
- /**
469
- * Accepts a target and root rect computes the intersection between then
470
- * following the algorithm in the spec.
471
- * TODO(philipwalton): at this time clip-path is not considered.
472
- * https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo
473
- * @param {Element} target The target DOM element
474
- * @param {Object} targetRect The bounding rect of the target.
475
- * @param {Object} rootRect The bounding rect of the root after being
476
- * expanded by the rootMargin value.
477
- * @return {?Object} The final intersection rect object or undefined if no
478
- * intersection is found.
479
- * @private
480
- */
481
- IntersectionObserver.prototype._computeTargetAndRootIntersection =
482
- function (target, targetRect, rootRect) {
483
- // If the element isn't displayed, an intersection can't happen.
484
- if (window.getComputedStyle(target).display == 'none')
485
- return;
486
- var intersectionRect = targetRect;
487
- var parent = getParentNode(target);
488
- var atRoot = false;
489
- while (!atRoot && parent) {
490
- var parentRect = null;
491
- var parentComputedStyle = parent.nodeType == 1 ?
492
- window.getComputedStyle(parent) : {};
493
- // If the parent isn't displayed, an intersection can't happen.
494
- if (parentComputedStyle.display == 'none')
495
- return null;
496
- if (parent == this.root || parent.nodeType == /* DOCUMENT */ 9) {
497
- atRoot = true;
498
- if (parent == this.root || parent == document) {
499
- if (crossOriginUpdater && !this.root) {
500
- if (!crossOriginRect ||
501
- crossOriginRect.width == 0 && crossOriginRect.height == 0) {
502
- // A 0-size cross-origin intersection means no-intersection.
503
- parent = null;
504
- parentRect = null;
505
- intersectionRect = null;
506
- }
507
- else {
508
- parentRect = crossOriginRect;
509
- }
510
- }
511
- else {
512
- parentRect = rootRect;
513
- }
514
- }
515
- else {
516
- // Check if there's a frame that can be navigated to.
517
- var frame = getParentNode(parent);
518
- var frameRect = frame && getBoundingClientRect(frame);
519
- var frameIntersect = frame &&
520
- this._computeTargetAndRootIntersection(frame, frameRect, rootRect);
521
- if (frameRect && frameIntersect) {
522
- parent = frame;
523
- parentRect = convertFromParentRect(frameRect, frameIntersect);
524
- }
525
- else {
526
- parent = null;
527
- intersectionRect = null;
528
- }
529
- }
530
- }
531
- else {
532
- // If the element has a non-visible overflow, and it's not the <body>
533
- // or <html> element, update the intersection rect.
534
- // Note: <body> and <html> cannot be clipped to a rect that's not also
535
- // the document rect, so no need to compute a new intersection.
536
- var doc = parent.ownerDocument;
537
- if (parent != doc.body &&
538
- parent != doc.documentElement &&
539
- parentComputedStyle.overflow != 'visible') {
540
- parentRect = getBoundingClientRect(parent);
541
- }
542
- }
543
- // If either of the above conditionals set a new parentRect,
544
- // calculate new intersection data.
545
- if (parentRect) {
546
- intersectionRect = computeRectIntersection(parentRect, intersectionRect);
547
- }
548
- if (!intersectionRect)
549
- break;
550
- parent = parent && getParentNode(parent);
551
- }
552
- return intersectionRect;
553
- };
554
- /**
555
- * Returns the root rect after being expanded by the rootMargin value.
556
- * @return {ClientRect} The expanded root rect.
557
- * @private
558
- */
559
- IntersectionObserver.prototype._getRootRect = function () {
560
- var rootRect;
561
- if (this.root && !isDoc(this.root)) {
562
- rootRect = getBoundingClientRect(this.root);
563
- }
564
- else {
565
- // Use <html>/<body> instead of window since scroll bars affect size.
566
- var doc = isDoc(this.root) ? this.root : document;
567
- var html = doc.documentElement;
568
- var body = doc.body;
569
- rootRect = {
570
- top: 0,
571
- left: 0,
572
- right: html.clientWidth || body.clientWidth,
573
- width: html.clientWidth || body.clientWidth,
574
- bottom: html.clientHeight || body.clientHeight,
575
- height: html.clientHeight || body.clientHeight
576
- };
577
- }
578
- return this._expandRectByRootMargin(rootRect);
579
- };
580
- /**
581
- * Accepts a rect and expands it by the rootMargin value.
582
- * @param {DOMRect|ClientRect} rect The rect object to expand.
583
- * @return {ClientRect} The expanded rect.
584
- * @private
585
- */
586
- IntersectionObserver.prototype._expandRectByRootMargin = function (rect) {
587
- var margins = this._rootMarginValues.map(function (margin, i) {
588
- return margin.unit == 'px' ? margin.value :
589
- margin.value * (i % 2 ? rect.width : rect.height) / 100;
590
- });
591
- var newRect = {
592
- top: rect.top - margins[0],
593
- right: rect.right + margins[1],
594
- bottom: rect.bottom + margins[2],
595
- left: rect.left - margins[3]
596
- };
597
- newRect.width = newRect.right - newRect.left;
598
- newRect.height = newRect.bottom - newRect.top;
599
- return newRect;
600
- };
601
- /**
602
- * Accepts an old and new entry and returns true if at least one of the
603
- * threshold values has been crossed.
604
- * @param {?IntersectionObserverEntry} oldEntry The previous entry for a
605
- * particular target element or null if no previous entry exists.
606
- * @param {IntersectionObserverEntry} newEntry The current entry for a
607
- * particular target element.
608
- * @return {boolean} Returns true if a any threshold has been crossed.
609
- * @private
610
- */
611
- IntersectionObserver.prototype._hasCrossedThreshold =
612
- function (oldEntry, newEntry) {
613
- // To make comparing easier, an entry that has a ratio of 0
614
- // but does not actually intersect is given a value of -1
615
- var oldRatio = oldEntry && oldEntry.isIntersecting ?
616
- oldEntry.intersectionRatio || 0 : -1;
617
- var newRatio = newEntry.isIntersecting ?
618
- newEntry.intersectionRatio || 0 : -1;
619
- // Ignore unchanged ratios
620
- if (oldRatio === newRatio)
621
- return;
622
- for (var i = 0; i < this.thresholds.length; i++) {
623
- var threshold = this.thresholds[i];
624
- // Return true if an entry matches a threshold or if the new ratio
625
- // and the old ratio are on the opposite sides of a threshold.
626
- if (threshold == oldRatio || threshold == newRatio ||
627
- threshold < oldRatio !== threshold < newRatio) {
628
- return true;
629
- }
630
- }
631
- };
632
- /**
633
- * Returns whether or not the root element is an element and is in the DOM.
634
- * @return {boolean} True if the root element is an element and is in the DOM.
635
- * @private
636
- */
637
- IntersectionObserver.prototype._rootIsInDom = function () {
638
- return !this.root || containsDeep(document, this.root);
639
- };
640
- /**
641
- * Returns whether or not the target element is a child of root.
642
- * @param {Element} target The target element to check.
643
- * @return {boolean} True if the target element is a child of root.
644
- * @private
645
- */
646
- IntersectionObserver.prototype._rootContainsTarget = function (target) {
647
- var rootDoc = (this.root && (this.root.ownerDocument || this.root)) || document;
648
- return (containsDeep(rootDoc, target) &&
649
- (!this.root || rootDoc == target.ownerDocument));
650
- };
651
- /**
652
- * Adds the instance to the global IntersectionObserver registry if it isn't
653
- * already present.
654
- * @private
655
- */
656
- IntersectionObserver.prototype._registerInstance = function () {
657
- if (registry.indexOf(this) < 0) {
658
- registry.push(this);
659
- }
660
- };
661
- /**
662
- * Removes the instance from the global IntersectionObserver registry.
663
- * @private
664
- */
665
- IntersectionObserver.prototype._unregisterInstance = function () {
666
- var index = registry.indexOf(this);
667
- if (index != -1)
668
- registry.splice(index, 1);
669
- };
670
- /**
671
- * Returns the result of the performance.now() method or null in browsers
672
- * that don't support the API.
673
- * @return {number} The elapsed time since the page was requested.
674
- */
675
- function now() {
676
- return window.performance && performance.now && performance.now();
677
- }
678
- /**
679
- * Throttles a function and delays its execution, so it's only called at most
680
- * once within a given time period.
681
- * @param {Function} fn The function to throttle.
682
- * @param {number} timeout The amount of time that must pass before the
683
- * function can be called again.
684
- * @return {Function} The throttled function.
685
- */
686
- function throttle(fn, timeout) {
687
- var timer = null;
688
- return function () {
689
- if (!timer) {
690
- timer = setTimeout(function () {
691
- fn();
692
- timer = null;
693
- }, timeout);
694
- }
695
- };
696
- }
697
- /**
698
- * Adds an event handler to a DOM node ensuring cross-browser compatibility.
699
- * @param {Node} node The DOM node to add the event handler to.
700
- * @param {string} event The event name.
701
- * @param {Function} fn The event handler to add.
702
- * @param {boolean} opt_useCapture Optionally adds the even to the capture
703
- * phase. Note: this only works in modern browsers.
704
- */
705
- function addEvent(node, event, fn, opt_useCapture) {
706
- if (typeof node.addEventListener == 'function') {
707
- node.addEventListener(event, fn, opt_useCapture || false);
708
- }
709
- else if (typeof node.attachEvent == 'function') {
710
- node.attachEvent('on' + event, fn);
711
- }
712
- }
713
- /**
714
- * Removes a previously added event handler from a DOM node.
715
- * @param {Node} node The DOM node to remove the event handler from.
716
- * @param {string} event The event name.
717
- * @param {Function} fn The event handler to remove.
718
- * @param {boolean} opt_useCapture If the event handler was added with this
719
- * flag set to true, it should be set to true here in order to remove it.
720
- */
721
- function removeEvent(node, event, fn, opt_useCapture) {
722
- if (typeof node.removeEventListener == 'function') {
723
- node.removeEventListener(event, fn, opt_useCapture || false);
724
- }
725
- else if (typeof node.detatchEvent == 'function') {
726
- node.detatchEvent('on' + event, fn);
727
- }
728
- }
729
- /**
730
- * Returns the intersection between two rect objects.
731
- * @param {Object} rect1 The first rect.
732
- * @param {Object} rect2 The second rect.
733
- * @return {?Object|?ClientRect} The intersection rect or undefined if no
734
- * intersection is found.
735
- */
736
- function computeRectIntersection(rect1, rect2) {
737
- var top = Math.max(rect1.top, rect2.top);
738
- var bottom = Math.min(rect1.bottom, rect2.bottom);
739
- var left = Math.max(rect1.left, rect2.left);
740
- var right = Math.min(rect1.right, rect2.right);
741
- var width = right - left;
742
- var height = bottom - top;
743
- return (width >= 0 && height >= 0) && {
744
- top: top,
745
- bottom: bottom,
746
- left: left,
747
- right: right,
748
- width: width,
749
- height: height
750
- } || null;
751
- }
752
- /**
753
- * Shims the native getBoundingClientRect for compatibility with older IE.
754
- * @param {Element} el The element whose bounding rect to get.
755
- * @return {DOMRect|ClientRect} The (possibly shimmed) rect of the element.
756
- */
757
- function getBoundingClientRect(el) {
758
- var rect;
759
- try {
760
- rect = el.getBoundingClientRect();
761
- }
762
- catch (err) {
763
- // Ignore Windows 7 IE11 "Unspecified error"
764
- // https://github.com/w3c/IntersectionObserver/pull/205
765
- }
766
- if (!rect)
767
- return getEmptyRect();
768
- // Older IE
769
- if (!(rect.width && rect.height)) {
770
- rect = {
771
- top: rect.top,
772
- right: rect.right,
773
- bottom: rect.bottom,
774
- left: rect.left,
775
- width: rect.right - rect.left,
776
- height: rect.bottom - rect.top
777
- };
778
- }
779
- return rect;
780
- }
781
- /**
782
- * Returns an empty rect object. An empty rect is returned when an element
783
- * is not in the DOM.
784
- * @return {ClientRect} The empty rect.
785
- */
786
- function getEmptyRect() {
787
- return {
788
- top: 0,
789
- bottom: 0,
790
- left: 0,
791
- right: 0,
792
- width: 0,
793
- height: 0
794
- };
795
- }
796
- /**
797
- * Ensure that the result has all of the necessary fields of the DOMRect.
798
- * Specifically this ensures that `x` and `y` fields are set.
799
- *
800
- * @param {?DOMRect|?ClientRect} rect
801
- * @return {?DOMRect}
802
- */
803
- function ensureDOMRect(rect) {
804
- // A `DOMRect` object has `x` and `y` fields.
805
- if (!rect || 'x' in rect) {
806
- return rect;
807
- }
808
- // A IE's `ClientRect` type does not have `x` and `y`. The same is the case
809
- // for internally calculated Rect objects. For the purposes of
810
- // `IntersectionObserver`, it's sufficient to simply mirror `left` and `top`
811
- // for these fields.
812
- return {
813
- top: rect.top,
814
- y: rect.top,
815
- bottom: rect.bottom,
816
- left: rect.left,
817
- x: rect.left,
818
- right: rect.right,
819
- width: rect.width,
820
- height: rect.height
821
- };
822
- }
823
- /**
824
- * Inverts the intersection and bounding rect from the parent (frame) BCR to
825
- * the local BCR space.
826
- * @param {DOMRect|ClientRect} parentBoundingRect The parent's bound client rect.
827
- * @param {DOMRect|ClientRect} parentIntersectionRect The parent's own intersection rect.
828
- * @return {ClientRect} The local root bounding rect for the parent's children.
829
- */
830
- function convertFromParentRect(parentBoundingRect, parentIntersectionRect) {
831
- var top = parentIntersectionRect.top - parentBoundingRect.top;
832
- var left = parentIntersectionRect.left - parentBoundingRect.left;
833
- return {
834
- top: top,
835
- left: left,
836
- height: parentIntersectionRect.height,
837
- width: parentIntersectionRect.width,
838
- bottom: top + parentIntersectionRect.height,
839
- right: left + parentIntersectionRect.width
840
- };
841
- }
842
- /**
843
- * Checks to see if a parent element contains a child element (including inside
844
- * shadow DOM).
845
- * @param {Node} parent The parent element.
846
- * @param {Node} child The child element.
847
- * @return {boolean} True if the parent node contains the child node.
848
- */
849
- function containsDeep(parent, child) {
850
- var node = child;
851
- while (node) {
852
- if (node == parent)
853
- return true;
854
- node = getParentNode(node);
855
- }
856
- return false;
857
- }
858
- /**
859
- * Gets the parent node of an element or its host element if the parent node
860
- * is a shadow root.
861
- * @param {Node} node The node whose parent to get.
862
- * @return {Node|null} The parent node or null if no parent exists.
863
- */
864
- function getParentNode(node) {
865
- var parent = node.parentNode;
866
- if (node.nodeType == /* DOCUMENT */ 9 && node != document) {
867
- // If this node is a document node, look for the embedding frame.
868
- return getFrameElement(node);
869
- }
870
- // If the parent has element that is assigned through shadow root slot
871
- if (parent && parent.assignedSlot) {
872
- parent = parent.assignedSlot.parentNode;
873
- }
874
- if (parent && parent.nodeType == 11 && parent.host) {
875
- // If the parent is a shadow root, return the host element.
876
- return parent.host;
877
- }
878
- return parent;
879
- }
880
- /**
881
- * Returns true if `node` is a Document.
882
- * @param {!Node} node
883
- * @returns {boolean}
884
- */
885
- function isDoc(node) {
886
- return node && node.nodeType === 9;
887
- }
888
- // Exposes the constructors globally.
889
- window.IntersectionObserver = IntersectionObserver;
890
- window.IntersectionObserverEntry = IntersectionObserverEntry;
891
- }());