@nizivo/react 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +120 -2
  3. package/THIRD_PARTY_NOTICES +68 -0
  4. package/dist/_engines/react-aria/dialog.client.js +126 -0
  5. package/dist/_engines/react-aria/dom-allowlist.js +19 -0
  6. package/dist/_engines/react-aria/dom.js +31 -0
  7. package/dist/_engines/react-aria/drawer.client.js +8 -0
  8. package/dist/_engines/react-aria/file-upload.client.js +50 -0
  9. package/dist/_engines/react-aria/locale.client.js +13 -0
  10. package/dist/_engines/react-aria/menu.client.js +229 -0
  11. package/dist/_engines/react-aria/open-state.client.js +53 -0
  12. package/dist/_engines/react-aria/outside-press.client.js +61 -0
  13. package/dist/_engines/react-aria/overlay.client.js +46 -0
  14. package/dist/_engines/react-aria/popover.client.js +148 -0
  15. package/dist/_engines/react-aria/popup.client.js +153 -0
  16. package/dist/_engines/react-aria/select.client.js +180 -0
  17. package/dist/_engines/react-aria/tabs.client.js +95 -0
  18. package/dist/_engines/react-aria/toast.client.js +38 -0
  19. package/dist/_engines/react-aria/tooltip.client.js +72 -0
  20. package/dist/_internal/cx.js +11 -0
  21. package/dist/_internal/data-status.d.ts +3 -0
  22. package/dist/_internal/data-status.js +13 -0
  23. package/dist/_internal/engine-part.d.ts +1 -0
  24. package/dist/_internal/field.js +20 -0
  25. package/dist/_internal/glyphs.js +87 -0
  26. package/dist/_internal/keys.js +62 -0
  27. package/dist/_internal/modal.client.js +54 -0
  28. package/dist/_internal/nested-focus.js +33 -0
  29. package/dist/_internal/overlay.d.ts +9 -0
  30. package/dist/_virtual/_rolldown/runtime.js +13 -0
  31. package/dist/alert/alert-dismiss.client.d.ts +32 -0
  32. package/dist/alert/alert-dismiss.client.js +38 -0
  33. package/dist/alert/alert.d.ts +28 -0
  34. package/dist/alert/alert.js +44 -0
  35. package/dist/alert/index.d.ts +3 -0
  36. package/dist/alert/index.js +3 -0
  37. package/dist/app-shell/app-shell.d.ts +24 -0
  38. package/dist/app-shell/app-shell.js +56 -0
  39. package/dist/app-shell/index.d.ts +2 -0
  40. package/dist/app-shell/index.js +1 -0
  41. package/dist/augment.d.ts +13 -0
  42. package/dist/augment.js +0 -0
  43. package/dist/avatar/avatar.d.ts +96 -0
  44. package/dist/avatar/avatar.js +94 -0
  45. package/dist/avatar/index.d.ts +2 -0
  46. package/dist/avatar/index.js +1 -0
  47. package/dist/badge/badge.d.ts +19 -0
  48. package/dist/badge/badge.js +22 -0
  49. package/dist/badge/index.d.ts +2 -0
  50. package/dist/badge/index.js +1 -0
  51. package/dist/banner/banner-dismiss.client.d.ts +32 -0
  52. package/dist/banner/banner-dismiss.client.js +38 -0
  53. package/dist/banner/banner.d.ts +34 -0
  54. package/dist/banner/banner.js +47 -0
  55. package/dist/banner/index.d.ts +3 -0
  56. package/dist/banner/index.js +3 -0
  57. package/dist/breadcrumb/breadcrumb.d.ts +46 -0
  58. package/dist/breadcrumb/breadcrumb.js +46 -0
  59. package/dist/breadcrumb/breadcrumb.parts.d.ts +6 -0
  60. package/dist/breadcrumb/breadcrumb.parts.js +9 -0
  61. package/dist/breadcrumb/index.d.ts +3 -0
  62. package/dist/breadcrumb/index.js +3 -0
  63. package/dist/button/button.d.ts +55 -0
  64. package/dist/button/button.js +62 -0
  65. package/dist/button/index.d.ts +2 -0
  66. package/dist/button/index.js +1 -0
  67. package/dist/card/card.d.ts +64 -0
  68. package/dist/card/card.js +62 -0
  69. package/dist/card/card.parts.d.ts +6 -0
  70. package/dist/card/card.parts.js +14 -0
  71. package/dist/card/index.d.ts +3 -0
  72. package/dist/card/index.js +3 -0
  73. package/dist/checkbox/checkbox.client.d.ts +37 -0
  74. package/dist/checkbox/checkbox.client.js +81 -0
  75. package/dist/checkbox/index.d.ts +2 -0
  76. package/dist/checkbox/index.js +1 -0
  77. package/dist/chip-group/chip-group.client.d.ts +88 -0
  78. package/dist/chip-group/chip-group.client.js +157 -0
  79. package/dist/chip-group/index.d.ts +2 -0
  80. package/dist/chip-group/index.js +1 -0
  81. package/dist/choice-card/choice-card.client.d.ts +66 -0
  82. package/dist/choice-card/choice-card.client.js +138 -0
  83. package/dist/choice-card/index.d.ts +2 -0
  84. package/dist/choice-card/index.js +1 -0
  85. package/dist/config/config.client.d.ts +24 -0
  86. package/dist/config/config.client.js +33 -0
  87. package/dist/config/index.d.ts +2 -0
  88. package/dist/config/index.js +1 -0
  89. package/dist/container/container.d.ts +13 -0
  90. package/dist/container/container.js +16 -0
  91. package/dist/container/index.d.ts +2 -0
  92. package/dist/container/index.js +1 -0
  93. package/dist/contracts/details.d.ts +13 -0
  94. package/dist/contracts/details.js +9 -0
  95. package/dist/contracts/index.d.ts +5 -0
  96. package/dist/contracts/index.js +5 -0
  97. package/dist/contracts/merge-props.d.ts +16 -0
  98. package/dist/contracts/merge-props.js +76 -0
  99. package/dist/contracts/render.d.ts +17 -0
  100. package/dist/contracts/render.js +43 -0
  101. package/dist/contracts/state.d.ts +42 -0
  102. package/dist/contracts/state.js +42 -0
  103. package/dist/css/alert.css +2 -0
  104. package/dist/css/app-shell.css +2 -0
  105. package/dist/css/avatar.css +2 -0
  106. package/dist/css/badge.css +2 -0
  107. package/dist/css/banner.css +2 -0
  108. package/dist/css/base.css +2 -0
  109. package/dist/css/breadcrumb.css +2 -0
  110. package/dist/css/button.css +2 -0
  111. package/dist/css/card.css +2 -0
  112. package/dist/css/checkbox.css +2 -0
  113. package/dist/css/chip-group.css +2 -0
  114. package/dist/css/choice-card.css +2 -0
  115. package/dist/css/container.css +2 -0
  116. package/dist/css/delta.css +2 -0
  117. package/dist/css/dialog.css +2 -0
  118. package/dist/css/drawer.css +2 -0
  119. package/dist/css/empty-state.css +2 -0
  120. package/dist/css/field.css +2 -0
  121. package/dist/css/fieldset.css +2 -0
  122. package/dist/css/file-upload.css +2 -0
  123. package/dist/css/form.css +2 -0
  124. package/dist/css/grid.css +2 -0
  125. package/dist/css/heading.css +2 -0
  126. package/dist/css/icon-button.css +2 -0
  127. package/dist/css/image.css +2 -0
  128. package/dist/css/inline-error.css +2 -0
  129. package/dist/css/inline.css +2 -0
  130. package/dist/css/input.css +2 -0
  131. package/dist/css/kbd.css +2 -0
  132. package/dist/css/kpi-tile.css +2 -0
  133. package/dist/css/menu.css +2 -0
  134. package/dist/css/meter.css +2 -0
  135. package/dist/css/metric.css +2 -0
  136. package/dist/css/mobile-tab-bar.css +2 -0
  137. package/dist/css/mobile-top-bar.css +2 -0
  138. package/dist/css/motion.css +2 -0
  139. package/dist/css/native-select.css +2 -0
  140. package/dist/css/nav-item.css +2 -0
  141. package/dist/css/number-value.css +2 -0
  142. package/dist/css/page-header.css +2 -0
  143. package/dist/css/pagination.css +2 -0
  144. package/dist/css/password-input.css +2 -0
  145. package/dist/css/popover.css +2 -0
  146. package/dist/css/progress-bar.css +2 -0
  147. package/dist/css/progress-ring.css +2 -0
  148. package/dist/css/radio-group.css +2 -0
  149. package/dist/css/ranked-list.css +2 -0
  150. package/dist/css/search-field.css +2 -0
  151. package/dist/css/segmented-control.css +2 -0
  152. package/dist/css/select.css +2 -0
  153. package/dist/css/separator.css +2 -0
  154. package/dist/css/sidebar.css +2 -0
  155. package/dist/css/skeleton.css +2 -0
  156. package/dist/css/split.css +2 -0
  157. package/dist/css/stack.css +2 -0
  158. package/dist/css/sticky-bar.css +2 -0
  159. package/dist/css/switch.css +2 -0
  160. package/dist/css/tab-nav.css +2 -0
  161. package/dist/css/table-selection.css +2 -0
  162. package/dist/css/table.css +2 -0
  163. package/dist/css/tabs.css +2 -0
  164. package/dist/css/text.css +2 -0
  165. package/dist/css/textarea.css +2 -0
  166. package/dist/css/toast.css +2 -0
  167. package/dist/css/tooltip.css +2 -0
  168. package/dist/css/top-bar.css +2 -0
  169. package/dist/css/trend-card.css +2 -0
  170. package/dist/delta/delta.d.ts +32 -0
  171. package/dist/delta/delta.js +50 -0
  172. package/dist/delta/index.d.ts +2 -0
  173. package/dist/delta/index.js +1 -0
  174. package/dist/dialog/dialog.client.d.ts +25 -0
  175. package/dist/dialog/dialog.client.js +145 -0
  176. package/dist/dialog/dialog.contract.d.ts +97 -0
  177. package/dist/dialog/dialog.parts.d.ts +6 -0
  178. package/dist/dialog/dialog.parts.js +15 -0
  179. package/dist/dialog/index.d.ts +5 -0
  180. package/dist/dialog/index.js +3 -0
  181. package/dist/drawer/drawer.client.d.ts +25 -0
  182. package/dist/drawer/drawer.client.js +154 -0
  183. package/dist/drawer/drawer.contract.d.ts +98 -0
  184. package/dist/drawer/drawer.parts.d.ts +6 -0
  185. package/dist/drawer/drawer.parts.js +16 -0
  186. package/dist/drawer/index.d.ts +5 -0
  187. package/dist/drawer/index.js +3 -0
  188. package/dist/empty-state/empty-state.d.ts +18 -0
  189. package/dist/empty-state/empty-state.js +32 -0
  190. package/dist/empty-state/index.d.ts +2 -0
  191. package/dist/empty-state/index.js +1 -0
  192. package/dist/field/field-scope.client.d.ts +50 -0
  193. package/dist/field/field-scope.client.js +212 -0
  194. package/dist/field/field-static.d.ts +122 -0
  195. package/dist/field/field-static.js +159 -0
  196. package/dist/field/field.d.ts +5 -0
  197. package/dist/field/field.js +53 -0
  198. package/dist/field/index.d.ts +4 -0
  199. package/dist/field/index.js +4 -0
  200. package/dist/fieldset/fieldset.d.ts +36 -0
  201. package/dist/fieldset/fieldset.js +63 -0
  202. package/dist/fieldset/index.d.ts +2 -0
  203. package/dist/fieldset/index.js +1 -0
  204. package/dist/file-upload/file-upload.client.d.ts +9 -0
  205. package/dist/file-upload/file-upload.client.js +406 -0
  206. package/dist/file-upload/file-upload.contract.d.ts +112 -0
  207. package/dist/file-upload/index.d.ts +3 -0
  208. package/dist/file-upload/index.js +1 -0
  209. package/dist/file-upload/seam.d.ts +1 -0
  210. package/dist/form/form.client.d.ts +38 -0
  211. package/dist/form/form.client.js +127 -0
  212. package/dist/form/form.d.ts +36 -0
  213. package/dist/form/form.js +29 -0
  214. package/dist/form/index.d.ts +4 -0
  215. package/dist/form/index.js +4 -0
  216. package/dist/form/submit-button.client.d.ts +20 -0
  217. package/dist/form/submit-button.client.js +19 -0
  218. package/dist/grid/grid.d.ts +38 -0
  219. package/dist/grid/grid.js +28 -0
  220. package/dist/grid/index.d.ts +2 -0
  221. package/dist/grid/index.js +1 -0
  222. package/dist/heading/heading.d.ts +30 -0
  223. package/dist/heading/heading.js +26 -0
  224. package/dist/heading/index.d.ts +2 -0
  225. package/dist/heading/index.js +1 -0
  226. package/dist/i18n/format-label.d.ts +24 -0
  227. package/dist/i18n/format-label.js +19 -0
  228. package/dist/i18n/index.d.ts +2 -0
  229. package/dist/i18n/index.js +1 -0
  230. package/dist/icon-button/icon-button-static.d.ts +23 -0
  231. package/dist/icon-button/icon-button-static.js +83 -0
  232. package/dist/icon-button/icon-button.client.js +29 -0
  233. package/dist/icon-button/icon-button.contract.d.ts +89 -0
  234. package/dist/icon-button/icon-button.d.ts +5 -0
  235. package/dist/icon-button/icon-button.js +21 -0
  236. package/dist/icon-button/index.d.ts +4 -0
  237. package/dist/icon-button/index.js +3 -0
  238. package/dist/image/image.d.ts +28 -0
  239. package/dist/image/image.js +24 -0
  240. package/dist/image/index.d.ts +2 -0
  241. package/dist/image/index.js +1 -0
  242. package/dist/index.d.ts +174 -0
  243. package/dist/index.js +96 -0
  244. package/dist/inline/index.d.ts +2 -0
  245. package/dist/inline/index.js +1 -0
  246. package/dist/inline/inline.d.ts +16 -0
  247. package/dist/inline/inline.js +14 -0
  248. package/dist/inline-error/index.d.ts +2 -0
  249. package/dist/inline-error/index.js +1 -0
  250. package/dist/inline-error/inline-error.d.ts +17 -0
  251. package/dist/inline-error/inline-error.js +33 -0
  252. package/dist/input/index.d.ts +2 -0
  253. package/dist/input/index.js +1 -0
  254. package/dist/input/input.client.d.ts +39 -0
  255. package/dist/input/input.client.js +82 -0
  256. package/dist/kbd/index.d.ts +2 -0
  257. package/dist/kbd/index.js +1 -0
  258. package/dist/kbd/kbd.d.ts +19 -0
  259. package/dist/kbd/kbd.js +68 -0
  260. package/dist/kpi-tile/index.d.ts +2 -0
  261. package/dist/kpi-tile/index.js +1 -0
  262. package/dist/kpi-tile/kpi-tile.d.ts +30 -0
  263. package/dist/kpi-tile/kpi-tile.js +48 -0
  264. package/dist/locales/en-US.d.ts +77 -0
  265. package/dist/locales/en-US.js +83 -0
  266. package/dist/menu/index.d.ts +5 -0
  267. package/dist/menu/index.js +3 -0
  268. package/dist/menu/menu.client.d.ts +14 -0
  269. package/dist/menu/menu.client.js +152 -0
  270. package/dist/menu/menu.contract.d.ts +152 -0
  271. package/dist/menu/menu.parts.d.ts +6 -0
  272. package/dist/menu/menu.parts.js +17 -0
  273. package/dist/meter/index.d.ts +2 -0
  274. package/dist/meter/index.js +1 -0
  275. package/dist/meter/meter.d.ts +43 -0
  276. package/dist/meter/meter.js +59 -0
  277. package/dist/metric/index.d.ts +2 -0
  278. package/dist/metric/index.js +1 -0
  279. package/dist/metric/metric.d.ts +72 -0
  280. package/dist/metric/metric.js +116 -0
  281. package/dist/mobile-tab-bar/index.d.ts +4 -0
  282. package/dist/mobile-tab-bar/index.js +4 -0
  283. package/dist/mobile-tab-bar/mobile-tab-bar-inset.client.js +38 -0
  284. package/dist/mobile-tab-bar/mobile-tab-bar-more.client.d.ts +26 -0
  285. package/dist/mobile-tab-bar/mobile-tab-bar-more.client.js +60 -0
  286. package/dist/mobile-tab-bar/mobile-tab-bar.d.ts +39 -0
  287. package/dist/mobile-tab-bar/mobile-tab-bar.js +54 -0
  288. package/dist/mobile-tab-bar/mobile-tab-bar.parts.d.ts +6 -0
  289. package/dist/mobile-tab-bar/mobile-tab-bar.parts.js +9 -0
  290. package/dist/mobile-top-bar/index.d.ts +2 -0
  291. package/dist/mobile-top-bar/index.js +1 -0
  292. package/dist/mobile-top-bar/mobile-top-bar.d.ts +17 -0
  293. package/dist/mobile-top-bar/mobile-top-bar.js +31 -0
  294. package/dist/motion/count-up.client.d.ts +39 -0
  295. package/dist/motion/count-up.client.js +109 -0
  296. package/dist/motion/index.d.ts +2 -0
  297. package/dist/motion/index.js +1 -0
  298. package/dist/native-select/index.d.ts +2 -0
  299. package/dist/native-select/index.js +1 -0
  300. package/dist/native-select/native-select.d.ts +43 -0
  301. package/dist/native-select/native-select.js +56 -0
  302. package/dist/nav-item/index.d.ts +2 -0
  303. package/dist/nav-item/index.js +1 -0
  304. package/dist/nav-item/nav-item.d.ts +35 -0
  305. package/dist/nav-item/nav-item.js +50 -0
  306. package/dist/number-value/index.d.ts +2 -0
  307. package/dist/number-value/index.js +1 -0
  308. package/dist/number-value/number-value.d.ts +25 -0
  309. package/dist/number-value/number-value.js +26 -0
  310. package/dist/page-header/index.d.ts +2 -0
  311. package/dist/page-header/index.js +1 -0
  312. package/dist/page-header/page-header.d.ts +19 -0
  313. package/dist/page-header/page-header.js +39 -0
  314. package/dist/pagination/index.d.ts +2 -0
  315. package/dist/pagination/index.js +1 -0
  316. package/dist/pagination/pagination.d.ts +74 -0
  317. package/dist/pagination/pagination.js +136 -0
  318. package/dist/password-input/index.d.ts +2 -0
  319. package/dist/password-input/index.js +1 -0
  320. package/dist/password-input/password-input.client.d.ts +52 -0
  321. package/dist/password-input/password-input.client.js +106 -0
  322. package/dist/popover/index.d.ts +5 -0
  323. package/dist/popover/index.js +3 -0
  324. package/dist/popover/popover.client.d.ts +20 -0
  325. package/dist/popover/popover.client.js +113 -0
  326. package/dist/popover/popover.contract.d.ts +88 -0
  327. package/dist/popover/popover.parts.d.ts +6 -0
  328. package/dist/popover/popover.parts.js +13 -0
  329. package/dist/progress-bar/index.d.ts +2 -0
  330. package/dist/progress-bar/index.js +1 -0
  331. package/dist/progress-bar/progress-bar.d.ts +34 -0
  332. package/dist/progress-bar/progress-bar.js +55 -0
  333. package/dist/progress-ring/index.d.ts +2 -0
  334. package/dist/progress-ring/index.js +1 -0
  335. package/dist/progress-ring/progress-ring.d.ts +38 -0
  336. package/dist/progress-ring/progress-ring.js +67 -0
  337. package/dist/radio-group/index.d.ts +3 -0
  338. package/dist/radio-group/index.js +3 -0
  339. package/dist/radio-group/radio-group.client.d.ts +22 -0
  340. package/dist/radio-group/radio-group.client.js +70 -0
  341. package/dist/radio-group/radio-group.d.ts +28 -0
  342. package/dist/radio-group/radio-group.js +35 -0
  343. package/dist/ranked-list/index.d.ts +3 -0
  344. package/dist/ranked-list/index.js +3 -0
  345. package/dist/ranked-list/ranked-list.d.ts +85 -0
  346. package/dist/ranked-list/ranked-list.js +153 -0
  347. package/dist/ranked-list/ranked-list.parts.d.ts +6 -0
  348. package/dist/ranked-list/ranked-list.parts.js +10 -0
  349. package/dist/search-field/index.d.ts +2 -0
  350. package/dist/search-field/index.js +1 -0
  351. package/dist/search-field/search-field.client.d.ts +55 -0
  352. package/dist/search-field/search-field.client.js +136 -0
  353. package/dist/segmented-control/index.d.ts +3 -0
  354. package/dist/segmented-control/index.js +3 -0
  355. package/dist/segmented-control/segmented-control.client.d.ts +61 -0
  356. package/dist/segmented-control/segmented-control.client.js +156 -0
  357. package/dist/segmented-control/segmented-control.parts.d.ts +6 -0
  358. package/dist/segmented-control/segmented-control.parts.js +9 -0
  359. package/dist/select/index.d.ts +5 -0
  360. package/dist/select/index.js +3 -0
  361. package/dist/select/select.client.d.ts +12 -0
  362. package/dist/select/select.client.js +152 -0
  363. package/dist/select/select.contract.d.ts +119 -0
  364. package/dist/select/select.parts.d.ts +6 -0
  365. package/dist/select/select.parts.js +15 -0
  366. package/dist/separator/index.d.ts +2 -0
  367. package/dist/separator/index.js +1 -0
  368. package/dist/separator/separator.d.ts +26 -0
  369. package/dist/separator/separator.js +23 -0
  370. package/dist/sidebar/index.d.ts +4 -0
  371. package/dist/sidebar/index.js +4 -0
  372. package/dist/sidebar/sidebar-item.client.d.ts +10 -0
  373. package/dist/sidebar/sidebar-item.client.js +55 -0
  374. package/dist/sidebar/sidebar.d.ts +45 -0
  375. package/dist/sidebar/sidebar.js +62 -0
  376. package/dist/sidebar/sidebar.parts.d.ts +6 -0
  377. package/dist/sidebar/sidebar.parts.js +11 -0
  378. package/dist/skeleton/index.d.ts +2 -0
  379. package/dist/skeleton/index.js +1 -0
  380. package/dist/skeleton/skeleton.d.ts +20 -0
  381. package/dist/skeleton/skeleton.js +19 -0
  382. package/dist/split/index.d.ts +3 -0
  383. package/dist/split/index.js +3 -0
  384. package/dist/split/split.d.ts +28 -0
  385. package/dist/split/split.js +33 -0
  386. package/dist/split/split.parts.d.ts +6 -0
  387. package/dist/split/split.parts.js +10 -0
  388. package/dist/stack/index.d.ts +2 -0
  389. package/dist/stack/index.js +1 -0
  390. package/dist/stack/stack.d.ts +17 -0
  391. package/dist/stack/stack.js +14 -0
  392. package/dist/sticky-bar/index.d.ts +2 -0
  393. package/dist/sticky-bar/index.js +1 -0
  394. package/dist/sticky-bar/sticky-bar.d.ts +16 -0
  395. package/dist/sticky-bar/sticky-bar.js +26 -0
  396. package/dist/styles.css +595 -0
  397. package/dist/switch/index.d.ts +2 -0
  398. package/dist/switch/index.js +1 -0
  399. package/dist/switch/switch.client.d.ts +33 -0
  400. package/dist/switch/switch.client.js +63 -0
  401. package/dist/tab-nav/index.d.ts +3 -0
  402. package/dist/tab-nav/index.js +3 -0
  403. package/dist/tab-nav/tab-nav.d.ts +36 -0
  404. package/dist/tab-nav/tab-nav.js +47 -0
  405. package/dist/tab-nav/tab-nav.parts.d.ts +6 -0
  406. package/dist/tab-nav/tab-nav.parts.js +9 -0
  407. package/dist/table/index.d.ts +3 -0
  408. package/dist/table/index.js +3 -0
  409. package/dist/table/table.d.ts +101 -0
  410. package/dist/table/table.js +121 -0
  411. package/dist/table/table.parts.d.ts +6 -0
  412. package/dist/table/table.parts.js +18 -0
  413. package/dist/table-selection/index.d.ts +3 -0
  414. package/dist/table-selection/index.js +3 -0
  415. package/dist/table-selection/table-selection.client.d.ts +14 -0
  416. package/dist/table-selection/table-selection.client.js +84 -0
  417. package/dist/table-selection/table-selection.d.ts +34 -0
  418. package/dist/table-selection/table-selection.js +50 -0
  419. package/dist/tabs/index.d.ts +4 -0
  420. package/dist/tabs/index.js +3 -0
  421. package/dist/tabs/tabs.client.d.ts +8 -0
  422. package/dist/tabs/tabs.client.js +68 -0
  423. package/dist/tabs/tabs.contract.d.ts +89 -0
  424. package/dist/tabs/tabs.parts.d.ts +6 -0
  425. package/dist/tabs/tabs.parts.js +11 -0
  426. package/dist/text/index.d.ts +2 -0
  427. package/dist/text/index.js +1 -0
  428. package/dist/text/text.d.ts +32 -0
  429. package/dist/text/text.js +17 -0
  430. package/dist/textarea/index.d.ts +2 -0
  431. package/dist/textarea/index.js +1 -0
  432. package/dist/textarea/textarea.client.d.ts +18 -0
  433. package/dist/textarea/textarea.client.js +31 -0
  434. package/dist/theme-script/index.d.ts +2 -0
  435. package/dist/theme-script/index.js +1 -0
  436. package/dist/theme-script/theme-script.d.ts +43 -0
  437. package/dist/theme-script/theme-script.js +46 -0
  438. package/dist/toast/index.d.ts +4 -0
  439. package/dist/toast/index.js +3 -0
  440. package/dist/toast/seam.d.ts +2 -0
  441. package/dist/toast/store.d.ts +19 -0
  442. package/dist/toast/store.js +136 -0
  443. package/dist/toast/toast.contract.d.ts +56 -0
  444. package/dist/toast/toaster.client.d.ts +10 -0
  445. package/dist/toast/toaster.client.js +305 -0
  446. package/dist/tooltip/index.d.ts +5 -0
  447. package/dist/tooltip/index.js +3 -0
  448. package/dist/tooltip/tooltip.client.d.ts +12 -0
  449. package/dist/tooltip/tooltip.client.js +51 -0
  450. package/dist/tooltip/tooltip.contract.d.ts +60 -0
  451. package/dist/tooltip/tooltip.parts.d.ts +6 -0
  452. package/dist/tooltip/tooltip.parts.js +10 -0
  453. package/dist/top-bar/index.d.ts +2 -0
  454. package/dist/top-bar/index.js +1 -0
  455. package/dist/top-bar/top-bar.d.ts +17 -0
  456. package/dist/top-bar/top-bar.js +35 -0
  457. package/dist/trend-card/index.d.ts +2 -0
  458. package/dist/trend-card/index.js +1 -0
  459. package/dist/trend-card/trend-card.d.ts +34 -0
  460. package/dist/trend-card/trend-card.js +74 -0
  461. package/package.json +447 -3
