@tcn/ui 0.0.4 → 0.2.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 (198) hide show
  1. package/README.md +38 -3
  2. package/dist/actions/button/base_button/base_button.d.ts.map +1 -1
  3. package/dist/actions/button/base_button/base_button.js +17 -12
  4. package/dist/actions/button/base_button/base_button.js.map +1 -1
  5. package/dist/actions/button/button/button.d.ts.map +1 -1
  6. package/dist/actions/button/button/button.js +7 -7
  7. package/dist/actions/button/button/button.js.map +1 -1
  8. package/dist/actions/button/slim_button/slim_button.js +2 -2
  9. package/dist/actions/button/slim_button/slim_button.js.map +1 -1
  10. package/dist/button.css +1 -1
  11. package/dist/draggable.css +1 -0
  12. package/dist/feedback/progress/progress_bar.js +1 -1
  13. package/dist/footer.css +1 -1
  14. package/dist/form/field/common/field_description.js +1 -1
  15. package/dist/form/field/common/field_error.js +4 -3
  16. package/dist/form/field/common/field_error.js.map +1 -1
  17. package/dist/form/field/common/field_label.js +1 -1
  18. package/dist/inputs/date_picker/date_picker_date.js +1 -1
  19. package/dist/inputs/date_picker/date_picker_day.js +1 -1
  20. package/dist/inputs/date_picker/date_picker_time_selector.js +1 -1
  21. package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
  22. package/dist/inputs/input/input.d.ts +2 -2
  23. package/dist/inputs/input/input.d.ts.map +1 -1
  24. package/dist/inputs/input/input.js.map +1 -1
  25. package/dist/inputs/options/option.d.ts +1 -0
  26. package/dist/inputs/options/option.d.ts.map +1 -1
  27. package/dist/inputs/options/option.js.map +1 -1
  28. package/dist/inputs/phone_number_input/phone_number_input.d.ts +8 -1
  29. package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
  30. package/dist/inputs/phone_number_input/phone_number_input.js +187 -137
  31. package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
  32. package/dist/inputs/suggestions/suggestion_item.d.ts +1 -1
  33. package/dist/inputs/suggestions/suggestion_item.d.ts.map +1 -1
  34. package/dist/inputs/suggestions/suggestion_item.js +23 -18
  35. package/dist/inputs/suggestions/suggestion_item.js.map +1 -1
  36. package/dist/inputs/suggestions/suggestion_list.d.ts +1 -1
  37. package/dist/inputs/suggestions/suggestion_list.d.ts.map +1 -1
  38. package/dist/inputs/suggestions/suggestion_list.js +106 -96
  39. package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
  40. package/dist/inputs/textarea/textarea.d.ts +2 -2
  41. package/dist/inputs/textarea/textarea.d.ts.map +1 -1
  42. package/dist/inputs/textarea/textarea.js.map +1 -1
  43. package/dist/layouts/footer/footer.js +5 -5
  44. package/dist/layouts/footer/footer.js.map +1 -1
  45. package/dist/layouts/header/header.d.ts.map +1 -1
  46. package/dist/layouts/header/header.js.map +1 -1
  47. package/dist/layouts/index.d.ts +3 -2
  48. package/dist/layouts/index.d.ts.map +1 -1
  49. package/dist/layouts/index.js +26 -24
  50. package/dist/layouts/index.js.map +1 -1
  51. package/dist/layouts/list/item.d.ts +1 -0
  52. package/dist/layouts/list/item.d.ts.map +1 -1
  53. package/dist/layouts/list/item.js +17 -6
  54. package/dist/layouts/list/item.js.map +1 -1
  55. package/dist/layouts/list/list.js +10 -10
  56. package/dist/layouts/list/list.js.map +1 -1
  57. package/dist/overlay/context_menu/context_menu.js +4 -4
  58. package/dist/overlay/frame/frame.d.ts +11 -0
  59. package/dist/overlay/frame/frame.d.ts.map +1 -0
  60. package/dist/overlay/frame/frame.js +18 -0
  61. package/dist/overlay/frame/frame.js.map +1 -0
  62. package/dist/overlay/index.d.ts +1 -0
  63. package/dist/overlay/index.d.ts.map +1 -1
  64. package/dist/overlay/index.js +5 -3
  65. package/dist/overlay/index.js.map +1 -1
  66. package/dist/overlay/popper/popper.js +12 -12
  67. package/dist/{portal-qqIp4SIl.js → overlay/portal/portal.js} +3 -3
  68. package/dist/overlay/portal/portal.js.map +1 -0
  69. package/dist/overlay/portal/portal_platform.js +3 -4
  70. package/dist/overlay/portal/portal_platform.js.map +1 -1
  71. package/dist/phone_number_input.css +1 -1
  72. package/dist/slim_button.css +1 -1
  73. package/dist/stacks/box/box.d.ts +1 -1
  74. package/dist/stacks/box/box.d.ts.map +1 -1
  75. package/dist/stacks/box/box.js.map +1 -1
  76. package/dist/surfaces/card/card.d.ts.map +1 -1
  77. package/dist/surfaces/card/card.js +7 -16
  78. package/dist/surfaces/card/card.js.map +1 -1
  79. package/dist/surfaces/confirm/confirm.js +4 -4
  80. package/dist/surfaces/index.d.ts +2 -2
  81. package/dist/surfaces/index.d.ts.map +1 -1
  82. package/dist/surfaces/index.js +22 -22
  83. package/dist/surfaces/modal/modal.d.ts +3 -2
  84. package/dist/surfaces/modal/modal.d.ts.map +1 -1
  85. package/dist/surfaces/modal/modal.js +14 -13
  86. package/dist/surfaces/modal/modal.js.map +1 -1
  87. package/dist/surfaces/window/window.d.ts +3 -2
  88. package/dist/surfaces/window/window.d.ts.map +1 -1
  89. package/dist/surfaces/window/window.js +17 -7
  90. package/dist/surfaces/window/window.js.map +1 -1
  91. package/dist/themes/index.js +6 -141
  92. package/dist/themes/index.js.map +1 -1
  93. package/dist/themes/stylesheets/reset.js +140 -0
  94. package/dist/themes/stylesheets/reset.js.map +1 -0
  95. package/dist/themes/themes/ergo/ergo_theme.js +664 -0
  96. package/dist/themes/themes/ergo/ergo_theme.js.map +1 -0
  97. package/dist/tokens/bubble/bubble.js +17 -16
  98. package/dist/tokens/bubble/bubble.js.map +1 -1
  99. package/dist/tokens/chip/chip.js +9 -8
  100. package/dist/tokens/chip/chip.js.map +1 -1
  101. package/dist/typography/title/title.d.ts +2 -1
  102. package/dist/typography/title/title.d.ts.map +1 -1
  103. package/dist/typography/title/title.js +24 -23
  104. package/dist/typography/title/title.js.map +1 -1
  105. package/dist/utils/dnd/context.d.ts +4 -0
  106. package/dist/utils/dnd/context.d.ts.map +1 -0
  107. package/dist/utils/dnd/context.js +20 -0
  108. package/dist/utils/dnd/context.js.map +1 -0
  109. package/dist/utils/dnd/draggable/draggable.d.ts +7 -0
  110. package/dist/utils/dnd/draggable/draggable.d.ts.map +1 -0
  111. package/dist/utils/dnd/draggable/draggable.js +27 -0
  112. package/dist/utils/dnd/draggable/draggable.js.map +1 -0
  113. package/dist/utils/dnd/handle.d.ts +6 -0
  114. package/dist/utils/dnd/handle.d.ts.map +1 -0
  115. package/dist/utils/dnd/handle.js +22 -0
  116. package/dist/utils/dnd/handle.js.map +1 -0
  117. package/dist/utils/dnd/hooks/use_drag_container.d.ts +7 -0
  118. package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -0
  119. package/dist/utils/dnd/hooks/use_drag_container.js +30 -0
  120. package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -0
  121. package/dist/utils/{hooks → dnd/hooks}/use_draggable.d.ts +3 -3
  122. package/dist/utils/dnd/hooks/use_draggable.d.ts.map +1 -0
  123. package/dist/utils/dnd/hooks/use_draggable.js +41 -0
  124. package/dist/utils/dnd/hooks/use_draggable.js.map +1 -0
  125. package/dist/utils/dnd/types.d.ts +10 -0
  126. package/dist/utils/dnd/types.d.ts.map +1 -0
  127. package/dist/utils/dnd/types.js +2 -0
  128. package/dist/utils/dnd/types.js.map +1 -0
  129. package/dist/utils/index.d.ts +1 -1
  130. package/dist/utils/index.d.ts.map +1 -1
  131. package/dist/utils/index.js +1 -1
  132. package/package.json +9 -3
  133. package/src/actions/button/base_button/base_button.tsx +7 -2
  134. package/src/actions/button/button/button.module.css +0 -78
  135. package/src/actions/button/button/button.tsx +2 -4
  136. package/src/actions/button/slim_button/slim_button.module.css +0 -26
  137. package/src/actions/button/slim_button/slim_button.tsx +1 -1
  138. package/src/inputs/input/input.tsx +3 -2
  139. package/src/inputs/options/option.tsx +1 -0
  140. package/src/inputs/phone_number_input/phone_number_input.module.css +12 -0
  141. package/src/inputs/phone_number_input/phone_number_input.stories.tsx +8 -0
  142. package/src/inputs/phone_number_input/phone_number_input.tsx +107 -21
  143. package/src/inputs/suggestions/suggestion_item.tsx +12 -2
  144. package/src/inputs/suggestions/suggestion_list.tsx +22 -3
  145. package/src/inputs/textarea/textarea.tsx +2 -2
  146. package/src/layouts/footer/footer.module.css +0 -1
  147. package/src/layouts/footer/footer.tsx +1 -1
  148. package/src/layouts/header/header.tsx +0 -1
  149. package/src/layouts/index.ts +3 -2
  150. package/src/layouts/list/item.tsx +10 -2
  151. package/src/layouts/list/list.tsx +2 -2
  152. package/src/overlay/frame/frame.stories.tsx +40 -0
  153. package/src/overlay/frame/frame.tsx +34 -0
  154. package/src/overlay/frame/frame_stories.module.css +14 -0
  155. package/src/overlay/index.ts +1 -0
  156. package/src/stacks/box/box.tsx +8 -2
  157. package/src/surfaces/card/card.tsx +2 -8
  158. package/src/surfaces/index.ts +2 -2
  159. package/src/surfaces/modal/__stories__/modal.stories.tsx +19 -27
  160. package/src/surfaces/modal/modal.tsx +13 -10
  161. package/src/surfaces/panel/__stories__/panel.stories.tsx +13 -12
  162. package/src/surfaces/window/window.stories.tsx +37 -4
  163. package/src/surfaces/window/window.tsx +14 -6
  164. package/src/themes/themes/ergo/__stories__/components/material_picker/sb_inverted_materials.module.css +34 -0
  165. package/src/themes/themes/ergo/__stories__/components/material_picker/sb_material_picker.tsx +52 -0
  166. package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_card.module.css +5 -0
  167. package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_card.tsx +40 -0
  168. package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +83 -0
  169. package/src/themes/themes/ergo/__stories__/components/tone_picker/types.ts +7 -0
  170. package/src/themes/themes/ergo/__stories__/material.stories.tsx +154 -0
  171. package/src/themes/themes/ergo/__stories__/sb_materials.module.css +110 -0
  172. package/src/themes/themes/ergo/__stories__/utils.ts +92 -0
  173. package/src/themes/themes/ergo/ergo_theme.css +358 -26
  174. package/src/typography/title/title.tsx +23 -19
  175. package/src/utils/dnd/__stories__/draggable.stories.tsx +48 -0
  176. package/src/utils/dnd/__stories__/draggable_stories.module.css +21 -0
  177. package/src/utils/{__stories__ → dnd/__stories__}/use_draggable.stories.tsx +15 -10
  178. package/src/utils/dnd/context.ts +24 -0
  179. package/src/utils/dnd/draggable/draggable.module.css +8 -0
  180. package/src/utils/dnd/draggable/draggable.tsx +42 -0
  181. package/src/utils/dnd/handle.tsx +32 -0
  182. package/src/utils/dnd/hooks/use_drag_container.ts +42 -0
  183. package/src/utils/{hooks → dnd/hooks}/use_draggable.ts +23 -17
  184. package/src/utils/dnd/types.ts +6 -0
  185. package/src/utils/index.ts +1 -1
  186. package/tsconfig.json +0 -3
  187. package/dist/card.css +0 -1
  188. package/dist/portal-qqIp4SIl.js.map +0 -1
  189. package/dist/themes/stylesheets/reset.css +0 -1
  190. package/dist/themes/themes/ergo/ergo_theme.css +0 -1
  191. package/dist/themes/themes/windows_98/windows_98.css +0 -1
  192. package/dist/title.module-B16de2jd.js +0 -5
  193. package/dist/title.module-B16de2jd.js.map +0 -1
  194. package/dist/utils/hooks/use_draggable.d.ts.map +0 -1
  195. package/dist/utils/hooks/use_draggable.js +0 -30
  196. package/dist/utils/hooks/use_draggable.js.map +0 -1
  197. package/src/surfaces/card/card.module.css +0 -5
  198. /package/dist/{overlay/portal/portal.css → portal_platform.css} +0 -0
