@noya-app/noya-designsystem 0.1.77 → 0.1.78
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 +20 -12
- package/CHANGELOG.md +9 -0
- package/dist/chunk-D57E6H3M.mjs +36 -0
- package/dist/chunk-D57E6H3M.mjs.map +1 -0
- package/dist/emojis.d.mts +1 -0
- package/dist/emojis.d.ts +1 -0
- package/dist/emojis.js +31 -0
- package/dist/emojis.js.map +1 -0
- package/dist/emojis.mjs +8 -0
- package/dist/emojis.mjs.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +142 -90
- package/dist/index.d.ts +142 -90
- package/dist/index.js +3171 -1745
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3349 -1918
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -7
- package/src/__tests__/__snapshots__/fuzzyScorer.test.ts.snap +1 -1
- package/src/components/Avatar.tsx +10 -10
- package/src/components/Banner.tsx +1 -1
- package/src/components/BaseToolbar.tsx +1 -1
- package/src/components/Button.tsx +2 -1
- package/src/components/Chip.tsx +1 -1
- package/src/components/ColorSwatchControl.tsx +22 -14
- package/src/components/CommandPalette.tsx +10 -6
- package/src/components/ContextMenu.tsx +249 -38
- package/src/components/Dialog.tsx +70 -67
- package/src/components/Drawer.tsx +56 -17
- package/src/components/DropdownMenu.tsx +305 -46
- package/src/components/EditableText.tsx +1 -1
- package/src/components/EmojiPicker.tsx +645 -0
- package/src/components/GridView.tsx +5 -1
- package/src/components/IVirtualizedList.tsx +21 -1
- package/src/components/InputField.tsx +2 -10
- package/src/components/InspectorContainer.tsx +4 -2
- package/src/components/Message.tsx +5 -16
- package/src/components/Popover.tsx +73 -107
- package/src/components/Progress.tsx +18 -18
- package/src/components/ScrollArea.tsx +66 -31
- package/src/components/ScrollableSidebar.tsx +1 -1
- package/src/components/SegmentedControl.tsx +166 -38
- package/src/components/SelectMenu.tsx +193 -101
- package/src/components/Slider.tsx +40 -38
- package/src/components/Switch.tsx +4 -4
- package/src/components/TextArea.tsx +1 -1
- package/src/components/Toast.tsx +99 -26
- package/src/components/Toolbar.tsx +114 -16
- package/src/components/Tooltip.tsx +18 -8
- package/src/components/Virtualized.tsx +193 -14
- package/src/components/VisuallyHidden.tsx +20 -0
- package/src/components/__tests__/Virtualized.math.test.ts +426 -1
- package/src/components/__tests__/Virtualized.test.tsx +129 -1
- package/src/components/ai-assistant/AIAssistantLayout.tsx +11 -6
- package/src/components/internal/Menu.tsx +4 -0
- package/src/components/listView/ListViewEditableRowTitle.tsx +1 -1
- package/src/components/listView/ListViewRoot.tsx +5 -1
- package/src/components/resizablePanels/Panel.tsx +94 -0
- package/src/components/resizablePanels/PanelGroup.tsx +498 -0
- package/src/components/resizablePanels/PanelGroupContext.tsx +14 -0
- package/src/components/resizablePanels/PanelResizeHandle.tsx +61 -0
- package/src/components/resizablePanels/index.ts +7 -0
- package/src/components/resizablePanels/types.ts +65 -0
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +22 -7
- package/src/components/workspace/PanelWorkspaceLayout.tsx +30 -84
- package/src/components/workspace/WorkspaceLayout.tsx +28 -58
- package/src/components/workspace/types.ts +6 -4
- package/src/contexts/DialogContext.tsx +15 -24
- package/src/emojis.ts +1 -0
- package/src/hooks/useTriggerToggle.ts +95 -0
- package/src/index.css +2 -0
- package/src/index.tsx +1 -2
- package/src/theme/proseTheme.ts +2 -0
- package/src/utils/mergeProps.ts +57 -0
- package/src/utils/skinTone.ts +90 -0
- package/tsup.config.ts +1 -1
- package/src/__tests__/workspaceLayout.test.ts +0 -281
- package/src/components/ScrollArea2.tsx +0 -76
- package/src/components/internal/MenuViewport.tsx +0 -178
- package/src/components/internal/SelectItem.tsx +0 -138
- package/src/components/workspace/panelStorage.ts +0 -216
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Dialog as DialogPrimitive
|
|
3
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
4
4
|
import React, {
|
|
5
|
-
ComponentProps,
|
|
6
5
|
ForwardedRef,
|
|
7
6
|
forwardRef,
|
|
8
7
|
ReactNode,
|
|
@@ -12,24 +11,25 @@ import React, {
|
|
|
12
11
|
import { cx } from "../utils/classNames";
|
|
13
12
|
import { IconButton } from "./IconButton";
|
|
14
13
|
import { Spacer } from "./Spacer";
|
|
14
|
+
import { VisuallyHidden } from "./VisuallyHidden";
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
React.
|
|
16
|
+
const StyledBackdrop = forwardRef<
|
|
17
|
+
HTMLDivElement,
|
|
18
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
19
19
|
>(({ className, ...props }, ref) => (
|
|
20
|
-
<DialogPrimitive.
|
|
20
|
+
<DialogPrimitive.Backdrop
|
|
21
21
|
ref={ref}
|
|
22
22
|
className={cx(`n-fixed n-inset-0 n-bg-[rgba(0,0,0,0.5)]`, className)}
|
|
23
23
|
{...props}
|
|
24
24
|
/>
|
|
25
25
|
));
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
React.
|
|
27
|
+
const StyledPopup = forwardRef<
|
|
28
|
+
HTMLDivElement,
|
|
29
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
30
30
|
>(({ className, children, ...props }, ref) => {
|
|
31
31
|
return (
|
|
32
|
-
<DialogPrimitive.
|
|
32
|
+
<DialogPrimitive.Popup
|
|
33
33
|
ref={ref}
|
|
34
34
|
className={cx(
|
|
35
35
|
`n-fixed n-top-1/2 n-left-1/2 -n-translate-x-1/2 -n-translate-y-1/2 n-w-[90vw] n-max-w-[550px] n-max-h-[85vh] n-p-dialog-padding n-rounded-[2px] n-font-sans n-text-heading5 n-font-normal n-leading-[19px] n-text-text-muted n-bg-popover-background n-pointer-events-all n-z-[1000] focus:n-outline-none n-shadow-dialog-shadow n-flex n-flex-col`,
|
|
@@ -38,13 +38,13 @@ const StyledContent = forwardRef<
|
|
|
38
38
|
{...props}
|
|
39
39
|
>
|
|
40
40
|
{children}
|
|
41
|
-
</DialogPrimitive.
|
|
41
|
+
</DialogPrimitive.Popup>
|
|
42
42
|
);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
const StyledTitle = forwardRef<
|
|
46
|
-
|
|
47
|
-
React.
|
|
46
|
+
HTMLHeadingElement,
|
|
47
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
48
48
|
>(({ className, ...props }, ref) => (
|
|
49
49
|
<DialogPrimitive.Title
|
|
50
50
|
ref={ref}
|
|
@@ -57,8 +57,8 @@ const StyledTitle = forwardRef<
|
|
|
57
57
|
));
|
|
58
58
|
|
|
59
59
|
const StyledDescription = forwardRef<
|
|
60
|
-
|
|
61
|
-
React.
|
|
60
|
+
HTMLParagraphElement,
|
|
61
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
62
62
|
>(({ className, ...props }, ref) => (
|
|
63
63
|
<DialogPrimitive.Description
|
|
64
64
|
ref={ref}
|
|
@@ -78,12 +78,9 @@ interface Props {
|
|
|
78
78
|
title?: ReactNode;
|
|
79
79
|
description?: ReactNode;
|
|
80
80
|
children?: ReactNode;
|
|
81
|
-
style?:
|
|
82
|
-
open:
|
|
83
|
-
onOpenChange?:
|
|
84
|
-
onOpenAutoFocus?: ComponentProps<
|
|
85
|
-
typeof DialogPrimitive.Content
|
|
86
|
-
>["onOpenAutoFocus"];
|
|
81
|
+
style?: React.CSSProperties;
|
|
82
|
+
open: boolean;
|
|
83
|
+
onOpenChange?: (open: boolean) => void;
|
|
87
84
|
closeOnInteractOutside?: boolean;
|
|
88
85
|
showCloseButton?: boolean;
|
|
89
86
|
className?: string;
|
|
@@ -97,8 +94,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
97
94
|
open,
|
|
98
95
|
style,
|
|
99
96
|
onOpenChange,
|
|
100
|
-
|
|
101
|
-
closeOnInteractOutside = true,
|
|
97
|
+
closeOnInteractOutside: _closeOnInteractOutside = true,
|
|
102
98
|
className,
|
|
103
99
|
showCloseButton = true,
|
|
104
100
|
}: Props,
|
|
@@ -113,52 +109,59 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
113
109
|
},
|
|
114
110
|
}));
|
|
115
111
|
|
|
112
|
+
const handleOpenChange = (newOpen: boolean) => {
|
|
113
|
+
onOpenChange?.(newOpen);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
116
|
return (
|
|
117
|
-
<DialogPrimitive.Root
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
117
|
+
<DialogPrimitive.Root
|
|
118
|
+
open={open}
|
|
119
|
+
onOpenChange={handleOpenChange}
|
|
120
|
+
modal={true}
|
|
121
|
+
>
|
|
122
|
+
<DialogPrimitive.Portal>
|
|
123
|
+
<StyledBackdrop />
|
|
124
|
+
<StyledPopup
|
|
125
|
+
ref={contentRef}
|
|
126
|
+
style={style}
|
|
127
|
+
className={className}
|
|
128
|
+
aria-describedby={typeof description === "string" ? description : ""}
|
|
129
|
+
>
|
|
130
|
+
{showCloseButton && (
|
|
131
|
+
<DialogPrimitive.Close
|
|
132
|
+
render={
|
|
133
|
+
<IconButton
|
|
134
|
+
iconName="Cross1Icon"
|
|
135
|
+
className="n-z-[1]"
|
|
136
|
+
style={{
|
|
137
|
+
position: "absolute",
|
|
138
|
+
top: "var(--n-dialog-padding)",
|
|
139
|
+
right: "var(--n-dialog-padding)",
|
|
140
|
+
}}
|
|
141
|
+
/>
|
|
142
|
+
}
|
|
140
143
|
/>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</
|
|
144
|
+
)}
|
|
145
|
+
{title && (
|
|
146
|
+
<>
|
|
147
|
+
<StyledTitle>{title}</StyledTitle>
|
|
148
|
+
<Spacer.Vertical size={description ? 10 : 20} />
|
|
149
|
+
</>
|
|
150
|
+
)}
|
|
151
|
+
{!title && (
|
|
152
|
+
<VisuallyHidden>
|
|
153
|
+
<StyledTitle>Dialog</StyledTitle>
|
|
154
|
+
</VisuallyHidden>
|
|
155
|
+
)}
|
|
156
|
+
{description && (
|
|
157
|
+
<>
|
|
158
|
+
<StyledDescription>{description}</StyledDescription>
|
|
159
|
+
<Spacer.Vertical size={20} />
|
|
160
|
+
</>
|
|
161
|
+
)}
|
|
162
|
+
{children}
|
|
163
|
+
</StyledPopup>
|
|
164
|
+
</DialogPrimitive.Portal>
|
|
162
165
|
</DialogPrimitive.Root>
|
|
163
166
|
);
|
|
164
167
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
3
4
|
import { useControlledOrUncontrolled } from "@noya-app/react-utils";
|
|
4
|
-
import { Dialog } from "radix-ui";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { useImperativeHandle } from "react";
|
|
7
|
+
import { useTriggerToggle } from "../hooks/useTriggerToggle";
|
|
7
8
|
import { cx } from "../utils/classNames";
|
|
9
|
+
import { mergePropsWithEventComposition } from "../utils/mergeProps";
|
|
8
10
|
import { SidebarRef } from "./workspace/types";
|
|
9
11
|
|
|
10
12
|
export type DrawerProps = {
|
|
@@ -22,6 +24,7 @@ export type DrawerProps = {
|
|
|
22
24
|
side?: "left" | "right";
|
|
23
25
|
portalled?: boolean;
|
|
24
26
|
portalContainer?: HTMLElement | null;
|
|
27
|
+
modal?: boolean;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export const Drawer = React.memo(
|
|
@@ -41,6 +44,7 @@ export const Drawer = React.memo(
|
|
|
41
44
|
portalContainer,
|
|
42
45
|
overlayClassName,
|
|
43
46
|
overlayStyle,
|
|
47
|
+
modal = true,
|
|
44
48
|
}: DrawerProps,
|
|
45
49
|
forwardedRef: React.ForwardedRef<SidebarRef>
|
|
46
50
|
) {
|
|
@@ -50,21 +54,30 @@ export const Drawer = React.memo(
|
|
|
50
54
|
onChange: onOpenChange,
|
|
51
55
|
});
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
const { setAnchorElement, popupRef, handleOpenChange } = useTriggerToggle(
|
|
58
|
+
internalOpen,
|
|
59
|
+
setInternalOpen
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
useImperativeHandle(
|
|
63
|
+
forwardedRef,
|
|
64
|
+
() => ({
|
|
65
|
+
expand: () => {
|
|
66
|
+
handleOpenChange(true);
|
|
67
|
+
},
|
|
68
|
+
collapse: () => {
|
|
69
|
+
handleOpenChange(false);
|
|
70
|
+
},
|
|
71
|
+
isExpanded: () => {
|
|
72
|
+
return internalOpen;
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
[internalOpen, handleOpenChange]
|
|
76
|
+
);
|
|
64
77
|
|
|
65
78
|
const inner = (
|
|
66
79
|
<>
|
|
67
|
-
<Dialog.
|
|
80
|
+
<Dialog.Backdrop
|
|
68
81
|
className={cx(
|
|
69
82
|
"n-inset-0 n-bg-black/50",
|
|
70
83
|
positioning === "absolute" ? "n-absolute" : "n-fixed",
|
|
@@ -72,7 +85,8 @@ export const Drawer = React.memo(
|
|
|
72
85
|
)}
|
|
73
86
|
style={overlayStyle}
|
|
74
87
|
/>
|
|
75
|
-
<Dialog.
|
|
88
|
+
<Dialog.Popup
|
|
89
|
+
ref={popupRef}
|
|
76
90
|
id={id}
|
|
77
91
|
style={style}
|
|
78
92
|
className={cx(
|
|
@@ -84,7 +98,7 @@ export const Drawer = React.memo(
|
|
|
84
98
|
>
|
|
85
99
|
{title && <Dialog.Title>{title}</Dialog.Title>}
|
|
86
100
|
{children}
|
|
87
|
-
</Dialog.
|
|
101
|
+
</Dialog.Popup>
|
|
88
102
|
</>
|
|
89
103
|
);
|
|
90
104
|
|
|
@@ -92,9 +106,34 @@ export const Drawer = React.memo(
|
|
|
92
106
|
<Dialog.Root
|
|
93
107
|
key="dialog"
|
|
94
108
|
open={internalOpen}
|
|
95
|
-
onOpenChange={
|
|
109
|
+
onOpenChange={handleOpenChange}
|
|
110
|
+
modal={modal}
|
|
96
111
|
>
|
|
97
|
-
<Dialog.Trigger
|
|
112
|
+
<Dialog.Trigger
|
|
113
|
+
key="trigger"
|
|
114
|
+
render={(triggerProps) => {
|
|
115
|
+
const element = React.isValidElement(trigger) ? (
|
|
116
|
+
trigger
|
|
117
|
+
) : (
|
|
118
|
+
<span>{trigger}</span>
|
|
119
|
+
);
|
|
120
|
+
const childProps = element.props as Record<string, unknown>;
|
|
121
|
+
const mergedProps = mergePropsWithEventComposition(
|
|
122
|
+
triggerProps as Record<string, unknown>,
|
|
123
|
+
childProps
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// Track anchor element for click detection
|
|
127
|
+
mergedProps.ref = (node: Element | null) => {
|
|
128
|
+
if (node) setAnchorElement(node);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return React.cloneElement(
|
|
132
|
+
element as React.ReactElement<any>,
|
|
133
|
+
mergedProps
|
|
134
|
+
);
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
98
137
|
{portalled ? (
|
|
99
138
|
<Dialog.Portal container={portalContainer}>{inner}</Dialog.Portal>
|
|
100
139
|
) : (
|