@astryx-vue/core 0.2.1 → 0.2.3

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 (273) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -0
  2. package/dist/AppShell/index.d.ts +1 -1
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-1wNIEtK_.js → AppShell-Dd-D4bA2.js} +2 -2
  5. package/dist/AvatarGroup/index.d.ts +1 -1
  6. package/dist/Badge/index.d.ts +2 -1
  7. package/dist/Banner/index.d.ts +1 -1
  8. package/dist/Breadcrumbs/index.d.ts +3 -2
  9. package/dist/Breadcrumbs/index.js +3 -2
  10. package/dist/{Breadcrumbs-C97HmjkC.js → Breadcrumbs-CWGfgLNK.js} +13 -8
  11. package/dist/Button/index.d.ts +1 -1
  12. package/dist/ButtonGroup/index.d.ts +1 -1
  13. package/dist/Calendar/index.d.ts +2 -2
  14. package/dist/Calendar/index.js +1 -1
  15. package/dist/Calendar-CnOsSjMY.js +656 -0
  16. package/dist/Card/index.d.ts +1 -1
  17. package/dist/Carousel/index.js +1 -1
  18. package/dist/{Carousel-BGUnskjo.js → Carousel-JA7ilqI_.js} +2 -2
  19. package/dist/Chat/index.d.ts +2 -2
  20. package/dist/Chat/index.js +2 -2
  21. package/dist/Chat-C7WrCOE4.js +3148 -0
  22. package/dist/CheckboxIndicator/index.js +1 -1
  23. package/dist/CheckboxIndicator-D37cm2Rh.js +68 -0
  24. package/dist/CheckboxInput/index.d.ts +1 -1
  25. package/dist/CheckboxInput/index.js +1 -1
  26. package/dist/{CheckboxInput-CMsEE1_4.js → CheckboxInput-25Q8ItH-.js} +10 -9
  27. package/dist/CheckboxList/index.d.ts +1 -1
  28. package/dist/CheckboxList/index.js +1 -1
  29. package/dist/{CheckboxList-BbCPiend.js → CheckboxList-CnCGnkZk.js} +77 -24
  30. package/dist/Citation/index.js +1 -1
  31. package/dist/{Citation-DunoAqVH.js → Citation-CtwrU33I.js} +2 -2
  32. package/dist/ClickableCard/index.d.ts +1 -1
  33. package/dist/Code/index.d.ts +1 -1
  34. package/dist/Code/index.js +2 -2
  35. package/dist/{Code-yb_KOFtJ.js → Code-BvefYRpx.js} +2 -1
  36. package/dist/{CodeBlock-CAF-VJnh.js → CodeBlock-BZGzYeoL.js} +1 -1
  37. package/dist/Collapsible/index.d.ts +1 -1
  38. package/dist/Collapsible/index.js +1 -1
  39. package/dist/{Collapsible-DvMiYJp7.js → Collapsible-3YerR-FO.js} +1 -1
  40. package/dist/CommandPalette/index.js +1 -1
  41. package/dist/{CommandPalette-xfm9ldUI.js → CommandPalette-BNbM9T9y.js} +1 -1
  42. package/dist/ComplexSelector/index.d.ts +1 -1
  43. package/dist/ComplexSelector/index.js +1 -1
  44. package/dist/{ComplexSelector-B6lBTRhP.js → ComplexSelector-LtbLlrcj.js} +3 -3
  45. package/dist/ContextMenu/index.d.ts +3 -2
  46. package/dist/ContextMenu/index.js +3 -2
  47. package/dist/{ContextMenu-DUkED3Z3.js → ContextMenu-DVQl0xL5.js} +204 -56
  48. package/dist/DateInput/index.d.ts +2 -2
  49. package/dist/DateInput/index.js +1 -1
  50. package/dist/DateInput-zm8sNc0t.js +743 -0
  51. package/dist/DateRangeInput/index.d.ts +1 -1
  52. package/dist/DateRangeInput/index.js +1 -1
  53. package/dist/{DateRangeInput-e9KSxBBK.js → DateRangeInput-DlVFzrf7.js} +54 -19
  54. package/dist/DateTimeInput/index.d.ts +1 -1
  55. package/dist/DateTimeInput/index.js +1 -1
  56. package/dist/{DateTimeInput-fSOfuLex.js → DateTimeInput-C7Z-p6Yd.js} +54 -15
  57. package/dist/Dialog/index.d.ts +1 -1
  58. package/dist/Divider/index.d.ts +1 -1
  59. package/dist/DropdownMenu/index.d.ts +3 -3
  60. package/dist/DropdownMenu/index.js +4 -3
  61. package/dist/{DropdownMenu-8G0B1UND.js → DropdownMenu-BoZChdev.js} +308 -63
  62. package/dist/DropdownMenu-u1psFjis.js +325 -0
  63. package/dist/DropdownMenuRadioItem.vue-uVM0FD2f.d.ts +564 -0
  64. package/dist/FileInput/index.d.ts +1 -1
  65. package/dist/FileInput/index.js +1 -1
  66. package/dist/{FileInput-D-fchyQH.js → FileInput-QdlZn7qK.js} +2 -2
  67. package/dist/Icon/index.d.ts +4 -3
  68. package/dist/Icon/index.js +2 -2
  69. package/dist/{Icon-Bku25g_K.js → Icon-bteSId7T.js} +114 -14
  70. package/dist/Indicator/index.d.ts +3 -0
  71. package/dist/Indicator/index.js +2 -0
  72. package/dist/InputGroup/index.d.ts +2 -2
  73. package/dist/InputGroup/index.js +3 -2
  74. package/dist/InputGroup-BzR6JRZb.js +129 -0
  75. package/dist/Lightbox/index.js +1 -1
  76. package/dist/{Lightbox-uuVGgHxW.js → Lightbox-BSzfqZ-u.js} +2 -2
  77. package/dist/List/index.d.ts +1 -1
  78. package/dist/Markdown/index.js +1 -1
  79. package/dist/{Markdown-DLICa3db.js → Markdown-B6tSqenv.js} +8 -5
  80. package/dist/MetadataList/index.d.ts +1 -1
  81. package/dist/MetadataList/index.js +1 -1
  82. package/dist/{MetadataList-h492rqEN.js → MetadataList-aN1tRn6W.js} +1 -1
  83. package/dist/MobileNav/index.js +1 -1
  84. package/dist/{MobileNavToggle-BMj3Wtuq.js → MobileNavToggle-fqcSafkc.js} +1 -1
  85. package/dist/MoreMenu/index.d.ts +1 -1
  86. package/dist/MoreMenu/index.js +1 -1
  87. package/dist/{MoreMenu-DkYi5az5.js → MoreMenu-B3brqdK_.js} +1 -1
  88. package/dist/MultiSelector/index.d.ts +2 -2
  89. package/dist/MultiSelector/index.js +1 -1
  90. package/dist/{MultiSelector-C2IS-EaU.js → MultiSelector-BD5PMgez.js} +303 -121
  91. package/dist/{NavDisclosure-DHrSNRDR.js → NavDisclosure-DbYLDXK0.js} +1 -1
  92. package/dist/NavItem/index.d.ts +1 -1
  93. package/dist/NavMenu/index.js +2 -2
  94. package/dist/{NavMenuItem-B-k7olt5.js → NavMenuItem-DrwIMHKO.js} +1 -1
  95. package/dist/NumberInput/index.js +1 -1
  96. package/dist/{NumberInput-CjfAsFwj.js → NumberInput-CBeU4lEl.js} +1 -1
  97. package/dist/Outline/index.js +1 -1
  98. package/dist/{Outline-BTmrtvXR.js → Outline--HVMSB6i.js} +1 -1
  99. package/dist/OverflowList/index.d.ts +1 -1
  100. package/dist/OverflowList/index.js +1 -1
  101. package/dist/{OverflowList-CRE8BE7V.js → OverflowList-FMh7r-r_.js} +3 -3
  102. package/dist/Pagination/index.d.ts +1 -1
  103. package/dist/Pagination/index.js +1 -1
  104. package/dist/{Pagination-BpGXPmc7.js → Pagination-DlIvESjx.js} +2 -2
  105. package/dist/Popover/index.d.ts +1 -1
  106. package/dist/Popover/index.js +1 -1
  107. package/dist/{Popover-Crhk9PNP.js → Popover-D7zqpFwU.js} +1 -1
  108. package/dist/PowerSearch/index.d.ts +2 -0
  109. package/dist/PowerSearch/index.js +2 -0
  110. package/dist/PowerSearch-CMG7Rb69.js +2386 -0
  111. package/dist/ProgressBar/index.d.ts +1 -1
  112. package/dist/Radio/index.d.ts +1 -1
  113. package/dist/Radio/index.js +1 -1
  114. package/dist/{RadioGroup-BqjdSCfJ.js → RadioGroup-CBqUPq_L.js} +16 -8
  115. package/dist/RadioList/index.d.ts +1 -1
  116. package/dist/RadioList/index.js +1 -1
  117. package/dist/{RadioList-DI8ujXcT.js → RadioList-CPOJn9Th.js} +1 -1
  118. package/dist/Resizable/index.d.ts +1 -1
  119. package/dist/Resizable/index.js +1 -1
  120. package/dist/{Resizable-CE8XQDL2.js → Resizable-CXpvj1TZ.js} +1 -1
  121. package/dist/ScrollableArea/index.d.ts +1 -1
  122. package/dist/SelectableCard/index.d.ts +1 -1
  123. package/dist/Selector/index.d.ts +2 -2
  124. package/dist/Selector/index.js +1 -1
  125. package/dist/Selector-BpPnuWH3.js +618 -0
  126. package/dist/SideNav/index.d.ts +1 -1
  127. package/dist/SideNav/index.js +1 -1
  128. package/dist/{SideNav-DcDWBnXJ.js → SideNav-D4TupqgE.js} +3 -3
  129. package/dist/Stack/index.d.ts +1 -1
  130. package/dist/Stepper/index.d.ts +1 -1
  131. package/dist/Stepper/index.js +1 -1
  132. package/dist/{Stepper-DZKaqEoz.js → Stepper-H-6-T5Ps.js} +1 -1
  133. package/dist/Switch/index.d.ts +1 -1
  134. package/dist/TabList/index.d.ts +1 -1
  135. package/dist/TabList/index.js +1 -1
  136. package/dist/{TabList-hm06QPiW.js → TabList-BlzkrObv.js} +2 -2
  137. package/dist/Table/index.d.ts +3 -3
  138. package/dist/Table/index.js +2 -2
  139. package/dist/Table-nqA_njNz.js +1982 -0
  140. package/dist/TextArea/index.d.ts +1 -1
  141. package/dist/TextInput/index.d.ts +1 -1
  142. package/dist/Theme/index.d.ts +2 -1
  143. package/dist/Theme/index.js +1 -1
  144. package/dist/{Theme-BuUiiJNr.js → Theme-CejS9MHm.js} +21 -3
  145. package/dist/Thumbnail/index.js +1 -1
  146. package/dist/{Thumbnail-CAOYds8t.js → Thumbnail-CXb3m_Hv.js} +2 -2
  147. package/dist/{TimeField-BGbxCoKU.js → TimeField-B3cndWb0.js} +2 -2
  148. package/dist/TimeInput/index.d.ts +1 -1
  149. package/dist/TimeInput/index.js +1 -1
  150. package/dist/{TimeInput-DJP3l4ZS.js → TimeInput-BHQ_LKGm.js} +1 -1
  151. package/dist/Timestamp/index.d.ts +1 -1
  152. package/dist/Timestamp/index.js +1 -1
  153. package/dist/{Timestamp-BzRp8uWc.js → Timestamp-Cfuxbb3i.js} +3 -3
  154. package/dist/ToggleButton/index.d.ts +1 -1
  155. package/dist/Token/index.d.ts +1 -1
  156. package/dist/Token/index.js +1 -1
  157. package/dist/{Token-CjocuhzE.js → Token-CdVLH0_H.js} +2 -2
  158. package/dist/Tokenizer/index.d.ts +1 -1
  159. package/dist/Tokenizer/index.js +1 -1
  160. package/dist/{Tokenizer-mYES5SPM.js → Tokenizer-DlD-S_8-.js} +4 -4
  161. package/dist/Toolbar/index.d.ts +1 -1
  162. package/dist/TopNav/index.d.ts +1 -1
  163. package/dist/TopNav/index.js +1 -1
  164. package/dist/{TopNav-C2t6JkZb.js → TopNav-DzV874G7.js} +5 -5
  165. package/dist/TreeList/index.d.ts +1 -1
  166. package/dist/TreeList/index.js +1 -1
  167. package/dist/{TreeList-THJ0KamE.js → TreeList-DEwvlZRV.js} +2 -2
  168. package/dist/Typeahead/index.d.ts +1 -1
  169. package/dist/Typeahead/index.js +1 -1
  170. package/dist/{Typeahead-D7VnvRpK.js → Typeahead-DQ3tmqYe.js} +4 -4
  171. package/dist/{useTypeaheadMenu-Ba7XpcZl.js → TypeaheadMenu-CGvo0Tud.js} +107 -107
  172. package/dist/{context-O2Vb8cJl.js → colorMode-CBgdgDSn.js} +1 -7
  173. package/dist/composables/index.d.ts +4 -4
  174. package/dist/composables/index.js +10 -5
  175. package/dist/{composables-CVfjp9h4.js → composables-DDI08XFF.js} +98 -1
  176. package/dist/context-Cws_tXTr.js +7 -0
  177. package/dist/context-D5-MwxnN.js +4 -0
  178. package/dist/{context-DzcK4T_C.js → context-DmOLCubj.js} +262 -12
  179. package/dist/{index-DimuSES0.d.ts → index-B1x05arQ.d.ts} +3 -1
  180. package/dist/index-B9WzWqzk.d.ts +18 -0
  181. package/dist/index-B9f1rUEv.d.ts +77 -0
  182. package/dist/{index-DnSrjbjP.d.ts → index-BB5yVIN-.d.ts} +2 -2
  183. package/dist/{index-Bu0Zd1uw.d.ts → index-BMn9ghAX.d.ts} +3 -3
  184. package/dist/{index-CJlBAXwj.d.ts → index-BRfR0lhb.d.ts} +41 -4
  185. package/dist/{index-DeOftUMq.d.ts → index-BTAgQRP0.d.ts} +762 -114
  186. package/dist/{index-DA52oIdw.d.ts → index-BcJBLWJ0.d.ts} +2 -2
  187. package/dist/{index-jdjcb3Js.d.ts → index-Bqb_Fyju.d.ts} +2 -2
  188. package/dist/{index-CNjbOgty.d.ts → index-C-QpeUlQ.d.ts} +2 -2
  189. package/dist/{index-I4J7gwa1.d.ts → index-C2sfHfBw.d.ts} +31 -5
  190. package/dist/{index-By2mSzUA.d.ts → index-CA6RbRWx.d.ts} +1 -1
  191. package/dist/{index-DnEh-HA0.d.ts → index-C_2Z65Rp.d.ts} +1 -1
  192. package/dist/{index-cG1E0U2s.d.ts → index-Ca8VIE4l.d.ts} +1 -1
  193. package/dist/{index-CRizexSC.d.ts → index-Ch6BbxCP.d.ts} +2 -67
  194. package/dist/{index-CBym0hSq.d.ts → index-ChWlKHjc.d.ts} +1 -1
  195. package/dist/{index-DXSs3rwa.d.ts → index-CngORuiq.d.ts} +137 -2
  196. package/dist/index-Ctu32CLv.d.ts +902 -0
  197. package/dist/{index-DQAnGHu7.d.ts → index-D1Twv_fL.d.ts} +65 -6
  198. package/dist/{index-D_nYxnNv.d.ts → index-D7-WTV6I.d.ts} +1 -1
  199. package/dist/{index-c_TaW8mM.d.ts → index-D8o50qOE.d.ts} +1 -1
  200. package/dist/index-DMQG6kdM.d.ts +416 -0
  201. package/dist/index-D_UEJIU5.d.ts +83 -0
  202. package/dist/{index-D2bSSSBP.d.ts → index-DkVEBdWa.d.ts} +2 -2
  203. package/dist/{index-SMh42NI8.d.ts → index-DxsKyAxq.d.ts} +118 -46
  204. package/dist/{index-BHqRH7QW.d.ts → index-FEy8qFSD.d.ts} +2 -2
  205. package/dist/{index-Byar3h1e.d.ts → index-HV6W3xCx.d.ts} +1 -1
  206. package/dist/{index-Clmz00IK.d.ts → index-LIyvJTW3.d.ts} +63 -0
  207. package/dist/{index-BKr7yvVv.d.ts → index-MPcg1Pm4.d.ts} +1 -1
  208. package/dist/{index-cGagYM1g.d.ts → index-ViSV0RBx.d.ts} +1 -1
  209. package/dist/{index-Z_onS2lR.d.ts → index-f4NGT-e2.d.ts} +3 -3
  210. package/dist/{index-DsyKhauk.d.ts → index-foQMNKZO.d.ts} +1 -1
  211. package/dist/{index-1uRMrk63.d.ts → index-nCEmW6wa.d.ts} +1 -1
  212. package/dist/{index-NOXYEdOI.d.ts → index-utZGF4GR.d.ts} +1 -1
  213. package/dist/{index-3p2BDVHq.d.ts → index-vP0EtrJJ.d.ts} +13 -3
  214. package/dist/{index-CZeoAr0a.d.ts → index-xfkEuGLY.d.ts} +2 -2
  215. package/dist/index.d.ts +81 -78
  216. package/dist/index.js +122 -106
  217. package/dist/locale/index.d.ts +1 -1
  218. package/dist/locale/index.js +2 -2
  219. package/dist/{locale-Cpk_nrLA.js → locale-CCwVnyMZ.js} +25 -1
  220. package/dist/power-search-DrDfcoL1.d.ts +68 -0
  221. package/dist/searchResultMessage-DN0HeRRB.js +94 -0
  222. package/dist/semantic-CKH9XVqa.d.ts +54 -0
  223. package/dist/{types-JktRxujg.d.ts → types-Cp4liug-.d.ts} +66 -3
  224. package/dist/{types-BKcxXW--.d.ts → types-CwyibrRB.d.ts} +12 -11
  225. package/dist/types-DIYwbkpe.d.ts +33 -0
  226. package/dist/types-jmqqnkKA.d.ts +163 -0
  227. package/dist/{useAnchoredListbox-7W90Ny-9.js → useAnchoredListbox-BN9LQnon.js} +1 -1
  228. package/dist/useDatePresentation-C07PnOCw.js +21 -0
  229. package/dist/{useMonthGrid-CmJsZTcB.js → useDateRange-CIXoE_8k.js} +1 -42
  230. package/dist/useDisclosureHandle-Df3HhAfC.js +24 -0
  231. package/dist/{useDismiss-CAiHU6QD.js → useDismiss-Cj8x_51F.js} +8 -4
  232. package/dist/useFieldControlState-voICDrys.js +18 -0
  233. package/dist/useHandleRef-6cdKugm8.js +17 -0
  234. package/dist/useIndicator-i1NORM7W.js +147 -0
  235. package/dist/useMenuDrillIn-OaEwjK44.js +520 -0
  236. package/dist/useMonthGrid-fGHSSrFc.js +43 -0
  237. package/dist/usePendingChange-ib-h8FZK.js +25 -0
  238. package/dist/{useResizable-CeESZS1v.d.ts → useResizable-CUoNPmUw.d.ts} +1 -1
  239. package/dist/useSubmenuMode-CZN9qrUo.js +37 -0
  240. package/package.json +9 -1
  241. package/styles/calendar.css +38 -3
  242. package/styles/chat.css +469 -1
  243. package/styles/check-indicator.css +17 -0
  244. package/styles/checkbox-indicator.css +29 -10
  245. package/styles/checkbox-input.css +0 -11
  246. package/styles/date-input.css +48 -0
  247. package/styles/dropdown-menu.css +163 -0
  248. package/styles/field.css +48 -0
  249. package/styles/icon.css +69 -1
  250. package/styles/input-group.css +32 -3
  251. package/styles/multi-selector.css +26 -0
  252. package/styles/power-search.css +303 -0
  253. package/styles/radio-indicator.css +90 -0
  254. package/styles/radio.css +9 -42
  255. package/styles/selector.css +112 -14
  256. package/styles/table.css +304 -1
  257. package/styles.css +3 -0
  258. package/dist/Calendar-DqC3EDN1.js +0 -352
  259. package/dist/Chat-DCjXRiOF.js +0 -1051
  260. package/dist/CheckboxIndicator-DdJmksHt.js +0 -52
  261. package/dist/DateInput-Crcg-CCj.js +0 -376
  262. package/dist/DropdownMenu-XvW4BJob.js +0 -164
  263. package/dist/InputGroup-ChrFVxzV.js +0 -42
  264. package/dist/Selector-DkJOLZSR.js +0 -468
  265. package/dist/Table-DwehtMap.js +0 -967
  266. package/dist/index-BLOEjvaM.d.ts +0 -398
  267. package/dist/index-Bgv4ZmBl.d.ts +0 -72
  268. package/dist/index-CuFLztiI.d.ts +0 -49
  269. package/dist/index-DJo-BmXZ.d.ts +0 -431
  270. package/dist/index-IbUN4M8V.d.ts +0 -40
  271. package/dist/types-DDAAT1Xd.d.ts +0 -285
  272. package/dist/useGridRovingFocus-DQQAOYH5.js +0 -99
  273. /package/dist/{index-BUXNRekN.d.ts → index-BXkNZF3q.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { VNode, VNodeChild } from "vue";
1
+ import { CSSProperties, VNode, VNodeChild } from "vue";
2
2
  //#region src/Table/types.d.ts
3
3
  type TableDensity = 'compact' | 'balanced' | 'spacious';
4
4
  type TableDividers = 'rows' | 'columns' | 'grid' | 'none';
@@ -33,6 +33,10 @@ interface TableColumn<T extends Record<string, unknown> = Record<string, unknown
33
33
  };
