@tcn/ui 0.2.0 → 0.3.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 (247) hide show
  1. package/dist/divider.module-FptFV0PX.js +5 -0
  2. package/dist/divider.module-FptFV0PX.js.map +1 -0
  3. package/dist/form/field/field.js +1 -1
  4. package/dist/frame.css +1 -0
  5. package/dist/inputs/color_input/color_input.js +1 -1
  6. package/dist/inputs/color_input/color_input.js.map +1 -1
  7. package/dist/inputs/color_input/color_picker.js +1 -1
  8. package/dist/inputs/combo_box/combo_box.js +1 -1
  9. package/dist/inputs/date_picker/date_picker.js +1 -1
  10. package/dist/inputs/date_picker/date_picker_input.js +2 -2
  11. package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
  12. package/dist/inputs/date_picker/date_picker_year_input.js +1 -1
  13. package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
  14. package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
  15. package/dist/inputs/mask_input/key_capture_input.js +1 -1
  16. package/dist/inputs/mask_input/mask_input.js +1 -1
  17. package/dist/inputs/multiselect/multiselect.js +1 -1
  18. package/dist/inputs/phone_number_input/phone_number_input.js +1 -1
  19. package/dist/inputs/select/select.js +1 -1
  20. package/dist/inputs/slider/slider.js +1 -1
  21. package/dist/inputs/suggestions/suggestion_list.js +2 -2
  22. package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
  23. package/dist/inputs/switch/switch.js +1 -1
  24. package/dist/inputs/unit_input/unit_input.js +1 -1
  25. package/dist/layouts/divider/divider.js +24 -23
  26. package/dist/layouts/divider/divider.js.map +1 -1
  27. package/dist/layouts/index.d.ts +6 -5
  28. package/dist/layouts/index.d.ts.map +1 -1
  29. package/dist/layouts/index.js +28 -26
  30. package/dist/layouts/index.js.map +1 -1
  31. package/dist/layouts/scaffold/scaffold.d.ts +9 -0
  32. package/dist/layouts/scaffold/scaffold.d.ts.map +1 -0
  33. package/dist/layouts/scaffold/scaffold.js +55 -0
  34. package/dist/layouts/scaffold/scaffold.js.map +1 -0
  35. package/dist/modal.css +1 -1
  36. package/dist/overlay/frame/frame.d.ts.map +1 -1
  37. package/dist/overlay/frame/frame.js +22 -5
  38. package/dist/overlay/frame/frame.js.map +1 -1
  39. package/dist/overlay/index.d.ts +9 -2
  40. package/dist/overlay/index.d.ts.map +1 -1
  41. package/dist/overlay/index.js +22 -10
  42. package/dist/overlay/index.js.map +1 -1
  43. package/dist/overlay/menu/menu.d.ts +1 -1
  44. package/dist/overlay/menu/menu.d.ts.map +1 -1
  45. package/dist/overlay/menu/menu.js +2 -2
  46. package/dist/overlay/menu/menu.js.map +1 -1
  47. package/dist/overlay/popper/base/base_popper.d.ts +11 -0
  48. package/dist/overlay/popper/base/base_popper.d.ts.map +1 -0
  49. package/dist/overlay/popper/base/base_popper.js +27 -0
  50. package/dist/overlay/popper/base/base_popper.js.map +1 -0
  51. package/dist/overlay/popper/base/dismissal_decorator.d.ts +16 -0
  52. package/dist/overlay/popper/base/dismissal_decorator.d.ts.map +1 -0
  53. package/dist/overlay/popper/base/dismissal_decorator.js +69 -0
  54. package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -0
  55. package/dist/overlay/popper/context_popper.d.ts +11 -0
  56. package/dist/overlay/popper/context_popper.d.ts.map +1 -0
  57. package/dist/overlay/popper/context_popper.js +33 -0
  58. package/dist/overlay/popper/context_popper.js.map +1 -0
  59. package/dist/overlay/popper/element_popper.d.ts +7 -0
  60. package/dist/overlay/popper/element_popper.d.ts.map +1 -0
  61. package/dist/overlay/popper/element_popper.js +33 -0
  62. package/dist/overlay/popper/element_popper.js.map +1 -0
  63. package/dist/overlay/popper/hooks/use_context_trigger.d.ts +7 -0
  64. package/dist/overlay/popper/hooks/use_context_trigger.d.ts.map +1 -0
  65. package/dist/overlay/popper/hooks/use_context_trigger.js +31 -0
  66. package/dist/overlay/popper/hooks/use_context_trigger.js.map +1 -0
  67. package/dist/overlay/popper/hooks/use_hover_trigger.d.ts +6 -0
  68. package/dist/overlay/popper/hooks/use_hover_trigger.d.ts.map +1 -0
  69. package/dist/overlay/popper/hooks/use_hover_trigger.js +17 -0
  70. package/dist/overlay/popper/hooks/use_hover_trigger.js.map +1 -0
  71. package/dist/overlay/popper/hooks/use_restore_focus.d.ts +2 -0
  72. package/dist/overlay/popper/hooks/use_restore_focus.d.ts.map +1 -0
  73. package/dist/overlay/popper/hooks/use_restore_focus.js +18 -0
  74. package/dist/overlay/popper/hooks/use_restore_focus.js.map +1 -0
  75. package/dist/overlay/popper/legacy/popper.d.ts.map +1 -0
  76. package/dist/overlay/popper/{popper.js → legacy/popper.js} +6 -6
  77. package/dist/overlay/popper/legacy/popper.js.map +1 -0
  78. package/dist/overlay/popper/preview_popper.d.ts +7 -0
  79. package/dist/overlay/popper/preview_popper.d.ts.map +1 -0
  80. package/dist/overlay/popper/preview_popper.js +46 -0
  81. package/dist/overlay/popper/preview_popper.js.map +1 -0
  82. package/dist/overlay/tethered/element_tethered.d.ts +8 -0
  83. package/dist/overlay/tethered/element_tethered.d.ts.map +1 -0
  84. package/dist/overlay/tethered/element_tethered.js +33 -0
  85. package/dist/overlay/tethered/element_tethered.js.map +1 -0
  86. package/dist/overlay/tethered/hooks/calculate_position.d.ts +19 -0
  87. package/dist/overlay/tethered/hooks/calculate_position.d.ts.map +1 -0
  88. package/dist/overlay/tethered/hooks/calculate_position.js +43 -0
  89. package/dist/overlay/tethered/hooks/calculate_position.js.map +1 -0
  90. package/dist/overlay/tethered/hooks/useTether.d.ts +19 -0
  91. package/dist/overlay/tethered/hooks/useTether.d.ts.map +1 -0
  92. package/dist/overlay/tethered/hooks/useTether.js +61 -0
  93. package/dist/overlay/tethered/hooks/useTether.js.map +1 -0
  94. package/dist/overlay/tethered/tethered.d.ts +20 -0
  95. package/dist/overlay/tethered/tethered.d.ts.map +1 -0
  96. package/dist/overlay/tethered/tethered.js +59 -0
  97. package/dist/overlay/tethered/tethered.js.map +1 -0
  98. package/dist/overlay/tethered/types.d.ts +3 -0
  99. package/dist/overlay/tethered/types.d.ts.map +1 -0
  100. package/dist/overlay/tethered/types.js +2 -0
  101. package/dist/overlay/tethered/types.js.map +1 -0
  102. package/dist/popper.css +1 -1
  103. package/dist/scaffold.css +1 -0
  104. package/dist/stacks/box/box.js +1 -1
  105. package/dist/stacks/h_collapsible_box.js +1 -1
  106. package/dist/stacks/v_collapsible_box.js +1 -1
  107. package/dist/surfaces/card/card.d.ts +2 -2
  108. package/dist/surfaces/card/card.d.ts.map +1 -1
  109. package/dist/surfaces/card/card.js +7 -7
  110. package/dist/surfaces/card/card.js.map +1 -1
  111. package/dist/surfaces/index.d.ts +2 -0
  112. package/dist/surfaces/index.d.ts.map +1 -1
  113. package/dist/surfaces/index.js +22 -18
  114. package/dist/surfaces/index.js.map +1 -1
  115. package/dist/surfaces/modal/modal.d.ts +3 -3
  116. package/dist/surfaces/modal/modal.d.ts.map +1 -1
  117. package/dist/surfaces/modal/modal.js +14 -14
  118. package/dist/surfaces/modal/modal.js.map +1 -1
  119. package/dist/surfaces/panel/h_panel.js +23 -24
  120. package/dist/surfaces/panel/h_panel.js.map +1 -1
  121. package/dist/surfaces/panel/v_panel.d.ts +3 -7
  122. package/dist/surfaces/panel/v_panel.d.ts.map +1 -1
  123. package/dist/surfaces/panel/v_panel.js +12 -54
  124. package/dist/surfaces/panel/v_panel.js.map +1 -1
  125. package/dist/surfaces/pop_confirm/pop_confirm.d.ts +5 -0
  126. package/dist/surfaces/pop_confirm/pop_confirm.d.ts.map +1 -0
  127. package/dist/surfaces/pop_confirm/pop_confirm.js +37 -0
  128. package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -0
  129. package/dist/surfaces/popconfirm/pop_confirm.d.ts +5 -0
  130. package/dist/surfaces/popconfirm/pop_confirm.d.ts.map +1 -0
  131. package/dist/surfaces/popconfirm/pop_confirm.js +13 -0
  132. package/dist/surfaces/popconfirm/pop_confirm.js.map +1 -0
  133. package/dist/surfaces/popover/popover.d.ts +1 -1
  134. package/dist/surfaces/popover/popover.d.ts.map +1 -1
  135. package/dist/surfaces/popover/popover.js +1 -1
  136. package/dist/surfaces/popover/popover.js.map +1 -1
  137. package/dist/surfaces/tooltip/tooltip.d.ts +10 -0
  138. package/dist/surfaces/tooltip/tooltip.d.ts.map +1 -0
  139. package/dist/surfaces/tooltip/tooltip.js +38 -0
  140. package/dist/surfaces/tooltip/tooltip.js.map +1 -0
  141. package/dist/surfaces/window/window.d.ts +3 -3
  142. package/dist/surfaces/window/window.d.ts.map +1 -1
  143. package/dist/surfaces/window/window.js +16 -14
  144. package/dist/surfaces/window/window.js.map +1 -1
  145. package/dist/tethered.css +1 -0
  146. package/dist/themes/themes/ergo/ergo_theme.js +144 -205
  147. package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
  148. package/dist/tooltip.css +1 -1
  149. package/dist/utility_bar.css +1 -1
  150. package/dist/utils/click_away_listener.d.ts +1 -0
  151. package/dist/utils/click_away_listener.d.ts.map +1 -1
  152. package/dist/utils/click_away_listener.js +2 -1
  153. package/dist/utils/click_away_listener.js.map +1 -1
  154. package/dist/utils/index.d.ts +6 -5
  155. package/dist/utils/index.d.ts.map +1 -1
  156. package/dist/utils/index.js +26 -23
  157. package/dist/utils/index.js.map +1 -1
  158. package/dist/utils/mouse_leave_region.d.ts +8 -0
  159. package/dist/utils/mouse_leave_region.d.ts.map +1 -0
  160. package/dist/utils/mouse_leave_region.js +26 -0
  161. package/dist/utils/mouse_leave_region.js.map +1 -0
  162. package/dist/utils/types/dimensions.d.ts +11 -1
  163. package/dist/utils/types/dimensions.d.ts.map +1 -1
  164. package/package.json +3 -3
  165. package/src/inputs/color_input/color_input.tsx +1 -1
  166. package/src/inputs/date_picker/date_picker_input.tsx +1 -1
  167. package/src/inputs/date_picker/date_picker_year_input.tsx +1 -1
  168. package/src/inputs/suggestions/suggestion_list.tsx +1 -1
  169. package/src/layouts/index.ts +7 -5
  170. package/src/layouts/scaffold/scaffold.module.css +5 -0
  171. package/src/layouts/scaffold/scaffold.tsx +60 -0
  172. package/src/layouts/utility_bar/utility_bar.module.css +0 -3
  173. package/src/overlay/frame/frame.module.css +5 -0
  174. package/src/overlay/frame/frame.stories.tsx +1 -1
  175. package/src/overlay/frame/frame.tsx +19 -3
  176. package/src/overlay/index.ts +29 -2
  177. package/src/overlay/menu/menu.tsx +1 -1
  178. package/src/overlay/popper/__stories__/base_args.ts +75 -0
  179. package/src/overlay/popper/__stories__/context_popper.stories.tsx +77 -0
  180. package/src/overlay/popper/__stories__/element_popper.stories.tsx +80 -0
  181. package/src/overlay/popper/__stories__/preview_popper.stories.tsx +73 -0
  182. package/src/overlay/popper/base/base_popper.tsx +55 -0
  183. package/src/overlay/popper/base/dismissal_decorator.tsx +80 -0
  184. package/src/overlay/popper/context_popper.tsx +43 -0
  185. package/src/overlay/popper/element_popper.tsx +42 -0
  186. package/src/overlay/popper/hooks/use_context_trigger.ts +50 -0
  187. package/src/overlay/popper/hooks/use_hover_trigger.ts +24 -0
  188. package/src/overlay/popper/hooks/use_restore_focus.ts +16 -0
  189. package/src/overlay/popper/{popper.stories.tsx → legacy/popper.stories.tsx} +11 -5
  190. package/src/overlay/popper/{popper.tsx → legacy/popper.tsx} +3 -2
  191. package/src/overlay/popper/preview_popper.tsx +54 -0
  192. package/src/overlay/tethered/__stories__/element/element_tethered.stories.tsx +57 -0
  193. package/src/overlay/tethered/__stories__/element/element_tethered_stories.module.css +14 -0
  194. package/src/overlay/tethered/__stories__/shared/base_story_config.ts +52 -0
  195. package/src/overlay/tethered/__stories__/shared/components/sb_point.module.css +20 -0
  196. package/src/overlay/tethered/__stories__/shared/components/sb_point.tsx +34 -0
  197. package/src/overlay/tethered/__stories__/shared/components/sb_reference_points.tsx +54 -0
  198. package/src/overlay/tethered/__stories__/tethered/tethered.stories.tsx +90 -0
  199. package/src/overlay/tethered/__stories__/tethered/tethered_stories.module.css +25 -0
  200. package/src/overlay/tethered/element_tethered.tsx +62 -0
  201. package/src/overlay/tethered/hooks/calculate_position.ts +110 -0
  202. package/src/overlay/tethered/hooks/useTether.ts +85 -0
  203. package/src/overlay/tethered/tethered.module.css +8 -0
  204. package/src/overlay/tethered/tethered.tsx +72 -0
  205. package/src/overlay/tethered/types.ts +2 -0
  206. package/src/stacks/h_stack.stories.tsx +2 -2
  207. package/src/stacks/v_stack.stories.tsx +2 -2
  208. package/src/surfaces/card/card.stories.tsx +64 -0
  209. package/src/surfaces/card/card.tsx +4 -4
  210. package/src/surfaces/card/card_stories.module.css +13 -0
  211. package/src/surfaces/index.ts +2 -0
  212. package/src/surfaces/modal/__stories__/modal.stories.tsx +12 -1
  213. package/src/surfaces/modal/modal.module.css +2 -2
  214. package/src/surfaces/modal/modal.tsx +14 -12
  215. package/src/surfaces/panel/__stories__/panel.stories.tsx +1 -1
  216. package/src/surfaces/panel/v_panel.tsx +8 -53
  217. package/src/surfaces/pop_confirm/pop_confirm.stories.tsx +70 -0
  218. package/src/surfaces/pop_confirm/pop_confirm.tsx +30 -0
  219. package/src/surfaces/popconfirm/pop_confirm.tsx +18 -0
  220. package/src/surfaces/popover/popover.tsx +1 -1
  221. package/src/surfaces/tooltip/tooltip.stories.tsx +54 -0
  222. package/src/surfaces/tooltip/tooltip.tsx +59 -0
  223. package/src/surfaces/window/window.stories.tsx +15 -1
  224. package/src/surfaces/window/window.tsx +16 -12
  225. package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +7 -9
  226. package/src/themes/themes/ergo/__stories__/material.stories.tsx +2 -6
  227. package/src/themes/themes/ergo/__stories__/sb_materials.module.css +29 -21
  228. package/src/themes/themes/ergo/ergo_theme.css +144 -205
  229. package/src/utils/click_away_listener.tsx +1 -1
  230. package/src/utils/index.ts +7 -5
  231. package/src/utils/mouse_leave_region.tsx +38 -0
  232. package/src/utils/types/dimensions.ts +13 -1
  233. package/tsconfig.json +3 -0
  234. package/dist/overlay/popper/popper.d.ts.map +0 -1
  235. package/dist/overlay/popper/popper.js.map +0 -1
  236. package/dist/overlay/tooltip/tooltip.d.ts +0 -7
  237. package/dist/overlay/tooltip/tooltip.d.ts.map +0 -1
  238. package/dist/overlay/tooltip/tooltip.js +0 -20
  239. package/dist/overlay/tooltip/tooltip.js.map +0 -1
  240. package/dist/panel.module-DwGKncon.js +0 -5
  241. package/dist/panel.module-DwGKncon.js.map +0 -1
  242. package/src/overlay/tooltip/tooltip.stories.tsx +0 -22
  243. package/src/overlay/tooltip/tooltip.tsx +0 -24
  244. /package/dist/{panel.css → h_panel.css} +0 -0
  245. /package/dist/overlay/popper/{popper.d.ts → legacy/popper.d.ts} +0 -0
  246. /package/src/overlay/popper/{popper.module.css → legacy/popper.module.css} +0 -0
  247. /package/src/{overlay → surfaces}/tooltip/tooltip.module.css +0 -0