@@ -0,0 +1,14 @@
1
+ .sb-frame-header {
2
+ background: var(--accent-color);
3
+ color: white;
4
+ font-weight: bold;
5
+ border: 2px solid black;
6
+ padding: var(--padding-medium);
7
+ border-radius: var(--shape-radius-medium);
8
+ }
9
+
10
+ .sb-frame-container {
11
+ background: #f7e9fe;
12
+ padding: var(--padding-medium);
13
+ border-radius: var(--shape-radius-large);
14
+ }
@@ -3,3 +3,4 @@ export * from './context_menu/context_menu.js';
3
3
  export * from './menu/menu.js';
4
4
  export * from './tooltip/tooltip.js';
5
5
  export * from './popper/popper.js';
6
+ export { Frame, type FrameOwnProps, type FrameProps } from './frame/frame.js';
@@ -45,8 +45,14 @@ export interface BoxProps extends HTMLAttributes<HTMLElement> {
45
45
  enableResizeOnRight?: boolean;
46
46
  horizontalHandleProps?: HandleProps;
47
47
  verticalHandleProps?: HandleProps;
48
- onWidthResize?: (width: number) => void;
49
- onHeightResize?: (width: number) => void;
48
+ onWidthResize?: (
49
+ width: number
50
+ // origin: 'left' | 'right'
51
+ ) => void;
52
+ onHeightResize?: (
53
+ height: number
54
+ // origin: 'top' | 'bottom'
55
+ ) => void;
50
56
  onWidthResizeEnd?: (width: number) => void;
51
57
  onHeightResizeEnd?: (width: number) => void;
52
58
  }
