@solid2-aria/stately 0.0.0-stage → 0.0.1

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 (477) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/dist/LICENSES/Apache-2.0.txt +201 -0
  4. package/dist/LICENSES/react-spectrum-NOTICE.txt +242 -0
  5. package/dist/NOTICE.txt +636 -0
  6. package/dist/autocomplete/create-autocomplete-state.d.ts +46 -0
  7. package/dist/autocomplete/create-autocomplete-state.js +41 -0
  8. package/dist/autocomplete/create-autocomplete-state.js.map +1 -0
  9. package/dist/calendar/create-calendar-state.d.ts +62 -0
  10. package/dist/calendar/create-calendar-state.js +357 -0
  11. package/dist/calendar/create-calendar-state.js.map +1 -0
  12. package/dist/calendar/create-range-calendar-state.d.ts +63 -0
  13. package/dist/calendar/create-range-calendar-state.js +204 -0
  14. package/dist/calendar/create-range-calendar-state.js.map +1 -0
  15. package/dist/calendar/types.d.ts +222 -0
  16. package/dist/calendar/types.js +16 -0
  17. package/dist/calendar/utils.d.ts +27 -0
  18. package/dist/calendar/utils.js +81 -0
  19. package/dist/calendar/utils.js.map +1 -0
  20. package/dist/checkbox/create-checkbox-group-state.d.ts +60 -0
  21. package/dist/checkbox/create-checkbox-group-state.js +88 -0
  22. package/dist/checkbox/create-checkbox-group-state.js.map +1 -0
  23. package/dist/collections/collection-builder.d.ts +28 -0
  24. package/dist/collections/collection-builder.js +164 -0
  25. package/dist/collections/collection-builder.js.map +1 -0
  26. package/dist/collections/create-collection.d.ts +24 -0
  27. package/dist/collections/create-collection.js +35 -0
  28. package/dist/collections/create-collection.js.map +1 -0
  29. package/dist/collections/get-child-nodes.d.ts +25 -0
  30. package/dist/collections/get-child-nodes.js +67 -0
  31. package/dist/collections/get-child-nodes.js.map +1 -0
  32. package/dist/collections/get-item-count.d.ts +19 -0
  33. package/dist/collections/get-item-count.js +34 -0
  34. package/dist/collections/get-item-count.js.map +1 -0
  35. package/dist/collections/item.d.ts +29 -0
  36. package/dist/collections/item.js +68 -0
  37. package/dist/collections/item.js.map +1 -0
  38. package/dist/collections/section.d.ts +29 -0
  39. package/dist/collections/section.js +60 -0
  40. package/dist/collections/section.js.map +1 -0
  41. package/dist/collections/types.d.ts +46 -0
  42. package/dist/collections/types.js +29 -0
  43. package/dist/collections/types.js.map +1 -0
  44. package/dist/color/color/base-color.d.ts +40 -0
  45. package/dist/color/color/base-color.js +122 -0
  46. package/dist/color/color/base-color.js.map +1 -0
  47. package/dist/color/color/color-classes.d.ts +27 -0
  48. package/dist/color/color/color-classes.js +29 -0
  49. package/dist/color/color/color-classes.js.map +1 -0
  50. package/dist/color/color/color-constructors.d.ts +23 -0
  51. package/dist/color/color/color-constructors.js +16 -0
  52. package/dist/color/color/color.d.ts +3 -0
  53. package/dist/color/color/color.js +2 -0
  54. package/dist/color/color/hsb-color.d.ts +24 -0
  55. package/dist/color/color/hsb-color.js +183 -0
  56. package/dist/color/color/hsb-color.js.map +1 -0
  57. package/dist/color/color/hsl-color.d.ts +24 -0
  58. package/dist/color/color/hsl-color.js +184 -0
  59. package/dist/color/color/hsl-color.js.map +1 -0
  60. package/dist/color/color/normalize-hue.d.ts +18 -0
  61. package/dist/color/color/normalize-hue.js +24 -0
  62. package/dist/color/color/normalize-hue.js.map +1 -0
  63. package/dist/color/color/oklch.d.ts +19 -0
  64. package/dist/color/color/oklch.js +97 -0
  65. package/dist/color/color/oklch.js.map +1 -0
  66. package/dist/color/color/rgb-color.d.ts +24 -0
  67. package/dist/color/color/rgb-color.js +230 -0
  68. package/dist/color/color/rgb-color.js.map +1 -0
  69. package/dist/color/color.d.ts +25 -0
  70. package/dist/color/color.js +41 -0
  71. package/dist/color/color.js.map +1 -0
  72. package/dist/color/create-color-area-state.d.ts +105 -0
  73. package/dist/color/create-color-area-state.js +138 -0
  74. package/dist/color/create-color-area-state.js.map +1 -0
  75. package/dist/color/create-color-channel-field-state.d.ts +29 -0
  76. package/dist/color/create-color-channel-field-state.js +69 -0
  77. package/dist/color/create-color-channel-field-state.js.map +1 -0
  78. package/dist/color/create-color-field-state.d.ts +61 -0
  79. package/dist/color/create-color-field-state.js +113 -0
  80. package/dist/color/create-color-field-state.js.map +1 -0
  81. package/dist/color/create-color-picker-state.d.ts +16 -0
  82. package/dist/color/create-color-picker-state.js +26 -0
  83. package/dist/color/create-color-picker-state.js.map +1 -0
  84. package/dist/color/create-color-slider-state.d.ts +50 -0
  85. package/dist/color/create-color-slider-state.js +93 -0
  86. package/dist/color/create-color-slider-state.js.map +1 -0
  87. package/dist/color/create-color-wheel-state.d.ts +76 -0
  88. package/dist/color/create-color-wheel-state.js +130 -0
  89. package/dist/color/create-color-wheel-state.js.map +1 -0
  90. package/dist/color/create-color.d.ts +20 -0
  91. package/dist/color/create-color.js +33 -0
  92. package/dist/color/create-color.js.map +1 -0
  93. package/dist/color/types.d.ts +87 -0
  94. package/dist/color/types.js +5 -0
  95. package/dist/combobox/create-combo-box-state.d.ts +157 -0
  96. package/dist/combobox/create-combo-box-state.js +450 -0
  97. package/dist/combobox/create-combo-box-state.js.map +1 -0
  98. package/dist/data/create-async-list.d.ts +88 -0
  99. package/dist/data/create-async-list.js +276 -0
  100. package/dist/data/create-async-list.js.map +1 -0
  101. package/dist/data/create-list-data.d.ts +140 -0
  102. package/dist/data/create-list-data.js +250 -0
  103. package/dist/data/create-list-data.js.map +1 -0
  104. package/dist/data/create-tree-data.d.ts +134 -0
  105. package/dist/data/create-tree-data.js +364 -0
  106. package/dist/data/create-tree-data.js.map +1 -0
  107. package/dist/datepicker/create-date-field-state.d.ts +138 -0
  108. package/dist/datepicker/create-date-field-state.js +449 -0
  109. package/dist/datepicker/create-date-field-state.js.map +1 -0
  110. package/dist/datepicker/create-date-picker-state.d.ts +82 -0
  111. package/dist/datepicker/create-date-picker-state.js +191 -0
  112. package/dist/datepicker/create-date-picker-state.js.map +1 -0
  113. package/dist/datepicker/create-date-range-picker-state.d.ts +97 -0
  114. package/dist/datepicker/create-date-range-picker-state.js +305 -0
  115. package/dist/datepicker/create-date-range-picker-state.js.map +1 -0
  116. package/dist/datepicker/create-time-field-state.d.ts +34 -0
  117. package/dist/datepicker/create-time-field-state.js +128 -0
  118. package/dist/datepicker/create-time-field-state.js.map +1 -0
  119. package/dist/datepicker/incomplete-date.d.ts +71 -0
  120. package/dist/datepicker/incomplete-date.js +324 -0
  121. package/dist/datepicker/incomplete-date.js.map +1 -0
  122. package/dist/datepicker/placeholders.d.ts +18 -0
  123. package/dist/datepicker/placeholders.js +418 -0
  124. package/dist/datepicker/placeholders.js.map +1 -0
  125. package/dist/datepicker/types.d.ts +131 -0
  126. package/dist/datepicker/types.js +16 -0
  127. package/dist/datepicker/utils.d.ts +37 -0
  128. package/dist/datepicker/utils.js +168 -0
  129. package/dist/datepicker/utils.js.map +1 -0
  130. package/dist/disclosure/create-disclosure-group-state.d.ts +47 -0
  131. package/dist/disclosure/create-disclosure-group-state.js +62 -0
  132. package/dist/disclosure/create-disclosure-group-state.js.map +1 -0
  133. package/dist/disclosure/create-disclosure-state.d.ts +42 -0
  134. package/dist/disclosure/create-disclosure-state.js +49 -0
  135. package/dist/disclosure/create-disclosure-state.js.map +1 -0
  136. package/dist/dnd/create-draggable-collection-state.d.ts +63 -0
  137. package/dist/dnd/create-draggable-collection-state.js +136 -0
  138. package/dist/dnd/create-draggable-collection-state.js.map +1 -0
  139. package/dist/dnd/create-droppable-collection-state.d.ts +55 -0
  140. package/dist/dnd/create-droppable-collection-state.js +155 -0
  141. package/dist/dnd/create-droppable-collection-state.js.map +1 -0
  142. package/dist/flags/flags.d.ts +21 -0
  143. package/dist/flags/flags.js +34 -0
  144. package/dist/flags/flags.js.map +1 -0
  145. package/dist/form/create-form-validation-state.d.ts +37 -0
  146. package/dist/form/create-form-validation-state.js +152 -0
  147. package/dist/form/create-form-validation-state.js.map +1 -0
  148. package/dist/grid/create-grid-state.d.ts +38 -0
  149. package/dist/grid/create-grid-state.js +85 -0
  150. package/dist/grid/create-grid-state.js.map +1 -0
  151. package/dist/grid/grid-collection.d.ts +68 -0
  152. package/dist/grid/grid-collection.js +133 -0
  153. package/dist/grid/grid-collection.js.map +1 -0
  154. package/dist/index.d.ts +91 -0
  155. package/dist/index.js +86 -0
  156. package/dist/intl/color/ar-AE.js +44 -0
  157. package/dist/intl/color/ar-AE.js.map +1 -0
  158. package/dist/intl/color/bg-BG.js +44 -0
  159. package/dist/intl/color/bg-BG.js.map +1 -0
  160. package/dist/intl/color/cs-CZ.js +44 -0
  161. package/dist/intl/color/cs-CZ.js.map +1 -0
  162. package/dist/intl/color/da-DK.js +44 -0
  163. package/dist/intl/color/da-DK.js.map +1 -0
  164. package/dist/intl/color/de-DE.js +44 -0
  165. package/dist/intl/color/de-DE.js.map +1 -0
  166. package/dist/intl/color/el-GR.js +44 -0
  167. package/dist/intl/color/el-GR.js.map +1 -0
  168. package/dist/intl/color/en-US.js +44 -0
  169. package/dist/intl/color/en-US.js.map +1 -0
  170. package/dist/intl/color/es-ES.js +44 -0
  171. package/dist/intl/color/es-ES.js.map +1 -0
  172. package/dist/intl/color/et-EE.js +44 -0
  173. package/dist/intl/color/et-EE.js.map +1 -0
  174. package/dist/intl/color/fi-FI.js +44 -0
  175. package/dist/intl/color/fi-FI.js.map +1 -0
  176. package/dist/intl/color/fr-FR.js +44 -0
  177. package/dist/intl/color/fr-FR.js.map +1 -0
  178. package/dist/intl/color/he-IL.js +44 -0
  179. package/dist/intl/color/he-IL.js.map +1 -0
  180. package/dist/intl/color/hr-HR.js +44 -0
  181. package/dist/intl/color/hr-HR.js.map +1 -0
  182. package/dist/intl/color/hu-HU.js +44 -0
  183. package/dist/intl/color/hu-HU.js.map +1 -0
  184. package/dist/intl/color/index.js +75 -0
  185. package/dist/intl/color/index.js.map +1 -0
  186. package/dist/intl/color/it-IT.js +44 -0
  187. package/dist/intl/color/it-IT.js.map +1 -0
  188. package/dist/intl/color/ja-JP.js +44 -0
  189. package/dist/intl/color/ja-JP.js.map +1 -0
  190. package/dist/intl/color/ko-KR.js +44 -0
  191. package/dist/intl/color/ko-KR.js.map +1 -0
  192. package/dist/intl/color/lt-LT.js +44 -0
  193. package/dist/intl/color/lt-LT.js.map +1 -0
  194. package/dist/intl/color/lv-LV.js +44 -0
  195. package/dist/intl/color/lv-LV.js.map +1 -0
  196. package/dist/intl/color/nb-NO.js +44 -0
  197. package/dist/intl/color/nb-NO.js.map +1 -0
  198. package/dist/intl/color/nl-NL.js +44 -0
  199. package/dist/intl/color/nl-NL.js.map +1 -0
  200. package/dist/intl/color/pl-PL.js +44 -0
  201. package/dist/intl/color/pl-PL.js.map +1 -0
  202. package/dist/intl/color/pt-BR.js +44 -0
  203. package/dist/intl/color/pt-BR.js.map +1 -0
  204. package/dist/intl/color/pt-PT.js +44 -0
  205. package/dist/intl/color/pt-PT.js.map +1 -0
  206. package/dist/intl/color/ro-RO.js +44 -0
  207. package/dist/intl/color/ro-RO.js.map +1 -0
  208. package/dist/intl/color/ru-RU.js +44 -0
  209. package/dist/intl/color/ru-RU.js.map +1 -0
  210. package/dist/intl/color/sk-SK.js +44 -0
  211. package/dist/intl/color/sk-SK.js.map +1 -0
  212. package/dist/intl/color/sl-SI.js +44 -0
  213. package/dist/intl/color/sl-SI.js.map +1 -0
  214. package/dist/intl/color/sr-SP.js +44 -0
  215. package/dist/intl/color/sr-SP.js.map +1 -0
  216. package/dist/intl/color/sv-SE.js +44 -0
  217. package/dist/intl/color/sv-SE.js.map +1 -0
  218. package/dist/intl/color/tr-TR.js +44 -0
  219. package/dist/intl/color/tr-TR.js.map +1 -0
  220. package/dist/intl/color/uk-UA.js +44 -0
  221. package/dist/intl/color/uk-UA.js.map +1 -0
  222. package/dist/intl/color/zh-CN.js +44 -0
  223. package/dist/intl/color/zh-CN.js.map +1 -0
  224. package/dist/intl/color/zh-TW.js +44 -0
  225. package/dist/intl/color/zh-TW.js.map +1 -0
  226. package/dist/intl/datepicker/ar-AE.js +11 -0
  227. package/dist/intl/datepicker/ar-AE.js.map +1 -0
  228. package/dist/intl/datepicker/bg-BG.js +11 -0
  229. package/dist/intl/datepicker/bg-BG.js.map +1 -0
  230. package/dist/intl/datepicker/cs-CZ.js +11 -0
  231. package/dist/intl/datepicker/cs-CZ.js.map +1 -0
  232. package/dist/intl/datepicker/da-DK.js +11 -0
  233. package/dist/intl/datepicker/da-DK.js.map +1 -0
  234. package/dist/intl/datepicker/de-DE.js +11 -0
  235. package/dist/intl/datepicker/de-DE.js.map +1 -0
  236. package/dist/intl/datepicker/el-GR.js +11 -0
  237. package/dist/intl/datepicker/el-GR.js.map +1 -0
  238. package/dist/intl/datepicker/en-US.js +11 -0
  239. package/dist/intl/datepicker/en-US.js.map +1 -0
  240. package/dist/intl/datepicker/es-ES.js +11 -0
  241. package/dist/intl/datepicker/es-ES.js.map +1 -0
  242. package/dist/intl/datepicker/et-EE.js +11 -0
  243. package/dist/intl/datepicker/et-EE.js.map +1 -0
  244. package/dist/intl/datepicker/fi-FI.js +11 -0
  245. package/dist/intl/datepicker/fi-FI.js.map +1 -0
  246. package/dist/intl/datepicker/fr-FR.js +11 -0
  247. package/dist/intl/datepicker/fr-FR.js.map +1 -0
  248. package/dist/intl/datepicker/he-IL.js +11 -0
  249. package/dist/intl/datepicker/he-IL.js.map +1 -0
  250. package/dist/intl/datepicker/hr-HR.js +11 -0
  251. package/dist/intl/datepicker/hr-HR.js.map +1 -0
  252. package/dist/intl/datepicker/hu-HU.js +11 -0
  253. package/dist/intl/datepicker/hu-HU.js.map +1 -0
  254. package/dist/intl/datepicker/index.js +75 -0
  255. package/dist/intl/datepicker/index.js.map +1 -0
  256. package/dist/intl/datepicker/it-IT.js +11 -0
  257. package/dist/intl/datepicker/it-IT.js.map +1 -0
  258. package/dist/intl/datepicker/ja-JP.js +11 -0
  259. package/dist/intl/datepicker/ja-JP.js.map +1 -0
  260. package/dist/intl/datepicker/ko-KR.js +11 -0
  261. package/dist/intl/datepicker/ko-KR.js.map +1 -0
  262. package/dist/intl/datepicker/lt-LT.js +11 -0
  263. package/dist/intl/datepicker/lt-LT.js.map +1 -0
  264. package/dist/intl/datepicker/lv-LV.js +11 -0
  265. package/dist/intl/datepicker/lv-LV.js.map +1 -0
  266. package/dist/intl/datepicker/nb-NO.js +11 -0
  267. package/dist/intl/datepicker/nb-NO.js.map +1 -0
  268. package/dist/intl/datepicker/nl-NL.js +11 -0
  269. package/dist/intl/datepicker/nl-NL.js.map +1 -0
  270. package/dist/intl/datepicker/pl-PL.js +11 -0
  271. package/dist/intl/datepicker/pl-PL.js.map +1 -0
  272. package/dist/intl/datepicker/pt-BR.js +11 -0
  273. package/dist/intl/datepicker/pt-BR.js.map +1 -0
  274. package/dist/intl/datepicker/pt-PT.js +11 -0
  275. package/dist/intl/datepicker/pt-PT.js.map +1 -0
  276. package/dist/intl/datepicker/ro-RO.js +11 -0
  277. package/dist/intl/datepicker/ro-RO.js.map +1 -0
  278. package/dist/intl/datepicker/ru-RU.js +11 -0
  279. package/dist/intl/datepicker/ru-RU.js.map +1 -0
  280. package/dist/intl/datepicker/sk-SK.js +11 -0
  281. package/dist/intl/datepicker/sk-SK.js.map +1 -0
  282. package/dist/intl/datepicker/sl-SI.js +11 -0
  283. package/dist/intl/datepicker/sl-SI.js.map +1 -0
  284. package/dist/intl/datepicker/sr-SP.js +11 -0
  285. package/dist/intl/datepicker/sr-SP.js.map +1 -0
  286. package/dist/intl/datepicker/sv-SE.js +11 -0
  287. package/dist/intl/datepicker/sv-SE.js.map +1 -0
  288. package/dist/intl/datepicker/tr-TR.js +11 -0
  289. package/dist/intl/datepicker/tr-TR.js.map +1 -0
  290. package/dist/intl/datepicker/uk-UA.js +11 -0
  291. package/dist/intl/datepicker/uk-UA.js.map +1 -0
  292. package/dist/intl/datepicker/zh-CN.js +11 -0
  293. package/dist/intl/datepicker/zh-CN.js.map +1 -0
  294. package/dist/intl/datepicker/zh-TW.js +11 -0
  295. package/dist/intl/datepicker/zh-TW.js.map +1 -0
  296. package/dist/layout/grid-layout.d.ts +107 -0
  297. package/dist/layout/grid-layout.js +253 -0
  298. package/dist/layout/grid-layout.js.map +1 -0
  299. package/dist/layout/list-layout.d.ts +187 -0
  300. package/dist/layout/list-layout.js +488 -0
  301. package/dist/layout/list-layout.js.map +1 -0
  302. package/dist/layout/table-layout.d.ts +98 -0
  303. package/dist/layout/table-layout.js +476 -0
  304. package/dist/layout/table-layout.js.map +1 -0
  305. package/dist/layout/waterfall-layout.d.ts +85 -0
  306. package/dist/layout/waterfall-layout.js +225 -0
  307. package/dist/layout/waterfall-layout.js.map +1 -0
  308. package/dist/list/create-list-state.d.ts +48 -0
  309. package/dist/list/create-list-state.js +123 -0
  310. package/dist/list/create-list-state.js.map +1 -0
  311. package/dist/list/create-single-select-list-state.d.ts +38 -0
  312. package/dist/list/create-single-select-list-state.js +55 -0
  313. package/dist/list/create-single-select-list-state.js.map +1 -0
  314. package/dist/list/list-collection.d.ts +36 -0
  315. package/dist/list/list-collection.js +91 -0
  316. package/dist/list/list-collection.js.map +1 -0
  317. package/dist/menu/create-menu-trigger-state.d.ts +55 -0
  318. package/dist/menu/create-menu-trigger-state.js +58 -0
  319. package/dist/menu/create-menu-trigger-state.js.map +1 -0
  320. package/dist/menu/create-submenu-trigger-state.d.ts +47 -0
  321. package/dist/menu/create-submenu-trigger-state.js +59 -0
  322. package/dist/menu/create-submenu-trigger-state.js.map +1 -0
  323. package/dist/numberfield/create-number-field-state.d.ts +93 -0
  324. package/dist/numberfield/create-number-field-state.js +139 -0
  325. package/dist/numberfield/create-number-field-state.js.map +1 -0
  326. package/dist/overlays/create-overlay-trigger-state.d.ts +51 -0
  327. package/dist/overlays/create-overlay-trigger-state.js +56 -0
  328. package/dist/overlays/create-overlay-trigger-state.js.map +1 -0
  329. package/dist/radio/create-radio-group-state.d.ts +61 -0
  330. package/dist/radio/create-radio-group-state.js +71 -0
  331. package/dist/radio/create-radio-group-state.js.map +1 -0
  332. package/dist/searchfield/create-search-field-state.d.ts +35 -0
  333. package/dist/searchfield/create-search-field-state.js +34 -0
  334. package/dist/searchfield/create-search-field-state.js.map +1 -0
  335. package/dist/select/create-select-state.d.ts +116 -0
  336. package/dist/select/create-select-state.js +151 -0
  337. package/dist/select/create-select-state.js.map +1 -0
  338. package/dist/selection/create-multiple-selection-state.d.ts +39 -0
  339. package/dist/selection/create-multiple-selection-state.js +114 -0
  340. package/dist/selection/create-multiple-selection-state.js.map +1 -0
  341. package/dist/selection/selection-manager.d.ts +139 -0
  342. package/dist/selection/selection-manager.js +334 -0
  343. package/dist/selection/selection-manager.js.map +1 -0
  344. package/dist/selection/selection.d.ts +27 -0
  345. package/dist/selection/selection.js +38 -0
  346. package/dist/selection/selection.js.map +1 -0
  347. package/dist/selection/types.d.ts +116 -0
  348. package/dist/selection/types.js +16 -0
  349. package/dist/slider/create-slider-state.d.ts +182 -0
  350. package/dist/slider/create-slider-state.js +131 -0
  351. package/dist/slider/create-slider-state.js.map +1 -0
  352. package/dist/steplist/create-step-list-state.d.ts +40 -0
  353. package/dist/steplist/create-step-list-state.js +132 -0
  354. package/dist/steplist/create-step-list-state.js.map +1 -0
  355. package/dist/table/cell.d.ts +37 -0
  356. package/dist/table/cell.js +47 -0
  357. package/dist/table/cell.js.map +1 -0
  358. package/dist/table/collection-context.d.ts +4 -0
  359. package/dist/table/collection-context.js +8 -0
  360. package/dist/table/collection-context.js.map +1 -0
  361. package/dist/table/column.d.ts +66 -0
  362. package/dist/table/column.js +71 -0
  363. package/dist/table/column.js.map +1 -0
  364. package/dist/table/create-table-column-resize-state.d.ts +65 -0
  365. package/dist/table/create-table-column-resize-state.js +100 -0
  366. package/dist/table/create-table-column-resize-state.js.map +1 -0
  367. package/dist/table/create-table-state.d.ts +112 -0
  368. package/dist/table/create-table-state.js +122 -0
  369. package/dist/table/create-table-state.js.map +1 -0
  370. package/dist/table/create-tree-grid-state.d.ts +44 -0
  371. package/dist/table/create-tree-grid-state.js +145 -0
  372. package/dist/table/create-tree-grid-state.js.map +1 -0
  373. package/dist/table/row.d.ts +44 -0
  374. package/dist/table/row.js +91 -0
  375. package/dist/table/row.js.map +1 -0
  376. package/dist/table/table-body.d.ts +36 -0
  377. package/dist/table/table-body.js +57 -0
  378. package/dist/table/table-body.js.map +1 -0
  379. package/dist/table/table-collection.d.ts +62 -0
  380. package/dist/table/table-collection.js +274 -0
  381. package/dist/table/table-collection.js.map +1 -0
  382. package/dist/table/table-column-layout.d.ts +47 -0
  383. package/dist/table/table-column-layout.js +94 -0
  384. package/dist/table/table-column-layout.js.map +1 -0
  385. package/dist/table/table-header.d.ts +37 -0
  386. package/dist/table/table-header.js +52 -0
  387. package/dist/table/table-header.js.map +1 -0
  388. package/dist/table/table-utils.d.ts +60 -0
  389. package/dist/table/table-utils.js +203 -0
  390. package/dist/table/table-utils.js.map +1 -0
  391. package/dist/tabs/create-tab-list-state.d.ts +42 -0
  392. package/dist/tabs/create-tab-list-state.js +78 -0
  393. package/dist/tabs/create-tab-list-state.js.map +1 -0
  394. package/dist/toast/create-toast-state.d.ts +97 -0
  395. package/dist/toast/create-toast-state.js +166 -0
  396. package/dist/toast/create-toast-state.js.map +1 -0
  397. package/dist/toggle/create-toggle-group-state.d.ts +55 -0
  398. package/dist/toggle/create-toggle-group-state.js +62 -0
  399. package/dist/toggle/create-toggle-group-state.js.map +1 -0
  400. package/dist/toggle/create-toggle-state.d.ts +58 -0
  401. package/dist/toggle/create-toggle-state.js +43 -0
  402. package/dist/toggle/create-toggle-state.js.map +1 -0
  403. package/dist/tokenfield/create-token-field-state.d.ts +39 -0
  404. package/dist/tokenfield/create-token-field-state.js +44 -0
  405. package/dist/tokenfield/create-token-field-state.js.map +1 -0
  406. package/dist/tokenfield/token-field-value.d.ts +111 -0
  407. package/dist/tokenfield/token-field-value.js +327 -0
  408. package/dist/tokenfield/token-field-value.js.map +1 -0
  409. package/dist/tooltip/create-tooltip-trigger-state.d.ts +73 -0
  410. package/dist/tooltip/create-tooltip-trigger-state.js +136 -0
  411. package/dist/tooltip/create-tooltip-trigger-state.js.map +1 -0
  412. package/dist/tree/create-tree-state.d.ts +42 -0
  413. package/dist/tree/create-tree-state.js +75 -0
  414. package/dist/tree/create-tree-state.js.map +1 -0
  415. package/dist/tree/tree-collection.d.ts +36 -0
  416. package/dist/tree/tree-collection.js +84 -0
  417. package/dist/tree/tree-collection.js.map +1 -0
  418. package/dist/utils/create-controlled-signal.d.ts +23 -0
  419. package/dist/utils/create-controlled-signal.js +54 -0
  420. package/dist/utils/create-controlled-signal.js.map +1 -0
  421. package/dist/utils/get-item-key.d.ts +5 -0
  422. package/dist/utils/get-item-key.js +12 -0
  423. package/dist/utils/get-item-key.js.map +1 -0
  424. package/dist/utils/get-node-props.d.ts +23 -0
  425. package/dist/utils/get-node-props.js +38 -0
  426. package/dist/utils/get-node-props.js.map +1 -0
  427. package/dist/utils/has-content.d.ts +5 -0
  428. package/dist/utils/has-content.js +7 -0
  429. package/dist/utils/has-content.js.map +1 -0
  430. package/dist/utils/legacy-props.d.ts +10 -0
  431. package/dist/utils/legacy-props.js +17 -0
  432. package/dist/utils/legacy-props.js.map +1 -0
  433. package/dist/utils/number.d.ts +25 -0
  434. package/dist/utils/number.js +59 -0
  435. package/dist/utils/number.js.map +1 -0
  436. package/dist/utils/parse-calendar-identifier.d.ts +5 -0
  437. package/dist/utils/parse-calendar-identifier.js +31 -0
  438. package/dist/utils/parse-calendar-identifier.js.map +1 -0
  439. package/dist/utils/require-value.d.ts +4 -0
  440. package/dist/utils/require-value.js +10 -0
  441. package/dist/utils/require-value.js.map +1 -0
  442. package/dist/virtualizer/create-virtualizer-state.d.ts +44 -0
  443. package/dist/virtualizer/create-virtualizer-state.js +92 -0
  444. package/dist/virtualizer/create-virtualizer-state.js.map +1 -0
  445. package/dist/virtualizer/layout-info.d.ts +94 -0
  446. package/dist/virtualizer/layout-info.js +118 -0
  447. package/dist/virtualizer/layout-info.js.map +1 -0
  448. package/dist/virtualizer/layout.d.ts +91 -0
  449. package/dist/virtualizer/layout.js +71 -0
  450. package/dist/virtualizer/layout.js.map +1 -0
  451. package/dist/virtualizer/overscan-manager.d.ts +25 -0
  452. package/dist/virtualizer/overscan-manager.js +46 -0
  453. package/dist/virtualizer/overscan-manager.js.map +1 -0
  454. package/dist/virtualizer/point.d.ts +36 -0
  455. package/dist/virtualizer/point.js +48 -0
  456. package/dist/virtualizer/point.js.map +1 -0
  457. package/dist/virtualizer/rect.d.ts +103 -0
  458. package/dist/virtualizer/rect.js +156 -0
  459. package/dist/virtualizer/rect.js.map +1 -0
  460. package/dist/virtualizer/reusable-view.d.ts +51 -0
  461. package/dist/virtualizer/reusable-view.js +81 -0
  462. package/dist/virtualizer/reusable-view.js.map +1 -0
  463. package/dist/virtualizer/scroll-anchor.d.ts +98 -0
  464. package/dist/virtualizer/scroll-anchor.js +150 -0
  465. package/dist/virtualizer/scroll-anchor.js.map +1 -0
  466. package/dist/virtualizer/size.d.ts +34 -0
  467. package/dist/virtualizer/size.js +46 -0
  468. package/dist/virtualizer/size.js.map +1 -0
  469. package/dist/virtualizer/types.d.ts +47 -0
  470. package/dist/virtualizer/types.js +16 -0
  471. package/dist/virtualizer/utils.d.ts +19 -0
  472. package/dist/virtualizer/utils.js +27 -0
  473. package/dist/virtualizer/utils.js.map +1 -0
  474. package/dist/virtualizer/virtualizer.d.ts +99 -0
  475. package/dist/virtualizer/virtualizer.js +314 -0
  476. package/dist/virtualizer/virtualizer.js.map +1 -0
  477. package/package.json +174 -4
