@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
@@ -20,21 +20,24 @@ export interface CalloutOwnProps {
20
20
 
21
21
  export type CalloutProps = WithDetailedHTMLProps<CalloutOwnProps, 'div'>;
22
22
 
23
- export function Callout({
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
- }: CalloutProps) {
23
+ export const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(function Callout(
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
+ }: CalloutProps,
39
+ ref
40
+ ) {
38
41
  if (pad) {
39
42
  style.padding = pad;
40
43
  }
@@ -61,6 +64,7 @@ export function Callout({
61
64
 
62
65
  return (
63
66
  <div
67
+ ref={ref}
64
68
  data-hierarchy={hierarchy}
65
69
  data-emphasis={emphasis}
66
70
  data-selectable={selectable}
@@ -71,4 +75,4 @@ export function Callout({
71
75
  {children}
72
76
  </div>
73
77
  );
74
- }
78
+ });
@@ -20,21 +20,24 @@ export interface CaptionOwnProps {
20
20
 
21
21
  export type CaptionProps = WithDetailedHTMLProps<CaptionOwnProps, 'div'>;
22
22
 
23
- export function Caption({
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
- }: CaptionProps) {
23
+ export const Caption = React.forwardRef<HTMLDivElement, CaptionProps>(function Caption(
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
+ }: CaptionProps,
39
+ ref
40
+ ) {
38
41
  if (pad) {
39
42
  style.padding = pad;
40
43
  }
@@ -61,6 +64,7 @@ export function Caption({
61
64
 
62
65
  return (
63
66
  <div
67
+ ref={ref}
64
68
  data-hierarchy={hierarchy}
65
69
  data-emphasis={emphasis}
66
70
  data-selectable={selectable}
@@ -71,4 +75,4 @@ export function Caption({
71
75
  {children}
72
76
  </div>
73
77
  );
74
- }
78
+ });
@@ -20,21 +20,24 @@ export interface FootnoteOwnProps {
20
20
 
21
21
  export type FootnoteProps = WithDetailedHTMLProps<FootnoteOwnProps, 'div'>;
22
22
 
23
- export function Footnote({
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
- }: FootnoteProps) {
23
+ export const Footnote = React.forwardRef<HTMLDivElement, FootnoteProps>(function Footnote(
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
+ }: FootnoteProps,
39
+ ref
40
+ ) {
38
41
  if (pad) {
39
42
  style.padding = pad;
40
43
  }
@@ -61,6 +64,7 @@ export function Footnote({
61
64
 
62
65
  return (
63
66
  <div
67
+ ref={ref}
64
68
  data-hierarchy={hierarchy}
65
69
  data-emphasis={emphasis}
66
70
  data-selectable={selectable}
@@ -71,4 +75,4 @@ export function Footnote({
71
75
  {children}
72
76
  </div>
73
77
  );
74
- }
78
+ });
@@ -20,65 +20,71 @@ export interface HeadlineOwnProps {
20
20
 
21
21
  export type HeadlineProps = WithDetailedHTMLProps<HeadlineOwnProps, 'h1' | 'h2' | 'h3'>;
22
22
 
23
- export function Headline({
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
- }: HeadlineProps) {
38
- let As: React.ElementType;
23
+ export const Headline = React.forwardRef<HTMLHeadingElement, HeadlineProps>(
24
+ function Headline(
25
+ {
26
+ size = 'md',
27
+ emphasis = 'normal',
28
+ hierarchy = 'primary',
29
+ color,
30
+ children,
31
+ className,
32
+ style = {},
33
+ padStart,
34
+ padEnd,
35
+ padBottom,
36
+ padTop,
37
+ pad,
38
+ selectable = true,
39
+ }: HeadlineProps,
40
+ ref
41
+ ) {
42
+ let As: React.ElementType;
39
43
 
40
- if (size === 'lg') {
41
- As = 'h1';
42
- } else if (size === 'md') {
43
- As = 'h2';
44
- } else {
45
- As = 'h3';
46
- }
44
+ if (size === 'lg') {
45
+ As = 'h1';
46
+ } else if (size === 'md') {
47
+ As = 'h2';
48
+ } else {
49
+ As = 'h3';
50
+ }
47
51
 
48
- if (pad) {
49
- style.padding = pad;
50
- }
52
+ if (pad) {
53
+ style.padding = pad;
54
+ }
51
55
 
52
- if (padStart) {
53
- style.paddingInlineStart = padStart;
54
- }
56
+ if (padStart) {
57
+ style.paddingInlineStart = padStart;
58
+ }
55
59
 
56
- if (padEnd) {
57
- style.paddingInlineEnd = padEnd;
58
- }
60
+ if (padEnd) {
61
+ style.paddingInlineEnd = padEnd;
62
+ }
59
63
 
60
- if (padTop) {
61
- style.paddingTop = padTop;
62
- }
64
+ if (padTop) {
65
+ style.paddingTop = padTop;
66
+ }
63
67
 
64
- if (padBottom) {
65
- style.paddingBottom = padBottom;
66
- }
68
+ if (padBottom) {
69
+ style.paddingBottom = padBottom;
70
+ }
67
71
 
68
- if (color) {
69
- style.color = color;
70
- }
72
+ if (color) {
73
+ style.color = color;
74
+ }
71
75
 
72
- return (
73
- <As
74
- data-hierarchy={hierarchy}
75
- data-emphasis={emphasis}
76
- data-selectable={selectable}
77
- className={clsx(styles['headline'], className, 'tcn-headline')}
78
- style={style}
79
- data-size={size}
80
- >
81
- {children}
82
- </As>
83
- );
84
- }
76
+ return (
77
+ <As
78
+ ref={ref}
79
+ data-hierarchy={hierarchy}
80
+ data-emphasis={emphasis}
81
+ data-selectable={selectable}
82
+ className={clsx(styles['headline'], className, 'tcn-headline')}
83
+ style={style}
84
+ data-size={size}
85
+ >
86
+ {children}
87
+ </As>
88
+ );
89
+ }
90
+ );
@@ -23,65 +23,71 @@ export type SubheadlineProps = WithDetailedHTMLProps<
23
23
  'h3' | 'h4' | 'h5'
24
24
  >;
25
25
 
26
- export function Subheadline({
27
- size = 'md',
28
- emphasis = 'normal',
29
- hierarchy = 'primary',
30
- color,
31
- children,
32
- className,
33
- style = {},
34
- padStart,
35
- padEnd,
36
- padBottom,
37
- padTop,
38
- pad,
39
- selectable = true,
40
- }: SubheadlineProps) {
41
- let As: React.ElementType;
26
+ export const Subheadline = React.forwardRef<HTMLHeadingElement, SubheadlineProps>(
27
+ function Subheadline(
28
+ {
29
+ size = 'md',
30
+ emphasis = 'normal',
31
+ hierarchy = 'primary',
32
+ color,
33
+ children,
34
+ className,
35
+ style = {},
36
+ padStart,
37
+ padEnd,
38
+ padBottom,
39
+ padTop,
40
+ pad,
41
+ selectable = true,
42
+ }: SubheadlineProps,
43
+ ref
44
+ ) {
45
+ let As: React.ElementType;
42
46
 
43
- if (size === 'lg') {
44
- As = 'h3';
45
- } else if (size === 'md') {
46
- As = 'h4';
47
- } else {
48
- As = 'h5';
49
- }
47
+ if (size === 'lg') {
48
+ As = 'h3';
49
+ } else if (size === 'md') {
50
+ As = 'h4';
51
+ } else {
52
+ As = 'h5';
53
+ }
50
54
 
51
- if (pad) {
52
- style.padding = pad;
53
- }
55
+ if (pad) {
56
+ style.padding = pad;
57
+ }
54
58
 
55
- if (padStart) {
56
- style.paddingInlineStart = padStart;
57
- }
59
+ if (padStart) {
60
+ style.paddingInlineStart = padStart;
61
+ }
58
62
 
59
- if (padEnd) {
60
- style.paddingInlineEnd = padEnd;
61
- }
63
+ if (padEnd) {
64
+ style.paddingInlineEnd = padEnd;
65
+ }
62
66
 
63
- if (padTop) {
64
- style.paddingTop = padTop;
65
- }
67
+ if (padTop) {
68
+ style.paddingTop = padTop;
69
+ }
66
70
 
67
- if (padBottom) {
68
- style.paddingBottom = padBottom;
69
- }
71
+ if (padBottom) {
72
+ style.paddingBottom = padBottom;
73
+ }
70
74
 
71
- if (color) {
72
- style.color = color;
73
- }
75
+ if (color) {
76
+ style.color = color;
77
+ }
74
78
 
75
- return (
76
- <As
77
- data-hierarchy={hierarchy}
78
- data-emphasis={emphasis}
79
- data-selectable={selectable}
80
- className={clsx(styles['subheadline'], className, 'tcn-subheadline')}
81
- style={style}
82
- data-size={size}
83
- >
84
- {children}
85
- </As>
86
- );
87
- }
79
+ return (
80
+ <As
81
+ ref={ref}
82
+ data-hierarchy={hierarchy}
83
+ data-emphasis={emphasis}
84
+ data-selectable={selectable}
85
+ className={clsx(styles['subheadline'], className, 'tcn-subheadline')}
86
+ style={style}
87
+ data-size={size}
88
+ >
89
+ {children}
90
+ </As>
91
+ );
92
+ }
93
+ );
@@ -1,8 +1,10 @@
1
1
  import { Draggable } from '../draggable/draggable.js';
2
+ import { useDragContainer } from '../context.js';
2
3
  import { VStack } from '../../../stacks/v_stack.js';
3
4
  import { DragHandle } from '../handle.js';
4
5
  import { Box } from '../../../stacks/box/box.js';
5
6
  import { BodyText } from '../../../typography/index.js';
7
+ import { Button } from '../../../actions/button/button/button.js';
6
8
  import styles from './draggable_stories.module.css';
7
9
 
8
10
  export default {
@@ -46,3 +48,35 @@ export const DraggableStory = () => {
46
48
  </VStack>
47
49
  );
48
50
  };
51
+
52
+ function ResetPositionButton() {
53
+ const { setPosition } = useDragContainer();
54
+ return (
55
+ <Button onClick={() => setPosition({ x: 0, y: 0 })} hierarchy="secondary">
56
+ Reset position
57
+ </Button>
58
+ );
59
+ }
60
+
61
+ export const WithSetPosition = () => {
62
+ return (
63
+ <VStack minHeight="600px" height="100%" width="100%" gap="8px">
64
+ <BodyText>
65
+ Drag the box, then click &quot;Reset position&quot; to move it back to (0, 0).
66
+ Dragging again should start from the new position.
67
+ </BodyText>
68
+ <Draggable>
69
+ <Box width="400px" height="300px" className={styles['handle-container']}>
70
+ <VStack gap="8px" padding="8px">
71
+ <DragHandle>
72
+ <Box className={styles.handle} width="120px" padding="8px">
73
+ <BodyText>Drag Handle</BodyText>
74
+ </Box>
75
+ </DragHandle>
76
+ <ResetPositionButton />
77
+ </VStack>
78
+ </Box>
79
+ </Draggable>
80
+ </VStack>
81
+ );
82
+ };
@@ -6,6 +6,7 @@ const defaultValue: DragContainer = {
6
6
  unregisterHandle: () => {},
7
7
  isDragging: false,
8
8
  position: { x: 0, y: 0 },
9
+ setPosition: () => {},
9
10
  };
10
11
 
11
12
  export const DragContainerContext = createContext<DragContainer>(defaultValue);
@@ -30,6 +30,17 @@ export function useMakeDragContainer(options: UseDragContainerOptions): DragCont
30
30
  },
31
31
  });
32
32
 
33
+ const setPositionState = useCallback(
34
+ (value: Position | ((prev: Position) => Position)) => {
35
+ setPosition(prev => {
36
+ const next = typeof value === 'function' ? value(prev) : value;
37
+ positionRef.current = next;
38
+ return next;
39
+ });
40
+ },
41
+ []
42
+ );
43
+
33
44
  const registerHandle = useCallback((handle: React.RefObject<HTMLElement>) => {
34
45
  setHandles(prev => [...prev, handle]);
35
46
  }, []);
@@ -38,5 +49,11 @@ export function useMakeDragContainer(options: UseDragContainerOptions): DragCont
38
49
  setHandles(prev => prev.filter(h => h !== handle));
39
50
  }, []);
40
51
 
41
- return { registerHandle, unregisterHandle, position, isDragging };
52
+ return {
53
+ registerHandle,
54
+ unregisterHandle,
55
+ position,
56
+ isDragging,
57
+ setPosition: setPositionState,
58
+ };
42
59
  }
@@ -1,6 +1,9 @@
1
+ import type { Position } from '../types/dimensions.js';
2
+
1
3
  export interface DragContainer {
2
4
  registerHandle: (handle: React.RefObject<HTMLElement>) => void;
3
5
  unregisterHandle: (handle: React.RefObject<HTMLElement>) => void;
4
6
  isDragging: boolean;
5
- position: { x: number; y: number };
7
+ position: Position;
8
+ setPosition: (value: Position | ((prev: Position) => Position)) => void;
6
9
  }
@@ -1,32 +1,21 @@
1
- import React from 'react';
1
+ import { useLayoutEffect, useState } from 'react';
2
+ import { useResizeObserver } from './use_resize_observer.js';
2
3
 
3
- /**
4
- * Custom hook that returns a boolean indicating if the current viewport
5
- * matches the given media query.
6
- *
7
- * @param query - The media query to match against (e.g. "(min-width: 768px)")
8
- * @returns boolean indicating if the media query matches
9
- */
10
- export function useMediaQuery(query: string): boolean {
11
- const [matches, setMatches] = React.useState(false);
12
-
13
- React.useEffect(() => {
14
- const mediaQuery = window.matchMedia(query);
15
-
16
- // Set initial value
17
- setMatches(mediaQuery.matches);
18
-
19
- // Create event listener
20
- const handler = (event: MediaQueryListEvent) => {
21
- setMatches(event.matches);
22
- };
4
+ export interface ViewportSize {
5
+ width: number;
6
+ height: number;
7
+ }
23
8
 
24
- // Add the listener
25
- mediaQuery.addEventListener('change', handler);
9
+ export function useMediaQuery(): ViewportSize {
10
+ const [size, setSize] = useState<ViewportSize>({ width: 0, height: 0 });
11
+ const resizeRef = useResizeObserver((width, height) => {
12
+ setSize({ width, height });
13
+ });
26
14
 
27
- // Clean up
28
- return () => mediaQuery.removeEventListener('change', handler);
29
- }, [query]);
15
+ useLayoutEffect(() => {
16
+ const body = document.body;
17
+ resizeRef(body);
18
+ }, [resizeRef]);
30
19
 
31
- return matches;
20
+ return size;
32
21
  }
@@ -5,8 +5,8 @@ export * from './scroll_away_listener.js';
5
5
  export * from './dnd/hooks/use_draggable.js';
6
6
  export * from './hooks/make_context_hook.js';
7
7
  export * from './hooks/use_fork_ref.js';
8
- export * from './hooks/use_media_query.js';
9
8
  export * from './hooks/use_resize_observer.js';
9
+ export * from './hooks/use_media_query.js';
10
10
 
11
11
  export * from './default_value.js';
12
12
 
@@ -19,7 +19,5 @@ export * from './calendar/month.js';
19
19
  export * from './types/dimensions.js';
20
20
  export * from './types/variations.js';
21
21
 
22
- export * from './responsive/responsive_renderer.js';
23
-
24
22
  export * from './dnd/draggable/draggable.js';
25
23
  export * from './dnd/handle.js';
@@ -1,5 +0,0 @@
1
- import './body_text.css';const t = "_body-text_ee60621", e = { "body-text": t };
2
- export {
3
- e as s
4
- };
5
- //# sourceMappingURL=body_text.module-h4XQE2pC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body_text.module-h4XQE2pC.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +0,0 @@
1
- import './callout.css';const s = "_callout_32c6400", t = { callout: s };
2
- export {
3
- t as s
4
- };
5
- //# sourceMappingURL=callout.module-D8ECmxpO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callout.module-D8ECmxpO.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +0,0 @@
1
- import './caption.css';const s = "_caption_94e02c4", t = { caption: s };
2
- export {
3
- t as s
4
- };
5
- //# sourceMappingURL=caption.module-DDq0H4xZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"caption.module-DDq0H4xZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +0,0 @@
1
- import './footnote.css';const o = "_footnote_f4b25ae", t = { footnote: o };
2
- export {
3
- t as s
4
- };
5
- //# sourceMappingURL=footnote.module-DEyFuqOr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"footnote.module-DEyFuqOr.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/h_body.css DELETED
@@ -1 +0,0 @@
1
- @layer tcn-system{:where(._h-body_d56f4f1){min-width:0;flex-grow:1;height:100%}}
package/dist/h_panel.css DELETED
@@ -1 +0,0 @@
1
- @layer tcn-system{:where(._panel-stack_f1896f3){width:100%;height:100%;overflow:auto}}
package/dist/header.css DELETED
@@ -1 +0,0 @@
1
- @layer tcn-system{:where(._header_3155fa4){width:100%;min-height:0;padding:var(--padding) var(--padding-large);gap:var(--gap)}}
@@ -1,5 +0,0 @@
1
- import './headline.css';const e = "_headline_9a99308", s = { headline: e };
2
- export {
3
- s
4
- };
5
- //# sourceMappingURL=headline.module-BiwHBtGf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"headline.module-BiwHBtGf.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,6 +0,0 @@
1
- import { default as React } from 'react';
2
- import { HStackProps } from '../../../stacks/h_stack.js';
3
- export interface MainProps extends Omit<HStackProps, 'as'> {
4
- }
5
- export declare const Main: React.ForwardRefExoticComponent<MainProps & React.RefAttributes<HTMLElement>>;
6
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/layouts/rail/main/main.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAG7D,eAAO,MAAM,IAAI,+EAef,CAAC"}