@@ -0,0 +1,38 @@
1
+ import { RenderProp } from "../contracts/render.js";
2
+ import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
3
+ //#region src/form/form.client.d.ts
4
+ /** One Field's errors: a message, or several (the first is shown), or none. */
5
+ export type FormErrorValue = string | readonly string[] | null | undefined;
6
+ /**
7
+ * Errors keyed by the Field's `name`, as a server action returns them (Zod's
8
+ * `z.flattenError(error).fieldErrors`, or Conform's and TanStack Form's issues mapped to text). A
9
+ * nested name is one key, written as the Field's `name` is: `items.0.title`. Serialisable.
10
+ */
11
+ export type FormErrors = Readonly<Record<string, FormErrorValue>>;
12
+ /** Form's own strings (§16.4): serialisable, English defaults. */
13
+ export interface FormLabels {
14
+ /** The error summary's title. @default 'There is a problem' */
15
+ summaryTitle: string;
16
+ }
17
+ export interface FormProps extends Omit<ComponentPropsWithRef<"form">, "children"> {
18
+ /**
19
+ * Errors by Field `name`, typically a server action's reply. Each one is presented by the Field
20
+ * with that `name` (the Field's own `error` prop wins over it) until the user edits that control.
21
+ * A new object (by identity) presents them all again and moves focus: to the error summary with
22
+ * `summary`, else to the first invalid control. The first render moves no focus.
23
+ */
24
+ errors?: FormErrors | undefined;
25
+ /**
26
+ * Renders an error summary at the start of the form while `errors` presents a message: a title
27
+ * and one link per error to its control, in page order. New errors focus the summary instead of
28
+ * the first invalid control (GOV.UK's error summary). For long forms. @default false
29
+ */
30
+ summary?: boolean;
31
+ /** Overrides Form's strings, for example `labels={{ summaryTitle: 'Es gibt ein Problem' }}`. */
32
+ labels?: Partial<FormLabels>;
33
+ /** Composition of the `<form>`. */
34
+ render?: RenderProp<Record<string, never>>;
35
+ children?: ReactNode;
36
+ }
37
+ export declare function Form({ errors, summary, labels: labelsProp, render, className, children, ...rest }: FormProps): ReactElement;
38
+ //#endregion
@@ -0,0 +1,127 @@
1
+ "use client";
2
+ import { cx } from "../_internal/cx.js";
3
+ import { mergeProps } from "../contracts/merge-props.js";
4
+ import { renderElement } from "../contracts/render.js";
5
+ import { Alert } from "../alert/alert.js";
6
+ import { useLabels } from "../config/config.client.js";
7
+ import { FormScope } from "../field/field-scope.client.js";
8
+ import { useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ //#region src/form/form.client.tsx
11
+ const NONE = /* @__PURE__ */ new Set();
12
+ function Form({ errors, summary = false, labels: labelsProp, render, className, children, ...rest }) {
13
+ const labels = useLabels("form", labelsProp);
14
+ const [edited, setEdited] = useState({
15
+ for: errors,
16
+ names: NONE
17
+ });
18
+ const hidden = edited.for === errors ? edited.names : NONE;
19
+ const shown = useMemo(() => {
20
+ const out = /* @__PURE__ */ new Map();
21
+ for (const [name, value] of Object.entries(errors ?? {})) {
22
+ const message = typeof value === "string" ? value : value?.[0];
23
+ if (message !== void 0 && message !== "" && !hidden.has(name)) out.set(name, message);
24
+ }
25
+ return out;
26
+ }, [errors, hidden]);
27
+ const form = useRef(null);
28
+ const summaryRef = useRef(null);
29
+ const listed = summary && shown.size > 0;
30
+ const [placed, setPlaced] = useState([]);
31
+ useLayoutEffect(() => {
32
+ const element = form.current;
33
+ if (!listed || element === null) return;
34
+ const next = [...shown.keys()].map((name) => [name, controlOf(element, name)]).toSorted(([, a], [, b]) => order(a, b)).map(([name, control]) => [name, control?.id || void 0]);
35
+ setPlaced((previous) => same(previous, next) ? previous : next);
36
+ }, [listed, shown]);
37
+ const seen = useRef(errors);
38
+ const moveFocus = useEffectEvent(() => {
39
+ const element = form.current;
40
+ if (element === null || shown.size === 0) return;
41
+ (summaryRef.current ?? firstInvalid(element))?.focus();
42
+ });
43
+ useLayoutEffect(() => {
44
+ if (seen.current === errors) return;
45
+ seen.current = errors;
46
+ moveFocus();
47
+ }, [errors]);
48
+ const own = {
49
+ "data-slot": "form",
50
+ className: cx("nz-form", className),
51
+ ref: form,
52
+ onInput(event) {
53
+ const { target } = event;
54
+ const name = "name" in target ? target.name : void 0;
55
+ if (typeof name === "string" && shown.has(name)) setEdited({
56
+ for: errors,
57
+ names: /* @__PURE__ */ new Set([...hidden, name])
58
+ });
59
+ }
60
+ };
61
+ const rank = new Map(placed.map(([name], index) => [name, index]));
62
+ const ids = new Map(placed);
63
+ const items = [...shown].toSorted(([a], [b]) => (rank.get(a) ?? rank.size) - (rank.get(b) ?? rank.size));
64
+ const props = {
65
+ ...mergeProps(own, rest),
66
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [listed && /* @__PURE__ */ jsx("div", {
67
+ ref: summaryRef,
68
+ tabIndex: -1,
69
+ className: "nz-form-summary",
70
+ "data-slot": "form-summary",
71
+ children: /* @__PURE__ */ jsx(Alert, {
72
+ tone: "critical",
73
+ role: "alert",
74
+ title: labels?.summaryTitle ?? "There is a problem",
75
+ children: /* @__PURE__ */ jsx("ul", {
76
+ className: "nz-form-summary-list",
77
+ "data-slot": "form-summary-list",
78
+ children: items.map(([name, message]) => {
79
+ const id = ids.get(name);
80
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
81
+ href: id === void 0 ? void 0 : `#${id}`,
82
+ className: "nz-form-summary-link",
83
+ "data-slot": "form-summary-link",
84
+ onClick: (event) => focusControl(event, name),
85
+ children: message
86
+ }) }, name);
87
+ })
88
+ })
89
+ })
90
+ }), children] })
91
+ };
92
+ return /* @__PURE__ */ jsx(FormScope, {
93
+ value: shown,
94
+ children: renderElement("form", render, {}, props)
95
+ });
96
+ }
97
+ /** The control a Field `name` names: the first of a radio group. */
98
+ function controlOf(form, name) {
99
+ const item = form.elements.namedItem(name);
100
+ const element = item instanceof RadioNodeList ? item[0] : item;
101
+ return element instanceof HTMLElement ? element : void 0;
102
+ }
103
+ /**
104
+ * The form's first control that presents an error (`aria-invalid="true"`), in tree order: through
105
+ * the error prop, a Form error or a native message. Not a disabled one, nor an unfocusable root.
106
+ */
107
+ function firstInvalid(form) {
108
+ for (const element of form.querySelectorAll("[aria-invalid=\"true\"]")) if (element.tabIndex >= 0 && !element.matches(":disabled")) return element;
109
+ }
110
+ /** A summary link focuses its control, which scrolls it into view, and leaves the URL as it is. */
111
+ function focusControl(event, name) {
112
+ const form = event.currentTarget.closest("form");
113
+ const control = form === null ? void 0 : controlOf(form, name);
114
+ if (control === void 0) return;
115
+ event.preventDefault();
116
+ control.focus();
117
+ }
118
+ /** Two controls in page order; a missing one comes last. */
119
+ function order(a, b) {
120
+ if (a === void 0 || b === void 0) return a === b ? 0 : a === void 0 ? 1 : -1;
121
+ return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
122
+ }
123
+ function same(a, b) {
124
+ return a.length === b.length && a.every(([name, id], i) => b[i]?.[0] === name && b[i]?.[1] === id);
125
+ }
126
+ //#endregion
127
+ export { Form };
@@ -0,0 +1,36 @@
1
+ import { RenderProp } from "../contracts/render.js";
2
+ import { AlertTone } from "../alert/alert.js";
3
+ import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
4
+ //#region src/form/form.d.ts
5
+ /** Alert's tones. `critical` is a `role="alert"` container; the others are `role="status"`. */
6
+ export type FormMessageTone = AlertTone;
7
+ export interface FormMessageState {
8
+ tone: FormMessageTone;
9
+ }
10
+ export interface FormMessageProps extends Omit<ComponentPropsWithRef<"div">, "title" | "role"> {
11
+ /**
12
+ * `critical` for a failure the user must act on (network, permission, conflict): `role="alert"`.
13
+ * `success`, `info` and `warning` are `role="status"`, read when the reader is idle.
14
+ * @default 'critical'
15
+ */
16
+ tone?: FormMessageTone;
17
+ /** One line above the message, as Alert's `title`. */
18
+ title?: ReactNode;
19
+ /** Decorative tone glyph, as Alert's `icon`; the text carries the meaning. */
20
+ icon?: ReactNode;
21
+ /** A control under the message, for example `<Button size="sm">Retry</Button>`. */
22
+ action?: ReactNode;
23
+ /** Composition of the live container. */
24
+ render?: RenderProp<FormMessageState>;
25
+ /**
26
+ * The message. `null`, `false` and `''` render nothing inside the container, which stays in the
27
+ * page so the next message is announced: render FormMessage always, and change only this.
28
+ */
29
+ children?: ReactNode;
30
+ }
31
+ /**
32
+ * The form-level message: a live container that is always rendered, with an Alert inside it while
33
+ * there is a message. Field errors belong to each Field (`error`, or Form's `errors`), not here.
34
+ */
35
+ export declare function FormMessage({ tone, title, icon, action, render, className, children, ...rest }: FormMessageProps): ReactElement;
36
+ //#endregion
@@ -0,0 +1,29 @@
1
+ import { cx } from "../_internal/cx.js";
2
+ import { renderElement } from "../contracts/render.js";
3
+ import { Alert } from "../alert/alert.js";
4
+ import { presented } from "../_internal/field.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/form/form.tsx
7
+ /**
8
+ * The form-level message: a live container that is always rendered, with an Alert inside it while
9
+ * there is a message. Field errors belong to each Field (`error`, or Form's `errors`), not here.
10
+ */
11
+ function FormMessage({ tone = "critical", title, icon, action, render, className, children, ...rest }) {
12
+ const shown = presented(children) || presented(title);
13
+ return renderElement("div", render, { tone }, {
14
+ "data-slot": "form-message",
15
+ "data-tone": tone,
16
+ ...rest,
17
+ className: cx("nz-form-message", className),
18
+ role: tone === "critical" ? "alert" : "status",
19
+ children: shown ? /* @__PURE__ */ jsx(Alert, {
20
+ tone,
21
+ title,
22
+ icon,
23
+ action,
24
+ children
25
+ }) : void 0
26
+ });
27
+ }
28
+ //#endregion
29
+ export { FormMessage };
@@ -0,0 +1,4 @@
1
+ import { Form, FormErrorValue, FormErrors, FormLabels, FormProps } from "./form.client.js";
2
+ import { SubmitButton, SubmitButtonProps } from "./submit-button.client.js";
3
+ import { FormMessage, FormMessageProps, FormMessageState, FormMessageTone } from "./form.js";
4
+ export { Form, type FormErrorValue, type FormErrors, type FormLabels, FormMessage, type FormMessageProps, type FormMessageState, type FormMessageTone, type FormProps, SubmitButton, type SubmitButtonProps };
@@ -0,0 +1,4 @@
1
+ import { Form } from "./form.client.js";
2
+ import { SubmitButton } from "./submit-button.client.js";
3
+ import { FormMessage } from "./form.js";
4
+ export { Form, FormMessage, SubmitButton };
@@ -0,0 +1,20 @@
1
+ import { ButtonVariant } from "../augment.js";
2
+ import { ButtonProps } from "../button/button.js";
3
+ import { ReactElement } from "react";
4
+ //#region src/form/submit-button.client.d.ts
5
+ export interface SubmitButtonProps extends Omit<ButtonProps, "type"> {
6
+ /**
7
+ * The form's main action, so `primary`; Button's other variants are accepted.
8
+ * @default 'primary'
9
+ */
10
+ variant?: ButtonVariant;
11
+ /**
12
+ * Pending even when the form's action is not running, for example while a client handler awaits.
13
+ * The form's own status is read for you: only an action passed as a function (`<form action={fn}>`
14
+ * or Form's) reports one, never a URL.
15
+ * @default false
16
+ */
17
+ pending?: boolean;
18
+ }
19
+ export declare function SubmitButton({ variant, pending, labels: labelsProp, ...rest }: SubmitButtonProps): ReactElement;
20
+ //#endregion
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useLabels } from "../config/config.client.js";
3
+ import { Button } from "../button/button.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useFormStatus } from "react-dom";
6
+ //#region src/form/submit-button.client.tsx
7
+ function SubmitButton({ variant = "primary", pending = false, labels: labelsProp, ...rest }) {
8
+ const status = useFormStatus();
9
+ const labels = useLabels("button", labelsProp);
10
+ return /* @__PURE__ */ jsx(Button, {
11
+ ...rest,
12
+ ...labels === void 0 ? {} : { labels },
13
+ variant,
14
+ type: "submit",
15
+ pending: pending || status.pending
16
+ });
17
+ }
18
+ //#endregion
19
+ export { SubmitButton };
@@ -0,0 +1,38 @@
1
+ import { RenderProp } from "../contracts/render.js";
2
+ import { LayoutGap } from "../stack/stack.js";
3
+ import { ComponentPropsWithRef, ReactElement } from "react";
4
+ //#region src/grid/grid.d.ts
5
+ /** Columns an item spans, or `'full'` for the whole row. Clamped to the columns available. */
6
+ export type GridSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | "full";
7
+ /**
8
+ * A span per breakpoint: `base` is mobile first, `sm` applies from 40rem (`--nz-sm`) and `lg` from
9
+ * 80rem (`--nz-lg`, provisional). An absent breakpoint keeps the one below it.
10
+ */
11
+ export interface GridResponsiveSpan {
12
+ base?: GridSpan;
13
+ sm?: GridSpan;
14
+ lg?: GridSpan;
15
+ }
16
+ export interface GridState {
17
+ gap: LayoutGap | undefined;
18
+ }
19
+ export interface GridProps extends ComponentPropsWithRef<"div"> {
20
+ /**
21
+ * Space between tracks, as a `--nz-space-*` key. Absent, the responsive gutter
22
+ * (`--nz-grid-gutter`: 16, 20, 24 px).
23
+ */
24
+ gap?: LayoutGap;
25
+ render?: RenderProp<GridState>;
26
+ }
27
+ export interface GridItemState {
28
+ span: GridSpan | GridResponsiveSpan | undefined;
29
+ }
30
+ export interface GridItemProps extends ComponentPropsWithRef<"div"> {
31
+ /** @default 1 */
32
+ span?: GridSpan | GridResponsiveSpan;
33
+ render?: RenderProp<GridItemState>;
34
+ }
35
+ /** The page grid: `--nz-grid-columns` columns (4, 8, 12 by viewport). Items snap to spans. */
36
+ export declare function Grid({ gap, render, className, ...rest }: GridProps): ReactElement;
37
+ export declare function GridItem({ span, render, className, ...rest }: GridItemProps): ReactElement;
38
+ //#endregion
@@ -0,0 +1,28 @@
1
+ import { cx } from "../_internal/cx.js";
2
+ import { renderElement } from "../contracts/render.js";
3
+ //#region src/grid/grid.tsx
4
+ /** The page grid: `--nz-grid-columns` columns (4, 8, 12 by viewport). Items snap to spans. */
5
+ function Grid({ gap, render, className, ...rest }) {
6
+ return renderElement("div", render, { gap }, {
7
+ "data-slot": "grid",
8
+ "data-gap": gap,
9
+ ...rest,
10
+ className: cx("nz-grid", className)
11
+ });
12
+ }
13
+ function GridItem({ span, render, className, ...rest }) {
14
+ const spans = typeof span === "object" ? span : span === void 0 ? {} : { base: span };
15
+ return renderElement("div", render, { span }, {
16
+ "data-slot": "grid-item",
17
+ "data-span": attr(spans.base),
18
+ "data-span-sm": attr(spans.sm),
19
+ "data-span-lg": attr(spans.lg),
20
+ ...rest,
21
+ className: cx("nz-grid-item", className)
22
+ });
23
+ }
24
+ function attr(span) {
25
+ return span === void 0 ? void 0 : String(span);
26
+ }
27
+ //#endregion
28
+ export { Grid, GridItem };
@@ -0,0 +1,2 @@
1
+ import { Grid, GridItem, GridItemProps, GridItemState, GridProps, GridResponsiveSpan, GridSpan, GridState } from "./grid.js";
2
+ export { Grid, GridItem, type GridItemProps, type GridItemState, type GridProps, type GridResponsiveSpan, type GridSpan, type GridState };
@@ -0,0 +1 @@
1
+ export { Grid, GridItem } from "./grid.js";
@@ -0,0 +1,30 @@
1
+ import { RenderProp } from "../contracts/render.js";
2
+ import { TextTone } from "../text/text.js";
3
+ import { ComponentPropsWithRef, ReactElement } from "react";
4
+ //#region src/heading/heading.d.ts
5
+ /** The document outline level: `<h1>` to `<h6>`. */
6
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
7
+ /** The Figma display and heading text styles. */
8
+ export type HeadingVariant = "display-l" | "display-m" | "heading-h1" | "heading-h2" | "heading-h3" | "heading-h4";
9
+ export interface HeadingState {
10
+ level: HeadingLevel;
11
+ variant: HeadingVariant;
12
+ tone: TextTone | undefined;
13
+ }
14
+ export interface HeadingProps extends ComponentPropsWithRef<"h2"> {
15
+ /** Required: the outline level decides the element, never the look. */
16
+ level: HeadingLevel;
17
+ /**
18
+ * The text style, independent of `level` (a page title can be an `<h1>` drawn as Heading/H3).
19
+ * @default the style named after the level, and `heading-h4` for levels 5 and 6 (Figma has no H5 or H6)
20
+ */
21
+ variant?: HeadingVariant;
22
+ /**
23
+ * A `text/*` colour. Absent, the colour is inherited from the surface. Deprecated value:
24
+ * `'accent'`, which paints `--nz-text-brand`; use `'brand'` (M42; removal deferred to 1.0).
25
+ */
26
+ tone?: TextTone;
27
+ render?: RenderProp<HeadingState>;
28
+ }
29
+ export declare function Heading({ level, variant, tone, render, className, ...rest }: HeadingProps): ReactElement;
30
+ //#endregion
@@ -0,0 +1,26 @@
1
+ import { cx } from "../_internal/cx.js";
2
+ import { renderElement } from "../contracts/render.js";
3
+ //#region src/heading/heading.tsx
4
+ const VARIANT_OF_LEVEL = {
5
+ 1: "heading-h1",
6
+ 2: "heading-h2",
7
+ 3: "heading-h3",
8
+ 4: "heading-h4",
9
+ 5: "heading-h4",
10
+ 6: "heading-h4"
11
+ };
12
+ function Heading({ level, variant = VARIANT_OF_LEVEL[level], tone, render, className, ...rest }) {
13
+ return renderElement(`h${level}`, render, {
14
+ level,
15
+ variant,
16
+ tone
17
+ }, {
18
+ "data-slot": "heading",
19
+ "data-variant": variant,
20
+ "data-tone": tone,
21
+ ...rest,
22
+ className: cx("nz-heading", className)
23
+ });
24
+ }
25
+ //#endregion
26
+ export { Heading };
@@ -0,0 +1,2 @@
1
+ import { Heading, HeadingLevel, HeadingProps, HeadingState, HeadingVariant } from "./heading.js";
2
+ export { Heading, type HeadingLevel, type HeadingProps, type HeadingState, type HeadingVariant };
@@ -0,0 +1 @@
1
+ export { Heading } from "./heading.js";
@@ -0,0 +1,24 @@
1
+ //#region src/i18n/format-label.d.ts
2
+ /** The CLDR plural categories `Intl.PluralRules` can select. */
3
+ export type PluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";
4
+ /**
5
+ * A label with one template per CLDR plural category of its locale, `other` required. A locale
6
+ * lists exactly the categories `Intl.PluralRules` has for it (en-US: `one`, `other`; pl: `one`,
7
+ * `few`, `many`, `other`). Exact-number keys (`'=0'`) are not supported.
8
+ */
9
+ export type PluralLabel = {
10
+ other: string;
11
+ } & Partial<Record<Exclude<PluralCategory, "other">, string>>;
12
+ /** The values a label's placeholders read: `{count}` reads `count`. */
13
+ export type LabelValues = Readonly<Record<string, string | number>>;
14
+ /**
15
+ * Fills a label. A `PluralLabel` picks its template by `values.count`, through
16
+ * `new Intl.PluralRules(locale).select(values.count)` (`other` when the category is missing or
17
+ * `count` is not a number); a plain string is used as is. Each `{name}` placeholder is replaced by
18
+ * `values.name`: a number formatted with `Intl.NumberFormat(locale)`, a string as written. A
19
+ * placeholder with no value stays as written: `formatLabel('+{count}', { count: 1200 })` is
20
+ * `'+1,200'`.
21
+ * @param locale BCP 47 tag for the plural rules and the numbers. @default 'en-US'
22
+ */
23
+ export declare function formatLabel(template: string | PluralLabel, values?: LabelValues, locale?: string): string;
24
+ //#endregion
@@ -0,0 +1,19 @@
1
+ //#region src/i18n/format-label.ts
2
+ /**
3
+ * Fills a label. A `PluralLabel` picks its template by `values.count`, through
4
+ * `new Intl.PluralRules(locale).select(values.count)` (`other` when the category is missing or
5
+ * `count` is not a number); a plain string is used as is. Each `{name}` placeholder is replaced by
6
+ * `values.name`: a number formatted with `Intl.NumberFormat(locale)`, a string as written. A
7
+ * placeholder with no value stays as written: `formatLabel('+{count}', { count: 1200 })` is
8
+ * `'+1,200'`.
9
+ * @param locale BCP 47 tag for the plural rules and the numbers. @default 'en-US'
10
+ */
11
+ function formatLabel(template, values = {}, locale = "en-US") {
12
+ const { count } = values;
13
+ return (typeof template === "string" ? template : (typeof count === "number" ? template[new Intl.PluralRules(locale).select(count)] : void 0) ?? template.other).replace(/\{(\w+)\}/g, (placeholder, name) => {
14
+ const value = Object.hasOwn(values, name) ? values[name] : void 0;
15
+ return typeof value === "number" ? new Intl.NumberFormat(locale).format(value) : value ?? placeholder;
16
+ });
17
+ }
18
+ //#endregion
19
+ export { formatLabel };
@@ -0,0 +1,2 @@
1
+ import { LabelValues, PluralCategory, PluralLabel, formatLabel } from "./format-label.js";
2
+ export { type LabelValues, type PluralCategory, type PluralLabel, formatLabel };
@@ -0,0 +1 @@
1
+ export { formatLabel } from "./format-label.js";
@@ -0,0 +1,23 @@
1
+ import { IconButtonStaticProps } from "./icon-button.contract.js";
2
+ import { ReactElement } from "react";
3
+ //#region src/icon-button/icon-button-static.d.ts
4
+ /**
5
+ * A server-safe IconButton with no tooltip: the same `<button>`, classes and CSS as
6
+ * `<IconButton tooltip={false}>`, from a module that imports no client code.
7
+ *
8
+ * Use it only where visible text already names the action for sighted users (a column header, a
9
+ * labelled row) and the page should ship no JavaScript for the button: a table row action that is a
10
+ * link (`render={<a href="/orders/42/edit" />}`) under a header that says what it does, a submit
11
+ * button in a Server Action form (`type="submit"` inside `<form action={deleteProduct}>`) beside its
12
+ * label. Under Turbopack and `next dev`, importing `IconButton` ships its tooltip code even with
13
+ * `tooltip={false}` (about 20 KB gzip in production); `IconButtonStatic` ships none.
14
+ *
15
+ * An icon-only toolbar needs `IconButton`'s tooltip, so a sighted user can read what each glyph does
16
+ * (Figma: "Icon-only buttons have an aria-label and a Tooltip").
17
+ *
18
+ * `aria-label` is always required. You may also pass `aria-labelledby` pointing at visible text; it
19
+ * then names the button, with `aria-label` as the fallback. There is no `tooltip`, no `shortcut`
20
+ * (pass `aria-keyshortcuts` yourself, for example `"Meta+B Control+B"`) and no `label`.
21
+ */
22
+ export declare function IconButtonStatic({ "aria-label": ariaLabel, label: _label, tooltip: _tooltip, shortcut: _shortcut, ...props }: IconButtonStaticProps): ReactElement;
23
+ //#endregion
@@ -0,0 +1,83 @@
1
+ import { cx } from "../_internal/cx.js";
2
+ import { mergeProps } from "../contracts/merge-props.js";
3
+ import { renderElement } from "../contracts/render.js";
4
+ import { SpinnerGlyph } from "../_internal/glyphs.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/icon-button/icon-button-static.tsx
7
+ /**
8
+ * A server-safe IconButton with no tooltip: the same `<button>`, classes and CSS as
9
+ * `<IconButton tooltip={false}>`, from a module that imports no client code.
10
+ *
11
+ * Use it only where visible text already names the action for sighted users (a column header, a
12
+ * labelled row) and the page should ship no JavaScript for the button: a table row action that is a
13
+ * link (`render={<a href="/orders/42/edit" />}`) under a header that says what it does, a submit
14
+ * button in a Server Action form (`type="submit"` inside `<form action={deleteProduct}>`) beside its
15
+ * label. Under Turbopack and `next dev`, importing `IconButton` ships its tooltip code even with
16
+ * `tooltip={false}` (about 20 KB gzip in production); `IconButtonStatic` ships none.
17
+ *
18
+ * An icon-only toolbar needs `IconButton`'s tooltip, so a sighted user can read what each glyph does
19
+ * (Figma: "Icon-only buttons have an aria-label and a Tooltip").
20
+ *
21
+ * `aria-label` is always required. You may also pass `aria-labelledby` pointing at visible text; it
22
+ * then names the button, with `aria-label` as the fallback. There is no `tooltip`, no `shortcut`
23
+ * (pass `aria-keyshortcuts` yourself, for example `"Meta+B Control+B"`) and no `label`.
24
+ */
25
+ function IconButtonStatic({ "aria-label": ariaLabel, label: _label, tooltip: _tooltip, shortcut: _shortcut, ...props }) {
26
+ warnUnnamed(ariaLabel, props["aria-labelledby"], "IconButtonStatic", "aria-label");
27
+ return iconButtonElement({
28
+ ...props,
29
+ label: ariaLabel
30
+ });
31
+ }
32
+ /**
33
+ * Renders the button. `trigger` holds the Tooltip trigger's props (handlers and ref) on IconButton's
34
+ * client path; the consumer's handlers run before them, as everywhere (§8.2).
35
+ */
36
+ function iconButtonElement({ label, icon, variant = "secondary", size = "md", pressed, pending = false, pendingIndicator, disabled = false, type, render, className, ...rest }, trigger) {
37
+ const native = render === void 0;
38
+ const props = trigger === void 0 ? rest : mergeProps(trigger, rest);
39
+ return renderElement("button", render, {
40
+ variant,
41
+ size,
42
+ pending,
43
+ disabled,
44
+ pressed
45
+ }, {
46
+ "data-slot": "icon-button",
47
+ "data-variant": variant,
48
+ "data-size": size,
49
+ "data-pending": pending ? "" : void 0,
50
+ "data-disabled": disabled ? "" : void 0,
51
+ ...props,
52
+ className: cx("nz-icon-button nz-hit-target", className),
53
+ type: native ? pending ? "button" : type ?? "button" : void 0,
54
+ disabled: native && disabled && !pending ? true : void 0,
55
+ "aria-label": label,
56
+ "aria-pressed": pressed,
57
+ "aria-disabled": pending || !native && disabled ? true : void 0,
58
+ onClick: pending && props["onClick"] !== void 0 ? swallow : props["onClick"],
59
+ children: /* @__PURE__ */ jsx("span", {
60
+ className: "nz-icon-button-icon",
61
+ "data-slot": "icon-button-icon",
62
+ "aria-hidden": "true",
63
+ children: pending ? pendingIndicator ?? /* @__PURE__ */ jsx(SpinnerGlyph, {}) : icon
64
+ })
65
+ });
66
+ }
67
+ function swallow(event) {
68
+ event.preventDefault();
69
+ }
70
+ /**
71
+ * Development builds warn about a button nothing names; bundlers strip it from production. `prop` is
72
+ * the prop that names it (`label` on IconButton, `aria-label` on IconButtonStatic).
73
+ */
74
+ function warnUnnamed(name, labelledBy, component = "IconButton", prop = "label") {
75
+ if ((name ?? "").trim() !== "" || (labelledBy ?? "").trim() !== "") return;
76
+ let development = false;
77
+ try {
78
+ development = process.env.NODE_ENV !== "production";
79
+ } catch {}
80
+ if (development) console.warn(`Nizivo ${component}: \`${prop}\` is empty, so the button has no accessible name. Pass the action in words, for example ${prop}="Delete product".`);
81
+ }
82
+ //#endregion
83
+ export { IconButtonStatic, iconButtonElement, warnUnnamed };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { iconButtonElement } from "./icon-button-static.js";
3
+ import { TooltipPopup, TooltipRoot, TooltipTrigger } from "../tooltip/tooltip.client.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/icon-button/icon-button.client.tsx
6
+ function IconButtonTooltip({ tooltip: { side, align, delay }, shortcut, ...button }) {
7
+ return /* @__PURE__ */ jsxs(TooltipRoot, {
8
+ disabled: button.disabled === true,
9
+ ...delay === void 0 ? {} : { delay },
10
+ children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: (props) => iconButtonElement(button, triggerProps(props)) }), /* @__PURE__ */ jsx(TooltipPopup, {
11
+ ...side === void 0 ? {} : { side },
12
+ ...align === void 0 ? {} : { align },
13
+ ...shortcut === void 0 ? {} : { shortcut },
14
+ children: button.label
15
+ })]
16
+ });
17
+ }
18
+ /**
19
+ * Keeps the trigger's handlers and ref. Drops what would make the DOM differ from the server path:
20
+ * `nz-tooltip-trigger`, its slot, `data-open` and the `tabIndex` that makes any element focusable (a
21
+ * button or link already is; a consumer's own `tabIndex` still applies). Drops `aria-describedby` too:
22
+ * the tooltip repeats the accessible name, so describing the button by it would say the label twice.
23
+ */
24
+ function triggerProps(props) {
25
+ const { className: _class, "data-slot": _slot, "data-open": _open, "aria-describedby": _described, type: _type, tabIndex: _tabIndex, ...kept } = props;
26
+ return kept;
27
+ }
28
+ //#endregion
29
+ export { IconButtonTooltip };