@hanzo/ui 8.27.10 → 8.27.12

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 (299) hide show
  1. package/dist/backends/gui/comparison.cjs +17 -21
  2. package/dist/backends/gui/comparison.d.ts +4 -5
  3. package/dist/backends/gui/comparison.d.ts.map +1 -1
  4. package/dist/backends/gui/comparison.js +18 -22
  5. package/dist/backends/gui/comparison.js.map +1 -1
  6. package/dist/backends/gui/crypto-screener.cjs +21 -31
  7. package/dist/backends/gui/crypto-screener.d.ts +20 -24
  8. package/dist/backends/gui/crypto-screener.d.ts.map +1 -1
  9. package/dist/backends/gui/crypto-screener.js +21 -31
  10. package/dist/backends/gui/crypto-screener.js.map +1 -1
  11. package/dist/backends/gui/cursor.cjs +15 -18
  12. package/dist/backends/gui/cursor.d.ts +4 -3
  13. package/dist/backends/gui/cursor.d.ts.map +1 -1
  14. package/dist/backends/gui/cursor.js +15 -18
  15. package/dist/backends/gui/cursor.js.map +1 -1
  16. package/dist/backends/gui/data-table.cjs +144 -184
  17. package/dist/backends/gui/data-table.d.ts +64 -44
  18. package/dist/backends/gui/data-table.d.ts.map +1 -1
  19. package/dist/backends/gui/data-table.js +146 -152
  20. package/dist/backends/gui/data-table.js.map +1 -1
  21. package/dist/backends/gui/dock.cjs +1 -1
  22. package/dist/backends/gui/dock.d.ts.map +1 -1
  23. package/dist/backends/gui/dock.js +1 -1
  24. package/dist/backends/gui/dock.js.map +1 -1
  25. package/dist/backends/gui/editor.cjs +35 -31
  26. package/dist/backends/gui/editor.d.ts +11 -11
  27. package/dist/backends/gui/editor.d.ts.map +1 -1
  28. package/dist/backends/gui/editor.js +35 -31
  29. package/dist/backends/gui/editor.js.map +1 -1
  30. package/dist/backends/gui/field.cjs +132 -0
  31. package/dist/backends/gui/field.d.ts +74 -0
  32. package/dist/backends/gui/field.d.ts.map +1 -0
  33. package/dist/backends/gui/field.js +121 -0
  34. package/dist/backends/gui/field.js.map +1 -0
  35. package/dist/backends/gui/gantt.cjs +17 -19
  36. package/dist/backends/gui/gantt.d.ts +4 -5
  37. package/dist/backends/gui/gantt.d.ts.map +1 -1
  38. package/dist/backends/gui/gantt.js +18 -21
  39. package/dist/backends/gui/gantt.js.map +1 -1
  40. package/dist/backends/gui/glimpse.cjs +88 -0
  41. package/dist/backends/gui/glimpse.d.ts +57 -0
  42. package/dist/backends/gui/glimpse.d.ts.map +1 -0
  43. package/dist/backends/gui/glimpse.js +81 -0
  44. package/dist/backends/gui/glimpse.js.map +1 -0
  45. package/dist/backends/gui/grid-pattern.cjs +119 -0
  46. package/dist/backends/gui/grid-pattern.d.ts +96 -0
  47. package/dist/backends/gui/grid-pattern.d.ts.map +1 -0
  48. package/dist/backends/gui/grid-pattern.js +84 -0
  49. package/dist/backends/gui/grid-pattern.js.map +1 -0
  50. package/dist/backends/gui/image-crop.cjs +35 -0
  51. package/dist/backends/gui/image-crop.d.ts +20 -0
  52. package/dist/backends/gui/image-crop.d.ts.map +1 -0
  53. package/dist/backends/gui/image-crop.js +33 -0
  54. package/dist/backends/gui/image-crop.js.map +1 -0
  55. package/dist/backends/gui/image-zoom.cjs +58 -0
  56. package/dist/backends/gui/image-zoom.d.ts +16 -0
  57. package/dist/backends/gui/image-zoom.d.ts.map +1 -0
  58. package/dist/backends/gui/image-zoom.js +56 -0
  59. package/dist/backends/gui/image-zoom.js.map +1 -0
  60. package/dist/backends/gui/index.cjs +159 -1
  61. package/dist/backends/gui/index.d.ts +49 -0
  62. package/dist/backends/gui/index.d.ts.map +1 -1
  63. package/dist/backends/gui/index.js +49 -0
  64. package/dist/backends/gui/index.js.map +1 -1
  65. package/dist/backends/gui/interactive-grid-pattern.cjs +61 -0
  66. package/dist/backends/gui/interactive-grid-pattern.d.ts +28 -0
  67. package/dist/backends/gui/interactive-grid-pattern.d.ts.map +1 -0
  68. package/dist/backends/gui/interactive-grid-pattern.js +26 -0
  69. package/dist/backends/gui/interactive-grid-pattern.js.map +1 -0
  70. package/dist/backends/gui/iphone-15-pro.cjs +83 -0
  71. package/dist/backends/gui/iphone-15-pro.d.ts +16 -0
  72. package/dist/backends/gui/iphone-15-pro.d.ts.map +1 -0
  73. package/dist/backends/gui/iphone-15-pro.js +81 -0
  74. package/dist/backends/gui/iphone-15-pro.js.map +1 -0
  75. package/dist/backends/gui/item.cjs +154 -0
  76. package/dist/backends/gui/item.d.ts +72 -0
  77. package/dist/backends/gui/item.d.ts.map +1 -0
  78. package/dist/backends/gui/item.js +143 -0
  79. package/dist/backends/gui/item.js.map +1 -0
  80. package/dist/backends/gui/kanban.cjs +247 -0
  81. package/dist/backends/gui/kanban.d.ts +37 -0
  82. package/dist/backends/gui/kanban.d.ts.map +1 -0
  83. package/dist/backends/gui/kanban.js +212 -0
  84. package/dist/backends/gui/kanban.js.map +1 -0
  85. package/dist/backends/gui/kbd.cjs +45 -0
  86. package/dist/backends/gui/kbd.d.ts +8 -0
  87. package/dist/backends/gui/kbd.d.ts.map +1 -0
  88. package/dist/backends/gui/kbd.js +42 -0
  89. package/dist/backends/gui/kbd.js.map +1 -0
  90. package/dist/backends/gui/limelight-nav.cjs +201 -0
  91. package/dist/backends/gui/limelight-nav.d.ts +20 -0
  92. package/dist/backends/gui/limelight-nav.d.ts.map +1 -0
  93. package/dist/backends/gui/limelight-nav.js +166 -0
  94. package/dist/backends/gui/limelight-nav.js.map +1 -0
  95. package/dist/backends/gui/list.cjs +26 -0
  96. package/dist/backends/gui/list.d.ts +15 -0
  97. package/dist/backends/gui/list.d.ts.map +1 -0
  98. package/dist/backends/gui/list.js +23 -0
  99. package/dist/backends/gui/list.js.map +1 -0
  100. package/dist/backends/gui/macos-dock.cjs +84 -0
  101. package/dist/backends/gui/macos-dock.d.ts +30 -0
  102. package/dist/backends/gui/macos-dock.d.ts.map +1 -0
  103. package/dist/backends/gui/macos-dock.js +82 -0
  104. package/dist/backends/gui/macos-dock.js.map +1 -0
  105. package/dist/backends/gui/magnetic.cjs +40 -0
  106. package/dist/backends/gui/magnetic.d.ts +12 -0
  107. package/dist/backends/gui/magnetic.d.ts.map +1 -0
  108. package/dist/backends/gui/magnetic.js +38 -0
  109. package/dist/backends/gui/magnetic.js.map +1 -0
  110. package/dist/backends/gui/marquee.cjs +110 -0
  111. package/dist/backends/gui/marquee.d.ts +44 -0
  112. package/dist/backends/gui/marquee.d.ts.map +1 -0
  113. package/dist/backends/gui/marquee.js +75 -0
  114. package/dist/backends/gui/marquee.js.map +1 -0
  115. package/dist/backends/gui/menu-dock.cjs +64 -0
  116. package/dist/backends/gui/menu-dock.d.ts +21 -0
  117. package/dist/backends/gui/menu-dock.d.ts.map +1 -0
  118. package/dist/backends/gui/menu-dock.js +62 -0
  119. package/dist/backends/gui/menu-dock.js.map +1 -0
  120. package/dist/backends/gui/menubar.cjs +227 -0
  121. package/dist/backends/gui/menubar.d.ts +106 -0
  122. package/dist/backends/gui/menubar.d.ts.map +1 -0
  123. package/dist/backends/gui/menubar.js +177 -0
  124. package/dist/backends/gui/menubar.js.map +1 -0
  125. package/dist/backends/gui/message-dock.cjs +111 -0
  126. package/dist/backends/gui/message-dock.d.ts +22 -0
  127. package/dist/backends/gui/message-dock.d.ts.map +1 -0
  128. package/dist/backends/gui/message-dock.js +110 -0
  129. package/dist/backends/gui/message-dock.js.map +1 -0
  130. package/dist/backends/gui/mini-calendar.cjs +25 -0
  131. package/dist/backends/gui/mini-calendar.d.ts +22 -0
  132. package/dist/backends/gui/mini-calendar.d.ts.map +1 -0
  133. package/dist/backends/gui/mini-calendar.js +24 -0
  134. package/dist/backends/gui/mini-calendar.js.map +1 -0
  135. package/dist/backends/gui/minimal-tiptap.cjs +56 -0
  136. package/dist/backends/gui/minimal-tiptap.d.ts +20 -0
  137. package/dist/backends/gui/minimal-tiptap.d.ts.map +1 -0
  138. package/dist/backends/gui/minimal-tiptap.js +21 -0
  139. package/dist/backends/gui/minimal-tiptap.js.map +1 -0
  140. package/dist/backends/gui/motion-highlight.cjs +83 -0
  141. package/dist/backends/gui/motion-highlight.d.ts +27 -0
  142. package/dist/backends/gui/motion-highlight.d.ts.map +1 -0
  143. package/dist/backends/gui/motion-highlight.js +48 -0
  144. package/dist/backends/gui/motion-highlight.js.map +1 -0
  145. package/dist/backends/gui/navigation-bar.cjs +47 -0
  146. package/dist/backends/gui/navigation-bar.d.ts +48 -0
  147. package/dist/backends/gui/navigation-bar.d.ts.map +1 -0
  148. package/dist/backends/gui/navigation-bar.js +45 -0
  149. package/dist/backends/gui/navigation-bar.js.map +1 -0
  150. package/dist/backends/gui/news-timeline.cjs +47 -0
  151. package/dist/backends/gui/news-timeline.d.ts +39 -0
  152. package/dist/backends/gui/news-timeline.d.ts.map +1 -0
  153. package/dist/backends/gui/news-timeline.js +45 -0
  154. package/dist/backends/gui/news-timeline.js.map +1 -0
  155. package/dist/backends/gui/order-entry.cjs +53 -0
  156. package/dist/backends/gui/order-entry.d.ts +21 -0
  157. package/dist/backends/gui/order-entry.d.ts.map +1 -0
  158. package/dist/backends/gui/order-entry.js +52 -0
  159. package/dist/backends/gui/order-entry.js.map +1 -0
  160. package/dist/backends/gui/orders-history.cjs +102 -0
  161. package/dist/backends/gui/orders-history.d.ts +24 -0
  162. package/dist/backends/gui/orders-history.d.ts.map +1 -0
  163. package/dist/backends/gui/orders-history.js +67 -0
  164. package/dist/backends/gui/orders-history.js.map +1 -0
  165. package/dist/backends/gui/pagination.cjs +51 -0
  166. package/dist/backends/gui/pagination.d.ts +52 -0
  167. package/dist/backends/gui/pagination.d.ts.map +1 -0
  168. package/dist/backends/gui/pagination.js +42 -0
  169. package/dist/backends/gui/pagination.js.map +1 -0
  170. package/dist/backends/gui/particles-background.cjs +135 -0
  171. package/dist/backends/gui/particles-background.d.ts +24 -0
  172. package/dist/backends/gui/particles-background.d.ts.map +1 -0
  173. package/dist/backends/gui/particles-background.js +133 -0
  174. package/dist/backends/gui/particles-background.js.map +1 -0
  175. package/dist/backends/gui/particles.cjs +145 -0
  176. package/dist/backends/gui/particles.d.ts +25 -0
  177. package/dist/backends/gui/particles.d.ts.map +1 -0
  178. package/dist/backends/gui/particles.js +143 -0
  179. package/dist/backends/gui/particles.js.map +1 -0
  180. package/dist/backends/gui/pill.cjs +82 -0
  181. package/dist/backends/gui/pill.d.ts +12 -0
  182. package/dist/backends/gui/pill.d.ts.map +1 -0
  183. package/dist/backends/gui/pill.js +78 -0
  184. package/dist/backends/gui/pill.js.map +1 -0
  185. package/dist/backends/gui/pin-list.cjs +82 -0
  186. package/dist/backends/gui/pin-list.d.ts +42 -0
  187. package/dist/backends/gui/pin-list.d.ts.map +1 -0
  188. package/dist/backends/gui/pin-list.js +80 -0
  189. package/dist/backends/gui/pin-list.js.map +1 -0
  190. package/dist/backends/gui/pixel-image.cjs +63 -0
  191. package/dist/backends/gui/pixel-image.d.ts +21 -0
  192. package/dist/backends/gui/pixel-image.d.ts.map +1 -0
  193. package/dist/backends/gui/pixel-image.js +61 -0
  194. package/dist/backends/gui/pixel-image.js.map +1 -0
  195. package/dist/backends/gui/positions-list.cjs +60 -0
  196. package/dist/backends/gui/positions-list.d.ts +14 -0
  197. package/dist/backends/gui/positions-list.d.ts.map +1 -0
  198. package/dist/backends/gui/positions-list.js +58 -0
  199. package/dist/backends/gui/positions-list.js.map +1 -0
  200. package/dist/backends/gui/qr-code.cjs +438 -0
  201. package/dist/backends/gui/qr-code.d.ts +42 -0
  202. package/dist/backends/gui/qr-code.d.ts.map +1 -0
  203. package/dist/backends/gui/qr-code.js +402 -0
  204. package/dist/backends/gui/qr-code.js.map +1 -0
  205. package/dist/backends/gui/relative-time.cjs +167 -0
  206. package/dist/backends/gui/relative-time.d.ts +10 -0
  207. package/dist/backends/gui/relative-time.d.ts.map +1 -0
  208. package/dist/backends/gui/relative-time.js +132 -0
  209. package/dist/backends/gui/relative-time.js.map +1 -0
  210. package/dist/backends/gui/safari.cjs +65 -0
  211. package/dist/backends/gui/safari.d.ts +23 -0
  212. package/dist/backends/gui/safari.d.ts.map +1 -0
  213. package/dist/backends/gui/safari.js +63 -0
  214. package/dist/backends/gui/safari.js.map +1 -0
  215. package/dist/backends/gui/snippet.cjs +144 -0
  216. package/dist/backends/gui/snippet.d.ts +38 -0
  217. package/dist/backends/gui/snippet.d.ts.map +1 -0
  218. package/dist/backends/gui/snippet.js +141 -0
  219. package/dist/backends/gui/snippet.js.map +1 -0
  220. package/dist/backends/gui/stars-scrolling-wheel.cjs +106 -0
  221. package/dist/backends/gui/stars-scrolling-wheel.d.ts +24 -0
  222. package/dist/backends/gui/stars-scrolling-wheel.d.ts.map +1 -0
  223. package/dist/backends/gui/stars-scrolling-wheel.js +104 -0
  224. package/dist/backends/gui/stars-scrolling-wheel.js.map +1 -0
  225. package/dist/backends/gui/status.cjs +79 -0
  226. package/dist/backends/gui/status.d.ts +15 -0
  227. package/dist/backends/gui/status.d.ts.map +1 -0
  228. package/dist/backends/gui/status.js +77 -0
  229. package/dist/backends/gui/status.js.map +1 -0
  230. package/dist/backends/gui/stock-market.cjs +21 -0
  231. package/dist/backends/gui/stock-market.d.ts +17 -0
  232. package/dist/backends/gui/stock-market.d.ts.map +1 -0
  233. package/dist/backends/gui/stock-market.js +19 -0
  234. package/dist/backends/gui/stock-market.js.map +1 -0
  235. package/dist/backends/gui/stock-screener.cjs +55 -0
  236. package/dist/backends/gui/stock-screener.d.ts +41 -0
  237. package/dist/backends/gui/stock-screener.d.ts.map +1 -0
  238. package/dist/backends/gui/stock-screener.js +53 -0
  239. package/dist/backends/gui/stock-screener.js.map +1 -0
  240. package/dist/backends/gui/symbol-info.cjs +46 -0
  241. package/dist/backends/gui/symbol-info.d.ts +36 -0
  242. package/dist/backends/gui/symbol-info.d.ts.map +1 -0
  243. package/dist/backends/gui/symbol-info.js +44 -0
  244. package/dist/backends/gui/symbol-info.js.map +1 -0
  245. package/dist/backends/gui/table.cjs +104 -0
  246. package/dist/backends/gui/table.d.ts +57 -0
  247. package/dist/backends/gui/table.d.ts.map +1 -0
  248. package/dist/backends/gui/table.js +95 -0
  249. package/dist/backends/gui/table.js.map +1 -0
  250. package/dist/backends/gui/tags.cjs +22 -0
  251. package/dist/backends/gui/tags.d.ts +22 -0
  252. package/dist/backends/gui/tags.d.ts.map +1 -0
  253. package/dist/backends/gui/tags.js +20 -0
  254. package/dist/backends/gui/tags.js.map +1 -0
  255. package/dist/backends/gui/technical-analysis.cjs +58 -0
  256. package/dist/backends/gui/technical-analysis.d.ts +41 -0
  257. package/dist/backends/gui/technical-analysis.d.ts.map +1 -0
  258. package/dist/backends/gui/technical-analysis.js +56 -0
  259. package/dist/backends/gui/technical-analysis.js.map +1 -0
  260. package/dist/backends/gui/terminal.cjs +266 -0
  261. package/dist/backends/gui/terminal.d.ts +38 -0
  262. package/dist/backends/gui/terminal.d.ts.map +1 -0
  263. package/dist/backends/gui/terminal.js +231 -0
  264. package/dist/backends/gui/terminal.js.map +1 -0
  265. package/dist/backends/gui/ticker.cjs +79 -0
  266. package/dist/backends/gui/ticker.d.ts +19 -0
  267. package/dist/backends/gui/ticker.d.ts.map +1 -0
  268. package/dist/backends/gui/ticker.js +44 -0
  269. package/dist/backends/gui/ticker.js.map +1 -0
  270. package/dist/backends/gui/timeline.cjs +154 -0
  271. package/dist/backends/gui/timeline.d.ts +42 -0
  272. package/dist/backends/gui/timeline.d.ts.map +1 -0
  273. package/dist/backends/gui/timeline.js +118 -0
  274. package/dist/backends/gui/timeline.js.map +1 -0
  275. package/dist/backends/gui/toggle.cjs +96 -0
  276. package/dist/backends/gui/toggle.d.ts +29 -0
  277. package/dist/backends/gui/toggle.d.ts.map +1 -0
  278. package/dist/backends/gui/toggle.js +95 -0
  279. package/dist/backends/gui/toggle.js.map +1 -0
  280. package/dist/backends/gui/video-player.cjs +383 -0
  281. package/dist/backends/gui/video-player.d.ts +54 -0
  282. package/dist/backends/gui/video-player.d.ts.map +1 -0
  283. package/dist/backends/gui/video-player.js +348 -0
  284. package/dist/backends/gui/video-player.js.map +1 -0
  285. package/dist/gallery.html +249 -249
  286. package/dist/gui-config.cjs +5 -0
  287. package/dist/gui-config.d.ts +18 -3
  288. package/dist/gui-config.d.ts.map +1 -1
  289. package/dist/gui-config.js +5 -0
  290. package/dist/gui-config.js.map +1 -1
  291. package/dist/index.cjs +110 -1
  292. package/dist/index.d.ts +1 -1
  293. package/dist/index.d.ts.map +1 -1
  294. package/dist/index.js +1 -1
  295. package/dist/index.js.map +1 -1
  296. package/dist/index.node.cjs +110 -1
  297. package/dist/index.node.js +1 -1
  298. package/dist/styles.css +124 -124
  299. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
