@musecat/uikit 0.1.1
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/LICENSE +9 -0
- package/README.md +51 -0
- package/index.ts +78 -0
- package/package.json +103 -0
- package/packages/Components/Box/Box.tsx +173 -0
- package/packages/Components/Box/Box.types.ts +48 -0
- package/packages/Components/Button/Button.tsx +275 -0
- package/packages/Components/Button/Button.types.ts +44 -0
- package/packages/Components/Card/Card.default.tsx +180 -0
- package/packages/Components/Card/Card.foldable.tsx +383 -0
- package/packages/Components/Card/Card.module.scss +23 -0
- package/packages/Components/Card/Card.tsx +8 -0
- package/packages/Components/Card/Card.types.ts +91 -0
- package/packages/Components/Card/Card.utils.ts +66 -0
- package/packages/Components/Checkbox/Checkbox.module.scss +11 -0
- package/packages/Components/Checkbox/Checkbox.tsx +104 -0
- package/packages/Components/Checkbox/Checkbox.types.ts +24 -0
- package/packages/Components/CodeBox/CodeBox.copy.tsx +43 -0
- package/packages/Components/CodeBox/CodeBox.module.scss +72 -0
- package/packages/Components/CodeBox/CodeBox.tsx +91 -0
- package/packages/Components/CodeBox/CodeBox.types.ts +17 -0
- package/packages/Components/ContextMenu/ContextMenu.module.scss +8 -0
- package/packages/Components/ContextMenu/ContextMenu.options.tsx +126 -0
- package/packages/Components/ContextMenu/ContextMenu.tsx +381 -0
- package/packages/Components/ContextMenu/ContextMenu.types.ts +46 -0
- package/packages/Components/ContributionGraph/ContributionGraph.module.scss +42 -0
- package/packages/Components/ContributionGraph/ContributionGraph.tsx +454 -0
- package/packages/Components/ContributionGraph/ContributionGraph.types.ts +27 -0
- package/packages/Components/DatePicker/DatePicker.calendar.tsx +161 -0
- package/packages/Components/DatePicker/DatePicker.core.tsx +582 -0
- package/packages/Components/DatePicker/DatePicker.module.scss +26 -0
- package/packages/Components/DatePicker/DatePicker.tsx +786 -0
- package/packages/Components/DatePicker/DatePicker.types.ts +36 -0
- package/packages/Components/DatePicker/DatePicker.utils.ts +80 -0
- package/packages/Components/DatePicker/hooks/useCalendar.ts +61 -0
- package/packages/Components/DatePicker/hooks/useSelection.ts +208 -0
- package/packages/Components/Divider/Divider.tsx +46 -0
- package/packages/Components/Divider/Divider.types.ts +12 -0
- package/packages/Components/Header/Header.module.scss +74 -0
- package/packages/Components/Header/Header.tsx +47 -0
- package/packages/Components/Header/Header.types.ts +8 -0
- package/packages/Components/Icon/Icon.group.tsx +122 -0
- package/packages/Components/Icon/Icon.group.types.ts +20 -0
- package/packages/Components/Icon/Icon.tsx +341 -0
- package/packages/Components/Icon/Icon.types.ts +59 -0
- package/packages/Components/Icon/SVG/data.tsx +232 -0
- package/packages/Components/Input/Input.module.scss +5 -0
- package/packages/Components/Input/Input.tsx +87 -0
- package/packages/Components/Input/Input.types.ts +14 -0
- package/packages/Components/Label/Label.module.scss +19 -0
- package/packages/Components/Label/Label.tsx +115 -0
- package/packages/Components/Label/Label.types.ts +28 -0
- package/packages/Components/Layout/Layout.docs.module.scss +42 -0
- package/packages/Components/Layout/Layout.docs.tsx +150 -0
- package/packages/Components/Layout/Layout.docs.types.ts +18 -0
- package/packages/Components/Layout/Layout.module.scss +91 -0
- package/packages/Components/Layout/Layout.tsx +306 -0
- package/packages/Components/Layout/Layout.types.ts +71 -0
- package/packages/Components/Maps/OSM/MapOSM.module.scss +11 -0
- package/packages/Components/Maps/OSM/MapOSM.shared.ts +121 -0
- package/packages/Components/Maps/OSM/MapOSM.tsx +279 -0
- package/packages/Components/Maps/OSM/MapOSM.types.ts +18 -0
- package/packages/Components/Nav/Nav.module.scss +137 -0
- package/packages/Components/Nav/Nav.tsx +304 -0
- package/packages/Components/Nav/Nav.types.ts +32 -0
- package/packages/Components/Nav/hooks/useNavDrag.ts +374 -0
- package/packages/Components/Nav/hooks/useNavIndicator.ts +137 -0
- package/packages/Components/Pagination/Pagination.tsx +254 -0
- package/packages/Components/Pagination/Pagination.types.ts +18 -0
- package/packages/Components/Pill/Pill.tsx +127 -0
- package/packages/Components/Pill/Pill.types.ts +33 -0
- package/packages/Components/Profile/Profile.shared.ts +74 -0
- package/packages/Components/Profile/Profile.tsx +382 -0
- package/packages/Components/Profile/Profile.types.ts +55 -0
- package/packages/Components/Progress/Progress.module.scss +15 -0
- package/packages/Components/Progress/Progress.tsx +88 -0
- package/packages/Components/Progress/Progress.types.ts +22 -0
- package/packages/Components/Radio/Radio.module.scss +11 -0
- package/packages/Components/Radio/Radio.tsx +121 -0
- package/packages/Components/Radio/Radio.types.ts +20 -0
- package/packages/Components/Select/Select.keyboard.tsx +76 -0
- package/packages/Components/Select/Select.trigger.tsx +88 -0
- package/packages/Components/Select/Select.tsx +11 -0
- package/packages/Components/Select/Select.types.ts +38 -0
- package/packages/Components/Select/Select.utils.ts +84 -0
- package/packages/Components/Select/hooks/useSelectNavigation.ts +461 -0
- package/packages/Components/Select/hooks/useSelectSelection.ts +142 -0
- package/packages/Components/Select/hooks/useSelectState.ts +314 -0
- package/packages/Components/Select/select.control.tsx +228 -0
- package/packages/Components/Select/select.inner.tsx +312 -0
- package/packages/Components/Skeleton/Skeleton.tsx +30 -0
- package/packages/Components/Skeleton/Skeleton.types.ts +12 -0
- package/packages/Components/Spinner/Spinner.module.scss +78 -0
- package/packages/Components/Spinner/Spinner.tsx +125 -0
- package/packages/Components/Spinner/Spinner.types.ts +19 -0
- package/packages/Components/Text/Text.module.scss +7 -0
- package/packages/Components/Text/Text.tsx +49 -0
- package/packages/Components/Text/Text.types.ts +33 -0
- package/packages/Components/TimePicker/TimePicker.core.tsx +448 -0
- package/packages/Components/TimePicker/TimePicker.module.scss +30 -0
- package/packages/Components/TimePicker/TimePicker.tsx +511 -0
- package/packages/Components/TimePicker/TimePicker.types.ts +22 -0
- package/packages/Components/Timeline/Timeline.tsx +111 -0
- package/packages/Components/Timeline/Timeline.types.ts +23 -0
- package/packages/Components/Title/Title.tsx +305 -0
- package/packages/Components/Title/Title.types.ts +64 -0
- package/packages/Components/Toggle/Toggle.module.scss +32 -0
- package/packages/Components/Toggle/Toggle.tsx +272 -0
- package/packages/Components/Toggle/Toggle.types.ts +17 -0
- package/packages/Components/Tooltip/Tooltip.module.scss +44 -0
- package/packages/Components/Tooltip/Tooltip.tsx +340 -0
- package/packages/Components/Tooltip/Tooltip.types.ts +38 -0
- package/packages/Frameworks/Dialog/Dialog.background.tsx +88 -0
- package/packages/Frameworks/Dialog/Dialog.boot.tsx +32 -0
- package/packages/Frameworks/Dialog/Dialog.store.ts +199 -0
- package/packages/Frameworks/Dialog/Dialog.tsx +185 -0
- package/packages/Frameworks/Dialog/Dialog.types.ts +264 -0
- package/packages/Frameworks/Dialog/Dialog.utils.ts +22 -0
- package/packages/Frameworks/Dialog/contents/Dialog.footer.tsx +79 -0
- package/packages/Frameworks/Dialog/contents/Dialog.funnel.tsx +260 -0
- package/packages/Frameworks/Dialog/contents/Dialog.header.tsx +137 -0
- package/packages/Frameworks/Dialog/hooks/useDialogPosition.ts +298 -0
- package/packages/Frameworks/Dialog/hooks/useSheetDrag.ts +325 -0
- package/packages/Frameworks/Dialog/hooks/useSheetGeometry.ts +201 -0
- package/packages/Frameworks/Dialog/hooks/useSheetProgressive.ts +98 -0
- package/packages/Frameworks/Dialog/renderers/renderModal.tsx +228 -0
- package/packages/Frameworks/Dialog/renderers/renderPopover.tsx +220 -0
- package/packages/Frameworks/Dialog/renderers/renderSheet.tsx +571 -0
- package/packages/Frameworks/EdgeEffect/EdgeEffect.tsx +52 -0
- package/packages/Frameworks/EdgeEffect/EdgeEffect.types.ts +5 -0
- package/packages/Frameworks/Motion/Motion.presets.ts +49 -0
- package/packages/Frameworks/Pressable/Pressable.module.scss +19 -0
- package/packages/Frameworks/Pressable/Pressable.tsx +651 -0
- package/packages/Frameworks/Pressable/Pressable.types.ts +73 -0
- package/packages/Frameworks/Squircle/Squircle.tsx +263 -0
- package/packages/Frameworks/Squircle/Squircle.types.ts +15 -0
- package/packages/Frameworks/Theme/Radius.types.ts +55 -0
- package/packages/Frameworks/Theme/Theme.types.ts +325 -0
- package/packages/Frameworks/Toaster/Toaster.boot.tsx +47 -0
- package/packages/Frameworks/Toaster/Toaster.module.scss +168 -0
- package/packages/Frameworks/Toaster/Toaster.types.ts +13 -0
- package/packages/Frameworks/View/DNDView/DNDView.module.scss +8 -0
- package/packages/Frameworks/View/DNDView/DNDView.tsx +470 -0
- package/packages/Frameworks/View/DNDView/DNDView.types.ts +61 -0
- package/packages/Frameworks/View/HScrollView/HScrollView.module.scss +59 -0
- package/packages/Frameworks/View/HScrollView/HScrollView.tsx +386 -0
- package/packages/Frameworks/View/HScrollView/HScrollView.types.ts +46 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.counter.tsx +27 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.footer.tsx +76 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.header.tsx +49 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.list.tsx +74 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.slide.tsx +71 -0
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.tsx +175 -0
- package/packages/Frameworks/View/ImageView/Image.controls.tsx +39 -0
- package/packages/Frameworks/View/ImageView/Image.hooks.ts +82 -0
- package/packages/Frameworks/View/ImageView/Image.module.scss +7 -0
- package/packages/Frameworks/View/ImageView/Image.tsx +375 -0
- package/packages/Frameworks/View/ImageView/Image.types.ts +71 -0
- package/packages/Frameworks/View/ImageView/Image.utils.ts +79 -0
- package/packages/Frameworks/View/View.module.scss +34 -0
- package/packages/Frameworks/View/View.tsx +200 -0
- package/packages/Frameworks/View/View.types.ts +36 -0
- package/packages/Frameworks/_shared/Padding.types.ts +52 -0
- package/packages/Frameworks/_shared/StopParentInteraction.tsx +45 -0
- package/packages/Frameworks/_shared/Wind.types.ts +17 -0
- package/packages/Frameworks/_shared/bodyScrollLock.ts +127 -0
- package/packages/Frameworks/_shared/layer.constants.ts +8 -0
- package/packages/Frameworks/_shared/normalize.ts +39 -0
- package/packages/Frameworks/_shared/sizing.ts +55 -0
- package/packages/Frameworks/_shared/useControllableState.ts +29 -0
- package/packages/Styles/_animation.scss +42 -0
- package/packages/Styles/_color.scss +131 -0
- package/packages/Styles/_font.scss +30 -0
- package/packages/Styles/_icon.scss +782 -0
- package/packages/Styles/_importer.scss +9 -0
- package/packages/Styles/_system.scss +69 -0
- package/packages/Styles/_textstyle.scss +111 -0
- package/packages/Styles/_theme.scss +452 -0
- package/packages/Styles/_viewport-global.scss +99 -0
- package/packages/Styles/_viewport.scss +108 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import Icon from "@/packages/Components/Icon/Icon";
|
|
4
|
+
import styles from "@/packages/Components/Layout/Layout.docs.module.scss";
|
|
5
|
+
import type { DocsLayoutProps } from "@/packages/Components/Layout/Layout.docs.types";
|
|
6
|
+
import Profile from "@/packages/Components/Profile/Profile";
|
|
7
|
+
import Text from "@/packages/Components/Text/Text";
|
|
8
|
+
import View from "@/packages/Frameworks/View/View";
|
|
9
|
+
export default function DocsLayout({
|
|
10
|
+
children,
|
|
11
|
+
image,
|
|
12
|
+
header,
|
|
13
|
+
fontType,
|
|
14
|
+
author,
|
|
15
|
+
createdBy,
|
|
16
|
+
caption,
|
|
17
|
+
title,
|
|
18
|
+
mobileTitleShown,
|
|
19
|
+
onlyHeaderTitleShown,
|
|
20
|
+
bodyClassName,
|
|
21
|
+
"data-color-mode": dataTheme,
|
|
22
|
+
goTop,
|
|
23
|
+
}: DocsLayoutProps) {
|
|
24
|
+
const usePlainTextBody = typeof children === "string";
|
|
25
|
+
const hasLayoutTitle = Boolean(title || caption);
|
|
26
|
+
const showLayoutTitle = hasLayoutTitle && !onlyHeaderTitleShown;
|
|
27
|
+
|
|
28
|
+
const layoutContent = (
|
|
29
|
+
<View
|
|
30
|
+
style={{ position: "relative", minHeight: "100dvh" }}
|
|
31
|
+
fullWidth
|
|
32
|
+
data-color-mode={dataTheme}
|
|
33
|
+
column
|
|
34
|
+
alignItems="center"
|
|
35
|
+
background="Base2"
|
|
36
|
+
>
|
|
37
|
+
<View className={styles.DocsLayoutInner} column gap={32}>
|
|
38
|
+
{image && (
|
|
39
|
+
<Image
|
|
40
|
+
alt=""
|
|
41
|
+
src={image}
|
|
42
|
+
width={3840}
|
|
43
|
+
height={2160}
|
|
44
|
+
style={{
|
|
45
|
+
width: "100%",
|
|
46
|
+
maxHeight: "38rem",
|
|
47
|
+
height: "52vw",
|
|
48
|
+
objectFit: "cover",
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
<View
|
|
53
|
+
style={{ minWidth: 0, paddingBottom: "1.6rem" }}
|
|
54
|
+
fullWidth
|
|
55
|
+
column
|
|
56
|
+
gap={24}
|
|
57
|
+
>
|
|
58
|
+
{showLayoutTitle && (
|
|
59
|
+
<View
|
|
60
|
+
className={clsx(
|
|
61
|
+
styles.DocsLayoutGroupTitle,
|
|
62
|
+
mobileTitleShown && styles.DocsLayoutGroupTitleMobileOnly,
|
|
63
|
+
)}
|
|
64
|
+
style={{ minWidth: 0 }}
|
|
65
|
+
fullWidth
|
|
66
|
+
data-layout-title-source="true"
|
|
67
|
+
column
|
|
68
|
+
gap={24}
|
|
69
|
+
>
|
|
70
|
+
{title && (
|
|
71
|
+
<Text
|
|
72
|
+
type="LargeTitle"
|
|
73
|
+
fontType={fontType || "serif"}
|
|
74
|
+
className={styles.DocsLayoutTitleText}
|
|
75
|
+
>
|
|
76
|
+
{title}
|
|
77
|
+
</Text>
|
|
78
|
+
)}
|
|
79
|
+
{caption && (
|
|
80
|
+
<Text
|
|
81
|
+
type="Footnote"
|
|
82
|
+
fontType={fontType || "serif"}
|
|
83
|
+
opacity={0.8}
|
|
84
|
+
>
|
|
85
|
+
{caption}
|
|
86
|
+
</Text>
|
|
87
|
+
)}
|
|
88
|
+
</View>
|
|
89
|
+
)}
|
|
90
|
+
<View opacity={0.6} column gap={10}>
|
|
91
|
+
{(author?.avatarUrl ||
|
|
92
|
+
author?.username ||
|
|
93
|
+
author?.displayName ||
|
|
94
|
+
author?.joinedAtText ||
|
|
95
|
+
author?.id) && (
|
|
96
|
+
<Profile
|
|
97
|
+
size={{ avatar: 16, textType: "Caption1" }}
|
|
98
|
+
avatarUrl={author.avatarUrl}
|
|
99
|
+
displayName={author.displayName || author.username || ""}
|
|
100
|
+
id={author.id}
|
|
101
|
+
username={author.username}
|
|
102
|
+
joinedAtText={author.joinedAtText}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
{createdBy && (
|
|
106
|
+
<View alignItems="center" gap={6}>
|
|
107
|
+
<Icon icon="iDate" size={16} />
|
|
108
|
+
<Text type="Caption1" weight={400}>
|
|
109
|
+
{createdBy}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
)}
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
|
|
116
|
+
{usePlainTextBody ? (
|
|
117
|
+
<Text
|
|
118
|
+
type="Body"
|
|
119
|
+
fontType={fontType || "serif"}
|
|
120
|
+
weight={400}
|
|
121
|
+
lineHeight={1.8}
|
|
122
|
+
className={bodyClassName}
|
|
123
|
+
style={{
|
|
124
|
+
whiteSpace: "pre-line",
|
|
125
|
+
width: "clamp(0px, 100%, 100%)",
|
|
126
|
+
overflowWrap: "anywhere",
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{children}
|
|
130
|
+
</Text>
|
|
131
|
+
) : (
|
|
132
|
+
<View
|
|
133
|
+
className={bodyClassName}
|
|
134
|
+
width="clamp(0px, 100%, 100%)"
|
|
135
|
+
style={{ overflowWrap: "anywhere" }}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
</View>
|
|
139
|
+
)}
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
return (
|
|
144
|
+
<>
|
|
145
|
+
{header}
|
|
146
|
+
{layoutContent}
|
|
147
|
+
{}
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProfileProps } from "@/packages/Components/Profile/Profile.types";
|
|
2
|
+
import type { TextProps } from "@/packages/Components/Text/Text.types";
|
|
3
|
+
|
|
4
|
+
export interface DocsLayoutProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
"data-color-mode"?: string;
|
|
7
|
+
image?: string;
|
|
8
|
+
header?: React.ReactNode;
|
|
9
|
+
author?: ProfileProps;
|
|
10
|
+
createdBy?: string;
|
|
11
|
+
caption?: React.ReactNode;
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
mobileTitleShown?: boolean;
|
|
14
|
+
onlyHeaderTitleShown?: boolean;
|
|
15
|
+
fontType?: TextProps["fontType"];
|
|
16
|
+
bodyClassName?: string;
|
|
17
|
+
goTop?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@use "../../Styles/viewport" as viewport;
|
|
2
|
+
|
|
3
|
+
.LayoutInner {
|
|
4
|
+
flex: 1 0 auto;
|
|
5
|
+
|
|
6
|
+
--layout-max-width: 1280px;
|
|
7
|
+
--layout-bleed: max(
|
|
8
|
+
var(--view-padding-page-inline),
|
|
9
|
+
calc(
|
|
10
|
+
(100vw - var(--layout-max-width)) / 2 + var(--view-padding-page-inline)
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
max-width: 1280px;
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
position: relative;
|
|
18
|
+
z-index: 2;
|
|
19
|
+
padding-inline: 3.6rem;
|
|
20
|
+
padding-top: 10.8rem;
|
|
21
|
+
padding-bottom: 3.6rem;
|
|
22
|
+
overflow: visible;
|
|
23
|
+
|
|
24
|
+
@include viewport.down(w3) {
|
|
25
|
+
--layout-max-width: 768px;
|
|
26
|
+
|
|
27
|
+
max-width: 768px;
|
|
28
|
+
padding-inline: 1.6rem;
|
|
29
|
+
padding-top: 10.8rem;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.LayoutTitleWrapper {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 2.4rem;
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
padding-bottom: 2.4rem;
|
|
40
|
+
max-width: 76rem;
|
|
41
|
+
opacity: var(--layout-title-handoff-opacity, 1);
|
|
42
|
+
filter: blur(var(--layout-title-handoff-blur, 0));
|
|
43
|
+
transform: translateY(var(--layout-title-handoff-y, 0));
|
|
44
|
+
will-change: opacity, filter, transform;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.LayoutTitleText {
|
|
48
|
+
display: block;
|
|
49
|
+
width: 100%;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
max-width: 100%;
|
|
52
|
+
white-space: normal !important;
|
|
53
|
+
word-break: keep-all;
|
|
54
|
+
overflow-wrap: anywhere;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.LayoutTitleMobileOnly {
|
|
58
|
+
display: none !important;
|
|
59
|
+
|
|
60
|
+
@include viewport.down(w3) {
|
|
61
|
+
display: flex !important;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.LayoutGrid {
|
|
66
|
+
--layout-grid-ratio: minmax(0, 1fr) minmax(0, 1fr);
|
|
67
|
+
--layout-grid-active-ratio: var(--layout-grid-ratio);
|
|
68
|
+
|
|
69
|
+
gap: 4.8rem;
|
|
70
|
+
width: 100%;
|
|
71
|
+
|
|
72
|
+
.LayoutGridGroup {
|
|
73
|
+
gap: 3.6rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@include viewport.down(w3) {
|
|
77
|
+
--layout-grid-active-ratio: minmax(0, 1fr);
|
|
78
|
+
|
|
79
|
+
gap: 3.2rem;
|
|
80
|
+
|
|
81
|
+
.LayoutGridGroup {
|
|
82
|
+
display: contents !important;
|
|
83
|
+
gap: 3.2rem;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.LayoutGridGroup {
|
|
89
|
+
width: 100%;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import { Children, isValidElement } from "react";
|
|
4
|
+
import styles from "@/packages/Components/Layout/Layout.module.scss";
|
|
5
|
+
import type {
|
|
6
|
+
BackgroundImageValue,
|
|
7
|
+
LayoutGridViewProps,
|
|
8
|
+
LayoutProps,
|
|
9
|
+
LayoutSectionProps,
|
|
10
|
+
} from "@/packages/Components/Layout/Layout.types";
|
|
11
|
+
import Title from "@/packages/Components/Title/Title";
|
|
12
|
+
import type { TitleProps } from "@/packages/Components/Title/Title.types";
|
|
13
|
+
import { normalizeUIKitImageSrc } from "@/packages/Frameworks/_shared/normalize";
|
|
14
|
+
import {
|
|
15
|
+
Size,
|
|
16
|
+
type UIKitSizeValue,
|
|
17
|
+
} from "@/packages/Frameworks/_shared/sizing";
|
|
18
|
+
import View from "@/packages/Frameworks/View/View";
|
|
19
|
+
|
|
20
|
+
function resolveBgMargin(
|
|
21
|
+
margin: NonNullable<BackgroundImageValue["margin"]>,
|
|
22
|
+
): string | number | undefined {
|
|
23
|
+
if (Array.isArray(margin)) {
|
|
24
|
+
return margin.map((v) => Size(v)).join(" ");
|
|
25
|
+
}
|
|
26
|
+
return Size(margin as UIKitSizeValue);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function Layout({
|
|
30
|
+
children,
|
|
31
|
+
title,
|
|
32
|
+
caption,
|
|
33
|
+
titleType,
|
|
34
|
+
titleFontType,
|
|
35
|
+
mobileTitleShown,
|
|
36
|
+
onlyHeaderTitleShown,
|
|
37
|
+
header,
|
|
38
|
+
titleContext,
|
|
39
|
+
backgroundImage,
|
|
40
|
+
"data-color-mode": dataTheme,
|
|
41
|
+
}: LayoutProps) {
|
|
42
|
+
const layoutChildren = Children.toArray(children);
|
|
43
|
+
const hasLayoutTitle = Boolean(title || caption);
|
|
44
|
+
const showLayoutTitle = hasLayoutTitle && !onlyHeaderTitleShown;
|
|
45
|
+
|
|
46
|
+
const bgConfig: BackgroundImageValue | undefined =
|
|
47
|
+
typeof backgroundImage === "string"
|
|
48
|
+
? { src: backgroundImage }
|
|
49
|
+
: backgroundImage;
|
|
50
|
+
|
|
51
|
+
const bgSrc = bgConfig?.src ? normalizeUIKitImageSrc(bgConfig.src) : "";
|
|
52
|
+
|
|
53
|
+
const bgHeight =
|
|
54
|
+
bgConfig?.height ??
|
|
55
|
+
(typeof backgroundImage === "string" ? "100vh" : undefined);
|
|
56
|
+
|
|
57
|
+
const layoutContent = (
|
|
58
|
+
<View
|
|
59
|
+
width="100%"
|
|
60
|
+
height="100%"
|
|
61
|
+
style={{
|
|
62
|
+
position: "relative",
|
|
63
|
+
minWidth: 0,
|
|
64
|
+
overflowX: "hidden",
|
|
65
|
+
overflowY: "auto",
|
|
66
|
+
}}
|
|
67
|
+
fullWidth
|
|
68
|
+
data-color-mode={dataTheme}
|
|
69
|
+
column
|
|
70
|
+
alignItems="center"
|
|
71
|
+
>
|
|
72
|
+
{bgConfig && bgSrc && (
|
|
73
|
+
<View
|
|
74
|
+
height={bgHeight ?? "100vh"}
|
|
75
|
+
style={
|
|
76
|
+
{
|
|
77
|
+
position: "fixed",
|
|
78
|
+
inset: 0,
|
|
79
|
+
width: "100%",
|
|
80
|
+
overflow: "hidden",
|
|
81
|
+
zIndex: 0,
|
|
82
|
+
margin: bgConfig.margin
|
|
83
|
+
? resolveBgMargin(bgConfig.margin)
|
|
84
|
+
: undefined,
|
|
85
|
+
} as React.CSSProperties
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
<Image
|
|
89
|
+
alt=""
|
|
90
|
+
src={bgSrc}
|
|
91
|
+
fill
|
|
92
|
+
sizes="100vw"
|
|
93
|
+
style={
|
|
94
|
+
{
|
|
95
|
+
objectFit: "cover",
|
|
96
|
+
filter: bgConfig.filter,
|
|
97
|
+
} as React.CSSProperties
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
</View>
|
|
101
|
+
)}
|
|
102
|
+
<View className={styles.LayoutInner} column gap={36}>
|
|
103
|
+
<View column gap={0} fullWidth style={{ minWidth: 0 }}>
|
|
104
|
+
{showLayoutTitle && (
|
|
105
|
+
<Title
|
|
106
|
+
className={clsx(
|
|
107
|
+
styles.LayoutTitleWrapper,
|
|
108
|
+
mobileTitleShown && styles.LayoutTitleMobileOnly,
|
|
109
|
+
)}
|
|
110
|
+
title={title ? { text: title } : undefined}
|
|
111
|
+
titleType={titleType ?? "LargeTitle"}
|
|
112
|
+
titleClassName={styles.LayoutTitleText}
|
|
113
|
+
fontType={titleFontType}
|
|
114
|
+
caption={caption}
|
|
115
|
+
captionOpacity={0.8}
|
|
116
|
+
context={titleContext}
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
<View column gap={36} fullWidth style={{ minWidth: 0 }}>
|
|
120
|
+
{layoutChildren}
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
{header}
|
|
129
|
+
{layoutContent}
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function getLayoutSectionGroup(child: React.ReactNode) {
|
|
135
|
+
if (!isValidElement<Pick<LayoutSectionProps, "group">>(child)) {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (child.type === LayoutSection || child.props.group !== undefined) {
|
|
140
|
+
return child.props.group ?? "BaseFull";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function LayoutGrid({
|
|
147
|
+
children,
|
|
148
|
+
className,
|
|
149
|
+
style,
|
|
150
|
+
ratio,
|
|
151
|
+
gap,
|
|
152
|
+
groupGap,
|
|
153
|
+
"data-color-mode": dataTheme,
|
|
154
|
+
}: LayoutGridViewProps) {
|
|
155
|
+
const layoutChildren = Children.toArray(children);
|
|
156
|
+
const groups = new Map<string, React.ReactNode[]>();
|
|
157
|
+
const standaloneChildren: React.ReactNode[] = [];
|
|
158
|
+
|
|
159
|
+
for (const child of layoutChildren) {
|
|
160
|
+
const group = getLayoutSectionGroup(child);
|
|
161
|
+
|
|
162
|
+
if (!group) {
|
|
163
|
+
standaloneChildren.push(child);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
groups.set(group, [...(groups.get(group) ?? []), child]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<View
|
|
172
|
+
data-color-mode={dataTheme}
|
|
173
|
+
alignItems="start"
|
|
174
|
+
className={clsx(styles.LayoutGrid, className)}
|
|
175
|
+
style={
|
|
176
|
+
{
|
|
177
|
+
"--layout-grid-ratio": ratio,
|
|
178
|
+
...style,
|
|
179
|
+
} as React.CSSProperties
|
|
180
|
+
}
|
|
181
|
+
gap={gap}
|
|
182
|
+
gridTemplateColumns="var(--layout-grid-active-ratio)"
|
|
183
|
+
>
|
|
184
|
+
{[...groups.entries()].map(([group, groupChildren]) => (
|
|
185
|
+
<View
|
|
186
|
+
key={group}
|
|
187
|
+
column
|
|
188
|
+
gap={groupGap}
|
|
189
|
+
className={styles.LayoutGridGroup}
|
|
190
|
+
>
|
|
191
|
+
{groupChildren}
|
|
192
|
+
</View>
|
|
193
|
+
))}
|
|
194
|
+
{standaloneChildren}
|
|
195
|
+
</View>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function resolveSectionTitle(title: LayoutSectionProps["title"]) {
|
|
200
|
+
if (!title) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (Array.isArray(title) || (typeof title === "object" && "text" in title)) {
|
|
205
|
+
return title as TitleProps["title"];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return { text: title as React.ReactNode };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function resolveSectionTitleProps({
|
|
212
|
+
title,
|
|
213
|
+
titleProps,
|
|
214
|
+
titleType,
|
|
215
|
+
caption,
|
|
216
|
+
suffix,
|
|
217
|
+
meta,
|
|
218
|
+
actions,
|
|
219
|
+
}: Pick<
|
|
220
|
+
LayoutSectionProps,
|
|
221
|
+
| "actions"
|
|
222
|
+
| "caption"
|
|
223
|
+
| "meta"
|
|
224
|
+
| "suffix"
|
|
225
|
+
| "title"
|
|
226
|
+
| "titleProps"
|
|
227
|
+
| "titleType"
|
|
228
|
+
>): TitleProps[] {
|
|
229
|
+
if (titleProps) {
|
|
230
|
+
return Array.isArray(titleProps) ? titleProps : [titleProps];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const sectionTitle = resolveSectionTitle(title);
|
|
234
|
+
|
|
235
|
+
return sectionTitle
|
|
236
|
+
? [
|
|
237
|
+
{
|
|
238
|
+
title: sectionTitle,
|
|
239
|
+
titleType: titleType ?? "Title1",
|
|
240
|
+
caption,
|
|
241
|
+
suffix,
|
|
242
|
+
meta,
|
|
243
|
+
actions,
|
|
244
|
+
},
|
|
245
|
+
]
|
|
246
|
+
: [];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function getSectionTitleKey(item: TitleProps) {
|
|
250
|
+
return [
|
|
251
|
+
item.className,
|
|
252
|
+
item.titleType,
|
|
253
|
+
Array.isArray(item.title)
|
|
254
|
+
? item.title.map((t) => t.text).join("/")
|
|
255
|
+
: item.title?.text,
|
|
256
|
+
item.caption,
|
|
257
|
+
]
|
|
258
|
+
.filter(Boolean)
|
|
259
|
+
.join(":");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function LayoutSection({
|
|
263
|
+
children,
|
|
264
|
+
className,
|
|
265
|
+
gap,
|
|
266
|
+
group: _group,
|
|
267
|
+
mobileOrder,
|
|
268
|
+
title,
|
|
269
|
+
titleProps,
|
|
270
|
+
titleType = "Title1",
|
|
271
|
+
caption,
|
|
272
|
+
suffix,
|
|
273
|
+
meta,
|
|
274
|
+
actions,
|
|
275
|
+
...props
|
|
276
|
+
}: LayoutSectionProps) {
|
|
277
|
+
const sectionTitleProps = resolveSectionTitleProps({
|
|
278
|
+
actions,
|
|
279
|
+
caption,
|
|
280
|
+
meta,
|
|
281
|
+
suffix,
|
|
282
|
+
title,
|
|
283
|
+
titleProps,
|
|
284
|
+
titleType,
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<View
|
|
289
|
+
{...props}
|
|
290
|
+
column
|
|
291
|
+
gap={gap ?? 12}
|
|
292
|
+
mobileOrder={mobileOrder}
|
|
293
|
+
className={className}
|
|
294
|
+
fullWidth
|
|
295
|
+
style={{ minWidth: 0 }}
|
|
296
|
+
>
|
|
297
|
+
{sectionTitleProps.map((item) => (
|
|
298
|
+
<Title key={getSectionTitleKey(item)} {...item} />
|
|
299
|
+
))}
|
|
300
|
+
{children}
|
|
301
|
+
</View>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
Layout.Grid = LayoutGrid;
|
|
306
|
+
Layout.Section = LayoutSection;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import type { TextProps } from "@/packages/Components/Text/Text.types";
|
|
3
|
+
import type { TitleProps } from "@/packages/Components/Title/Title.types";
|
|
4
|
+
import type { UIKitSizeValue } from "@/packages/Frameworks/_shared/sizing";
|
|
5
|
+
import type { ViewProps } from "@/packages/Frameworks/View/View.types";
|
|
6
|
+
|
|
7
|
+
type BackgroundMarginUnitValue = UIKitSizeValue;
|
|
8
|
+
|
|
9
|
+
type BackgroundMarginValue =
|
|
10
|
+
| BackgroundMarginUnitValue
|
|
11
|
+
| readonly [BackgroundMarginUnitValue]
|
|
12
|
+
| readonly [BackgroundMarginUnitValue, BackgroundMarginUnitValue]
|
|
13
|
+
| readonly [
|
|
14
|
+
BackgroundMarginUnitValue,
|
|
15
|
+
BackgroundMarginUnitValue,
|
|
16
|
+
BackgroundMarginUnitValue,
|
|
17
|
+
]
|
|
18
|
+
| readonly [
|
|
19
|
+
BackgroundMarginUnitValue,
|
|
20
|
+
BackgroundMarginUnitValue,
|
|
21
|
+
BackgroundMarginUnitValue,
|
|
22
|
+
BackgroundMarginUnitValue,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export interface BackgroundImageValue {
|
|
26
|
+
height?: UIKitSizeValue;
|
|
27
|
+
src?: string;
|
|
28
|
+
filter?: CSSProperties["filter"];
|
|
29
|
+
margin?: BackgroundMarginValue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface LayoutProps {
|
|
33
|
+
"data-color-mode"?: string;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
title?: React.ReactNode;
|
|
36
|
+
caption?: React.ReactNode;
|
|
37
|
+
titleType?: TitleProps["titleType"];
|
|
38
|
+
titleFontType?: TextProps["fontType"];
|
|
39
|
+
mobileTitleShown?: boolean;
|
|
40
|
+
onlyHeaderTitleShown?: boolean;
|
|
41
|
+
header?: React.ReactNode;
|
|
42
|
+
titleContext?: React.ReactNode;
|
|
43
|
+
goTop?: boolean;
|
|
44
|
+
backgroundImage?: string | BackgroundImageValue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface LayoutGridViewProps {
|
|
48
|
+
"data-color-mode"?: string;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
className?: string;
|
|
51
|
+
style?: React.CSSProperties;
|
|
52
|
+
ratio?: string;
|
|
53
|
+
gap?: ViewProps["gap"];
|
|
54
|
+
groupGap?: ViewProps["gap"];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface LayoutSectionProps
|
|
58
|
+
extends Omit<
|
|
59
|
+
ViewProps,
|
|
60
|
+
"caption" | "column" | "mobileOrder" | "order" | "title"
|
|
61
|
+
> {
|
|
62
|
+
group?: "BaseFull" | "BaseSoft" | "BaseSoft" | (string & {});
|
|
63
|
+
mobileOrder?: number;
|
|
64
|
+
title?: React.ReactNode | TitleProps["title"];
|
|
65
|
+
titleProps?: TitleProps | TitleProps[];
|
|
66
|
+
titleType?: TitleProps["titleType"];
|
|
67
|
+
caption?: TitleProps["caption"];
|
|
68
|
+
suffix?: TitleProps["suffix"];
|
|
69
|
+
meta?: TitleProps["meta"];
|
|
70
|
+
actions?: TitleProps["actions"];
|
|
71
|
+
}
|