@gogitcms/design-system 0.16.0-next.12 → 0.16.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/css/tokens.css +1 -0
- package/package.json +1 -1
- package/src/__tests__/BranchMenu.test.tsx +38 -0
- package/src/__tests__/ContentBrowser.changes.test.tsx +23 -14
- package/src/__tests__/ContentBrowser.contentslot.test.tsx +10 -6
- package/src/__tests__/ContentBrowser.expand.test.tsx +170 -0
- package/src/__tests__/ContentBrowser.forms.test.tsx +25 -20
- package/src/__tests__/ContentBrowser.listrow.test.tsx +57 -0
- package/src/__tests__/ContentBrowser.master.test.tsx +147 -0
- package/src/__tests__/ContentBrowser.media.test.tsx +2 -1
- package/src/__tests__/ContentBrowser.references.test.tsx +3 -3
- package/src/__tests__/ContentBrowser.reorder.test.tsx +2 -3
- package/src/__tests__/ContentBrowser.window.test.tsx +203 -0
- package/src/__tests__/MediaBrowser.test.tsx +15 -9
- package/src/__tests__/ProtectedBranchModal.test.tsx +14 -0
- package/src/__tests__/cssTokens.test.ts +1 -0
- package/src/__tests__/documentDrafts.test.ts +59 -0
- package/src/components/BranchMenu.tsx +14 -4
- package/src/components/ContentBrowser.tsx +584 -460
- package/src/components/Input.tsx +37 -5
- package/src/components/MediaField.tsx +2 -2
- package/src/components/Notifications.tsx +10 -1
- package/src/components/ProjectMenu.tsx +100 -26
- package/src/components/ProtectedBranchModal.tsx +19 -7
- package/src/components/Skeleton.tsx +12 -19
- package/src/components/WorkspaceMenu.tsx +163 -0
- package/src/components/documentDrafts.ts +19 -4
- package/src/components/layout.tsx +33 -1
- package/src/icons.ts +5 -0
- package/src/index.ts +4 -1
- package/src/references.ts +1 -1
- package/src/theme.ts +3 -1
|
@@ -39,24 +39,50 @@ export function Screen({
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* What a host that draws its own window chrome needs from the top bar: room at
|
|
44
|
+
* the leading edge for the platform's window controls (the macOS traffic
|
|
45
|
+
* lights, when the app hides the title bar), and the bar marked as the place
|
|
46
|
+
* the window is dragged by. The web and mobile apps have a browser or an OS
|
|
47
|
+
* doing this for them and pass nothing.
|
|
48
|
+
*/
|
|
49
|
+
export type WindowChrome = {
|
|
50
|
+
/** Width, in px, kept clear at the bar's leading edge. */
|
|
51
|
+
leadingInset?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The bar's height, when it has to match the platform's title bar: the
|
|
54
|
+
* controls drawn over it are centred on that, not on the bar.
|
|
55
|
+
*/
|
|
56
|
+
height?: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
42
59
|
/** Horizontal top bar with left / center / right slots. */
|
|
43
60
|
export function TopBar({
|
|
44
61
|
left,
|
|
45
62
|
center,
|
|
46
63
|
right,
|
|
64
|
+
windowChrome,
|
|
47
65
|
}: {
|
|
48
66
|
left?: React.ReactNode;
|
|
49
67
|
center?: React.ReactNode;
|
|
50
68
|
right?: React.ReactNode;
|
|
69
|
+
windowChrome?: WindowChrome;
|
|
51
70
|
}) {
|
|
52
71
|
const t = useTheme();
|
|
53
72
|
return (
|
|
54
73
|
<View
|
|
74
|
+
// The bar is where a chromeless window is dragged from. The host reads
|
|
75
|
+
// this attribute (data-window-drag) on mousedown, and only over the bar
|
|
76
|
+
// itself: the controls on it stay controls.
|
|
77
|
+
// @ts-expect-error react-native-web accepts dataSet -> data-* attributes
|
|
78
|
+
dataSet={windowChrome ? { windowDrag: "true" } : undefined}
|
|
79
|
+
testID="top-bar"
|
|
55
80
|
style={{
|
|
56
|
-
height: t.layout.topbar,
|
|
81
|
+
height: windowChrome?.height ?? t.layout.topbar,
|
|
57
82
|
flexDirection: "row",
|
|
58
83
|
alignItems: "center",
|
|
59
84
|
paddingHorizontal: t.space(3),
|
|
85
|
+
paddingLeft: t.space(3) + (windowChrome?.leadingInset ?? 0),
|
|
60
86
|
gap: t.space(3),
|
|
61
87
|
borderBottomWidth: 1,
|
|
62
88
|
// Hairline appropriate to the dark chrome in both modes.
|
|
@@ -176,6 +202,12 @@ export function Pane({
|
|
|
176
202
|
gap: t.space(2),
|
|
177
203
|
borderBottomWidth: 1,
|
|
178
204
|
borderBottomColor: t.color.borderSubtle,
|
|
205
|
+
// Above the body, so a menu opened from the header (the master
|
|
206
|
+
// pane's title switcher) paints over the list beneath it rather
|
|
207
|
+
// than under it. Views stack in tree order otherwise, and the body
|
|
208
|
+
// comes second.
|
|
209
|
+
position: "relative",
|
|
210
|
+
zIndex: 10,
|
|
179
211
|
}}
|
|
180
212
|
>
|
|
181
213
|
{header}
|
package/src/icons.ts
CHANGED
|
@@ -47,6 +47,11 @@ export const icons = {
|
|
|
47
47
|
copy: ["M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2Z", "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2"],
|
|
48
48
|
lock: ["M5 11h14a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2Z", "M7 11V7a5 5 0 0 1 10 0v4"],
|
|
49
49
|
panelLeft: ["M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2Z", "M9 3v18"],
|
|
50
|
+
// Corner arrows (maximize/minimize): the pair the markdown editor already
|
|
51
|
+
// draws for its focus mode, so "take over the screen" reads the same whether
|
|
52
|
+
// it is a field or a whole pane doing it.
|
|
53
|
+
maximize: ["M15 3h6v6", "M9 21H3v-6", "m21 3-7 7", "m3 21 7-7"],
|
|
54
|
+
minimize: ["M4 14h6v6", "M20 10h-6V4", "m14 10 7-7", "m3 21 7-7"],
|
|
50
55
|
more: ["M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z", "M19 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z", "M5 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"],
|
|
51
56
|
gripVertical: [
|
|
52
57
|
"M9 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z", "M9 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z", "M9 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
|
package/src/index.ts
CHANGED
|
@@ -43,7 +43,9 @@ export type { SegmentProps, SegmentItem } from "./components/Segment";
|
|
|
43
43
|
export { BranchMenu } from "./components/BranchMenu";
|
|
44
44
|
export type { BranchMenuProps, BranchRef } from "./components/BranchMenu";
|
|
45
45
|
export { ProjectMenu } from "./components/ProjectMenu";
|
|
46
|
-
export type { ProjectMenuProps, ProjectRef } from "./components/ProjectMenu";
|
|
46
|
+
export type { ProjectMenuProps, ProjectRef, ProjectMenuAction } from "./components/ProjectMenu";
|
|
47
|
+
export { WorkspaceMenu, workspaceInitials } from "./components/WorkspaceMenu";
|
|
48
|
+
export type { WorkspaceMenuProps, WorkspaceRef, WorkspaceMenuAction } from "./components/WorkspaceMenu";
|
|
47
49
|
|
|
48
50
|
// Apply changes (merge) progress modal
|
|
49
51
|
export { ApplyChangesModal } from "./components/ApplyChangesModal";
|
|
@@ -134,6 +136,7 @@ export {
|
|
|
134
136
|
MobileScreen,
|
|
135
137
|
ThemeToggle,
|
|
136
138
|
} from "./components/layout";
|
|
139
|
+
export type { WindowChrome } from "./components/layout";
|
|
137
140
|
|
|
138
141
|
// Media: the picker control, its previews, and the host data seam
|
|
139
142
|
export { MediaField, MediaPicker, MediaProvider, DocumentPathProvider, useMediaApi, useFieldMedia, pathForStoreAs } from "./components/MediaField";
|
package/src/references.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ReferenceDef {
|
|
|
17
17
|
key: string;
|
|
18
18
|
// For the object shape, the child that holds the key ("ref" unless renamed).
|
|
19
19
|
keyName: string;
|
|
20
|
-
// The embedded copies, in the order
|
|
20
|
+
// The embedded copies, in the order their children are listed.
|
|
21
21
|
embed: ReferenceEmbed[];
|
|
22
22
|
// What deleting a referenced document does: restrict | unset.
|
|
23
23
|
onDelete: string;
|
package/src/theme.ts
CHANGED
|
@@ -81,7 +81,9 @@ export function makeTheme(mode: ThemeMode) {
|
|
|
81
81
|
space: (n: number) => n * 4,
|
|
82
82
|
radius: { sm: 3, md: 5, lg: 8, pill: 999 },
|
|
83
83
|
control: { sm: 28, md: 34, lg: 40 },
|
|
84
|
-
|
|
84
|
+
// `master` is the editor's master pane (sections at rest, a collection's
|
|
85
|
+
// entries pushed in): wide enough for a two-line entry row.
|
|
86
|
+
layout: { sidebar: 260, master: 340, column: 300, topbar: 48, container: 1200 },
|
|
85
87
|
font: { sans: fontSans, mono: fontMono },
|
|
86
88
|
type: {
|
|
87
89
|
display: { size: 40, line: 44 },
|