@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
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as s, useRef as b, useCallback as o } from "react";
|
|
2
2
|
import { useDraggable as k } from "./use_draggable.js";
|
|
3
|
-
function m(
|
|
4
|
-
const [
|
|
3
|
+
function m(g) {
|
|
4
|
+
const [u, a] = s([]), n = b(g.initialPosition ?? { x: 0, y: 0 }), [i, c] = s(n.current), [f, l] = s(!1);
|
|
5
5
|
k({
|
|
6
|
-
handles:
|
|
6
|
+
handles: u,
|
|
7
7
|
startDragCallback: () => {
|
|
8
|
-
|
|
8
|
+
l(!0);
|
|
9
9
|
},
|
|
10
|
-
dragCallback: (
|
|
11
|
-
|
|
12
|
-
x:
|
|
13
|
-
y:
|
|
10
|
+
dragCallback: (t, e) => {
|
|
11
|
+
c({
|
|
12
|
+
x: n.current.x + t,
|
|
13
|
+
y: n.current.y + e
|
|
14
14
|
});
|
|
15
15
|
},
|
|
16
16
|
endDragCallback: () => {
|
|
17
|
-
|
|
17
|
+
l(!1), n.current = i;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const d = o(
|
|
21
|
+
(t) => {
|
|
22
|
+
c((e) => {
|
|
23
|
+
const r = typeof t == "function" ? t(e) : t;
|
|
24
|
+
return n.current = r, r;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
[]
|
|
28
|
+
), p = o((t) => {
|
|
29
|
+
a((e) => [...e, t]);
|
|
30
|
+
}, []), D = o((t) => {
|
|
31
|
+
a((e) => e.filter((r) => r !== t));
|
|
24
32
|
}, []);
|
|
25
|
-
return {
|
|
33
|
+
return {
|
|
34
|
+
registerHandle: p,
|
|
35
|
+
unregisterHandle: D,
|
|
36
|
+
position: i,
|
|
37
|
+
isDragging: f,
|
|
38
|
+
setPosition: d
|
|
39
|
+
};
|
|
26
40
|
}
|
|
27
41
|
export {
|
|
28
42
|
m as useMakeDragContainer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_drag_container.js","sources":["../../../../src/utils/dnd/hooks/use_drag_container.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from './use_draggable.js';\nimport type { Position } from '../../index.js';\nimport type { DragContainer } from '../types.js';\n\nexport interface UseDragContainerOptions {\n initialPosition?: Position;\n}\n\nexport function useMakeDragContainer(options: UseDragContainerOptions): DragContainer {\n const [handles, setHandles] = useState<React.RefObject<HTMLElement>[]>([]);\n const positionRef = useRef<Position>(options.initialPosition ?? { x: 0, y: 0 });\n const [position, setPosition] = useState(positionRef.current);\n const [isDragging, setIsDragging] = useState(false);\n\n useDraggable({\n handles: handles,\n startDragCallback: () => {\n setIsDragging(true);\n },\n dragCallback: (deltaX, deltaY) => {\n setPosition({\n x: positionRef.current.x + deltaX,\n y: positionRef.current.y + deltaY,\n });\n },\n endDragCallback: () => {\n setIsDragging(false);\n positionRef.current = position;\n },\n });\n\n const registerHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => [...prev, handle]);\n }, []);\n\n const unregisterHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => prev.filter(h => h !== handle));\n }, []);\n\n return {
|
|
1
|
+
{"version":3,"file":"use_drag_container.js","sources":["../../../../src/utils/dnd/hooks/use_drag_container.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { useDraggable } from './use_draggable.js';\nimport type { Position } from '../../index.js';\nimport type { DragContainer } from '../types.js';\n\nexport interface UseDragContainerOptions {\n initialPosition?: Position;\n}\n\nexport function useMakeDragContainer(options: UseDragContainerOptions): DragContainer {\n const [handles, setHandles] = useState<React.RefObject<HTMLElement>[]>([]);\n const positionRef = useRef<Position>(options.initialPosition ?? { x: 0, y: 0 });\n const [position, setPosition] = useState(positionRef.current);\n const [isDragging, setIsDragging] = useState(false);\n\n useDraggable({\n handles: handles,\n startDragCallback: () => {\n setIsDragging(true);\n },\n dragCallback: (deltaX, deltaY) => {\n setPosition({\n x: positionRef.current.x + deltaX,\n y: positionRef.current.y + deltaY,\n });\n },\n endDragCallback: () => {\n setIsDragging(false);\n positionRef.current = position;\n },\n });\n\n const setPositionState = useCallback(\n (value: Position | ((prev: Position) => Position)) => {\n setPosition(prev => {\n const next = typeof value === 'function' ? value(prev) : value;\n positionRef.current = next;\n return next;\n });\n },\n []\n );\n\n const registerHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => [...prev, handle]);\n }, []);\n\n const unregisterHandle = useCallback((handle: React.RefObject<HTMLElement>) => {\n setHandles(prev => prev.filter(h => h !== handle));\n }, []);\n\n return {\n registerHandle,\n unregisterHandle,\n position,\n isDragging,\n setPosition: setPositionState,\n };\n}\n"],"names":["useMakeDragContainer","options","handles","setHandles","useState","positionRef","useRef","position","setPosition","isDragging","setIsDragging","useDraggable","deltaX","deltaY","setPositionState","useCallback","value","prev","next","registerHandle","handle","unregisterHandle","h"],"mappings":";;AASO,SAASA,EAAqBC,GAAiD;AACpF,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAyC,CAAA,CAAE,GACnEC,IAAcC,EAAiBL,EAAQ,mBAAmB,EAAE,GAAG,GAAG,GAAG,GAAG,GACxE,CAACM,GAAUC,CAAW,IAAIJ,EAASC,EAAY,OAAO,GACtD,CAACI,GAAYC,CAAa,IAAIN,EAAS,EAAK;AAElD,EAAAO,EAAa;AAAA,IACX,SAAAT;AAAA,IACA,mBAAmB,MAAM;AACvB,MAAAQ,EAAc,EAAI;AAAA,IACpB;AAAA,IACA,cAAc,CAACE,GAAQC,MAAW;AAChC,MAAAL,EAAY;AAAA,QACV,GAAGH,EAAY,QAAQ,IAAIO;AAAA,QAC3B,GAAGP,EAAY,QAAQ,IAAIQ;AAAA,MAAA,CAC5B;AAAA,IACH;AAAA,IACA,iBAAiB,MAAM;AACrB,MAAAH,EAAc,EAAK,GACnBL,EAAY,UAAUE;AAAA,IACxB;AAAA,EAAA,CACD;AAED,QAAMO,IAAmBC;AAAA,IACvB,CAACC,MAAqD;AACpD,MAAAR,EAAY,CAAAS,MAAQ;AAClB,cAAMC,IAAO,OAAOF,KAAU,aAAaA,EAAMC,CAAI,IAAID;AACzD,eAAAX,EAAY,UAAUa,GACfA;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAA;AAAA,EAAC,GAGGC,IAAiBJ,EAAY,CAACK,MAAyC;AAC3E,IAAAjB,EAAW,CAAAc,MAAQ,CAAC,GAAGA,GAAMG,CAAM,CAAC;AAAA,EACtC,GAAG,CAAA,CAAE,GAECC,IAAmBN,EAAY,CAACK,MAAyC;AAC7E,IAAAjB,EAAW,OAAQc,EAAK,OAAO,CAAAK,MAAKA,MAAMF,CAAM,CAAC;AAAA,EACnD,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,gBAAAD;AAAA,IACA,kBAAAE;AAAA,IACA,UAAAd;AAAA,IACA,YAAAE;AAAA,IACA,aAAaK;AAAA,EAAA;AAEjB;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { Position } from '../types/dimensions.js';
|
|
1
2
|
export interface DragContainer {
|
|
2
3
|
registerHandle: (handle: React.RefObject<HTMLElement>) => void;
|
|
3
4
|
unregisterHandle: (handle: React.RefObject<HTMLElement>) => void;
|
|
4
5
|
isDragging: boolean;
|
|
5
|
-
position:
|
|
6
|
-
|
|
7
|
-
y: number;
|
|
8
|
-
};
|
|
6
|
+
position: Position;
|
|
7
|
+
setPosition: (value: Position | ((prev: Position) => Position)) => void;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/dnd/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/D,gBAAgB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/dnd/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/D,gBAAgB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzE"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @returns boolean indicating if the media query matches
|
|
7
|
-
*/
|
|
8
|
-
export declare function useMediaQuery(query: string): boolean;
|
|
1
|
+
export interface ViewportSize {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function useMediaQuery(): ViewportSize;
|
|
9
6
|
//# sourceMappingURL=use_media_query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_media_query.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/use_media_query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_media_query.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/use_media_query.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,aAAa,IAAI,YAAY,CAY5C"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, [t]), c;
|
|
1
|
+
import { useState as i, useLayoutEffect as u } from "react";
|
|
2
|
+
import { useResizeObserver as n } from "./use_resize_observer.js";
|
|
3
|
+
function d() {
|
|
4
|
+
const [o, s] = i({ width: 0, height: 0 }), t = n((e, r) => {
|
|
5
|
+
s({ width: e, height: r });
|
|
6
|
+
});
|
|
7
|
+
return u(() => {
|
|
8
|
+
const e = document.body;
|
|
9
|
+
t(e);
|
|
10
|
+
}, [t]), o;
|
|
12
11
|
}
|
|
13
12
|
export {
|
|
14
13
|
d as useMediaQuery
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_media_query.js","sources":["../../../src/utils/hooks/use_media_query.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"use_media_query.js","sources":["../../../src/utils/hooks/use_media_query.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\nimport { useResizeObserver } from './use_resize_observer.js';\n\nexport interface ViewportSize {\n width: number;\n height: number;\n}\n\nexport function useMediaQuery(): ViewportSize {\n const [size, setSize] = useState<ViewportSize>({ width: 0, height: 0 });\n const resizeRef = useResizeObserver((width, height) => {\n setSize({ width, height });\n });\n\n useLayoutEffect(() => {\n const body = document.body;\n resizeRef(body);\n }, [resizeRef]);\n\n return size;\n}\n"],"names":["useMediaQuery","size","setSize","useState","resizeRef","useResizeObserver","width","height","useLayoutEffect","body"],"mappings":";;AAQO,SAASA,IAA8B;AAC5C,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAuB,EAAE,OAAO,GAAG,QAAQ,GAAG,GAChEC,IAAYC,EAAkB,CAACC,GAAOC,MAAW;AACrD,IAAAL,EAAQ,EAAE,OAAAI,GAAO,QAAAC,GAAQ;AAAA,EAC3B,CAAC;AAED,SAAAC,EAAgB,MAAM;AACpB,UAAMC,IAAO,SAAS;AACtB,IAAAL,EAAUK,CAAI;AAAA,EAChB,GAAG,CAACL,CAAS,CAAC,GAEPH;AACT;"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export * from './scroll_away_listener.js';
|
|
|
4
4
|
export * from './dnd/hooks/use_draggable.js';
|
|
5
5
|
export * from './hooks/make_context_hook.js';
|
|
6
6
|
export * from './hooks/use_fork_ref.js';
|
|
7
|
-
export * from './hooks/use_media_query.js';
|
|
8
7
|
export * from './hooks/use_resize_observer.js';
|
|
8
|
+
export * from './hooks/use_media_query.js';
|
|
9
9
|
export * from './default_value.js';
|
|
10
10
|
export * from './calendar/calendar_date.js';
|
|
11
11
|
export * from './calendar/calendar_dates_generator.js';
|
|
@@ -14,7 +14,6 @@ export * from './calendar/get_months_of_year.js';
|
|
|
14
14
|
export * from './calendar/month.js';
|
|
15
15
|
export * from './types/dimensions.js';
|
|
16
16
|
export * from './types/variations.js';
|
|
17
|
-
export * from './responsive/responsive_renderer.js';
|
|
18
17
|
export * from './dnd/draggable/draggable.js';
|
|
19
18
|
export * from './dnd/handle.js';
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
import { ClickAwayListener as o, isEventWithinElement as t } from "./click_away_listener.js";
|
|
2
2
|
import { FocusRedirect as a } from "./focus_redirect.js";
|
|
3
|
-
import { ScrollAwayListener as
|
|
3
|
+
import { ScrollAwayListener as x } from "./scroll_away_listener.js";
|
|
4
4
|
import { useDraggable as s } from "./dnd/hooks/use_draggable.js";
|
|
5
5
|
import { makeContextHook as i } from "./hooks/make_context_hook.js";
|
|
6
6
|
import { useForkRef as l } from "./hooks/use_fork_ref.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { defaultValue as
|
|
10
|
-
import { CalendarDatesGenerator as
|
|
11
|
-
import { getDaysOfWeek as
|
|
12
|
-
import { getMonthsOfYear as
|
|
7
|
+
import { TriggerConfig as d, useResizeObserver as k } from "./hooks/use_resize_observer.js";
|
|
8
|
+
import { useMediaQuery as c } from "./hooks/use_media_query.js";
|
|
9
|
+
import { defaultValue as C } from "./default_value.js";
|
|
10
|
+
import { CalendarDatesGenerator as h } from "./calendar/calendar_dates_generator.js";
|
|
11
|
+
import { getDaysOfWeek as O } from "./calendar/get_days_of_week.js";
|
|
12
|
+
import { getMonthsOfYear as v } from "./calendar/get_months_of_year.js";
|
|
13
13
|
import { Month as A } from "./calendar/month.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { DragHandle as z } from "./dnd/handle.js";
|
|
14
|
+
import { Draggable as F } from "./dnd/draggable/draggable.js";
|
|
15
|
+
import { DragHandle as L } from "./dnd/handle.js";
|
|
17
16
|
export {
|
|
18
|
-
|
|
17
|
+
h as CalendarDatesGenerator,
|
|
19
18
|
o as ClickAwayListener,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
L as DragHandle,
|
|
20
|
+
F as Draggable,
|
|
22
21
|
a as FocusRedirect,
|
|
23
22
|
A as Month,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
v as
|
|
29
|
-
O as getMonthsOfYear,
|
|
23
|
+
x as ScrollAwayListener,
|
|
24
|
+
d as TriggerConfig,
|
|
25
|
+
C as defaultValue,
|
|
26
|
+
O as getDaysOfWeek,
|
|
27
|
+
v as getMonthsOfYear,
|
|
30
28
|
t as isEventWithinElement,
|
|
31
29
|
i as makeContextHook,
|
|
32
30
|
s as useDraggable,
|
|
33
31
|
l as useForkRef,
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
c as useMediaQuery,
|
|
33
|
+
k as useResizeObserver
|
|
36
34
|
};
|
|
37
35
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -3,8 +3,6 @@ import { VStack } from '../../stacks/v_stack.js';
|
|
|
3
3
|
import { SBNestedScaffold, SBContent, SBNestedRail } from './utils.js';
|
|
4
4
|
|
|
5
5
|
import styles from './composed_stories.module.css';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import { Body } from '../body/body.js';
|
|
8
6
|
|
|
9
7
|
const meta: Meta = {
|
|
10
8
|
title: 'Layouts/Composed',
|
|
@@ -45,59 +43,6 @@ export const Baseline: Story = {
|
|
|
45
43
|
),
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
export const ScaffoldWithBody: Story = {
|
|
49
|
-
render: () => (
|
|
50
|
-
<SBContainer>
|
|
51
|
-
<SBNestedScaffold depth={1}>
|
|
52
|
-
<SBContent />
|
|
53
|
-
<SBContent />
|
|
54
|
-
<SBContent />
|
|
55
|
-
</SBNestedScaffold>
|
|
56
|
-
</SBContainer>
|
|
57
|
-
),
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ScaffoldWithMain: Story = {
|
|
61
|
-
render: () => (
|
|
62
|
-
<SBContainer>
|
|
63
|
-
<SBNestedScaffold depth={1}>
|
|
64
|
-
<SBNestedRail depth={2} side={false} utilityStrip={false} scaffold={false}>
|
|
65
|
-
<SBContent />
|
|
66
|
-
<SBContent />
|
|
67
|
-
<SBContent />
|
|
68
|
-
</SBNestedRail>
|
|
69
|
-
</SBNestedScaffold>
|
|
70
|
-
</SBContainer>
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const RailWithMain: Story = {
|
|
75
|
-
render: () => (
|
|
76
|
-
<SBContainer>
|
|
77
|
-
<SBNestedRail depth={1} scaffold={false}>
|
|
78
|
-
<SBContent />
|
|
79
|
-
<SBContent />
|
|
80
|
-
<SBContent />
|
|
81
|
-
</SBNestedRail>
|
|
82
|
-
</SBContainer>
|
|
83
|
-
),
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const RailWithBody: Story = {
|
|
87
|
-
render: () => (
|
|
88
|
-
<SBContainer>
|
|
89
|
-
<SBNestedRail depth={1} scaffold={false}>
|
|
90
|
-
<Body className={clsx(styles.body, styles.secondary)}>
|
|
91
|
-
Body
|
|
92
|
-
<SBContent />
|
|
93
|
-
<SBContent />
|
|
94
|
-
<SBContent />
|
|
95
|
-
</Body>
|
|
96
|
-
</SBNestedRail>
|
|
97
|
-
</SBContainer>
|
|
98
|
-
),
|
|
99
|
-
};
|
|
100
|
-
|
|
101
46
|
export const WithColumns: Story = {
|
|
102
47
|
render: () => (
|
|
103
48
|
<SBContainer>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { LayoutStoryDecorator } from './utils/layout_theme_provider.js';
|
|
4
|
+
import { SBLayoutContent } from './utils/content.js';
|
|
5
|
+
import { Rail } from '../rail/rail.js';
|
|
6
|
+
import { Side } from '../rail/side/side.js';
|
|
7
|
+
import { UtilityStrip } from '../rail/utility_strip/utility_strip.js';
|
|
8
|
+
import { Title } from '../../typography/index.js';
|
|
9
|
+
import { HBody } from '../body/h_body.js';
|
|
10
|
+
import { VBody } from '../body/v_body.js';
|
|
11
|
+
import { Body } from '../body/body.js';
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof Rail> = {
|
|
14
|
+
title: 'Layouts/Rail',
|
|
15
|
+
component: Rail,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: 'A component that lays out content in a horizontal hierarchy.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof Rail>;
|
|
29
|
+
|
|
30
|
+
export const Baseline: Story = {
|
|
31
|
+
render: () => (
|
|
32
|
+
<LayoutStoryDecorator>
|
|
33
|
+
<Rail>
|
|
34
|
+
<UtilityStrip>
|
|
35
|
+
<Title>Utility Strip</Title>
|
|
36
|
+
</UtilityStrip>
|
|
37
|
+
<Body>Body fills available space </Body>
|
|
38
|
+
<Side width="200px">Side</Side>
|
|
39
|
+
</Rail>
|
|
40
|
+
</LayoutStoryDecorator>
|
|
41
|
+
),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const HorizontalContent: Story = {
|
|
45
|
+
render: () => (
|
|
46
|
+
<LayoutStoryDecorator>
|
|
47
|
+
<Rail>
|
|
48
|
+
<UtilityStrip>
|
|
49
|
+
<Title>Utility Strip</Title>
|
|
50
|
+
</UtilityStrip>
|
|
51
|
+
<HBody>
|
|
52
|
+
<SBLayoutContent />
|
|
53
|
+
<SBLayoutContent />
|
|
54
|
+
<SBLayoutContent />
|
|
55
|
+
</HBody>
|
|
56
|
+
<Side width="200px">Side</Side>
|
|
57
|
+
</Rail>
|
|
58
|
+
</LayoutStoryDecorator>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const VerticalContent: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<LayoutStoryDecorator>
|
|
65
|
+
<Rail>
|
|
66
|
+
<UtilityStrip>
|
|
67
|
+
<Title>Utility Strip</Title>
|
|
68
|
+
</UtilityStrip>
|
|
69
|
+
<VBody>
|
|
70
|
+
<SBLayoutContent />
|
|
71
|
+
<SBLayoutContent />
|
|
72
|
+
<SBLayoutContent />
|
|
73
|
+
</VBody>
|
|
74
|
+
<Side width="200px">Side</Side>
|
|
75
|
+
</Rail>
|
|
76
|
+
</LayoutStoryDecorator>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Scaffold } from '../scaffold/scaffold.js';
|
|
2
|
+
import { Header } from '../header/header.js';
|
|
3
|
+
import { UtilityBar } from '../utility_bar/utility_bar.js';
|
|
4
|
+
import { VBody } from '../body/v_body.js';
|
|
5
|
+
import { Footer } from '../footer/footer.js';
|
|
6
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
7
|
+
|
|
8
|
+
import { LayoutStoryDecorator } from './utils/layout_theme_provider.js';
|
|
9
|
+
import { SBLayoutContent } from './utils/content.js';
|
|
10
|
+
import { HBody } from '../body/h_body.js';
|
|
11
|
+
import { VStack } from '../../stacks/v_stack.js';
|
|
12
|
+
import { Body } from '../body/body.js';
|
|
13
|
+
|
|
14
|
+
const meta: Meta<typeof Scaffold> = {
|
|
15
|
+
title: 'Layouts/Scaffold',
|
|
16
|
+
component: Scaffold,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'A scaffold component that lays out content in a vertical hierarchy.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof Scaffold>;
|
|
30
|
+
|
|
31
|
+
export const Baseline: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<LayoutStoryDecorator>
|
|
34
|
+
<Scaffold>
|
|
35
|
+
<Header>Header</Header>
|
|
36
|
+
<UtilityBar>Utility Bar</UtilityBar>
|
|
37
|
+
<Body>Body fills available space</Body>
|
|
38
|
+
<Footer>Footer</Footer>
|
|
39
|
+
</Scaffold>
|
|
40
|
+
</LayoutStoryDecorator>
|
|
41
|
+
),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const VerticalContent: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
height: '100vh',
|
|
47
|
+
},
|
|
48
|
+
render: () => (
|
|
49
|
+
<LayoutStoryDecorator>
|
|
50
|
+
<Scaffold height="100vh">
|
|
51
|
+
<Header>Header</Header>
|
|
52
|
+
<UtilityBar>Utility Bar</UtilityBar>
|
|
53
|
+
<VBody>
|
|
54
|
+
<p>(V)Body</p>
|
|
55
|
+
<p>Fills available space</p>
|
|
56
|
+
<p>Scrolls vertically</p>
|
|
57
|
+
<SBLayoutContent />
|
|
58
|
+
<SBLayoutContent />
|
|
59
|
+
<SBLayoutContent />
|
|
60
|
+
</VBody>
|
|
61
|
+
<Footer>Footer</Footer>
|
|
62
|
+
</Scaffold>
|
|
63
|
+
</LayoutStoryDecorator>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const HorizontalContent: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
height: '100vh',
|
|
70
|
+
},
|
|
71
|
+
render: () => (
|
|
72
|
+
<LayoutStoryDecorator>
|
|
73
|
+
<Scaffold height="100vh">
|
|
74
|
+
<Header>Header</Header>
|
|
75
|
+
<UtilityBar>Utility Bar</UtilityBar>
|
|
76
|
+
<HBody>
|
|
77
|
+
<VStack minWidth="200px" hAlign="center">
|
|
78
|
+
<p>(H)Body</p>
|
|
79
|
+
<p>Fills available space</p>
|
|
80
|
+
<p>Scrolls horizontally</p>
|
|
81
|
+
</VStack>
|
|
82
|
+
<SBLayoutContent />
|
|
83
|
+
<SBLayoutContent />
|
|
84
|
+
<SBLayoutContent />
|
|
85
|
+
</HBody>
|
|
86
|
+
<Footer>Footer</Footer>
|
|
87
|
+
</Scaffold>
|
|
88
|
+
</LayoutStoryDecorator>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Box } from '../../../stacks/index.js';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import type { BoxProps } from '../../../stacks/index.js';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
|
|
6
|
+
export interface SBLayoutContentProps extends BoxProps {}
|
|
7
|
+
|
|
8
|
+
export const SBLayoutContent: React.FC<PropsWithChildren<SBLayoutContentProps>> = ({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
minHeight = '200px',
|
|
12
|
+
minWidth = '200px',
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<Box
|
|
17
|
+
minHeight={minHeight}
|
|
18
|
+
minWidth={minWidth}
|
|
19
|
+
className={clsx('sb-layout-content', className)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
↔ {minWidth}
|
|
23
|
+
<br />↕ {minHeight}
|
|
24
|
+
{children}
|
|
25
|
+
</Box>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* A way to visualize layout components - since they are not themed until being used in a surface */
|
|
2
|
+
.sb-layout-theme {
|
|
3
|
+
/* Forest (5) - Greens & teals */
|
|
4
|
+
--pastel-forest-bg: #e8f5e9;
|
|
5
|
+
--pastel-forest-1: #a5d6a7;
|
|
6
|
+
--pastel-forest-2: #81c784;
|
|
7
|
+
--pastel-forest-3: #66bb6a;
|
|
8
|
+
--pastel-forest-4: #4caf50;
|
|
9
|
+
|
|
10
|
+
/* Sunset (5) - Warm peaches, corals & yellows */
|
|
11
|
+
--pastel-sunset-bg: #fff7e3;
|
|
12
|
+
--pastel-sunset-1: #f5c6a0;
|
|
13
|
+
--pastel-sunset-2: #eba985;
|
|
14
|
+
--pastel-sunset-3: #e08f6a;
|
|
15
|
+
--pastel-sunset-4: #d47550;
|
|
16
|
+
|
|
17
|
+
/* Berry (5) - Purples, lavenders & pinks */
|
|
18
|
+
--pastel-berry-bg: #f5eafa;
|
|
19
|
+
--pastel-berry-1: #e8d5f2;
|
|
20
|
+
--pastel-berry-2: #d4b8e8;
|
|
21
|
+
--pastel-berry-3: #c9a7e0;
|
|
22
|
+
--pastel-berry-4: #b78ed4;
|
|
23
|
+
|
|
24
|
+
--bg: var(--pastel-sunset-bg);
|
|
25
|
+
--bg-1: var(--pastel-sunset-1);
|
|
26
|
+
--bg-2: var(--pastel-sunset-2);
|
|
27
|
+
--bg-3: var(--pastel-sunset-3);
|
|
28
|
+
--bg-4: var(--pastel-sunset-4);
|
|
29
|
+
--bg-5: rgba(0, 0, 0, 0.25);
|
|
30
|
+
|
|
31
|
+
:where(.tcn-scaffold) {
|
|
32
|
+
background: var(--bg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:where(.tcn-bar) {
|
|
36
|
+
min-height: 32px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where(.tcn-header) {
|
|
40
|
+
background: var(--bg-1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:where(.tcn-utility-bar) {
|
|
44
|
+
background: var(--bg-2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:where(.tcn-footer) {
|
|
48
|
+
background: var(--bg-3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:where(.tcn-body) {
|
|
52
|
+
background: var(--bg-4);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:where(.tcn-rail) {
|
|
56
|
+
background: var(--bg);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:where(.tcn-utility-strip) {
|
|
60
|
+
background: var(--bg-1);
|
|
61
|
+
min-width: 32px;
|
|
62
|
+
padding: 8px;
|
|
63
|
+
|
|
64
|
+
:where(.tcn-title) {
|
|
65
|
+
writing-mode: vertical-rl;
|
|
66
|
+
text-orientation: mixed;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:where(.tcn-side) {
|
|
71
|
+
background: var(--bg-2);
|
|
72
|
+
min-width: 32px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:where(.tcn-main) {
|
|
76
|
+
background: var(--bg-4);
|
|
77
|
+
gap: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:where(.sb-layout-content) {
|
|
81
|
+
background: var(--bg-5);
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
/* flex-grow: 1; */
|
|
86
|
+
height: 100%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Box } from '../../../stacks/index.js';
|
|
2
|
+
|
|
3
|
+
import './layout_theme.css';
|
|
4
|
+
|
|
5
|
+
export const LayoutStoryDecorator = ({ children }: { children: React.ReactNode }) => {
|
|
6
|
+
return (
|
|
7
|
+
<Box className="sb-layout-theme" height="100vh" width="100vw" minHeight="400px">
|
|
8
|
+
{children}
|
|
9
|
+
</Box>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -3,13 +3,13 @@ import clsx from 'clsx';
|
|
|
3
3
|
|
|
4
4
|
import { Scaffold, type ScaffoldProps } from '../scaffold/scaffold.js';
|
|
5
5
|
import { Header } from '../header/header.js';
|
|
6
|
-
import { Body } from '../body/body.js';
|
|
7
6
|
import { Footer } from '../footer/footer.js';
|
|
8
7
|
import { UtilityBar } from '../utility_bar/utility_bar.js';
|
|
9
8
|
|
|
10
9
|
import { Rail, type RailProps } from '../rail/rail.js';
|
|
11
10
|
import { Side } from '../rail/side/side.js';
|
|
12
|
-
import {
|
|
11
|
+
import { VBody } from '../body/v_body.js';
|
|
12
|
+
import { HBody } from '../body/h_body.js';
|
|
13
13
|
import { Box, Spacer } from '../../stacks/index.js';
|
|
14
14
|
import { UtilityStrip } from '../rail/utility_strip/utility_strip.js';
|
|
15
15
|
import { SearchIcon } from '@tcn/icons/search_icon.js';
|
|
@@ -101,10 +101,10 @@ export const SBNestedRail: React.FC<PropsWithChildren<SBNestedRailProps>> = ({
|
|
|
101
101
|
</UtilityStrip>
|
|
102
102
|
)}
|
|
103
103
|
{main && (
|
|
104
|
-
<
|
|
105
|
-
{mainLabel && <>
|
|
104
|
+
<HBody className={clsx(styles.main, styles.secondary)} width="200px">
|
|
105
|
+
{mainLabel && <>Body</>}
|
|
106
106
|
{children}
|
|
107
|
-
</
|
|
107
|
+
</HBody>
|
|
108
108
|
)}
|
|
109
109
|
{!main && children}
|
|
110
110
|
{side && (
|
|
@@ -163,7 +163,7 @@ export const SBNestedScaffold: React.FC<PropsWithChildren<SBNestedScaffoldProps>
|
|
|
163
163
|
</UtilityBar>
|
|
164
164
|
)}
|
|
165
165
|
{body && (
|
|
166
|
-
<
|
|
166
|
+
<VBody className={clsx(styles.body, styles.secondary)}>Body {children}</VBody>
|
|
167
167
|
)}
|
|
168
168
|
{!body && children}
|
|
169
169
|
{footer && (
|