@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,364 @@
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/data/useTreeData.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { getItemKey } from "../utils/get-item-key.js";
18
+ import { createMemo, createSignal, untrack } from "solid-js";
19
+ // src/data/create-tree-data.ts
20
+ /**
21
+ * Manages state for an immutable tree data structure, and provides convenience methods to
22
+ * update the data over time.
23
+ */
24
+ function createTreeData(options) {
25
+ const initialItems = createMemo(() => options.initialItems ?? []);
26
+ const initialSelectedKeys = createMemo(() => options.initialSelectedKeys);
27
+ const getKey = createMemo(() => options.getKey ?? getItemKey);
28
+ const getChildren = createMemo(() => options.getChildren ?? ((item) => {
29
+ const children = "children" in item ? item.children : void 0;
30
+ return Array.isArray(children) ? children : [];
31
+ }));
32
+ const [tree, commitTree] = createSignal(untrack(() => (() => {
33
+ return buildTree(initialItems(), /* @__PURE__ */ new Map());
34
+ })()), { ownedWrite: true });
35
+ let pendingTree = untrack(tree);
36
+ const setItems = (update) => {
37
+ pendingTree = typeof update === "function" ? update(pendingTree) : update;
38
+ commitTree(pendingTree);
39
+ };
40
+ const derived1 = createMemo(() => tree());
41
+ const items = createMemo(() => {
42
+ return derived1().items;
43
+ });
44
+ const [selectedKeys, commitSelectedKeys] = createSignal(untrack(() => {
45
+ const currentInitialSelectedKeys = initialSelectedKeys();
46
+ return new Set(currentInitialSelectedKeys);
47
+ }), { ownedWrite: true });
48
+ let pendingSelectedKeys = untrack(selectedKeys);
49
+ const setSelectedKeys = (keys) => {
50
+ pendingSelectedKeys = keys;
51
+ commitSelectedKeys(keys);
52
+ };
53
+ function buildTree(initialInitialItems, map, parentKey) {
54
+ let localInitialItems = initialInitialItems;
55
+ localInitialItems ??= [];
56
+ return {
57
+ items: localInitialItems.map((item) => {
58
+ const currentGetKey = getKey();
59
+ const currentGetChildren = getChildren();
60
+ const node = {
61
+ children: null,
62
+ key: currentGetKey(item),
63
+ parentKey: parentKey ?? null,
64
+ value: item
65
+ };
66
+ node.children = buildTree(currentGetChildren(item), map, node.key).items;
67
+ map.set(node.key, node);
68
+ return node;
69
+ }),
70
+ nodeMap: map
71
+ };
72
+ }
73
+ function updateTree(localInitialItems, key, update, originalMap) {
74
+ const localItems = localInitialItems;
75
+ let node = key === null || key === void 0 ? null : originalMap.get(key);
76
+ if (node === null || node === void 0) return {
77
+ items: localItems,
78
+ nodeMap: originalMap
79
+ };
80
+ const map = new Map(originalMap);
81
+ let newNode = update(node);
82
+ if (newNode === null || newNode === void 0) deleteNode(node, map);
83
+ else addNode(newNode, map);
84
+ while (node.parentKey !== null && node.parentKey !== void 0) {
85
+ const nextParent = map.get(node.parentKey);
86
+ if (!nextParent) throw new Error(`Missing parent node: ${node.parentKey}`);
87
+ const copy = {
88
+ children: null,
89
+ key: nextParent.key,
90
+ parentKey: nextParent.parentKey,
91
+ value: nextParent.value
92
+ };
93
+ const previousNode = node;
94
+ const replacement = newNode;
95
+ copy.children = nextParent.children?.flatMap((child) => {
96
+ if (child !== previousNode) return [child];
97
+ return replacement === null ? [] : [replacement];
98
+ }) ?? null;
99
+ map.set(copy.key, copy);
100
+ newNode = copy;
101
+ node = nextParent;
102
+ }
103
+ const rootNode = node;
104
+ const rootReplacement = newNode;
105
+ return {
106
+ items: localItems.flatMap((item) => {
107
+ if (item !== rootNode) return [item];
108
+ return rootReplacement === null ? [] : [rootReplacement];
109
+ }),
110
+ nodeMap: map
111
+ };
112
+ }
113
+ function addNode(node, map) {
114
+ map.set(node.key, node);
115
+ if (node.children) for (const child of node.children) addNode(child, map);
116
+ }
117
+ function deleteNode(node, map) {
118
+ map.delete(node.key);
119
+ if (node.children) for (const child of node.children) deleteNode(child, map);
120
+ }
121
+ return {
122
+ append(parentKey, ...values) {
123
+ const currentItems = pendingTree.items;
124
+ const currentNodeMap = pendingTree.nodeMap;
125
+ if (parentKey === null || parentKey === void 0) this.insert(null, currentItems.length, ...values);
126
+ else {
127
+ const parentNode = currentNodeMap.get(parentKey);
128
+ if (!parentNode) return;
129
+ this.insert(parentKey, parentNode.children?.length ?? 0, ...values);
130
+ }
131
+ },
132
+ getItem(key) {
133
+ return pendingTree.nodeMap.get(key);
134
+ },
135
+ insert(parentKey, index, ...values) {
136
+ setItems(({ items: localItems, nodeMap: originalMap }) => {
137
+ const { items: newNodes, nodeMap: newMap } = buildTree(values, new Map(originalMap), parentKey);
138
+ if (parentKey === null || parentKey === void 0) return {
139
+ items: [
140
+ ...localItems.slice(0, index),
141
+ ...newNodes,
142
+ ...localItems.slice(index)
143
+ ],
144
+ nodeMap: newMap
145
+ };
146
+ return updateTree(localItems, parentKey, (parentNode) => ({
147
+ children: [
148
+ ...(parentNode.children ?? []).slice(0, index),
149
+ ...newNodes,
150
+ ...(parentNode.children ?? []).slice(index)
151
+ ],
152
+ key: parentNode.key,
153
+ parentKey: parentNode.parentKey,
154
+ value: parentNode.value
155
+ }), newMap);
156
+ });
157
+ },
158
+ insertAfter(key, ...values) {
159
+ const currentNodeMap = pendingTree.nodeMap;
160
+ const currentItems = pendingTree.items;
161
+ const node = currentNodeMap.get(key);
162
+ if (!node) return;
163
+ const parentNode = node.parentKey === null || node.parentKey === void 0 ? void 0 : currentNodeMap.get(node.parentKey);
164
+ const index = (parentNode?.children ?? currentItems).indexOf(node);
165
+ this.insert(parentNode?.key ?? null, index + 1, ...values);
166
+ },
167
+ insertBefore(key, ...values) {
168
+ const currentNodeMap = pendingTree.nodeMap;
169
+ const currentItems = pendingTree.items;
170
+ const node = currentNodeMap.get(key);
171
+ if (!node) return;
172
+ const parentNode = node.parentKey === null || node.parentKey === void 0 ? void 0 : currentNodeMap.get(node.parentKey);
173
+ const index = (parentNode?.children ?? currentItems).indexOf(node);
174
+ this.insert(parentNode?.key ?? null, index, ...values);
175
+ },
176
+ get items() {
177
+ return items();
178
+ },
179
+ move(key, toParentKey, index) {
180
+ setItems(({ items: localItems, nodeMap: originalMap }) => {
181
+ let current = toParentKey;
182
+ while (current !== null && current !== void 0) {
183
+ if (current === key) throw new Error("Cannot move an item to be a child of itself.");
184
+ current = originalMap.get(current)?.parentKey ?? null;
185
+ }
186
+ const node = originalMap.get(key);
187
+ if (!node) return {
188
+ items: localItems,
189
+ nodeMap: originalMap
190
+ };
191
+ const { items: newItems, nodeMap: newMap } = updateTree(localItems, key, () => null, originalMap);
192
+ const movedNode = {
193
+ ...node,
194
+ parentKey: toParentKey
195
+ };
196
+ if (toParentKey === null || toParentKey === void 0) {
197
+ addNode(movedNode, newMap);
198
+ return {
199
+ items: [
200
+ ...newItems.slice(0, index),
201
+ movedNode,
202
+ ...newItems.slice(index)
203
+ ],
204
+ nodeMap: newMap
205
+ };
206
+ }
207
+ return updateTree(newItems, toParentKey, (parentNode) => ({
208
+ children: [
209
+ ...(parentNode.children ?? []).slice(0, index),
210
+ movedNode,
211
+ ...(parentNode.children ?? []).slice(index)
212
+ ],
213
+ key: parentNode.key,
214
+ parentKey: parentNode.parentKey,
215
+ value: parentNode.value
216
+ }), newMap);
217
+ });
218
+ },
219
+ moveAfter(key, keys) {
220
+ setItems((prevState) => {
221
+ const { items: localItems, nodeMap } = prevState;
222
+ const node = nodeMap.get(key);
223
+ if (!node) return prevState;
224
+ const toParentKey = node.parentKey ?? null;
225
+ let parent = null;
226
+ if (toParentKey !== null && toParentKey !== void 0) parent = nodeMap.get(toParentKey) ?? null;
227
+ let toIndex = parent?.children ? parent.children.indexOf(node) : localItems.indexOf(node);
228
+ toIndex += 1;
229
+ return moveItems(prevState, keys, parent, toIndex, updateTree, addNode);
230
+ });
231
+ },
232
+ moveBefore(key, keys) {
233
+ setItems((prevState) => {
234
+ const { items: localItems, nodeMap } = prevState;
235
+ const node = nodeMap.get(key);
236
+ if (!node) return prevState;
237
+ const toParentKey = node.parentKey ?? null;
238
+ let parent = null;
239
+ if (toParentKey !== null && toParentKey !== void 0) parent = nodeMap.get(toParentKey) ?? null;
240
+ const toIndex = parent?.children ? parent.children.indexOf(node) : localItems.indexOf(node);
241
+ return moveItems(prevState, keys, parent, toIndex, updateTree, addNode);
242
+ });
243
+ },
244
+ prepend(parentKey, ...values) {
245
+ this.insert(parentKey, 0, ...values);
246
+ },
247
+ remove(...keys) {
248
+ const currentItems = pendingTree.items;
249
+ const currentNodeMap = pendingTree.nodeMap;
250
+ const currentSelectedKeys = pendingSelectedKeys;
251
+ if (keys.length === 0) return;
252
+ let newItems = currentItems;
253
+ let prevMap = currentNodeMap;
254
+ let newTree = {
255
+ items: newItems,
256
+ nodeMap: prevMap
257
+ };
258
+ for (const key of keys) {
259
+ newTree = updateTree(newItems, key, () => null, prevMap);
260
+ prevMap = newTree.nodeMap;
261
+ newItems = newTree.items;
262
+ }
263
+ setItems(newTree);
264
+ const selection = new Set(currentSelectedKeys);
265
+ for (const key of currentSelectedKeys) if (!newTree.nodeMap.has(key)) selection.delete(key);
266
+ setSelectedKeys(selection);
267
+ },
268
+ removeSelectedItems() {
269
+ const currentSelectedKeys = pendingSelectedKeys;
270
+ this.remove(...currentSelectedKeys);
271
+ },
272
+ get selectedKeys() {
273
+ return selectedKeys();
274
+ },
275
+ setSelectedKeys,
276
+ update(oldKey, newValue) {
277
+ setItems(({ items: localItems, nodeMap: originalMap }) => updateTree(localItems, oldKey, (oldNode) => {
278
+ const currentGetChildren = getChildren();
279
+ const node = {
280
+ children: null,
281
+ key: oldNode.key,
282
+ parentKey: oldNode.parentKey,
283
+ value: newValue
284
+ };
285
+ node.children = buildTree(currentGetChildren(newValue), originalMap, node.key).items;
286
+ return node;
287
+ }, originalMap));
288
+ }
289
+ };
290
+ }
291
+ function moveItems(state, keys, toParent, initialToIndex, updateTree, addNode) {
292
+ let toIndex = initialToIndex;
293
+ const { items, nodeMap } = state;
294
+ let parent = toParent;
295
+ const removeKeys = new Set(keys);
296
+ while (parent !== null && parent !== void 0) {
297
+ if (removeKeys.has(parent.key)) throw new Error("Cannot move an item to be a child of itself.");
298
+ parent = parent.parentKey === null || parent.parentKey === void 0 ? null : nodeMap.get(parent.parentKey) ?? null;
299
+ }
300
+ const originalToIndex = toIndex;
301
+ const keyArray = new Set(keys);
302
+ const inOrderKeys = /* @__PURE__ */ new Map();
303
+ const removedItems = [];
304
+ let newItems = items;
305
+ let newMap = nodeMap;
306
+ let i = 0;
307
+ function traversal(node, { inorder: localInorder, postorder: localPostorder }) {
308
+ if (node === null || "key" in node) localInorder?.(node);
309
+ if (node !== null && node !== void 0) for (const child of node.children ?? []) {
310
+ traversal(child, {
311
+ inorder: localInorder,
312
+ postorder: localPostorder
313
+ });
314
+ localPostorder?.(child);
315
+ }
316
+ }
317
+ function inorder(child) {
318
+ if (child && keyArray.has(child.key)) {
319
+ inOrderKeys.set(child.key, i);
320
+ i += 1;
321
+ }
322
+ }
323
+ function postorder(child) {
324
+ if (Boolean(child) && keyArray.has(child.key)) {
325
+ removedItems.push({
326
+ ...newMap.get(child.key) ?? child,
327
+ parentKey: toParent?.key ?? null
328
+ });
329
+ const { items: nextItems, nodeMap: nextMap } = updateTree(newItems, child.key, () => null, newMap);
330
+ newItems = nextItems;
331
+ newMap = nextMap;
332
+ }
333
+ if ((child.parentKey === toParent || child.parentKey === toParent?.key) && keyArray.has(child.key) && (toParent?.children ? toParent.children.indexOf(child) : items.indexOf(child)) < originalToIndex) toIndex -= 1;
334
+ }
335
+ traversal({ children: items }, {
336
+ inorder,
337
+ postorder
338
+ });
339
+ const inOrderItems = removedItems.toSorted((a, b) => (inOrderKeys.get(a.key) ?? 0) > (inOrderKeys.get(b.key) ?? 0) ? 1 : -1);
340
+ if (!toParent || toParent.key === null || toParent.key === void 0) {
341
+ for (const movedNode of inOrderItems) addNode(movedNode, newMap);
342
+ return {
343
+ items: [
344
+ ...newItems.slice(0, toIndex),
345
+ ...inOrderItems,
346
+ ...newItems.slice(toIndex)
347
+ ],
348
+ nodeMap: newMap
349
+ };
350
+ }
351
+ return updateTree(newItems, toParent.key, (parentNode) => ({
352
+ children: [
353
+ ...(parentNode.children ?? []).slice(0, toIndex),
354
+ ...inOrderItems,
355
+ ...(parentNode.children ?? []).slice(toIndex)
356
+ ],
357
+ key: parentNode.key,
358
+ parentKey: parentNode.parentKey,
359
+ value: parentNode.value
360
+ }), newMap);
361
+ }
362
+ export { createTreeData };
363
+
364
+ //# sourceMappingURL=create-tree-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-tree-data.js","names":[],"sources":["../../src/data/create-tree-data.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/data/useTreeData.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { createMemo, createSignal, untrack } from \"solid-js\";\n\nimport { getItemKey } from \"../utils/get-item-key\";\n\nexport interface TreeOptions<T extends object> {\n /** Initial root items in the tree. */\n initialItems?: T[];\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>;\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key;\n /** A function that returns the children for an item object. */\n getChildren?: (item: T) => T[];\n}\n\ninterface TreeNode<T extends object> {\n /** A unique key for the tree node. */\n key: Key;\n /** The key of the parent node. */\n parentKey?: Key | null;\n /** The value object for the tree node. */\n value: T;\n /** Children of the tree node. */\n children: TreeNode<T>[] | null;\n}\n\nexport interface TreeData<T extends object> {\n /** The root nodes in the tree. */\n items: TreeNode<T>[];\n /** The keys of the currently selected items in the tree. */\n selectedKeys: Set<Key>;\n /** Sets the selected keys. */\n setSelectedKeys: (keys: Set<Key>) => void;\n /**\n * Gets a node from the tree by key.\n *\n * @param key - The key of the item to retrieve.\n */\n getItem: (key: Key) => TreeNode<T> | undefined;\n /**\n * Inserts an item into a parent node as a child.\n *\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param index - The index within the parent to insert into.\n * @param value - The value to insert.\n */\n insert: (parentKey: Key | null, index: number, ...values: T[]) => void;\n /**\n * Inserts items into the list before the item at the given key.\n *\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore: (key: Key, ...values: T[]) => void;\n /**\n * Inserts items into the list after the item at the given key.\n *\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter: (key: Key, ...values: T[]) => void;\n /**\n * Appends an item into a parent node as a child.\n *\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n append: (parentKey: Key | null, ...values: T[]) => void;\n /**\n * Prepends an item into a parent node as a child.\n *\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n prepend: (parentKey: Key | null, ...value: T[]) => void;\n /**\n * Removes an item from the tree by its key.\n *\n * @param key - The key of the item to remove.\n */\n remove: (...keys: Key[]) => void;\n /**\n * Removes all items from the tree that are currently\n * in the set of selected items.\n */\n removeSelectedItems: () => void;\n /**\n * Moves an item within the tree.\n *\n * @param key - The key of the item to move.\n * @param toParentKey - The key of the new parent to insert into. `null` for the root.\n * @param index - The index within the new parent to insert at.\n */\n move: (key: Key, toParentKey: Key | null, index: number) => void;\n /**\n * Moves one or more items before a given key.\n *\n * @param key - The key of the item to move the items before.\n * @param keys - The keys of the items to move.\n */\n moveBefore: (key: Key, keys: Iterable<Key>) => void;\n /**\n * Moves one or more items after a given key.\n *\n * @param key - The key of the item to move the items after.\n * @param keys - The keys of the items to move.\n */\n moveAfter: (key: Key, keys: Iterable<Key>) => void;\n /**\n * Updates an item in the tree.\n *\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update: (key: Key, newValue: T) => void;\n}\n\ninterface TreeDataState<T extends object> {\n items: TreeNode<T>[];\n nodeMap: Map<Key, TreeNode<T>>;\n}\n\n/**\n * Manages state for an immutable tree data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function createTreeData<T extends object>(\n options: TreeOptions<T>\n): TreeData<T> {\n const initialItems = createMemo(() => options.initialItems ?? []);\n const initialSelectedKeys = createMemo(() => options.initialSelectedKeys);\n const getKey = createMemo(() => options.getKey ?? getItemKey);\n\n const getChildren = createMemo(\n () =>\n options.getChildren ??\n ((item: T) => {\n const children = \"children\" in item ? item.children : undefined;\n\n // SAFETY: without getChildren, TreeOptions uses the conventional recursive children: T[] shape.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return Array.isArray(children) ? (children as T[]) : [];\n })\n );\n\n // We only want to compute this on initial render.\n const [tree, commitTree] = createSignal<TreeDataState<T>>(\n untrack(() =>\n (() => {\n const currentInitialItems = initialItems();\n\n return buildTree(currentInitialItems, new Map());\n })()\n ),\n { ownedWrite: true }\n );\n\n let pendingTree = untrack(tree);\n\n const setItems = (\n update: TreeDataState<T> | ((state: TreeDataState<T>) => TreeDataState<T>)\n ) => {\n pendingTree = typeof update === \"function\" ? update(pendingTree) : update;\n commitTree(pendingTree);\n };\n\n const derived1 = createMemo(() => tree());\n\n const items = createMemo(() => {\n const currentDerived1 = derived1();\n\n return currentDerived1.items;\n });\n\n const [selectedKeys, commitSelectedKeys] = createSignal(\n untrack(() => {\n const currentInitialSelectedKeys = initialSelectedKeys();\n\n return new Set<Key>(currentInitialSelectedKeys);\n }),\n { ownedWrite: true }\n );\n\n let pendingSelectedKeys = untrack(selectedKeys);\n\n const setSelectedKeys = (keys: Set<Key>) => {\n pendingSelectedKeys = keys;\n commitSelectedKeys(keys);\n };\n\n function buildTree(\n initialInitialItems: T[] | null | undefined,\n map: Map<Key, TreeNode<T>>,\n parentKey?: Key | null\n ) {\n let localInitialItems = initialInitialItems;\n\n localInitialItems ??= [];\n\n return {\n items: localInitialItems.map((item) => {\n const currentGetKey = getKey();\n const currentGetChildren = getChildren();\n\n const node: TreeNode<T> = {\n children: null,\n key: currentGetKey(item),\n parentKey: parentKey ?? null,\n value: item,\n };\n\n node.children = buildTree(\n currentGetChildren(item),\n map,\n node.key\n ).items;\n map.set(node.key, node);\n\n return node;\n }),\n nodeMap: map,\n };\n }\n\n function updateTree(\n localInitialItems: TreeNode<T>[],\n key: Key | null,\n update: (node: TreeNode<T>) => TreeNode<T> | null,\n originalMap: Map<Key, TreeNode<T>>\n ) {\n const localItems = localInitialItems;\n\n let node = key === null || key === undefined ? null : originalMap.get(key);\n\n if (node === null || node === undefined) {\n return { items: localItems, nodeMap: originalMap };\n }\n\n const map = new Map<Key, TreeNode<T>>(originalMap);\n // Create a new node. If null, then delete the node, otherwise replace.\n let newNode = update(node);\n\n if (newNode === null || newNode === undefined) {\n deleteNode(node, map);\n } else {\n addNode(newNode, map);\n }\n\n // Walk up the tree and update each parent to refer to the new children.\n while (node.parentKey !== null && node.parentKey !== undefined) {\n const nextParent = map.get(node.parentKey);\n\n if (!nextParent) {\n throw new Error(`Missing parent node: ${node.parentKey}`);\n }\n\n const copy: TreeNode<T> = {\n children: null,\n key: nextParent.key,\n parentKey: nextParent.parentKey,\n value: nextParent.value,\n };\n\n const previousNode = node;\n const replacement = newNode;\n copy.children =\n nextParent.children?.flatMap((child) => {\n if (child !== previousNode) {\n return [child];\n }\n\n return replacement === null ? [] : [replacement];\n }) ?? null;\n map.set(copy.key, copy);\n newNode = copy;\n node = nextParent;\n }\n\n const rootNode = node;\n const rootReplacement = newNode;\n\n return {\n items: localItems.flatMap((item) => {\n if (item !== rootNode) {\n return [item];\n }\n\n return rootReplacement === null ? [] : [rootReplacement];\n }),\n nodeMap: map,\n };\n }\n\n function addNode(node: TreeNode<T>, map: Map<Key, TreeNode<T>>) {\n map.set(node.key, node);\n\n if (node.children) {\n for (const child of node.children) {\n addNode(child, map);\n }\n }\n }\n\n function deleteNode(node: TreeNode<T>, map: Map<Key, TreeNode<T>>) {\n map.delete(node.key);\n\n if (node.children) {\n for (const child of node.children) {\n deleteNode(child, map);\n }\n }\n }\n\n return {\n append(parentKey: Key | null, ...values: T[]) {\n const currentItems = pendingTree.items;\n const currentNodeMap = pendingTree.nodeMap;\n\n if (parentKey === null || parentKey === undefined) {\n this.insert(null, currentItems.length, ...values);\n } else {\n const parentNode = currentNodeMap.get(parentKey);\n\n if (!parentNode) {\n return;\n }\n\n this.insert(parentKey, parentNode.children?.length ?? 0, ...values);\n }\n },\n getItem(key: Key) {\n const currentNodeMap = pendingTree.nodeMap;\n\n return currentNodeMap.get(key);\n },\n insert(parentKey: Key | null, index: number, ...values: T[]) {\n setItems(({ items: localItems, nodeMap: originalMap }) => {\n const { items: newNodes, nodeMap: newMap } = buildTree(\n values,\n new Map(originalMap),\n parentKey\n );\n\n // If parentKey is null, insert into the root.\n if (parentKey === null || parentKey === undefined) {\n return {\n items: [\n ...localItems.slice(0, index),\n ...newNodes,\n ...localItems.slice(index),\n ],\n nodeMap: newMap,\n };\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(\n localItems,\n parentKey,\n (parentNode) => ({\n children: [\n ...(parentNode.children ?? []).slice(0, index),\n ...newNodes,\n ...(parentNode.children ?? []).slice(index),\n ],\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n }),\n newMap\n );\n });\n },\n insertAfter(key: Key, ...values: T[]): void {\n const currentNodeMap = pendingTree.nodeMap;\n const currentItems = pendingTree.items;\n const node = currentNodeMap.get(key);\n\n if (!node) {\n return;\n }\n\n const parentNode =\n node.parentKey === null || node.parentKey === undefined\n ? undefined\n : currentNodeMap.get(node.parentKey);\n\n const nodes = parentNode?.children ?? currentItems;\n const index = nodes.indexOf(node);\n this.insert(parentNode?.key ?? null, index + 1, ...values);\n },\n insertBefore(key: Key, ...values: T[]): void {\n const currentNodeMap = pendingTree.nodeMap;\n const currentItems = pendingTree.items;\n const node = currentNodeMap.get(key);\n\n if (!node) {\n return;\n }\n\n const parentNode =\n node.parentKey === null || node.parentKey === undefined\n ? undefined\n : currentNodeMap.get(node.parentKey);\n\n const nodes = parentNode?.children ?? currentItems;\n const index = nodes.indexOf(node);\n this.insert(parentNode?.key ?? null, index, ...values);\n },\n get items() {\n return items();\n },\n move(key: Key, toParentKey: Key | null, index: number) {\n setItems(({ items: localItems, nodeMap: originalMap }) => {\n let current = toParentKey;\n\n while (current !== null && current !== undefined) {\n if (current === key) {\n throw new Error(\"Cannot move an item to be a child of itself.\");\n }\n\n current = originalMap.get(current)?.parentKey ?? null;\n }\n\n const node = originalMap.get(key);\n\n if (!node) {\n return { items: localItems, nodeMap: originalMap };\n }\n\n const { items: newItems, nodeMap: newMap } = updateTree(\n localItems,\n key,\n () => null,\n originalMap\n );\n\n const movedNode = {\n ...node,\n parentKey: toParentKey,\n };\n\n // If parentKey is null, insert into the root.\n if (toParentKey === null || toParentKey === undefined) {\n addNode(movedNode, newMap);\n\n return {\n items: [\n ...newItems.slice(0, index),\n movedNode,\n ...newItems.slice(index),\n ],\n nodeMap: newMap,\n };\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(\n newItems,\n toParentKey,\n (parentNode) => ({\n children: [\n ...(parentNode.children ?? []).slice(0, index),\n movedNode,\n ...(parentNode.children ?? []).slice(index),\n ],\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n }),\n newMap\n );\n });\n },\n moveAfter(key: Key, keys: Iterable<Key>) {\n setItems((prevState) => {\n const { items: localItems, nodeMap } = prevState;\n const node = nodeMap.get(key);\n\n if (!node) {\n return prevState;\n }\n\n const toParentKey = node.parentKey ?? null;\n let parent: null | TreeNode<T> = null;\n\n if (toParentKey !== null && toParentKey !== undefined) {\n parent = nodeMap.get(toParentKey) ?? null;\n }\n\n let toIndex = parent?.children\n ? parent.children.indexOf(node)\n : localItems.indexOf(node);\n\n toIndex += 1;\n\n return moveItems(prevState, keys, parent, toIndex, updateTree, addNode);\n });\n },\n moveBefore(key: Key, keys: Iterable<Key>) {\n setItems((prevState) => {\n const { items: localItems, nodeMap } = prevState;\n const node = nodeMap.get(key);\n\n if (!node) {\n return prevState;\n }\n\n const toParentKey = node.parentKey ?? null;\n let parent: null | TreeNode<T> = null;\n\n if (toParentKey !== null && toParentKey !== undefined) {\n parent = nodeMap.get(toParentKey) ?? null;\n }\n\n const toIndex = parent?.children\n ? parent.children.indexOf(node)\n : localItems.indexOf(node);\n\n return moveItems(prevState, keys, parent, toIndex, updateTree, addNode);\n });\n },\n prepend(parentKey: Key | null, ...values: T[]) {\n this.insert(parentKey, 0, ...values);\n },\n remove(...keys: Key[]) {\n const currentItems = pendingTree.items;\n const currentNodeMap = pendingTree.nodeMap;\n const currentSelectedKeys = pendingSelectedKeys;\n\n if (keys.length === 0) {\n return;\n }\n\n let newItems = currentItems;\n let prevMap = currentNodeMap;\n let newTree: TreeDataState<T> = { items: newItems, nodeMap: prevMap };\n\n for (const key of keys) {\n newTree = updateTree(newItems, key, () => null, prevMap);\n prevMap = newTree.nodeMap;\n newItems = newTree.items;\n }\n\n setItems(newTree);\n const selection = new Set(currentSelectedKeys);\n\n for (const key of currentSelectedKeys) {\n if (!newTree.nodeMap.has(key)) {\n selection.delete(key);\n }\n }\n\n setSelectedKeys(selection);\n },\n removeSelectedItems() {\n const currentSelectedKeys = pendingSelectedKeys;\n this.remove(...currentSelectedKeys);\n },\n get selectedKeys() {\n return selectedKeys();\n },\n setSelectedKeys,\n update(oldKey: Key, newValue: T) {\n setItems(({ items: localItems, nodeMap: originalMap }) =>\n updateTree(\n localItems,\n oldKey,\n (oldNode) => {\n const currentGetChildren = getChildren();\n\n const node: TreeNode<T> = {\n children: null,\n key: oldNode.key,\n parentKey: oldNode.parentKey,\n value: newValue,\n };\n\n const localTree = buildTree(\n currentGetChildren(newValue),\n originalMap,\n node.key\n );\n\n node.children = localTree.items;\n\n return node;\n },\n originalMap\n )\n );\n },\n };\n}\n\nfunction moveItems<T extends object>(\n state: TreeDataState<T>,\n keys: Iterable<Key>,\n toParent: TreeNode<T> | null,\n initialToIndex: number,\n updateTree: (\n items: TreeNode<T>[],\n key: Key | null,\n update: (node: TreeNode<T>) => TreeNode<T> | null,\n originalMap: Map<Key, TreeNode<T>>\n ) => TreeDataState<T>,\n addNode: (node: TreeNode<T>, map: Map<Key, TreeNode<T>>) => void\n): TreeDataState<T> {\n let toIndex = initialToIndex;\n\n const { items, nodeMap } = state;\n let parent = toParent;\n const removeKeys = new Set(keys);\n\n while (parent !== null && parent !== undefined) {\n if (removeKeys.has(parent.key)) {\n throw new Error(\"Cannot move an item to be a child of itself.\");\n }\n\n parent =\n parent.parentKey === null || parent.parentKey === undefined\n ? null\n : (nodeMap.get(parent.parentKey) ?? null);\n }\n\n const originalToIndex = toIndex;\n const keyArray = new Set(keys);\n // depth first search to put keys in order\n const inOrderKeys = new Map<Key, number>();\n const removedItems: TreeNode<T>[] = [];\n let newItems = items;\n let newMap = nodeMap;\n let i = 0;\n\n function traversal(\n node:\n | TreeNode<T>\n | {\n children: TreeNode<T>[];\n }\n | null,\n {\n inorder: localInorder,\n postorder: localPostorder,\n }: {\n inorder?: (node: TreeNode<T> | null) => void;\n postorder?: (node: TreeNode<T>) => void;\n }\n ) {\n if (node === null || \"key\" in node) {\n localInorder?.(node);\n }\n\n if (node !== null && node !== undefined) {\n for (const child of node.children ?? []) {\n traversal(child, { inorder: localInorder, postorder: localPostorder });\n localPostorder?.(child);\n }\n }\n }\n\n function inorder(child: TreeNode<T> | null) {\n // in-order so we add items as we encounter them in the tree, then we can insert them in expected order later\n if (child && keyArray.has(child.key)) {\n inOrderKeys.set(child.key, i);\n i += 1;\n }\n }\n\n function postorder(child: TreeNode<T>) {\n // remove items and update the tree from the leaves and work upwards toward the root, this way\n // we don't copy child node references from parents inadvertently\n if (Boolean(child) && keyArray.has(child.key)) {\n removedItems.push({\n ...(newMap.get(child.key) ?? child),\n parentKey: toParent?.key ?? null,\n });\n\n const { items: nextItems, nodeMap: nextMap } = updateTree(\n newItems,\n child.key,\n () => null,\n newMap\n );\n\n newItems = nextItems;\n newMap = nextMap;\n }\n\n // decrement the index if the child being removed is in the target parent and before the target index\n // the root node is special, it is null, and will not have a key, however, a parentKey can still point to it\n if (\n (child.parentKey === toParent || child.parentKey === toParent?.key) &&\n keyArray.has(child.key) &&\n (toParent?.children\n ? toParent.children.indexOf(child)\n : items.indexOf(child)) < originalToIndex\n ) {\n toIndex -= 1;\n }\n }\n\n traversal({ children: items }, { inorder, postorder });\n\n const inOrderItems = removedItems.toSorted((a, b) =>\n (inOrderKeys.get(a.key) ?? 0) > (inOrderKeys.get(b.key) ?? 0) ? 1 : -1\n );\n\n // If parentKey is null, insert into the root.\n if (!toParent || toParent.key === null || toParent.key === undefined) {\n for (const movedNode of inOrderItems) {\n addNode(movedNode, newMap);\n }\n\n return {\n items: [\n ...newItems.slice(0, toIndex),\n ...inOrderItems,\n ...newItems.slice(toIndex),\n ],\n nodeMap: newMap,\n };\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(\n newItems,\n toParent.key,\n (parentNode) => ({\n children: [\n ...(parentNode.children ?? []).slice(0, toIndex),\n ...inOrderItems,\n ...(parentNode.children ?? []).slice(toIndex),\n ],\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n }),\n newMap\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgJA,SAAgB,eACd,SACa;CACb,MAAM,eAAe,iBAAiB,QAAQ,gBAAgB,CAAC,CAAC;CAChE,MAAM,sBAAsB,iBAAiB,QAAQ,mBAAmB;CACxE,MAAM,SAAS,iBAAiB,QAAQ,UAAU,UAAU;CAE5D,MAAM,cAAc,iBAEhB,QAAQ,iBACN,SAAY;EACZ,MAAM,WAAW,cAAc,OAAO,KAAK,WAAW,KAAA;EAItD,OAAO,MAAM,QAAQ,QAA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,QAAQ,SAAS,QAAQ,KAAA,GAAW;EACpE,KAAK,MAAM,aAAa,cACtB,QAAQ,WAAW,MAAM;EAG3B,OAAO;GACL,OAAO;IACL,GAAG,SAAS,MAAM,GAAG,OAAO;IAC5B,GAAG;IACH,GAAG,SAAS,MAAM,OAAO;GAC3B;GACA,SAAS;EACX;CACF;CAGA,OAAO,WACL,UACA,SAAS,MACR,gBAAgB;EACf,UAAU;GACR,IAAI,WAAW,YAAY,CAAC,EAAA,CAAG,MAAM,GAAG,OAAO;GAC/C,GAAG;GACH,IAAI,WAAW,YAAY,CAAC,EAAA,CAAG,MAAM,OAAO;EAC9C;EACA,KAAK,WAAW;EAChB,WAAW,WAAW;EACtB,OAAO,WAAW;CACpB,IACA,MACF;AACF"}
@@ -0,0 +1,138 @@
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/datepicker/useDateFieldState.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { FormValidationState } from "../form/create-form-validation-state.js";
18
+ import { DatePickerProps, DateValue, Granularity } from "./types.js";
19
+ import { FieldOptions, FormatterOptions } from "./utils.js";
20
+ import { Calendar, CalendarIdentifier, DateFormatter } from "@internationalized/date";
21
+ import { ValidationState } from "@solid2-aria/types-shared";
22
+ export type DateSegmentType = "era" | "year" | "month" | "day" | "hour" | "minute" | "second" | "dayPeriod" | "literal" | "timeZoneName";
23
+ export interface DateSegment {
24
+ /** The type of segment. */
25
+ type: DateSegmentType;
26
+ /** The formatted text for the segment. */
27
+ text: string;
28
+ /** The numeric value for the segment, if applicable. */
29
+ value?: number | null;
30
+ /** The minimum numeric value for the segment, if applicable. */
31
+ minValue?: number;
32
+ /** The maximum numeric value for the segment, if applicable. */
33
+ maxValue?: number;
34
+ /** Whether the value is a placeholder. */
35
+ isPlaceholder: boolean;
36
+ /** A placeholder string for the segment. */
37
+ placeholder: string;
38
+ /** Whether the segment is editable. */
39
+ isEditable: boolean;
40
+ }
41
+ export interface DateFieldState extends FormValidationState {
42
+ /** The current field value. */
43
+ value: DateValue | null;
44
+ /** The default field value. */
45
+ defaultValue: DateValue | null;
46
+ /** The current value, converted to a native JavaScript `Date` object. */
47
+ dateValue: Date;
48
+ /** The calendar system currently in use. */
49
+ calendar: Calendar;
50
+ /** Sets the field's value. */
51
+ setValue: (value: DateValue | null) => void;
52
+ /** A list of segments for the current value. */
53
+ segments: DateSegment[];
54
+ /** A date formatter configured for the current locale and format. */
55
+ dateFormatter: DateFormatter;
56
+ /**
57
+ * The current validation state of the date field, based on the `validationState`, `minValue`, and
58
+ * `maxValue` props.
59
+ *
60
+ * @deprecated Use `isInvalid` instead.
61
+ */
62
+ validationState: ValidationState | null;
63
+ /** Whether the date field is invalid, based on the `isInvalid`, `minValue`, and `maxValue` props. */
64
+ isInvalid: boolean;
65
+ /** The granularity for the field, based on the `granularity` prop and current value. */
66
+ granularity: Granularity;
67
+ /** The maximum date or time unit that is displayed in the field. */
68
+ maxGranularity: "year" | "month" | Granularity;
69
+ /** Whether the field is disabled. */
70
+ isDisabled: boolean;
71
+ /** Whether the field is read only. */
72
+ isReadOnly: boolean;
73
+ /** Whether the field is required. */
74
+ isRequired: boolean;
75
+ /**
76
+ * Increments the given segment. Upon reaching the minimum or maximum value, the value wraps
77
+ * around to the opposite limit.
78
+ */
79
+ increment: (type: DateSegmentType) => void;
80
+ /**
81
+ * Decrements the given segment. Upon reaching the minimum or maximum value, the value wraps
82
+ * around to the opposite limit.
83
+ */
84
+ decrement: (type: DateSegmentType) => void;
85
+ /**
86
+ * Increments the given segment by a larger amount, rounding it to the nearest increment.
87
+ * The amount to increment by depends on the field, for example 15 minutes, 7 days, and 5 years.
88
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
89
+ */
90
+ incrementPage: (type: DateSegmentType) => void;
91
+ /**
92
+ * Decrements the given segment by a larger amount, rounding it to the nearest increment.
93
+ * The amount to decrement by depends on the field, for example 15 minutes, 7 days, and 5 years.
94
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
95
+ */
96
+ decrementPage: (type: DateSegmentType) => void;
97
+ /** Increments the given segment to its maxiumum value. */
98
+ incrementToMax: (type: DateSegmentType) => void;
99
+ /** Decrements the given segment to its minimum value. */
100
+ decrementToMin: (type: DateSegmentType) => void;
101
+ /** Sets the value of the given segment. */
102
+ setSegment: {
103
+ (type: "era", value: string): void;
104
+ (type: DateSegmentType, value: number): void;
105
+ };
106
+ /** Updates the remaining unfilled segments with the placeholder value. */
107
+ confirmPlaceholder: () => void;
108
+ /** Clears the value of the given segment, reverting it to the placeholder. */
109
+ clearSegment: (type: DateSegmentType) => void;
110
+ /** Formats the current date value using the given options. */
111
+ formatValue: (fieldOptions: FieldOptions) => string;
112
+ /** Gets a formatter based on state's props. */
113
+ getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter;
114
+ }
115
+ export interface DateFieldStateOptions<T extends DateValue = DateValue> extends DatePickerProps<T> {
116
+ /**
117
+ * The maximum unit to display in the date field.
118
+ *
119
+ * @default 'year'
120
+ */
121
+ maxGranularity?: "year" | "month" | Granularity;
122
+ /** The locale to display and edit the value according to. */
123
+ locale: string;
124
+ /**
125
+ * A function that creates a [Calendar](../internationalized/date/Calendar.html)
126
+ * object for a given calendar identifier. Such a function may be imported from the
127
+ * `@internationalized/date` package, or manually implemented to include support for
128
+ * only certain calendars.
129
+ */
130
+ createCalendar: (name: CalendarIdentifier) => Calendar;
131
+ }
132
+ /**
133
+ * Provides state management for a date field component.
134
+ * A date field allows users to enter and edit date and time values using a keyboard.
135
+ * Each part of a date value is displayed in an individually editable segment.
136
+ */
137
+ export declare function createDateFieldState<T extends DateValue = DateValue>(props: DateFieldStateOptions<T>): DateFieldState;
138
+ //# sourceMappingURL=create-date-field-state.d.ts.map