@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.
- package/README.md +38 -3
- package/dist/actions/button/base_button/base_button.d.ts.map +1 -1
- package/dist/actions/button/base_button/base_button.js +17 -12
- package/dist/actions/button/base_button/base_button.js.map +1 -1
- package/dist/actions/button/button/button.d.ts.map +1 -1
- package/dist/actions/button/button/button.js +7 -7
- package/dist/actions/button/button/button.js.map +1 -1
- package/dist/actions/button/slim_button/slim_button.js +2 -2
- package/dist/actions/button/slim_button/slim_button.js.map +1 -1
- package/dist/button.css +1 -1
- package/dist/draggable.css +1 -0
- package/dist/feedback/progress/progress_bar.js +1 -1
- package/dist/footer.css +1 -1
- package/dist/form/field/common/field_description.js +1 -1
- package/dist/form/field/common/field_error.js +4 -3
- package/dist/form/field/common/field_error.js.map +1 -1
- package/dist/form/field/common/field_label.js +1 -1
- package/dist/inputs/date_picker/date_picker_date.js +1 -1
- package/dist/inputs/date_picker/date_picker_day.js +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
- package/dist/inputs/input/input.d.ts +2 -2
- package/dist/inputs/input/input.d.ts.map +1 -1
- package/dist/inputs/input/input.js.map +1 -1
- package/dist/inputs/options/option.d.ts +1 -0
- package/dist/inputs/options/option.d.ts.map +1 -1
- package/dist/inputs/options/option.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +8 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +187 -137
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_item.d.ts +1 -1
- package/dist/inputs/suggestions/suggestion_item.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_item.js +23 -18
- package/dist/inputs/suggestions/suggestion_item.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +106 -96
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/textarea/textarea.d.ts +2 -2
- package/dist/inputs/textarea/textarea.d.ts.map +1 -1
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/layouts/footer/footer.js +5 -5
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +3 -2
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +26 -24
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/list/item.d.ts +1 -0
- package/dist/layouts/list/item.d.ts.map +1 -1
- package/dist/layouts/list/item.js +17 -6
- package/dist/layouts/list/item.js.map +1 -1
- package/dist/layouts/list/list.js +10 -10
- package/dist/layouts/list/list.js.map +1 -1
- package/dist/overlay/context_menu/context_menu.js +4 -4
- package/dist/overlay/frame/frame.d.ts +11 -0
- package/dist/overlay/frame/frame.d.ts.map +1 -0
- package/dist/overlay/frame/frame.js +18 -0
- package/dist/overlay/frame/frame.js.map +1 -0
- package/dist/overlay/index.d.ts +1 -0
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +5 -3
- package/dist/overlay/index.js.map +1 -1
- package/dist/overlay/popper/popper.js +12 -12
- package/dist/{portal-qqIp4SIl.js → overlay/portal/portal.js} +3 -3
- package/dist/overlay/portal/portal.js.map +1 -0
- package/dist/overlay/portal/portal_platform.js +3 -4
- package/dist/overlay/portal/portal_platform.js.map +1 -1
- package/dist/phone_number_input.css +1 -1
- package/dist/slim_button.css +1 -1
- package/dist/stacks/box/box.d.ts +1 -1
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/surfaces/card/card.d.ts.map +1 -1
- package/dist/surfaces/card/card.js +7 -16
- package/dist/surfaces/card/card.js.map +1 -1
- package/dist/surfaces/confirm/confirm.js +4 -4
- package/dist/surfaces/index.d.ts +2 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +22 -22
- package/dist/surfaces/modal/modal.d.ts +3 -2
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +14 -13
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/window/window.d.ts +3 -2
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +17 -7
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/index.js +6 -141
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/stylesheets/reset.js +140 -0
- package/dist/themes/stylesheets/reset.js.map +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +664 -0
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -0
- package/dist/tokens/bubble/bubble.js +17 -16
- package/dist/tokens/bubble/bubble.js.map +1 -1
- package/dist/tokens/chip/chip.js +9 -8
- package/dist/tokens/chip/chip.js.map +1 -1
- package/dist/typography/title/title.d.ts +2 -1
- package/dist/typography/title/title.d.ts.map +1 -1
- package/dist/typography/title/title.js +24 -23
- package/dist/typography/title/title.js.map +1 -1
- package/dist/utils/dnd/context.d.ts +4 -0
- package/dist/utils/dnd/context.d.ts.map +1 -0
- package/dist/utils/dnd/context.js +20 -0
- package/dist/utils/dnd/context.js.map +1 -0
- package/dist/utils/dnd/draggable/draggable.d.ts +7 -0
- package/dist/utils/dnd/draggable/draggable.d.ts.map +1 -0
- package/dist/utils/dnd/draggable/draggable.js +27 -0
- package/dist/utils/dnd/draggable/draggable.js.map +1 -0
- package/dist/utils/dnd/handle.d.ts +6 -0
- package/dist/utils/dnd/handle.d.ts.map +1 -0
- package/dist/utils/dnd/handle.js +22 -0
- package/dist/utils/dnd/handle.js.map +1 -0
- package/dist/utils/dnd/hooks/use_drag_container.d.ts +7 -0
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -0
- package/dist/utils/dnd/hooks/use_drag_container.js +30 -0
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -0
- package/dist/utils/{hooks → dnd/hooks}/use_draggable.d.ts +3 -3
- package/dist/utils/dnd/hooks/use_draggable.d.ts.map +1 -0
- package/dist/utils/dnd/hooks/use_draggable.js +41 -0
- package/dist/utils/dnd/hooks/use_draggable.js.map +1 -0
- package/dist/utils/dnd/types.d.ts +10 -0
- package/dist/utils/dnd/types.d.ts.map +1 -0
- package/dist/utils/dnd/types.js +2 -0
- package/dist/utils/dnd/types.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +9 -3
- package/src/actions/button/base_button/base_button.tsx +7 -2
- package/src/actions/button/button/button.module.css +0 -78
- package/src/actions/button/button/button.tsx +2 -4
- package/src/actions/button/slim_button/slim_button.module.css +0 -26
- package/src/actions/button/slim_button/slim_button.tsx +1 -1
- package/src/inputs/input/input.tsx +3 -2
- package/src/inputs/options/option.tsx +1 -0
- package/src/inputs/phone_number_input/phone_number_input.module.css +12 -0
- package/src/inputs/phone_number_input/phone_number_input.stories.tsx +8 -0
- package/src/inputs/phone_number_input/phone_number_input.tsx +107 -21
- package/src/inputs/suggestions/suggestion_item.tsx +12 -2
- package/src/inputs/suggestions/suggestion_list.tsx +22 -3
- package/src/inputs/textarea/textarea.tsx +2 -2
- package/src/layouts/footer/footer.module.css +0 -1
- package/src/layouts/footer/footer.tsx +1 -1
- package/src/layouts/header/header.tsx +0 -1
- package/src/layouts/index.ts +3 -2
- package/src/layouts/list/item.tsx +10 -2
- package/src/layouts/list/list.tsx +2 -2
- package/src/overlay/frame/frame.stories.tsx +40 -0
- package/src/overlay/frame/frame.tsx +34 -0
- package/src/overlay/frame/frame_stories.module.css +14 -0
- package/src/overlay/index.ts +1 -0
- package/src/stacks/box/box.tsx +8 -2
- package/src/surfaces/card/card.tsx +2 -8
- package/src/surfaces/index.ts +2 -2
- package/src/surfaces/modal/__stories__/modal.stories.tsx +19 -27
- package/src/surfaces/modal/modal.tsx +13 -10
- package/src/surfaces/panel/__stories__/panel.stories.tsx +13 -12
- package/src/surfaces/window/window.stories.tsx +37 -4
- package/src/surfaces/window/window.tsx +14 -6
- package/src/themes/themes/ergo/__stories__/components/material_picker/sb_inverted_materials.module.css +34 -0
- package/src/themes/themes/ergo/__stories__/components/material_picker/sb_material_picker.tsx +52 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_card.module.css +5 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_card.tsx +40 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +83 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/types.ts +7 -0
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +154 -0
- package/src/themes/themes/ergo/__stories__/sb_materials.module.css +110 -0
- package/src/themes/themes/ergo/__stories__/utils.ts +92 -0
- package/src/themes/themes/ergo/ergo_theme.css +358 -26
- package/src/typography/title/title.tsx +23 -19
- package/src/utils/dnd/__stories__/draggable.stories.tsx +48 -0
- package/src/utils/dnd/__stories__/draggable_stories.module.css +21 -0
- package/src/utils/{__stories__ → dnd/__stories__}/use_draggable.stories.tsx +15 -10
- package/src/utils/dnd/context.ts +24 -0
- package/src/utils/dnd/draggable/draggable.module.css +8 -0
- package/src/utils/dnd/draggable/draggable.tsx +42 -0
- package/src/utils/dnd/handle.tsx +32 -0
- package/src/utils/dnd/hooks/use_drag_container.ts +42 -0
- package/src/utils/{hooks → dnd/hooks}/use_draggable.ts +23 -17
- package/src/utils/dnd/types.ts +6 -0
- package/src/utils/index.ts +1 -1
- package/tsconfig.json +0 -3
- package/dist/card.css +0 -1
- package/dist/portal-qqIp4SIl.js.map +0 -1
- package/dist/themes/stylesheets/reset.css +0 -1
- package/dist/themes/themes/ergo/ergo_theme.css +0 -1
- package/dist/themes/themes/windows_98/windows_98.css +0 -1
- package/dist/title.module-B16de2jd.js +0 -5
- package/dist/title.module-B16de2jd.js.map +0 -1
- package/dist/utils/hooks/use_draggable.d.ts.map +0 -1
- package/dist/utils/hooks/use_draggable.js +0 -30
- package/dist/utils/hooks/use_draggable.js.map +0 -1
- package/src/surfaces/card/card.module.css +0 -5
- /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
|
+
}
|
package/src/overlay/index.ts
CHANGED
package/src/stacks/box/box.tsx
CHANGED
|
@@ -45,8 +45,14 @@ export interface BoxProps extends HTMLAttributes<HTMLElement> {
|
|
|
45
45
|
enableResizeOnRight?: boolean;
|
|
46
46
|
horizontalHandleProps?: HandleProps;
|
|
47
47
|
verticalHandleProps?: HandleProps;
|
|
48
|
-
onWidthResize?: (
|
|
49
|
-
|
|
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
|
|
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
|
);
|
package/src/surfaces/index.ts
CHANGED
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
<
|
|
29
|
+
<SlimButton hierarchy="tertiary">
|
|
29
30
|
<GridOneIcon />
|
|
30
|
-
</
|
|
31
|
+
</SlimButton>
|
|
31
32
|
<Divider length="md" vertical />
|
|
32
|
-
<
|
|
33
|
+
<SlimButton hierarchy="tertiary">
|
|
33
34
|
<CrossIcon />
|
|
34
|
-
</
|
|
35
|
+
</SlimButton>
|
|
35
36
|
</Header>
|
|
36
37
|
<UtilityBar>
|
|
37
38
|
<Title>Utility Bar</Title>
|
|
38
39
|
<Spacer />
|
|
39
|
-
<
|
|
40
|
+
<SlimButton hierarchy="tertiary">
|
|
40
41
|
<BugIcon />
|
|
41
|
-
</
|
|
42
|
-
<
|
|
42
|
+
</SlimButton>
|
|
43
|
+
<SlimButton hierarchy="tertiary">
|
|
43
44
|
<BugIcon />
|
|
44
|
-
</
|
|
45
|
-
<
|
|
45
|
+
</SlimButton>
|
|
46
|
+
<SlimButton size="md" hierarchy="tertiary">
|
|
46
47
|
<BugIcon />
|
|
47
|
-
</
|
|
48
|
-
<
|
|
48
|
+
</SlimButton>
|
|
49
|
+
<SlimButton hierarchy="tertiary">
|
|
49
50
|
<BugIcon />
|
|
50
|
-
</
|
|
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
|
|
17
|
+
export const WindowStory = () => {
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
|
|
20
|
+
function toggle() {
|
|
21
|
+
setIsOpen(!isOpen);
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
return (
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
7
|
+
export type WindowProps = FrameOwnProps & Omit<VStackProps<HTMLDialogElement>, 'as'>;
|
|
7
8
|
|
|
8
|
-
export const Window = React.forwardRef<
|
|
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
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
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,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
|
+
};
|