@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,182 @@
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/slider/useSliderState.ts.
14
+ * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 { LabelableProps, Orientation, RangeInputBase, ValueBase } from "@solid2-aria/types-shared";
18
+ export interface SliderProps<T = number | number[]> extends RangeInputBase<number>, ValueBase<T>, LabelableProps {
19
+ /**
20
+ * The orientation of the Slider.
21
+ *
22
+ * @default 'horizontal'
23
+ */
24
+ orientation?: Orientation;
25
+ /** Whether the whole Slider is disabled. */
26
+ isDisabled?: boolean;
27
+ /** Fired when the slider stops moving, due to being let go. */
28
+ onChangeEnd?: (value: T) => void;
29
+ /**
30
+ * The slider's minimum value.
31
+ *
32
+ * @default 0
33
+ */
34
+ minValue?: number;
35
+ /**
36
+ * The slider's maximum value.
37
+ *
38
+ * @default 100
39
+ */
40
+ maxValue?: number;
41
+ /**
42
+ * The slider's step value.
43
+ *
44
+ * @default 1
45
+ */
46
+ step?: number;
47
+ }
48
+ export interface SliderState {
49
+ /**
50
+ * Values managed by the slider by thumb index.
51
+ */
52
+ readonly values: number[];
53
+ /**
54
+ * The default values for each thumb.
55
+ */
56
+ readonly defaultValues: number[];
57
+ /**
58
+ * Get the value for the specified thumb.
59
+ *
60
+ * @param index
61
+ */
62
+ getThumbValue: (index: number) => number;
63
+ /**
64
+ * Sets the value for the specified thumb.
65
+ * The actual value set will be clamped and rounded according to min/max/step.
66
+ *
67
+ * @param index
68
+ * @param value
69
+ */
70
+ setThumbValue: (index: number, value: number) => void;
71
+ /**
72
+ * Sets value for the specified thumb by percent offset (between 0 and 1).
73
+ *
74
+ * @param index
75
+ * @param percent
76
+ */
77
+ setThumbPercent: (index: number, percent: number) => void;
78
+ /**
79
+ * Whether the specific thumb is being dragged.
80
+ *
81
+ * @param index
82
+ */
83
+ isThumbDragging: (index: number) => boolean;
84
+ /**
85
+ * Set is dragging on the specified thumb.
86
+ *
87
+ * @param index
88
+ * @param dragging
89
+ */
90
+ setThumbDragging: (index: number, dragging: boolean) => void;
91
+ /**
92
+ * Currently-focused thumb index.
93
+ */
94
+ readonly focusedThumb: number | undefined;
95
+ /**
96
+ * Set focused true on specified thumb. This will remove focus from
97
+ * any thumb that had it before.
98
+ *
99
+ * @param index
100
+ */
101
+ setFocusedThumb: (index: number | undefined) => void;
102
+ /**
103
+ * Returns the specified thumb's value as a percentage from 0 to 1.
104
+ *
105
+ * @param index
106
+ */
107
+ getThumbPercent: (index: number) => number;
108
+ /**
109
+ * Returns the value as a percent between the min and max of the slider.
110
+ *
111
+ * @param index
112
+ */
113
+ getValuePercent: (value: number) => number;
114
+ /**
115
+ * Returns the string label for the specified thumb's value, per props.formatOptions.
116
+ *
117
+ * @param index
118
+ */
119
+ getThumbValueLabel: (index: number) => string;
120
+ /**
121
+ * Returns the string label for the value, per props.formatOptions.
122
+ *
123
+ * @param value
124
+ */
125
+ getFormattedValue: (value?: number | number[]) => string;
126
+ /**
127
+ * Returns the min allowed value for the specified thumb.
128
+ *
129
+ * @param index
130
+ */
131
+ getThumbMinValue: (index: number) => number;
132
+ /**
133
+ * Returns the max allowed value for the specified thumb.
134
+ *
135
+ * @param index
136
+ */
137
+ getThumbMaxValue: (index: number) => number;
138
+ /**
139
+ * Converts a percent along track (between 0 and 1) to the corresponding value.
140
+ *
141
+ * @param percent
142
+ */
143
+ getPercentValue: (percent: number) => number;
144
+ /**
145
+ * Returns if the specified thumb is editable.
146
+ *
147
+ * @param index
148
+ */
149
+ isThumbEditable: (index: number) => boolean;
150
+ /**
151
+ * Set the specified thumb's editable state.
152
+ *
153
+ * @param index
154
+ * @param editable
155
+ */
156
+ setThumbEditable: (index: number, editable: boolean) => void;
157
+ /**
158
+ * Increments the value of the thumb by the step or page amount.
159
+ */
160
+ incrementThumb: (index: number, stepSize?: number) => void;
161
+ /**
162
+ * Decrements the value of the thumb by the step or page amount.
163
+ */
164
+ decrementThumb: (index: number, stepSize?: number) => void;
165
+ /**
166
+ * The step amount for the slider.
167
+ */
168
+ readonly step: number;
169
+ /**
170
+ * The page size for the slider, used to do a bigger step.
171
+ */
172
+ readonly pageSize: number;
173
+ /** The orientation of the slider. */
174
+ readonly orientation: Orientation;
175
+ /** Whether the slider is disabled. */
176
+ readonly isDisabled: boolean;
177
+ }
178
+ export interface SliderStateOptions extends SliderProps {
179
+ numberFormatter: Intl.NumberFormat;
180
+ }
181
+ export declare function createSliderState(props: SliderStateOptions): SliderState;
182
+ //# sourceMappingURL=create-slider-state.d.ts.map
@@ -0,0 +1,131 @@
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/slider/useSliderState.ts.
14
+ * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 { clamp, snapValueToStep } from "../utils/number.js";
19
+ import { createMemo, createRenderEffect, createSignal, untrack } from "solid-js";
20
+ // src/slider/create-slider-state.ts
21
+ function createSliderState(props) {
22
+ const min = () => props.minValue ?? 0;
23
+ const max = () => props.maxValue ?? 100;
24
+ const step = () => props.step ?? 1;
25
+ const restrict = (v) => {
26
+ const a = Array.isArray(v) ? v : [v];
27
+ return a.map((n, i) => snapValueToStep(n, i === 0 ? min() : a[i - 1], i === a.length - 1 ? max() : a[i + 1], step()));
28
+ };
29
+ const defaults = () => restrict(props.defaultValue ?? [min()]);
30
+ const emit = (fn, v) => fn?.(typeof props.value === "number" || typeof props.defaultValue === "number" ? v[0] ?? min() : v);
31
+ const controlledValue = createMemo(() => props.value === void 0 ? void 0 : restrict(props.value));
32
+ const [values, setValues] = createControlledSignal(controlledValue, untrack(defaults), (v) => emit(props.onChange, v));
33
+ const initialValues = untrack(values);
34
+ const [draggings, setDraggings] = createSignal([]);
35
+ const [focus, setFocus] = createSignal();
36
+ let dragging = [];
37
+ const editable = [];
38
+ let pending = initialValues;
39
+ createRenderEffect(values, (v) => {
40
+ pending = v;
41
+ });
42
+ const get = (i) => values()[i] ?? min();
43
+ const thumbMin = (i) => i === 0 ? min() : get(i - 1);
44
+ const thumbMax = (i) => i === values().length - 1 ? max() : get(i + 1);
45
+ const isEditable = (i) => editable[i] ?? true;
46
+ const update = (i, v) => {
47
+ if (props.isDisabled === true || !isEditable(i)) return;
48
+ const nextValue = snapValueToStep(v, thumbMin(i), thumbMax(i), step());
49
+ if (pending[i] === nextValue) return;
50
+ pending = pending.map((n, index) => index === i ? nextValue : n);
51
+ setValues(pending);
52
+ };
53
+ const percent = (v) => (v - min()) / (max() - min());
54
+ const percentValue = (p) => clamp(Math.round(p * (max() - min()) / step()) * step() + min(), min(), max());
55
+ const format = (v = values()) => {
56
+ const a = Array.isArray(v) ? v : [v];
57
+ const f = props.numberFormatter;
58
+ if (a.length === 0) return "";
59
+ if (a.length === 1) return f.format(a[0] ?? min());
60
+ if (a.length === 2) return f.formatRange(a[0] ?? min(), a[1] ?? max());
61
+ return new Intl.ListFormat(f.resolvedOptions().locale, { type: "unit" }).format(a.map((n) => f.format(n)));
62
+ };
63
+ return {
64
+ decrementThumb(i, s = 1) {
65
+ update(i, get(i) - Math.max(s, step()));
66
+ },
67
+ get defaultValues() {
68
+ return props.defaultValue === void 0 ? initialValues : defaults();
69
+ },
70
+ get focusedThumb() {
71
+ return focus();
72
+ },
73
+ getFormattedValue: format,
74
+ getPercentValue: percentValue,
75
+ getThumbMaxValue: thumbMax,
76
+ getThumbMinValue: thumbMin,
77
+ getThumbPercent(i) {
78
+ return percent(get(i));
79
+ },
80
+ getThumbValue: get,
81
+ getThumbValueLabel(i) {
82
+ return format(get(i));
83
+ },
84
+ getValuePercent: percent,
85
+ incrementThumb(i, s = 1) {
86
+ update(i, get(i) + Math.max(s, step()));
87
+ },
88
+ get isDisabled() {
89
+ return props.isDisabled ?? false;
90
+ },
91
+ isThumbDragging(i) {
92
+ return draggings()[i] ?? false;
93
+ },
94
+ isThumbEditable: isEditable,
95
+ get orientation() {
96
+ return props.orientation ?? "horizontal";
97
+ },
98
+ get pageSize() {
99
+ const size = (max() - min()) / 10;
100
+ return Math.max(step(), snapValueToStep(size, 0, size + step(), step()));
101
+ },
102
+ setFocusedThumb(v) {
103
+ setFocus(v);
104
+ },
105
+ setThumbDragging(i, v) {
106
+ if (props.isDisabled === true || !isEditable(i)) return;
107
+ if (v) pending = values();
108
+ const was = dragging[i];
109
+ dragging = [...dragging];
110
+ dragging[i] = v;
111
+ setDraggings(dragging);
112
+ if (was === true && !dragging.some(Boolean)) emit(props.onChangeEnd, pending);
113
+ },
114
+ setThumbEditable(i, v) {
115
+ editable[i] = v;
116
+ },
117
+ setThumbPercent(i, p) {
118
+ update(i, percentValue(p));
119
+ },
120
+ setThumbValue: update,
121
+ get step() {
122
+ return step();
123
+ },
124
+ get values() {
125
+ return values();
126
+ }
127
+ };
128
+ }
129
+ export { createSliderState };
130
+
131
+ //# sourceMappingURL=create-slider-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-slider-state.js","names":[],"sources":["../../src/slider/create-slider-state.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/slider/useSliderState.ts.\n * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 LabelableProps,\n Orientation,\n RangeInputBase,\n ValueBase,\n} from \"@solid2-aria/types-shared\";\nimport {\n createMemo,\n createRenderEffect,\n createSignal,\n untrack,\n} from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { clamp, snapValueToStep } from \"../utils/number\";\n\nexport interface SliderProps<T = number | number[]>\n extends RangeInputBase<number>, ValueBase<T>, LabelableProps {\n /**\n * The orientation of the Slider.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /** Whether the whole Slider is disabled. */\n isDisabled?: boolean;\n /** Fired when the slider stops moving, due to being let go. */\n onChangeEnd?: (value: T) => void;\n // These are duplicated from ValueBase to define defaults for the docs.\n /**\n * The slider's minimum value.\n *\n * @default 0\n */\n minValue?: number;\n /**\n * The slider's maximum value.\n *\n * @default 100\n */\n maxValue?: number;\n /**\n * The slider's step value.\n *\n * @default 1\n */\n step?: number;\n}\n\nexport interface SliderState {\n /**\n * Values managed by the slider by thumb index.\n */\n readonly values: number[];\n /**\n * The default values for each thumb.\n */\n readonly defaultValues: number[];\n /**\n * Get the value for the specified thumb.\n *\n * @param index\n */\n getThumbValue: (index: number) => number;\n\n /**\n * Sets the value for the specified thumb.\n * The actual value set will be clamped and rounded according to min/max/step.\n *\n * @param index\n * @param value\n */\n setThumbValue: (index: number, value: number) => void;\n\n /**\n * Sets value for the specified thumb by percent offset (between 0 and 1).\n *\n * @param index\n * @param percent\n */\n setThumbPercent: (index: number, percent: number) => void;\n\n /**\n * Whether the specific thumb is being dragged.\n *\n * @param index\n */\n isThumbDragging: (index: number) => boolean;\n /**\n * Set is dragging on the specified thumb.\n *\n * @param index\n * @param dragging\n */\n setThumbDragging: (index: number, dragging: boolean) => void;\n\n /**\n * Currently-focused thumb index.\n */\n readonly focusedThumb: number | undefined;\n /**\n * Set focused true on specified thumb. This will remove focus from\n * any thumb that had it before.\n *\n * @param index\n */\n setFocusedThumb: (index: number | undefined) => void;\n\n /**\n * Returns the specified thumb's value as a percentage from 0 to 1.\n *\n * @param index\n */\n getThumbPercent: (index: number) => number;\n\n /**\n * Returns the value as a percent between the min and max of the slider.\n *\n * @param index\n */\n getValuePercent: (value: number) => number;\n\n /**\n * Returns the string label for the specified thumb's value, per props.formatOptions.\n *\n * @param index\n */\n getThumbValueLabel: (index: number) => string;\n\n /**\n * Returns the string label for the value, per props.formatOptions.\n *\n * @param value\n */\n getFormattedValue: (value?: number | number[]) => string;\n\n /**\n * Returns the min allowed value for the specified thumb.\n *\n * @param index\n */\n getThumbMinValue: (index: number) => number;\n\n /**\n * Returns the max allowed value for the specified thumb.\n *\n * @param index\n */\n getThumbMaxValue: (index: number) => number;\n\n /**\n * Converts a percent along track (between 0 and 1) to the corresponding value.\n *\n * @param percent\n */\n getPercentValue: (percent: number) => number;\n\n /**\n * Returns if the specified thumb is editable.\n *\n * @param index\n */\n isThumbEditable: (index: number) => boolean;\n\n /**\n * Set the specified thumb's editable state.\n *\n * @param index\n * @param editable\n */\n setThumbEditable: (index: number, editable: boolean) => void;\n\n /**\n * Increments the value of the thumb by the step or page amount.\n */\n incrementThumb: (index: number, stepSize?: number) => void;\n /**\n * Decrements the value of the thumb by the step or page amount.\n */\n decrementThumb: (index: number, stepSize?: number) => void;\n\n /**\n * The step amount for the slider.\n */\n readonly step: number;\n\n /**\n * The page size for the slider, used to do a bigger step.\n */\n readonly pageSize: number;\n\n /** The orientation of the slider. */\n readonly orientation: Orientation;\n\n /** Whether the slider is disabled. */\n readonly isDisabled: boolean;\n}\n\nexport interface SliderStateOptions extends SliderProps {\n numberFormatter: Intl.NumberFormat;\n}\n\nexport function createSliderState(props: SliderStateOptions): SliderState {\n const min = () => props.minValue ?? 0;\n const max = () => props.maxValue ?? 100;\n const step = () => props.step ?? 1;\n\n const restrict = (v: number | number[]) => {\n const a = Array.isArray(v) ? v : [v];\n\n return a.map((n, i) =>\n snapValueToStep(\n n,\n i === 0 ? min() : a[i - 1],\n i === a.length - 1 ? max() : a[i + 1],\n step()\n )\n );\n };\n\n const defaults = () => restrict(props.defaultValue ?? [min()]);\n\n const emit = (\n fn: ((v: number | number[]) => void) | undefined,\n v: number[]\n ) =>\n fn?.(\n typeof props.value === \"number\" || typeof props.defaultValue === \"number\"\n ? (v[0] ?? min())\n : v\n );\n\n const controlledValue = createMemo(() =>\n props.value === undefined ? undefined : restrict(props.value)\n );\n\n const [values, setValues] = createControlledSignal(\n controlledValue,\n untrack(defaults),\n (v) => emit(props.onChange, v)\n );\n\n const initialValues = untrack(values);\n const [draggings, setDraggings] = createSignal<boolean[]>([]);\n const [focus, setFocus] = createSignal<number>();\n let dragging: boolean[] = [];\n const editable: boolean[] = [];\n let pending = initialValues;\n createRenderEffect(values, (v) => {\n pending = v;\n });\n const get = (i: number) => values()[i] ?? min();\n const thumbMin = (i: number) => (i === 0 ? min() : get(i - 1));\n\n const thumbMax = (i: number) =>\n i === values().length - 1 ? max() : get(i + 1);\n\n const isEditable = (i: number) => editable[i] ?? true;\n\n const update = (i: number, v: number) => {\n if (props.isDisabled === true || !isEditable(i)) {\n return;\n }\n\n const nextValue = snapValueToStep(v, thumbMin(i), thumbMax(i), step());\n\n if (pending[i] === nextValue) {\n return;\n }\n\n pending = pending.map((n, index) => (index === i ? nextValue : n));\n setValues(pending);\n };\n\n const percent = (v: number) => (v - min()) / (max() - min());\n\n const percentValue = (p: number) =>\n clamp(\n Math.round((p * (max() - min())) / step()) * step() + min(),\n min(),\n max()\n );\n\n const format = (v: number | number[] = values()) => {\n const a = Array.isArray(v) ? v : [v];\n const f = props.numberFormatter;\n\n if (a.length === 0) {\n return \"\";\n }\n\n if (a.length === 1) {\n return f.format(a[0] ?? min());\n }\n\n if (a.length === 2) {\n return f.formatRange(a[0] ?? min(), a[1] ?? max());\n }\n\n return new Intl.ListFormat(f.resolvedOptions().locale, {\n type: \"unit\",\n }).format(a.map((n) => f.format(n)));\n };\n\n return {\n decrementThumb(i, s = 1) {\n update(i, get(i) - Math.max(s, step()));\n },\n get defaultValues() {\n return props.defaultValue === undefined ? initialValues : defaults();\n },\n get focusedThumb() {\n return focus();\n },\n getFormattedValue: format,\n getPercentValue: percentValue,\n getThumbMaxValue: thumbMax,\n getThumbMinValue: thumbMin,\n getThumbPercent(i) {\n return percent(get(i));\n },\n getThumbValue: get,\n getThumbValueLabel(i) {\n return format(get(i));\n },\n getValuePercent: percent,\n incrementThumb(i, s = 1) {\n update(i, get(i) + Math.max(s, step()));\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n isThumbDragging(i) {\n return draggings()[i] ?? false;\n },\n isThumbEditable: isEditable,\n get orientation() {\n return props.orientation ?? \"horizontal\";\n },\n get pageSize() {\n const size = (max() - min()) / 10;\n\n return Math.max(step(), snapValueToStep(size, 0, size + step(), step()));\n },\n setFocusedThumb(v) {\n setFocus(v);\n },\n setThumbDragging(i, v) {\n if (props.isDisabled === true || !isEditable(i)) {\n return;\n }\n\n if (v) {\n pending = values();\n }\n\n const was = dragging[i];\n dragging = [...dragging];\n dragging[i] = v;\n setDraggings(dragging);\n\n if (was === true && !dragging.some(Boolean)) {\n emit(props.onChangeEnd, pending);\n }\n },\n setThumbEditable(i, v) {\n editable[i] = v;\n },\n setThumbPercent(i, p) {\n update(i, percentValue(p));\n },\n setThumbValue: update,\n get step() {\n return step();\n },\n get values() {\n return values();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2NA,SAAgB,kBAAkB,OAAwC;CACxE,MAAM,YAAY,MAAM,YAAY;CACpC,MAAM,YAAY,MAAM,YAAY;CACpC,MAAM,aAAa,MAAM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;EACf,mBAAmB,GAAG;GACpB,OAAO,OAAO,IAAI,CAAC,CAAC;EACtB;EACA,iBAAiB;EACjB,eAAe,GAAG,IAAI,GAAG;GACvB,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,CAAC;EACxC;EACA,IAAI,aAAa;GACf,OAAO,MAAM,cAAc;EAC7B;EACA,gBAAgB,GAAG;GACjB,OAAO,UAAU,CAAC,CAAC,MAAM;EAC3B;EACA,iBAAiB;EACjB,IAAI,cAAc;GAChB,OAAO,MAAM,eAAe;EAC9B;EACA,IAAI,WAAW;GACb,MAAM,QAAQ,IAAI,IAAI,IAAI,KAAK;GAE/B,OAAO,KAAK,IAAI,KAAK,GAAG,gBAAgB,MAAM,GAAG,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC;EACzE;EACA,gBAAgB,GAAG;GACjB,SAAS,CAAC;EACZ;EACA,iBAAiB,GAAG,GAAG;GACrB,IAAI,MAAM,eAAe,QAAQ,CAAC,WAAW,CAAC,GAC5C;GAGF,IAAI,GACF,UAAU,OAAO;GAGnB,MAAM,MAAM,SAAS;GACrB,WAAW,CAAC,GAAG,QAAQ;GACvB,SAAS,KAAK;GACd,aAAa,QAAQ;GAErB,IAAI,QAAQ,QAAQ,CAAC,SAAS,KAAK,OAAO,GACxC,KAAK,MAAM,aAAa,OAAO;EAEnC;EACA,iBAAiB,GAAG,GAAG;GACrB,SAAS,KAAK;EAChB;EACA,gBAAgB,GAAG,GAAG;GACpB,OAAO,GAAG,aAAa,CAAC,CAAC;EAC3B;EACA,eAAe;EACf,IAAI,OAAO;GACT,OAAO,KAAK;EACd;EACA,IAAI,SAAS;GACX,OAAO,OAAO;EAChB;CACF;AACF"}
@@ -0,0 +1,40 @@
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/steplist/useStepListState.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 { SingleSelectListState } from "../list/create-single-select-list-state.js";
18
+ import { CollectionBase, Key, SingleSelection } from "@solid2-aria/types-shared";
19
+ export interface StepListProps<T> extends CollectionBase<T>, Omit<SingleSelection, "onSelectionChange"> {
20
+ /** The key of the last completed step (controlled). */
21
+ lastCompletedStep?: Key;
22
+ /** The key of the initially last completed step (uncontrolled). */
23
+ defaultLastCompletedStep?: Key;
24
+ /** Callback for when the last completed step changes. */
25
+ onLastCompletedStepChange?: (key: Key | null) => void;
26
+ /** Whether the step list is disabled. Steps will not be focusable or interactive. */
27
+ isDisabled?: boolean;
28
+ /** Whether the step list is read only. Steps will be focusable but non-interactive. */
29
+ isReadOnly?: boolean;
30
+ /** Handler that is called when the selection changes. */
31
+ onSelectionChange?: (key: Key) => void;
32
+ }
33
+ export interface StepListState<T> extends SingleSelectListState<T> {
34
+ readonly lastCompletedStep?: Key;
35
+ setLastCompletedStep: (key: Key) => void;
36
+ isCompleted: (key: Key) => boolean;
37
+ isSelectable: (key: Key) => boolean;
38
+ }
39
+ export declare function createStepListState<T extends object>(props: StepListProps<T>): StepListState<T>;
40
+ //# sourceMappingURL=create-step-list-state.d.ts.map
@@ -0,0 +1,132 @@
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/steplist/useStepListState.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 { requireValue } from "../utils/require-value.js";
19
+ import { createSingleSelectListState } from "../list/create-single-select-list-state.js";
20
+ import { createMemo, createRenderEffect, merge, omit, untrack } from "solid-js";
21
+ // src/steplist/create-step-list-state.ts
22
+ function createStepListState(props) {
23
+ const state = createSingleSelectListState(merge(omit(props, "onSelectionChange"), { get onSelectionChange() {
24
+ return (key) => {
25
+ if (key !== null && key !== void 0) props.onSelectionChange?.(key);
26
+ };
27
+ } }));
28
+ const [lastCompletedStep, setLastCompletedStep] = createControlledSignal(() => props.lastCompletedStep, untrack(() => props.defaultLastCompletedStep ?? null), untrack(() => props.onLastCompletedStepChange));
29
+ const stepMaps = createMemo(() => buildKeysMaps(state.collection));
30
+ const selectedIdx = createMemo(() => state.selectedKey === null || state.selectedKey === void 0 ? 0 : stepMaps().indexMap.get(state.selectedKey));
31
+ const isCompleted = (step) => {
32
+ if (step === void 0) return false;
33
+ const completedStep = lastCompletedStep();
34
+ const indexes = stepMaps().indexMap;
35
+ const stepIndex = step === null ? void 0 : indexes.get(step);
36
+ const completedIndex = completedStep === null ? void 0 : indexes.get(completedStep);
37
+ return stepIndex !== void 0 && completedIndex !== void 0 && stepIndex <= completedIndex;
38
+ };
39
+ const findDefaultSelectedKey = (collection, disabledKeys) => {
40
+ let selectedKey = null;
41
+ if (collection && collection.size > 0) {
42
+ selectedKey = collection.getFirstKey();
43
+ while (selectedKey !== collection.getLastKey() && selectedKey !== null && selectedKey !== void 0 && (disabledKeys.has(selectedKey) || isCompleted(selectedKey))) selectedKey = collection.getKeyAfter(selectedKey);
44
+ }
45
+ return selectedKey;
46
+ };
47
+ createRenderEffect(() => {
48
+ const manager = state.selectionManager;
49
+ let { selectedKey } = state;
50
+ let replaceSelection = false;
51
+ if (manager.isEmpty || selectedKey === null || !state.collection.getItem(selectedKey)) {
52
+ selectedKey = findDefaultSelectedKey(state.collection, state.disabledKeys);
53
+ replaceSelection = selectedKey !== null;
54
+ }
55
+ const completedKey = lastCompletedStep();
56
+ const maps = stepMaps();
57
+ const lastCompletedIndex = (completedKey === null ? -1 : maps.indexMap.get(completedKey)) ?? -1;
58
+ const index = selectedIdx();
59
+ let completedStep;
60
+ if (index !== void 0 && index > 0 && index > lastCompletedIndex + 1 && selectedKey !== null && maps.keysLinkedList.has(selectedKey)) completedStep = requireValue(maps.keysLinkedList.get(selectedKey), "Expected the selected step to have a preceding step.");
61
+ return {
62
+ completedStep,
63
+ manager,
64
+ replaceSelection,
65
+ selectedKey,
66
+ updateFocus: manager.focusedKey === null
67
+ };
68
+ }, ({ completedStep, manager, replaceSelection, selectedKey, updateFocus }) => {
69
+ if (replaceSelection && selectedKey !== null) untrack(() => {
70
+ manager.replaceSelection(selectedKey);
71
+ });
72
+ if (updateFocus) untrack(() => {
73
+ manager.setFocusedKey(selectedKey);
74
+ });
75
+ if (completedStep !== void 0) setLastCompletedStep(completedStep);
76
+ });
77
+ function isSelectable(step) {
78
+ if (props.isDisabled === true || state.disabledKeys.has(step) || props.isReadOnly === true) return false;
79
+ if (isCompleted(step)) return true;
80
+ const prevStep = stepMaps().keysLinkedList.get(step);
81
+ return isCompleted(prevStep) || step === state.collection.getFirstKey();
82
+ }
83
+ function setSelectedKey(key) {
84
+ if (key === null) {
85
+ state.setSelectedKey(null);
86
+ return;
87
+ }
88
+ const prevKey = stepMaps().keysLinkedList.get(key);
89
+ if (prevKey !== null && prevKey !== void 0 && !isCompleted(prevKey)) setLastCompletedStep(prevKey);
90
+ state.setSelectedKey(key);
91
+ }
92
+ return merge(state, {
93
+ get isCompleted() {
94
+ return isCompleted;
95
+ },
96
+ get isSelectable() {
97
+ return isSelectable;
98
+ },
99
+ get lastCompletedStep() {
100
+ return lastCompletedStep() ?? void 0;
101
+ },
102
+ get setLastCompletedStep() {
103
+ return setLastCompletedStep;
104
+ },
105
+ get setSelectedKey() {
106
+ return setSelectedKey;
107
+ }
108
+ });
109
+ }
110
+ function buildKeysMaps(coll) {
111
+ const indexMap = /* @__PURE__ */ new Map();
112
+ const keysLinkedList = /* @__PURE__ */ new Map();
113
+ let i = 0;
114
+ let prev;
115
+ for (const item of coll) {
116
+ indexMap.set(item.key, i);
117
+ keysLinkedList.set(item.key, prev?.key);
118
+ prev = item;
119
+ i += 1;
120
+ }
121
+ return {
122
+ get indexMap() {
123
+ return indexMap;
124
+ },
125
+ get keysLinkedList() {
126
+ return keysLinkedList;
127
+ }
128
+ };
129
+ }
130
+ export { createStepListState };
131
+
132
+ //# sourceMappingURL=create-step-list-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-step-list-state.js","names":[],"sources":["../../src/steplist/create-step-list-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/steplist/useStepListState.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 Collection,\n CollectionBase,\n Key,\n Node,\n SingleSelection,\n} from \"@solid2-aria/types-shared\";\nimport { createMemo, createRenderEffect, merge, untrack, omit } from \"solid-js\";\n\nimport { createSingleSelectListState } from \"../list/create-single-select-list-state\";\nimport type { SingleSelectListState } from \"../list/create-single-select-list-state\";\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { requireValue } from \"../utils/require-value\";\n\nexport interface StepListProps<T>\n extends CollectionBase<T>, Omit<SingleSelection, \"onSelectionChange\"> {\n /** The key of the last completed step (controlled). */\n lastCompletedStep?: Key;\n /** The key of the initially last completed step (uncontrolled). */\n defaultLastCompletedStep?: Key;\n /** Callback for when the last completed step changes. */\n onLastCompletedStepChange?: (key: Key | null) => void;\n /** Whether the step list is disabled. Steps will not be focusable or interactive. */\n isDisabled?: boolean;\n /** Whether the step list is read only. Steps will be focusable but non-interactive. */\n isReadOnly?: boolean;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (key: Key) => void;\n}\n\nexport interface StepListState<T> extends SingleSelectListState<T> {\n readonly lastCompletedStep?: Key;\n setLastCompletedStep: (key: Key) => void;\n isCompleted: (key: Key) => boolean;\n isSelectable: (key: Key) => boolean;\n}\n\nexport function createStepListState<T extends object>(\n props: StepListProps<T>\n): StepListState<T> {\n const state = createSingleSelectListState<T>(\n merge(omit(props, \"onSelectionChange\"), {\n get onSelectionChange() {\n return (key: Key | null) => {\n if (key !== null && key !== undefined) {\n props.onSelectionChange?.(key);\n }\n };\n },\n })\n );\n\n const [lastCompletedStep, setLastCompletedStep] =\n createControlledSignal<Key | null>(\n () => props.lastCompletedStep,\n untrack(() => props.defaultLastCompletedStep ?? null),\n untrack(() => props.onLastCompletedStepChange)\n );\n\n const stepMaps = createMemo(() => buildKeysMaps(state.collection));\n\n const selectedIdx = createMemo(() =>\n state.selectedKey === null || state.selectedKey === undefined\n ? 0\n : stepMaps().indexMap.get(state.selectedKey)\n );\n\n const isCompleted = (step: Key | null | undefined) => {\n if (step === undefined) {\n return false;\n }\n\n const completedStep = lastCompletedStep();\n const indexes = stepMaps().indexMap;\n const stepIndex = step === null ? undefined : indexes.get(step);\n\n const completedIndex =\n completedStep === null ? undefined : indexes.get(completedStep);\n\n return (\n stepIndex !== undefined &&\n completedIndex !== undefined &&\n stepIndex <= completedIndex\n );\n };\n\n const findDefaultSelectedKey = (\n collection: Collection<Node<T>> | null,\n disabledKeys: Set<Key>\n ) => {\n let selectedKey: Key | null = null;\n\n if (collection && collection.size > 0) {\n selectedKey = collection.getFirstKey();\n\n // loop over keys until we find one that isn't completed or disabled and select that\n while (\n selectedKey !== collection.getLastKey() &&\n selectedKey !== null &&\n selectedKey !== undefined &&\n (disabledKeys.has(selectedKey) || isCompleted(selectedKey))\n ) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n }\n\n return selectedKey;\n };\n\n createRenderEffect(\n () => {\n const manager = state.selectionManager;\n let { selectedKey } = state;\n let replaceSelection = false;\n\n if (\n manager.isEmpty ||\n selectedKey === null ||\n !state.collection.getItem(selectedKey)\n ) {\n selectedKey = findDefaultSelectedKey(\n state.collection,\n state.disabledKeys\n );\n replaceSelection = selectedKey !== null;\n }\n\n const completedKey = lastCompletedStep();\n const maps = stepMaps();\n\n const lastCompletedIndex =\n (completedKey === null ? -1 : maps.indexMap.get(completedKey)) ?? -1;\n\n const index = selectedIdx();\n let completedStep: Key | undefined;\n\n if (\n index !== undefined &&\n index > 0 &&\n index > lastCompletedIndex + 1 &&\n selectedKey !== null &&\n maps.keysLinkedList.has(selectedKey)\n ) {\n completedStep = requireValue(\n maps.keysLinkedList.get(selectedKey),\n \"Expected the selected step to have a preceding step.\"\n );\n }\n\n return {\n completedStep,\n manager,\n replaceSelection,\n selectedKey,\n updateFocus: manager.focusedKey === null,\n };\n },\n ({\n completedStep,\n manager,\n replaceSelection,\n selectedKey,\n updateFocus,\n }) => {\n if (replaceSelection && selectedKey !== null) {\n untrack(() => {\n manager.replaceSelection(selectedKey);\n });\n }\n\n if (updateFocus) {\n untrack(() => {\n manager.setFocusedKey(selectedKey);\n });\n }\n\n if (completedStep !== undefined) {\n setLastCompletedStep(completedStep);\n }\n }\n );\n\n function isSelectable(step: Key) {\n if (\n props.isDisabled === true ||\n state.disabledKeys.has(step) ||\n props.isReadOnly === true\n ) {\n return false;\n }\n\n if (isCompleted(step)) {\n return true;\n }\n\n const prevStep = stepMaps().keysLinkedList.get(step);\n\n return isCompleted(prevStep) || step === state.collection.getFirstKey();\n }\n\n function setSelectedKey(key: Key | null) {\n if (key === null) {\n state.setSelectedKey(null);\n\n return;\n }\n\n const prevKey = stepMaps().keysLinkedList.get(key);\n\n if (prevKey !== null && prevKey !== undefined && !isCompleted(prevKey)) {\n setLastCompletedStep(prevKey);\n }\n\n state.setSelectedKey(key);\n }\n\n return merge(state, {\n get isCompleted() {\n return isCompleted;\n },\n get isSelectable() {\n return isSelectable;\n },\n get lastCompletedStep() {\n return lastCompletedStep() ?? undefined;\n },\n get setLastCompletedStep() {\n return setLastCompletedStep;\n },\n get setSelectedKey() {\n return setSelectedKey;\n },\n });\n}\n\nfunction buildKeysMaps<T>(coll: Collection<Node<T>>) {\n const indexMap = new Map<Key, number>();\n const keysLinkedList = new Map<Key, Key | undefined>();\n let i = 0;\n let prev;\n\n for (const item of coll) {\n indexMap.set(item.key, i);\n keysLinkedList.set(item.key, prev?.key);\n prev = item;\n i += 1;\n }\n\n return {\n get indexMap() {\n return indexMap;\n },\n get keysLinkedList() {\n return keysLinkedList;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,oBACd,OACkB;CAClB,MAAM,QAAQ,4BACZ,MAAM,KAAK,OAAO,mBAAmB,GAAG,EACtC,IAAI,oBAAoB;EACtB,QAAQ,QAAoB;GAC1B,IAAI,QAAQ,QAAQ,QAAQ,KAAA,GAC1B,MAAM,oBAAoB,GAAG;EAEjC;CACF,EACF,CAAC,CACH;CAEA,MAAM,CAAC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C;AACH;AAEA,SAAS,cAAiB,MAA2B;CACnD,MAAM,2BAAW,IAAI,IAAiB;CACtC,MAAM,iCAAiB,IAAI,IAA0B;CACrD,IAAI,IAAI;CACR,IAAI;CAEJ,KAAK,MAAM,QAAQ,MAAM;EACvB,SAAS,IAAI,KAAK,KAAK,CAAC;EACxB,eAAe,IAAI,KAAK,KAAK,MAAM,GAAG;EACtC,OAAO;EACP,KAAK;CACP;CAEA,OAAO;EACL,IAAI,WAAW;GACb,OAAO;EACT;EACA,IAAI,iBAAiB;GACnB,OAAO;EACT;CACF;AACF"}
@@ -0,0 +1,37 @@
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/Cell.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 { Element } from "solid-js";
19
+ import { Key } from "@solid2-aria/types-shared";
20
+ export interface CellProps {
21
+ key?: Key;
22
+ "aria-label"?: string;
23
+ /** The contents of the cell. */
24
+ children: Element;
25
+ /** A string representation of the cell's contents, used for features like typeahead. */
26
+ textValue?: string;
27
+ /** Indicates how many columns the data cell spans. */
28
+ colSpan?: number;
29
+ }
30
+ export type CellElement = Element;
31
+ export type CellRenderer = (columnKey: Key) => CellElement;
32
+ declare function Cell(props: CellProps): Element;
33
+ declare namespace Cell {
34
+ var getCollectionNode: <T>(props: CellProps) => Generator<PartialNode<T>>;
35
+ }
36
+ export { Cell };
37
+ //# sourceMappingURL=cell.d.ts.map
@@ -0,0 +1,47 @@
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/Cell.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 { untrack } from "solid-js";
18
+ // src/table/cell.ts
19
+ function Cell(props) {
20
+ return Object.assign([], {
21
+ getCollectionNode: (_context) => Cell.getCollectionNode(props),
22
+ get key() {
23
+ return props.key;
24
+ },
25
+ props,
26
+ type: Cell
27
+ });
28
+ }
29
+ Cell.getCollectionNode = function* getCollectionNode(props) {
30
+ const { children } = untrack(() => props);
31
+ let textValue = untrack(() => props["aria-label"]) ?? "";
32
+ if (typeof children === "string" && children !== "") textValue = children;
33
+ if (untrack(() => props.textValue) !== void 0 && untrack(() => props.textValue) !== "") textValue = untrack(() => props.textValue) ?? "";
34
+ yield {
35
+ get "aria-label"() {
36
+ return props["aria-label"];
37
+ },
38
+ hasChildNodes: false,
39
+ props,
40
+ rendered: children,
41
+ textValue,
42
+ type: "cell"
43
+ };
44
+ };
45
+ export { Cell };
46
+
47
+ //# sourceMappingURL=cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.js","names":[],"sources":["../../src/table/cell.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/Cell.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 } from \"@solid2-aria/types-shared\";\nimport { untrack } from \"solid-js\";\nimport type { Element as SolidElement } from \"solid-js\";\n\nimport type { CollectionContext, PartialNode } from \"../collections/types\";\n\nexport interface CellProps {\n key?: Key;\n \"aria-label\"?: string;\n /** The contents of the cell. */\n children: SolidElement;\n /** A string representation of the cell's contents, used for features like typeahead. */\n textValue?: string;\n /** Indicates how many columns the data cell spans. */\n colSpan?: number;\n}\n\nexport type CellElement = SolidElement;\n\nexport type CellRenderer = (columnKey: Key) => CellElement;\n\nfunction Cell(props: CellProps): SolidElement {\n return Object.assign([], {\n getCollectionNode: (_context: CollectionContext) =>\n Cell.getCollectionNode(props),\n get key() {\n return props.key;\n },\n props,\n type: Cell,\n });\n}\n\nCell.getCollectionNode = function* getCollectionNode<T>(\n props: CellProps\n): Generator<PartialNode<T>> {\n const { children } = untrack(() => props);\n\n let textValue = untrack(() => props[\"aria-label\"]) ?? \"\";\n\n if (typeof children === \"string\" && children !== \"\") {\n textValue = children;\n }\n\n if (\n untrack(() => props.textValue) !== undefined &&\n untrack(() => props.textValue) !== \"\"\n ) {\n textValue = untrack(() => props.textValue) ?? \"\";\n }\n\n yield {\n get \"aria-label\"() {\n return props[\"aria-label\"];\n },\n hasChildNodes: false,\n props,\n rendered: children,\n textValue,\n type: \"cell\",\n };\n};\n\n/**\n * A Cell represents the value of a single Column within a Table Row.\n */\n// We don't want getCollectionNode to show up in the type definition\nexport { Cell };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,SAAS,KAAK,OAAgC;CAC5C,OAAO,OAAO,OAAO,CAAC,GAAG;EACvB,oBAAoB,aAClB,KAAK,kBAAkB,KAAK;EAC9B,IAAI,MAAM;GACR,OAAO,MAAM;EACf;EACA;EACA,MAAM;CACR,CAAC;AACH;AAEA,KAAK,oBAAoB,UAAU,kBACjC,OAC2B;CAC3B,MAAM,EAAE,aAAa,cAAc,KAAK;CAExC,IAAI,YAAY,cAAc,MAAM,aAAa,KAAK;CAEtD,IAAI,OAAO,aAAa,YAAY,aAAa,IAC/C,YAAY;CAGd,IACE,cAAc,MAAM,SAAS,MAAM,KAAA,KACnC,cAAc,MAAM,SAAS,MAAM,IAEnC,YAAY,cAAc,MAAM,SAAS,KAAK;CAGhD,MAAM;EACJ,IAAI,eAAe;GACjB,OAAO,MAAM;EACf;EACA,eAAe;EACf;EACA,UAAU;EACV;EACA,MAAM;CACR;AACF"}
@@ -0,0 +1,4 @@
1
+
2
+ import { CollectionBuilderContext } from "./create-table-state.js";
3
+ export declare function isTableCollectionContext<T>(context: unknown): context is CollectionBuilderContext<T>;
4
+ //# sourceMappingURL=collection-context.d.ts.map
@@ -0,0 +1,8 @@
1
+
2
+ // src/table/collection-context.ts
3
+ function isTableCollectionContext(context) {
4
+ return typeof context === "object" && context !== null && "columns" in context && Array.isArray(context.columns) && "selectionMode" in context && (context.selectionMode === "none" || context.selectionMode === "single" || context.selectionMode === "multiple") && "showSelectionCheckboxes" in context && typeof context.showSelectionCheckboxes === "boolean" && "showDragButtons" in context && typeof context.showDragButtons === "boolean";
5
+ }
6
+ export { isTableCollectionContext };
7
+
8
+ //# sourceMappingURL=collection-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-context.js","names":[],"sources":["../../src/table/collection-context.ts"],"sourcesContent":["import type { CollectionBuilderContext } from \"./create-table-state\";\n\nexport function isTableCollectionContext<T>(\n context: unknown\n): context is CollectionBuilderContext<T> {\n return (\n typeof context === \"object\" &&\n context !== null &&\n \"columns\" in context &&\n Array.isArray(context.columns) &&\n \"selectionMode\" in context &&\n (context.selectionMode === \"none\" ||\n context.selectionMode === \"single\" ||\n context.selectionMode === \"multiple\") &&\n \"showSelectionCheckboxes\" in context &&\n typeof context.showSelectionCheckboxes === \"boolean\" &&\n \"showDragButtons\" in context &&\n typeof context.showDragButtons === \"boolean\"\n );\n}\n"],"mappings":";;AAEA,SAAgB,yBACd,SACwC;CACxC,OACE,OAAO,YAAY,YACnB,YAAY,QACZ,aAAa,WACb,MAAM,QAAQ,QAAQ,OAAO,KAC7B,mBAAmB,YAClB,QAAQ,kBAAkB,UACzB,QAAQ,kBAAkB,YAC1B,QAAQ,kBAAkB,eAC5B,6BAA6B,WAC7B,OAAO,QAAQ,4BAA4B,aAC3C,qBAAqB,WACrB,OAAO,QAAQ,oBAAoB;AAEvC"}