@@ -1,23 +1,17 @@
1
1
  import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
2
  import { clsx } from 'clsx';
3
3
  import React from 'react';
4
- import styles from './card.module.css';
5
4
 
6
5
  export interface CardProps extends Omit<VStackProps, 'as' | 'children'> {
7
6
  children?: React.ReactNode;
8
7
  }
9
8
 
10
- export const Card = React.forwardRef<HTMLElement, CardProps>(function VPanel(
9
+ export const Card = React.forwardRef<HTMLElement, CardProps>(function Card(
11
10
  { children, className, ...props }: CardProps,
12
11
  ref
13
12
  ) {
14
13
  return (
15
- <VStack
16
- ref={ref}
17
- as="section"
18
- className={clsx(className, styles.card, 'card')}
19
- {...props}
20
- >
14
+ <VStack ref={ref} as="section" className={clsx(className, 'tcn-card')} {...props}>
21
15
  {children}
22
16
  </VStack>
23
17
  );
@@ -1,14 +1,14 @@
1
1
  export * from './alert/alert.js';
2
2
  export * from './card/card.js';
3
3
  export * from './confirm/confirm.js';
4
- export * from './modal/modal.js';
5
4
  export * from './page/h_page.js';
6
5
  export * from './page/v_page.js';
7
6
  export * from './panel/h_panel.js';
8
7
  export * from './panel/v_panel.js';
9
8
  export * from './popover/popover.js';
10
- export * from './window/window.js';
11
9
  export * from './drawers/drawer_bottom/drawer_bottom.js';
12
10
  export * from './drawers/drawer_top/drawer_top.js';
13
11
  export * from './drawers/drawer_start/drawer_start.js';
14
12
  export * from './drawers/drawer_end/drawer_end.js';
13
+ export { Window, type WindowProps } from './window/window.js';
14
+ export { Modal, type ModalProps } from './modal/modal.js';
@@ -1,11 +1,9 @@
1
1
  import { useState } from 'react';
2
2
  import { Button, SlimButton } from '../../../actions/index.js';
3
3
  import { Footer, Header, VBody } from '../../../layouts/index.js';
4
- import { Portal } from '../../../overlay/index.js';
5
4
  import { ZStack } from '../../../stacks/z_stack.js';
6
5
  import { BodyText, Title } from '../../../typography/index.js';
7
6
  import { Modal } from '../modal.js';
8
- import { ClickAwayListener } from '../../../utils/index.js';
9
7
  import { Spacer } from '../../../stacks/index.js';
10
8
  import { CrossIcon } from '@tcn/icons/cross_icon.js';
11
9
 
@@ -21,34 +19,28 @@ export const ModalStory = () => {
21
19
  function toggle() {
22
20
  setIsOpen(!isOpen);
23
21
  }
22
+
24
23
  return (
25
24
  <ZStack height="100%" width="100%" minHeight="600px">
26
25
  <button onClick={toggle}>{isOpen ? 'Close' : 'Open'}</button>
27
- {isOpen && (
28
- <Portal>
29
- <ZStack width="100%" height="100%" className="tcn-veil">
30
- <ClickAwayListener onClickAway={toggle}>
31
- <Modal width="400px" height="500px">
32
- <Header>
33
- <Title>Modal Title</Title>
34
- <Spacer />
35
- <SlimButton hierarchy="tertiary" onClick={toggle}>
36
- <CrossIcon />
37
- </SlimButton>
38
- </Header>
39
- <VBody>
40
- <BodyText>This is a modal</BodyText>
41
- </VBody>
42
- <Footer>
43
- <Spacer />
44
- <Button hierarchy="secondary">Cancel</Button>
45
- <Button hierarchy="primary">Save</Button>
46
- </Footer>
47
- </Modal>
48
- </ClickAwayListener>
49
- </ZStack>
50
- </Portal>
51
- )}
26
+
27
+ <Modal isOpen={isOpen} width="400px" height="500px">
28
+ <Header>
29
+ <Title>Modal Title</Title>
30
+ <Spacer />
31
+ <SlimButton hierarchy="tertiary" size="md" onClick={toggle}>
32
+ <CrossIcon />
33
+ </SlimButton>
34
+ </Header>
35
+ <VBody>
36
+ <BodyText>This is a modal</BodyText>
37
+ </VBody>
38
+ <Footer>
39
+ <Spacer />
40
+ <Button hierarchy="secondary">Cancel</Button>
41
+ <Button hierarchy="primary">Save</Button>
42
+ </Footer>
43
+ </Modal>
52
44
  </ZStack>
53
45
  );
54
46
  };
@@ -2,21 +2,24 @@ import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
2
  import { clsx } from 'clsx';
3
3
  import React from 'react';
4
4
  import styles from './modal.module.css';
5
+ import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
5
6
 
6
- export type ModalProps = Omit<VStackProps<HTMLDialogElement>, 'as'>;
7
+ export type ModalProps = FrameOwnProps & Omit<VStackProps<HTMLDialogElement>, 'as'>;
7
8
 
8
9
  export const Modal = React.forwardRef<HTMLDialogElement, ModalProps>(function Modal(
9
- { children, className, ...props }: ModalProps,
10
+ { children, className, isOpen, draggable = false, veil = true, ...props }: ModalProps,
10
11
  ref
11
12
  ) {
12
13
  return (
13
- <VStack
14
- ref={ref}
15
- className={clsx(styles['modal'], 'tcn-modal', className)}
16
- as="dialog"
17
- {...props}
18
- >
19
- {children}
20
- </VStack>
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
+ >
21
+ {children}
22
+ </VStack>
23
+ </Frame>
21
24
  );
22
25
  });
@@ -11,6 +11,7 @@ import { Title } from '../../../typography/title/title.js';
11
11
  import { VPanel } from '../v_panel.js';
12
12
  // Styles
13
13
  import styles from './panel_stories.module.css';
14
+ import { SlimButton } from '../../../actions/index.js';
14
15
 
15
16
  export default {
16
17
  title: 'Surfaces/Panel',
@@ -25,29 +26,29 @@ export const Default = () => {
25
26
  <Header>
26
27
  <Title>Panel Primary Header</Title>
27
28
  <Spacer />
28
- <Button hierarchy="tertiary">
29
+ <SlimButton hierarchy="tertiary">
29
30
  <GridOneIcon />
30
- </Button>
31
+ </SlimButton>
31
32
  <Divider length="md" vertical />
32
- <Button hierarchy="tertiary">
33
+ <SlimButton hierarchy="tertiary">
33
34
  <CrossIcon />
34
- </Button>
35
+ </SlimButton>
35
36
  </Header>
36
37
  <UtilityBar>
37
38
  <Title>Utility Bar</Title>
38
39
  <Spacer />
39
- <Button hierarchy="tertiary">
40
+ <SlimButton hierarchy="tertiary">
40
41
  <BugIcon />
41
- </Button>
42
- <Button hierarchy="tertiary">
42
+ </SlimButton>
43
+ <SlimButton hierarchy="tertiary">
43
44
  <BugIcon />
44
- </Button>
45
- <Button hierarchy="tertiary">
45
+ </SlimButton>
46
+ <SlimButton size="md" hierarchy="tertiary">
46
47
  <BugIcon />
47
- </Button>
48
- <Button hierarchy="tertiary">
48
+ </SlimButton>
49
+ <SlimButton hierarchy="tertiary">
49
50
  <BugIcon />
50
- </Button>
51
+ </SlimButton>
51
52
  </UtilityBar>
52
53
 
53
54
  <VBody>
@@ -1,4 +1,12 @@
1
+ import { useState } from 'react';
1
2
  import { Window } from './window.js';
3
+ import { Footer, Header, VBody } from '../../layouts/index.js';
4
+ import { BodyText, Title } from '../../typography/index.js';
5
+ import { Spacer } from '../../stacks/spacer.js';
6
+ import { Button, SlimButton } from '../../actions/index.js';
7
+ import { CrossIcon } from '@tcn/icons/cross_icon.js';
8
+ import { ZStack } from '../../stacks/z_stack.js';
9
+ import { DragHandle } from '../../utils/dnd/handle.js';
2
10
 
3
11
  export default {
4
12
  title: 'Surfaces/Window',
@@ -6,10 +14,35 @@ export default {
6
14
  tags: ['autodocs'],
7
15
  };
8
16
 
9
- export const ModalStory = () => {
17
+ export const WindowStory = () => {
18
+ const [isOpen, setIsOpen] = useState(false);
19
+
20
+ function toggle() {
21
+ setIsOpen(!isOpen);
22
+ }
23
+
10
24
  return (
11
- <Window>
12
- <>window</>
13
- </Window>
25
+ <ZStack height="100%" width="100%" minHeight="600px">
26
+ <button onClick={toggle}>{isOpen ? 'Close' : 'Open'}</button>
27
+ <Window isOpen={isOpen} width="400px" height="500px">
28
+ <DragHandle>
29
+ <Header>
30
+ <Title>Window Title</Title>
31
+ <Spacer />
32
+ <SlimButton hierarchy="tertiary" size="md" onClick={toggle}>
33
+ <CrossIcon />
34
+ </SlimButton>
35
+ </Header>
36
+ </DragHandle>
37
+ <VBody>
38
+ <BodyText>This is a window</BodyText>
39
+ </VBody>
40
+ <Footer>
41
+ <Spacer />
42
+ <Button hierarchy="secondary">Cancel</Button>
43
+ <Button hierarchy="primary">Save</Button>
44
+ </Footer>
45
+ </Window>
46
+ </ZStack>
14
47
  );
15
48
  };
@@ -2,16 +2,24 @@ import { VStack, type VStackProps } from '../../stacks/v_stack.js';
2
2
  import { clsx } from 'clsx';
3
3
  import React from 'react';
4
4
  import styles from './window.module.css';
5
+ import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
5
6
 
6
- export type WindowProps = Omit<VStackProps, 'as'>;
7
+ export type WindowProps = FrameOwnProps & Omit<VStackProps<HTMLDialogElement>, 'as'>;
7
8
 
8
- export const Window = React.forwardRef<HTMLDivElement, WindowProps>(function Window(
9
- { children, className, ...props }: WindowProps,
9
+ export const Window = React.forwardRef<HTMLDialogElement, WindowProps>(function Window(
10
+ { children, className, isOpen, draggable = true, veil = false, ...props }: WindowProps,
10
11
  ref
11
12
  ) {
12
13
  return (
13
- <VStack ref={ref} className={clsx(styles.window, className, 'window')} {...props}>
14
- {children}
15
- </VStack>
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
+ >
21
+ {children}
22
+ </VStack>
23
+ </Frame>
16
24
  );
17
25
  });
@@ -0,0 +1,34 @@
1
+ .light-primary-inverted {
2
+ --action: var(--primary);
3
+ --on-action: var(--white);
4
+ --material: var(--white);
5
+ --on-material: var(--navy);
6
+ }
7
+
8
+ .light-secondary-inverted {
9
+ --action: var(--tan);
10
+ --on-action: var(--navy);
11
+ --material: var(--white);
12
+ --on-material: var(--navy);
13
+ }
14
+
15
+ .dark-primary-inverted {
16
+ --action: var(--slate);
17
+ --on-action: var(--white);
18
+ --material: var(--white);
19
+ --on-material: var(--navy);
20
+ }
21
+
22
+ .dark-secondary-inverted {
23
+ --action: var(--navy);
24
+ --on-action: var(--white);
25
+ --material: var(--white);
26
+ --on-material: var(--navy);
27
+ }
28
+
29
+ .surface-custom-inverted {
30
+ --action: var(--custom-material);
31
+ --on-action: var(--custom-on-material);
32
+ --material: var(--navy);
33
+ --on-material: var(--white);
34
+ }
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { clsx } from 'clsx';
3
+ import { Header } from '../../../../../../layouts/index.js';
4
+ import { Button } from '../../../../../../actions/button/button/button.js';
5
+ import { theme } from '../../../../../theme_variables.js';
6
+
7
+ // Styles
8
+ import styles from './sb_inverted_materials.module.css';
9
+
10
+ export const SB_MaterialPicker: React.FC<{
11
+ handleSurfaceClick: (surface: string) => () => void;
12
+ }> = ({ handleSurfaceClick }) => {
13
+ return (
14
+ <Header gap={theme.gap.md} height="48px">
15
+ <Button
16
+ hierarchy="primary"
17
+ className={clsx(styles['light-primary-inverted'])}
18
+ onClick={handleSurfaceClick('light-primary')}
19
+ >
20
+ Light
21
+ </Button>
22
+ <Button
23
+ onClick={handleSurfaceClick('light-secondary')}
24
+ hierarchy="primary"
25
+ className={clsx(styles['light-secondary-inverted'])}
26
+ >
27
+ Light Variant
28
+ </Button>
29
+ <Button
30
+ onClick={handleSurfaceClick('dark-primary')}
31
+ hierarchy="primary"
32
+ className={clsx(styles['dark-primary-inverted'])}
33
+ >
34
+ Dark
35
+ </Button>
36
+ <Button
37
+ onClick={handleSurfaceClick('dark-secondary')}
38
+ hierarchy="primary"
39
+ className={clsx(styles['dark-secondary-inverted'])}
40
+ >
41
+ Dark Variant
42
+ </Button>
43
+ <Button
44
+ onClick={handleSurfaceClick('surface-custom')}
45
+ hierarchy="primary"
46
+ className={clsx(styles['surface-custom-inverted'])}
47
+ >
48
+ Custom
49
+ </Button>
50
+ </Header>
51
+ );
52
+ };
@@ -0,0 +1,5 @@
1
+ .box {
2
+ height: 100px;
3
+ width: 100%;
4
+ background-color: rgba(120, 180, 255, 0.18);
5
+ }
@@ -0,0 +1,40 @@
1
+ import { Header, VBody } from '../../../../../../layouts/index.js';
2
+ import { Card } from '../../../../../../surfaces/index.js';
3
+ import { SlimButton } from '../../../../../../actions/button/slim_button/slim_button.js';
4
+ import { Spacer } from '../../../../../../stacks/spacer.js';
5
+ import { Box } from '../../../../../../stacks/index.js';
6
+ import { InfoIcon } from '@tcn/icons/info_icon.js';
7
+ import { AlertCircleIcon } from '@tcn/icons/alert_circle_icon.js';
8
+ import { CheckCircleIcon } from '@tcn/icons/check_circle_icon.js';
9
+ import { theme } from '../../../../../theme_variables.js';
10
+
11
+ // Styles
12
+ import styles from './sb_card.module.css';
13
+ import type { SB_ToneListItem } from './types.js';
14
+
15
+ export const SB_ToneCard: React.FC<{
16
+ item: SB_ToneListItem | null;
17
+ }> = ({ item }) => {
18
+ return (
19
+ <Card data-tone={item?.tone || 'neutral'}>
20
+ <Header>
21
+ {item?.name ?? 'Neutral'}
22
+ <Spacer />
23
+ <SlimButton size="sm" hierarchy="tertiary">
24
+ <InfoIcon />
25
+ </SlimButton>
26
+ <SlimButton size="sm" hierarchy="secondary">
27
+ <AlertCircleIcon />
28
+ </SlimButton>
29
+ <SlimButton size="sm" hierarchy="primary">
30
+ <CheckCircleIcon />
31
+ </SlimButton>
32
+ </Header>
33
+ <VBody gap={theme.gap.md}>
34
+ <Box className={styles.box} />
35
+ <Box className={styles.box} />
36
+ <Box className={styles.box} />
37
+ </VBody>
38
+ </Card>
39
+ );
40
+ };
@@ -0,0 +1,83 @@
1
+ import { useState } from 'react';
2
+ import { BodyText } from '../../../../../../typography/body_text/body_text.js';
3
+ import { Item, List, SectionHeader } from '../../../../../../layouts/index.js';
4
+ import { HStack } from '../../../../../../stacks/h_stack.js';
5
+ import type { SB_ToneListItem } from './types.js';
6
+ import { SB_ToneCard } from './sb_tone_card.js';
7
+ import { theme } from '../../../../../theme_variables.js';
8
+ import { VStack } from '../../../../../../stacks/v_stack.js';
9
+
10
+ const items: SB_ToneListItem[] = [
11
+ {
12
+ id: 'positive',
13
+ name: 'Positive',
14
+ tone: 'positive',
15
+ },
16
+ {
17
+ id: 'notice',
18
+ name: 'Notice',
19
+ tone: 'notice',
20
+ },
21
+ {
22
+ id: 'neutral',
23
+ name: 'Neutral',
24
+ tone: 'neutral',
25
+ },
26
+ {
27
+ id: 'warning',
28
+ name: 'Warning',
29
+ tone: 'warning',
30
+ },
31
+ {
32
+ id: 'danger',
33
+ name: 'Danger',
34
+ tone: 'danger',
35
+ },
36
+ ];
37
+
38
+ export const SB_TonePicker = () => {
39
+ const [selectedItem, setSelectedItem] = useState<SB_ToneListItem | null>(null);
40
+
41
+ const handleItemClick = (item: SB_ToneListItem) => () => {
42
+ setSelectedItem(item);
43
+ };
44
+
45
+ return (
46
+ <HStack
47
+ gap={theme.gap.md}
48
+ growWeight={1}
49
+ paddingTop={theme.padding.md}
50
+ paddingBottom={theme.padding.md}
51
+ >
52
+ <VStack
53
+ height="100%"
54
+ width="auto"
55
+ gap={theme.gap.md}
56
+ hAlign="start"
57
+ minWidth="300px"
58
+ >
59
+ <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
+ >
67
+ {items.map(item => (
68
+ <Item
69
+ key={item.id}
70
+ onClick={handleItemClick(item)}
71
+ selected={selectedItem?.id === item.id}
72
+ >
73
+ <BodyText>{item.name}</BodyText>
74
+ </Item>
75
+ ))}
76
+ </List>
77
+ </VStack>
78
+ <VStack height="100%">
79
+ <SB_ToneCard item={selectedItem || null} />
80
+ </VStack>
81
+ </HStack>
82
+ );
83
+ };
@@ -0,0 +1,7 @@
1
+ export type SB_WipTone = 'positive' | 'notice' | 'neutral' | 'warning' | 'danger';
2
+
3
+ export interface SB_ToneListItem {
4
+ id: string;
5
+ name: string;
6
+ tone: SB_WipTone;
7
+ }