@@ -80,7 +80,7 @@ const meta: Meta<HStackProps> = {
80
80
 
81
81
  export default meta;
82
82
 
83
- export function HStack(props: HStackProps) {
83
+ export function SB_HStack(props: HStackProps) {
84
84
  return (
85
85
  <StyleBox border="1px dashed #ccc" backgroundColor="white">
86
86
  <HStackComponent {...props}>
@@ -99,7 +99,7 @@ export function HStack(props: HStackProps) {
99
99
  );
100
100
  }
101
101
 
102
- HStack.storyName = 'HStack';
102
+ SB_HStack.storyName = 'HStack';
103
103
 
104
104
  export function ManyChildren(props: HStackProps) {
105
105
  return (
@@ -80,7 +80,7 @@ const meta: Meta<VStackProps> = {
80
80
 
81
81
  export default meta;
82
82
 
83
- export function VStack(props: VStackProps) {
83
+ export function SBVStack(props: VStackProps) {
84
84
  return (
85
85
  <StyleBox
86
86
  borderLeft="1px dashed #ccc"
@@ -102,7 +102,7 @@ export function VStack(props: VStackProps) {
102
102
  );
103
103
  }
104
104
 
105
- VStack.storyName = 'VStack';
105
+ SBVStack.storyName = 'VStack';
106
106
 
107
107
  export function Padding() {
108
108
  return (
@@ -0,0 +1,64 @@
1
+ import { BugIcon } from '@tcn/icons/bug_icon.js';
2
+ import { GridOneIcon } from '@tcn/icons/grid_one_icon.js';
3
+ import { Header } from '../../layouts/header/header.js';
4
+ import { VBody } from '../../layouts/body/v_body.js';
5
+ import { UtilityBar } from '../../layouts/utility_bar/utility_bar.js';
6
+ import { Box, Spacer } from '../../stacks/index.js';
7
+ import { Title } from '../../typography/title/title.js';
8
+ import { SlimButton } from '../../actions/index.js';
9
+ import { Card } from './card.js';
10
+
11
+ // Styles
12
+ import styles from './card_stories.module.css';
13
+
14
+ export default {
15
+ title: 'Surfaces/Card',
16
+ component: Card,
17
+ tags: ['autodocs'],
18
+ };
19
+
20
+ export const Default = () => {
21
+ return (
22
+ <div className={styles['stories-container']}>
23
+ <Card maxHeight="400px">
24
+ <Header>
25
+ <Title>Card Header</Title>
26
+ <Spacer />
27
+ <SlimButton hierarchy="tertiary">
28
+ <GridOneIcon />
29
+ </SlimButton>
30
+ <SlimButton hierarchy="tertiary">
31
+ <GridOneIcon />
32
+ </SlimButton>
33
+ </Header>
34
+ <UtilityBar>
35
+ <Title>Utility Bar</Title>
36
+ <Spacer />
37
+ <SlimButton hierarchy="tertiary">
38
+ <BugIcon />
39
+ </SlimButton>
40
+ <SlimButton hierarchy="tertiary">
41
+ <BugIcon />
42
+ </SlimButton>
43
+ <SlimButton size="md" hierarchy="tertiary">
44
+ <BugIcon />
45
+ </SlimButton>
46
+ <SlimButton hierarchy="tertiary">
47
+ <BugIcon />
48
+ </SlimButton>
49
+ </UtilityBar>
50
+
51
+ <VBody>
52
+ <Box className={styles['content-box']} />
53
+ </VBody>
54
+ {/* Cards typically do not have a footer */}
55
+ {/* <Footer>
56
+ <Title>Footer</Title>
57
+ <Spacer />
58
+ <Button hierarchy="secondary">Secondary</Button>
59
+ <Button hierarchy="primary">Primary</Button>
60
+ </Footer> */}
61
+ </Card>
62
+ </div>
63
+ );
64
+ };
@@ -1,8 +1,8 @@
1
- import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
1
  import { clsx } from 'clsx';
3
2
  import React from 'react';
3
+ import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
4
4
 
5
- export interface CardProps extends Omit<VStackProps, 'as' | 'children'> {
5
+ export interface CardProps extends Omit<ScaffoldProps, 'as' | 'children'> {
6
6
  children?: React.ReactNode;
7
7
  }
8
8
 
@@ -11,8 +11,8 @@ export const Card = React.forwardRef<HTMLElement, CardProps>(function Card(
11
11
  ref
12
12
  ) {
13
13
  return (
14
- <VStack ref={ref} as="section" className={clsx(className, 'tcn-card')} {...props}>
14
+ <Scaffold ref={ref} className={clsx(className, 'tcn-surface', 'tcn-card')} {...props}>
15
15
  {children}
16
- </VStack>
16
+ </Scaffold>
17
17
  );
18
18
  });
@@ -0,0 +1,13 @@
1
+ .content-box {
2
+ background: rgba(0, 128, 0, 0.5);
3
+ min-height: 200px;
4
+ width: 100%;
5
+ }
6
+
7
+ .stories-container {
8
+ width: 100%;
9
+ height: 100%;
10
+ padding: 16px;
11
+ background-color: #ccc;
12
+ overflow: auto;
13
+ }
@@ -12,3 +12,5 @@ export * from './drawers/drawer_start/drawer_start.js';
12
12
  export * from './drawers/drawer_end/drawer_end.js';
13
13
  export { Window, type WindowProps } from './window/window.js';
14
14
  export { Modal, type ModalProps } from './modal/modal.js';
15
+ export { Tooltip, type TooltipProps } from './tooltip/tooltip.js';
16
+ export { PopConfirm, type PopConfirmProps } from './pop_confirm/pop_confirm.js';
@@ -1,11 +1,12 @@
1
1
  import { useState } from 'react';
2
2
  import { Button, SlimButton } from '../../../actions/index.js';
3
- import { Footer, Header, VBody } from '../../../layouts/index.js';
3
+ import { Footer, Header, UtilityBar, VBody } from '../../../layouts/index.js';
4
4
  import { ZStack } from '../../../stacks/z_stack.js';
5
5
  import { BodyText, Title } from '../../../typography/index.js';
6
6
  import { Modal } from '../modal.js';
7
7
  import { Spacer } from '../../../stacks/index.js';
8
8
  import { CrossIcon } from '@tcn/icons/cross_icon.js';
9
+ import { BugIcon } from '@tcn/icons/bug_icon.js';
9
10
 
10
11
  export default {
11
12
  title: 'Surfaces/Modal',
@@ -32,6 +33,16 @@ export const ModalStory = () => {
32
33
  <CrossIcon />
33
34
  </SlimButton>
34
35
  </Header>
36
+ <UtilityBar>
37
+ <Title>Utility Bar</Title>
38
+ <Spacer />
39
+ <SlimButton hierarchy="tertiary">
40
+ <BugIcon />
41
+ </SlimButton>
42
+ <SlimButton hierarchy="tertiary">
43
+ <BugIcon />
44
+ </SlimButton>
45
+ </UtilityBar>
35
46
  <VBody>
36
47
  <BodyText>This is a modal</BodyText>
37
48
  </VBody>
@@ -1,4 +1,4 @@
1
1
  .modal {
2
- width: 100%;
3
- height: 100%;
2
+ width: auto;
3
+ height: auto;
4
4
  }
@@ -1,25 +1,27 @@
1
- import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
1
  import { clsx } from 'clsx';
3
2
  import React from 'react';
4
- import styles from './modal.module.css';
5
3
  import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
4
+ import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
5
+
6
+ // Styles
7
+ import styles from './modal.module.css';
6
8
 
7
- export type ModalProps = FrameOwnProps & Omit<VStackProps<HTMLDialogElement>, 'as'>;
9
+ export type ModalProps = FrameOwnProps & ScaffoldProps;
8
10
 
9
- export const Modal = React.forwardRef<HTMLDialogElement, ModalProps>(function Modal(
11
+ export const Modal = React.forwardRef<HTMLElement, ModalProps>(function Modal(
10
12
  { children, className, isOpen, draggable = false, veil = true, ...props }: ModalProps,
11
13
  ref
12
14
  ) {
13
15
  return (
14
- <Frame isOpen={isOpen} draggable={draggable} veil={veil}>
15
- <VStack
16
- ref={ref}
17
- className={clsx(styles['modal'], 'tcn-modal', className)}
18
- as="dialog"
19
- {...props}
20
- >
16
+ <Frame
17
+ isOpen={isOpen}
18
+ draggable={draggable}
19
+ veil={veil}
20
+ className={clsx(styles['modal'], 'tcn-surface', 'tcn-modal', className)}
21
+ >
22
+ <Scaffold ref={ref} {...props}>
21
23
  {children}
22
- </VStack>
24
+ </Scaffold>
23
25
  </Frame>
24
26
  );
25
27
  });
@@ -24,7 +24,7 @@ export const Default = () => {
24
24
  <div className={styles['stories-container']}>
25
25
  <VPanel maxHeight="600px">
26
26
  <Header>
27
- <Title>Panel Primary Header</Title>
27
+ <Title emphasis="strong">Panel Primary Header</Title>
28
28
  <Spacer />
29
29
  <SlimButton hierarchy="tertiary">
30
30
  <GridOneIcon />
@@ -1,65 +1,20 @@
1
1
  import React from 'react';
2
- import { clsx } from 'clsx';
3
- import { Box, type BoxProps } from '../../stacks/box/box.js';
4
- import type { Alignment } from '../../stacks/types/alignment.js';
5
- import { VStack } from '../../stacks/v_stack.js';
6
- // Styles
7
- import styles from './panel.module.css';
2
+ import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
3
+ import clsx from 'clsx';
8
4
 
9
- export interface VPanelProps extends Omit<BoxProps, 'as'> {
10
- vAlign?: Alignment;
11
- hAlign?: Alignment;
12
- }
5
+ export type VPanelProps = ScaffoldProps;
13
6
 
14
7
  export const VPanel = React.forwardRef<HTMLElement, VPanelProps>(function VPanel(
15
- {
16
- children,
17
- width,
18
- height = '100%',
19
- minWidth,
20
- maxWidth,
21
- minHeight,
22
- maxHeight,
23
- hAlign,
24
- vAlign = 'start',
25
- className,
26
- ...props
27
- }: VPanelProps,
8
+ { children, className, ...props }: VPanelProps,
28
9
  ref
29
10
  ) {
30
11
  return (
31
- <Box
12
+ <Scaffold
32
13
  ref={ref}
33
- width={width}
34
- height={height}
35
- minWidth={minWidth}
36
- maxWidth={maxWidth}
37
- minHeight={minHeight}
38
- maxHeight={maxHeight}
39
- data-h-alignment={hAlign}
40
- data-v-alignment={vAlign}
41
- className={clsx(className, 'panel', 'tcn-panel', 'tcn-v-panel')}
14
+ className={clsx('tcn-surface', 'tcn-panel', 'tcn-v-panel', className)}
42
15
  {...props}
43
16
  >
44
- <VStack
45
- as="section"
46
- minWidth={minWidth}
47
- maxWidth={maxWidth}
48
- minHeight={minHeight}
49
- maxHeight={maxHeight}
50
- hAlign={hAlign}
51
- vAlign={vAlign}
52
- ref={ref}
53
- className={clsx(
54
- styles['panel-stack'],
55
- className,
56
- 'panel-stack',
57
- 'tcn-panel-stack'
58
- )}
59
- zIndex={0}
60
- >
61
- {children}
62
- </VStack>
63
- </Box>
17
+ {children}
18
+ </Scaffold>
64
19
  );
65
20
  });
@@ -0,0 +1,70 @@
1
+ import { useRef, useState } from 'react';
2
+ import { Button } from '../../actions/index.js';
3
+ import { Footer, Header, VBody } from '../../layouts/index.js';
4
+ import { HStack } from '../../stacks/h_stack.js';
5
+ import { PopConfirm as PopConfirmComponent } from './pop_confirm.js';
6
+ import { BodyText, Title } from '../../typography/index.js';
7
+ import { VStack } from '../../stacks/v_stack.js';
8
+ import { Spacer } from '../../stacks/spacer.js';
9
+
10
+ export default {
11
+ title: 'Surfaces/Pop Confirm',
12
+ component: PopConfirmComponent,
13
+ tags: ['autodocs'],
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: 'A tooltip component that displays a tooltip when hovered.',
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ export const DefaultPopConfirm = () => {
24
+ const anchorRef = useRef<HTMLButtonElement>(null);
25
+ const [open, setOpen] = useState(false);
26
+
27
+ const cancel = () => {
28
+ setOpen(false);
29
+ };
30
+
31
+ const confirm = () => {
32
+ setOpen(false);
33
+ };
34
+
35
+ const prompt = () => {
36
+ setOpen(true);
37
+ };
38
+
39
+ return (
40
+ <VStack hAlign="center" vAlign="center" height="100%" width="100%">
41
+ <HStack hAlign="center" vAlign="center">
42
+ <Button ref={anchorRef} onClick={prompt}>
43
+ Click to Confirm
44
+ </Button>
45
+ <PopConfirmComponent
46
+ height={'200px'}
47
+ open={open}
48
+ onDismissal={cancel}
49
+ anchorElement={anchorRef}
50
+ >
51
+ <Header>
52
+ <Title>Confirmation Title</Title>
53
+ </Header>
54
+ <VBody>
55
+ <BodyText>Are you sure you want to confirm this action?</BodyText>
56
+ </VBody>
57
+ <Footer>
58
+ <Spacer />
59
+ <Button hierarchy="secondary" onClick={cancel}>
60
+ Cancel
61
+ </Button>
62
+ <Button hierarchy="primary" onClick={confirm}>
63
+ Confirm
64
+ </Button>
65
+ </Footer>
66
+ </PopConfirmComponent>
67
+ </HStack>
68
+ </VStack>
69
+ );
70
+ };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { clsx } from 'clsx';
3
+ import {
4
+ ElementPopper,
5
+ type ElementPopperProps,
6
+ } from '../../overlay/popper/element_popper.js';
7
+ import { Scaffold } from '../../layouts/index.js';
8
+ import { PopperDismissal } from '../../overlay/popper/base/dismissal_decorator.js';
9
+
10
+ export type PopConfirmProps = ElementPopperProps;
11
+
12
+ export const PopConfirm = React.forwardRef<HTMLDivElement, PopConfirmProps>(
13
+ function PopConfirm(
14
+ { children, className, dismissals = [PopperDismissal.CLICK_AWAY], ...props },
15
+ ref
16
+ ) {
17
+ return (
18
+ <ElementPopper
19
+ ref={ref}
20
+ className={clsx(className, 'tcn-pop-confirm')}
21
+ dismissals={dismissals}
22
+ {...props}
23
+ >
24
+ <Scaffold width={'100%'} height={'100%'}>
25
+ {children}
26
+ </Scaffold>
27
+ </ElementPopper>
28
+ );
29
+ }
30
+ );
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { clsx } from 'clsx';
3
+ import {
4
+ ElementPopper,
5
+ type ElementPopperProps,
6
+ } from '../../overlay/popper/element_popper.js';
7
+
8
+ export type PopConfirmProps = ElementPopperProps;
9
+
10
+ export const PopConfirm = React.forwardRef<HTMLDivElement, PopConfirmProps>(
11
+ function PopConfirm({ children, className, ...props }, ref) {
12
+ return (
13
+ <ElementPopper ref={ref} className={clsx(className, 'tcn-popconfirm')} {...props}>
14
+ {children}
15
+ </ElementPopper>
16
+ );
17
+ }
18
+ );
@@ -1,6 +1,6 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { VStack } from '../../stacks/v_stack.js';
3
- import { Popper, type PopperProps } from '../../overlay/popper/popper.js';
3
+ import { Popper, type PopperProps } from '../../overlay/popper/legacy/popper.js';
4
4
  import { VStackProps } from '../../stacks/v_stack.js';
5
5
 
6
6
  export interface PopoverProps extends Omit<PopperProps, 'children'>, VStackProps {}
@@ -0,0 +1,54 @@
1
+ import { StyleBox } from '../../stacks/story_components/style_box.js';
2
+ import { BodyText } from '../../typography/index.js';
3
+ import { Tooltip as TooltipComponent } from './tooltip.js';
4
+
5
+ export default {
6
+ title: 'Surfaces/Tooltip',
7
+ component: TooltipComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: 'A tooltip component that displays a tooltip when hovered.',
13
+ },
14
+ },
15
+ },
16
+ };
17
+
18
+ export const DefaultTooltip = () => {
19
+ return (
20
+ <TooltipComponent label={'Tooltip content'}>
21
+ <StyleBox
22
+ backgroundColor="red"
23
+ padding="8px"
24
+ borderRadius={'8px'}
25
+ width="200px"
26
+ height="100px"
27
+ display="flex"
28
+ justifyContent="center"
29
+ alignItems="center"
30
+ >
31
+ Hover to open
32
+ </StyleBox>
33
+ </TooltipComponent>
34
+ );
35
+ };
36
+
37
+ export const CustomTooltip = () => {
38
+ return (
39
+ <TooltipComponent label={<BodyText>Tooltip content</BodyText>}>
40
+ <StyleBox
41
+ backgroundColor="red"
42
+ padding="8px"
43
+ borderRadius={'8px'}
44
+ width="200px"
45
+ height="100px"
46
+ display="flex"
47
+ justifyContent="center"
48
+ alignItems="center"
49
+ >
50
+ Hover to open
51
+ </StyleBox>
52
+ </TooltipComponent>
53
+ );
54
+ };
@@ -0,0 +1,59 @@
1
+ import { clsx } from 'clsx';
2
+ import React, { isValidElement, cloneElement, useRef } from 'react';
3
+ import styles from './tooltip.module.css';
4
+ import {
5
+ PreviewPopper,
6
+ type PreviewPopperProps,
7
+ } from '../../overlay/popper/preview_popper.js';
8
+ import { HStack } from '../../stacks/h_stack.js';
9
+
10
+ export interface TooltipProps extends Omit<PreviewPopperProps, 'anchorElement'> {
11
+ /** The element that triggers the tooltip on hover */
12
+ children: React.ReactNode;
13
+ /** Content to display in the tooltip */
14
+ label: React.ReactNode;
15
+ }
16
+
17
+ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(function Tooltip(
18
+ {
19
+ children,
20
+ className,
21
+ verticalAnchor = 'top',
22
+ verticalOrigin = 'bottom',
23
+ horizontalAnchor = 'center',
24
+ horizontalOrigin = 'center',
25
+ label,
26
+ ...props
27
+ },
28
+ ref
29
+ ) {
30
+ const anchorRef = useRef<HTMLElement>(null);
31
+
32
+ // If children is a valid element, clone it and attach the ref
33
+ // Otherwise, wrap it in a span
34
+ const anchor = isValidElement(children) ? (
35
+ cloneElement(children, { ref: anchorRef } as React.Attributes)
36
+ ) : (
37
+ <HStack as="span" ref={anchorRef}>
38
+ {children}
39
+ </HStack>
40
+ );
41
+
42
+ return (
43
+ <>
44
+ {anchor}
45
+ <PreviewPopper
46
+ ref={ref}
47
+ anchorElement={anchorRef}
48
+ verticalAnchor={verticalAnchor}
49
+ verticalOrigin={verticalOrigin}
50
+ horizontalAnchor={horizontalAnchor}
51
+ horizontalOrigin={horizontalOrigin}
52
+ className={clsx(className, styles.tooltip, 'tcn-surface', 'tcn-tooltip')}
53
+ {...props}
54
+ >
55
+ {label}
56
+ </PreviewPopper>
57
+ </>
58
+ );
59
+ });
@@ -1,12 +1,13 @@
1
1
  import { useState } from 'react';
2
2
  import { Window } from './window.js';
3
- import { Footer, Header, VBody } from '../../layouts/index.js';
3
+ import { Footer, Header, UtilityBar, VBody } from '../../layouts/index.js';
4
4
  import { BodyText, Title } from '../../typography/index.js';
5
5
  import { Spacer } from '../../stacks/spacer.js';
6
6
  import { Button, SlimButton } from '../../actions/index.js';
7
7
  import { CrossIcon } from '@tcn/icons/cross_icon.js';
8
8
  import { ZStack } from '../../stacks/z_stack.js';
9
9
  import { DragHandle } from '../../utils/dnd/handle.js';
10
+ import { BugIcon } from '@tcn/icons/bug_icon.js';
10
11
 
11
12
  export default {
12
13
  title: 'Surfaces/Window',
@@ -34,6 +35,19 @@ export const WindowStory = () => {
34
35
  </SlimButton>
35
36
  </Header>
36
37
  </DragHandle>
38
+ <UtilityBar>
39
+ <Title>Utility Bar</Title>
40
+ <Spacer />
41
+ <SlimButton hierarchy="tertiary">
42
+ <BugIcon />
43
+ </SlimButton>
44
+ <SlimButton hierarchy="tertiary">
45
+ <BugIcon />
46
+ </SlimButton>
47
+ <SlimButton size="md" hierarchy="tertiary">
48
+ <BugIcon />
49
+ </SlimButton>
50
+ </UtilityBar>
37
51
  <VBody>
38
52
  <BodyText>This is a window</BodyText>
39
53
  </VBody>
@@ -1,25 +1,29 @@
1
- import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
1
  import { clsx } from 'clsx';
3
2
  import React from 'react';
4
- import styles from './window.module.css';
5
3
  import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
4
+ import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
5
+
6
+ // Styles
7
+ import styles from './window.module.css';
6
8
 
7
- export type WindowProps = FrameOwnProps & Omit<VStackProps<HTMLDialogElement>, 'as'>;
9
+ export type WindowProps = FrameOwnProps & ScaffoldProps;
8
10
 
9
- export const Window = React.forwardRef<HTMLDialogElement, WindowProps>(function Window(
11
+ export const Window = React.forwardRef<HTMLElement, WindowProps>(function Window(
10
12
  { children, className, isOpen, draggable = true, veil = false, ...props }: WindowProps,
11
13
  ref
12
14
  ) {
13
15
  return (
14
- <Frame isOpen={isOpen} draggable={draggable} veil={veil}>
15
- <VStack
16
- ref={ref}
17
- className={clsx(styles['window'], 'tcn-window', className)}
18
- as="dialog"
19
- {...props}
20
- >
16
+ <Frame
17
+ isOpen={isOpen}
18
+ draggable={draggable}
19
+ veil={veil}
20
+ className={clsx(styles['window'], 'tcn-surface', 'tcn-window', className)}
21
+ width="auto"
22
+ height="auto"
23
+ >
24
+ <Scaffold ref={ref} {...props}>
21
25
  {children}
22
- </VStack>
26
+ </Scaffold>
23
27
  </Frame>
24
28
  );
25
29
  });
@@ -48,22 +48,20 @@ export const SB_TonePicker = () => {
48
48
  growWeight={1}
49
49
  paddingTop={theme.padding.md}
50
50
  paddingBottom={theme.padding.md}
51
+ vAlign="start"
52
+ hAlign="start"
51
53
  >
52
54
  <VStack
53
55
  height="100%"
54
56
  width="auto"
55
57
  gap={theme.gap.md}
56
58
  hAlign="start"
57
- minWidth="300px"
59
+ vAlign="start"
60
+ maxWidth="300px"
61
+ minWidth="200px"
58
62
  >
59
63
  <SectionHeader>Tone Picker (WIP)</SectionHeader>
60
- <List
61
- padding={theme.padding.md}
62
- maxWidth="200px"
63
- growWeight={1}
64
- height="100%"
65
- overflowY="auto"
66
- >
64
+ <List padding={theme.padding.md} growWeight={1} height="100%" overflowY="auto">
67
65
  {items.map(item => (
68
66
  <Item
69
67
  key={item.id}
@@ -75,7 +73,7 @@ export const SB_TonePicker = () => {
75
73
  ))}
76
74
  </List>
77
75
  </VStack>
78
- <VStack height="100%">
76
+ <VStack height="100%" minWidth="200px" growWeight={1}>
79
77
  <SB_ToneCard item={selectedItem || null} />
80
78
  </VStack>
81
79
  </HStack>