1
  /**
2
- * Editor — a rich-text surface: a toolbar of bold/italic/bulleted-list/numbered-list
3
- * toggles above a contentEditable region, reporting its HTML back on every edit.
2
+ * Editor — a minimal rich-text field: a toolbar of formatting buttons above a
3
+ * `contentEditable` surface.
4
4
  *
5
- * Formatting a live selection is a browser primitive with no cross-platform
6
- * equivalent in gui, so this wraps the two platform primitives directly —
7
- * `contentEditable` for the surface, `document.execCommand` for the commands —
8
- * inside a gui frame for layout and theming. It is web-only for that reason;
9
- * native has no selection to format.
5
+ * Bold, italic and the two list commands run through the browser's own
6
+ * `document.execCommand`, the one API that turns a toolbar click into a real
7
+ * selection edit inside a `contentEditable` region — there is no gui primitive
8
+ * for rich-text editing, so this wraps that platform primitive in a gui frame
9
+ * the way `CodeEditor` wraps a plain field. The surface is HTML: `value` and
10
+ * `onChange` carry the region's `innerHTML`, matching what the toolbar
11
+ * commands actually produce.
10
12
  */
11
13
  import { type YStackProps } from '@hanzo/gui';
12
14
  import * as React from 'react';
13
- /** The four formatting commands the toolbar issues via `document.execCommand`. */
14
15
  export type EditorCommand = 'bold' | 'italic' | 'insertUnorderedList' | 'insertOrderedList';
