@tcn/ui 0.8.1 → 0.10.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 (285) hide show
  1. package/dist/bar.css +1 -0
  2. package/dist/body.css +1 -1
  3. package/dist/body.module-BbFZ7KNP.js +5 -0
  4. package/dist/body.module-BbFZ7KNP.js.map +1 -0
  5. package/dist/divider.css +1 -1
  6. package/dist/feedback/progress/progress_bar.js +13 -13
  7. package/dist/footer.css +1 -1
  8. package/dist/form/field/common/field_description.js +7 -8
  9. package/dist/form/field/common/field_description.js.map +1 -1
  10. package/dist/form/field/common/field_error.js +6 -6
  11. package/dist/form/field/common/field_label.js +7 -8
  12. package/dist/form/field/common/field_label.js.map +1 -1
  13. package/dist/form/field_set/field_set.js +7 -7
  14. package/dist/inputs/date_picker/date_picker_date.js +6 -6
  15. package/dist/inputs/date_picker/date_picker_day.js +6 -6
  16. package/dist/inputs/date_picker/date_picker_time_selector.js +5 -5
  17. package/dist/inputs/date_picker/date_picker_year_selector.js +5 -5
  18. package/dist/inputs/suggestions/suggestion_list.js +6 -6
  19. package/dist/layouts/bar/bar.d.ts +5 -0
  20. package/dist/layouts/bar/bar.d.ts.map +1 -0
  21. package/dist/layouts/bar/bar.js +20 -0
  22. package/dist/layouts/bar/bar.js.map +1 -0
  23. package/dist/layouts/body/body.d.ts +2 -2
  24. package/dist/layouts/body/body.d.ts.map +1 -1
  25. package/dist/layouts/body/body.js +12 -12
  26. package/dist/layouts/body/body.js.map +1 -1
  27. package/dist/layouts/body/h_body.d.ts.map +1 -1
  28. package/dist/layouts/body/h_body.js +18 -12
  29. package/dist/layouts/body/h_body.js.map +1 -1
  30. package/dist/layouts/body/v_body.d.ts.map +1 -1
  31. package/dist/layouts/body/v_body.js +16 -10
  32. package/dist/layouts/body/v_body.js.map +1 -1
  33. package/dist/layouts/footer/footer.d.ts +2 -3
  34. package/dist/layouts/footer/footer.d.ts.map +1 -1
  35. package/dist/layouts/footer/footer.js +7 -7
  36. package/dist/layouts/footer/footer.js.map +1 -1
  37. package/dist/layouts/header/header.d.ts +2 -2
  38. package/dist/layouts/header/header.d.ts.map +1 -1
  39. package/dist/layouts/header/header.js +13 -21
  40. package/dist/layouts/header/header.js.map +1 -1
  41. package/dist/layouts/index.d.ts +2 -1
  42. package/dist/layouts/index.d.ts.map +1 -1
  43. package/dist/layouts/index.js +40 -38
  44. package/dist/layouts/index.js.map +1 -1
  45. package/dist/layouts/rail/rail.js +41 -41
  46. package/dist/layouts/rail/rail.js.map +1 -1
  47. package/dist/layouts/rail/side/side.d.ts.map +1 -1
  48. package/dist/layouts/rail/side/side.js +1 -1
  49. package/dist/layouts/rail/side/side.js.map +1 -1
  50. package/dist/layouts/rail/utility_strip/utility_strip.d.ts.map +1 -1
  51. package/dist/layouts/rail/utility_strip/utility_strip.js +21 -17
  52. package/dist/layouts/rail/utility_strip/utility_strip.js.map +1 -1
  53. package/dist/layouts/responsive/breakpoint.d.ts +11 -0
  54. package/dist/layouts/responsive/breakpoint.d.ts.map +1 -0
  55. package/dist/layouts/responsive/breakpoint.js +15 -0
  56. package/dist/layouts/responsive/breakpoint.js.map +1 -0
  57. package/dist/layouts/responsive/responsive.d.ts +7 -0
  58. package/dist/layouts/responsive/responsive.d.ts.map +1 -0
  59. package/dist/layouts/responsive/responsive.js +11 -0
  60. package/dist/layouts/responsive/responsive.js.map +1 -0
  61. package/dist/layouts/responsive/responsive_container.d.ts +7 -0
  62. package/dist/layouts/responsive/responsive_container.d.ts.map +1 -0
  63. package/dist/layouts/responsive/responsive_container.js +30 -0
  64. package/dist/layouts/responsive/responsive_container.js.map +1 -0
  65. package/dist/layouts/responsive/responsive_viewport.d.ts +7 -0
  66. package/dist/layouts/responsive/responsive_viewport.d.ts.map +1 -0
  67. package/dist/layouts/responsive/responsive_viewport.js +12 -0
  68. package/dist/layouts/responsive/responsive_viewport.js.map +1 -0
  69. package/dist/layouts/scaffold/scaffold.js +32 -32
  70. package/dist/layouts/scaffold/scaffold.js.map +1 -1
  71. package/dist/layouts/utility_bar/utility_bar.d.ts +2 -2
  72. package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
  73. package/dist/layouts/utility_bar/utility_bar.js +17 -19
  74. package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
  75. package/dist/overlay/frame/frame.js +3 -3
  76. package/dist/overlay/frame/frame.js.map +1 -1
  77. package/dist/panel.css +1 -0
  78. package/dist/rail.css +1 -1
  79. package/dist/scaffold.css +1 -1
  80. package/dist/side.css +1 -1
  81. package/dist/stacks/box/bottom_resize_handle.d.ts +2 -2
  82. package/dist/stacks/box/bottom_resize_handle.d.ts.map +1 -1
  83. package/dist/stacks/box/bottom_resize_handle.js +12 -10
  84. package/dist/stacks/box/bottom_resize_handle.js.map +1 -1
  85. package/dist/stacks/box/box.d.ts +4 -4
  86. package/dist/stacks/box/box.d.ts.map +1 -1
  87. package/dist/stacks/box/box.js +26 -26
  88. package/dist/stacks/box/box.js.map +1 -1
  89. package/dist/stacks/box/end_resize_handle.d.ts +2 -2
  90. package/dist/stacks/box/end_resize_handle.d.ts.map +1 -1
  91. package/dist/stacks/box/end_resize_handle.js +6 -5
  92. package/dist/stacks/box/end_resize_handle.js.map +1 -1
  93. package/dist/stacks/box/left_resize_handle.d.ts +2 -2
  94. package/dist/stacks/box/left_resize_handle.d.ts.map +1 -1
  95. package/dist/stacks/box/left_resize_handle.js +10 -9
  96. package/dist/stacks/box/left_resize_handle.js.map +1 -1
  97. package/dist/stacks/box/resize_handlers.d.ts +2 -2
  98. package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
  99. package/dist/stacks/box/resize_handlers.js +24 -24
  100. package/dist/stacks/box/resize_handlers.js.map +1 -1
  101. package/dist/stacks/box/right_resize_handle.d.ts +2 -2
  102. package/dist/stacks/box/right_resize_handle.d.ts.map +1 -1
  103. package/dist/stacks/box/right_resize_handle.js +6 -5
  104. package/dist/stacks/box/right_resize_handle.js.map +1 -1
  105. package/dist/stacks/box/start_resize_handle.d.ts +2 -2
  106. package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
  107. package/dist/stacks/box/start_resize_handle.js +4 -4
  108. package/dist/stacks/box/start_resize_handle.js.map +1 -1
  109. package/dist/stacks/box/top_resize_handle.d.ts +2 -2
  110. package/dist/stacks/box/top_resize_handle.d.ts.map +1 -1
  111. package/dist/stacks/box/top_resize_handle.js +2 -1
  112. package/dist/stacks/box/top_resize_handle.js.map +1 -1
  113. package/dist/stacks/h_collapsible_box.d.ts.map +1 -1
  114. package/dist/stacks/h_collapsible_box.js +24 -24
  115. package/dist/stacks/h_collapsible_box.js.map +1 -1
  116. package/dist/stacks/v_collapsible_box.js +25 -25
  117. package/dist/stacks/v_collapsible_box.js.map +1 -1
  118. package/dist/surfaces/confirm/confirm.js +5 -5
  119. package/dist/surfaces/index.d.ts +1 -2
  120. package/dist/surfaces/index.d.ts.map +1 -1
  121. package/dist/surfaces/index.js +18 -20
  122. package/dist/surfaces/index.js.map +1 -1
  123. package/dist/surfaces/panel/panel.d.ts +5 -0
  124. package/dist/surfaces/panel/panel.d.ts.map +1 -0
  125. package/dist/surfaces/panel/panel.js +19 -0
  126. package/dist/surfaces/panel/panel.js.map +1 -0
  127. package/dist/surfaces/pop_confirm/pop_confirm.js +1 -1
  128. package/dist/themes/theme.d.ts +2 -1
  129. package/dist/themes/theme.d.ts.map +1 -1
  130. package/dist/themes/theme.js +16 -9
  131. package/dist/themes/theme.js.map +1 -1
  132. package/dist/themes/themes/ergo/ergo_theme.css +1 -1
  133. package/dist/themes/themes/ergo/ergo_theme.js +27 -0
  134. package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
  135. package/dist/typography/body_text/body_text.d.ts +2 -1
  136. package/dist/typography/body_text/body_text.d.ts.map +1 -1
  137. package/dist/typography/body_text/body_text.js +24 -23
  138. package/dist/typography/body_text/body_text.js.map +1 -1
  139. package/dist/typography/callout/callout.d.ts +2 -1
  140. package/dist/typography/callout/callout.d.ts.map +1 -1
  141. package/dist/typography/callout/callout.js +28 -27
  142. package/dist/typography/callout/callout.js.map +1 -1
  143. package/dist/typography/caption/caption.d.ts +2 -1
  144. package/dist/typography/caption/caption.d.ts.map +1 -1
  145. package/dist/typography/caption/caption.js +18 -17
  146. package/dist/typography/caption/caption.js.map +1 -1
  147. package/dist/typography/footnote/footnote.d.ts +2 -1
  148. package/dist/typography/footnote/footnote.d.ts.map +1 -1
  149. package/dist/typography/footnote/footnote.js +25 -24
  150. package/dist/typography/footnote/footnote.js.map +1 -1
  151. package/dist/typography/headline/headline.d.ts +2 -1
  152. package/dist/typography/headline/headline.d.ts.map +1 -1
  153. package/dist/typography/headline/headline.js +36 -33
  154. package/dist/typography/headline/headline.js.map +1 -1
  155. package/dist/typography/subheadline/subheadline.d.ts +2 -1
  156. package/dist/typography/subheadline/subheadline.d.ts.map +1 -1
  157. package/dist/typography/subheadline/subheadline.js +35 -32
  158. package/dist/typography/subheadline/subheadline.js.map +1 -1
  159. package/dist/utils/dnd/context.d.ts.map +1 -1
  160. package/dist/utils/dnd/context.js +9 -7
  161. package/dist/utils/dnd/context.js.map +1 -1
  162. package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -1
  163. package/dist/utils/dnd/hooks/use_drag_container.js +29 -15
  164. package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -1
  165. package/dist/utils/dnd/types.d.ts +3 -4
  166. package/dist/utils/dnd/types.d.ts.map +1 -1
  167. package/dist/utils/hooks/use_media_query.d.ts +5 -8
  168. package/dist/utils/hooks/use_media_query.d.ts.map +1 -1
  169. package/dist/utils/hooks/use_media_query.js +10 -11
  170. package/dist/utils/hooks/use_media_query.js.map +1 -1
  171. package/dist/utils/index.d.ts +1 -2
  172. package/dist/utils/index.d.ts.map +1 -1
  173. package/dist/utils/index.js +19 -21
  174. package/dist/utils/index.js.map +1 -1
  175. package/package.json +1 -1
  176. package/src/layouts/__stories__/composed.stories.tsx +0 -55
  177. package/src/layouts/__stories__/rail.stories.tsx +78 -0
  178. package/src/layouts/__stories__/scaffold.stories.tsx +90 -0
  179. package/src/layouts/__stories__/utils/content.tsx +27 -0
  180. package/src/layouts/__stories__/utils/layout_theme.css +88 -0
  181. package/src/layouts/__stories__/utils/layout_theme_provider.tsx +11 -0
  182. package/src/layouts/__stories__/utils.tsx +6 -6
  183. package/src/layouts/{utility_bar/utility_bar.module.css → bar/bar.module.css} +2 -1
  184. package/src/layouts/bar/bar.tsx +23 -0
  185. package/src/layouts/body/body.module.css +9 -4
  186. package/src/layouts/body/body.tsx +7 -6
  187. package/src/layouts/body/h_body.module.css +1 -2
  188. package/src/layouts/body/h_body.tsx +9 -4
  189. package/src/layouts/body/v_body.tsx +9 -4
  190. package/src/layouts/divider/divider.module.css +1 -1
  191. package/src/layouts/footer/footer.module.css +0 -3
  192. package/src/layouts/footer/footer.tsx +5 -6
  193. package/src/layouts/header/header.tsx +6 -15
  194. package/src/layouts/index.ts +2 -1
  195. package/src/layouts/rail/rail.module.css +9 -5
  196. package/src/layouts/rail/rail.tsx +1 -1
  197. package/src/layouts/rail/side/side.module.css +0 -1
  198. package/src/layouts/rail/side/side.tsx +1 -2
  199. package/src/layouts/rail/utility_strip/utility_strip.module.css +5 -0
  200. package/src/layouts/rail/utility_strip/utility_strip.tsx +4 -1
  201. package/src/layouts/responsive/breakpoint.tsx +29 -0
  202. package/src/layouts/responsive/responsive.stories.tsx +37 -0
  203. package/src/layouts/responsive/responsive.tsx +18 -0
  204. package/src/layouts/responsive/responsive_container.tsx +51 -0
  205. package/src/layouts/responsive/responsive_viewport.tsx +17 -0
  206. package/src/layouts/scaffold/scaffold.module.css +10 -7
  207. package/src/layouts/scaffold/scaffold.tsx +1 -1
  208. package/src/layouts/utility_bar/utility_bar.tsx +6 -9
  209. package/src/overlay/frame/frame.tsx +2 -2
  210. package/src/stacks/box/bottom_resize_handle.tsx +7 -5
  211. package/src/stacks/box/box.tsx +12 -18
  212. package/src/stacks/box/end_resize_handle.tsx +6 -6
  213. package/src/stacks/box/left_resize_handle.tsx +4 -3
  214. package/src/stacks/box/resize_handlers.ts +11 -9
  215. package/src/stacks/box/right_resize_handle.tsx +4 -3
  216. package/src/stacks/box/start_resize_handle.tsx +3 -3
  217. package/src/stacks/box/top_resize_handle.tsx +4 -3
  218. package/src/stacks/collapsible_box.stories.tsx +11 -11
  219. package/src/stacks/h_collapsible_box.tsx +5 -5
  220. package/src/stacks/v_collapsible_box.tsx +4 -4
  221. package/src/surfaces/index.ts +1 -2
  222. package/src/surfaces/panel/__stories__/panel.stories.tsx +12 -12
  223. package/src/surfaces/panel/__stories__/panel_stories.module.css +3 -3
  224. package/src/surfaces/panel/panel.module.css +1 -6
  225. package/src/surfaces/panel/panel.tsx +22 -0
  226. package/src/themes/theme.tsx +6 -2
  227. package/src/themes/themes/ergo/__stories__/material.stories.tsx +15 -16
  228. package/src/themes/themes/ergo/ergo_theme.css +27 -0
  229. package/src/typography/body_text/body_text.tsx +21 -17
  230. package/src/typography/callout/callout.tsx +20 -16
  231. package/src/typography/caption/caption.tsx +20 -16
  232. package/src/typography/footnote/footnote.tsx +20 -16
  233. package/src/typography/headline/headline.tsx +60 -54
  234. package/src/typography/subheadline/subheadline.tsx +60 -54
  235. package/src/utils/dnd/__stories__/draggable.stories.tsx +34 -0
  236. package/src/utils/dnd/context.ts +1 -0
  237. package/src/utils/dnd/hooks/use_drag_container.ts +18 -1
  238. package/src/utils/dnd/types.ts +4 -1
  239. package/src/utils/hooks/use_media_query.ts +16 -27
  240. package/src/utils/index.ts +1 -3
  241. package/dist/body_text.module-h4XQE2pC.js +0 -5
  242. package/dist/body_text.module-h4XQE2pC.js.map +0 -1
  243. package/dist/callout.module-D8ECmxpO.js +0 -5
  244. package/dist/callout.module-D8ECmxpO.js.map +0 -1
  245. package/dist/caption.module-DDq0H4xZ.js +0 -5
  246. package/dist/caption.module-DDq0H4xZ.js.map +0 -1
  247. package/dist/footnote.module-DEyFuqOr.js +0 -5
  248. package/dist/footnote.module-DEyFuqOr.js.map +0 -1
  249. package/dist/h_body.css +0 -1
  250. package/dist/h_panel.css +0 -1
  251. package/dist/header.css +0 -1
  252. package/dist/headline.module-BiwHBtGf.js +0 -5
  253. package/dist/headline.module-BiwHBtGf.js.map +0 -1
  254. package/dist/layouts/rail/main/main.d.ts +0 -6
  255. package/dist/layouts/rail/main/main.d.ts.map +0 -1
  256. package/dist/layouts/rail/main/main.js +0 -21
  257. package/dist/layouts/rail/main/main.js.map +0 -1
  258. package/dist/main.css +0 -1
  259. package/dist/subheadline.module-C-v7zMkQ.js +0 -5
  260. package/dist/subheadline.module-C-v7zMkQ.js.map +0 -1
  261. package/dist/surfaces/panel/h_panel.d.ts +0 -9
  262. package/dist/surfaces/panel/h_panel.d.ts.map +0 -1
  263. package/dist/surfaces/panel/h_panel.js +0 -60
  264. package/dist/surfaces/panel/h_panel.js.map +0 -1
  265. package/dist/surfaces/panel/v_panel.d.ts +0 -5
  266. package/dist/surfaces/panel/v_panel.d.ts.map +0 -1
  267. package/dist/surfaces/panel/v_panel.js +0 -19
  268. package/dist/surfaces/panel/v_panel.js.map +0 -1
  269. package/dist/utility_bar.css +0 -1
  270. package/dist/utils/responsive/responsive_renderer.d.ts +0 -21
  271. package/dist/utils/responsive/responsive_renderer.d.ts.map +0 -1
  272. package/dist/utils/responsive/responsive_renderer.js +0 -12
  273. package/dist/utils/responsive/responsive_renderer.js.map +0 -1
  274. package/dist/v_body.css +0 -1
  275. package/src/layouts/header/header.module.css +0 -8
  276. package/src/layouts/rail/__stories__/rail.stories.tsx +0 -64
  277. package/src/layouts/rail/__stories__/rail_stories.module.css +0 -25
  278. package/src/layouts/rail/main/main.module.css +0 -7
  279. package/src/layouts/rail/main/main.tsx +0 -26
  280. package/src/layouts/scaffold/__stories__/scaffold.stories.tsx +0 -53
  281. package/src/layouts/scaffold/__stories__/scaffold_stories.module.css +0 -31
  282. package/src/surfaces/panel/h_panel.tsx +0 -65
  283. package/src/surfaces/panel/v_panel.tsx +0 -20
  284. package/src/utils/responsive/responsive_renderer.stories.tsx +0 -77
  285. package/src/utils/responsive/responsive_renderer.tsx +0 -31
