@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,16 +1,16 @@
1
- import { useForkRef } from '../../utils/index.js';
1
+ import { clsx } from 'clsx';
2
2
  import React, { CSSProperties, HTMLAttributes, useRef } from 'react';
3
- import { LeftResizeHandle } from './left_resize_handle.js';
4
- import { RightResizeHandle } from './right_resize_handle.js';
3
+ import { useForkRef } from '../../utils/index.js';
4
+ import styles from '../stack.module.css';
5
+ import { isCustomSizeProp } from '../utils/isCustomSizeProp.js';
6
+ import { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';
5
7
  import { BottomResizeHandle } from './bottom_resize_handle.js';
6
8
  import { EndResizeHandle } from './end_resize_handle.js';
9
+ import { HandleProps } from './handle_props.js';
10
+ import { LeftResizeHandle } from './left_resize_handle.js';
11
+ import { RightResizeHandle } from './right_resize_handle.js';
7
12
  import { StartResizeHandle } from './start_resize_handle.js';
8
13
  import { TopResizeHandle } from './top_resize_handle.js';
9
- import { clsx } from 'clsx';
10
- import { isCustomSizeProp } from '../utils/isCustomSizeProp.js';
11
- import { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';
12
- import styles from '../stack.module.css';
13
- import { HandleProps } from './handle_props.js';
14
14
 
15
15
  export interface BoxProps<T extends HTMLElement = HTMLElement> extends HTMLAttributes<T> {
16
16
  as?: string;
@@ -45,16 +45,10 @@ export interface BoxProps<T extends HTMLElement = HTMLElement> extends HTMLAttri
45
45
  enableResizeOnRight?: boolean;
46
46
  horizontalHandleProps?: HandleProps;
47
47
  verticalHandleProps?: HandleProps;
48
- onWidthResize?: (
49
- width: number
50
- // origin: 'left' | 'right'
51
- ) => void;
52
- onHeightResize?: (
53
- height: number
54
- // origin: 'top' | 'bottom'
55
- ) => void;
56
- onWidthResizeEnd?: (width: number) => void;
57
- onHeightResizeEnd?: (width: number) => void;
48
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void;
49
+ onHeightResize?: (height: number, origin: 'top' | 'bottom', delta: number) => void;
50
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void;
51
+ onHeightResizeEnd?: (height: number, origin: 'top' | 'bottom') => void;
58
52
  }
59
53
 
60
54
  export const Box = React.forwardRef<HTMLElement, BoxProps>(function Box(
@@ -1,16 +1,15 @@
1
+ import { clsx } from 'clsx';
1
2
  import React from 'react';
2
3
  import styles from './end_resize_handle.module.css';
4
+ import { HandleProps } from './handle_props.js';
3
5
  import { createHorizontalResizeHandler } from './resize_handlers.js';
4
- import { clsx } from 'clsx';
5
- import type { HandleProps } from './handle_props.js';
6
6
 
7
7
  export interface EndResizeHandleProps {
8
8
  targetRef: React.MutableRefObject<HTMLElement | null>;
9
9
  handleProps?: HandleProps;
10
- onWidthResize?: (value: number) => void;
11
- onWidthResizeEnd?: (value: number) => void;
10
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void;
11
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void;
12
12
  }
13
-
14
13
  export function EndResizeHandle({
15
14
  targetRef,
16
15
  handleProps,
@@ -20,7 +19,8 @@ export function EndResizeHandle({
20
19
  const resizeHandler = createHorizontalResizeHandler(
21
20
  targetRef,
22
21
  onWidthResize,
23
- onWidthResizeEnd
22
+ onWidthResizeEnd,
23
+ 'right'
24
24
  );
25
25
  const offset = handleProps?.offset ? handleProps.offset : -8;
26
26
 
@@ -1,14 +1,14 @@
1
+ import { clsx } from 'clsx';
1
2
  import React from 'react';
2
3
  import { HandleProps } from './handle_props.js';
3
4
  import styles from './left_resize_handle.module.css';
4
5
  import { createHorizontalResizeHandler } from './resize_handlers.js';
5
- import { clsx } from 'clsx';
6
6
 
7
7
  export interface LeftResizeHandleProps {
8
8
  targetRef: React.MutableRefObject<HTMLElement | null>;
9
9
  handleProps?: HandleProps;
10
- onWidthResize?: (value: number) => void;
11
- onWidthResizeEnd?: (value: number) => void;
10
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void;
11
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void;
12
12
  }
13
13
  export function LeftResizeHandle({
14
14
  targetRef,
@@ -20,6 +20,7 @@ export function LeftResizeHandle({
20
20
  targetRef,
21
21
  onWidthResize,
22
22
  onWidthResizeEnd,
23
+ 'left',
23
24
  true,
24
25
  true
25
26
  );
@@ -9,8 +9,9 @@ function createVeil() {
9
9
 
10
10
  export function createHorizontalResizeHandler(
11
11
  targetRef: React.MutableRefObject<HTMLElement | null>,
12
- onWidthResize?: (value: number) => void,
13
- onWidthResizeEnd?: (value: number) => void,
12
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void,
13
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void,
14
+ origin: 'left' | 'right' = 'right',
14
15
  invert = false,
15
16
  disableDirection = false
16
17
  ) {
@@ -40,7 +41,7 @@ export function createHorizontalResizeHandler(
40
41
  width = newWidth;
41
42
 
42
43
  box.style.width = `${newWidth}px`;
43
- onWidthResize && onWidthResize(newWidth);
44
+ onWidthResize?.(newWidth, origin, deltaX);
44
45
  event.stopPropagation();
45
46
  event.preventDefault();
46
47
  };
@@ -60,7 +61,7 @@ export function createHorizontalResizeHandler(
60
61
  event.stopPropagation();
61
62
  event.preventDefault();
62
63
 
63
- onWidthResizeEnd && onWidthResizeEnd(width);
64
+ onWidthResizeEnd?.(width, origin);
64
65
  };
65
66
 
66
67
  document.body.addEventListener('mousemove', drag);
@@ -73,9 +74,10 @@ export function createHorizontalResizeHandler(
73
74
 
74
75
  export function createVerticalResizeHandler(
75
76
  targetRef: React.MutableRefObject<HTMLElement | null>,
76
- onHeightResize?: (value: number) => void,
77
- onHeightResizeEnd?: (value: number) => void,
78
- invert = false
77
+ onHeightResize?: (height: number, origin: 'top' | 'bottom', delta: number) => void,
78
+ onHeightResizeEnd?: (height: number, origin: 'top' | 'bottom') => void,
79
+ invert = false,
80
+ origin: 'top' | 'bottom' = 'bottom'
79
81
  ) {
80
82
  const direction = invert ? -1 : 1;
81
83
  return function startVerticalResize(event: React.MouseEvent) {
@@ -97,7 +99,7 @@ export function createVerticalResizeHandler(
97
99
  const newHeight = startRect.height + deltaY;
98
100
  height = newHeight;
99
101
  box.style.height = `${newHeight}px`;
100
- onHeightResize && onHeightResize(newHeight);
102
+ onHeightResize?.(newHeight, origin, deltaY);
101
103
  event.stopPropagation();
102
104
  event.preventDefault();
103
105
  };
@@ -117,7 +119,7 @@ export function createVerticalResizeHandler(
117
119
  event.stopPropagation();
118
120
  event.preventDefault();
119
121
 
120
- onHeightResizeEnd && onHeightResizeEnd(height);
122
+ onHeightResizeEnd?.(height, origin);
121
123
  };
122
124
 
123
125
  document.body.addEventListener('mousemove', drag);
@@ -1,14 +1,14 @@
1
+ import { clsx } from 'clsx';
1
2
  import React from 'react';
2
3
  import { HandleProps } from './handle_props.js';
3
4
  import { createHorizontalResizeHandler } from './resize_handlers.js';
4
5
  import styles from './right_resize_handle.module.css';
5
- import { clsx } from 'clsx';
6
6
 
7
7
  export interface RightResizeHandleProps {
8
8
  targetRef: React.MutableRefObject<HTMLElement | null>;
9
9
  handleProps?: HandleProps;
10
- onWidthResize?: (value: number) => void;
11
- onWidthResizeEnd?: (value: number) => void;
10
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void;
11
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void;
12
12
  }
13
13
  export function RightResizeHandle({
14
14
  targetRef,
@@ -20,6 +20,7 @@ export function RightResizeHandle({
20
20
  targetRef,
21
21
  onWidthResize,
22
22
  onWidthResizeEnd,
23
+ 'right',
23
24
  false,
24
25
  true
25
26
  );
@@ -7,8 +7,8 @@ import { clsx } from 'clsx';
7
7
  export interface StartResizeHandleProps {
8
8
  targetRef: React.MutableRefObject<HTMLElement | null>;
9
9
  handleProps?: HandleProps;
10
- onWidthResize?: (value: number) => void;
11
- onWidthResizeEnd?: (value: number) => void;
10
+ onWidthResize?: (width: number, origin: 'left' | 'right', delta: number) => void;
11
+ onWidthResizeEnd?: (width: number, origin: 'left' | 'right') => void;
12
12
  }
13
13
  export function StartResizeHandle({
14
14
  targetRef,
@@ -20,7 +20,7 @@ export function StartResizeHandle({
20
20
  targetRef,
21
21
  onWidthResize,
22
22
  onWidthResizeEnd,
23
- true
23
+ 'left'
24
24
  );
25
25
  const offset = handleProps?.offset ? handleProps.offset : -8;
26
26
 
@@ -7,8 +7,8 @@ import { clsx } from 'clsx';
7
7
  export interface TopResizeHandleProps {
8
8
  targetRef: React.MutableRefObject<HTMLElement | null>;
9
9
  handleProps?: HandleProps;
10
- onHeightResize?: (value: number) => void;
11
- onHeightResizeEnd?: (value: number) => void;
10
+ onHeightResize?: (height: number, origin: 'top' | 'bottom', delta: number) => void;
11
+ onHeightResizeEnd?: (height: number, origin: 'top' | 'bottom') => void;
12
12
  }
13
13
  export function TopResizeHandle({
14
14
  targetRef,
@@ -20,7 +20,8 @@ export function TopResizeHandle({
20
20
  targetRef,
21
21
  onHeightResize,
22
22
  onHeightResizeEnd,
23
- true
23
+ true,
24
+ 'top'
24
25
  );
25
26
  const offset = handleProps?.offset ? handleProps.offset : -8;
26
27
 
@@ -1,13 +1,13 @@
1
+ import { ChevronLeftIcon as ChevronLeft } from '@tcn/icons/chevron_left_icon.js';
2
+ import { PlusIcon as Plus } from '@tcn/icons/plus_icon.js';
1
3
  import React from 'react';
2
4
  import { Button, SlimButton } from '../actions/index.js';
3
- import { HCollapsibleBox as HComponent } from './h_collapsible_box.js';
4
- import { VCollapsibleBox as VComponent } from './v_collapsible_box.js';
5
5
  import { Title } from '../typography/index.js';
6
- import { Spacer } from './spacer.js';
6
+ import { HCollapsibleBox } from './h_collapsible_box.js';
7
7
  import { HStack } from './h_stack.js';
8
+ import { Spacer } from './spacer.js';
9
+ import { VCollapsibleBox } from './v_collapsible_box.js';
8
10
  import { VStack } from './v_stack.js';
9
- import { ChevronLeftIcon as ChevronLeft } from '@tcn/icons/chevron_left_icon.js';
10
- import { PlusIcon as Plus } from '@tcn/icons/plus_icon.js';
11
11
 
12
12
  export default {
13
13
  title: 'Stacks/Collapsible Box',
@@ -49,13 +49,13 @@ export function CollapsibleBox() {
49
49
  <Button onClick={() => setVHopen(c => !c)}>toggle vertical collapse</Button>
50
50
  <Button onClick={() => setHOpen(c => !c)}>toggle horizontal collapse</Button>
51
51
  </VStack>
52
- <VComponent open={vOpen} enableResizeOnTop>
52
+ <VCollapsibleBox open={vOpen} enableResizeOnTop>
53
53
  <MyPanel />
54
- </VComponent>
54
+ </VCollapsibleBox>
55
55
  </VStack>
56
- <HComponent open={hOpen} enableResizeOnStart>
56
+ <HCollapsibleBox open={hOpen} enableResizeOnStart>
57
57
  <MyPanel />
58
- </HComponent>
58
+ </HCollapsibleBox>
59
59
  </HStack>
60
60
  );
61
61
  }
@@ -67,9 +67,9 @@ export function VerticalCollapsibleBox() {
67
67
  <HStack height="flex" hAlign="end" gap="16px">
68
68
  <Button onClick={() => setOpen(c => !c)}>toggle collapse</Button>
69
69
  </HStack>
70
- <VComponent open={open} enableResizeOnTop defaultHeight="300px">
70
+ <VCollapsibleBox open={open} enableResizeOnTop defaultHeight="300px">
71
71
  <MyPanel />
72
- </VComponent>
72
+ </VCollapsibleBox>
73
73
  </VStack>
74
74
  );
75
75
  }
@@ -1,6 +1,6 @@
1
+ import { clsx } from 'clsx';
1
2
  import React, { useLayoutEffect } from 'react';
2
3
  import { useForkRef } from '../utils/index.js';
3
- import { clsx } from 'clsx';
4
4
  import { Box, BoxProps } from './box/box.js';
5
5
  import styles from './collapsible_box.module.css';
6
6
  import { useIsCollapsed } from './utils/use_is_collapsed.js';
@@ -32,13 +32,13 @@ export const HCollapsibleBox = React.forwardRef(function CollapsibleBox(
32
32
  data-is-collapsed={!open}
33
33
  data-collapse-orientation="horizontal"
34
34
  data-is-resizing={resizing}
35
- onWidthResize={width => {
35
+ onWidthResize={(width, origin, delta) => {
36
36
  setIsResizing(true);
37
- props.onWidthResize?.(width);
37
+ props.onWidthResize?.(width, origin, delta);
38
38
  }}
39
- onWidthResizeEnd={width => {
39
+ onWidthResizeEnd={(width, origin) => {
40
40
  setIsResizing(false);
41
- props.onWidthResizeEnd?.(width);
41
+ props.onWidthResizeEnd?.(width, origin);
42
42
  collapsibleRef.current?.style.setProperty('--collapsible-size', `${width}px`);
43
43
  }}
44
44
  className={clsx(
@@ -32,14 +32,14 @@ export const VCollapsibleBox = React.forwardRef(function CollapsibleBox(
32
32
  data-is-collapsed={!open}
33
33
  data-collapse-orientation="vertical"
34
34
  data-is-resizing={resizing}
35
- onHeightResize={height => {
35
+ onHeightResize={(height, origin, delta) => {
36
36
  setIsResizing(true);
37
- props.onHeightResize?.(height);
37
+ props.onHeightResize?.(height, origin, delta);
38
38
  }}
39
- onHeightResizeEnd={height => {
39
+ onHeightResizeEnd={(height, origin) => {
40
40
  setIsResizing(false);
41
41
  collapsibleRef.current?.style.setProperty('--collapsible-size', `${height}px`);
42
- props.onHeightResizeEnd?.(height);
42
+ props.onHeightResizeEnd?.(height, origin);
43
43
  }}
44
44
  className={clsx(
45
45
  props.className,
@@ -3,8 +3,7 @@ export * from './card/card.js';
3
3
  export * from './confirm/confirm.js';
4
4
  export * from './page/h_page.js';
5
5
  export * from './page/v_page.js';
6
- export * from './panel/h_panel.js';
7
- export * from './panel/v_panel.js';
6
+ export * from './panel/panel.js';
8
7
  export * from './popover/popover.js';
9
8
  export * from './drawers/drawer_bottom/drawer_bottom.js';
10
9
  export * from './drawers/drawer_top/drawer_top.js';
@@ -6,7 +6,7 @@ import { Heading, Section, VBody } from '../../../layouts/index.js';
6
6
  import { UtilityBar } from '../../../layouts/utility_bar/utility_bar.js';
7
7
  import { Box, HStack, Spacer } from '../../../stacks/index.js';
8
8
  import { Title } from '../../../typography/title/title.js';
9
- import { VPanel } from '../v_panel.js';
9
+ import { Panel } from '../panel.js';
10
10
  // Styles
11
11
  import styles from './panel_stories.module.css';
12
12
  import { TTable, TBody, TD, TH, THead, TR } from '../../../layouts/table/table.js';
@@ -23,7 +23,7 @@ import { BodyText } from '../../../typography/index.js';
23
23
 
24
24
  export default {
25
25
  title: 'Surfaces/Panel',
26
- component: VPanel,
26
+ component: Panel,
27
27
  tags: ['autodocs'],
28
28
  };
29
29
 
@@ -71,8 +71,8 @@ const UtilGroupExample = () => {
71
71
 
72
72
  export const Default = () => {
73
73
  return (
74
- <div className={styles['stories-container']}>
75
- <VPanel maxHeight="600px">
74
+ <Box className={styles['stories-container']}>
75
+ <Panel maxHeight="600px">
76
76
  <Header>
77
77
  <Title emphasis="strong">Panel Primary Header</Title>
78
78
  <Spacer />
@@ -109,16 +109,16 @@ export const Default = () => {
109
109
  <Button hierarchy="secondary">Secondary</Button>
110
110
  <Button hierarchy="primary">Primary</Button>
111
111
  </Footer>
112
- </VPanel>
113
- </div>
112
+ </Panel>
113
+ </Box>
114
114
  );
115
115
  };
116
116
 
117
117
  export const WithTable = () => {
118
118
  return (
119
- <div className={styles['stories-container']}>
119
+ <Box className={styles['stories-container']}>
120
120
  <HStack gap="16px" maxHeight="600px" height="100%" maxWidth="1440px">
121
- <VPanel minWidth="300px">
121
+ <Panel minWidth="300px">
122
122
  <Header>
123
123
  <Title emphasis="strong">Table Title</Title>
124
124
  <Spacer />
@@ -190,8 +190,8 @@ export const WithTable = () => {
190
190
  </Button>
191
191
  </HStack>
192
192
  </Footer>
193
- </VPanel>
194
- <VPanel maxHeight="600px" width="300px" minWidth="300px">
193
+ </Panel>
194
+ <Panel maxHeight="600px" width="300px" minWidth="300px">
195
195
  <Header>
196
196
  <Title emphasis="strong">John Doe</Title>
197
197
  <Spacer />
@@ -210,8 +210,8 @@ export const WithTable = () => {
210
210
  <BodyText>Email: john.doe@example.com</BodyText>
211
211
  </Section>
212
212
  </VBody>
213
- </VPanel>
213
+ </Panel>
214
214
  </HStack>
215
- </div>
215
+ </Box>
216
216
  );
217
217
  };
@@ -19,8 +19,8 @@
19
19
 
20
20
  .stories-container {
21
21
  width: 100%;
22
- height: 100%;
23
- padding: 16px;
22
+ height: 100vh;
23
+ min-height: 400px;
24
24
  background-color: #ccc;
25
- overflow: auto;
25
+ padding: 16px;
26
26
  }
@@ -1,10 +1,5 @@
1
1
  @layer tcn-system {
2
- :where(.panel-stack) {
3
- width: 100%;
2
+ .panel {
4
3
  height: 100%;
5
- overflow: auto;
6
4
  }
7
- /* .page-stack > :global(.stack) {
8
- gap: var(--gap);
9
- } */
10
5
  }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
3
+ import clsx from 'clsx';
4
+
5
+ import styles from './panel.module.css';
6
+
7
+ export type PanelProps = ScaffoldProps;
8
+
9
+ export const Panel = React.forwardRef<HTMLElement, PanelProps>(function Panel(
10
+ { children, className, ...props }: PanelProps,
11
+ ref
12
+ ) {
13
+ return (
14
+ <Scaffold
15
+ ref={ref}
16
+ className={clsx(styles['panel'], 'tcn-surface', 'tcn-panel', className)}
17
+ {...props}
18
+ >
19
+ {children}
20
+ </Scaffold>
21
+ );
22
+ });
@@ -10,9 +10,10 @@ import layers from '../css/layers.css?raw';
10
10
  export interface ThemeProps extends BoxProps {
11
11
  styleSheets: CSSStyleSheet[];
12
12
  children: React.ReactNode;
13
+ className?: string;
13
14
  }
14
15
 
15
- export function Theme({ styleSheets, children, ...boxProps }: ThemeProps) {
16
+ export function Theme({ styleSheets, children, className, ...boxProps }: ThemeProps) {
16
17
  useLayoutEffect(() => {
17
18
  document.adoptedStyleSheets = styleSheets;
18
19
  }, [styleSheets]);
@@ -33,7 +34,10 @@ export function Theme({ styleSheets, children, ...boxProps }: ThemeProps) {
33
34
  }, []);
34
35
 
35
36
  return (
36
- <Box className={clsx('tcn-theme-root', styles['tcn-theme-provider'])} {...boxProps}>
37
+ <Box
38
+ className={clsx('tcn-theme-root', styles['tcn-theme-provider'], className)}
39
+ {...boxProps}
40
+ >
37
41
  {children}
38
42
  </Box>
39
43
  );
@@ -3,10 +3,9 @@ import { VStack } from '../../../../stacks/v_stack.js';
3
3
  import { clsx } from 'clsx';
4
4
  import { PlusIcon } from '@tcn/icons/plus_icon.js';
5
5
  import { Divider, Footer, Header, VBody } from '../../../../layouts/index.js';
6
- import { VPanel } from '../../../../surfaces/index.js';
6
+ import { Panel } from '../../../../surfaces/index.js';
7
7
  import { Button } from '../../../../actions/button/button/button.js';
8
8
  import { Spacer } from '../../../../stacks/spacer.js';
9
- import { SlimButton } from '../../../../actions/button/slim_button/slim_button.js';
10
9
  import { SB_TonePicker } from './components/tone_picker/sb_tone_picker.js';
11
10
  import { formatHSLString, getContrastText, parseHSL } from './utils.js';
12
11
  import { SB_MaterialPicker } from './components/material_picker/sb_material_picker.js';
@@ -86,7 +85,7 @@ export const DynamicSurface = (args: {
86
85
  <Title>Ergo Theme: Materials and Surfaces</Title>
87
86
  </Header>
88
87
  <SB_MaterialPicker handleSurfaceClick={handleSurfaceClick} />
89
- <VPanel
88
+ <Panel
90
89
  minHeight="200px"
91
90
  maxHeight="700px"
92
91
  height="100%"
@@ -95,30 +94,30 @@ export const DynamicSurface = (args: {
95
94
  <Header>
96
95
  Enabled Utilities
97
96
  <Spacer />
98
- <SlimButton hierarchy="tertiary">
97
+ <Button utility hierarchy="tertiary">
99
98
  <PlusIcon />
100
- </SlimButton>
101
- <SlimButton hierarchy="secondary">
99
+ </Button>
100
+ <Button utility hierarchy="secondary">
102
101
  <PlusIcon />
103
- </SlimButton>
102
+ </Button>
104
103
  <Divider vertical length="md" />
105
- <SlimButton hierarchy="primary">
104
+ <Button utility hierarchy="primary">
106
105
  <PlusIcon />
107
- </SlimButton>
106
+ </Button>
108
107
  </Header>
109
108
  <Header>
110
109
  Disabled Utilities
111
110
  <Spacer />
112
- <SlimButton hierarchy="tertiary" disabled>
111
+ <Button utility hierarchy="tertiary" disabled>
113
112
  <PlusIcon />
114
- </SlimButton>
115
- <SlimButton hierarchy="secondary" disabled>
113
+ </Button>
114
+ <Button utility hierarchy="secondary" disabled>
116
115
  <PlusIcon />
117
- </SlimButton>
116
+ </Button>
118
117
  <Divider vertical length="md" />
119
- <SlimButton hierarchy="primary" disabled>
118
+ <Button utility hierarchy="primary" disabled>
120
119
  <PlusIcon />
121
- </SlimButton>
120
+ </Button>
122
121
  </Header>
123
122
  <VBody>
124
123
  <SB_TonePicker />
@@ -143,7 +142,7 @@ export const DynamicSurface = (args: {
143
142
  <Button hierarchy="secondary">Secondary</Button>
144
143
  <Button hierarchy="primary">Primary</Button>
145
144
  </Footer>
146
- </VPanel>
145
+ </Panel>
147
146
  <Header></Header>
148
147
  </VStack>
149
148
  );
@@ -579,6 +579,18 @@
579
579
  color: var(--on-material);
580
580
  }
581
581
 
582
+ /* Divider: use material-line; emphasis variants for strong/faint */
583
+ .tcn-divider-line,
584
+ .tcn-divider-line[data-emphasis="normal"] {
585
+ background: var(--material-line);
586
+ }
587
+ .tcn-divider-line[data-emphasis="strong"] {
588
+ background: color-mix(in srgb, var(--material-line) 80%, black 20%);
589
+ }
590
+ .tcn-divider-line[data-emphasis="faint"] {
591
+ background: color-mix(in srgb, var(--material-line) 80%, white 20%);
592
+ }
593
+
582
594
  /* ===== SURFACES ===== */
583
595
  .tcn-draggable[data-is-draggable="true"] {
584
596
  .tcn-drag-handle {
@@ -606,7 +618,22 @@
606
618
  border-radius: var(--shape-radius-medium);
607
619
  }
608
620
  }
621
+ /* Rail: */
622
+ .tcn-utility-strip {
623
+ min-width: var(--bar-md);
624
+ }
625
+
626
+ .tcn-utility-strip,
627
+ .tcn-side {
628
+ padding-block: var(--padding-medium);
629
+ gap: var(--gap-medium);
630
+ }
609
631
 
632
+ .tcn-rail {
633
+ :where(.tcn-body) {
634
+ gap: var(--gap-medium);
635
+ }
636
+ }
610
637
  /* Scaffold: */
611
638
  .tcn-footer,
612
639
  .tcn-header,
@@ -20,22 +20,25 @@ export interface BodyTextOwnProps {
20
20
 
21
21
  export type BodyTextProps = WithDetailedHTMLProps<BodyTextOwnProps, 'div'>;
22
22
 
23
- export function BodyText({
24
- size = 'md',
25
- emphasis = 'normal',
26
- hierarchy = 'primary',
27
- color,
28
- children,
29
- className,
30
- style = {},
31
- padStart,
32
- padEnd,
33
- padBottom,
34
- padTop,
35
- pad,
36
- selectable = true,
37
- breakWords = false,
38
- }: BodyTextProps) {
23
+ export const BodyText = React.forwardRef<HTMLDivElement, BodyTextProps>(function (
24
+ {
25
+ size = 'md',
26
+ emphasis = 'normal',
27
+ hierarchy = 'primary',
28
+ color,
29
+ children,
30
+ className,
31
+ style = {},
32
+ padStart,
33
+ padEnd,
34
+ padBottom,
35
+ padTop,
36
+ pad,
37
+ selectable = true,
38
+ breakWords = false,
39
+ }: BodyTextProps,
40
+ ref
41
+ ) {
39
42
  if (pad) {
40
43
  style.padding = pad;
41
44
  }
@@ -62,6 +65,7 @@ export function BodyText({
62
65
 
63
66
  return (
64
67
  <div
68
+ ref={ref}
65
69
  data-hierarchy={hierarchy}
66
70
  data-emphasis={emphasis}
67
71
  data-selectable={selectable}
@@ -73,4 +77,4 @@ export function BodyText({
73
77
  {children}
74
78
  </div>
75
79
  );
76
- }
80
+ });