15
16
  export interface EditorProps extends Omit<YStackProps, 'children' | 'onChange'> {
16
- /** A controlled value; omit it and edit freely to let the surface own its HTML. */
17
+ /** The region's HTML. Omit it and the region keeps its own content. */
17
18
  value?: string;
18
19
  onChange?: (value: string) => void;
19
20
  placeholder?: string;
20
- readOnly?: boolean;
21
21
  }
22
- export declare function Editor({ value, onChange, placeholder, readOnly, ...props }: EditorProps): React.JSX.Element;
22
+ export declare function Editor({ value, onChange, placeholder, ...props }: EditorProps): React.JSX.Element;
23
23
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/editor.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,qBAAqB,GAAG,mBAAmB,CAAA;AAE3F,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAC7E,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAA+B,EAAE,QAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBA0EnH"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/editor.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,qBAAqB,GAAG,mBAAmB,CAAA;AAE3F,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAC7E,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAA+B,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBA6EjG"}
@@ -1,45 +1,49 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  /**
4
- * Editor — a rich-text surface: a toolbar of bold/italic/bulleted-list/numbered-list
5
- * toggles above a contentEditable region, reporting its HTML back on every edit.
4
+ * Editor — a minimal rich-text field: a toolbar of formatting buttons above a
5
+ * `contentEditable` surface.
6
6
  *
7
- * Formatting a live selection is a browser primitive with no cross-platform
8
- * equivalent in gui, so this wraps the two platform primitives directly —
9
- * `contentEditable` for the surface, `document.execCommand` for the commands —
10
- * inside a gui frame for layout and theming. It is web-only for that reason;
11
- * native has no selection to format.
7
+ * Bold, italic and the two list commands run through the browser's own
8
+ * `document.execCommand`, the one API that turns a toolbar click into a real
9
+ * selection edit inside a `contentEditable` region — there is no gui primitive
10
+ * for rich-text editing, so this wraps that platform primitive in a gui frame
11
+ * the way `CodeEditor` wraps a plain field. The surface is HTML: `value` and
12
+ * `onChange` carry the region's `innerHTML`, matching what the toolbar
13
+ * commands actually produce.
12
14
  */
