@tcn/ui 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bar.css +1 -0
- package/dist/body.css +1 -1
- package/dist/body.module-BbFZ7KNP.js +5 -0
- package/dist/body.module-BbFZ7KNP.js.map +1 -0
- package/dist/divider.css +1 -1
- package/dist/feedback/progress/progress_bar.js +13 -13
- package/dist/footer.css +1 -1
- package/dist/form/field/common/field_description.js +7 -8
- package/dist/form/field/common/field_description.js.map +1 -1
- package/dist/form/field/common/field_error.js +6 -6
- package/dist/form/field/common/field_label.js +7 -8
- package/dist/form/field/common/field_label.js.map +1 -1
- package/dist/form/field_set/field_set.js +7 -7
- package/dist/inputs/date_picker/date_picker_date.js +6 -6
- package/dist/inputs/date_picker/date_picker_day.js +6 -6
- package/dist/inputs/date_picker/date_picker_time_selector.js +5 -5
- package/dist/inputs/date_picker/date_picker_year_selector.js +5 -5
- package/dist/inputs/suggestions/suggestion_list.js +6 -6
- package/dist/layouts/bar/bar.d.ts +5 -0
- package/dist/layouts/bar/bar.d.ts.map +1 -0
- package/dist/layouts/bar/bar.js +20 -0
- package/dist/layouts/bar/bar.js.map +1 -0
- package/dist/layouts/body/body.d.ts +2 -2
- package/dist/layouts/body/body.d.ts.map +1 -1
- package/dist/layouts/body/body.js +12 -12
- package/dist/layouts/body/body.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts.map +1 -1
- package/dist/layouts/body/h_body.js +18 -12
- package/dist/layouts/body/h_body.js.map +1 -1
- package/dist/layouts/body/v_body.d.ts.map +1 -1
- package/dist/layouts/body/v_body.js +16 -10
- package/dist/layouts/body/v_body.js.map +1 -1
- package/dist/layouts/footer/footer.d.ts +2 -3
- package/dist/layouts/footer/footer.d.ts.map +1 -1
- package/dist/layouts/footer/footer.js +7 -7
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts +2 -2
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js +13 -21
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +2 -1
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +40 -38
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/rail/rail.js +41 -41
- package/dist/layouts/rail/rail.js.map +1 -1
- package/dist/layouts/rail/side/side.d.ts.map +1 -1
- package/dist/layouts/rail/side/side.js +1 -1
- package/dist/layouts/rail/side/side.js.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.d.ts.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.js +21 -17
- package/dist/layouts/rail/utility_strip/utility_strip.js.map +1 -1
- package/dist/layouts/responsive/breakpoint.d.ts +11 -0
- package/dist/layouts/responsive/breakpoint.d.ts.map +1 -0
- package/dist/layouts/responsive/breakpoint.js +15 -0
- package/dist/layouts/responsive/breakpoint.js.map +1 -0
- package/dist/layouts/responsive/responsive.d.ts +7 -0
- package/dist/layouts/responsive/responsive.d.ts.map +1 -0
- package/dist/layouts/responsive/responsive.js +11 -0
- package/dist/layouts/responsive/responsive.js.map +1 -0
- package/dist/layouts/responsive/responsive_container.d.ts +7 -0
- package/dist/layouts/responsive/responsive_container.d.ts.map +1 -0
- package/dist/layouts/responsive/responsive_container.js +30 -0
- package/dist/layouts/responsive/responsive_container.js.map +1 -0
- package/dist/layouts/responsive/responsive_viewport.d.ts +7 -0
- package/dist/layouts/responsive/responsive_viewport.d.ts.map +1 -0
- package/dist/layouts/responsive/responsive_viewport.js +12 -0
- package/dist/layouts/responsive/responsive_viewport.js.map +1 -0
- package/dist/layouts/scaffold/scaffold.js +32 -32
- package/dist/layouts/scaffold/scaffold.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts +2 -2
- package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +17 -19
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/overlay/frame/frame.js +3 -3
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/panel.css +1 -0
- package/dist/rail.css +1 -1
- package/dist/scaffold.css +1 -1
- package/dist/side.css +1 -1
- package/dist/stacks/box/bottom_resize_handle.d.ts +2 -2
- package/dist/stacks/box/bottom_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/bottom_resize_handle.js +12 -10
- package/dist/stacks/box/bottom_resize_handle.js.map +1 -1
- package/dist/stacks/box/box.d.ts +4 -4
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js +26 -26
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/end_resize_handle.d.ts +2 -2
- package/dist/stacks/box/end_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/end_resize_handle.js +6 -5
- package/dist/stacks/box/end_resize_handle.js.map +1 -1
- package/dist/stacks/box/left_resize_handle.d.ts +2 -2
- package/dist/stacks/box/left_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/left_resize_handle.js +10 -9
- package/dist/stacks/box/left_resize_handle.js.map +1 -1
- package/dist/stacks/box/resize_handlers.d.ts +2 -2
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +24 -24
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/right_resize_handle.d.ts +2 -2
- package/dist/stacks/box/right_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/right_resize_handle.js +6 -5
- package/dist/stacks/box/right_resize_handle.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.d.ts +2 -2
- package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +4 -4
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/top_resize_handle.d.ts +2 -2
- package/dist/stacks/box/top_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/top_resize_handle.js +2 -1
- package/dist/stacks/box/top_resize_handle.js.map +1 -1
- package/dist/stacks/h_collapsible_box.d.ts.map +1 -1
- package/dist/stacks/h_collapsible_box.js +24 -24
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +25 -25
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/surfaces/confirm/confirm.js +5 -5
- package/dist/surfaces/index.d.ts +1 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +18 -20
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/panel/panel.d.ts +5 -0
- package/dist/surfaces/panel/panel.d.ts.map +1 -0
- package/dist/surfaces/panel/panel.js +19 -0
- package/dist/surfaces/panel/panel.js.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +1 -1
- package/dist/themes/theme.d.ts +2 -1
- package/dist/themes/theme.d.ts.map +1 -1
- package/dist/themes/theme.js +16 -9
- package/dist/themes/theme.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +27 -0
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/typography/body_text/body_text.d.ts +2 -1
- package/dist/typography/body_text/body_text.d.ts.map +1 -1
- package/dist/typography/body_text/body_text.js +24 -23
- package/dist/typography/body_text/body_text.js.map +1 -1
- package/dist/typography/callout/callout.d.ts +2 -1
- package/dist/typography/callout/callout.d.ts.map +1 -1
- package/dist/typography/callout/callout.js +28 -27
- package/dist/typography/callout/callout.js.map +1 -1
- package/dist/typography/caption/caption.d.ts +2 -1
- package/dist/typography/caption/caption.d.ts.map +1 -1
- package/dist/typography/caption/caption.js +18 -17
- package/dist/typography/caption/caption.js.map +1 -1
- package/dist/typography/footnote/footnote.d.ts +2 -1
- package/dist/typography/footnote/footnote.d.ts.map +1 -1
- package/dist/typography/footnote/footnote.js +25 -24
- package/dist/typography/footnote/footnote.js.map +1 -1
- package/dist/typography/headline/headline.d.ts +2 -1
- package/dist/typography/headline/headline.d.ts.map +1 -1
- package/dist/typography/headline/headline.js +36 -33
- package/dist/typography/headline/headline.js.map +1 -1
- package/dist/typography/subheadline/subheadline.d.ts +2 -1
- package/dist/typography/subheadline/subheadline.d.ts.map +1 -1
- package/dist/typography/subheadline/subheadline.js +35 -32
- package/dist/typography/subheadline/subheadline.js.map +1 -1
- package/dist/utils/dnd/context.d.ts.map +1 -1
- package/dist/utils/dnd/context.js +9 -7
- package/dist/utils/dnd/context.js.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.js +29 -15
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -1
- package/dist/utils/dnd/types.d.ts +3 -4
- package/dist/utils/dnd/types.d.ts.map +1 -1
- package/dist/utils/hooks/use_media_query.d.ts +5 -8
- package/dist/utils/hooks/use_media_query.d.ts.map +1 -1
- package/dist/utils/hooks/use_media_query.js +10 -11
- package/dist/utils/hooks/use_media_query.js.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +19 -21
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layouts/__stories__/composed.stories.tsx +0 -55
- package/src/layouts/__stories__/rail.stories.tsx +78 -0
- package/src/layouts/__stories__/scaffold.stories.tsx +90 -0
- package/src/layouts/__stories__/utils/content.tsx +27 -0
- package/src/layouts/__stories__/utils/layout_theme.css +88 -0
- package/src/layouts/__stories__/utils/layout_theme_provider.tsx +11 -0
- package/src/layouts/__stories__/utils.tsx +6 -6
- package/src/layouts/{utility_bar/utility_bar.module.css → bar/bar.module.css} +2 -1
- package/src/layouts/bar/bar.tsx +23 -0
- package/src/layouts/body/body.module.css +9 -4
- package/src/layouts/body/body.tsx +7 -6
- package/src/layouts/body/h_body.module.css +1 -2
- package/src/layouts/body/h_body.tsx +9 -4
- package/src/layouts/body/v_body.tsx +9 -4
- package/src/layouts/divider/divider.module.css +1 -1
- package/src/layouts/footer/footer.module.css +0 -3
- package/src/layouts/footer/footer.tsx +5 -6
- package/src/layouts/header/header.tsx +6 -15
- package/src/layouts/index.ts +2 -1
- package/src/layouts/rail/rail.module.css +9 -5
- package/src/layouts/rail/rail.tsx +1 -1
- package/src/layouts/rail/side/side.module.css +0 -1
- package/src/layouts/rail/side/side.tsx +1 -2
- package/src/layouts/rail/utility_strip/utility_strip.module.css +5 -0
- package/src/layouts/rail/utility_strip/utility_strip.tsx +4 -1
- package/src/layouts/responsive/breakpoint.tsx +29 -0
- package/src/layouts/responsive/responsive.stories.tsx +37 -0
- package/src/layouts/responsive/responsive.tsx +18 -0
- package/src/layouts/responsive/responsive_container.tsx +51 -0
- package/src/layouts/responsive/responsive_viewport.tsx +17 -0
- package/src/layouts/scaffold/scaffold.module.css +10 -7
- package/src/layouts/scaffold/scaffold.tsx +1 -1
- package/src/layouts/utility_bar/utility_bar.tsx +6 -9
- package/src/overlay/frame/frame.tsx +2 -2
- package/src/stacks/box/bottom_resize_handle.tsx +7 -5
- package/src/stacks/box/box.tsx +12 -18
- package/src/stacks/box/end_resize_handle.tsx +6 -6
- package/src/stacks/box/left_resize_handle.tsx +4 -3
- package/src/stacks/box/resize_handlers.ts +11 -9
- package/src/stacks/box/right_resize_handle.tsx +4 -3
- package/src/stacks/box/start_resize_handle.tsx +3 -3
- package/src/stacks/box/top_resize_handle.tsx +4 -3
- package/src/stacks/collapsible_box.stories.tsx +11 -11
- package/src/stacks/h_collapsible_box.tsx +5 -5
- package/src/stacks/v_collapsible_box.tsx +4 -4
- package/src/surfaces/index.ts +1 -2
- package/src/surfaces/panel/__stories__/panel.stories.tsx +12 -12
- package/src/surfaces/panel/__stories__/panel_stories.module.css +3 -3
- package/src/surfaces/panel/panel.module.css +1 -6
- package/src/surfaces/panel/panel.tsx +22 -0
- package/src/themes/theme.tsx +6 -2
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +15 -16
- package/src/themes/themes/ergo/ergo_theme.css +27 -0
- package/src/typography/body_text/body_text.tsx +21 -17
- package/src/typography/callout/callout.tsx +20 -16
- package/src/typography/caption/caption.tsx +20 -16
- package/src/typography/footnote/footnote.tsx +20 -16
- package/src/typography/headline/headline.tsx +60 -54
- package/src/typography/subheadline/subheadline.tsx +60 -54
- package/src/utils/dnd/__stories__/draggable.stories.tsx +34 -0
- package/src/utils/dnd/context.ts +1 -0
- package/src/utils/dnd/hooks/use_drag_container.ts +18 -1
- package/src/utils/dnd/types.ts +4 -1
- package/src/utils/hooks/use_media_query.ts +16 -27
- package/src/utils/index.ts +1 -3
- package/dist/body_text.module-h4XQE2pC.js +0 -5
- package/dist/body_text.module-h4XQE2pC.js.map +0 -1
- package/dist/callout.module-D8ECmxpO.js +0 -5
- package/dist/callout.module-D8ECmxpO.js.map +0 -1
- package/dist/caption.module-DDq0H4xZ.js +0 -5
- package/dist/caption.module-DDq0H4xZ.js.map +0 -1
- package/dist/footnote.module-DEyFuqOr.js +0 -5
- package/dist/footnote.module-DEyFuqOr.js.map +0 -1
- package/dist/h_body.css +0 -1
- package/dist/h_panel.css +0 -1
- package/dist/header.css +0 -1
- package/dist/headline.module-BiwHBtGf.js +0 -5
- package/dist/headline.module-BiwHBtGf.js.map +0 -1
- package/dist/layouts/rail/main/main.d.ts +0 -6
- package/dist/layouts/rail/main/main.d.ts.map +0 -1
- package/dist/layouts/rail/main/main.js +0 -21
- package/dist/layouts/rail/main/main.js.map +0 -1
- package/dist/main.css +0 -1
- package/dist/subheadline.module-C-v7zMkQ.js +0 -5
- package/dist/subheadline.module-C-v7zMkQ.js.map +0 -1
- package/dist/surfaces/panel/h_panel.d.ts +0 -9
- package/dist/surfaces/panel/h_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/h_panel.js +0 -60
- package/dist/surfaces/panel/h_panel.js.map +0 -1
- package/dist/surfaces/panel/v_panel.d.ts +0 -5
- package/dist/surfaces/panel/v_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/v_panel.js +0 -19
- package/dist/surfaces/panel/v_panel.js.map +0 -1
- package/dist/utility_bar.css +0 -1
- package/dist/utils/responsive/responsive_renderer.d.ts +0 -21
- package/dist/utils/responsive/responsive_renderer.d.ts.map +0 -1
- package/dist/utils/responsive/responsive_renderer.js +0 -12
- package/dist/utils/responsive/responsive_renderer.js.map +0 -1
- package/dist/v_body.css +0 -1
- package/src/layouts/header/header.module.css +0 -8
- package/src/layouts/rail/__stories__/rail.stories.tsx +0 -64
- package/src/layouts/rail/__stories__/rail_stories.module.css +0 -25
- package/src/layouts/rail/main/main.module.css +0 -7
- package/src/layouts/rail/main/main.tsx +0 -26
- package/src/layouts/scaffold/__stories__/scaffold.stories.tsx +0 -53
- package/src/layouts/scaffold/__stories__/scaffold_stories.module.css +0 -31
- package/src/surfaces/panel/h_panel.tsx +0 -65
- package/src/surfaces/panel/v_panel.tsx +0 -20
- package/src/utils/responsive/responsive_renderer.stories.tsx +0 -77
- package/src/utils/responsive/responsive_renderer.tsx +0 -31
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
4
|
+
|
|
5
|
+
import styles from './bar.module.css';
|
|
6
|
+
|
|
7
|
+
export type BarProps = HStackProps;
|
|
8
|
+
|
|
9
|
+
export const Bar = React.forwardRef<HTMLElement, BarProps>(function Bar(
|
|
10
|
+
{ children, className, ...props }: BarProps,
|
|
11
|
+
ref
|
|
12
|
+
) {
|
|
13
|
+
return (
|
|
14
|
+
<HStack
|
|
15
|
+
ref={ref}
|
|
16
|
+
as="header"
|
|
17
|
+
className={clsx(className, styles['bar'], 'tcn-bar')}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</HStack>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
@layer tcn-system {
|
|
2
2
|
.body {
|
|
3
3
|
min-height: 0;
|
|
4
|
+
min-width: 0;
|
|
4
5
|
flex-grow: 1;
|
|
5
|
-
|
|
6
|
-
height: 100%;
|
|
6
|
+
flex-shrink: unset;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
.h-body {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.v-body {
|
|
14
|
+
overflow-y: auto;
|
|
10
15
|
}
|
|
11
16
|
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { VStack, type VStackProps } from '../../stacks/v_stack.js';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import styles from './body.module.css';
|
|
4
|
+
import { Box, type BoxProps } from '../../stacks/box/box.js';
|
|
5
5
|
|
|
6
|
-
export interface BodyProps extends Omit<
|
|
6
|
+
export interface BodyProps extends Omit<BoxProps, 'as'> {}
|
|
7
7
|
|
|
8
|
+
// Under construction: although this component behaves correctly, a content/child component that manages scrolling is needed.
|
|
9
|
+
// For now HBody and VBody are recommended.
|
|
8
10
|
export const Body = React.forwardRef<HTMLElement, BodyProps>(function Body(
|
|
9
|
-
{ children, className,
|
|
11
|
+
{ children, className, ...props }: BodyProps,
|
|
10
12
|
ref
|
|
11
13
|
) {
|
|
12
14
|
return (
|
|
13
|
-
<
|
|
15
|
+
<Box
|
|
14
16
|
ref={ref}
|
|
15
17
|
as="div"
|
|
16
|
-
overflowY={overflowY}
|
|
17
18
|
className={clsx(styles['body'], className, 'tcn-body')}
|
|
18
19
|
{...props}
|
|
19
20
|
>
|
|
20
21
|
{children}
|
|
21
|
-
</
|
|
22
|
+
</Box>
|
|
22
23
|
);
|
|
23
24
|
});
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
|
-
import styles from './
|
|
4
|
+
import styles from './body.module.css';
|
|
5
5
|
|
|
6
6
|
export interface HBodyProps extends Omit<HStackProps, 'as'> {}
|
|
7
7
|
|
|
8
8
|
export const HBody = React.forwardRef<HTMLElement, HBodyProps>(function HBody(
|
|
9
|
-
{ children, className,
|
|
9
|
+
{ children, className, ...props }: HBodyProps,
|
|
10
10
|
ref
|
|
11
11
|
) {
|
|
12
12
|
return (
|
|
13
13
|
<HStack
|
|
14
14
|
ref={ref}
|
|
15
15
|
as="div"
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
className={clsx(
|
|
17
|
+
styles['body'],
|
|
18
|
+
styles['h-body'],
|
|
19
|
+
className,
|
|
20
|
+
'tcn-h-body',
|
|
21
|
+
'tcn-body'
|
|
22
|
+
)}
|
|
18
23
|
{...props}
|
|
19
24
|
>
|
|
20
25
|
{children}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { VStack, type VStackProps } from '../../stacks/v_stack.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
|
-
import styles from './
|
|
4
|
+
import styles from './body.module.css';
|
|
5
5
|
|
|
6
6
|
export interface VBodyProps extends Omit<VStackProps, 'as'> {}
|
|
7
7
|
|
|
8
8
|
export const VBody = React.forwardRef<HTMLElement, VBodyProps>(function VBody(
|
|
9
|
-
{ children, className,
|
|
9
|
+
{ children, className, ...props }: VBodyProps,
|
|
10
10
|
ref
|
|
11
11
|
) {
|
|
12
12
|
return (
|
|
13
13
|
<VStack
|
|
14
14
|
ref={ref}
|
|
15
15
|
as="div"
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
className={clsx(
|
|
17
|
+
styles['body'],
|
|
18
|
+
styles['v-body'],
|
|
19
|
+
className,
|
|
20
|
+
'tcn-body',
|
|
21
|
+
'tcn-v-body'
|
|
22
|
+
)}
|
|
18
23
|
{...props}
|
|
19
24
|
>
|
|
20
25
|
{children}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
4
3
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
-
import
|
|
4
|
+
import { Bar, type BarProps } from '../bar/bar.js';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
import styles from './footer.module.css';
|
|
7
|
+
export interface FooterProps extends Omit<BarProps, 'as'> {
|
|
8
8
|
hierarchy?: Hierarchy;
|
|
9
9
|
size?: Size;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export const Footer = React.forwardRef<HTMLElement, FooterProps>(function Footer(
|
|
@@ -15,7 +14,7 @@ export const Footer = React.forwardRef<HTMLElement, FooterProps>(function Footer
|
|
|
15
14
|
ref
|
|
16
15
|
) {
|
|
17
16
|
return (
|
|
18
|
-
<
|
|
17
|
+
<Bar
|
|
19
18
|
ref={ref}
|
|
20
19
|
as="footer"
|
|
21
20
|
className={clsx(styles.footer, className, 'tcn-footer')}
|
|
@@ -24,6 +23,6 @@ export const Footer = React.forwardRef<HTMLElement, FooterProps>(function Footer
|
|
|
24
23
|
{...props}
|
|
25
24
|
>
|
|
26
25
|
{children}
|
|
27
|
-
</
|
|
26
|
+
</Bar>
|
|
28
27
|
);
|
|
29
28
|
});
|
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
4
3
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
-
import
|
|
4
|
+
import { Bar, type BarProps } from '../bar/bar.js';
|
|
6
5
|
|
|
7
|
-
export interface HeaderProps extends Omit<
|
|
6
|
+
export interface HeaderProps extends Omit<BarProps, 'as'> {
|
|
8
7
|
hierarchy?: Hierarchy;
|
|
9
8
|
size?: Size;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const Header = React.forwardRef<HTMLElement, HeaderProps>(function Header(
|
|
13
|
-
{
|
|
14
|
-
hierarchy = 'secondary',
|
|
15
|
-
height = 'auto',
|
|
16
|
-
children,
|
|
17
|
-
className,
|
|
18
|
-
size = 'md',
|
|
19
|
-
...props
|
|
20
|
-
}: HeaderProps,
|
|
12
|
+
{ hierarchy = 'secondary', size = 'md', children, className, ...props }: HeaderProps,
|
|
21
13
|
ref
|
|
22
14
|
) {
|
|
23
15
|
return (
|
|
24
|
-
<
|
|
16
|
+
<Bar
|
|
25
17
|
ref={ref}
|
|
26
18
|
as="header"
|
|
27
|
-
className={clsx(
|
|
19
|
+
className={clsx(className, 'tcn-header')}
|
|
28
20
|
data-hierarchy={hierarchy}
|
|
29
21
|
data-size={size}
|
|
30
|
-
height={height}
|
|
31
22
|
{...props}
|
|
32
23
|
>
|
|
33
24
|
{children}
|
|
34
|
-
</
|
|
25
|
+
</Bar>
|
|
35
26
|
);
|
|
36
27
|
});
|
package/src/layouts/index.ts
CHANGED
|
@@ -15,11 +15,12 @@ export { UtilityBar, type UtilityBarProps } from './utility_bar/utility_bar.js';
|
|
|
15
15
|
export { Row } from './row/row.js';
|
|
16
16
|
export { Section } from './section/section.js';
|
|
17
17
|
export { Heading, type HeadingOwnProps } from './section/heading.js';
|
|
18
|
+
export { Responsive, type ResponsiveProps } from './responsive/responsive.js';
|
|
19
|
+
export { Breakpoint, type BreakpointProps } from './responsive/breakpoint.js';
|
|
18
20
|
|
|
19
21
|
export { TTable, THead, TBody, TFoot, TR, TH, TD } from './table/table.js';
|
|
20
22
|
|
|
21
23
|
export { Rail, type RailProps } from './rail/rail.js';
|
|
22
|
-
export { Main, type MainProps } from './rail/main/main.js';
|
|
23
24
|
export { Side, type SideProps } from './rail/side/side.js';
|
|
24
25
|
export {
|
|
25
26
|
UtilityStrip,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
@layer tcn-system {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
overflow: auto;
|
|
6
|
-
:where(.tcn-body) {
|
|
2
|
+
.rail {
|
|
3
|
+
:where(.rail-stack) {
|
|
4
|
+
width: 100%;
|
|
7
5
|
height: 100%;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
> :global(.tcn-body) {
|
|
8
|
+
height: 100%;
|
|
9
|
+
width: auto;
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
}
|
|
8
12
|
}
|
|
9
13
|
}
|
|
10
14
|
}
|
|
@@ -40,7 +40,7 @@ export const Rail = React.forwardRef<HTMLElement, RailProps>(function Rail(
|
|
|
40
40
|
maxHeight={maxHeight}
|
|
41
41
|
data-h-alignment={hAlign}
|
|
42
42
|
data-v-alignment={vAlign}
|
|
43
|
-
className={clsx(className, 'tcn-rail')}
|
|
43
|
+
className={clsx(className, styles['rail'], 'tcn-rail')}
|
|
44
44
|
{...props}
|
|
45
45
|
>
|
|
46
46
|
<HStack
|
|
@@ -4,7 +4,6 @@ import { VStack, type VStackProps } from '../../../stacks/v_stack.js';
|
|
|
4
4
|
|
|
5
5
|
import styles from './side.module.css';
|
|
6
6
|
|
|
7
|
-
// UtilityBar
|
|
8
7
|
export interface SideProps extends Omit<VStackProps, 'as'> {}
|
|
9
8
|
|
|
10
9
|
export const Side = React.forwardRef<HTMLElement, SideProps>(function UtilityStrip(
|
|
@@ -14,9 +13,9 @@ export const Side = React.forwardRef<HTMLElement, SideProps>(function UtilityStr
|
|
|
14
13
|
return (
|
|
15
14
|
<VStack
|
|
16
15
|
ref={ref}
|
|
16
|
+
width={width}
|
|
17
17
|
className={clsx(styles['side'], 'tcn-side', className)}
|
|
18
18
|
as="section"
|
|
19
|
-
width={width}
|
|
20
19
|
{...props}
|
|
21
20
|
>
|
|
22
21
|
{children}
|
|
@@ -5,7 +5,6 @@ import { VStack, type VStackProps } from '../../../stacks/v_stack.js';
|
|
|
5
5
|
|
|
6
6
|
import styles from './utility_strip.module.css';
|
|
7
7
|
|
|
8
|
-
// UtilityBar
|
|
9
8
|
export interface UtilityStripProps extends Omit<VStackProps, 'as'> {
|
|
10
9
|
hierarchy?: Hierarchy;
|
|
11
10
|
size?: Size;
|
|
@@ -18,6 +17,8 @@ export const UtilityStrip = React.forwardRef<HTMLElement, UtilityStripProps>(
|
|
|
18
17
|
className,
|
|
19
18
|
width = 'auto',
|
|
20
19
|
hierarchy = 'secondary',
|
|
20
|
+
vAlign = 'start',
|
|
21
|
+
hAlign = 'center',
|
|
21
22
|
size = 'md',
|
|
22
23
|
...props
|
|
23
24
|
}: UtilityStripProps,
|
|
@@ -27,6 +28,8 @@ export const UtilityStrip = React.forwardRef<HTMLElement, UtilityStripProps>(
|
|
|
27
28
|
<VStack
|
|
28
29
|
ref={ref}
|
|
29
30
|
as="header"
|
|
31
|
+
vAlign={vAlign}
|
|
32
|
+
hAlign={hAlign}
|
|
30
33
|
className={clsx(styles['utility-strip'], 'tcn-utility-strip', className)}
|
|
31
34
|
data-hierarchy={hierarchy}
|
|
32
35
|
data-size={size}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface BreakpointProps {
|
|
2
|
+
from?: number | string;
|
|
3
|
+
to?: number | string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface InternalBreakpointProps extends BreakpointProps {
|
|
8
|
+
width: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function toNumber(value: number | string) {
|
|
12
|
+
if (typeof value === 'number') {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return parseFloat(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function Breakpoint(_: BreakpointProps) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function InternalBreakpoint(props: InternalBreakpointProps) {
|
|
24
|
+
const from = toNumber(props.from ?? 0);
|
|
25
|
+
const to = toNumber(props.to ?? Infinity);
|
|
26
|
+
const isWithinRange = props.width >= from && props.width < to;
|
|
27
|
+
|
|
28
|
+
return isWithinRange ? props.children : null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HStack } from '../../stacks/h_stack.js';
|
|
2
|
+
import { Breakpoint } from './breakpoint.js';
|
|
3
|
+
import { Responsive } from './responsive.js';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Layouts/Responsive',
|
|
7
|
+
component: Responsive,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function Container() {
|
|
12
|
+
return (
|
|
13
|
+
<HStack width="100%" hAlign="center">
|
|
14
|
+
<Responsive>
|
|
15
|
+
<Breakpoint to={200}>Small</Breakpoint>
|
|
16
|
+
<Breakpoint from={200} to={800}>
|
|
17
|
+
Medium
|
|
18
|
+
</Breakpoint>
|
|
19
|
+
<Breakpoint from={800}>Large</Breakpoint>
|
|
20
|
+
</Responsive>
|
|
21
|
+
</HStack>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function Viewport() {
|
|
26
|
+
return (
|
|
27
|
+
<HStack width="100%" hAlign="center">
|
|
28
|
+
<Responsive on="viewport">
|
|
29
|
+
<Breakpoint to={200}>Small</Breakpoint>
|
|
30
|
+
<Breakpoint from={200} to={800}>
|
|
31
|
+
Medium
|
|
32
|
+
</Breakpoint>
|
|
33
|
+
<Breakpoint from={800}>Large</Breakpoint>
|
|
34
|
+
</Responsive>
|
|
35
|
+
</HStack>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BreakpointProps } from './breakpoint.js';
|
|
2
|
+
import { ResponsiveContainer } from './responsive_container.js';
|
|
3
|
+
import { ResponsiveViewport } from './responsive_viewport.js';
|
|
4
|
+
|
|
5
|
+
export interface ResponsiveProps {
|
|
6
|
+
on?: 'viewport' | 'container';
|
|
7
|
+
children?: React.ReactElement<BreakpointProps>[] | React.ReactElement<BreakpointProps>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Responsive(props: ResponsiveProps) {
|
|
11
|
+
const { on = 'container', children } = props;
|
|
12
|
+
|
|
13
|
+
if (on === 'viewport') {
|
|
14
|
+
return <ResponsiveViewport>{children}</ResponsiveViewport>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return <ResponsiveContainer>{children}</ResponsiveContainer>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { useForkRef } from '../../utils/hooks/use_fork_ref.js';
|
|
3
|
+
import { useResizeObserver } from '../../utils/hooks/use_resize_observer.js';
|
|
4
|
+
import { InternalBreakpoint, BreakpointProps } from './breakpoint.js';
|
|
5
|
+
|
|
6
|
+
export interface ResponsiveContainerProps {
|
|
7
|
+
children?: React.ReactElement<BreakpointProps>[] | React.ReactElement<BreakpointProps>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ResponsiveContainer(props: ResponsiveContainerProps) {
|
|
11
|
+
const [parent, setParent] = useState<Element | null>(null);
|
|
12
|
+
const [width, setWidth] = useState(0);
|
|
13
|
+
|
|
14
|
+
const resizeRef = useResizeObserver(width => {
|
|
15
|
+
setWidth(width);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const forkedRef = useForkRef((element: any) => {
|
|
19
|
+
if (element == null || element.parentElement == null) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
resizeRef(element.parentElement);
|
|
23
|
+
setParent(element.parentElement);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const hiddenChild = (
|
|
27
|
+
<div
|
|
28
|
+
ref={forkedRef}
|
|
29
|
+
style={{
|
|
30
|
+
display: 'none',
|
|
31
|
+
}}
|
|
32
|
+
></div>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const internalBreakpoints = React.Children.toArray(props.children).map((child: any) => {
|
|
36
|
+
return <InternalBreakpoint key={child.key} {...child.props} width={width} />;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
return () => {
|
|
41
|
+
setParent(null);
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{parent == null ? hiddenChild : null}
|
|
48
|
+
{internalBreakpoints}
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InternalBreakpoint, BreakpointProps } from './breakpoint.js';
|
|
3
|
+
import { useMediaQuery } from '../../utils/hooks/use_media_query.js';
|
|
4
|
+
|
|
5
|
+
export interface ResponsiveViewportProps {
|
|
6
|
+
children?: React.ReactElement<BreakpointProps>[] | React.ReactElement<BreakpointProps>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ResponsiveViewport(props: ResponsiveViewportProps) {
|
|
10
|
+
const { width } = useMediaQuery();
|
|
11
|
+
|
|
12
|
+
const internalBreakpoints = React.Children.toArray(props.children).map((child: any) => {
|
|
13
|
+
return <InternalBreakpoint key={child.key} {...child.props} width={width} />;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return <>{internalBreakpoints}</>;
|
|
17
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
@layer tcn-system {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
.scaffold {
|
|
3
|
+
:where(.scaffold-stack) {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
> :global(.tcn-body) {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: auto;
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -38,7 +38,7 @@ export const Scaffold = React.forwardRef<HTMLElement, ScaffoldProps>(function Sc
|
|
|
38
38
|
maxHeight={maxHeight}
|
|
39
39
|
data-h-alignment={hAlign}
|
|
40
40
|
data-v-alignment={vAlign}
|
|
41
|
-
className={clsx(className, 'tcn-scaffold')}
|
|
41
|
+
className={clsx(className, styles['scaffold'], 'tcn-scaffold')}
|
|
42
42
|
{...props}
|
|
43
43
|
>
|
|
44
44
|
<VStack
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
4
3
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
-
import
|
|
4
|
+
import { Bar, type BarProps } from '../bar/bar.js';
|
|
6
5
|
|
|
7
6
|
// UtilityBar
|
|
8
|
-
export interface UtilityBarProps extends Omit<
|
|
7
|
+
export interface UtilityBarProps extends Omit<BarProps, 'as'> {
|
|
9
8
|
hierarchy?: Hierarchy;
|
|
10
9
|
size?: Size;
|
|
11
10
|
}
|
|
@@ -14,26 +13,24 @@ export const UtilityBar = React.forwardRef<HTMLElement, UtilityBarProps>(
|
|
|
14
13
|
function UtilityBar(
|
|
15
14
|
{
|
|
16
15
|
hierarchy = 'secondary',
|
|
17
|
-
|
|
16
|
+
size = 'md',
|
|
18
17
|
children,
|
|
19
18
|
className,
|
|
20
|
-
size = 'md',
|
|
21
19
|
...props
|
|
22
20
|
}: UtilityBarProps,
|
|
23
21
|
ref
|
|
24
22
|
) {
|
|
25
23
|
return (
|
|
26
|
-
<
|
|
24
|
+
<Bar
|
|
27
25
|
ref={ref}
|
|
28
26
|
as="header"
|
|
29
|
-
className={clsx(
|
|
27
|
+
className={clsx(className, 'tcn-utility-bar')}
|
|
30
28
|
data-hierarchy={hierarchy}
|
|
31
29
|
data-size={size}
|
|
32
|
-
height={height}
|
|
33
30
|
{...props}
|
|
34
31
|
>
|
|
35
32
|
{children}
|
|
36
|
-
</
|
|
33
|
+
</Bar>
|
|
37
34
|
);
|
|
38
35
|
}
|
|
39
36
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ZStack, type ZStackProps } from '../../stacks/index.js';
|
|
3
|
-
import { Portal } from '../portal/portal.js';
|
|
4
3
|
import { Draggable } from '../../utils/dnd/draggable/draggable.js';
|
|
4
|
+
import { Portal } from '../portal/portal.js';
|
|
5
5
|
|
|
6
6
|
// Styles
|
|
7
|
-
import styles from './frame.module.css';
|
|
8
7
|
import { clsx } from 'clsx';
|
|
8
|
+
import styles from './frame.module.css';
|
|
9
9
|
|
|
10
10
|
export interface FrameOwnProps {
|
|
11
11
|
isOpen?: boolean;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import styles from './bottom_resize_handle.module.css';
|
|
3
|
-
import { createVerticalResizeHandler } from './resize_handlers.js';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
4
|
import type { HandleProps } from './handle_props.js';
|
|
5
|
+
import { createVerticalResizeHandler } from './resize_handlers.js';
|
|
6
6
|
|
|
7
7
|
export interface BottomResizeHandleProps {
|
|
8
8
|
targetRef: React.MutableRefObject<HTMLElement | null>;
|
|
9
9
|
handleProps?: HandleProps;
|
|
10
|
-
onHeightResize?: (
|
|
11
|
-
onHeightResizeEnd?: (
|
|
10
|
+
onHeightResize?: (height: number, origin: 'top' | 'bottom', delta: number) => void;
|
|
11
|
+
onHeightResizeEnd?: (height: number, origin: 'top' | 'bottom') => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function BottomResizeHandle({
|
|
@@ -20,7 +20,9 @@ export function BottomResizeHandle({
|
|
|
20
20
|
const resizeHandler = createVerticalResizeHandler(
|
|
21
21
|
targetRef,
|
|
22
22
|
onHeightResize,
|
|
23
|
-
onHeightResizeEnd
|
|
23
|
+
onHeightResizeEnd,
|
|
24
|
+
false,
|
|
25
|
+
'bottom'
|
|
24
26
|
);
|
|
25
27
|
const offset = handleProps?.offset ? handleProps.offset : -8;
|
|
26
28
|
|