@knk1313/plain-ui 0.0.0-stage → 0.1.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 (632) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -2
  3. package/dist/components/accordion/Accordion.d.ts +27 -0
  4. package/dist/components/accordion/Accordion.js +18 -0
  5. package/dist/components/accordion/index.d.ts +1 -0
  6. package/dist/components/accordion/index.js +1 -0
  7. package/dist/components/agent-form/AgentForm.d.ts +40 -0
  8. package/dist/components/agent-form/AgentForm.js +100 -0
  9. package/dist/components/agent-form/index.d.ts +1 -0
  10. package/dist/components/agent-form/index.js +1 -0
  11. package/dist/components/agent-steps/AgentSteps.d.ts +21 -0
  12. package/dist/components/agent-steps/AgentSteps.js +42 -0
  13. package/dist/components/agent-steps/index.d.ts +1 -0
  14. package/dist/components/agent-steps/index.js +1 -0
  15. package/dist/components/agent-thinking/AgentThinking.d.ts +12 -0
  16. package/dist/components/agent-thinking/AgentThinking.js +18 -0
  17. package/dist/components/agent-thinking/index.d.ts +1 -0
  18. package/dist/components/agent-thinking/index.js +1 -0
  19. package/dist/components/area-chart/AreaChart.d.ts +10 -0
  20. package/dist/components/area-chart/AreaChart.js +83 -0
  21. package/dist/components/area-chart/index.d.ts +1 -0
  22. package/dist/components/area-chart/index.js +1 -0
  23. package/dist/components/auth-card/AuthCard.d.ts +14 -0
  24. package/dist/components/auth-card/AuthCard.js +9 -0
  25. package/dist/components/auth-card/PasswordInput.d.ts +13 -0
  26. package/dist/components/auth-card/PasswordInput.js +26 -0
  27. package/dist/components/auth-card/index.d.ts +2 -0
  28. package/dist/components/auth-card/index.js +2 -0
  29. package/dist/components/avatar/Avatar.d.ts +14 -0
  30. package/dist/components/avatar/Avatar.js +42 -0
  31. package/dist/components/avatar/index.d.ts +1 -0
  32. package/dist/components/avatar/index.js +1 -0
  33. package/dist/components/badge/Badge.d.ts +9 -0
  34. package/dist/components/badge/Badge.js +15 -0
  35. package/dist/components/badge/index.d.ts +1 -0
  36. package/dist/components/badge/index.js +1 -0
  37. package/dist/components/banner/Banner.d.ts +9 -0
  38. package/dist/components/banner/Banner.js +36 -0
  39. package/dist/components/banner/index.d.ts +1 -0
  40. package/dist/components/banner/index.js +1 -0
  41. package/dist/components/bar-chart/BarChart.d.ts +3 -0
  42. package/dist/components/bar-chart/BarChart.js +47 -0
  43. package/dist/components/bar-chart/index.d.ts +1 -0
  44. package/dist/components/bar-chart/index.js +1 -0
  45. package/dist/components/bar-list/BarList.d.ts +26 -0
  46. package/dist/components/bar-list/BarList.js +24 -0
  47. package/dist/components/bar-list/index.d.ts +1 -0
  48. package/dist/components/bar-list/index.js +1 -0
  49. package/dist/components/breadcrumb/Breadcrumb.d.ts +12 -0
  50. package/dist/components/breadcrumb/Breadcrumb.js +9 -0
  51. package/dist/components/breadcrumb/index.d.ts +1 -0
  52. package/dist/components/breadcrumb/index.js +1 -0
  53. package/dist/components/button/Button.d.ts +24 -0
  54. package/dist/components/button/Button.js +31 -0
  55. package/dist/components/button/buttonStyle.d.ts +9 -0
  56. package/dist/components/button/buttonStyle.js +41 -0
  57. package/dist/components/button/index.d.ts +1 -0
  58. package/dist/components/button/index.js +1 -0
  59. package/dist/components/button-group/ButtonGroup.d.ts +18 -0
  60. package/dist/components/button-group/ButtonGroup.js +26 -0
  61. package/dist/components/button-group/index.d.ts +1 -0
  62. package/dist/components/button-group/index.js +1 -0
  63. package/dist/components/calendar/Calendar.d.ts +20 -0
  64. package/dist/components/calendar/Calendar.js +98 -0
  65. package/dist/components/calendar/index.d.ts +1 -0
  66. package/dist/components/calendar/index.js +1 -0
  67. package/dist/components/calendar-view/CalendarView.d.ts +34 -0
  68. package/dist/components/calendar-view/CalendarView.js +111 -0
  69. package/dist/components/calendar-view/index.d.ts +1 -0
  70. package/dist/components/calendar-view/index.js +1 -0
  71. package/dist/components/card/Card.d.ts +6 -0
  72. package/dist/components/card/Card.js +6 -0
  73. package/dist/components/card/index.d.ts +1 -0
  74. package/dist/components/card/index.js +1 -0
  75. package/dist/components/carousel/Carousel.d.ts +18 -0
  76. package/dist/components/carousel/Carousel.js +58 -0
  77. package/dist/components/carousel/index.d.ts +1 -0
  78. package/dist/components/carousel/index.js +1 -0
  79. package/dist/components/chart/Axis.d.ts +51 -0
  80. package/dist/components/chart/Axis.js +127 -0
  81. package/dist/components/chart/ChartFrame.d.ts +79 -0
  82. package/dist/components/chart/ChartFrame.js +80 -0
  83. package/dist/components/chart/ChartTooltip.d.ts +12 -0
  84. package/dist/components/chart/ChartTooltip.js +57 -0
  85. package/dist/components/chart/Legend.d.ts +11 -0
  86. package/dist/components/chart/Legend.js +6 -0
  87. package/dist/components/chart/Sparkline.d.ts +5 -0
  88. package/dist/components/chart/Sparkline.js +20 -0
  89. package/dist/components/chart/format.d.ts +2 -0
  90. package/dist/components/chart/format.js +17 -0
  91. package/dist/components/chart/heatmap.d.ts +18 -0
  92. package/dist/components/chart/heatmap.js +47 -0
  93. package/dist/components/chart/index.d.ts +1 -0
  94. package/dist/components/chart/index.js +1 -0
  95. package/dist/components/chart/line.d.ts +1 -0
  96. package/dist/components/chart/line.js +15 -0
  97. package/dist/components/chart/scale.d.ts +15 -0
  98. package/dist/components/chart/scale.js +100 -0
  99. package/dist/components/chart/series.d.ts +44 -0
  100. package/dist/components/chart/series.js +86 -0
  101. package/dist/components/chart/spacing.d.ts +29 -0
  102. package/dist/components/chart/spacing.js +34 -0
  103. package/dist/components/chart/types.d.ts +29 -0
  104. package/dist/components/chart/types.js +2 -0
  105. package/dist/components/chart/useChartHover.d.ts +34 -0
  106. package/dist/components/chart/useChartHover.js +97 -0
  107. package/dist/components/checkbox/Checkbox.d.ts +10 -0
  108. package/dist/components/checkbox/Checkbox.js +38 -0
  109. package/dist/components/checkbox/index.d.ts +1 -0
  110. package/dist/components/checkbox/index.js +1 -0
  111. package/dist/components/chip/Chip.d.ts +21 -0
  112. package/dist/components/chip/Chip.js +10 -0
  113. package/dist/components/chip/index.d.ts +1 -0
  114. package/dist/components/chip/index.js +1 -0
  115. package/dist/components/close-button/CloseButton.d.ts +14 -0
  116. package/dist/components/close-button/CloseButton.js +9 -0
  117. package/dist/components/close-button/index.d.ts +1 -0
  118. package/dist/components/close-button/index.js +1 -0
  119. package/dist/components/color-picker/ColorPicker.d.ts +21 -0
  120. package/dist/components/color-picker/ColorPicker.js +20 -0
  121. package/dist/components/color-picker/index.d.ts +1 -0
  122. package/dist/components/color-picker/index.js +1 -0
  123. package/dist/components/combo-chart/ComboChart.d.ts +12 -0
  124. package/dist/components/combo-chart/ComboChart.js +84 -0
  125. package/dist/components/combo-chart/index.d.ts +1 -0
  126. package/dist/components/combo-chart/index.js +1 -0
  127. package/dist/components/combobox/Combobox.d.ts +33 -0
  128. package/dist/components/combobox/Combobox.js +246 -0
  129. package/dist/components/combobox/index.d.ts +1 -0
  130. package/dist/components/combobox/index.js +1 -0
  131. package/dist/components/command-palette/CommandPalette.d.ts +36 -0
  132. package/dist/components/command-palette/CommandPalette.js +156 -0
  133. package/dist/components/command-palette/index.d.ts +1 -0
  134. package/dist/components/command-palette/index.js +1 -0
  135. package/dist/components/composer/Composer.d.ts +32 -0
  136. package/dist/components/composer/Composer.js +101 -0
  137. package/dist/components/composer/index.d.ts +1 -0
  138. package/dist/components/composer/index.js +1 -0
  139. package/dist/components/composer-attachments/ComposerAttachments.d.ts +25 -0
  140. package/dist/components/composer-attachments/ComposerAttachments.js +52 -0
  141. package/dist/components/composer-attachments/index.d.ts +1 -0
  142. package/dist/components/composer-attachments/index.js +1 -0
  143. package/dist/components/composer-panel/ComposerPanel.d.ts +26 -0
  144. package/dist/components/composer-panel/ComposerPanel.js +154 -0
  145. package/dist/components/composer-panel/index.d.ts +1 -0
  146. package/dist/components/composer-panel/index.js +1 -0
  147. package/dist/components/contribution-chart/ContributionChart.d.ts +25 -0
  148. package/dist/components/contribution-chart/ContributionChart.js +127 -0
  149. package/dist/components/contribution-chart/index.d.ts +1 -0
  150. package/dist/components/contribution-chart/index.js +1 -0
  151. package/dist/components/data-grid/DataGrid.d.ts +40 -0
  152. package/dist/components/data-grid/DataGrid.js +157 -0
  153. package/dist/components/data-grid/index.d.ts +1 -0
  154. package/dist/components/data-grid/index.js +1 -0
  155. package/dist/components/data-table/DataTable.d.ts +87 -0
  156. package/dist/components/data-table/DataTable.js +150 -0
  157. package/dist/components/data-table/index.d.ts +2 -0
  158. package/dist/components/data-table/index.js +2 -0
  159. package/dist/components/data-table/query.d.ts +54 -0
  160. package/dist/components/data-table/query.js +70 -0
  161. package/dist/components/date-picker/DatePicker.d.ts +25 -0
  162. package/dist/components/date-picker/DatePicker.js +154 -0
  163. package/dist/components/date-picker/index.d.ts +1 -0
  164. package/dist/components/date-picker/index.js +1 -0
  165. package/dist/components/dialog/ConfirmDialog.d.ts +25 -0
  166. package/dist/components/dialog/ConfirmDialog.js +69 -0
  167. package/dist/components/dialog/Dialog.d.ts +25 -0
  168. package/dist/components/dialog/Dialog.js +11 -0
  169. package/dist/components/dialog/DialogFrame.d.ts +22 -0
  170. package/dist/components/dialog/DialogFrame.js +21 -0
  171. package/dist/components/dialog/DiscardChangesDialog.d.ts +10 -0
  172. package/dist/components/dialog/DiscardChangesDialog.js +10 -0
  173. package/dist/components/dialog/index.d.ts +2 -0
  174. package/dist/components/dialog/index.js +2 -0
  175. package/dist/components/dialog/useDiscardOnClose.d.ts +20 -0
  176. package/dist/components/dialog/useDiscardOnClose.js +26 -0
  177. package/dist/components/dialog/useModalDialog.d.ts +20 -0
  178. package/dist/components/dialog/useModalDialog.js +85 -0
  179. package/dist/components/drawer/Drawer.d.ts +14 -0
  180. package/dist/components/drawer/Drawer.js +22 -0
  181. package/dist/components/drawer/index.d.ts +1 -0
  182. package/dist/components/drawer/index.js +1 -0
  183. package/dist/components/empty-state/EmptyState.d.ts +11 -0
  184. package/dist/components/empty-state/EmptyState.js +7 -0
  185. package/dist/components/empty-state/index.d.ts +1 -0
  186. package/dist/components/empty-state/index.js +1 -0
  187. package/dist/components/error-state/ErrorState.d.ts +8 -0
  188. package/dist/components/error-state/ErrorState.js +7 -0
  189. package/dist/components/error-state/index.d.ts +1 -0
  190. package/dist/components/error-state/index.js +1 -0
  191. package/dist/components/error-summary/ErrorSummary.d.ts +21 -0
  192. package/dist/components/error-summary/ErrorSummary.js +16 -0
  193. package/dist/components/error-summary/index.d.ts +1 -0
  194. package/dist/components/error-summary/index.js +1 -0
  195. package/dist/components/field/Field.d.ts +23 -0
  196. package/dist/components/field/Field.js +20 -0
  197. package/dist/components/field/index.d.ts +1 -0
  198. package/dist/components/field/index.js +1 -0
  199. package/dist/components/field-error/FieldError.d.ts +10 -0
  200. package/dist/components/field-error/FieldError.js +52 -0
  201. package/dist/components/field-error/index.d.ts +1 -0
  202. package/dist/components/field-error/index.js +1 -0
  203. package/dist/components/file-upload/FileUpload.d.ts +50 -0
  204. package/dist/components/file-upload/FileUpload.js +169 -0
  205. package/dist/components/file-upload/fileSize.d.ts +1 -0
  206. package/dist/components/file-upload/fileSize.js +13 -0
  207. package/dist/components/file-upload/index.d.ts +1 -0
  208. package/dist/components/file-upload/index.js +1 -0
  209. package/dist/components/form-section/FormSection.d.ts +16 -0
  210. package/dist/components/form-section/FormSection.js +14 -0
  211. package/dist/components/form-section/index.d.ts +1 -0
  212. package/dist/components/form-section/index.js +1 -0
  213. package/dist/components/form-steps/FormSteps.d.ts +18 -0
  214. package/dist/components/form-steps/FormSteps.js +26 -0
  215. package/dist/components/form-steps/index.d.ts +1 -0
  216. package/dist/components/form-steps/index.js +1 -0
  217. package/dist/components/funnel-chart/FunnelChart.d.ts +12 -0
  218. package/dist/components/funnel-chart/FunnelChart.js +69 -0
  219. package/dist/components/funnel-chart/index.d.ts +1 -0
  220. package/dist/components/funnel-chart/index.js +1 -0
  221. package/dist/components/header/Header.d.ts +14 -0
  222. package/dist/components/header/Header.js +31 -0
  223. package/dist/components/header/index.d.ts +1 -0
  224. package/dist/components/header/index.js +1 -0
  225. package/dist/components/heatmap-chart/HeatmapChart.d.ts +10 -0
  226. package/dist/components/heatmap-chart/HeatmapChart.js +76 -0
  227. package/dist/components/heatmap-chart/index.d.ts +1 -0
  228. package/dist/components/heatmap-chart/index.js +1 -0
  229. package/dist/components/image-error/ImageError.d.ts +11 -0
  230. package/dist/components/image-error/ImageError.js +16 -0
  231. package/dist/components/image-error/index.d.ts +1 -0
  232. package/dist/components/image-error/index.js +1 -0
  233. package/dist/components/image-loader/ImageLoader.d.ts +9 -0
  234. package/dist/components/image-loader/ImageLoader.js +10 -0
  235. package/dist/components/image-loader/index.d.ts +1 -0
  236. package/dist/components/image-loader/index.js +1 -0
  237. package/dist/components/index.d.ts +98 -0
  238. package/dist/components/index.js +97 -0
  239. package/dist/components/input/Input.d.ts +6 -0
  240. package/dist/components/input/Input.js +8 -0
  241. package/dist/components/input/index.d.ts +1 -0
  242. package/dist/components/input/index.js +1 -0
  243. package/dist/components/input/inputStyle.d.ts +14 -0
  244. package/dist/components/input/inputStyle.js +35 -0
  245. package/dist/components/item-range/ItemRange.d.ts +11 -0
  246. package/dist/components/item-range/ItemRange.js +13 -0
  247. package/dist/components/item-range/index.d.ts +1 -0
  248. package/dist/components/item-range/index.js +1 -0
  249. package/dist/components/label/Label.d.ts +8 -0
  250. package/dist/components/label/Label.js +5 -0
  251. package/dist/components/label/index.d.ts +1 -0
  252. package/dist/components/label/index.js +1 -0
  253. package/dist/components/line-chart/LineChart.d.ts +10 -0
  254. package/dist/components/line-chart/LineChart.js +29 -0
  255. package/dist/components/line-chart/index.d.ts +1 -0
  256. package/dist/components/line-chart/index.js +1 -0
  257. package/dist/components/link-button/LinkButton.d.ts +29 -0
  258. package/dist/components/link-button/LinkButton.js +15 -0
  259. package/dist/components/link-button/index.d.ts +1 -0
  260. package/dist/components/link-button/index.js +1 -0
  261. package/dist/components/menu/Menu.d.ts +33 -0
  262. package/dist/components/menu/Menu.js +113 -0
  263. package/dist/components/menu/index.d.ts +1 -0
  264. package/dist/components/menu/index.js +1 -0
  265. package/dist/components/meter/Meter.d.ts +24 -0
  266. package/dist/components/meter/Meter.js +65 -0
  267. package/dist/components/meter/index.d.ts +1 -0
  268. package/dist/components/meter/index.js +1 -0
  269. package/dist/components/nav-group/NavGroup.d.ts +24 -0
  270. package/dist/components/nav-group/NavGroup.js +23 -0
  271. package/dist/components/nav-group/index.d.ts +1 -0
  272. package/dist/components/nav-group/index.js +1 -0
  273. package/dist/components/notification/Notification.d.ts +25 -0
  274. package/dist/components/notification/Notification.js +13 -0
  275. package/dist/components/notification/index.d.ts +1 -0
  276. package/dist/components/notification/index.js +1 -0
  277. package/dist/components/notification-center/NotificationCenter.d.ts +33 -0
  278. package/dist/components/notification-center/NotificationCenter.js +29 -0
  279. package/dist/components/notification-center/index.d.ts +1 -0
  280. package/dist/components/notification-center/index.js +1 -0
  281. package/dist/components/number-field/NumberField.d.ts +28 -0
  282. package/dist/components/number-field/NumberField.js +155 -0
  283. package/dist/components/number-field/index.d.ts +1 -0
  284. package/dist/components/number-field/index.js +1 -0
  285. package/dist/components/otp-input/OtpInput.d.ts +14 -0
  286. package/dist/components/otp-input/OtpInput.js +70 -0
  287. package/dist/components/otp-input/index.d.ts +1 -0
  288. package/dist/components/otp-input/index.js +1 -0
  289. package/dist/components/pagination/Pagination.d.ts +21 -0
  290. package/dist/components/pagination/Pagination.js +51 -0
  291. package/dist/components/pagination/index.d.ts +1 -0
  292. package/dist/components/pagination/index.js +1 -0
  293. package/dist/components/popover/Popover.d.ts +23 -0
  294. package/dist/components/popover/Popover.js +83 -0
  295. package/dist/components/popover/index.d.ts +1 -0
  296. package/dist/components/popover/index.js +1 -0
  297. package/dist/components/progress/Progress.d.ts +12 -0
  298. package/dist/components/progress/Progress.js +30 -0
  299. package/dist/components/progress/index.d.ts +1 -0
  300. package/dist/components/progress/index.js +1 -0
  301. package/dist/components/question-form/QuestionForm.d.ts +59 -0
  302. package/dist/components/question-form/QuestionForm.js +128 -0
  303. package/dist/components/question-form/index.d.ts +1 -0
  304. package/dist/components/question-form/index.js +1 -0
  305. package/dist/components/radar-chart/RadarChart.d.ts +3 -0
  306. package/dist/components/radar-chart/RadarChart.js +72 -0
  307. package/dist/components/radar-chart/geometry.d.ts +16 -0
  308. package/dist/components/radar-chart/geometry.js +56 -0
  309. package/dist/components/radar-chart/index.d.ts +1 -0
  310. package/dist/components/radar-chart/index.js +1 -0
  311. package/dist/components/radial-chart/RadialChart.d.ts +39 -0
  312. package/dist/components/radial-chart/RadialChart.js +135 -0
  313. package/dist/components/radial-chart/index.d.ts +1 -0
  314. package/dist/components/radial-chart/index.js +1 -0
  315. package/dist/components/radio/Radio.d.ts +31 -0
  316. package/dist/components/radio/Radio.js +24 -0
  317. package/dist/components/radio/index.d.ts +1 -0
  318. package/dist/components/radio/index.js +1 -0
  319. package/dist/components/reply-loader/ReplyLoader.d.ts +10 -0
  320. package/dist/components/reply-loader/ReplyLoader.js +9 -0
  321. package/dist/components/reply-loader/index.d.ts +1 -0
  322. package/dist/components/reply-loader/index.js +1 -0
  323. package/dist/components/sankey-chart/SankeyChart.d.ts +35 -0
  324. package/dist/components/sankey-chart/SankeyChart.js +218 -0
  325. package/dist/components/sankey-chart/index.d.ts +1 -0
  326. package/dist/components/sankey-chart/index.js +1 -0
  327. package/dist/components/scatter-chart/ScatterChart.d.ts +38 -0
  328. package/dist/components/scatter-chart/ScatterChart.js +69 -0
  329. package/dist/components/scatter-chart/index.d.ts +1 -0
  330. package/dist/components/scatter-chart/index.js +1 -0
  331. package/dist/components/search-field/SearchField.d.ts +17 -0
  332. package/dist/components/search-field/SearchField.js +92 -0
  333. package/dist/components/search-field/index.d.ts +1 -0
  334. package/dist/components/search-field/index.js +1 -0
  335. package/dist/components/segmented-control/SegmentedControl.d.ts +26 -0
  336. package/dist/components/segmented-control/SegmentedControl.js +38 -0
  337. package/dist/components/segmented-control/index.d.ts +1 -0
  338. package/dist/components/segmented-control/index.js +1 -0
  339. package/dist/components/select/Select.d.ts +11 -0
  340. package/dist/components/select/Select.js +30 -0
  341. package/dist/components/select/index.d.ts +1 -0
  342. package/dist/components/select/index.js +1 -0
  343. package/dist/components/separator/Separator.d.ts +14 -0
  344. package/dist/components/separator/Separator.js +12 -0
  345. package/dist/components/separator/index.d.ts +1 -0
  346. package/dist/components/separator/index.js +1 -0
  347. package/dist/components/settings-modal/SettingsModal.d.ts +35 -0
  348. package/dist/components/settings-modal/SettingsModal.js +120 -0
  349. package/dist/components/settings-modal/index.d.ts +1 -0
  350. package/dist/components/settings-modal/index.js +1 -0
  351. package/dist/components/sidebar/Sidebar.d.ts +30 -0
  352. package/dist/components/sidebar/Sidebar.js +30 -0
  353. package/dist/components/sidebar/index.d.ts +1 -0
  354. package/dist/components/sidebar/index.js +1 -0
  355. package/dist/components/skeleton/Skeleton.d.ts +6 -0
  356. package/dist/components/skeleton/Skeleton.js +6 -0
  357. package/dist/components/skeleton/index.d.ts +1 -0
  358. package/dist/components/skeleton/index.js +1 -0
  359. package/dist/components/skip-link/SkipLink.d.ts +8 -0
  360. package/dist/components/skip-link/SkipLink.js +10 -0
  361. package/dist/components/skip-link/index.d.ts +1 -0
  362. package/dist/components/skip-link/index.js +1 -0
  363. package/dist/components/slider/Slider.d.ts +19 -0
  364. package/dist/components/slider/Slider.js +49 -0
  365. package/dist/components/slider/index.d.ts +1 -0
  366. package/dist/components/slider/index.js +1 -0
  367. package/dist/components/spinner/Spinner.d.ts +5 -0
  368. package/dist/components/spinner/Spinner.js +7 -0
  369. package/dist/components/spinner/index.d.ts +1 -0
  370. package/dist/components/spinner/index.js +1 -0
  371. package/dist/components/stacked-bar/StackedBar.d.ts +29 -0
  372. package/dist/components/stacked-bar/StackedBar.js +77 -0
  373. package/dist/components/stacked-bar/index.d.ts +1 -0
  374. package/dist/components/stacked-bar/index.js +1 -0
  375. package/dist/components/stat-card/StatCard.d.ts +19 -0
  376. package/dist/components/stat-card/StatCard.js +32 -0
  377. package/dist/components/stat-card/index.d.ts +1 -0
  378. package/dist/components/stat-card/index.js +1 -0
  379. package/dist/components/switch/Switch.d.ts +10 -0
  380. package/dist/components/switch/Switch.js +22 -0
  381. package/dist/components/switch/index.d.ts +1 -0
  382. package/dist/components/switch/index.js +1 -0
  383. package/dist/components/table/SortableHeader.d.ts +12 -0
  384. package/dist/components/table/SortableHeader.js +11 -0
  385. package/dist/components/table/Table.d.ts +15 -0
  386. package/dist/components/table/Table.js +26 -0
  387. package/dist/components/table/align.d.ts +1 -0
  388. package/dist/components/table/align.js +5 -0
  389. package/dist/components/table/index.d.ts +4 -0
  390. package/dist/components/table/index.js +2 -0
  391. package/dist/components/tabs/Tabs.d.ts +38 -0
  392. package/dist/components/tabs/Tabs.js +137 -0
  393. package/dist/components/tabs/fitTabs.d.ts +18 -0
  394. package/dist/components/tabs/fitTabs.js +46 -0
  395. package/dist/components/tabs/index.d.ts +1 -0
  396. package/dist/components/tabs/index.js +1 -0
  397. package/dist/components/tag-group/TagGroup.d.ts +29 -0
  398. package/dist/components/tag-group/TagGroup.js +82 -0
  399. package/dist/components/tag-group/index.d.ts +1 -0
  400. package/dist/components/tag-group/index.js +1 -0
  401. package/dist/components/task-list/TaskList.d.ts +46 -0
  402. package/dist/components/task-list/TaskList.js +30 -0
  403. package/dist/components/task-list/index.d.ts +1 -0
  404. package/dist/components/task-list/index.js +1 -0
  405. package/dist/components/text-link/TextLink.d.ts +27 -0
  406. package/dist/components/text-link/TextLink.js +22 -0
  407. package/dist/components/text-link/index.d.ts +1 -0
  408. package/dist/components/text-link/index.js +1 -0
  409. package/dist/components/textarea/Textarea.d.ts +6 -0
  410. package/dist/components/textarea/Textarea.js +9 -0
  411. package/dist/components/textarea/index.d.ts +1 -0
  412. package/dist/components/textarea/index.js +1 -0
  413. package/dist/components/time-field/TimeField.d.ts +6 -0
  414. package/dist/components/time-field/TimeField.js +9 -0
  415. package/dist/components/time-field/index.d.ts +1 -0
  416. package/dist/components/time-field/index.js +1 -0
  417. package/dist/components/toast/Toast.d.ts +19 -0
  418. package/dist/components/toast/Toast.js +190 -0
  419. package/dist/components/toast/index.d.ts +1 -0
  420. package/dist/components/toast/index.js +1 -0
  421. package/dist/components/token-input/TokenInput.d.ts +27 -0
  422. package/dist/components/token-input/TokenInput.js +153 -0
  423. package/dist/components/token-input/index.d.ts +1 -0
  424. package/dist/components/token-input/index.js +1 -0
  425. package/dist/components/tooltip/Tooltip.d.ts +17 -0
  426. package/dist/components/tooltip/Tooltip.js +144 -0
  427. package/dist/components/tooltip/index.d.ts +1 -0
  428. package/dist/components/tooltip/index.js +1 -0
  429. package/dist/components/tree-view/TreeView.d.ts +29 -0
  430. package/dist/components/tree-view/TreeView.js +140 -0
  431. package/dist/components/tree-view/index.d.ts +1 -0
  432. package/dist/components/tree-view/index.js +1 -0
  433. package/dist/components/unsaved-changes/index.d.ts +1 -0
  434. package/dist/components/unsaved-changes/index.js +1 -0
  435. package/dist/components/unsaved-changes/useUnsavedChanges.d.ts +12 -0
  436. package/dist/components/unsaved-changes/useUnsavedChanges.js +45 -0
  437. package/dist/components/usage-limit/UsageLimit.d.ts +15 -0
  438. package/dist/components/usage-limit/UsageLimit.js +21 -0
  439. package/dist/components/usage-limit/index.d.ts +1 -0
  440. package/dist/components/usage-limit/index.js +1 -0
  441. package/dist/components/web-search-results/WebSearchResults.d.ts +21 -0
  442. package/dist/components/web-search-results/WebSearchResults.js +17 -0
  443. package/dist/components/web-search-results/index.d.ts +1 -0
  444. package/dist/components/web-search-results/index.js +1 -0
  445. package/dist/lib/anchor.d.ts +21 -0
  446. package/dist/lib/anchor.js +50 -0
  447. package/dist/lib/cn.d.ts +1 -0
  448. package/dist/lib/cn.js +5 -0
  449. package/dist/lib/date.d.ts +77 -0
  450. package/dist/lib/date.js +165 -0
  451. package/dist/lib/icon-message.d.ts +16 -0
  452. package/dist/lib/icon-message.js +7 -0
  453. package/dist/lib/number.d.ts +1 -0
  454. package/dist/lib/number.js +5 -0
  455. package/dist/lib/slot.d.ts +8 -0
  456. package/dist/lib/slot.js +53 -0
  457. package/dist/lib/variant.d.ts +1 -0
  458. package/dist/lib/variant.js +1 -0
  459. package/docs/a11y.md +320 -0
  460. package/docs/chart/axis.md +82 -0
  461. package/docs/chart/color.md +120 -0
  462. package/docs/chart/drawing.md +283 -0
  463. package/docs/chart/reading.md +79 -0
  464. package/docs/chart/size-and-spacing.md +85 -0
  465. package/docs/chart.md +47 -0
  466. package/docs/color/contrast.md +80 -0
  467. package/docs/color/data-viz.md +66 -0
  468. package/docs/color/foundation.md +91 -0
  469. package/docs/color/neutral.md +88 -0
  470. package/docs/color/state.md +111 -0
  471. package/docs/color.md +22 -0
  472. package/docs/components/accordion.md +51 -0
  473. package/docs/components/agent-form.md +56 -0
  474. package/docs/components/agent-steps.md +75 -0
  475. package/docs/components/agent-thinking.md +70 -0
  476. package/docs/components/area-chart.md +55 -0
  477. package/docs/components/auth-card.md +126 -0
  478. package/docs/components/avatar.md +38 -0
  479. package/docs/components/badge.md +28 -0
  480. package/docs/components/banner.md +19 -0
  481. package/docs/components/bar-list.md +77 -0
  482. package/docs/components/button-group.md +74 -0
  483. package/docs/components/button.md +49 -0
  484. package/docs/components/calendar-view.md +106 -0
  485. package/docs/components/calendar.md +44 -0
  486. package/docs/components/carousel.md +81 -0
  487. package/docs/components/chart.md +45 -0
  488. package/docs/components/chat-message.md +199 -0
  489. package/docs/components/checkbox.md +27 -0
  490. package/docs/components/chip.md +34 -0
  491. package/docs/components/choosing.md +26 -0
  492. package/docs/components/close-button.md +17 -0
  493. package/docs/components/color-picker.md +52 -0
  494. package/docs/components/combo-chart.md +74 -0
  495. package/docs/components/combobox.md +60 -0
  496. package/docs/components/command-palette.md +151 -0
  497. package/docs/components/composer-attachments.md +116 -0
  498. package/docs/components/composer-panel.md +106 -0
  499. package/docs/components/composer.md +163 -0
  500. package/docs/components/contribution-chart.md +70 -0
  501. package/docs/components/data-grid.md +132 -0
  502. package/docs/components/data-table.md +165 -0
  503. package/docs/components/date-picker.md +120 -0
  504. package/docs/components/dialog.md +211 -0
  505. package/docs/components/drawer.md +38 -0
  506. package/docs/components/empty-state.md +17 -0
  507. package/docs/components/error-state.md +13 -0
  508. package/docs/components/error-summary.md +49 -0
  509. package/docs/components/field.md +84 -0
  510. package/docs/components/file-upload.md +161 -0
  511. package/docs/components/focus.md +25 -0
  512. package/docs/components/form-section.md +49 -0
  513. package/docs/components/form-steps.md +63 -0
  514. package/docs/components/funnel-chart.md +49 -0
  515. package/docs/components/heatmap-chart.md +64 -0
  516. package/docs/components/image-error.md +73 -0
  517. package/docs/components/image-loader.md +53 -0
  518. package/docs/components/input.md +21 -0
  519. package/docs/components/item-range.md +10 -0
  520. package/docs/components/link-button.md +16 -0
  521. package/docs/components/menu.md +115 -0
  522. package/docs/components/meter.md +83 -0
  523. package/docs/components/nav-group.md +33 -0
  524. package/docs/components/notification-center.md +100 -0
  525. package/docs/components/notification.md +127 -0
  526. package/docs/components/number-field.md +128 -0
  527. package/docs/components/otp-input.md +86 -0
  528. package/docs/components/pagination.md +29 -0
  529. package/docs/components/popover.md +43 -0
  530. package/docs/components/progress.md +25 -0
  531. package/docs/components/prohibitions.md +58 -0
  532. package/docs/components/props.md +20 -0
  533. package/docs/components/question-form.md +125 -0
  534. package/docs/components/radar-chart.md +61 -0
  535. package/docs/components/radial-chart.md +74 -0
  536. package/docs/components/radio.md +24 -0
  537. package/docs/components/reply-loader.md +80 -0
  538. package/docs/components/sankey-chart.md +71 -0
  539. package/docs/components/scatter-chart.md +61 -0
  540. package/docs/components/search-field.md +44 -0
  541. package/docs/components/segmented-control.md +35 -0
  542. package/docs/components/select.md +28 -0
  543. package/docs/components/separator.md +23 -0
  544. package/docs/components/settings-modal.md +128 -0
  545. package/docs/components/sidebar.md +145 -0
  546. package/docs/components/skeleton.md +27 -0
  547. package/docs/components/skip-link.md +17 -0
  548. package/docs/components/slider.md +82 -0
  549. package/docs/components/spinner.md +8 -0
  550. package/docs/components/stacked-bar.md +66 -0
  551. package/docs/components/stat-card.md +78 -0
  552. package/docs/components/switch.md +61 -0
  553. package/docs/components/table.md +43 -0
  554. package/docs/components/tabs.md +104 -0
  555. package/docs/components/tag-group.md +115 -0
  556. package/docs/components/task-list.md +99 -0
  557. package/docs/components/text-link.md +17 -0
  558. package/docs/components/textarea.md +27 -0
  559. package/docs/components/time-field.md +97 -0
  560. package/docs/components/toast.md +73 -0
  561. package/docs/components/token-input.md +135 -0
  562. package/docs/components/tooltip.md +41 -0
  563. package/docs/components/tree-view.md +71 -0
  564. package/docs/components/usage-limit.md +47 -0
  565. package/docs/components/web-search-results.md +60 -0
  566. package/docs/components.md +234 -0
  567. package/docs/design.md +31 -0
  568. package/docs/form/clearing-errors.md +28 -0
  569. package/docs/form/error-announcement.md +69 -0
  570. package/docs/form/long-forms.md +103 -0
  571. package/docs/form/placeholder.md +40 -0
  572. package/docs/form/submit-errors.md +102 -0
  573. package/docs/form/submitting.md +72 -0
  574. package/docs/form/unsaved-changes.md +146 -0
  575. package/docs/form/validation-timing.md +44 -0
  576. package/docs/form.md +39 -0
  577. package/docs/glossary.md +169 -0
  578. package/docs/icon.md +245 -0
  579. package/docs/interaction/before.md +64 -0
  580. package/docs/interaction/motion.md +38 -0
  581. package/docs/interaction/pending.md +38 -0
  582. package/docs/interaction/permissions.md +133 -0
  583. package/docs/interaction/result.md +38 -0
  584. package/docs/interaction/states.md +159 -0
  585. package/docs/interaction.md +31 -0
  586. package/docs/layout/alignment.md +145 -0
  587. package/docs/layout/hit-area.md +58 -0
  588. package/docs/layout/mobile.md +200 -0
  589. package/docs/layout/responsive.md +73 -0
  590. package/docs/layout/scroll.md +51 -0
  591. package/docs/layout/surface.md +110 -0
  592. package/docs/layout.md +31 -0
  593. package/docs/list/board.md +85 -0
  594. package/docs/list/paging.md +146 -0
  595. package/docs/list/search.md +98 -0
  596. package/docs/list/toolbar.md +91 -0
  597. package/docs/list.md +39 -0
  598. package/docs/log.md +94 -0
  599. package/docs/manual.md +152 -0
  600. package/docs/navigation/header-and-transition.md +82 -0
  601. package/docs/navigation/location.md +68 -0
  602. package/docs/navigation/menu-items.md +152 -0
  603. package/docs/navigation/menu-structure.md +68 -0
  604. package/docs/navigation.md +23 -0
  605. package/docs/rules.md +246 -0
  606. package/docs/scenario.md +218 -0
  607. package/docs/spacing/placement.md +219 -0
  608. package/docs/spacing/radius.md +45 -0
  609. package/docs/spacing/scale.md +91 -0
  610. package/docs/spacing.md +17 -0
  611. package/docs/typography.md +233 -0
  612. package/docs/writing/date-and-number.md +25 -0
  613. package/docs/writing/error-and-empty.md +58 -0
  614. package/docs/writing/label-and-button.md +124 -0
  615. package/docs/writing/tone.md +156 -0
  616. package/docs/writing.md +27 -0
  617. package/icons/index.d.ts +1 -0
  618. package/icons/index.js +3 -0
  619. package/package.json +115 -4
  620. package/scripts/lint/colors.mjs +103 -0
  621. package/scripts/lint/deps.mjs +33 -0
  622. package/scripts/lint/icons.mjs +177 -0
  623. package/scripts/lint/interaction.mjs +163 -0
  624. package/scripts/lint/layout.mjs +103 -0
  625. package/scripts/lint/markup.mjs +271 -0
  626. package/scripts/lint/shared.mjs +340 -0
  627. package/scripts/lint/spacing.mjs +70 -0
  628. package/scripts/lint/typography.mjs +141 -0
  629. package/scripts/lint/writing.mjs +107 -0
  630. package/scripts/lint.mjs +166 -0
  631. package/scripts/plain-ui-lint.mjs +33 -0
  632. package/tokens/tokens.css +482 -0
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ export interface HeaderProps {
3
+ /** 左端に置く、アプリの名前やロゴ。ページ名は置かない */
4
+ brand: ReactNode;
5
+ /** 768px未満で、メニューのボタンから左のドロワーで開くナビゲーション。NavLink と NavGroup を並べる */
6
+ nav: ReactNode;
7
+ /** メニューの名前。ドロワーの見出しと、ドロワーの中の nav の aria-label になる。省いたときは「メニュー」 */
8
+ navLabel?: string;
9
+ /** 通知やユーザーメニューのような、どの画面にも共通の機能。その画面だけの操作は置かない */
10
+ children?: ReactNode;
11
+ /** 外側の配置だけに使う */
12
+ className?: string;
13
+ }
14
+ export declare function Header({ brand, nav, navLabel, children, className }: HeaderProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { MenuIcon } from "lucide-react";
5
+ import { Button } from "../button/Button.js";
6
+ import { Drawer } from "../drawer/Drawer.js";
7
+ import { cn } from "../../lib/cn.js";
8
+ // 768px(Tailwind の md)以上かどうか。md: のクラスと同じ境目で、ドロワーを閉じる
9
+ const WIDE_QUERY = "(min-width: 48rem)";
10
+ // 画面の上に固定するヘッダー。768px以上ではメニューを Sidebar で常に表示するので、開くボタンは768px未満だけに出す。
11
+ // 768px未満のメニューは、Sidebar のドロワーと同じく、左から出すドロワー(Drawer)で開く
12
+ export function Header({ brand, nav, navLabel = "メニュー", children, className }) {
13
+ const [open, setOpen] = useState(false);
14
+ // ドロワーを開いたまま画面が768px以上に広がったら閉じる。広い画面では Sidebar の区画がいつも出ているので、ドロワーは要らない
15
+ useEffect(() => {
16
+ if (!open || typeof matchMedia !== "function")
17
+ return;
18
+ const query = matchMedia(WIDE_QUERY);
19
+ const closeIfWide = () => {
20
+ if (query.matches)
21
+ setOpen(false);
22
+ };
23
+ closeIfWide();
24
+ query.addEventListener("change", closeIfWide);
25
+ return () => query.removeEventListener("change", closeIfWide);
26
+ }, [open]);
27
+ return (_jsxs("header", { className: cn("sticky top-0 z-10 border-b bg-background", className), children: [_jsxs("div", { className: "flex h-14 items-center gap-2 px-4 md:px-6", children: [_jsx("div", { className: "md:hidden", children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "\u30E1\u30CB\u30E5\u30FC\u3092\u958B\u304F", "aria-haspopup": "dialog", onClick: () => setOpen(true), children: _jsx(MenuIcon, { "aria-hidden": "true", className: "size-4" }) }) }), _jsx("div", { className: "flex items-center font-semibold", children: brand }), _jsx("div", { className: "ml-auto flex items-center gap-2", children: children })] }), _jsx(Drawer, { open: open, onClose: () => setOpen(false), title: navLabel, side: "left", children: _jsx("nav", { "aria-label": navLabel, className: "space-y-1", onClick: event => {
28
+ if (event.target.closest("a[href]"))
29
+ setOpen(false);
30
+ }, children: nav }) })] }));
31
+ }
@@ -0,0 +1 @@
1
+ export * from "./Header.js";
@@ -0,0 +1 @@
1
+ export * from "./Header.js";
@@ -0,0 +1,10 @@
1
+ import type { ChartProps, ChartSeries } from "../chart/types.js";
2
+ export interface HeatmapChartProps extends Omit<ChartProps, "categoryLabel"> {
3
+ /** 横の軸に並べる列の名前(「9時」「12時」など) */
4
+ labels: readonly string[];
5
+ /** 行。name を縦の軸に並べ、values を labels と同じ順・同じ数で並べる。値のないセルは null にする。行の数に上限はない */
6
+ series: readonly ChartSeries[];
7
+ /** 縦の軸の名前(「曜日」)。値の表の1列目の見出しにする。省いたときは「項目」 */
8
+ seriesLabel?: string;
9
+ }
10
+ export declare function HeatmapChart({ seriesLabel, ...props }: HeatmapChartProps): import("react").JSX.Element;
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { cn } from "../../lib/cn.js";
5
+ import { formatNumber } from "../../lib/number.js";
6
+ import { CategoryAxis } from "../chart/Axis.js";
7
+ import { ChartFrame } from "../chart/ChartFrame.js";
8
+ import { ChartTooltip } from "../chart/ChartTooltip.js";
9
+ import { formatValue } from "../chart/format.js";
10
+ import { HeatmapLegend, HeatmapSwatch, STEP_FILL, STEP_TEXT, heatmapStepOf, heatmapStepSize, isValue } from "../chart/heatmap.js";
11
+ import { AXIS_FONT_SIZE, LABEL_MAX, textWidth, truncate, valueRange } from "../chart/scale.js";
12
+ import { CELL_GAP, LABEL_GAP } from "../chart/spacing.js";
13
+ import { ChartTooltipContent, useChartHover } from "../chart/useChartHover.js";
14
+ // 正と負のある値は、薄い〜濃いの1方向の段では読み違えるので、開発時に知らせる(docs/chart/drawing.md の CHART-021)
15
+ function useNegativeWarning(series) {
16
+ const negative = series.some(s => s.values.some(v => isValue(v) && v < 0));
17
+ useEffect(() => {
18
+ if (negative)
19
+ console.warn("HeatmapChart: 負の値は描けない。増減のように正と負のある値は、棒グラフか表で示す(docs/chart/drawing.md の CHART-021)");
20
+ }, [negative]);
21
+ }
22
+ // 2つの軸の組み合わせ(行と列)ごとの量を、セルの濃さで示す。
23
+ // 色の濃さだけで読ませず、セルに値を書き、凡例に段と値の範囲を出し、値の表とツールチップでも同じ値を読めるようにする
24
+ export function HeatmapChart({ seriesLabel, ...props }) {
25
+ useNegativeWarning(props.series);
26
+ const size = heatmapStepSize(Math.max(0, valueRange(props.series)[1]));
27
+ const hasNull = props.series.some(s => props.labels.some((_, i) => !isValue(s.values[i])));
28
+ const legend = _jsx(HeatmapLegend, { stepSize: size, hasNull: hasNull });
29
+ return (_jsx(ChartFrame, { ...props, component: "HeatmapChart", categoryLabel: seriesLabel, swatch: () => null, legend: legend, maxSeries: Infinity, seriesAsRows: true, children: box => _jsx(HeatmapPlot, { ...props, stepSize: size, ...box }) }));
30
+ }
31
+ // 描く領域の下:列の名前と描く領域の間(S)と、名前の文字の高さ(docs/chart/size-and-spacing.md の「間隔」)
32
+ const X_AXIS_HEIGHT = LABEL_GAP + AXIS_FONT_SIZE;
33
+ function HeatmapPlot({ labels, series, unit, stepSize, width, height, }) {
34
+ const cols = Math.max(labels.length, 1);
35
+ const rows = Math.max(series.length, 1);
36
+ // 行の名前の幅は、いちばん長い名前に合わせ、上限(96px)を超える名前は「…」で切り詰める
37
+ const rowLabelWidth = Math.ceil(Math.min(LABEL_MAX, Math.max(0, ...series.map(s => textWidth(s.name)))));
38
+ const left = rowLabelWidth + LABEL_GAP;
39
+ const plot = { left, top: 0, width: Math.max(width - left, 1), height: Math.max(height - X_AXIS_HEIGHT, 1) };
40
+ // セルどうしの間は XS(CELL_GAP)。描く領域の端には間をあけず、端のセルを領域の端にそろえる
41
+ const cellWidth = Math.max(1, (plot.width - CELL_GAP * (cols - 1)) / cols);
42
+ const cellHeight = Math.max(1, (plot.height - CELL_GAP * (rows - 1)) / rows);
43
+ const cellX = (col) => plot.left + col * (cellWidth + CELL_GAP);
44
+ const cellY = (row) => plot.top + row * (cellHeight + CELL_GAP);
45
+ // セルを、隣との間の半分ずつ外へ広げた帯。列の名前とマウスの位置の判定は、この帯で等分する(帯の中央がセルの中央になる)
46
+ const bands = { left: plot.left - CELL_GAP / 2, top: plot.top - CELL_GAP / 2, width: plot.width + CELL_GAP, height: plot.height + CELL_GAP };
47
+ const hover = useChartHover(bands, labels.length, "x", series.length);
48
+ // セルの値は、いちばん長い値がセルの端から XS 以上離れて収まるときだけ、すべてのセルに書く。
49
+ // 一部のセルだけに書くと、書いていないセルの値が読めないように見えるので、書くか書かないかはグラフで1つにする
50
+ const longest = Math.max(0, ...series.flatMap(s => s.values.filter(isValue).map(v => textWidth(formatNumber(v)))));
51
+ const showValues = longest + CELL_GAP * 2 <= cellWidth && AXIS_FONT_SIZE + CELL_GAP * 2 <= cellHeight;
52
+ // 行の名前は、上下の名前どうしが S 以上離れるように間引く
53
+ const rowStep = Math.max(1, Math.ceil((AXIS_FONT_SIZE + LABEL_GAP) / (cellHeight + CELL_GAP)));
54
+ const activeCol = hover.index;
55
+ const activeRow = hover.row;
56
+ const activeValue = activeCol !== null && activeRow !== null ? series[activeRow]?.values[activeCol] : undefined;
57
+ return (_jsxs(_Fragment, { children: [_jsxs("svg", { "aria-hidden": "true", width: width, height: height, className: "block overflow-visible", children: [series.map((s, row) => {
58
+ const y = cellY(row);
59
+ return (_jsxs("g", { children: [row % rowStep === 0 && (_jsx("text", { x: plot.left - LABEL_GAP, y: y + cellHeight / 2, textAnchor: "end", dominantBaseline: "middle", className: "fill-muted-foreground text-xs", children: truncate(s.name, rowLabelWidth) })), labels.map((_, col) => {
60
+ const x = cellX(col);
61
+ const value = s.values[col];
62
+ // 値のないセルは塗らずに、枠だけを描く(凡例の「値なし」の見本と同じ形)。0 のセルは1段目で塗り、値なしと混ぜない
63
+ if (!isValue(value)) {
64
+ return (_jsx("rect", { x: x + 0.5, y: y + 0.5, width: cellWidth - 1, height: cellHeight - 1, fill: "none", strokeWidth: "1", className: "stroke-muted-foreground" }, col));
65
+ }
66
+ const step = heatmapStepOf(value, stepSize);
67
+ return (_jsxs("g", { children: [_jsx("rect", { x: x, y: y, width: cellWidth, height: cellHeight, className: STEP_FILL[step] }), showValues && (_jsx("text", { x: x + cellWidth / 2, y: y + cellHeight / 2, textAnchor: "middle", dominantBaseline: "central", className: cn("text-xs tabular-nums", STEP_TEXT[step]), children: formatNumber(value) }))] }, col));
68
+ })] }, row));
69
+ }), activeCol !== null && activeRow !== null && (_jsx("rect", { x: cellX(activeCol) - 1, y: cellY(activeRow) - 1, width: cellWidth + 2, height: cellHeight + 2, fill: "none", strokeWidth: "2", className: "stroke-foreground" })), _jsx(CategoryAxis, { plot: { ...bands, height: plot.height + CELL_GAP / 2 }, labels: labels }), _jsx("rect", { x: plot.left, y: plot.top, width: plot.width, height: plot.height, fill: "transparent", ...hover.handlers })] }), _jsx(ChartTooltip, { position: hover.position, onDismiss: hover.dismiss, children: activeCol !== null && activeRow !== null && (_jsx(ChartTooltipContent, { label: labels[activeCol] ?? "", rows: [
70
+ {
71
+ name: series[activeRow]?.name ?? "",
72
+ swatch: _jsx(HeatmapSwatch, { step: isValue(activeValue) ? heatmapStepOf(activeValue, stepSize) : null }),
73
+ value: formatValue(activeValue ?? null, unit),
74
+ },
75
+ ] })) })] }));
76
+ }
@@ -0,0 +1 @@
1
+ export * from "./HeatmapChart.js";
@@ -0,0 +1 @@
1
+ export * from "./HeatmapChart.js";
@@ -0,0 +1,11 @@
1
+ export interface ImageErrorProps {
2
+ /** 失敗した理由と、どうすればよいか。使う側が書く(例:混み合っているため、生成できませんでした。少し待ってから、もう一度生成してください。) */
3
+ message: string;
4
+ /** 「もう一度生成する」のボタンを押したときに呼ぶ。同じ頼みで生成し直す */
5
+ onRetry: () => void;
6
+ /** 失敗した旨の文言。省いたときは「画像を生成できませんでした」。並べて生成するときは「2枚目の画像を生成できませんでした」のようにする */
7
+ label?: string;
8
+ /** 生成する画像と同じ大きさ(aspect-square w-64 など)と外側の配置を渡す(ImageLoader と同じ) */
9
+ className?: string;
10
+ }
11
+ export declare function ImageError({ message, onRetry, label, className }: ImageErrorProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { CircleAlertIcon } from "lucide-react";
4
+ import { cn } from "../../lib/cn.js";
5
+ import { IconMessage } from "../../lib/icon-message.js";
6
+ import { Button } from "../button/Button.js";
7
+ import { Skeleton } from "../skeleton/Skeleton.js";
8
+ // 画像の生成に失敗したときに、ImageLoader と同じ場所に、同じ大きさで置く(docs/components/image-error.md)。
9
+ // 面と、背景の色の面に載せる並べ方は ImageLoader と同じにし、生成中から失敗に変わっても、配置を崩さない。
10
+ // 失敗は、色だけでなく、アイコンと「生成できませんでした」の文でも示す。アイコンと文の並べ方は FieldError、Banner と同じ(lib/icon-message.tsx)。
11
+ // 失敗した旨と理由は role="alert" の領域に入れ、出したときに1回だけ読ませる。ボタンは領域の外に置き、
12
+ // 並べて生成したときにボタンの名前まで何度も読ませない。ボタンは、失敗した旨の文を aria-describedby で指し、どの画像のやり直しかを伝える
13
+ export function ImageError({ message, onRetry, label = "画像を生成できませんでした", className }) {
14
+ const labelId = useId();
15
+ return (_jsxs("div", { className: cn("relative flex items-center justify-center", className), children: [_jsx(Skeleton, { className: "absolute inset-0" }), _jsxs("div", { className: "relative w-full max-w-60 space-y-4 rounded-md bg-background p-4", children: [_jsx("div", { role: "alert", children: _jsxs(IconMessage, { as: "div", icon: CircleAlertIcon, iconClassName: "text-danger-icon", contentClassName: "space-y-1", className: "text-foreground", children: [_jsx("p", { id: labelId, className: "font-medium", children: label }), _jsx("p", { className: "text-muted-foreground", children: message })] }) }), _jsx(Button, { onClick: onRetry, "aria-describedby": labelId, children: "\u3082\u3046\u4E00\u5EA6\u751F\u6210\u3059\u308B" })] })] }));
16
+ }
@@ -0,0 +1 @@
1
+ export * from "./ImageError.js";
@@ -0,0 +1 @@
1
+ export * from "./ImageError.js";
@@ -0,0 +1,9 @@
1
+ export interface ImageLoaderProps {
2
+ /** 進んだ割合(0〜100)。まだ分からない間は省き、値なしのプログレスにする */
3
+ progress?: number;
4
+ /** 進行中の文言。プログレスの名前にもなる。省いたときは「画像を生成しています」 */
5
+ label?: string;
6
+ /** 生成する画像と同じ大きさ(aspect-square w-64 など)と外側の配置を渡す(Skeleton と同じ) */
7
+ className?: string;
8
+ }
9
+ export declare function ImageLoader({ progress, label, className }: ImageLoaderProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { Progress } from "../progress/Progress.js";
4
+ import { Skeleton } from "../skeleton/Skeleton.js";
5
+ // 生成中の画像の場所に置き、生成した後の画像と同じ大きさの Skeleton の上に、進んだ割合と文言を重ねる(docs/components/image-loader.md)。
6
+ // 進み具合は Progress(role="progressbar")で示す。値なしの明滅と、ほかの動きは、動きを減らす設定では止まる(Progress の決まり)。
7
+ // Skeleton は自分では動かさない(docs/interaction/motion.md の「動き」の例外は、値なしのプログレスとスピナーだけ)
8
+ export function ImageLoader({ progress, label = "画像を生成しています", className }) {
9
+ return (_jsxs("div", { className: cn("relative flex items-center justify-center", className), children: [_jsx(Skeleton, { className: "absolute inset-0" }), _jsxs("div", { className: "relative w-full max-w-60 space-y-2 rounded-md bg-background p-4", children: [_jsx("p", { "aria-hidden": "true", className: "text-sm leading-tight text-foreground", children: label }), _jsx(Progress, { "aria-label": label, value: progress, max: 100, showValue: true })] })] }));
10
+ }
@@ -0,0 +1 @@
1
+ export * from "./ImageLoader.js";
@@ -0,0 +1 @@
1
+ export * from "./ImageLoader.js";
@@ -0,0 +1,98 @@
1
+ export * from "./button/index.js";
2
+ export * from "./close-button/index.js";
3
+ export * from "./link-button/index.js";
4
+ export * from "./text-link/index.js";
5
+ export * from "./badge/index.js";
6
+ export * from "./chip/index.js";
7
+ export * from "./tag-group/index.js";
8
+ export * from "./composer-attachments/index.js";
9
+ export * from "./token-input/index.js";
10
+ export * from "./card/index.js";
11
+ export * from "./skeleton/index.js";
12
+ export * from "./label/index.js";
13
+ export * from "./input/index.js";
14
+ export * from "./otp-input/index.js";
15
+ export * from "./auth-card/index.js";
16
+ export * from "./textarea/index.js";
17
+ export * from "./time-field/index.js";
18
+ export * from "./file-upload/index.js";
19
+ export * from "./composer/index.js";
20
+ export * from "./field-error/index.js";
21
+ export * from "./table/index.js";
22
+ export * from "./data-table/index.js";
23
+ export * from "./data-grid/index.js";
24
+ export * from "./spinner/index.js";
25
+ export * from "./banner/index.js";
26
+ export * from "./error-summary/index.js";
27
+ export * from "./breadcrumb/index.js";
28
+ export * from "./empty-state/index.js";
29
+ export * from "./error-state/index.js";
30
+ export * from "./field/index.js";
31
+ export * from "./form-section/index.js";
32
+ export * from "./form-steps/index.js";
33
+ export * from "./question-form/index.js";
34
+ export * from "./header/index.js";
35
+ export * from "./nav-group/index.js";
36
+ export * from "./sidebar/index.js";
37
+ export * from "./skip-link/index.js";
38
+ export * from "./dialog/index.js";
39
+ export * from "./drawer/index.js";
40
+ export * from "./unsaved-changes/index.js";
41
+ export * from "./command-palette/index.js";
42
+ export * from "./settings-modal/index.js";
43
+ export * from "./tabs/index.js";
44
+ export * from "./accordion/index.js";
45
+ export * from "./carousel/index.js";
46
+ export * from "./menu/index.js";
47
+ export * from "./button-group/index.js";
48
+ export * from "./avatar/index.js";
49
+ export * from "./separator/index.js";
50
+ export * from "./popover/index.js";
51
+ export * from "./checkbox/index.js";
52
+ export * from "./select/index.js";
53
+ export * from "./combobox/index.js";
54
+ export * from "./composer-panel/index.js";
55
+ export * from "./tooltip/index.js";
56
+ export * from "./search-field/index.js";
57
+ export * from "./number-field/index.js";
58
+ export * from "./color-picker/index.js";
59
+ export * from "./tree-view/index.js";
60
+ export * from "./switch/index.js";
61
+ export * from "./slider/index.js";
62
+ export * from "./radio/index.js";
63
+ export * from "./toast/index.js";
64
+ export * from "./notification/index.js";
65
+ export * from "./notification-center/index.js";
66
+ export * from "./pagination/index.js";
67
+ export * from "./item-range/index.js";
68
+ export * from "./progress/index.js";
69
+ export * from "./meter/index.js";
70
+ export * from "./reply-loader/index.js";
71
+ export * from "./image-error/index.js";
72
+ export * from "./image-loader/index.js";
73
+ export * from "./calendar/index.js";
74
+ export * from "./date-picker/index.js";
75
+ export * from "./calendar-view/index.js";
76
+ export * from "./segmented-control/index.js";
77
+ export * from "./area-chart/index.js";
78
+ export * from "./bar-chart/index.js";
79
+ export * from "./bar-list/index.js";
80
+ export * from "./heatmap-chart/index.js";
81
+ export * from "./line-chart/index.js";
82
+ export * from "./funnel-chart/index.js";
83
+ export * from "./scatter-chart/index.js";
84
+ export * from "./combo-chart/index.js";
85
+ export * from "./radar-chart/index.js";
86
+ export * from "./radial-chart/index.js";
87
+ export * from "./contribution-chart/index.js";
88
+ export * from "./sankey-chart/index.js";
89
+ export * from "./stacked-bar/index.js";
90
+ export * from "./stat-card/index.js";
91
+ export * from "./task-list/index.js";
92
+ export * from "./agent-steps/index.js";
93
+ export * from "./agent-thinking/index.js";
94
+ export * from "./usage-limit/index.js";
95
+ export * from "./agent-form/index.js";
96
+ export * from "./web-search-results/index.js";
97
+ export type { ChartSeries } from "./chart/index.js";
98
+ export type { StatusVariant } from "../lib/variant.js";
@@ -0,0 +1,97 @@
1
+ // Plain UIのコンポーネントの書き出し口(@knk1313/plain-ui/components)
2
+ export * from "./button/index.js";
3
+ export * from "./close-button/index.js";
4
+ export * from "./link-button/index.js";
5
+ export * from "./text-link/index.js";
6
+ export * from "./badge/index.js";
7
+ export * from "./chip/index.js";
8
+ export * from "./tag-group/index.js";
9
+ export * from "./composer-attachments/index.js";
10
+ export * from "./token-input/index.js";
11
+ export * from "./card/index.js";
12
+ export * from "./skeleton/index.js";
13
+ export * from "./label/index.js";
14
+ export * from "./input/index.js";
15
+ export * from "./otp-input/index.js";
16
+ export * from "./auth-card/index.js";
17
+ export * from "./textarea/index.js";
18
+ export * from "./time-field/index.js";
19
+ export * from "./file-upload/index.js";
20
+ export * from "./composer/index.js";
21
+ export * from "./field-error/index.js";
22
+ export * from "./table/index.js";
23
+ export * from "./data-table/index.js";
24
+ export * from "./data-grid/index.js";
25
+ export * from "./spinner/index.js";
26
+ export * from "./banner/index.js";
27
+ export * from "./error-summary/index.js";
28
+ export * from "./breadcrumb/index.js";
29
+ export * from "./empty-state/index.js";
30
+ export * from "./error-state/index.js";
31
+ export * from "./field/index.js";
32
+ export * from "./form-section/index.js";
33
+ export * from "./form-steps/index.js";
34
+ export * from "./question-form/index.js";
35
+ export * from "./header/index.js";
36
+ export * from "./nav-group/index.js";
37
+ export * from "./sidebar/index.js";
38
+ export * from "./skip-link/index.js";
39
+ export * from "./dialog/index.js";
40
+ export * from "./drawer/index.js";
41
+ export * from "./unsaved-changes/index.js";
42
+ export * from "./command-palette/index.js";
43
+ export * from "./settings-modal/index.js";
44
+ export * from "./tabs/index.js";
45
+ export * from "./accordion/index.js";
46
+ export * from "./carousel/index.js";
47
+ export * from "./menu/index.js";
48
+ export * from "./button-group/index.js";
49
+ export * from "./avatar/index.js";
50
+ export * from "./separator/index.js";
51
+ export * from "./popover/index.js";
52
+ export * from "./checkbox/index.js";
53
+ export * from "./select/index.js";
54
+ export * from "./combobox/index.js";
55
+ export * from "./composer-panel/index.js";
56
+ export * from "./tooltip/index.js";
57
+ export * from "./search-field/index.js";
58
+ export * from "./number-field/index.js";
59
+ export * from "./color-picker/index.js";
60
+ export * from "./tree-view/index.js";
61
+ export * from "./switch/index.js";
62
+ export * from "./slider/index.js";
63
+ export * from "./radio/index.js";
64
+ export * from "./toast/index.js";
65
+ export * from "./notification/index.js";
66
+ export * from "./notification-center/index.js";
67
+ export * from "./pagination/index.js";
68
+ export * from "./item-range/index.js";
69
+ export * from "./progress/index.js";
70
+ export * from "./meter/index.js";
71
+ export * from "./reply-loader/index.js";
72
+ export * from "./image-error/index.js";
73
+ export * from "./image-loader/index.js";
74
+ export * from "./calendar/index.js";
75
+ export * from "./date-picker/index.js";
76
+ export * from "./calendar-view/index.js";
77
+ export * from "./segmented-control/index.js";
78
+ export * from "./area-chart/index.js";
79
+ export * from "./bar-chart/index.js";
80
+ export * from "./bar-list/index.js";
81
+ export * from "./heatmap-chart/index.js";
82
+ export * from "./line-chart/index.js";
83
+ export * from "./funnel-chart/index.js";
84
+ export * from "./scatter-chart/index.js";
85
+ export * from "./combo-chart/index.js";
86
+ export * from "./radar-chart/index.js";
87
+ export * from "./radial-chart/index.js";
88
+ export * from "./contribution-chart/index.js";
89
+ export * from "./sankey-chart/index.js";
90
+ export * from "./stacked-bar/index.js";
91
+ export * from "./stat-card/index.js";
92
+ export * from "./task-list/index.js";
93
+ export * from "./agent-steps/index.js";
94
+ export * from "./agent-thinking/index.js";
95
+ export * from "./usage-limit/index.js";
96
+ export * from "./agent-form/index.js";
97
+ export * from "./web-search-results/index.js";
@@ -0,0 +1,6 @@
1
+ import { type InputHTMLAttributes } from "react";
2
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ /** 外側の配置(余白と幅)だけに使う */
4
+ className?: string;
5
+ }
6
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { inputClassName } from "./inputStyle.js";
4
+ // 枠線、フォーカス、無効、エラーの見た目は inputStyle.ts にまとめてある。
5
+ // ref は input の要素に渡す。React 18 でも ref を受け取れるように、forwardRef で包む(LinkButton と同じ形)
6
+ export const Input = forwardRef(function Input({ type = "text", className, ...props }, ref) {
7
+ return (_jsx("input", { ref: ref, type: type, className: inputClassName("text", className), ...props }));
8
+ });
@@ -0,0 +1 @@
1
+ export * from "./Input.js";
@@ -0,0 +1 @@
1
+ export * from "./Input.js";
@@ -0,0 +1,14 @@
1
+ /** 枠線と面 */
2
+ export declare const inputSurface = "border border-input bg-background";
3
+ /** フォーカスの輪。ブラウザーの既定の輪は消し、ボタンと同じ輪を描く */
4
+ export declare const inputFocus = "outline-none focus-visible:ring-2 focus-visible:ring-ring";
5
+ /** 無効の見た目。label の側で薄くする部品(Radio)は、ここを付けず、カーソルだけを変える */
6
+ export declare const inputDisabled = "disabled:cursor-not-allowed disabled:opacity-50";
7
+ /** エラー。aria-invalid を付けた間だけ、枠線を danger-icon にする */
8
+ export declare const inputInvalid = "aria-invalid:border-danger-icon";
9
+ /** まだ入力していないときの文字(placeholder)。Select の未選択と同じ muted-foreground にする */
10
+ export declare const inputPlaceholder = "placeholder:text-muted-foreground";
11
+ export type InputShape = "text" | "picker" | "multiline";
12
+ export declare function inputClassName(shape: InputShape, className?: string): string;
13
+ export declare function inputFrameClassName(className?: string): string;
14
+ export declare function inputFieldClassName(className?: string): string;
@@ -0,0 +1,35 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ // 入力欄が共有する見た目(枠線、フォーカス、無効、エラー)。クラスはここだけに書き、部品ごとに写さない(#88)。
3
+ // Button の buttonStyle と同じく、components/index.ts からは書き出さない(部品の内部で使う)
4
+ // 状態ごとのクラス。Tailwind がクラスを読み取れるように、クラス名は組み立てずにそのまま書く。
5
+ // 入力欄そのもの(input、textarea、select)に付ける。Radio のように、決まった形の箱に合わないものは、ここから必要な分を選んで付ける
6
+ /** 枠線と面 */
7
+ export const inputSurface = "border border-input bg-background";
8
+ /** フォーカスの輪。ブラウザーの既定の輪は消し、ボタンと同じ輪を描く */
9
+ export const inputFocus = "outline-none focus-visible:ring-2 focus-visible:ring-ring";
10
+ /** 無効の見た目。label の側で薄くする部品(Radio)は、ここを付けず、カーソルだけを変える */
11
+ export const inputDisabled = "disabled:cursor-not-allowed disabled:opacity-50";
12
+ /** エラー。aria-invalid を付けた間だけ、枠線を danger-icon にする */
13
+ export const inputInvalid = "aria-invalid:border-danger-icon";
14
+ /** まだ入力していないときの文字(placeholder)。Select の未選択と同じ muted-foreground にする */
15
+ export const inputPlaceholder = "placeholder:text-muted-foreground";
16
+ const shapes = {
17
+ text: "min-h-11 px-4 py-2",
18
+ picker: "min-h-11 truncate py-2 pl-4 pr-8",
19
+ multiline: "min-h-24 max-h-60 resize-y field-sizing-content px-4 py-2 leading-relaxed",
20
+ };
21
+ // 入力欄の見た目のクラスを返す。className は、部品の中で足す振る舞いのクラス(peer、appearance-none など)と、外側の配置(余白と幅)だけに使う。
22
+ // 入力欄の文字は、画面の密度にかかわらず text-base にする(docs/typography.md)
23
+ export function inputClassName(shape, className) {
24
+ return cn("block w-full rounded-md text-base text-foreground", inputSurface, inputFocus, inputDisabled, inputInvalid, inputPlaceholder, shapes[shape], className);
25
+ }
26
+ // 入力欄を中に持ち、前後にアイコンやボタンを並べる箱(SearchField)の見た目のクラスを返す。
27
+ // 枠線とフォーカスの輪は、中の入力欄ではなく箱に描く。状態は中の input から :has() で読む。
28
+ // 中の input には枠線と輪を付けず、inputFieldClassName を付ける
29
+ export function inputFrameClassName(className) {
30
+ return cn("flex min-h-11 w-full items-center gap-2 rounded-md text-foreground", inputSurface, "has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-ring", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", "has-[input[aria-invalid=true]]:border-danger-icon", className);
31
+ }
32
+ // inputFrameClassName の箱の中に置く input の見た目のクラスを返す。面と枠線は箱に任せ、残りの幅を埋める
33
+ export function inputFieldClassName(className) {
34
+ return cn("min-w-0 flex-1 self-stretch bg-transparent py-2 text-base outline-none disabled:cursor-not-allowed", inputPlaceholder, className);
35
+ }
@@ -0,0 +1,11 @@
1
+ export interface ItemRangeProps {
2
+ /** 全体の件数 */
3
+ total: number;
4
+ /** 今のページ。1から数える */
5
+ page: number;
6
+ /** 1ページに見せる件数 */
7
+ pageSize: number;
8
+ /** 外側の配置(余白と幅)だけに使う */
9
+ className?: string;
10
+ }
11
+ export declare function ItemRange({ total, page, pageSize, className }: ItemRangeProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { formatNumber } from "../../lib/number.js";
4
+ // 一覧の上に置く、全体の件数と今のページで見せている範囲(「1,234件中 51〜100件」、docs/list.md)。
5
+ // 全体が1ページに収まるときと、今のページに見せる項目がないときは、範囲を書かず件数だけにする
6
+ export function ItemRange({ total, page, pageSize, className }) {
7
+ const from = (page - 1) * pageSize + 1;
8
+ const to = Math.min(page * pageSize, total);
9
+ const text = total <= pageSize || from < 1 || from > total
10
+ ? `${formatNumber(total)}件`
11
+ : `${formatNumber(total)}件中 ${formatNumber(from)}〜${formatNumber(to)}件`;
12
+ return _jsx("p", { className: cn("text-sm text-muted-foreground", className), children: text });
13
+ }
@@ -0,0 +1 @@
1
+ export * from "./ItemRange.js";
@@ -0,0 +1 @@
1
+ export * from "./ItemRange.js";
@@ -0,0 +1,8 @@
1
+ import type { LabelHTMLAttributes } from "react";
2
+ export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
3
+ /** 必須の項目。記号ではなく、ラベルの後ろに「(必須)」と書いて示す */
4
+ required?: boolean;
5
+ /** 外側の配置(余白と幅)だけに使う */
6
+ className?: string;
7
+ }
8
+ export declare function Label({ required, className, children, ...props }: LabelProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/cn.js";
3
+ export function Label({ required, className, children, ...props }) {
4
+ return (_jsxs("label", { className: cn("block text-sm font-medium leading-tight text-foreground", className), ...props, children: [children, required && _jsx("span", { className: "font-normal text-muted-foreground", children: "\uFF08\u5FC5\u9808\uFF09" })] }));
5
+ }
@@ -0,0 +1 @@
1
+ export * from "./Label.js";
@@ -0,0 +1 @@
1
+ export * from "./Label.js";
@@ -0,0 +1,10 @@
1
+ import type { ChartProps } from "../chart/types.js";
2
+ export interface LineChartProps extends ChartProps {
3
+ /**
4
+ * 値の軸を 0 から始めるか。省いたときは true。
5
+ * false にすると、値の範囲に合わせて 0 より上から始め、端の目盛りの線に省略の印を付ける。
6
+ * 量ではなく、変化の形を読ませたいときだけに使う(docs/chart/axis.md の CHART-003)
7
+ */
8
+ includeZero?: boolean;
9
+ }
10
+ export declare function LineChart({ includeZero, ...props }: LineChartProps): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CategoryAxis, HoverGuide, ValueAxis, layoutPlot } from "../chart/Axis.js";
4
+ import { ChartFrame } from "../chart/ChartFrame.js";
5
+ import { ChartTooltip } from "../chart/ChartTooltip.js";
6
+ import { formatValue } from "../chart/format.js";
7
+ import { linePath } from "../chart/line.js";
8
+ import { valueRange } from "../chart/scale.js";
9
+ import { LineSwatch, MARKER_MIN_BAND, SERIES_DASH, SERIES_STROKE, SeriesMarker, seriesIndex } from "../chart/series.js";
10
+ import { ChartTooltipContent, useChartHover } from "../chart/useChartHover.js";
11
+ // 時間に沿った推移を、折れ線で示す。系列は、色に加えて線の種類と印の形で描き分ける(docs/chart/color.md の CHART-002)。
12
+ // 値のない項目(null)では線を切り、前後をつながない
13
+ export function LineChart({ includeZero = true, ...props }) {
14
+ return (_jsx(ChartFrame, { ...props, component: "LineChart", swatch: i => _jsx(LineSwatch, { index: i }), children: size => _jsx(LinePlot, { ...props, includeZero: includeZero, ...size }) }));
15
+ }
16
+ function points(values, x, scale) {
17
+ return values.flatMap((value, i) => (typeof value === "number" && Number.isFinite(value) ? [{ i, x: x(i), y: scale.y(value) }] : []));
18
+ }
19
+ function LinePlot({ labels, series, unit, includeZero, width, height }) {
20
+ const { plot, scale } = layoutPlot(valueRange(series), width, height, includeZero);
21
+ const hover = useChartHover(plot, labels.length);
22
+ const band = plot.width / Math.max(labels.length, 1);
23
+ const x = (i) => plot.left + band * (i + 0.5);
24
+ const active = hover.index;
25
+ const allMarkers = band >= MARKER_MIN_BAND;
26
+ return (_jsxs(_Fragment, { children: [_jsxs("svg", { "aria-hidden": "true", width: width, height: height, className: "block overflow-visible", children: [_jsx(ValueAxis, { plot: plot, scale: scale }), active !== null && _jsx(HoverGuide, { plot: plot, x: x(active) }), series.map((s, i) => (_jsxs("g", { children: [_jsx("path", { d: linePath(s.values, x, scale.y), fill: "none", strokeWidth: "2", strokeLinejoin: "round", strokeLinecap: "round", strokeDasharray: SERIES_DASH[seriesIndex(i)], className: SERIES_STROKE[seriesIndex(i)] }), points(s.values, x, scale)
27
+ .filter(p => allMarkers || p.i === active)
28
+ .map(p => _jsx(SeriesMarker, { index: i, x: p.x, y: p.y, size: p.i === active ? 10 : 8 }, p.i))] }, i))), _jsx(CategoryAxis, { plot: plot, labels: labels }), _jsx("rect", { x: plot.left, y: plot.top, width: plot.width, height: plot.height, fill: "transparent", ...hover.handlers })] }), _jsx(ChartTooltip, { position: hover.position, onDismiss: hover.dismiss, children: active !== null && (_jsx(ChartTooltipContent, { label: labels[active] ?? "", rows: series.map((s, i) => ({ name: s.name, swatch: _jsx(LineSwatch, { index: i }), value: formatValue(s.values[active] ?? null, unit) })) })) })] }));
29
+ }
@@ -0,0 +1 @@
1
+ export * from "./LineChart.js";
@@ -0,0 +1 @@
1
+ export * from "./LineChart.js";