13
15
  import { XStack, YStack } from '@hanzo/gui';
14
16
  import { Bold, Italic, List, ListOrdered } from '@hanzogui/lucide-icons-2';
15
17
  import * as React from 'react';
16
18
  import { Button } from './button.js';
17
19
  import { slot } from './slot.js';
18
- export function Editor({ value, onChange, placeholder = 'Start typing...', readOnly = false, ...props }) {
19
- const surface = React.useRef(null);
20
- const [empty, setEmpty] = React.useState(!value);
21
- // A controlled value is written into the surface only when it changes out
22
- // from under the caller (e.g. a reset button) — writing it on every render
23
- // would fight the surface's own DOM as the user types and jump the caret.
20
+ export function Editor({ value, onChange, placeholder = 'Start typing...', ...props }) {
21
+ const field = React.useRef(null);
22
+ const shown = React.useRef(value);
23
+ const run = (command) => {
24
+ document.execCommand(command, false);
25
+ field.current?.focus();
26
+ };
27
+ const input = () => {
28
+ if (field.current)
29
+ onChange?.(field.current.innerHTML);
30
+ };
31
+ // A controlled `value` is only ever WRITTEN into the region when it changed
32
+ // out from under the caller — writing it on every render would reset the
33
+ // caret to the start on each keystroke, because `innerHTML` replaces the
34
+ // whole subtree rather than patching it.
24
35
  React.useEffect(() => {
25
- const el = surface.current;
26
- if (el && value !== undefined && value !== el.innerHTML)
27
- el.innerHTML = value;
36
+ if (field.current && value !== undefined && value !== shown.current) {
37
+ field.current.innerHTML = value;
38
+ }
39
+ shown.current = value;
28
40
  }, [value]);
29
- const report = React.useCallback(() => {
30
- const el = surface.current;
31
- if (!el)
32
- return;
33
- setEmpty(el.textContent === '');
34
- onChange?.(el.innerHTML);
35
- }, [onChange]);
36
- const command = (name) => () => {
37
- document.execCommand(name);
38
- surface.current?.focus();
39
- report();
40
- };
41
- return (_jsxs(YStack, { ...slot('editor'), gap: "$2", ...props, children: [_jsxs(XStack, { ...slot('editor-toolbar'), gap: "$1", borderBottomWidth: 1, borderColor: "$borderColor", pb: "$2", children: [_jsx(Button, { ...slot('editor-bold'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('bold'), "aria-label": "Bold", children: _jsx(Bold, { size: 16 }) }), _jsx(Button, { ...slot('editor-italic'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('italic'), "aria-label": "Italic", children: _jsx(Italic, { size: 16 }) }), _jsx(Button, { ...slot('editor-bullet-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertUnorderedList'), "aria-label": "Bulleted list", children: _jsx(List, { size: 16 }) }), _jsx(Button, { ...slot('editor-ordered-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertOrderedList'), "aria-label": "Numbered list", children: _jsx(ListOrdered, { size: 16 }) })] }), _jsx(YStack, { ...slot('editor-surface'), ref: surface,
42
- // @ts-expect-error — contentEditable is a DOM attribute gui does not type; it forwards unknown props on web and drops them on native
43
- contentEditable: !readOnly, suppressContentEditableWarning: true, "data-placeholder": placeholder, "data-empty": empty || undefined, minH: 200, borderWidth: 1, borderColor: "$borderColor", rounded: "$3", p: "$4", onInput: report, dangerouslySetInnerHTML: value === undefined ? { __html: '' } : undefined, style: { outline: 'none' } })] }));
41
+ return (_jsxs(YStack, { ...slot('editor'), gap: "$2", ...props, children: [_jsxs(XStack, { ...slot('editor-toolbar'), items: "center", gap: "$1", borderBottomWidth: 1, borderColor: "$borderColor", pb: "$2", children: [_jsx(Button, { ...slot('editor-bold'), variant: "ghost", size: "sm", type: "button", onClick: () => run('bold'), children: _jsx(Bold, { size: 16 }) }), _jsx(Button, { ...slot('editor-italic'), variant: "ghost", size: "sm", type: "button", onClick: () => run('italic'), children: _jsx(Italic, { size: 16 }) }), _jsx(Button, { ...slot('editor-bullet-list'), variant: "ghost", size: "sm", type: "button", onClick: () => run('insertUnorderedList'), children: _jsx(List, { size: 16 }) }), _jsx(Button, { ...slot('editor-ordered-list'), variant: "ghost", size: "sm", type: "button", onClick: () => run('insertOrderedList'), children: _jsx(ListOrdered, { size: 16 }) })] }), _jsx("div", { ref: field, ...slot('editor-content'), contentEditable: true, onInput: input, "data-placeholder": placeholder, suppressContentEditableWarning: true, dangerouslySetInnerHTML: value === undefined ? undefined : { __html: value }, style: {
42
+ minHeight: 200,
43
+ borderRadius: 8,
44
+ border: '1px solid var(--borderColor)',
45
+ padding: 16,
46
+ outline: 'none',
47
+ } })] }));
44
48
  }
45
49
  //# sourceMappingURL=editor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../src/backends/gui/editor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAoB,MAAM,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AI,CAAC,eAAe,CAAC,EAAE,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,YACrG,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,GAAI,GACb,EACT,KAAC,MAAM,OACD,IAAI,CAAC,oBAAoB,CAAC,EAC9B,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,GAAI,GACX,EACT,KAAC,MAAM,OACD,IAAI,CAAC,qBAAqB,CAAC,EAC/B,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,YAEvC,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,GAAI,GAClB,IACF,EACT,cACE,GAAG,EAAE,KAAK,KACN,IAAI,CAAC,gBAAgB,CAAC,EAC1B,eAAe,QACf,OAAO,EAAE,KAAK,sBACI,WAAW,EAC7B,8BAA8B,QAC9B,uBAAuB,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAC5E,KAAK,EAAE;oBACL,SAAS,EAAE,GAAG;oBACd,YAAY,EAAE,CAAC;oBACf,MAAM,EAAE,8BAA8B;oBACtC,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,MAAM;iBAChB,GACD,IACK,CACV,CAAA;AACH,CAAC"}
@@ -0,0 +1,132 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FieldGroup = exports.FieldContent = void 0;
5
+ exports.Field = Field;
6
+ exports.FieldDescription = FieldDescription;
7
+ exports.FieldError = FieldError;
8
+ exports.FieldLabel = FieldLabel;
9
+ exports.FieldLegend = FieldLegend;
10
+ exports.FieldSeparator = FieldSeparator;
11
+ exports.FieldSet = FieldSet;
12
+ exports.FieldTitle = FieldTitle;
13
+ const jsx_runtime_1 = require("react/jsx-runtime");
14
+ /**
15
+ * Field — the parts a form composes a labeled control from.
16
+ *
17
+ * `FieldSet`/`FieldLegend` group related fields inside a real `<fieldset>` so
18
+ * keyboard and screen-reader users get the grouping for free. `FieldGroup`
19
+ * stacks `Field`s with one rhythm. `Field` is the per-control wrapper —
20
+ * `role="group"`, an `orientation` (vertical / horizontal / responsive), and a
21
+ * `data-invalid` switch that turns the whole block destructive-colored so a
22
+ * sighted user and a screen reader see the same boundary. `FieldContent` keeps
23
+ * a label and its description together when the label sits beside the control.
24
+ * `FieldLabel` also doubles as a selectable "choice card" when its only child
25
+ * is a `Field` — border, radius and padding appear around it.
26
+ * `FieldTitle`/`FieldDescription`/`FieldError` are the text leaves;
27
+ * `FieldSeparator` divides a `FieldGroup`.
28
+ *
29
+ * `responsive` is mobile-first like `vertical` already is: a column below
30
+ * `$md`, a row from `$md` up — this config's media props are min-width (see
31
+ * the compiled `@media (min-width: …)` any `$md` prop emits), so there are no
32
+ * container queries to reach for and none are needed: the same direction every
33
+ * other responsive prop in this codebase is written in.
34
+ */
35
+ const gui_1 = require("@hanzo/gui");
36
+ const react_1 = require("react");
37
+ const box_1 = require("../../box.cjs");
38
+ const label_1 = require("./label.cjs");
39
+ const layout_1 = require("./layout.cjs");
40
+ const ink_1 = require("./ink.cjs");
41
+ const slot_1 = require("./slot.cjs");
42
+ function FieldSet({ children, ...props }) {
43
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "fieldset", className: "flex flex-col gap-6", ...(0, slot_1.slot)('field-set'), ...props, children: children }));
44
+ }
45
+ function FieldLegend({ variant = 'legend', children, ...props }) {
46
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "legend", className: variant === 'label' ? 'mb-3 text-sm font-medium' : 'mb-3 text-base font-medium', ...(0, slot_1.slot)('field-legend'), "data-variant": variant, ...props, children: children }));
47
+ }
48
+ const FieldGroup = (0, gui_1.styled)(gui_1.YStack, {
49
+ name: 'FieldGroup',
50
+ width: '100%',
51
+ gap: '$7',
52
+ });
53
+ exports.FieldGroup = FieldGroup;
54
+ const FieldContext = /* @__PURE__ */ (0, gui_1.createStyledContext)({
55
+ orientation: 'vertical',
56
+ });
57
+ const FieldFrame = (0, gui_1.styled)(gui_1.XStack, {
58
+ name: 'Field',
59
+ context: FieldContext,
60
+ width: '100%',
61
+ gap: '$3',
62
+ variants: {
63
+ orientation: {
64
+ vertical: { flexDirection: 'column' },
65
+ horizontal: { flexDirection: 'row', items: 'center' },
66
+ // Mobile-first, the way `vertical` already is: a column below `$md`,
67
+ // a row from `$md` up — this config's media props are min-width, so the
68
+ // base case is the narrow one and `$md` is where it widens.
69
+ responsive: {
70
+ flexDirection: 'column',
71
+ $md: { flexDirection: 'row', items: 'center' },
72
+ },
73
+ },
74
+ invalid: {
75
+ true: { color: '$red9' },
76
+ },
77
+ },
78
+ defaultVariants: { orientation: 'vertical' },
79
+ });
80
+ function Field({ orientation = 'vertical', ...props }) {
81
+ const invalid = props['data-invalid'];
82
+ return ((0, jsx_runtime_1.jsx)(FieldFrame, { role: "group", ...(0, slot_1.slot)('field'), "data-orientation": orientation, orientation: orientation, invalid: invalid, ...props }));
83
+ }
84
+ const FieldContent = (0, gui_1.styled)(gui_1.YStack, {
85
+ name: 'FieldContent',
86
+ flex: 1,
87
+ gap: '$1.5',
88
+ });
89
+ exports.FieldContent = FieldContent;
90
+ /** A `Field` nested directly inside a `FieldLabel` reads as a choice card. */
91
+ const isFieldChild = (children) => (0, react_1.isValidElement)(children) && children.type === Field;
92
+ function FieldLabel({ className, children, ...props }) {
93
+ const card = isFieldChild(children);
94
+ return ((0, jsx_runtime_1.jsx)(label_1.Label, { ...(0, slot_1.slot)('field-label'), gap: "$2", ...(card
95
+ ? {
96
+ width: '100%',
97
+ flexDirection: 'column',
98
+ rounded: '$3',
99
+ borderWidth: 1,
100
+ borderColor: '$borderColor',
101
+ p: '$4',
102
+ }
103
+ : { self: 'flex-start' }), className: className, ...props, children: children }));
104
+ }
105
+ function FieldTitle({ children, ...props }) {
106
+ return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('field-label'), self: "flex-start", items: "center", gap: "$2", ...props, children: (0, ink_1.ink)(children, gui_1.SizableText, { fontSize: '$2', fontWeight: '500' }) }));
107
+ }
108
+ function FieldDescription({ children, ...props }) {
109
+ return ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { ...(0, slot_1.slot)('field-description'), fontSize: "$2", fontWeight: "400", color: "$quiet", ...props, children: children }));
110
+ }
111
+ function FieldSeparator({ children, ...props }) {
112
+ return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('field-separator'), "data-content": !!children, items: "center", gap: "$2", ...props, children: [(0, jsx_runtime_1.jsx)(layout_1.Separator, { flex: 1 }), children && ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { ...(0, slot_1.slot)('field-separator-content'), color: "$quiet", fontSize: "$2", children: children })), children && (0, jsx_runtime_1.jsx)(layout_1.Separator, { flex: 1 })] }));
113
+ }
114
+ function fieldErrorContent(children, errors, issues) {
115
+ if (children)
116
+ return children;
117
+ const list = errors ?? issues;
118
+ if (!list)
119
+ return null;
120
+ const messages = list.filter((e) => !!e?.message);
121
+ if (messages.length === 0)
122
+ return null;
123
+ if (messages.length === 1)
124
+ return messages[0].message;
125
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "ul", className: "ml-4 flex flex-col gap-1", style: { listStyleType: 'disc' }, ...(0, slot_1.slot)('field-error-list'), children: messages.map((error, index) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "li", className: "text-sm text-red9", children: error.message }, index))) }));
126
+ }
127
+ function FieldError({ children, errors, issues, ...props }) {
128
+ const content = fieldErrorContent(children, errors, issues);
129
+ if (!content)
130
+ return null;
131
+ return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { role: "alert", ...(0, slot_1.slot)('field-error'), ...props, children: (0, ink_1.ink)(content, gui_1.SizableText, { fontSize: '$2', fontWeight: '400', color: '$red9' }) }));
132
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Field — the parts a form composes a labeled control from.
3
+ *
4
+ * `FieldSet`/`FieldLegend` group related fields inside a real `<fieldset>` so
5
+ * keyboard and screen-reader users get the grouping for free. `FieldGroup`
6
+ * stacks `Field`s with one rhythm. `Field` is the per-control wrapper —
7
+ * `role="group"`, an `orientation` (vertical / horizontal / responsive), and a
8
+ * `data-invalid` switch that turns the whole block destructive-colored so a
9
+ * sighted user and a screen reader see the same boundary. `FieldContent` keeps
10
+ * a label and its description together when the label sits beside the control.
11
+ * `FieldLabel` also doubles as a selectable "choice card" when its only child
12
+ * is a `Field` — border, radius and padding appear around it.
13
+ * `FieldTitle`/`FieldDescription`/`FieldError` are the text leaves;
14
+ * `FieldSeparator` divides a `FieldGroup`.
15
+ *
16
+ * `responsive` is mobile-first like `vertical` already is: a column below
17
+ * `$md`, a row from `$md` up — this config's media props are min-width (see
18
+ * the compiled `@media (min-width: …)` any `$md` prop emits), so there are no
19
+ * container queries to reach for and none are needed: the same direction every
20
+ * other responsive prop in this codebase is written in.
21
+ */
22
+ import { SizableText, XStack } from '@hanzo/gui';
23
+ import { type ComponentProps, type ReactNode } from 'react';
24
+ import { Label } from './label.js';
25
+ export type FieldOrientation = 'vertical' | 'horizontal' | 'responsive';
26
+ export type FieldLegendVariant = 'legend' | 'label';
27
+ declare function FieldSet({ children, ...props }: ComponentProps<'fieldset'>): import("react").JSX.Element;
28
+ export type FieldSetProps = ComponentProps<typeof FieldSet>;
29
+ declare function FieldLegend({ variant, children, ...props }: ComponentProps<'legend'> & {
30
+ variant?: FieldLegendVariant;
31
+ }): import("react").JSX.Element;
32
+ export type FieldLegendProps = ComponentProps<typeof FieldLegend>;
33
+ declare const FieldGroup: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
34
+ elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
35
+ fullscreen?: boolean | undefined;
36
+ }, import("@hanzogui/web").StaticConfigPublic>;
37
+ export type FieldGroupProps = ComponentProps<typeof FieldGroup>;
38
+ declare const FieldFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
39
+ elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
40
+ fullscreen?: boolean | undefined;
41
+ invalid?: boolean | undefined;
42
+ orientation?: "horizontal" | "responsive" | "vertical" | undefined;
43
+ }, import("@hanzogui/web").StaticConfigPublic>;
44
+ export type FieldProps = Omit<ComponentProps<typeof FieldFrame>, 'orientation'> & {
45
+ orientation?: FieldOrientation;
46
+ 'data-invalid'?: boolean;
47
+ };
48
+ declare function Field({ orientation, ...props }: FieldProps): import("react").JSX.Element;
49
+ declare const FieldContent: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
50
+ elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
51
+ fullscreen?: boolean | undefined;
52
+ }, import("@hanzogui/web").StaticConfigPublic>;
53
+ export type FieldContentProps = ComponentProps<typeof FieldContent>;
54
+ declare function FieldLabel({ className, children, ...props }: ComponentProps<typeof Label>): import("react").JSX.Element;
55
+ export type FieldLabelProps = ComponentProps<typeof FieldLabel>;
56
+ declare function FieldTitle({ children, ...props }: ComponentProps<typeof XStack>): import("react").JSX.Element;
57
+ export type FieldTitleProps = ComponentProps<typeof FieldTitle>;
58
+ declare function FieldDescription({ children, ...props }: ComponentProps<typeof SizableText>): import("react").JSX.Element;
59
+ export type FieldDescriptionProps = ComponentProps<typeof FieldDescription>;
60
+ declare function FieldSeparator({ children, ...props }: ComponentProps<typeof XStack> & {
61
+ children?: ReactNode;
62
+ }): import("react").JSX.Element;
63
+ export type FieldSeparatorProps = ComponentProps<typeof FieldSeparator>;
64
+ export type FieldErrorIssue = {
65
+ message?: string;
66
+ };
67
+ export type FieldErrorProps = ComponentProps<typeof XStack> & {
68
+ errors?: Array<FieldErrorIssue | undefined>;
69
+ /** Issues from any [Standard Schema](https://standardschema.dev/) validator. */
70
+ issues?: Array<FieldErrorIssue | undefined>;
71
+ };
72
+ declare function FieldError({ children, errors, issues, ...props }: FieldErrorProps): import("react").JSX.Element | null;
73
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, };
74
+ //# sourceMappingURL=field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/field.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAuC,MAAM,YAAY,CAAA;AACrF,OAAO,EAAkB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAK/B,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEnD,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,UAAU,CAAC,+BAMnE;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CA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F;AAED,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE3E,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,+BAYA;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,CAAA;AAEvE,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAiClD,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAC5D,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;IAC3C,gFAAgF;IAChF,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;CAC5C,CAAA;AAED,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,sCAQ1E;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,UAAU,GACX,CAAA"}
@@ -0,0 +1,121 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Field — the parts a form composes a labeled control from.
5
+ *
6
+ * `FieldSet`/`FieldLegend` group related fields inside a real `<fieldset>` so
7
+ * keyboard and screen-reader users get the grouping for free. `FieldGroup`
8
+ * stacks `Field`s with one rhythm. `Field` is the per-control wrapper —
9
+ * `role="group"`, an `orientation` (vertical / horizontal / responsive), and a
10
+ * `data-invalid` switch that turns the whole block destructive-colored so a
11
+ * sighted user and a screen reader see the same boundary. `FieldContent` keeps
12
+ * a label and its description together when the label sits beside the control.
13
+ * `FieldLabel` also doubles as a selectable "choice card" when its only child
14
+ * is a `Field` — border, radius and padding appear around it.
15
+ * `FieldTitle`/`FieldDescription`/`FieldError` are the text leaves;
16
+ * `FieldSeparator` divides a `FieldGroup`.
17
+ *
18
+ * `responsive` is mobile-first like `vertical` already is: a column below
19
+ * `$md`, a row from `$md` up — this config's media props are min-width (see
20
+ * the compiled `@media (min-width: …)` any `$md` prop emits), so there are no
21
+ * container queries to reach for and none are needed: the same direction every
22
+ * other responsive prop in this codebase is written in.
23
+ */
24
+ import { SizableText, XStack, YStack, createStyledContext, styled } from '@hanzo/gui';
25
+ import { isValidElement } from 'react';
26
+ import { Box } from '../../box.js';
27
+ import { Label } from './label.js';
28
+ import { Separator } from './layout.js';
29
+ import { ink } from './ink.js';
30
+ import { slot } from './slot.js';
31
+ function FieldSet({ children, ...props }) {
32
+ return (_jsx(Box, { tag: "fieldset", className: "flex flex-col gap-6", ...slot('field-set'), ...props, children: children }));
33
+ }
34
+ function FieldLegend({ variant = 'legend', children, ...props }) {
35
+ return (_jsx(Box, { tag: "legend", className: variant === 'label' ? 'mb-3 text-sm font-medium' : 'mb-3 text-base font-medium', ...slot('field-legend'), "data-variant": variant, ...props, children: children }));
36
+ }
37
+ const FieldGroup = styled(YStack, {
38
+ name: 'FieldGroup',
39
+ width: '100%',
40
+ gap: '$7',
41
+ });
42
+ const FieldContext = /* @__PURE__ */ createStyledContext({
43
+ orientation: 'vertical',
44
+ });
45
+ const FieldFrame = styled(XStack, {
46
+ name: 'Field',
47
+ context: FieldContext,
48
+ width: '100%',
49
+ gap: '$3',
50
+ variants: {
51
+ orientation: {
52
+ vertical: { flexDirection: 'column' },
53
+ horizontal: { flexDirection: 'row', items: 'center' },
54
+ // Mobile-first, the way `vertical` already is: a column below `$md`,
55
+ // a row from `$md` up — this config's media props are min-width, so the
56
+ // base case is the narrow one and `$md` is where it widens.
57
+ responsive: {
58
+ flexDirection: 'column',
59
+ $md: { flexDirection: 'row', items: 'center' },
60
+ },
61
+ },
62
+ invalid: {
63
+ true: { color: '$red9' },
64
+ },
65
+ },
66
+ defaultVariants: { orientation: 'vertical' },
67
+ });
68
+ function Field({ orientation = 'vertical', ...props }) {
69
+ const invalid = props['data-invalid'];
70
+ return (_jsx(FieldFrame, { role: "group", ...slot('field'), "data-orientation": orientation, orientation: orientation, invalid: invalid, ...props }));
71
+ }
72
+ const FieldContent = styled(YStack, {
73
+ name: 'FieldContent',
74
+ flex: 1,
75
+ gap: '$1.5',
76
+ });
77
+ /** A `Field` nested directly inside a `FieldLabel` reads as a choice card. */
78
+ const isFieldChild = (children) => isValidElement(children) && children.type === Field;
79
+ function FieldLabel({ className, children, ...props }) {
80
+ const card = isFieldChild(children);
81
+ return (_jsx(Label, { ...slot('field-label'), gap: "$2", ...(card
82
+ ? {
83
+ width: '100%',
84
+ flexDirection: 'column',
85
+ rounded: '$3',
86
+ borderWidth: 1,
87
+ borderColor: '$borderColor',
88
+ p: '$4',
89
+ }
90
+ : { self: 'flex-start' }), className: className, ...props, children: children }));
91
+ }
92
+ function FieldTitle({ children, ...props }) {
93
+ return (_jsx(XStack, { ...slot('field-label'), self: "flex-start", items: "center", gap: "$2", ...props, children: ink(children, SizableText, { fontSize: '$2', fontWeight: '500' }) }));
94
+ }
95
+ function FieldDescription({ children, ...props }) {
96
+ return (_jsx(SizableText, { ...slot('field-description'), fontSize: "$2", fontWeight: "400", color: "$quiet", ...props, children: children }));
97
+ }
98
+ function FieldSeparator({ children, ...props }) {
99
+ return (_jsxs(XStack, { ...slot('field-separator'), "data-content": !!children, items: "center", gap: "$2", ...props, children: [_jsx(Separator, { flex: 1 }), children && (_jsx(SizableText, { ...slot('field-separator-content'), color: "$quiet", fontSize: "$2", children: children })), children && _jsx(Separator, { flex: 1 })] }));
100
+ }
101
+ function fieldErrorContent(children, errors, issues) {
102
+ if (children)
103
+ return children;
104
+ const list = errors ?? issues;
105
+ if (!list)
106
+ return null;
107
+ const messages = list.filter((e) => !!e?.message);
108
+ if (messages.length === 0)
109
+ return null;
110
+ if (messages.length === 1)
111
+ return messages[0].message;
112
+ return (_jsx(Box, { tag: "ul", className: "ml-4 flex flex-col gap-1", style: { listStyleType: 'disc' }, ...slot('field-error-list'), children: messages.map((error, index) => (_jsx(Box, { tag: "li", className: "text-sm text-red9", children: error.message }, index))) }));
113
+ }
114
+ function FieldError({ children, errors, issues, ...props }) {
115
+ const content = fieldErrorContent(children, errors, issues);
116
+ if (!content)
117
+ return null;
118
+ return (_jsx(XStack, { role: "alert", ...slot('field-error'), ...props, children: ink(content, SizableText, { fontSize: '$2', fontWeight: '400', color: '$red9' }) }));
119
+ }
120
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, };
121
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.js","sourceRoot":"","sources":["../../../src/backends/gui/field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAK7B,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAA8B;IAClE,OAAO,CACL,KAAC,GAAG,IAAC,GAAG,EAAC,UAAU,EAAC,SAAS,EAAC,qBAAqB,KAAK,IAAI,CAAC,WAAW,CAAC,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exports, "__esModule", { value: true });
4
4
  exports.Gantt = Gantt;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  /**
7
- * Gantt — a vertical list of tasks, each drawn as a labelled progress bar
8
- * spanning its own start and end date.
7
+ * Gantt — a task list with a per-row progress track and a start/end date.
9
8
  *
10
- * One row is one task: a name and a percentage on top, a filled track for
11
- * progress in the middle, the start and end dates below. No timeline axis is
12
- * computed — each row's fill is just `progress`, so the component stays a
13
- * plain list (one YStack, one axis) rather than a two-dimensional layout, and
14
- * needs no `Grid`.
9
+ * One row is three lines: name and percent, a filled track, then the two
10
+ * dates. The substrate is @hanzo/gui: `styled()` frames and theme tokens, so
11
+ * it renders on web, native (expo) and Tauri. An empty task list renders a
12
+ * placeholder rather than nothing.
15
13
  */