@@ -0,0 +1,145 @@
1
+ /*
2
+ * Copyright 2023 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/useTreeGridState.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { createControlledSignal } from "../utils/create-controlled-signal.js";
18
+ import { CollectionBuilder } from "../collections/collection-builder.js";
19
+ import { getNodeChildren } from "../collections/get-child-nodes.js";
20
+ import { getNodeProps } from "../utils/get-node-props.js";
21
+ import { tableNestedRows } from "../flags/flags.js";
22
+ import { TableCollection } from "./table-collection.js";
23
+ import { createTableState } from "./create-table-state.js";
24
+ import { createMemo, merge, untrack } from "solid-js";
25
+ // src/table/create-tree-grid-state.ts
26
+ /**
27
+ * Provides state management for a tree grid component. Handles building a collection of columns and
28
+ * rows from props. In addition, it tracks and manages expanded rows, row selection, and sort order
29
+ * changes.
30
+ */
31
+ function UNSTABLE_createTreeGridState(props) {
32
+ if (!tableNestedRows()) throw new Error("Feature flag for table nested rows must be enabled to use createTreeGridState.");
33
+ const [expandedKeys, setExpandedKeys] = createControlledSignal(() => props.UNSTABLE_expandedKeys === void 0 ? void 0 : convertExpanded(props.UNSTABLE_expandedKeys), untrack(() => props.UNSTABLE_defaultExpandedKeys === void 0 ? /* @__PURE__ */ new Set() : convertExpanded(props.UNSTABLE_defaultExpandedKeys)), (keys) => {
34
+ if (keys !== "all") props.UNSTABLE_onExpandedChange?.(keys);
35
+ });
36
+ const treeGridCollection = createMemo(() => {
37
+ const context = {
38
+ columns: [],
39
+ selectionMode: props.selectionMode ?? "none",
40
+ showDragButtons: props.showDragButtons === true,
41
+ showSelectionCheckboxes: props.showSelectionCheckboxes === true && props.selectionMode !== "none"
42
+ };
43
+ const tree = generateTreeGridCollection(new CollectionBuilder().build({ children: props.children }, context), {
44
+ expandedKeys: expandedKeys(),
45
+ showDragButtons: props.showDragButtons,
46
+ showSelectionCheckboxes: props.showSelectionCheckboxes
47
+ });
48
+ return {
49
+ collection: new TableCollection(tree.tableNodes, null, context),
50
+ tree
51
+ };
52
+ });
53
+ const tableState = createTableState(merge(props, { get collection() {
54
+ return treeGridCollection().collection;
55
+ } }));
56
+ return merge(tableState, {
57
+ get expandedKeys() {
58
+ return expandedKeys();
59
+ },
60
+ get keyMap() {
61
+ return treeGridCollection().tree.keyMap;
62
+ },
63
+ toggleKey(key) {
64
+ setExpandedKeys((current) => toggleKey(current, key, treeGridCollection().tree));
65
+ },
66
+ get treeColumn() {
67
+ return tableState.treeColumn ?? treeGridCollection().collection.rowHeaderColumnKeys.keys().next().value ?? null;
68
+ },
69
+ get userColumnCount() {
70
+ return treeGridCollection().tree.userColumnCount;
71
+ }
72
+ });
73
+ }
74
+ function toggleKey(currentExpandedKeys, key, collection) {
75
+ let updatedExpandedKeys;
76
+ if (currentExpandedKeys === "all") {
77
+ updatedExpandedKeys = new Set(collection.flattenedRows.filter((row) => getNodeProps(row).hasChildItems || getNodeProps(row).children > collection.userColumnCount).map((row) => row.key));
78
+ updatedExpandedKeys.delete(key);
79
+ } else {
80
+ updatedExpandedKeys = new Set(currentExpandedKeys);
81
+ if (updatedExpandedKeys.has(key)) updatedExpandedKeys.delete(key);
82
+ else updatedExpandedKeys.add(key);
83
+ }
84
+ return updatedExpandedKeys;
85
+ }
86
+ function convertExpanded(expanded) {
87
+ if (expanded === null || expanded === void 0) return /* @__PURE__ */ new Set();
88
+ return expanded === "all" ? "all" : new Set(expanded);
89
+ }
90
+ function generateTreeGridCollection(nodes, opts) {
91
+ const { expandedKeys } = opts;
92
+ let body = null;
93
+ const flattenedRows = [];
94
+ let userColumnCount = 0;
95
+ const originalColumns = [];
96
+ const keyMap = /* @__PURE__ */ new Map();
97
+ const topLevelRows = [];
98
+ const visit = (node) => {
99
+ switch (node.type) {
100
+ case "body":
101
+ body = node;
102
+ keyMap.set(body.key, body);
103
+ break;
104
+ case "column":
105
+ if (!node.hasChildNodes) userColumnCount += 1;
106
+ break;
107
+ case "item":
108
+ topLevelRows.push(node);
109
+ return;
110
+ }
111
+ for (const child of getNodeChildren(node)) visit(child);
112
+ };
113
+ for (const node of nodes) {
114
+ if (node.type === "column") originalColumns.push(node);
115
+ visit(node);
116
+ }
117
+ const visitNode = (node) => {
118
+ if (node.type === "item") flattenedRows.push(node);
119
+ keyMap.set(node.key, node);
120
+ for (const child of getNodeChildren(node)) if (child.type !== "item" || expandedKeys === "all" || expandedKeys.has(node.key)) {
121
+ if (child.type === "item") visitNode(child);
122
+ else visitNode(child);
123
+ }
124
+ };
125
+ for (const node of topLevelRows) visitNode(node);
126
+ return {
127
+ get flattenedRows() {
128
+ return flattenedRows;
129
+ },
130
+ get keyMap() {
131
+ return keyMap;
132
+ },
133
+ get tableNodes() {
134
+ return [...originalColumns, merge(body, { get childNodes() {
135
+ return flattenedRows;
136
+ } })];
137
+ },
138
+ get userColumnCount() {
139
+ return userColumnCount;
140
+ }
141
+ };
142
+ }
143
+ export { UNSTABLE_createTreeGridState };
144
+
145
+ //# sourceMappingURL=create-tree-grid-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-tree-grid-state.js","names":[],"sources":["../../src/table/create-tree-grid-state.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/table/useTreeGridState.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { Key, Node } from \"@solid2-aria/types-shared\";\nimport { createMemo, merge, untrack } from \"solid-js\";\n\nimport { CollectionBuilder } from \"../collections/collection-builder\";\nimport { getNodeChildren } from \"../collections/get-child-nodes\";\nimport { tableNestedRows } from \"../flags/flags\";\nimport type { GridNode } from \"../grid/grid-collection\";\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { getNodeProps } from \"../utils/get-node-props\";\nimport type {\n CollectionBuilderContext,\n TableState,\n TableStateProps,\n} from \"./create-table-state\";\nimport { createTableState } from \"./create-table-state\";\nimport { TableCollection } from \"./table-collection\";\n\nexport interface TreeGridState<T> extends Omit<TableState<T>, \"expandedKeys\"> {\n /** A set of keys for items that are expanded. */\n expandedKeys: \"all\" | Set<Key>;\n /** Toggles the expanded state for a row by its key. */\n toggleKey: (key: Key) => void;\n /** The key map containing nodes representing the collection's tree grid structure. */\n keyMap: Map<Key, GridNode<T>>;\n /** The number of leaf columns provided by the user. */\n userColumnCount: number;\n}\n\nexport interface TreeGridStateProps<T> extends Omit<\n TableStateProps<T>,\n \"collection\"\n> {\n /** The currently expanded keys in the collection (controlled). */\n UNSTABLE_expandedKeys?: \"all\" | Iterable<Key>;\n /** The initial expanded keys in the collection (uncontrolled). */\n UNSTABLE_defaultExpandedKeys?: \"all\" | Iterable<Key>;\n /** Handler that is called when items are expanded or collapsed. */\n UNSTABLE_onExpandedChange?: (keys: Set<Key>) => void;\n}\n\n/**\n * Provides state management for a tree grid component. Handles building a collection of columns and\n * rows from props. In addition, it tracks and manages expanded rows, row selection, and sort order\n * changes.\n */\nexport function UNSTABLE_createTreeGridState<T extends object>(\n props: TreeGridStateProps<T>\n): TreeGridState<T> {\n if (!tableNestedRows()) {\n throw new Error(\n \"Feature flag for table nested rows must be enabled to use createTreeGridState.\"\n );\n }\n\n const [expandedKeys, setExpandedKeys] = createControlledSignal<\n \"all\" | Set<Key>\n >(\n () =>\n props.UNSTABLE_expandedKeys === undefined\n ? undefined\n : convertExpanded(props.UNSTABLE_expandedKeys),\n untrack(() =>\n props.UNSTABLE_defaultExpandedKeys === undefined\n ? new Set<Key>()\n : convertExpanded(props.UNSTABLE_defaultExpandedKeys)\n ),\n (keys) => {\n if (keys !== \"all\") {\n props.UNSTABLE_onExpandedChange?.(keys);\n }\n }\n );\n\n const treeGridCollection = createMemo(() => {\n const context: CollectionBuilderContext<T> = {\n columns: [],\n selectionMode: props.selectionMode ?? \"none\",\n showDragButtons: props.showDragButtons === true,\n showSelectionCheckboxes:\n props.showSelectionCheckboxes === true &&\n props.selectionMode !== \"none\",\n };\n\n const nodes = new CollectionBuilder<T>().build(\n { children: props.children },\n context\n );\n\n const tree = generateTreeGridCollection<T>(nodes, {\n expandedKeys: expandedKeys(),\n showDragButtons: props.showDragButtons,\n showSelectionCheckboxes: props.showSelectionCheckboxes,\n });\n\n return {\n collection: new TableCollection<T>(tree.tableNodes, null, context),\n tree,\n };\n });\n\n const tableState = createTableState<T>(\n merge(props, {\n get collection() {\n return treeGridCollection().collection;\n },\n })\n );\n\n return merge(tableState, {\n get expandedKeys() {\n return expandedKeys();\n },\n get keyMap() {\n return treeGridCollection().tree.keyMap;\n },\n toggleKey(key: Key) {\n setExpandedKeys((current) =>\n toggleKey(current, key, treeGridCollection().tree)\n );\n },\n get treeColumn() {\n return (\n tableState.treeColumn ??\n treeGridCollection().collection.rowHeaderColumnKeys.keys().next()\n .value ??\n null\n );\n },\n get userColumnCount() {\n return treeGridCollection().tree.userColumnCount;\n },\n });\n}\n\nfunction toggleKey<T>(\n currentExpandedKeys: \"all\" | Set<Key>,\n key: Key,\n collection: TreeGridCollection<T>\n): Set<Key> {\n let updatedExpandedKeys: Set<Key>;\n\n if (currentExpandedKeys === \"all\") {\n updatedExpandedKeys = new Set(\n collection.flattenedRows\n .filter(\n (row) =>\n getNodeProps(row).hasChildItems ||\n getNodeProps(row).children > collection.userColumnCount\n )\n .map((row) => row.key)\n );\n updatedExpandedKeys.delete(key);\n } else {\n updatedExpandedKeys = new Set(currentExpandedKeys);\n\n if (updatedExpandedKeys.has(key)) {\n updatedExpandedKeys.delete(key);\n } else {\n updatedExpandedKeys.add(key);\n }\n }\n\n return updatedExpandedKeys;\n}\n\nfunction convertExpanded(expanded: \"all\" | Iterable<Key>): \"all\" | Set<Key> {\n if (expanded === null || expanded === undefined) {\n return new Set<Key>();\n }\n\n return expanded === \"all\" ? \"all\" : new Set(expanded);\n}\n\ninterface TreeGridCollectionOptions {\n showSelectionCheckboxes?: boolean;\n showDragButtons?: boolean;\n expandedKeys: \"all\" | Set<Key>;\n}\n\ninterface TreeGridCollection<T> {\n keyMap: Map<Key, GridNode<T>>;\n tableNodes: GridNode<T>[];\n flattenedRows: GridNode<T>[];\n userColumnCount: number;\n}\n\nfunction generateTreeGridCollection<T>(\n nodes: Iterable<Node<T>>,\n opts: TreeGridCollectionOptions\n): TreeGridCollection<T> {\n const { expandedKeys } = opts;\n let body: GridNode<T> | null = null;\n const flattenedRows: GridNode<T>[] = [];\n let userColumnCount = 0;\n const originalColumns: GridNode<T>[] = [];\n const keyMap = new Map();\n const topLevelRows: GridNode<T>[] = [];\n\n const visit = (node: GridNode<T>) => {\n switch (node.type) {\n case \"body\": {\n body = node;\n keyMap.set(body.key, body);\n break;\n }\n\n case \"column\": {\n if (!node.hasChildNodes) {\n userColumnCount += 1;\n }\n\n break;\n }\n\n case \"item\": {\n topLevelRows.push(node);\n\n return;\n }\n\n default: {\n break;\n }\n }\n\n for (const child of getNodeChildren(node)) {\n visit(child);\n }\n };\n\n for (const node of nodes) {\n if (node.type === \"column\") {\n originalColumns.push(node);\n }\n\n visit(node);\n }\n\n // Update each grid node in the treegrid table with values specific to a treegrid structure. Also store a set of flattened row nodes for TableCollection to consume\n const visitNode = (node: GridNode<T>) => {\n if (node.type === \"item\") {\n flattenedRows.push(node);\n }\n\n keyMap.set(node.key, node);\n\n for (const child of getNodeChildren(node)) {\n if (\n child.type !== \"item\" ||\n expandedKeys === \"all\" ||\n expandedKeys.has(node.key)\n ) {\n if (child.type === \"item\") {\n visitNode(child);\n } else {\n // We enforce that the cells come before rows so can just reuse cell index\n visitNode(child);\n }\n }\n }\n };\n\n for (const node of topLevelRows) {\n visitNode(node);\n }\n\n return {\n get flattenedRows() {\n return flattenedRows;\n },\n get keyMap() {\n return keyMap;\n },\n get tableNodes() {\n return [\n ...originalColumns,\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n merge(body, {\n get childNodes() {\n return flattenedRows;\n },\n }),\n // oxlint-enable solid/reactivity\n ];\n },\n get userColumnCount() {\n return userColumnCount;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,6BACd,OACkB;CAClB,IAAI,CAAC,gBAAgB,GACnB,MAAM,IAAI,MACR,gFACF;CAGF,MAAM,CAAC,cAAc,mBAAmB,6BAIpC,MAAM,0BAA0B,KAAA,IAC5B,KAAA,IACA,gBAAgB,MAAM,qBAAqB,GACjD,cACE,MAAM,iCAAiC,KAAA,oBACnC,IAAI,IAAS,IACb,gBAAgB,MAAM,4BAA4B,CACxD,IACC,SAAS;EACR,IAAI,SAAS,OACX,MAAM,4BAA4B,IAAI;CAE1C,CACF;CAEA,MAAM,qBAAqB,iBAAiB;EAC1C,MAAM,UAAuC;GAC3C,SAAS,CAAC;GACV,eAAe,MAAM,iBAAiB;GACtC,iBAAiB,MAAM,oBAAoB;GAC3C,yBACE,MAAM,4BAA4B,QAClC,MAAM,kBAAkB;EAC5B;EAOA,MAAM,OAAO,2BALC,IAAI,kBAAqB,CAAC,CAAC,MACvC,EAAE,UAAU,MAAM,SAAS,GAC3B,OAG6C,GAAG;GAChD,cAAc,aAAa;GAC3B,iBAAiB,MAAM;GACvB,yBAAyB,MAAM;EACjC,CAAC;EAED,OAAO;GACL,YAAY,IAAI,gBAAmB,KAAK,YAAY,MAAM,OAAO;GACjE;EACF;CACF,CAAC;CAED,MAAM,aAAa,iBACjB,MAAM,OAAO,EACX,IAAI,aAAa;EACf,OAAO,mBAAmB,CAAC,CAAC;CAC9B,EACF,CAAC,CACH;CAEA,OAAO,MAAM,YAAY;EACvB,IAAI,eAAe;GACjB,OAAO,aAAa;EACtB;EACA,IAAI,SAAS;GACX,OAAO,mBAAmB,CAAC,CAAC,KAAK;EACnC;EACA,UAAU,KAAU;GAClB,iBAAiB,YACf,UAAU,SAAS,KAAK,mBAAmB,CAAC,CAAC,IAAI,CACnD;EACF;EACA,IAAI,aAAa;GACf,OACE,WAAW,cACX,mBAAmB,CAAC,CAAC,WAAW,oBAAoB,KAAK,CAAC,CAAC,KAAK,CAAC,CAC9D,SACH;EAEJ;EACA,IAAI,kBAAkB;GACpB,OAAO,mBAAmB,CAAC,CAAC,KAAK;EACnC;CACF,CAAC;AACH;AAEA,SAAS,UACP,qBACA,KACA,YACU;CACV,IAAI;CAEJ,IAAI,wBAAwB,OAAO;EACjC,sBAAsB,IAAI,IACxB,WAAW,cACR,QACE,QACC,aAAa,GAAG,CAAC,CAAC,iBAClB,aAAa,GAAG,CAAC,CAAC,WAAW,WAAW,eAC5C,CAAC,CACA,KAAK,QAAQ,IAAI,GAAG,CACzB;EACA,oBAAoB,OAAO,GAAG;CAChC,OAAO;EACL,sBAAsB,IAAI,IAAI,mBAAmB;EAEjD,IAAI,oBAAoB,IAAI,GAAG,GAC7B,oBAAoB,OAAO,GAAG;OAE9B,oBAAoB,IAAI,GAAG;CAE/B;CAEA,OAAO;AACT;AAEA,SAAS,gBAAgB,UAAmD;CAC1E,IAAI,aAAa,QAAQ,aAAa,KAAA,GACpC,uBAAO,IAAI,IAAS;CAGtB,OAAO,aAAa,QAAQ,QAAQ,IAAI,IAAI,QAAQ;AACtD;AAeA,SAAS,2BACP,OACA,MACuB;CACvB,MAAM,EAAE,iBAAiB;CACzB,IAAI,OAA2B;CAC/B,MAAM,gBAA+B,CAAC;CACtC,IAAI,kBAAkB;CACtB,MAAM,kBAAiC,CAAC;CACxC,MAAM,yBAAS,IAAI,IAAI;CACvB,MAAM,eAA8B,CAAC;CAErC,MAAM,SAAS,SAAsB;EACnC,QAAQ,KAAK,MAAb;GACE,KAAK;IACH,OAAO;IACP,OAAO,IAAI,KAAK,KAAK,IAAI;IACzB;GAGF,KAAK;IACH,IAAI,CAAC,KAAK,eACR,mBAAmB;IAGrB;GAGF,KAAK;IACH,aAAa,KAAK,IAAI;IAEtB;EAMJ;EAEA,KAAK,MAAM,SAAS,gBAAgB,IAAI,GACtC,MAAM,KAAK;CAEf;CAEA,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,SAAS,UAChB,gBAAgB,KAAK,IAAI;EAG3B,MAAM,IAAI;CACZ;CAGA,MAAM,aAAa,SAAsB;EACvC,IAAI,KAAK,SAAS,QAChB,cAAc,KAAK,IAAI;EAGzB,OAAO,IAAI,KAAK,KAAK,IAAI;EAEzB,KAAK,MAAM,SAAS,gBAAgB,IAAI,GACtC,IACE,MAAM,SAAS,UACf,iBAAiB,SACjB,aAAa,IAAI,KAAK,GAAG,GACzB;GACA,IAAI,MAAM,SAAS,QACjB,UAAU,KAAK;QAGf,UAAU,KAAK;EAEnB;CAEJ;CAEA,KAAK,MAAM,QAAQ,cACjB,UAAU,IAAI;CAGhB,OAAO;EACL,IAAI,gBAAgB;GAClB,OAAO;EACT;EACA,IAAI,SAAS;GACX,OAAO;EACT;EACA,IAAI,aAAa;GACf,OAAO,CACL,GAAG,iBAEH,MAAM,MAAM,EACV,IAAI,aAAa;IACf,OAAO;GACT,EACF,CAAC,CAEH;EACF;EACA,IAAI,kBAAkB;GACpB,OAAO;EACT;CACF;AACF"}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/Row.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { CollectionContext, PartialNode } from "../collections/types.js";
18
+ import { CellElement, CellRenderer } from "./cell.js";
19
+ import { Element } from "solid-js";
20
+ import { Key, LinkDOMProps } from "@solid2-aria/types-shared";
21
+ export type RowElement<_T> = Element;
22
+ export interface RowProps<T> extends LinkDOMProps {
23
+ key?: Key;
24
+ "aria-label"?: string;
25
+ /**
26
+ * A list of child item objects used when dynamically rendering row children. Requires the feature
27
+ * flag to be enabled along with UNSTABLE_allowsExpandableRows, see
28
+ * https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
29
+ *
30
+ * @private
31
+ * @version alpha
32
+ */
33
+ UNSTABLE_childItems?: Iterable<T>;
34
+ /** Rendered contents of the row or row child items. */
35
+ children: CellElement | CellElement[] | CellRenderer;
36
+ /** A string representation of the row's contents, used for features like typeahead. */
37
+ textValue?: string;
38
+ }
39
+ declare function Row<T>(props: RowProps<T>): Element;
40
+ declare namespace Row {
41
+ var getCollectionNode: <T>(props: RowProps<T>, context: CollectionContext) => Generator<PartialNode<T>>;
42
+ }
43
+ export { Row };
44
+ //# sourceMappingURL=row.d.ts.map
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/Row.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { collectionChildren, isCollectionElement } from "../collections/types.js";
18
+ import { isTableCollectionContext } from "./collection-context.js";
19
+ // src/table/row.ts
20
+ function Row(props) {
21
+ return Object.assign([], {
22
+ getCollectionNode: (context) => Row.getCollectionNode(props, context),
23
+ get key() {
24
+ return props.key;
25
+ },
26
+ props,
27
+ type: Row
28
+ });
29
+ }
30
+ Row.getCollectionNode = function* getCollectionNode(props, context) {
31
+ if (!isTableCollectionContext(context)) throw new Error("Table collection context is required.");
32
+ const { children, textValue, UNSTABLE_childItems } = props;
33
+ yield {
34
+ "aria-label": props["aria-label"],
35
+ *childNodes() {
36
+ if (context.showDragButtons) yield {
37
+ key: "header-drag",
38
+ props: { isDragButtonCell: true },
39
+ type: "cell"
40
+ };
41
+ if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield {
42
+ key: "header",
43
+ props: { isSelectionCell: true },
44
+ type: "cell"
45
+ };
46
+ if (typeof children === "function") {
47
+ for (const column of context.columns) yield {
48
+ element: children(column.key),
49
+ key: column.key,
50
+ type: "cell"
51
+ };
52
+ if (UNSTABLE_childItems) for (const child of UNSTABLE_childItems) yield {
53
+ type: "item",
54
+ value: child
55
+ };
56
+ } else {
57
+ const cells = [];
58
+ const childRows = [];
59
+ let columnCount = 0;
60
+ for (const node of collectionChildren(children)) if (isCollectionElement(node) && "type" in node && node.type === Row) {
61
+ if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
62
+ childRows.push({
63
+ element: node,
64
+ type: "item"
65
+ });
66
+ } else {
67
+ cells.push({
68
+ element: node,
69
+ type: "cell"
70
+ });
71
+ const cellProps = isCollectionElement(node) ? node.props : null;
72
+ columnCount += typeof cellProps === "object" && cellProps !== null && "colSpan" in cellProps && typeof cellProps.colSpan === "number" ? cellProps.colSpan : 1;
73
+ }
74
+ if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
75
+ yield* cells;
76
+ yield* childRows;
77
+ }
78
+ },
79
+ hasChildNodes: true,
80
+ props,
81
+ shouldInvalidate(newContext) {
82
+ if (!isTableCollectionContext(newContext)) return true;
83
+ return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i) => c.key !== context.columns[i]?.key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
84
+ },
85
+ textValue,
86
+ type: "item"
87
+ };
88
+ };
89
+ export { Row };
90
+
91
+ //# sourceMappingURL=row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","names":[],"sources":["../../src/table/row.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/table/Row.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { Key, LinkDOMProps } from \"@solid2-aria/types-shared\";\nimport type { Element as SolidElement } from \"solid-js\";\n\nimport type { PartialNode, CollectionContext } from \"../collections/types\";\nimport { collectionChildren, isCollectionElement } from \"../collections/types\";\nimport type { CellElement, CellRenderer } from \"./cell\";\nimport { isTableCollectionContext } from \"./collection-context\";\n\nexport type RowElement<_T> = SolidElement;\n\nexport interface RowProps<T> extends LinkDOMProps {\n key?: Key;\n \"aria-label\"?: string;\n /**\n * A list of child item objects used when dynamically rendering row children. Requires the feature\n * flag to be enabled along with UNSTABLE_allowsExpandableRows, see\n * https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.\n *\n * @private\n * @version alpha\n */\n UNSTABLE_childItems?: Iterable<T>;\n // update when async loading is supported for expandable rows\n // /** Whether this row has children, even if not loaded yet. */\n // hasChildItems?: boolean,\n /** Rendered contents of the row or row child items. */\n children: CellElement | CellElement[] | CellRenderer;\n /** A string representation of the row's contents, used for features like typeahead. */\n // ???\n textValue?: string;\n}\n\nfunction Row<T>(props: RowProps<T>): SolidElement {\n return Object.assign([], {\n getCollectionNode: (context: CollectionContext) =>\n Row.getCollectionNode(props, context),\n get key() {\n return props.key;\n },\n props,\n type: Row,\n });\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(\n props: RowProps<T>,\n context: CollectionContext\n): Generator<PartialNode<T>> {\n if (!isTableCollectionContext<T>(context)) {\n throw new Error(\"Table collection context is required.\");\n }\n\n const { children, textValue, UNSTABLE_childItems } = props;\n yield {\n \"aria-label\": props[\"aria-label\"],\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n // this is combined with the row key by CollectionBuilder\n key: \"header-drag\",\n props: {\n isDragButtonCell: true,\n },\n type: \"cell\",\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== \"none\") {\n yield {\n // this is combined with the row key by CollectionBuilder\n key: \"header\",\n props: {\n isSelectionCell: true,\n },\n type: \"cell\",\n };\n }\n\n if (typeof children === \"function\") {\n for (const column of context.columns) {\n yield {\n element: children(column.key),\n // this is combined with the row key by CollectionBuilder\n key: column.key,\n type: \"cell\",\n };\n }\n\n if (UNSTABLE_childItems) {\n for (const child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: \"item\",\n value: child,\n };\n }\n }\n } else {\n const cells: PartialNode<T>[] = [];\n const childRows: PartialNode<T>[] = [];\n let columnCount = 0;\n\n for (const node of collectionChildren(children)) {\n if (\n isCollectionElement(node) &&\n \"type\" in node &&\n node.type === Row\n ) {\n if (cells.length < context.columns.length) {\n throw new Error(\n \"All of a Row's child Cells must be positioned before any child Rows.\"\n );\n }\n\n childRows.push({\n element: node,\n type: \"item\",\n });\n } else {\n cells.push({\n element: node,\n type: \"cell\",\n });\n const cellProps = isCollectionElement(node) ? node.props : null;\n columnCount +=\n typeof cellProps === \"object\" &&\n cellProps !== null &&\n \"colSpan\" in cellProps &&\n typeof cellProps.colSpan === \"number\"\n ? cellProps.colSpan\n : 1;\n }\n }\n\n if (columnCount !== context.columns.length) {\n throw new Error(\n `Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`\n );\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n hasChildNodes: true,\n props,\n shouldInvalidate(newContext: CollectionContext) {\n if (!isTableCollectionContext<T>(newContext)) {\n return true;\n }\n\n // Invalidate all rows if the columns changed.\n return (\n newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i]?.key) ||\n newContext.showSelectionCheckboxes !==\n context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode\n );\n },\n textValue,\n type: \"item\",\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nexport { Row };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiDA,SAAS,IAAO,OAAkC;CAChD,OAAO,OAAO,OAAO,CAAC,GAAG;EACvB,oBAAoB,YAClB,IAAI,kBAAkB,OAAO,OAAO;EACtC,IAAI,MAAM;GACR,OAAO,MAAM;EACf;EACA;EACA,MAAM;CACR,CAAC;AACH;AAEA,IAAI,oBAAoB,UAAU,kBAChC,OACA,SAC2B;CAC3B,IAAI,CAAC,yBAA4B,OAAO,GACtC,MAAM,IAAI,MAAM,uCAAuC;CAGzD,MAAM,EAAE,UAAU,WAAW,wBAAwB;CACrD,MAAM;EACJ,cAAc,MAAM;EACpB,CAAC,aAAa;GAEZ,IAAI,QAAQ,iBACV,MAAM;IAEJ,KAAK;IACL,OAAO,EACL,kBAAkB,KACpB;IACA,MAAM;GACR;GAGF,IAAI,QAAQ,2BAA2B,QAAQ,kBAAkB,QAC/D,MAAM;IAEJ,KAAK;IACL,OAAO,EACL,iBAAiB,KACnB;IACA,MAAM;GACR;GAGF,IAAI,OAAO,aAAa,YAAY;IAClC,KAAK,MAAM,UAAU,QAAQ,SAC3B,MAAM;KACJ,SAAS,SAAS,OAAO,GAAG;KAE5B,KAAK,OAAO;KACZ,MAAM;IACR;IAGF,IAAI,qBACF,KAAK,MAAM,SAAS,qBAGlB,MAAM;KACJ,MAAM;KACN,OAAO;IACT;GAGN,OAAO;IACL,MAAM,QAA0B,CAAC;IACjC,MAAM,YAA8B,CAAC;IACrC,IAAI,cAAc;IAElB,KAAK,MAAM,QAAQ,mBAAmB,QAAQ,GAC5C,IACE,oBAAoB,IAAI,KACxB,UAAU,QACV,KAAK,SAAS,KACd;KACA,IAAI,MAAM,SAAS,QAAQ,QAAQ,QACjC,MAAM,IAAI,MACR,sEACF;KAGF,UAAU,KAAK;MACb,SAAS;MACT,MAAM;KACR,CAAC;IACH,OAAO;KACL,MAAM,KAAK;MACT,SAAS;MACT,MAAM;KACR,CAAC;KACD,MAAM,YAAY,oBAAoB,IAAI,IAAI,KAAK,QAAQ;KAC3D,eACE,OAAO,cAAc,YACrB,cAAc,QACd,aAAa,aACb,OAAO,UAAU,YAAY,WACzB,UAAU,UACV;IACR;IAGF,IAAI,gBAAgB,QAAQ,QAAQ,QAClC,MAAM,IAAI,MACR,6CAA6C,YAAY,aAAa,QAAQ,QAAQ,OAAO,UAC/F;IAGF,OAAO;IACP,OAAO;GACT;EACF;EACA,eAAe;EACf;EACA,iBAAiB,YAA+B;GAC9C,IAAI,CAAC,yBAA4B,UAAU,GACzC,OAAO;GAIT,OACE,WAAW,QAAQ,WAAW,QAAQ,QAAQ,UAC9C,WAAW,QAAQ,MAAM,GAAG,MAAM,EAAE,QAAQ,QAAQ,QAAQ,EAAE,EAAE,GAAG,KACnE,WAAW,4BACT,QAAQ,2BACV,WAAW,oBAAoB,QAAQ,mBACvC,WAAW,kBAAkB,QAAQ;EAEzC;EACA;EACA,MAAM;CACR;AACF"}
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/TableBody.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { PartialNode } from "../collections/types.js";
18
+ import { RowElement } from "./row.js";
19
+ import { Element } from "solid-js";
20
+ import { AsyncLoadable, Key, LoadingState } from "@solid2-aria/types-shared";
21
+ export interface TableBodyProps<T> extends Omit<AsyncLoadable, "isLoading"> {
22
+ key?: Key;
23
+ "aria-label"?: string;
24
+ /** The contents of the table body. Supports static items or a function for dynamic rendering. */
25
+ children: RowElement<T> | RowElement<T>[] | ((item: T) => RowElement<T>);
26
+ /** A list of row objects in the table body used when dynamically rendering rows. */
27
+ items?: Iterable<T>;
28
+ /** The current loading state of the table. */
29
+ loadingState?: LoadingState;
30
+ }
31
+ declare function TableBody<T>(props: TableBodyProps<T>): Element;
32
+ declare namespace TableBody {
33
+ var getCollectionNode: <T>(props: TableBodyProps<T>) => Generator<PartialNode<T>>;
34
+ }
35
+ export { TableBody };
36
+ //# sourceMappingURL=table-body.d.ts.map
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/TableBody.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { collectionChildren } from "../collections/types.js";
18
+ import { untrack } from "solid-js";
19
+ // src/table/table-body.ts
20
+ function TableBody(props) {
21
+ return Object.assign([], {
22
+ getCollectionNode: (_context) => TableBody.getCollectionNode(props),
23
+ get key() {
24
+ return props.key;
25
+ },
26
+ props,
27
+ type: TableBody
28
+ });
29
+ }
30
+ TableBody.getCollectionNode = function* getCollectionNode(props) {
31
+ const { children, items } = untrack(() => props);
32
+ yield {
33
+ *childNodes() {
34
+ if (typeof children === "function") {
35
+ if (!items) throw new Error("props.children was a function but props.items is missing");
36
+ for (const item of items) yield {
37
+ renderer: children,
38
+ type: "item",
39
+ value: item
40
+ };
41
+ } else {
42
+ const localItems = [];
43
+ for (const item of collectionChildren(children)) localItems.push({
44
+ element: item,
45
+ type: "item"
46
+ });
47
+ yield* localItems;
48
+ }
49
+ },
50
+ hasChildNodes: true,
51
+ props,
52
+ type: "body"
53
+ };
54
+ };
55
+ export { TableBody };
56
+
57
+ //# sourceMappingURL=table-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-body.js","names":[],"sources":["../../src/table/table-body.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/table/TableBody.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type {\n AsyncLoadable,\n Key,\n LoadingState,\n} from \"@solid2-aria/types-shared\";\nimport { untrack } from \"solid-js\";\nimport type { Element as SolidElement } from \"solid-js\";\n\nimport type { PartialNode, CollectionContext } from \"../collections/types\";\nimport { collectionChildren } from \"../collections/types\";\nimport type { RowElement } from \"./row\";\n\nexport interface TableBodyProps<T> extends Omit<AsyncLoadable, \"isLoading\"> {\n key?: Key;\n \"aria-label\"?: string;\n /** The contents of the table body. Supports static items or a function for dynamic rendering. */\n children: RowElement<T> | RowElement<T>[] | ((item: T) => RowElement<T>);\n /** A list of row objects in the table body used when dynamically rendering rows. */\n items?: Iterable<T>;\n /** The current loading state of the table. */\n loadingState?: LoadingState;\n}\n\nfunction TableBody<T>(props: TableBodyProps<T>): SolidElement {\n return Object.assign([], {\n getCollectionNode: (_context: CollectionContext) =>\n TableBody.getCollectionNode(props),\n get key() {\n return props.key;\n },\n props,\n type: TableBody,\n });\n}\n\nTableBody.getCollectionNode = function* getCollectionNode<T>(\n props: TableBodyProps<T>\n): Generator<PartialNode<T>> {\n const { children, items } = untrack(() => props);\n yield {\n *childNodes() {\n if (typeof children === \"function\") {\n if (!items) {\n throw new Error(\n \"props.children was a function but props.items is missing\"\n );\n }\n\n for (const item of items) {\n yield {\n renderer: children,\n type: \"item\",\n value: item,\n };\n }\n } else {\n const localItems: PartialNode<T>[] = [];\n\n for (const item of collectionChildren(children)) {\n localItems.push({\n element: item,\n type: \"item\",\n });\n }\n\n yield* localItems;\n }\n },\n hasChildNodes: true,\n props,\n type: \"body\",\n };\n};\n\n/**\n * A TableBody is a container for the Row elements of a Table. Rows can be statically defined as\n * children, or generated dynamically using a function based on the data passed to the `items`\n * prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nexport { TableBody };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,SAAS,UAAa,OAAwC;CAC5D,OAAO,OAAO,OAAO,CAAC,GAAG;EACvB,oBAAoB,aAClB,UAAU,kBAAkB,KAAK;EACnC,IAAI,MAAM;GACR,OAAO,MAAM;EACf;EACA;EACA,MAAM;CACR,CAAC;AACH;AAEA,UAAU,oBAAoB,UAAU,kBACtC,OAC2B;CAC3B,MAAM,EAAE,UAAU,UAAU,cAAc,KAAK;CAC/C,MAAM;EACJ,CAAC,aAAa;GACZ,IAAI,OAAO,aAAa,YAAY;IAClC,IAAI,CAAC,OACH,MAAM,IAAI,MACR,0DACF;IAGF,KAAK,MAAM,QAAQ,OACjB,MAAM;KACJ,UAAU;KACV,MAAM;KACN,OAAO;IACT;GAEJ,OAAO;IACL,MAAM,aAA+B,CAAC;IAEtC,KAAK,MAAM,QAAQ,mBAAmB,QAAQ,GAC5C,WAAW,KAAK;KACd,SAAS;KACT,MAAM;IACR,CAAC;IAGH,OAAO;GACT;EACF;EACA,eAAe;EACf;EACA,MAAM;CACR;AACF"}
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/table/TableCollection.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { GridCollection, GridNode, IGridCollection } from "../grid/grid-collection.js";
18
+ import { Collection, Key, Node } from "@solid2-aria/types-shared";
19
+ export interface ITableCollection<T> extends IGridCollection<T> {
20
+ filter?: (...args: Parameters<NonNullable<Collection<GridNode<T>>["filter"]>>) => ITableCollection<T>;
21
+ /** A list of header row nodes in the table. */
22
+ headerRows: GridNode<T>[];
23
+ /** A list of column nodes in the table. */
24
+ columns: GridNode<T>[];
25
+ /**
26
+ * A set of column keys that serve as the [row
27
+ * header](https://www.w3.org/TR/wai-aria-1.1/#rowheader).
28
+ */
29
+ rowHeaderColumnKeys: Set<Key>;
30
+ /** The node that makes up the header of the table. */
31
+ head?: GridNode<T>;
32
+ /** The node that makes up the body of the table. */
33
+ body: GridNode<T>;
34
+ }
35
+ interface GridCollectionOptions {
36
+ showSelectionCheckboxes?: boolean;
37
+ showDragButtons?: boolean;
38
+ }
39
+ /** @private */
40
+ export declare function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: GridNode<T>[]): GridNode<T>[];
41
+ export declare class TableCollection<T> extends GridCollection<T> implements ITableCollection<T> {
42
+ headerRows: GridNode<T>[];
43
+ columns: GridNode<T>[];
44
+ rowHeaderColumnKeys: Set<Key>;
45
+ body: GridNode<T>;
46
+ _size: number;
47
+ constructor(nodes: Iterable<GridNode<T>>, prev?: ITableCollection<T> | null, opts?: GridCollectionOptions);
48
+ [Symbol.iterator](): IterableIterator<GridNode<T>>;
49
+ get size(): number;
50
+ getKeys(): IterableIterator<Key>;
51
+ getKeyBefore(key: Key): Key | null;
52
+ getKeyAfter(key: Key): Key | null;
53
+ getFirstKey(): Key | null;
54
+ getLastKey(): Key | null;
55
+ getItem(key: Key): GridNode<T> | null;
56
+ at(idx: number): GridNode<T> | null;
57
+ getChildren(key: Key): Iterable<GridNode<T>>;
58
+ getTextValue(key: Key): string;
59
+ }
60
+ export declare function isTableCollection<T>(collection: Collection<Node<T>>): collection is ITableCollection<T>;
61
+ export {};
62
+ //# sourceMappingURL=table-collection.d.ts.map