@@ -1,28 +1,42 @@
1
- import { useState as n, useRef as b, useCallback as o } from "react";
1
+ import { useState as s, useRef as b, useCallback as o } from "react";
2
2
  import { useDraggable as k } from "./use_draggable.js";
3
- function m(l) {
4
- const [c, a] = n([]), r = b(l.initialPosition ?? { x: 0, y: 0 }), [s, g] = n(r.current), [u, i] = n(!1);
3
+ function m(g) {
4
+ const [u, a] = s([]), n = b(g.initialPosition ?? { x: 0, y: 0 }), [i, c] = s(n.current), [f, l] = s(!1);
5
5
  k({
6
- handles: c,
6
+ handles: u,
7
7
  startDragCallback: () => {
8
- i(!0);
8
+ l(!0);
9
9
  },
10
- dragCallback: (e, t) => {
11
- g({
12
- x: r.current.x + e,
13
- y: r.current.y + t
10
+ dragCallback: (t, e) => {
11
+ c({
12
+ x: n.current.x + t,
13
+ y: n.current.y + e
14
14
  });
15
15
  },
16
16
  endDragCallback: () => {
17
- i(!1), r.current = s;
17
+ l(!1), n.current = i;
18
18
  }
19
19
  });
20
- const f = o((e) => {
21
- a((t) => [...t, e]);
22
- }, []), d = o((e) => {
23
- a((t) => t.filter((D) => D !== e));
20
+ const d = o(
21
+ (t) => {
22
+ c((e) => {
23
+ const r = typeof t == "function" ? t(e) : t;
24
+ return n.current = r, r;
25
+ });
26
+ },
27
+ []
28
+ ), p = o((t) => {
29
+ a((e) => [...e, t]);
30
+ }, []), D = o((t) => {
31
+ a((e) => e.filter((r) => r !== t));
24
32
  }, []);
25
- return { registerHandle: f, unregisterHandle: d, position: s, isDragging: u };
33
+ return {
34
+ registerHandle: p,
35
+ unregisterHandle: D,
36
+ position: i,
37
+ isDragging: f,
38
+ setPosition: d
39
+ };
26
40
  }
27
41
  export {
28
42
  m as useMakeDragContainer
@@ -1 +1 @@
1
- {"version":3,"file":"use_drag_container.js","sources":["../../../../src/utils/dnd/hooks/use_drag_container.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from './use_draggable.js';\nimport type { Position } from '../../index.js';\nimport type { DragContainer } from '../types.js';\n\nexport interface UseDragContainerOptions {\n initialPosition?: Position;\n}\n\nexport function useMakeDragContainer(options: UseDragContainerOptions): DragContainer {\n const [handles, setHandles] = useState<React.RefObject<HTMLElement>[]>([]);\n const positionRef = useRef<Position>(options.initialPosition ?? { x: 0, y: 0 });\n const [position, setPosition] = useState(positionRef.current);\n const [isDragging, setIsDragging] = useState(false);\n\n useDraggable({\n handles: handles,\n startDragCallback: () => {\n setIsDragging(true);\n },\n dragCallback: (deltaX, deltaY) => {\n setPosition({\n x: positionRef.current.x + deltaX,\n y: positionRef.current.y + deltaY,\n });\n },\n endDragCallback: () => {\n setIsDragging(false);\n positionRef.current = position;\n },\n });\n\n const registerHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => [...prev, handle]);\n }, []);\n\n const unregisterHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => prev.filter(h => h !== handle));\n }, []);\n\n return { registerHandle, unregisterHandle, position, isDragging };\n}\n"],"names":["useMakeDragContainer","options","handles","setHandles","useState","positionRef","useRef","position","setPosition","isDragging","setIsDragging","useDraggable","deltaX","deltaY","registerHandle","useCallback","handle","prev","unregisterHandle","h"],"mappings":";;AASO,SAASA,EAAqBC,GAAiD;AACpF,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAyC,CAAA,CAAE,GACnEC,IAAcC,EAAiBL,EAAQ,mBAAmB,EAAE,GAAG,GAAG,GAAG,GAAG,GACxE,CAACM,GAAUC,CAAW,IAAIJ,EAASC,EAAY,OAAO,GACtD,CAACI,GAAYC,CAAa,IAAIN,EAAS,EAAK;AAElD,EAAAO,EAAa;AAAA,IACX,SAAAT;AAAA,IACA,mBAAmB,MAAM;AACvB,MAAAQ,EAAc,EAAI;AAAA,IACpB;AAAA,IACA,cAAc,CAACE,GAAQC,MAAW;AAChC,MAAAL,EAAY;AAAA,QACV,GAAGH,EAAY,QAAQ,IAAIO;AAAA,QAC3B,GAAGP,EAAY,QAAQ,IAAIQ;AAAA,MAAA,CAC5B;AAAA,IACH;AAAA,IACA,iBAAiB,MAAM;AACrB,MAAAH,EAAc,EAAK,GACnBL,EAAY,UAAUE;AAAA,IACxB;AAAA,EAAA,CACD;AAED,QAAMO,IAAiBC,EAAY,CAACC,MAAyC;AAC3E,IAAAb,EAAW,CAAAc,MAAQ,CAAC,GAAGA,GAAMD,CAAM,CAAC;AAAA,EACtC,GAAG,CAAA,CAAE,GAECE,IAAmBH,EAAY,CAACC,MAAyC;AAC7E,IAAAb,EAAW,OAAQc,EAAK,OAAO,CAAAE,MAAKA,MAAMH,CAAM,CAAC;AAAA,EACnD,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,gBAAAF,GAAgB,kBAAAI,GAAkB,UAAAX,GAAU,YAAAE,EAAA;AACvD;"}
1
+ {"version":3,"file":"use_drag_container.js","sources":["../../../../src/utils/dnd/hooks/use_drag_container.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from './use_draggable.js';\nimport type { Position } from '../../index.js';\nimport type { DragContainer } from '../types.js';\n\nexport interface UseDragContainerOptions {\n initialPosition?: Position;\n}\n\nexport function useMakeDragContainer(options: UseDragContainerOptions): DragContainer {\n const [handles, setHandles] = useState<React.RefObject<HTMLElement>[]>([]);\n const positionRef = useRef<Position>(options.initialPosition ?? { x: 0, y: 0 });\n const [position, setPosition] = useState(positionRef.current);\n const [isDragging, setIsDragging] = useState(false);\n\n useDraggable({\n handles: handles,\n startDragCallback: () => {\n setIsDragging(true);\n },\n dragCallback: (deltaX, deltaY) => {\n setPosition({\n x: positionRef.current.x + deltaX,\n y: positionRef.current.y + deltaY,\n });\n },\n endDragCallback: () => {\n setIsDragging(false);\n positionRef.current = position;\n },\n });\n\n const setPositionState = useCallback(\n (value: Position | ((prev: Position) => Position)) => {\n setPosition(prev => {\n const next = typeof value === 'function' ? value(prev) : value;\n positionRef.current = next;\n return next;\n });\n },\n []\n );\n\n const registerHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => [...prev, handle]);\n }, []);\n\n const unregisterHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => prev.filter(h => h !== handle));\n }, []);\n\n return {\n registerHandle,\n unregisterHandle,\n position,\n isDragging,\n setPosition: setPositionState,\n };\n}\n"],"names":["useMakeDragContainer","options","handles","setHandles","useState","positionRef","useRef","position","setPosition","isDragging","setIsDragging","useDraggable","deltaX","deltaY","setPositionState","useCallback","value","prev","next","registerHandle","handle","unregisterHandle","h"],"mappings":";;AASO,SAASA,EAAqBC,GAAiD;AACpF,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAyC,CAAA,CAAE,GACnEC,IAAcC,EAAiBL,EAAQ,mBAAmB,EAAE,GAAG,GAAG,GAAG,GAAG,GACxE,CAACM,GAAUC,CAAW,IAAIJ,EAASC,EAAY,OAAO,GACtD,CAACI,GAAYC,CAAa,IAAIN,EAAS,EAAK;AAElD,EAAAO,EAAa;AAAA,IACX,SAAAT;AAAA,IACA,mBAAmB,MAAM;AACvB,MAAAQ,EAAc,EAAI;AAAA,IACpB;AAAA,IACA,cAAc,CAACE,GAAQC,MAAW;AAChC,MAAAL,EAAY;AAAA,QACV,GAAGH,EAAY,QAAQ,IAAIO;AAAA,QAC3B,GAAGP,EAAY,QAAQ,IAAIQ;AAAA,MAAA,CAC5B;AAAA,IACH;AAAA,IACA,iBAAiB,MAAM;AACrB,MAAAH,EAAc,EAAK,GACnBL,EAAY,UAAUE;AAAA,IACxB;AAAA,EAAA,CACD;AAED,QAAMO,IAAmBC;AAAA,IACvB,CAACC,MAAqD;AACpD,MAAAR,EAAY,CAAAS,MAAQ;AAClB,cAAMC,IAAO,OAAOF,KAAU,aAAaA,EAAMC,CAAI,IAAID;AACzD,eAAAX,EAAY,UAAUa,GACfA;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAA;AAAA,EAAC,GAGGC,IAAiBJ,EAAY,CAACK,MAAyC;AAC3E,IAAAjB,EAAW,CAAAc,MAAQ,CAAC,GAAGA,GAAMG,CAAM,CAAC;AAAA,EACtC,GAAG,CAAA,CAAE,GAECC,IAAmBN,EAAY,CAACK,MAAyC;AAC7E,IAAAjB,EAAW,OAAQc,EAAK,OAAO,CAAAK,MAAKA,MAAMF,CAAM,CAAC;AAAA,EACnD,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,gBAAAD;AAAA,IACA,kBAAAE;AAAA,IACA,UAAAd;AAAA,IACA,YAAAE;AAAA,IACA,aAAaK;AAAA,EAAA;AAEjB;"}
@@ -1,10 +1,9 @@
1
+ import { Position } from '../types/dimensions.js';
1
2
  export interface DragContainer {
2
3
  registerHandle: (handle: React.RefObject<HTMLElement>) => void;
3
4
  unregisterHandle: (handle: React.RefObject<HTMLElement>) => void;
4
5
  isDragging: boolean;
5
- position: {
6
- x: number;
7
- y: number;
8
- };
6
+ position: Position;
7
+ setPosition: (value: Position | ((prev: Position) => Position)) => void;
9
8
  }
10
9
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/dnd/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/D,gBAAgB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/dnd/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/D,gBAAgB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzE"}
@@ -1,9 +1,6 @@
1
- /**
2
- * Custom hook that returns a boolean indicating if the current viewport
3
- * matches the given media query.
4
- *
5
- * @param query - The media query to match against (e.g. "(min-width: 768px)")
6
- * @returns boolean indicating if the media query matches
7
- */
8
- export declare function useMediaQuery(query: string): boolean;
1
+ export interface ViewportSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ export declare function useMediaQuery(): ViewportSize;
9
6
  //# sourceMappingURL=use_media_query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_media_query.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/use_media_query.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAsBpD"}
1
+ {"version":3,"file":"use_media_query.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/use_media_query.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,aAAa,IAAI,YAAY,CAY5C"}
@@ -1,14 +1,13 @@
1
- import s from "react";
2
- function d(t) {
3
- const [c, a] = s.useState(!1);
4
- return s.useEffect(() => {
5
- const e = window.matchMedia(t);
6
- a(e.matches);
7
- const n = (r) => {
8
- a(r.matches);
9
- };
10
- return e.addEventListener("change", n), () => e.removeEventListener("change", n);
11
- }, [t]), c;
1
+ import { useState as i, useLayoutEffect as u } from "react";
2
+ import { useResizeObserver as n } from "./use_resize_observer.js";
3
+ function d() {
4
+ const [o, s] = i({ width: 0, height: 0 }), t = n((e, r) => {
5
+ s({ width: e, height: r });
6
+ });
7
+ return u(() => {
8
+ const e = document.body;
9
+ t(e);
10
+ }, [t]), o;
12
11
  }
13
12
  export {
14
13
  d as useMediaQuery
@@ -1 +1 @@
1
- {"version":3,"file":"use_media_query.js","sources":["../../../src/utils/hooks/use_media_query.ts"],"sourcesContent":["import React from 'react';\n\n/**\n * Custom hook that returns a boolean indicating if the current viewport\n * matches the given media query.\n *\n * @param query - The media query to match against (e.g. \"(min-width: 768px)\")\n * @returns boolean indicating if the media query matches\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = React.useState(false);\n\n React.useEffect(() => {\n const mediaQuery = window.matchMedia(query);\n\n // Set initial value\n setMatches(mediaQuery.matches);\n\n // Create event listener\n const handler = (event: MediaQueryListEvent) => {\n setMatches(event.matches);\n };\n\n // Add the listener\n mediaQuery.addEventListener('change', handler);\n\n // Clean up\n return () => mediaQuery.removeEventListener('change', handler);\n }, [query]);\n\n return matches;\n}\n"],"names":["useMediaQuery","query","matches","setMatches","React","mediaQuery","handler","event"],"mappings":";AASO,SAASA,EAAcC,GAAwB;AACpD,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAM,SAAS,EAAK;AAElDA,SAAAA,EAAM,UAAU,MAAM;AACpB,UAAMC,IAAa,OAAO,WAAWJ,CAAK;AAG1C,IAAAE,EAAWE,EAAW,OAAO;AAG7B,UAAMC,IAAU,CAACC,MAA+B;AAC9C,MAAAJ,EAAWI,EAAM,OAAO;AAAA,IAC1B;AAGA,WAAAF,EAAW,iBAAiB,UAAUC,CAAO,GAGtC,MAAMD,EAAW,oBAAoB,UAAUC,CAAO;AAAA,EAC/D,GAAG,CAACL,CAAK,CAAC,GAEHC;AACT;"}
1
+ {"version":3,"file":"use_media_query.js","sources":["../../../src/utils/hooks/use_media_query.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\nimport { useResizeObserver } from './use_resize_observer.js';\n\nexport interface ViewportSize {\n width: number;\n height: number;\n}\n\nexport function useMediaQuery(): ViewportSize {\n const [size, setSize] = useState<ViewportSize>({ width: 0, height: 0 });\n const resizeRef = useResizeObserver((width, height) => {\n setSize({ width, height });\n });\n\n useLayoutEffect(() => {\n const body = document.body;\n resizeRef(body);\n }, [resizeRef]);\n\n return size;\n}\n"],"names":["useMediaQuery","size","setSize","useState","resizeRef","useResizeObserver","width","height","useLayoutEffect","body"],"mappings":";;AAQO,SAASA,IAA8B;AAC5C,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAuB,EAAE,OAAO,GAAG,QAAQ,GAAG,GAChEC,IAAYC,EAAkB,CAACC,GAAOC,MAAW;AACrD,IAAAL,EAAQ,EAAE,OAAAI,GAAO,QAAAC,GAAQ;AAAA,EAC3B,CAAC;AAED,SAAAC,EAAgB,MAAM;AACpB,UAAMC,IAAO,SAAS;AACtB,IAAAL,EAAUK,CAAI;AAAA,EAChB,GAAG,CAACL,CAAS,CAAC,GAEPH;AACT;"}
@@ -4,8 +4,8 @@ export * from './scroll_away_listener.js';
4
4
  export * from './dnd/hooks/use_draggable.js';
5
5
  export * from './hooks/make_context_hook.js';
6
6
  export * from './hooks/use_fork_ref.js';
7
- export * from './hooks/use_media_query.js';
8
7
  export * from './hooks/use_resize_observer.js';
8
+ export * from './hooks/use_media_query.js';
9
9
  export * from './default_value.js';
10
10
  export * from './calendar/calendar_date.js';
11
11
  export * from './calendar/calendar_dates_generator.js';
@@ -14,7 +14,6 @@ export * from './calendar/get_months_of_year.js';
14
14
  export * from './calendar/month.js';
15
15
  export * from './types/dimensions.js';
16
16
  export * from './types/variations.js';
17
- export * from './responsive/responsive_renderer.js';
18
17
  export * from './dnd/draggable/draggable.js';
19
18
  export * from './dnd/handle.js';
20
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,qCAAqC,CAAC;AAEpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC"}
@@ -1,37 +1,35 @@
1
1
  import { ClickAwayListener as o, isEventWithinElement as t } from "./click_away_listener.js";
2
2
  import { FocusRedirect as a } from "./focus_redirect.js";
3
- import { ScrollAwayListener as p } from "./scroll_away_listener.js";
3
+ import { ScrollAwayListener as x } from "./scroll_away_listener.js";
4
4
  import { useDraggable as s } from "./dnd/hooks/use_draggable.js";
5
5
  import { makeContextHook as i } from "./hooks/make_context_hook.js";
6
6
  import { useForkRef as l } from "./hooks/use_fork_ref.js";
7
- import { useMediaQuery as d } from "./hooks/use_media_query.js";
8
- import { TriggerConfig as D, useResizeObserver as R } from "./hooks/use_resize_observer.js";
9
- import { defaultValue as y } from "./default_value.js";
10
- import { CalendarDatesGenerator as b } from "./calendar/calendar_dates_generator.js";
11
- import { getDaysOfWeek as v } from "./calendar/get_days_of_week.js";
12
- import { getMonthsOfYear as O } from "./calendar/get_months_of_year.js";
7
+ import { TriggerConfig as d, useResizeObserver as k } from "./hooks/use_resize_observer.js";
8
+ import { useMediaQuery as c } from "./hooks/use_media_query.js";
9
+ import { defaultValue as C } from "./default_value.js";
10
+ import { CalendarDatesGenerator as h } from "./calendar/calendar_dates_generator.js";
11
+ import { getDaysOfWeek as O } from "./calendar/get_days_of_week.js";
12
+ import { getMonthsOfYear as v } from "./calendar/get_months_of_year.js";
13
13
  import { Month as A } from "./calendar/month.js";
14
- import { ResponsiveRenderer as F } from "./responsive/responsive_renderer.js";
15
- import { Draggable as L } from "./dnd/draggable/draggable.js";
16
- import { DragHandle as z } from "./dnd/handle.js";
14
+ import { Draggable as F } from "./dnd/draggable/draggable.js";
15
+ import { DragHandle as L } from "./dnd/handle.js";
17
16
  export {
18
- b as CalendarDatesGenerator,
17
+ h as CalendarDatesGenerator,
19
18
  o as ClickAwayListener,
20
- z as DragHandle,
21
- L as Draggable,
19
+ L as DragHandle,
20
+ F as Draggable,
22
21
  a as FocusRedirect,
23
22
  A as Month,
24
- F as ResponsiveRenderer,
25
- p as ScrollAwayListener,
26
- D as TriggerConfig,
27
- y as defaultValue,
28
- v as getDaysOfWeek,
29
- O as getMonthsOfYear,
23
+ x as ScrollAwayListener,
24
+ d as TriggerConfig,
25
+ C as defaultValue,
26
+ O as getDaysOfWeek,
27
+ v as getMonthsOfYear,
30
28
  t as isEventWithinElement,
31
29
  i as makeContextHook,
32
30
  s as useDraggable,
33
31
  l as useForkRef,
34
- d as useMediaQuery,
35
- R as useResizeObserver
32
+ c as useMediaQuery,
33
+ k as useResizeObserver
36
34
  };
37
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tcn/ui",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "author": "TCN",
@@ -3,8 +3,6 @@ import { VStack } from '../../stacks/v_stack.js';
3
3
  import { SBNestedScaffold, SBContent, SBNestedRail } from './utils.js';
4
4
 
5
5
  import styles from './composed_stories.module.css';
6
- import clsx from 'clsx';
7
- import { Body } from '../body/body.js';
8
6
 
9
7
  const meta: Meta = {
10
8
  title: 'Layouts/Composed',
@@ -45,59 +43,6 @@ export const Baseline: Story = {
45
43
  ),
46
44
  };
47
45
 
48
- export const ScaffoldWithBody: Story = {
49
- render: () => (
50
- <SBContainer>
51
- <SBNestedScaffold depth={1}>
52
- <SBContent />
53
- <SBContent />
54
- <SBContent />
55
- </SBNestedScaffold>
56
- </SBContainer>
57
- ),
58
- };
59
-
60
- export const ScaffoldWithMain: Story = {
61
- render: () => (
62
- <SBContainer>
63
- <SBNestedScaffold depth={1}>
64
- <SBNestedRail depth={2} side={false} utilityStrip={false} scaffold={false}>
65
- <SBContent />
66
- <SBContent />
67
- <SBContent />
68
- </SBNestedRail>
69
- </SBNestedScaffold>
70
- </SBContainer>
71
- ),
72
- };
73
-
74
- export const RailWithMain: Story = {
75
- render: () => (
76
- <SBContainer>
77
- <SBNestedRail depth={1} scaffold={false}>
78
- <SBContent />
79
- <SBContent />
80
- <SBContent />
81
- </SBNestedRail>
82
- </SBContainer>
83
- ),
84
- };
85
-
86
- export const RailWithBody: Story = {
87
- render: () => (
88
- <SBContainer>
89
- <SBNestedRail depth={1} scaffold={false}>
90
- <Body className={clsx(styles.body, styles.secondary)}>
91
- Body
92
- <SBContent />
93
- <SBContent />
94
- <SBContent />
95
- </Body>
96
- </SBNestedRail>
97
- </SBContainer>
98
- ),
99
- };
100
-
101
46
  export const WithColumns: Story = {
102
47
  render: () => (
103
48
  <SBContainer>
@@ -0,0 +1,78 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { LayoutStoryDecorator } from './utils/layout_theme_provider.js';
4
+ import { SBLayoutContent } from './utils/content.js';
5
+ import { Rail } from '../rail/rail.js';
6
+ import { Side } from '../rail/side/side.js';
7
+ import { UtilityStrip } from '../rail/utility_strip/utility_strip.js';
8
+ import { Title } from '../../typography/index.js';
9
+ import { HBody } from '../body/h_body.js';
10
+ import { VBody } from '../body/v_body.js';
11
+ import { Body } from '../body/body.js';
12
+
13
+ const meta: Meta<typeof Rail> = {
14
+ title: 'Layouts/Rail',
15
+ component: Rail,
16
+ tags: ['autodocs'],
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component: 'A component that lays out content in a horizontal hierarchy.',
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof Rail>;
29
+
30
+ export const Baseline: Story = {
31
+ render: () => (
32
+ <LayoutStoryDecorator>
33
+ <Rail>
34
+ <UtilityStrip>
35
+ <Title>Utility Strip</Title>
36
+ </UtilityStrip>
37
+ <Body>Body fills available space </Body>
38
+ <Side width="200px">Side</Side>
39
+ </Rail>
40
+ </LayoutStoryDecorator>
41
+ ),
42
+ };
43
+
44
+ export const HorizontalContent: Story = {
45
+ render: () => (
46
+ <LayoutStoryDecorator>
47
+ <Rail>
48
+ <UtilityStrip>
49
+ <Title>Utility Strip</Title>
50
+ </UtilityStrip>
51
+ <HBody>
52
+ <SBLayoutContent />
53
+ <SBLayoutContent />
54
+ <SBLayoutContent />
55
+ </HBody>
56
+ <Side width="200px">Side</Side>
57
+ </Rail>
58
+ </LayoutStoryDecorator>
59
+ ),
60
+ };
61
+
62
+ export const VerticalContent: Story = {
63
+ render: () => (
64
+ <LayoutStoryDecorator>
65
+ <Rail>
66
+ <UtilityStrip>
67
+ <Title>Utility Strip</Title>
68
+ </UtilityStrip>
69
+ <VBody>
70
+ <SBLayoutContent />
71
+ <SBLayoutContent />
72
+ <SBLayoutContent />
73
+ </VBody>
74
+ <Side width="200px">Side</Side>
75
+ </Rail>
76
+ </LayoutStoryDecorator>
77
+ ),
78
+ };
@@ -0,0 +1,90 @@
1
+ import { Scaffold } from '../scaffold/scaffold.js';
2
+ import { Header } from '../header/header.js';
3
+ import { UtilityBar } from '../utility_bar/utility_bar.js';
4
+ import { VBody } from '../body/v_body.js';
5
+ import { Footer } from '../footer/footer.js';
6
+ import type { Meta, StoryObj } from '@storybook/react-vite';
7
+
8
+ import { LayoutStoryDecorator } from './utils/layout_theme_provider.js';
9
+ import { SBLayoutContent } from './utils/content.js';
10
+ import { HBody } from '../body/h_body.js';
11
+ import { VStack } from '../../stacks/v_stack.js';
12
+ import { Body } from '../body/body.js';
13
+
14
+ const meta: Meta<typeof Scaffold> = {
15
+ title: 'Layouts/Scaffold',
16
+ component: Scaffold,
17
+ tags: ['autodocs'],
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ component: 'A scaffold component that lays out content in a vertical hierarchy.',
22
+ },
23
+ },
24
+ },
25
+ };
26
+
27
+ export default meta;
28
+
29
+ type Story = StoryObj<typeof Scaffold>;
30
+
31
+ export const Baseline: Story = {
32
+ render: () => (
33
+ <LayoutStoryDecorator>
34
+ <Scaffold>
35
+ <Header>Header</Header>
36
+ <UtilityBar>Utility Bar</UtilityBar>
37
+ <Body>Body fills available space</Body>
38
+ <Footer>Footer</Footer>
39
+ </Scaffold>
40
+ </LayoutStoryDecorator>
41
+ ),
42
+ };
43
+
44
+ export const VerticalContent: Story = {
45
+ args: {
46
+ height: '100vh',
47
+ },
48
+ render: () => (
49
+ <LayoutStoryDecorator>
50
+ <Scaffold height="100vh">
51
+ <Header>Header</Header>
52
+ <UtilityBar>Utility Bar</UtilityBar>
53
+ <VBody>
54
+ <p>(V)Body</p>
55
+ <p>Fills available space</p>
56
+ <p>Scrolls vertically</p>
57
+ <SBLayoutContent />
58
+ <SBLayoutContent />
59
+ <SBLayoutContent />
60
+ </VBody>
61
+ <Footer>Footer</Footer>
62
+ </Scaffold>
63
+ </LayoutStoryDecorator>
64
+ ),
65
+ };
66
+
67
+ export const HorizontalContent: Story = {
68
+ args: {
69
+ height: '100vh',
70
+ },
71
+ render: () => (
72
+ <LayoutStoryDecorator>
73
+ <Scaffold height="100vh">
74
+ <Header>Header</Header>
75
+ <UtilityBar>Utility Bar</UtilityBar>
76
+ <HBody>
77
+ <VStack minWidth="200px" hAlign="center">
78
+ <p>(H)Body</p>
79
+ <p>Fills available space</p>
80
+ <p>Scrolls horizontally</p>
81
+ </VStack>
82
+ <SBLayoutContent />
83
+ <SBLayoutContent />
84
+ <SBLayoutContent />
85
+ </HBody>
86
+ <Footer>Footer</Footer>
87
+ </Scaffold>
88
+ </LayoutStoryDecorator>
89
+ ),
90
+ };
@@ -0,0 +1,27 @@
1
+ import { Box } from '../../../stacks/index.js';
2
+ import type { PropsWithChildren } from 'react';
3
+ import type { BoxProps } from '../../../stacks/index.js';
4
+ import { clsx } from 'clsx';
5
+
6
+ export interface SBLayoutContentProps extends BoxProps {}
7
+
8
+ export const SBLayoutContent: React.FC<PropsWithChildren<SBLayoutContentProps>> = ({
9
+ className,
10
+ children,
11
+ minHeight = '200px',
12
+ minWidth = '200px',
13
+ ...props
14
+ }) => {
15
+ return (
16
+ <Box
17
+ minHeight={minHeight}
18
+ minWidth={minWidth}
19
+ className={clsx('sb-layout-content', className)}
20
+ {...props}
21
+ >
22
+ ↔ {minWidth}
23
+ <br />↕ {minHeight}
24
+ {children}
25
+ </Box>
26
+ );
27
+ };
@@ -0,0 +1,88 @@
1
+ /* A way to visualize layout components - since they are not themed until being used in a surface */
2
+ .sb-layout-theme {
3
+ /* Forest (5) - Greens & teals */
4
+ --pastel-forest-bg: #e8f5e9;
5
+ --pastel-forest-1: #a5d6a7;
6
+ --pastel-forest-2: #81c784;
7
+ --pastel-forest-3: #66bb6a;
8
+ --pastel-forest-4: #4caf50;
9
+
10
+ /* Sunset (5) - Warm peaches, corals & yellows */
11
+ --pastel-sunset-bg: #fff7e3;
12
+ --pastel-sunset-1: #f5c6a0;
13
+ --pastel-sunset-2: #eba985;
14
+ --pastel-sunset-3: #e08f6a;
15
+ --pastel-sunset-4: #d47550;
16
+
17
+ /* Berry (5) - Purples, lavenders & pinks */
18
+ --pastel-berry-bg: #f5eafa;
19
+ --pastel-berry-1: #e8d5f2;
20
+ --pastel-berry-2: #d4b8e8;
21
+ --pastel-berry-3: #c9a7e0;
22
+ --pastel-berry-4: #b78ed4;
23
+
24
+ --bg: var(--pastel-sunset-bg);
25
+ --bg-1: var(--pastel-sunset-1);
26
+ --bg-2: var(--pastel-sunset-2);
27
+ --bg-3: var(--pastel-sunset-3);
28
+ --bg-4: var(--pastel-sunset-4);
29
+ --bg-5: rgba(0, 0, 0, 0.25);
30
+
31
+ :where(.tcn-scaffold) {
32
+ background: var(--bg);
33
+ }
34
+
35
+ :where(.tcn-bar) {
36
+ min-height: 32px;
37
+ }
38
+
39
+ :where(.tcn-header) {
40
+ background: var(--bg-1);
41
+ }
42
+
43
+ :where(.tcn-utility-bar) {
44
+ background: var(--bg-2);
45
+ }
46
+
47
+ :where(.tcn-footer) {
48
+ background: var(--bg-3);
49
+ }
50
+
51
+ :where(.tcn-body) {
52
+ background: var(--bg-4);
53
+ }
54
+
55
+ :where(.tcn-rail) {
56
+ background: var(--bg);
57
+ }
58
+
59
+ :where(.tcn-utility-strip) {
60
+ background: var(--bg-1);
61
+ min-width: 32px;
62
+ padding: 8px;
63
+
64
+ :where(.tcn-title) {
65
+ writing-mode: vertical-rl;
66
+ text-orientation: mixed;
67
+ }
68
+ }
69
+
70
+ :where(.tcn-side) {
71
+ background: var(--bg-2);
72
+ min-width: 32px;
73
+ }
74
+
75
+ :where(.tcn-main) {
76
+ background: var(--bg-4);
77
+ gap: 8px;
78
+ }
79
+
80
+ :where(.sb-layout-content) {
81
+ background: var(--bg-5);
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ /* flex-grow: 1; */
86
+ height: 100%;
87
+ }
88
+ }
@@ -0,0 +1,11 @@
1
+ import { Box } from '../../../stacks/index.js';
2
+
3
+ import './layout_theme.css';
4
+
5
+ export const LayoutStoryDecorator = ({ children }: { children: React.ReactNode }) => {
6
+ return (
7
+ <Box className="sb-layout-theme" height="100vh" width="100vw" minHeight="400px">
8
+ {children}
9
+ </Box>
10
+ );
11
+ };
@@ -3,13 +3,13 @@ import clsx from 'clsx';
3
3
 
4
4
  import { Scaffold, type ScaffoldProps } from '../scaffold/scaffold.js';
5
5
  import { Header } from '../header/header.js';
6
- import { Body } from '../body/body.js';
7
6
  import { Footer } from '../footer/footer.js';
8
7
  import { UtilityBar } from '../utility_bar/utility_bar.js';
9
8
 
10
9
  import { Rail, type RailProps } from '../rail/rail.js';
11
10
  import { Side } from '../rail/side/side.js';
12
- import { Main } from '../rail/main/main.js';
11
+ import { VBody } from '../body/v_body.js';
12
+ import { HBody } from '../body/h_body.js';
13
13
  import { Box, Spacer } from '../../stacks/index.js';
14
14
  import { UtilityStrip } from '../rail/utility_strip/utility_strip.js';
15
15
  import { SearchIcon } from '@tcn/icons/search_icon.js';
@@ -101,10 +101,10 @@ export const SBNestedRail: React.FC<PropsWithChildren<SBNestedRailProps>> = ({
101
101
  </UtilityStrip>
102
102
  )}
103
103
  {main && (
104
- <Main className={clsx(styles.main, styles.secondary)} width="200px">
105
- {mainLabel && <>Main</>}
104
+ <HBody className={clsx(styles.main, styles.secondary)} width="200px">
105
+ {mainLabel && <>Body</>}
106
106
  {children}
107
- </Main>
107
+ </HBody>
108
108
  )}
109
109
  {!main && children}
110
110
  {side && (
@@ -163,7 +163,7 @@ export const SBNestedScaffold: React.FC<PropsWithChildren<SBNestedScaffoldProps>
163
163
  </UtilityBar>
164
164
  )}
165
165
  {body && (
166
- <Body className={clsx(styles.body, styles.secondary)}>Body {children}</Body>
166
+ <VBody className={clsx(styles.body, styles.secondary)}>Body {children}</VBody>
167
167
  )}
168
168
  {!body && children}
169
169
  {footer && (