16
14
  const gui_1 = require("@hanzo/gui");
17
15
  const ink_1 = require("./ink.cjs");
18
16
  const slot_1 = require("./slot.cjs");
19
- const Frame = (0, gui_1.styled)(gui_1.YStack, {
17
+ const TRACK_HEIGHT = 32;
18
+ const GanttFrame = (0, gui_1.styled)(gui_1.YStack, {
20
19
  name: 'Gantt',
21
20
  bg: '$background',
22
21
  borderWidth: 1,
23
22
  borderColor: '$borderColor',
24
23
  rounded: '$6',
25
24
  p: '$6',
26
- gap: '$4',
27
25
  });
28
- const Track = (0, gui_1.styled)(gui_1.YStack, {
26
+ const RowFrame = (0, gui_1.styled)(gui_1.YStack, { name: 'GanttRow', gap: '$2' });
27
+ const TrackFrame = (0, gui_1.styled)(gui_1.YStack, {
29
28
  name: 'GanttTrack',
30
- height: 32,
29
+ height: TRACK_HEIGHT,
31
30
  rounded: '$3',
32
31
  bg: '$edge',
33
32
  overflow: 'hidden',
34
33
  });
35
- const Fill = (0, gui_1.styled)(gui_1.YStack, {
36
- name: 'GanttFill',
34
+ const BarFrame = (0, gui_1.styled)(gui_1.YStack, {
35
+ name: 'GanttBar',
37
36
  height: '100%',
38
37
  rounded: '$3',
39
38
  bg: '$accentBackground',
40
39
  });
41
- const clamp = (n) => Math.min(100, Math.max(0, n));
42
40
  function Gantt({ tasks = [], ...props }) {
43
- return ((0, jsx_runtime_1.jsx)(Frame, { ...(0, slot_1.slot)('gantt'), ...props, children: tasks.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('gantt-empty'), items: "center", justify: "center", p: "$8", children: (0, ink_1.ink)('No tasks available. Add tasks to display Gantt chart.', gui_1.SizableText, {
41
+ return ((0, jsx_runtime_1.jsx)(GanttFrame, { ...(0, slot_1.slot)('gantt'), ...props, children: tasks.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('gantt-empty'), items: "center", justify: "center", p: "$8", children: (0, ink_1.ink)('No tasks available. Add tasks to display Gantt chart.', gui_1.SizableText, {
44
42
  size: '$2',
45
43
  color: '$quiet',
46
- }) })) : (tasks.map((task) => {
47
- const progress = clamp(task.progress ?? 0);
48
- return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('gantt-task'), gap: "$2", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { justify: "space-between", children: [(0, ink_1.ink)(task.name, gui_1.SizableText, { size: '$2', fontWeight: '600' }), (0, ink_1.ink)(`${progress}%`, gui_1.SizableText, { size: '$2', color: '$quiet' })] }), (0, jsx_runtime_1.jsx)(Track, { ...(0, slot_1.slot)('gantt-track'), children: (0, jsx_runtime_1.jsx)(Fill, { ...(0, slot_1.slot)('gantt-fill'), width: `${progress}%` }) }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { justify: "space-between", children: [(0, ink_1.ink)(task.start.toLocaleDateString(), gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(task.end.toLocaleDateString(), gui_1.SizableText, { size: '$1', color: '$quiet' })] })] }, task.id));
49
- })) }));
44
+ }) })) : ((0, jsx_runtime_1.jsx)(gui_1.YStack, { gap: "$4", children: tasks.map((task) => {
45
+ const progress = Math.min(100, Math.max(0, task.progress ?? 0));
46
+ return ((0, jsx_runtime_1.jsxs)(RowFrame, { ...(0, slot_1.slot)('gantt-task'), "data-progress": progress, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { justify: "space-between", items: "center", children: [(0, ink_1.ink)(task.name, gui_1.SizableText, { size: '$3', fontWeight: '600' }), (0, ink_1.ink)(`${progress}%`, gui_1.SizableText, { size: '$3', color: '$quiet' })] }), (0, jsx_runtime_1.jsx)(TrackFrame, { ...(0, slot_1.slot)('gantt-track'), children: (0, jsx_runtime_1.jsx)(BarFrame, { ...(0, slot_1.slot)('gantt-bar'), width: `${progress}%` }) }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { justify: "space-between", children: [(0, ink_1.ink)(task.start.toLocaleDateString(), gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(task.end.toLocaleDateString(), gui_1.SizableText, { size: '$1', color: '$quiet' })] })] }, task.id));
47
+ }) })) }));
50
48
  }