34
34
  /** Field key used by the filtering plugin. */
35
35
  filter?: string;
36
+ /** 表头只留给读屏,视觉上留空。 */
37
+ headerHidden?: boolean;
38
+ /** 为 false 时,列宽拖动不给这一列画把手。 */
39
+ resizable?: boolean;
36
40
  renderCell?: (item: T, index: number) => VNodeChild;
37
41
  }
38
42
  interface TableFilterField {
@@ -68,6 +72,47 @@ interface TableSelectionContribution<T> {
68
72
  rowLabel?: (row: T) => string;
69
73
  hasRowHighlight?: boolean;
70
74
  }
75
+ interface TableRowMenuItem {
76
+ id: string;
77
+ label: string;
78
+ icon?: string;
79
+ onSelect: () => void;
80
+ }
81
+ interface TableGroupPatch {
82
+ groupKey: string;
83
+ count: number;
84
+ collapsed: boolean;
85
+ onToggle: () => void;
86
+ render?: () => VNodeChild;
87
+ }
88
+ interface TablePanelPatch {
89
+ variant: 'muted' | 'transparent';
90
+ render: () => VNodeChild;
91
+ }
92
+ interface TableRowPatch {
93
+ attrs?: Record<string, string | undefined>;
94
+ class?: string;
95
+ onClick?: (event: MouseEvent) => void;
96
+ suppressSelection?: boolean;
97
+ skipRowIndex?: boolean;
98
+ group?: TableGroupPatch;
99
+ panel?: TablePanelPatch;
100
+ menu?: readonly TableRowMenuItem[];
101
+ }
102
+ interface TableCellPatch {
103
+ class?: string;
104
+ style?: CSSProperties;
105
+ attrs?: Record<string, string | undefined>;
106
+ }
107
+ interface TableCellPatchInput<T extends Record<string, unknown>> {
108
+ column: TableColumn<T>;
109
+ columns: readonly TableColumn<T>[];
110
+ row: T | null;
111
+ kind: 'header' | 'body';
112
+ }
113
+ interface TableHeaderPatch {
114
+ before?: () => VNodeChild;
115
+ }
71
116
  interface TablePlugin<T extends Record<string, unknown> = Record<string, unknown>> {
72
117
  transformColumns?: (columns: TableColumn<T>[]) => TableColumn<T>[];
73
118
  sortFor?: (column: TableColumn<T>) => TableSortContribution | null;
@@ -76,11 +121,29 @@ interface TablePlugin<T extends Record<string, unknown> = Record<string, unknown
76
121
  widthFor?: (column: TableColumn<T>) => number | undefined;
77
122
  onColumnResizeEnd?: (key: string, width: number) => void;
78
123
  below?: () => VNodeChild;
124
+ /** 改一行的属性、点击、分组头或展开面板。多个插件的结果会合并。 */
125
+ rowPatch?: (row: T, index: number, columnCount: number) => TableRowPatch | null;
126
+ /** 改表头或单元格的定位与类名。选择列的 key 是 `__select`。 */
127
+ cellPatch?: (input: TableCellPatchInput<T>) => TableCellPatch | null;
128
+ /** 在列表头文字前面加控件,例如树的全部展开。 */
129
+ headerPatch?: (column: TableColumn<T>) => TableHeaderPatch | null;
130
+ /** 表格滚动容器挂上或卸下时调用,用来画固定列的滚动阴影。 */
131
+ bindScrollRoot?: (element: HTMLElement | null) => void;
79
132
  }
80
133
  interface TableProps<T extends Record<string, unknown> = Record<string, unknown>> {
81
134
  data?: readonly T[];
82
135
  columns?: readonly TableColumn<T>[];
83
- idKey?: string;
136
+ idKey?: string | ((item: T) => string);
137
+ /**
138
+ * 窗口里第一行数据的行号,从 1 计。
139
+ * 和 `rowCount` 任一设置后,数据行带 `aria-rowindex`。分组头和展开面板不计。
140
+ */
141
+ rowIndexStart?: number;
142
+ /**
143
+ * 完整结果集的行数,含当前窗口以外的行。
144
+ * 设置后表格带 `aria-rowcount`。只设置了 `rowIndexStart` 时,行数为未知(-1)。
145
+ */
146
+ rowCount?: number;
84
147
  density?: TableDensity;
85
148
  dividers?: TableDividers;
86
149
  isStriped?: boolean;
@@ -104,4 +167,4 @@ interface TableCellProps {
104
167
  headers?: string;
105
168
  }
106
169
  //#endregion
107
- export { TableSortEntry as _, TableColumn as a, TableVerticalAlign as b, TableDividers as c, TableFilterValue as d, TablePlugin as f, TableSortDirection as g, TableSlots as h, TableCellProps as i, TableFilterField as l, TableRowProps as m, PixelWidth as n, TableColumnAlign as o, TableProps as p, ProportionalWidth as r, TableDensity as s, ColumnWidth as t, TableFilterState as u, TableSortState as v, TableTextOverflow as y };
170
+ export { TableSortEntry as C, TableVerticalAlign as E, TableSortDirection as S, TableTextOverflow as T, TableProps as _, TableCellProps as a, TableRowProps as b, TableDensity as c, TableFilterState as d, TableFilterValue as f, TablePlugin as g, TablePanelPatch as h, TableCellPatch as i, TableDividers as l, TableHeaderPatch as m, PixelWidth as n, TableColumn as o, TableGroupPatch as p, ProportionalWidth as r, TableColumnAlign as s, ColumnWidth as t, TableFilterField as u, TableRowMenuItem as v, TableSortState as w, TableSlots as x, TableRowPatch as y };
@@ -28,14 +28,14 @@ interface IconColorMap {
28
28
  }
29
29
  type IconColor = Extract<keyof IconColorMap, string>;
30
30
  /**
31
- * The semantic names of the artwork astryx-vue keeps for its own chrome.
31
+ * Semantic names shared by the components.
32
32
  *
33
- * A name describes what the icon is for, not one particular drawing, so a theme
34
- * can replace the artwork with one declaration. Applications never pass these
35
- * names: the artwork is a library implementation detail, and a `icon` prop or
36
- * slot takes a CSS icon class or the application's own component instead.
33
+ * A name is the job, not one drawing. `defineTheme({ icons })` points the name
34
+ * at an Iconify id, and every component that asks for that name follows.
35
+ * `name` on Icon is still a direct Iconify id. `icon` accepts one of these
36
+ * names, a CSS class, or a component.
37
37
  */
38
- type IconName = 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'check' | 'moreHorizontal' | 'copy' | 'calendar' | 'clock' | 'upload' | 'arrowUp' | 'arrowDown' | 'close' | 'funnel' | 'image';
38
+ type IconName = 'close' | 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'chevronsLeft' | 'chevronsRight' | 'check' | 'success' | 'error' | 'warning' | 'info' | 'calendar' | 'clock' | 'externalLink' | 'menu' | 'moreHorizontal' | 'search' | 'upload' | 'arrowUp' | 'arrowDown' | 'arrowsUpDown' | 'funnel' | 'eyeSlash' | 'viewColumns' | 'copy' | 'checkDouble' | 'wrench' | 'stop' | 'microphone' | 'image';
39
39
  /**
40
40
  * A built-in name, or any other string.
41
41
  *
@@ -61,11 +61,12 @@ interface IconProps {
61
61
  /**
62
62
  * The icon to render. Three forms are accepted:
63
63
  *
64
- * - a string, treated as a CSS icon class you provide — for example an
65
- * UnoCSS icon such as `'i-carbon-search'`, or your own class. The class
66
- * paints the inside of the sized box, so a utility that sets
67
- * `width`/`height: 100%` fills the icon instead of replacing its size;
68
- * - a name from the library's own chrome, which only the components use;
64
+ * - a semantic name such as `search` or `close`. The nearest theme decides
65
+ * which Iconify icon that name draws. Until that icon is registered, the
66
+ * built-in glyph is used;
67
+ * - a CSS icon class you provide, such as an UnoCSS class. The class paints
68
+ * the inside of the sized box, so a utility that sets `width`/`height:
69
+ * 100%` fills the icon instead of replacing its size;
69
70
  * - a component, rendered as it is.
70
71
  *
71
72
  * Omit it when `name` or the default slot provides the artwork instead.
@@ -0,0 +1,33 @@
1
+ //#region src/Badge/types.d.ts
2
+ interface BadgeVariantMap {
3
+ blue: true;
4
+ cyan: true;
5
+ error: true;
6
+ green: true;
7
+ info: true;
8
+ neutral: true;
9
+ orange: true;
10
+ pink: true;
11
+ purple: true;
12
+ red: true;
13
+ success: true;
14
+ teal: true;
15
+ warning: true;
16
+ yellow: true;
17
+ }
18
+ type BadgeVariant = Extract<keyof BadgeVariantMap, string>;
19
+ interface BadgeProps {
20
+ /**
21
+ * The visual style of the badge.
22
+ *
23
+ * @default 'neutral'
24
+ */
25
+ variant?: BadgeVariant;
26
+ /**
27
+ * Badge text. A string or number is also set as the title so a clipped
28
+ * label stays reachable. The default slot overrides this when both are set.
29
+ */
30
+ label?: string | number;
31
+ }
32
+ //#endregion
33
+ export { BadgeVariant as n, BadgeVariantMap as r, BadgeProps as t };
@@ -0,0 +1,163 @@
1
+ import { n as SyntaxThemeDefinition } from "./syntaxTheme-Bcs1YMF7.js";
2
+ import { t as SemanticIconMap } from "./semantic-CKH9XVqa.js";
3
+ import { Component } from "vue";
4
+ //#region src/Indicator/types.d.ts
5
+ /**
6
+ * Each family owns its own states.
7
+ *
8
+ * A radio is only chosen or not. A checkbox can also be partial. Keeping the
9
+ * families apart means a radio graphic is never asked to draw a mixed state.
10
+ */
11
+ interface IndicatorFamilyMap {
12
+ singleSelection: 'unchecked' | 'checked';
13
+ multiSelection: 'unchecked' | 'checked' | 'indeterminate';
14
+ }
15
+ type IndicatorFamily = keyof IndicatorFamilyMap & string;
16
+ type IndicatorState<F extends IndicatorFamily = IndicatorFamily> = IndicatorFamilyMap[F];
17
+ /** Matches the control sizes of the inputs that draw these graphics. */
18
+ type IndicatorSize = 'sm' | 'md';
19
+ /**
20
+ * Which edge of a row the mark sits on.
21
+ *
22
+ * Logical, not physical: start is the left edge in left-to-right text.
23
+ * The row decides this. The graphic itself has no position.
24
+ */
25
+ type IndicatorPosition = 'start' | 'end';
26
+ /**
27
+ * Props every indicator accepts.
28
+ *
29
+ * The graphic is decorative. The control that draws it keeps the input, the
30
+ * role, the accessible name, and the keyboard. Hover and focus reach the
31
+ * graphic through the `astryx-indicator-scope` class on that control, not
32
+ * through a prop.
33
+ */
34
+ interface IndicatorProps<F extends IndicatorFamily = IndicatorFamily> {
35
+ /** Which state to draw. The family decides which states exist. */
36
+ state: IndicatorState<F>;
37
+ /**
38
+ * Control size. `sm` is 20px and `md` is 24px.
39
+ * @default 'md'
40
+ */
41
+ size?: IndicatorSize;
42
+ /**
43
+ * Whether the owning control is disabled. Visual only.
44
+ * @default false
45
+ */
46
+ isDisabled?: boolean;
47
+ }
48
+ /** A component that can stand in for one indicator name. */
49
+ type IndicatorComponent<F extends IndicatorFamily = IndicatorFamily> = Component<IndicatorProps<F>>;
50
+ /**
51
+ * Names a theme can replace.
52
+ *
53
+ * Packages can add names by augmenting this interface. Core has no default
54
+ * for a name it does not know, so `getIndicator` returns undefined for those
55
+ * and the caller supplies the fallback.
56
+ */
57
+ interface IndicatorMap {
58
+ /** The mark on a chosen option. A check by default, and nothing when unchosen. */
59
+ check: 'singleSelection';
60
+ /** The circle of a radio. */
61
+ radio: 'singleSelection';
62
+ /** The box of a checkbox, including the partial state. */
63
+ checkbox: 'multiSelection';
64
+ }
65
+ type IndicatorName = keyof IndicatorMap & string;
66
+ type CoreIndicatorName = 'check' | 'checkbox' | 'radio';
67
+ /**
68
+ * Theme overrides, keyed by indicator name.
69
+ *
70
+ * One entry replaces that graphic everywhere it is drawn. Mapping `check` to
71
+ * the radio graphic turns every single-selection mark into a radio.
72
+ */
73
+ interface IndicatorRegistry {
74
+ check?: IndicatorComponent<'singleSelection'>;
75
+ radio?: IndicatorComponent<'singleSelection'>;
76
+ checkbox?: IndicatorComponent<'multiSelection'>;
77
+ [name: string]: Component | undefined;
78
+ }
79
+ //#endregion
80
+ //#region src/Theme/types.d.ts
81
+ /** Color mode for a theme subtree. `system` follows the page and the OS. */
82
+ type ThemeMode = 'light' | 'dark' | 'system';
83
+ /**
84
+ * A token value.
85
+ *
86
+ * A string is used as written. A two-item tuple is the light stop, then the
87
+ * dark stop, and becomes `light-dark()`.
88
+ */
89
+ type ThemeTokenValue = string | readonly [string, string];
90
+ /** CSS custom properties for a theme. Keys may omit the `--astryx-` prefix. */
91
+ type ThemeTokens = Record<string, ThemeTokenValue>;
92
+ /** Token overrides for one inverted surface. */
93
+ interface ThemeSurfaceInput {
94
+ tokens?: ThemeTokens;
95
+ }
96
+ interface DefineThemeInput {
97
+ /** Theme name. Used as `data-astryx-theme`. */
98
+ name: string;
99
+ /** Semantic token overrides for this theme. */
100
+ tokens?: ThemeTokens;
101
+ /** Another theme to start from. This theme's own values win. */
102
+ extends?: ThemeDefinition;
103
+ /** Syntax colors for code in this subtree, unless a SyntaxTheme is closer. */
104
+ syntax?: SyntaxThemeDefinition;
105
+ /** Extra tokens for content on a dark surface. */
106
+ onDark?: ThemeSurfaceInput;
107
+ /** Extra tokens for content on a light surface. */
108
+ onLight?: ThemeSurfaceInput;
109
+ /**
110
+ * Semantic icon name to Iconify id.
111
+ *
112
+ * Entries replace the built-in map by name and merge with the theme this
113
+ * one extends. A name that is not listed keeps the built-in id.
114
+ */
115
+ icons?: SemanticIconMap;
116
+ /**
117
+ * Indicator graphics, replaced by name.
118
+ *
119
+ * One entry reaches every control that draws that indicator. Entries merge
120
+ * with the theme this one extends.
121
+ */
122
+ indicators?: IndicatorRegistry;
123
+ }
124
+ interface ThemeDefinition {
125
+ name: string;
126
+ /** Token values already written as CSS. */
127
+ tokens: Readonly<Record<string, string>>;
128
+ /** Extra tokens applied by MediaTheme when the surface is dark. */
129
+ onDark: Readonly<Record<string, string>>;
130
+ /** Extra tokens applied by MediaTheme when the surface is light. */
131
+ onLight: Readonly<Record<string, string>>;
132
+ syntax?: SyntaxThemeDefinition;
133
+ /** Semantic icon overrides. Absent when this theme does not set any. */
134
+ icons?: SemanticIconMap;
135
+ /** Indicator overrides. Absent when this theme does not set any. */
136
+ indicators?: IndicatorRegistry;
137
+ readonly __astryxTheme: true;
138
+ }
139
+ interface ThemeProps {
140
+ /** Theme from `defineTheme()`. */
141
+ theme: ThemeDefinition;
142
+ /**
143
+ * Color mode for this subtree.
144
+ * @default 'system'
145
+ */
146
+ mode?: ThemeMode;
147
+ }
148
+ /** Surface luminance, `auto` to measure it, or `off` to leave the page theme. */
149
+ type MediaThemeMode = 'dark' | 'light' | 'auto' | 'off';
150
+ interface MediaThemeProps {
151
+ /**
152
+ * Which surface the children sit on.
153
+ * `auto` measures the parent. `off` keeps the surrounding theme.
154
+ */
155
+ mode: MediaThemeMode;
156
+ /**
157
+ * Side used by `auto` before the surface can be measured, and when it cannot.
158
+ * @default 'dark'
159
+ */
160
+ fallback?: 'dark' | 'light';
161
+ }
162
+ //#endregion
163
+ export { IndicatorProps as _, ThemeMode as a, IndicatorState as b, ThemeTokenValue as c, IndicatorComponent as d, IndicatorFamily as f, IndicatorPosition as g, IndicatorName as h, ThemeDefinition as i, ThemeTokens as l, IndicatorMap as m, MediaThemeMode as n, ThemeProps as o, IndicatorFamilyMap as p, MediaThemeProps as r, ThemeSurfaceInput as s, DefineThemeInput as t, CoreIndicatorName as u, IndicatorRegistry as v, IndicatorSize as y };
@@ -1,4 +1,4 @@
1
- import { t as useDismiss } from "./useDismiss-CAiHU6QD.js";
1
+ import { t as useDismiss } from "./useDismiss-Cj8x_51F.js";
2
2
  import { t as usePositionedLayer } from "./usePositionedLayer-C1NBOsVT.js";
3
3
  import { computed, onMounted, ref, watch } from "vue";
4
4
  //#region src/Typeahead/useAnchoredListbox.ts
@@ -0,0 +1,21 @@
1
+ //#region src/composables/useDatePresentation.ts
2
+ /**
3
+ * `presentation` wins over the older native picker name.
4
+ * With neither set, a mouse gets the calendar popover and a coarse pointer gets the system date control.
5
+ */
6
+ function resolveDatePresentation(presentation, nativePicker) {
7
+ if (presentation) return presentation;
8
+ if (nativePicker === "always") return "native";
9
+ if (nativePicker === "never") return "adaptive-bottom-sheet";
10
+ if (nativePicker === "touch") return "adaptive-native";
11
+ return "adaptive-native";
12
+ }
13
+ function resolveDateSurface(presentation, coarse) {
14
+ if (presentation === "popover") return "popover";
15
+ if (presentation === "bottom-sheet") return "sheet";
16
+ if (presentation === "native") return "native";
17
+ if (presentation === "adaptive-bottom-sheet") return coarse ? "sheet" : "popover";
18
+ return coarse ? "native" : "popover";
19
+ }
20
+ //#endregion
21
+ export { resolveDateSurface as n, resolveDatePresentation as t };
@@ -1,4 +1,3 @@
1
- import { CalendarDate } from "@internationalized/date";
2
1
  //#region src/composables/useDateRange.ts
3
2
  const WEEKDAY_INDEX = {
4
3
  sun: 0,
@@ -96,44 +95,4 @@ function formatDateRange(range, locale) {
96
95
  return `${format(range.start)} – ${format(range.end)}`;
97
96
  }
98
97
  //#endregion
99
- //#region src/composables/useMonthGrid.ts
100
- function toISODate(date) {
101
- const month = String(date.month).padStart(2, "0");
102
- const day = String(date.day).padStart(2, "0");
103
- return `${date.year}-${month}-${day}`;
104
- }
105
- function parseISODate(value) {
106
- const [year, month, day] = value.split("-").map(Number);
107
- return new CalendarDate(year, month, day);
108
- }
109
- function buildMonthGrid(year, month, weekStartsOn) {
110
- const first = new CalendarDate(year, month, 1);
111
- const start = resolveWeekStart(weekStartsOn);
112
- const offset = (first.toDate("UTC").getUTCDay() - start + 7) % 7;
113
- let cursor = first.subtract({ days: offset });
114
- const weeks = [];
115
- for (let week = 0; week < 6; week += 1) {
116
- const days = [];
117
- for (let day = 0; day < 7; day += 1) {
118
- days.push(toISODate(cursor));
119
- cursor = cursor.add({ days: 1 });
120
- }
121
- weeks.push(days);
122
- }
123
- return weeks;
124
- }
125
- function addMonths(year, month, amount) {
126
- const date = new CalendarDate(year, month, 1).add({ months: amount });
127
- return {
128
- year: date.year,
129
- month: date.month
130
- };
131
- }
132
- function todayISODate() {
133
- const now = /* @__PURE__ */ new Date();
134
- const month = String(now.getMonth() + 1).padStart(2, "0");
135
- const day = String(now.getDate()).padStart(2, "0");
136
- return `${now.getFullYear()}-${month}-${day}`;
137
- }
138
- //#endregion
139
- export { todayISODate as a, formatDateRange as c, isSameRange as d, orderRange as f, toISODate as i, isDayOutsideSpan as l, spanDays as m, buildMonthGrid as n, applyRangeClick as o, resolveWeekStart as p, parseISODate as r, compareISODate as s, addMonths as t, isRangeWithinSpan as u };
98
+ export { isRangeWithinSpan as a, resolveWeekStart as c, isDayOutsideSpan as i, spanDays as l, compareISODate as n, isSameRange as o, formatDateRange as r, orderRange as s, applyRangeClick as t };
@@ -0,0 +1,24 @@
1
+ import { onBeforeUnmount, watchEffect } from "vue";
2
+ //#region src/composables/useDisclosureHandle.ts
3
+ function publish(target, value) {
4
+ if (target == null) return;
5
+ if (typeof target === "function") target(value);
6
+ else target.value = value;
7
+ }
8
+ /**
9
+ * 把打开、关闭、切换和当前是否打开写到调用方持有的句柄上。
10
+ * 必须传入读取函数。句柄本身常常就是一个 ref,直接交给 Vue 的解包会拿到里面的 null。
11
+ * 句柄换掉时先把旧的清空,组件卸载时也清空。
12
+ */
13
+ function useDisclosureHandle(read, handle) {
14
+ let previous;
15
+ watchEffect(() => {
16
+ const target = read();
17
+ if (previous != null && previous !== target) publish(previous, null);
18
+ publish(target, handle);
19
+ previous = target;
20
+ });
21
+ onBeforeUnmount(() => publish(read(), null));
22
+ }
23
+ //#endregion
24
+ export { useDisclosureHandle as t };
@@ -13,6 +13,10 @@ const escapeStack = [];
13
13
  function useDismiss(options) {
14
14
  const { container, trigger, isEnabled, enableEscape = { value: true }, onDismiss } = options;
15
15
  let isAttached = false;
16
+ function dismissFromEscape() {
17
+ if (options.onEscape != null) options.onEscape();
18
+ else onDismiss();
19
+ }
16
20
  function onClickOutside(event) {
17
21
  if (!isEnabled.value) return;
18
22
  const el = container.value;
@@ -25,9 +29,9 @@ function useDismiss(options) {
25
29
  function onEscapeKey(event) {
26
30
  if (!isEnabled.value || !enableEscape.value) return;
27
31
  if (event.key === "Escape") {
28
- if (escapeStack[escapeStack.length - 1] === onDismiss) {
32
+ if (escapeStack[escapeStack.length - 1] === dismissFromEscape) {
29
33
  event.preventDefault();
30
- onDismiss();
34
+ dismissFromEscape();
31
35
  }
32
36
  }
33
37
  }
@@ -38,14 +42,14 @@ function useDismiss(options) {
38
42
  isAttached = true;
39
43
  document.addEventListener("pointerdown", onClickOutside, true);
40
44
  document.addEventListener("keydown", onEscapeKey, true);
41
- if (enableEscape.value) escapeStack.push(onDismiss);
45
+ if (enableEscape.value) escapeStack.push(dismissFromEscape);
42
46
  }
43
47
  function teardown() {
44
48
  if (typeof document === "undefined" || !isAttached) return;
45
49
  isAttached = false;
46
50
  document.removeEventListener("pointerdown", onClickOutside, true);
47
51
  document.removeEventListener("keydown", onEscapeKey, true);
48
- const index = escapeStack.indexOf(onDismiss);
52
+ const index = escapeStack.indexOf(dismissFromEscape);
49
53
  if (index !== -1) escapeStack.splice(index, 1);
50
54
  }
51
55
  watch(isEnabled, (enabled) => {
@@ -0,0 +1,18 @@
1
+ import { computed, toValue } from "vue";
2
+ //#region src/composables/useFieldControlState.ts
3
+ /**
4
+ * 选择器和复选列表共用的三种互斥状态。
5
+ * 同时标成禁用和只读时,按禁用处理。
6
+ */
7
+ function useFieldControlState(input) {
8
+ const isDisabled = computed(() => toValue(input.disabled) === true);
9
+ const isReadOnly = computed(() => toValue(input.readOnly) === true && !isDisabled.value);
10
+ return {
11
+ isDisabled,
12
+ isReadOnly,
13
+ isLoading: computed(() => toValue(input.loading) === true),
14
+ canActivate: computed(() => !isDisabled.value && !isReadOnly.value)
15
+ };
16
+ }
17
+ //#endregion
18
+ export { useFieldControlState as t };
@@ -0,0 +1,17 @@
1
+ import { onBeforeUnmount, watch } from "vue";
2
+ //#region src/composables/useHandleRef.ts
3
+ function publish(target, handle) {
4
+ if (target == null) return;
5
+ if (typeof target === "function") target(handle);
6
+ else target.value = handle;
7
+ }
8
+ /** Keeps an imperative handle on a ref or a callback, and clears it when the owner goes away. */
9
+ function useHandleRef(read, handle) {
10
+ watch(read, (_next, previous) => {
11
+ if (previous != null && previous !== read()) publish(previous, null);
12
+ publish(read(), handle);
13
+ }, { immediate: true });
14
+ onBeforeUnmount(() => publish(read(), null));
15
+ }
16
+ //#endregion
17
+ export { useHandleRef as t };
@@ -0,0 +1,147 @@
1
+ import { t as _sfc_main$2 } from "./Icon-bteSId7T.js";
2
+ import { n as themeContextKey } from "./context-Cws_tXTr.js";
3
+ import { n as decorativeAttrs, t as _sfc_main$3 } from "./CheckboxIndicator-D37cm2Rh.js";
4
+ import { Comment, Fragment, Text, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, inject, mergeProps, openBlock, renderSlot, unref, useAttrs, useSlots, useTemplateRef } from "vue";
5
+ import "../styles/check-indicator.css";
6
+ import "../styles/radio-indicator.css";
7
+ //#region src/Indicator/isRenderable.ts
8
+ /**
9
+ * Whether a slot or vnode should replace an indicator's own mark.
10
+ *
11
+ * Null, undefined, booleans, and the empty string do not count. An element
12
+ * does, even when that element later renders nothing. A host writes
13
+ * `v-if="busy"` around a spinner, and `false` must not delete the mark.
14
+ */
15
+ function isRenderable(value) {
16
+ if (value == null || typeof value === "boolean" || value === "") return false;
17
+ if (Array.isArray(value)) return value.some((item) => isRenderable(item));
18
+ if (typeof value !== "object") return true;
19
+ const node = value;
20
+ if (node.type === Comment) return false;
21
+ if (node.type === Text) return String(node.children ?? "").trim() !== "";
22
+ if (node.type === Fragment) return isRenderable(node.children);
23
+ return true;
24
+ }
25
+ //#endregion
26
+ //#region src/Indicator/useReplacementSlot.ts
27
+ /**
28
+ * Whether the default slot should take the place of the state mark.
29
+ *
30
+ * Called during render. The slot function runs once to inspect, and the
31
+ * template renders it again when the answer is yes.
32
+ */
33
+ function useReplacementSlot() {
34
+ const slots = useSlots();
35
+ return () => isRenderable(slots.default?.());
36
+ }
37
+ //#endregion
38
+ //#region src/Indicator/CheckIndicator.vue
39
+ const _hoisted_1$1 = ["data-size", "data-disabled"];
40
+ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
41
+ name: "AstryxCheckIndicator",
42
+ inheritAttrs: false,
43
+ __name: "CheckIndicator",
44
+ props: {
45
+ state: {},
46
+ size: { default: "md" },
47
+ isDisabled: { type: Boolean }
48
+ },
49
+ setup(__props, { expose: __expose }) {
50
+ const props = __props;
51
+ const attrs = useAttrs();
52
+ const element = useTemplateRef("mark");
53
+ const passed = computed(() => decorativeAttrs(attrs));
54
+ const replacement = useReplacementSlot();
55
+ __expose({ element });
56
+ return (_ctx, _cache) => {
57
+ return unref(replacement)() ? (openBlock(), createElementBlock("span", mergeProps({
58
+ key: 0,
59
+ ref: "mark"
60
+ }, passed.value, {
61
+ class: "astryx-check-indicator",
62
+ "aria-hidden": "true",
63
+ "data-size": props.size,
64
+ "data-disabled": __props.isDisabled || void 0
65
+ }), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1)) : __props.state === "checked" ? (openBlock(), createBlock(_sfc_main$2, mergeProps({
66
+ key: 1,
67
+ ref: "mark"
68
+ }, passed.value, {
69
+ icon: "check",
70
+ size: "sm",
71
+ color: __props.isDisabled ? "disabled" : "accent",
72
+ "aria-hidden": "true"
73
+ }), null, 16, ["color"])) : createCommentVNode("v-if", true);
74
+ };
75
+ }
76
+ });
77
+ //#endregion
78
+ //#region src/Indicator/RadioIndicator.vue
79
+ const _hoisted_1 = [
80
+ "data-state",
81
+ "data-size",
82
+ "data-disabled"
83
+ ];
84
+ const _hoisted_2 = {
85
+ key: 0,
86
+ class: "astryx-radio-indicator-dot"
87
+ };
88
+ const _sfc_main = /*@__PURE__*/ defineComponent({
89
+ name: "AstryxRadioIndicator",
90
+ inheritAttrs: false,
91
+ __name: "RadioIndicator",
92
+ props: {
93
+ state: {},
94
+ size: {},
95
+ isDisabled: { type: Boolean }
96
+ },
97
+ setup(__props, { expose: __expose }) {
98
+ const props = __props;
99
+ const attrs = useAttrs();
100
+ const element = useTemplateRef("indicator");
101
+ const passed = computed(() => decorativeAttrs(attrs));
102
+ const checked = computed(() => props.state !== "unchecked");
103
+ __expose({ element });
104
+ return (_ctx, _cache) => {
105
+ return openBlock(), createElementBlock("span", mergeProps(passed.value, {
106
+ ref: "indicator",
107
+ class: "astryx-radio-indicator",
108
+ "aria-hidden": "true",
109
+ "data-state": checked.value ? "checked" : "unchecked",
110
+ "data-size": props.size,
111
+ "data-disabled": __props.isDisabled || void 0
112
+ }), [renderSlot(_ctx.$slots, "default", {}, () => [checked.value ? (openBlock(), createElementBlock("span", _hoisted_2)) : createCommentVNode("v-if", true)])], 16, _hoisted_1);
113
+ };
114
+ }
115
+ });
116
+ //#endregion
117
+ //#region src/Indicator/registry.ts
118
+ /**
119
+ * The graphics this package ships.
120
+ *
121
+ * A theme's `indicators` entries replace these by name. The set is closed:
122
+ * a name added by augmentation is not in here.
123
+ */
124
+ const defaultIndicators = {
125
+ check: _sfc_main$1,
126
+ checkbox: _sfc_main$3,
127
+ radio: _sfc_main
128
+ };
129
+ function isCoreIndicatorName(name) {
130
+ return name === "check" || name === "checkbox" || name === "radio";
131
+ }
132
+ function themeIndicators(theme) {
133
+ return theme?.indicators;
134
+ }
135
+ function getIndicator(name, theme) {
136
+ const override = themeIndicators(theme)?.[name];
137
+ if (override) return override;
138
+ if (isCoreIndicatorName(name)) return defaultIndicators[name];
139
+ }
140
+ //#endregion
141
+ //#region src/Indicator/useIndicator.ts
142
+ function useIndicator(name) {
143
+ const context = inject(themeContextKey, null);
144
+ return computed(() => getIndicator(name, context?.value.theme));
145
+ }
146
+ //#endregion
147
+ export { _sfc_main as a, isCoreIndicatorName as i, defaultIndicators as n, _sfc_main$1 as o, getIndicator as r, isRenderable as s, useIndicator as t };