@noya-app/noya-designsystem 0.1.47 → 0.1.48
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +10 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +205 -106
- package/dist/index.d.ts +205 -106
- package/dist/index.js +2108 -1589
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2078 -1566
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -7
- package/src/__tests__/validateDropIndicator.test.ts +263 -0
- package/src/components/ActionMenu.tsx +40 -0
- package/src/components/ActivityIndicator.tsx +7 -1
- package/src/components/Collection.tsx +12 -2
- package/src/components/Combobox.tsx +14 -1
- package/src/components/ComboboxMenu.tsx +14 -5
- package/src/components/Dialog.tsx +17 -12
- package/src/components/Drawer.tsx +98 -0
- package/src/components/Grid.tsx +57 -27
- package/src/components/GridView.tsx +39 -25
- package/src/components/InputField.tsx +87 -92
- package/src/components/Label.tsx +7 -7
- package/src/components/List.tsx +42 -16
- package/src/components/ListView.tsx +21 -17
- package/src/components/MediaThumbnail.tsx +117 -0
- package/src/components/SearchCompletionMenu.tsx +30 -16
- package/src/components/SelectMenu.tsx +19 -17
- package/src/components/Sortable.tsx +70 -44
- package/src/components/internal/Menu.tsx +38 -23
- package/src/components/internal/MenuViewport.tsx +7 -1
- package/src/components/internal/SelectItem.tsx +51 -27
- package/src/components/internal/__tests__/Menu.test.tsx +12 -0
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +86 -0
- package/src/components/workspace/PanelWorkspaceLayout.tsx +102 -0
- package/src/components/{WorkspaceLayout.tsx → workspace/WorkspaceLayout.tsx} +109 -106
- package/src/components/workspace/types.ts +31 -0
- package/src/contexts/DialogContext.tsx +49 -34
- package/src/hooks/usePreservePanelSize.tsx +1 -5
- package/src/index.css +1 -0
- package/src/index.tsx +4 -1
- package/tailwind.config.ts +1 -0
|
@@ -24,31 +24,26 @@ function createDeferredPromise<T>() {
|
|
|
24
24
|
return { promise, resolve, reject };
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
type RenderableProps = { close: () => void };
|
|
28
|
+
|
|
27
29
|
export type DialogContextValue = {
|
|
28
|
-
openDialog(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
openDialog(
|
|
31
|
+
options: BaseDialogContents & {
|
|
32
|
+
children: ReactNode | ((props: RenderableProps) => ReactNode);
|
|
33
|
+
}
|
|
34
|
+
): Promise<void>;
|
|
33
35
|
|
|
34
36
|
openInputDialog(
|
|
35
37
|
options:
|
|
36
38
|
| string
|
|
37
|
-
| {
|
|
38
|
-
title: string;
|
|
39
|
-
description?: ReactNode;
|
|
39
|
+
| (BaseDialogContents & {
|
|
40
40
|
placeholder?: string;
|
|
41
41
|
initialValue?: string;
|
|
42
|
-
}
|
|
42
|
+
})
|
|
43
43
|
): Promise<string | undefined>;
|
|
44
44
|
|
|
45
45
|
openConfirmationDialog(
|
|
46
|
-
options:
|
|
47
|
-
| string
|
|
48
|
-
| {
|
|
49
|
-
title: string;
|
|
50
|
-
description?: ReactNode;
|
|
51
|
-
}
|
|
46
|
+
options: string | BaseDialogContents
|
|
52
47
|
): Promise<boolean>;
|
|
53
48
|
|
|
54
49
|
containsElement(element: HTMLElement): boolean;
|
|
@@ -56,26 +51,27 @@ export type DialogContextValue = {
|
|
|
56
51
|
|
|
57
52
|
const DialogContext = createContext<DialogContextValue | undefined>(undefined);
|
|
58
53
|
|
|
59
|
-
type
|
|
60
|
-
|
|
54
|
+
type BaseDialogContents = {
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
className?: string;
|
|
61
57
|
title: string;
|
|
62
58
|
description?: ReactNode;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type InputDialogContents = BaseDialogContents & {
|
|
62
|
+
type: "input";
|
|
63
63
|
placeholder?: string;
|
|
64
64
|
inputValue: string;
|
|
65
65
|
resolve: (value: string | undefined) => void;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
type ConfirmationDialogContents = {
|
|
68
|
+
type ConfirmationDialogContents = BaseDialogContents & {
|
|
69
69
|
type: "confirmation";
|
|
70
|
-
title: string;
|
|
71
|
-
description?: ReactNode;
|
|
72
70
|
resolve: (value: boolean) => void;
|
|
73
71
|
};
|
|
74
72
|
|
|
75
|
-
type CustomDialogContents = {
|
|
73
|
+
type CustomDialogContents = BaseDialogContents & {
|
|
76
74
|
type: "custom";
|
|
77
|
-
title: string;
|
|
78
|
-
description?: ReactNode;
|
|
79
75
|
children: ReactNode;
|
|
80
76
|
resolve: () => void;
|
|
81
77
|
};
|
|
@@ -95,16 +91,20 @@ export const DialogProvider = function DialogProvider({
|
|
|
95
91
|
const isOpen = !!contents;
|
|
96
92
|
|
|
97
93
|
const close = useCallback(() => {
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
if (contents) {
|
|
95
|
+
if (contents.type === "input") {
|
|
96
|
+
contents.resolve(undefined);
|
|
97
|
+
} else {
|
|
98
|
+
contents.resolve(false);
|
|
99
|
+
}
|
|
104
100
|
}
|
|
101
|
+
|
|
105
102
|
setContents(undefined);
|
|
106
103
|
}, [contents]);
|
|
107
104
|
|
|
105
|
+
const closeRef = useRef(close);
|
|
106
|
+
closeRef.current = close;
|
|
107
|
+
|
|
108
108
|
const submit = useCallback(() => {
|
|
109
109
|
if (!contents || contents.type !== "input") return;
|
|
110
110
|
|
|
@@ -115,7 +115,7 @@ export const DialogProvider = function DialogProvider({
|
|
|
115
115
|
const open: DialogContextValue["openInputDialog"] = useCallback((options) => {
|
|
116
116
|
const { promise, resolve } = createDeferredPromise<string | undefined>();
|
|
117
117
|
|
|
118
|
-
const { title, description, initialValue, placeholder } =
|
|
118
|
+
const { title, description, initialValue, placeholder, style, className } =
|
|
119
119
|
typeof options === "string" ? { title: options } : options;
|
|
120
120
|
|
|
121
121
|
setContents({
|
|
@@ -124,6 +124,8 @@ export const DialogProvider = function DialogProvider({
|
|
|
124
124
|
description,
|
|
125
125
|
inputValue: initialValue ?? "",
|
|
126
126
|
placeholder,
|
|
127
|
+
style,
|
|
128
|
+
className,
|
|
127
129
|
resolve: (value: string | undefined) => {
|
|
128
130
|
resolve(value);
|
|
129
131
|
setContents(undefined);
|
|
@@ -137,13 +139,15 @@ export const DialogProvider = function DialogProvider({
|
|
|
137
139
|
useCallback((options) => {
|
|
138
140
|
const { promise, resolve } = createDeferredPromise<boolean>();
|
|
139
141
|
|
|
140
|
-
const { title, description } =
|
|
142
|
+
const { title, description, style, className } =
|
|
141
143
|
typeof options === "string" ? { title: options } : options;
|
|
142
144
|
|
|
143
145
|
setContents({
|
|
144
146
|
type: "confirmation",
|
|
145
147
|
title,
|
|
146
148
|
description,
|
|
149
|
+
style,
|
|
150
|
+
className,
|
|
147
151
|
resolve: (value: boolean) => {
|
|
148
152
|
resolve(value);
|
|
149
153
|
setContents(undefined);
|
|
@@ -157,11 +161,20 @@ export const DialogProvider = function DialogProvider({
|
|
|
157
161
|
(options) => {
|
|
158
162
|
const { promise, resolve } = createDeferredPromise<void>();
|
|
159
163
|
|
|
164
|
+
const { title, description, style, className } = options;
|
|
165
|
+
|
|
166
|
+
const children =
|
|
167
|
+
typeof options.children === "function"
|
|
168
|
+
? options.children({ close: closeRef.current })
|
|
169
|
+
: options.children;
|
|
170
|
+
|
|
160
171
|
setContents({
|
|
161
172
|
type: "custom",
|
|
162
|
-
title
|
|
163
|
-
description
|
|
164
|
-
|
|
173
|
+
title,
|
|
174
|
+
description,
|
|
175
|
+
style,
|
|
176
|
+
className,
|
|
177
|
+
children,
|
|
165
178
|
resolve: () => {
|
|
166
179
|
resolve();
|
|
167
180
|
setContents(undefined);
|
|
@@ -214,6 +227,8 @@ export const DialogProvider = function DialogProvider({
|
|
|
214
227
|
title={contents?.title}
|
|
215
228
|
description={contents?.description}
|
|
216
229
|
open={isOpen}
|
|
230
|
+
style={contents?.style}
|
|
231
|
+
className={contents?.className}
|
|
217
232
|
onOpenChange={useCallback(
|
|
218
233
|
(isOpen: boolean) => {
|
|
219
234
|
if (!isOpen) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useLayoutEffect, useRef } from "react";
|
|
2
2
|
import { ImperativePanelGroupHandle } from "react-resizable-panels";
|
|
3
|
+
import { PanelLayoutState } from "../components/workspace/types";
|
|
3
4
|
import { useWindowSize } from "./useWindowSize";
|
|
4
5
|
|
|
5
6
|
export const EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
@@ -7,11 +8,6 @@ export const LEFT_SIDEBAR_ID = "editor-left-sidebar";
|
|
|
7
8
|
export const RIGHT_SIDEBAR_ID = "editor-right-sidebar";
|
|
8
9
|
export const CONTENT_AREA_ID = "editor-content-area";
|
|
9
10
|
|
|
10
|
-
export type PanelLayoutState = {
|
|
11
|
-
leftSidebarCollapsed: boolean;
|
|
12
|
-
rightSidebarCollapsed: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
11
|
export function usePreservePanelSize(
|
|
16
12
|
panelGroupRef: React.RefObject<ImperativePanelGroupHandle | null>,
|
|
17
13
|
setPanelLayoutState?: (state: PanelLayoutState) => void
|
package/src/index.css
CHANGED
package/src/index.tsx
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./components/ContextMenu";
|
|
|
14
14
|
export * from "./components/Dialog";
|
|
15
15
|
export * from "./components/Divider";
|
|
16
16
|
export * from "./components/DraggableMenuButton";
|
|
17
|
+
export * from "./components/Drawer";
|
|
17
18
|
export * from "./components/DropdownMenu";
|
|
18
19
|
export * from "./components/EditableText";
|
|
19
20
|
export * from "./components/Fade";
|
|
@@ -39,6 +40,7 @@ export * from "./components/LabeledElementView";
|
|
|
39
40
|
export * from "./components/LabeledField";
|
|
40
41
|
export * from "./components/List";
|
|
41
42
|
export * from "./components/ListView";
|
|
43
|
+
export * from "./components/MediaThumbnail";
|
|
42
44
|
export * from "./components/Message";
|
|
43
45
|
export * from "./components/Popover";
|
|
44
46
|
export * from "./components/Progress";
|
|
@@ -57,7 +59,8 @@ export * from "./components/Toast";
|
|
|
57
59
|
export * from "./components/Tooltip";
|
|
58
60
|
export * from "./components/TreeView";
|
|
59
61
|
export * from "./components/UserPointer";
|
|
60
|
-
export * from "./components/
|
|
62
|
+
export * from "./components/workspace/types";
|
|
63
|
+
export * from "./components/workspace/WorkspaceLayout";
|
|
61
64
|
// Contexts
|
|
62
65
|
export * from "./contexts/DesignSystemConfiguration";
|
|
63
66
|
export * from "./contexts/DialogContext";
|
package/tailwind.config.ts
CHANGED
|
@@ -189,6 +189,7 @@ const config = {
|
|
|
189
189
|
"inspector-h-separator": "var(--inspector-h-separator)",
|
|
190
190
|
"inspector-v-separator": "var(--inspector-v-separator)",
|
|
191
191
|
"dialog-padding": "var(--dialog-padding)",
|
|
192
|
+
"input-height": "var(--input-height)",
|
|
192
193
|
},
|
|
193
194
|
keyframes: {
|
|
194
195
|
spin: {
|