@@ -1,4 +1,3 @@
1
- import type { ComponentProps } from 'react';
2
1
  export interface GanttTask {
3
2
  id: string;
4
3
  name: string;
@@ -7,13 +6,13 @@ export interface GanttTask {
7
6
  /** 0–100. Defaults to 0. */
8
7
  progress?: number;
9
8
  }
10
- declare const Frame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
9
+ declare const GanttFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
11
10
  elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
12
11
  fullscreen?: boolean | undefined;
13
12
  }, import("@hanzogui/web").StaticConfigPublic>;
14
- export type GanttProps = ComponentProps<typeof Frame> & {
13
+ export type GanttProps = Omit<import('react').ComponentProps<typeof GanttFrame>, 'children'> & {
15
14
  tasks?: GanttTask[];
16
15
  };
17
- declare function Gantt({ tasks, ...props }: GanttProps): import("react").JSX.Element;
18
- export { Gantt };
16
+ export declare function Gantt({ tasks, ...props }: GanttProps): import("react").JSX.Element;
17
+ export {};
19
18
  //# sourceMappingURL=gantt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gantt.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/gantt.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,IAAI,CAAA;IACX,GAAG,EAAE,IAAI,CAAA;IACT,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,QAAA,MAAM,KAAK;;;8CAQT,CAAA;AAmBF,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;CACpB,CAAA;AAED,iBAAS,KAAK,CAAC,EAAE,KAAU,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,+BAgClD;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
1
+ {"version":3,"file":"gantt.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/gantt.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,IAAI,CAAA;IACX,GAAG,EAAE,IAAI,CAAA;IACT,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,QAAA,MAAM,UAAU;;;8CAOd,CAAA;AAmBF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7F,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;CACpB,CAAA;AAED,wBAAgB,KAAK,CAAC,EAAE,KAAU,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,+BAkCzD"}