@noya-app/noya-designsystem 0.1.64 → 0.1.65
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 +13 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +501 -228
- package/dist/index.d.ts +501 -228
- package/dist/index.js +6738 -2571
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6697 -2499
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/ActivityIndicator.tsx +9 -4
- package/src/components/ActivityLog.tsx +197 -0
- package/src/components/AnimatePresence.tsx +37 -22
- package/src/components/Avatar.tsx +42 -25
- package/src/components/Banner.tsx +57 -11
- package/src/components/BaseToolbar.tsx +29 -7
- package/src/components/Breadcrumbs.tsx +2 -2
- package/src/components/Button.tsx +23 -24
- package/src/components/Checkbox.tsx +6 -35
- package/src/components/Chip.tsx +45 -33
- package/src/components/Collection.tsx +16 -11
- package/src/components/ColorSwatch.tsx +3 -3
- package/src/components/ColorSwatchControl.tsx +2 -2
- package/src/components/Combobox.tsx +6 -6
- package/src/components/ComboboxMenu.tsx +6 -5
- package/src/components/CommandPalette.tsx +1 -1
- package/src/components/Dialog.tsx +6 -12
- package/src/components/Divider.tsx +8 -8
- package/src/components/DraggableMenuButton.tsx +9 -5
- package/src/components/Drawer.tsx +5 -5
- package/src/components/DropdownMenu.tsx +1 -1
- package/src/components/EditableText.tsx +2 -2
- package/src/components/Fade.tsx +13 -13
- package/src/components/FileUploadIndicator.tsx +11 -11
- package/src/components/FloatingWindow.tsx +2 -2
- package/src/components/Grid.tsx +18 -11
- package/src/components/GridView.tsx +32 -25
- package/src/components/IVirtualizedList.tsx +5 -0
- package/src/components/Icons.tsx +24 -4
- package/src/components/InputField.tsx +19 -19
- package/src/components/InspectorContainer.tsx +2 -2
- package/src/components/InspectorPrimitives.tsx +15 -9
- package/src/components/Label.tsx +4 -3
- package/src/components/LabeledElementView.tsx +3 -3
- package/src/components/LabeledField.tsx +6 -6
- package/src/components/List.tsx +103 -45
- package/src/components/ListMenu.tsx +91 -0
- package/src/components/ListNavigator.tsx +106 -0
- package/src/components/ListView.tsx +20 -1158
- package/src/components/MediaThumbnail.tsx +56 -15
- package/src/components/Message.tsx +5 -5
- package/src/components/Navigator.tsx +461 -0
- package/src/components/NoyaLogo.tsx +1 -1
- package/src/components/Popover.tsx +9 -5
- package/src/components/Progress.tsx +19 -9
- package/src/components/ResizableContainer.tsx +187 -0
- package/src/components/RingProgress.tsx +128 -0
- package/src/components/ScrollArea.tsx +4 -4
- package/src/components/ScrollableSidebar.tsx +10 -0
- package/src/components/SearchCompletionMenu.tsx +3 -3
- package/src/components/Section.tsx +107 -57
- package/src/components/SegmentedControl.tsx +29 -29
- package/src/components/SelectMenu.tsx +13 -20
- package/src/components/SelectionToolbar.tsx +4 -3
- package/src/components/Slider.tsx +9 -9
- package/src/components/Spacer.tsx +2 -2
- package/src/components/StackNavigator.tsx +378 -0
- package/src/components/Stepper.tsx +88 -0
- package/src/components/Switch.tsx +4 -4
- package/src/components/Tabs.tsx +3 -3
- package/src/components/Text.tsx +23 -13
- package/src/components/TextArea.tsx +3 -3
- package/src/components/Toast.tsx +4 -4
- package/src/components/Toolbar.tsx +50 -9
- package/src/components/ToolbarDrawer.tsx +2 -2
- package/src/components/Tooltip.tsx +1 -1
- package/src/components/TreeView.tsx +11 -4
- package/src/components/UserPointer.tsx +4 -4
- package/src/components/ai-assistant/AIAssistantLayout.tsx +8 -8
- package/src/components/blocks/ImageBlockComponent.tsx +13 -7
- package/src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx +4 -4
- package/src/components/file-explorer/FileExplorerLayout.tsx +20 -8
- package/src/components/internal/Checkmark.tsx +1 -1
- package/src/components/internal/Menu.tsx +22 -18
- package/src/components/internal/MenuViewport.tsx +13 -6
- package/src/components/internal/SelectItem.tsx +3 -3
- package/src/components/internal/TextInput.tsx +5 -1
- package/src/components/listView/ListViewContexts.tsx +68 -0
- package/src/components/listView/ListViewEditableRowTitle.tsx +55 -0
- package/src/components/listView/ListViewRoot.tsx +521 -0
- package/src/components/listView/ListViewRow.tsx +475 -0
- package/src/components/listView/ListViewRowTitle.tsx +21 -0
- package/src/components/listView/types.ts +11 -0
- package/src/components/pipeline/PipelineResultLayout.tsx +6 -6
- package/src/components/sorting/DragRegistration.tsx +2 -1
- package/src/components/sorting/SharedDragProvider.tsx +91 -9
- package/src/components/sorting/Sortable.tsx +71 -17
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +5 -5
- package/src/components/workspace/PanelWorkspaceLayout.tsx +65 -49
- package/src/components/workspace/VerticalTabMenu.tsx +25 -15
- package/src/components/workspace/WorkspaceLayout.tsx +30 -21
- package/src/contexts/DialogContext.tsx +17 -5
- package/src/hooks/useIndent.ts +3 -8
- package/src/index.css +24 -10
- package/src/index.tsx +10 -5
- package/src/utils/classNames.ts +52 -6
- package/src/utils/editableBlockStyles.ts +2 -2
- package/src/utils/formatByteSize.ts +1 -0
- package/src/utils/inputs.ts +8 -6
- package/src/utils/sketchColor.ts +0 -34
- package/tailwind.config.ts +1 -0
- package/src/components/FillInputField.tsx +0 -37
- package/src/components/FillPreviewBackground.tsx +0 -134
- package/src/components/GradientPicker.tsx +0 -90
- package/src/utils/getGradientBackground.tsx +0 -31
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRefGeneric, memoGeneric } from "@noya-app/react-utils";
|
|
4
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
+
import React, {
|
|
6
|
+
CSSProperties,
|
|
7
|
+
ForwardedRef,
|
|
8
|
+
forwardRef,
|
|
9
|
+
ReactNode,
|
|
10
|
+
Ref,
|
|
11
|
+
useCallback,
|
|
12
|
+
useContext,
|
|
13
|
+
useMemo,
|
|
14
|
+
} from "react";
|
|
15
|
+
import { mergeEventHandlers } from "../../hooks/mergeEventHandlers";
|
|
16
|
+
import { useHover } from "../../hooks/useHover";
|
|
17
|
+
import { cssVars } from "../../theme";
|
|
18
|
+
import { cx } from "../../utils/classNames";
|
|
19
|
+
import { ContextMenu } from "../ContextMenu";
|
|
20
|
+
import { MenuItem } from "../internal/Menu";
|
|
21
|
+
import { Sortable } from "../sorting/Sortable";
|
|
22
|
+
import { RelativeDropPosition } from "../sorting/sorting";
|
|
23
|
+
import { Spacer } from "../Spacer";
|
|
24
|
+
import {
|
|
25
|
+
ListRowContext,
|
|
26
|
+
ListViewContext,
|
|
27
|
+
ListViewDraggingContext,
|
|
28
|
+
} from "./ListViewContexts";
|
|
29
|
+
import {
|
|
30
|
+
ListColorScheme,
|
|
31
|
+
ListRowMarginType,
|
|
32
|
+
ListRowPosition,
|
|
33
|
+
ListViewSectionHeaderVariant,
|
|
34
|
+
ListViewVariant,
|
|
35
|
+
} from "./types";
|
|
36
|
+
|
|
37
|
+
/* ----------------------------------------------------------------------------
|
|
38
|
+
* Row
|
|
39
|
+
* ------------------------------------------------------------------------- */
|
|
40
|
+
|
|
41
|
+
const RowContainer = forwardRef<
|
|
42
|
+
HTMLDivElement,
|
|
43
|
+
React.HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
$marginType: ListRowMarginType;
|
|
45
|
+
$selected: boolean;
|
|
46
|
+
$selectedPosition: ListRowPosition;
|
|
47
|
+
$disabled: boolean;
|
|
48
|
+
$hovered: boolean;
|
|
49
|
+
$variant: ListViewVariant;
|
|
50
|
+
$divider: boolean;
|
|
51
|
+
$isSectionHeader: boolean;
|
|
52
|
+
$showsActiveState: boolean;
|
|
53
|
+
$sectionHeaderVariant: ListViewSectionHeaderVariant;
|
|
54
|
+
$colorScheme: ListColorScheme;
|
|
55
|
+
$backgroundColor?: CSSProperties["backgroundColor"];
|
|
56
|
+
$clickable?: boolean;
|
|
57
|
+
href?: string;
|
|
58
|
+
as?: React.ElementType;
|
|
59
|
+
}
|
|
60
|
+
>(
|
|
61
|
+
(
|
|
62
|
+
{
|
|
63
|
+
as: Component = "div",
|
|
64
|
+
href,
|
|
65
|
+
className,
|
|
66
|
+
$marginType,
|
|
67
|
+
$selected,
|
|
68
|
+
$selectedPosition,
|
|
69
|
+
$disabled,
|
|
70
|
+
$hovered,
|
|
71
|
+
$variant,
|
|
72
|
+
$divider,
|
|
73
|
+
$isSectionHeader,
|
|
74
|
+
$showsActiveState,
|
|
75
|
+
$sectionHeaderVariant,
|
|
76
|
+
$colorScheme,
|
|
77
|
+
$backgroundColor,
|
|
78
|
+
style,
|
|
79
|
+
$clickable,
|
|
80
|
+
"aria-describedby": _, // Causes hydration warning
|
|
81
|
+
role,
|
|
82
|
+
"aria-label": ariaLabel,
|
|
83
|
+
"aria-roledescription": ariaRoleDescription,
|
|
84
|
+
"aria-selected": ariaSelected,
|
|
85
|
+
...props
|
|
86
|
+
},
|
|
87
|
+
ref
|
|
88
|
+
) => {
|
|
89
|
+
return (
|
|
90
|
+
<Component
|
|
91
|
+
ref={ref}
|
|
92
|
+
href={href}
|
|
93
|
+
role={role}
|
|
94
|
+
aria-label={ariaLabel}
|
|
95
|
+
aria-roledescription={ariaRoleDescription}
|
|
96
|
+
aria-selected={ariaSelected ?? $selected}
|
|
97
|
+
className={cx(
|
|
98
|
+
$isSectionHeader && $sectionHeaderVariant === "label"
|
|
99
|
+
? "n-font-sans n-text-label n-uppercase n-leading-3 n-font-bold n-text-text-muted"
|
|
100
|
+
: "n-font-sans n-text-heading5 n-font-normal",
|
|
101
|
+
!$isSectionHeader &&
|
|
102
|
+
$selected &&
|
|
103
|
+
"n-text-selected-list-item-text active:n-bg-selected-list-item-background",
|
|
104
|
+
!$isSectionHeader && $disabled && "n-text-text-disabled",
|
|
105
|
+
$clickable ? "n-cursor-pointer" : "n-cursor-default",
|
|
106
|
+
$isSectionHeader && "n-bg-listview-raised-background",
|
|
107
|
+
"n-flex n-flex-[0_0_auto] n-select-none n-items-center n-relative",
|
|
108
|
+
className
|
|
109
|
+
)}
|
|
110
|
+
style={{
|
|
111
|
+
...($variant !== "bare" && {
|
|
112
|
+
paddingTop: $selected ? "4px" : "6px",
|
|
113
|
+
paddingRight: $selected ? "8px" : "12px",
|
|
114
|
+
paddingBottom: $selected ? "4px" : "6px",
|
|
115
|
+
paddingLeft: $selected ? "8px" : "12px",
|
|
116
|
+
borderRadius: $selected ? "4px" : "",
|
|
117
|
+
marginLeft: $selected ? "4px" : "",
|
|
118
|
+
marginRight: $selected ? "4px" : "",
|
|
119
|
+
marginTop: $selected ? "2px" : "",
|
|
120
|
+
marginBottom: $selected ? "2px" : "",
|
|
121
|
+
}),
|
|
122
|
+
...($selected &&
|
|
123
|
+
!$isSectionHeader && {
|
|
124
|
+
backgroundColor:
|
|
125
|
+
$colorScheme === "primary"
|
|
126
|
+
? cssVars.colors["selectedListItemBackground"]
|
|
127
|
+
: cssVars.colors[$colorScheme],
|
|
128
|
+
}),
|
|
129
|
+
...($selected &&
|
|
130
|
+
!$isSectionHeader &&
|
|
131
|
+
($selectedPosition === "middle" ||
|
|
132
|
+
$selectedPosition === "last") && {
|
|
133
|
+
borderTopRightRadius: "0px",
|
|
134
|
+
borderTopLeftRadius: "0px",
|
|
135
|
+
}),
|
|
136
|
+
...($selected &&
|
|
137
|
+
!$isSectionHeader &&
|
|
138
|
+
($selectedPosition === "middle" ||
|
|
139
|
+
$selectedPosition === "first") && {
|
|
140
|
+
borderBottomRightRadius: "0px",
|
|
141
|
+
borderBottomLeftRadius: "0px",
|
|
142
|
+
}),
|
|
143
|
+
...($hovered &&
|
|
144
|
+
!$selected && {
|
|
145
|
+
background: cssVars.colors.listViewHoverBackground,
|
|
146
|
+
}),
|
|
147
|
+
// ...($showsActiveState && {
|
|
148
|
+
// "&:active": {
|
|
149
|
+
// backgroundColor: $selected
|
|
150
|
+
// ? $colorScheme === "secondary"
|
|
151
|
+
// ? cssVars.colors.secondaryLight
|
|
152
|
+
// : cssVars.colors.selectedListItemBackground
|
|
153
|
+
// : cssVars.colors.activeBackground,
|
|
154
|
+
// },
|
|
155
|
+
// }),
|
|
156
|
+
...($divider && {
|
|
157
|
+
borderBottom: `1px solid ${cssVars.colors.dividerSubtle}`,
|
|
158
|
+
}),
|
|
159
|
+
// ...($backgroundColor && {
|
|
160
|
+
// backgroundColor: $backgroundColor,
|
|
161
|
+
// "&:hover": {
|
|
162
|
+
// backgroundColor: $backgroundColor,
|
|
163
|
+
// },
|
|
164
|
+
// "&:active": {
|
|
165
|
+
// backgroundColor: $backgroundColor,
|
|
166
|
+
// },
|
|
167
|
+
// }),
|
|
168
|
+
...style,
|
|
169
|
+
}}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
export const ListViewDragIndicatorElement = forwardRef<
|
|
177
|
+
HTMLDivElement,
|
|
178
|
+
React.HTMLAttributes<HTMLDivElement> & {
|
|
179
|
+
$relativeDropPosition?: RelativeDropPosition;
|
|
180
|
+
$gap: number;
|
|
181
|
+
$offsetLeft: number;
|
|
182
|
+
$colorScheme: ListColorScheme;
|
|
183
|
+
}
|
|
184
|
+
>(
|
|
185
|
+
(
|
|
186
|
+
{
|
|
187
|
+
className,
|
|
188
|
+
$relativeDropPosition,
|
|
189
|
+
$offsetLeft,
|
|
190
|
+
$colorScheme,
|
|
191
|
+
$gap,
|
|
192
|
+
style,
|
|
193
|
+
...props
|
|
194
|
+
},
|
|
195
|
+
ref
|
|
196
|
+
) => {
|
|
197
|
+
return (
|
|
198
|
+
<div
|
|
199
|
+
ref={ref}
|
|
200
|
+
{...props}
|
|
201
|
+
className={className}
|
|
202
|
+
style={{
|
|
203
|
+
zIndex: 1000,
|
|
204
|
+
position: "absolute",
|
|
205
|
+
borderRadius: "3px",
|
|
206
|
+
pointerEvents: "none",
|
|
207
|
+
...($relativeDropPosition === "inside"
|
|
208
|
+
? {
|
|
209
|
+
inset: 2,
|
|
210
|
+
boxShadow: `0 0 0 1px ${cssVars.colors.sidebarBackground}, 0 0 0 3px ${
|
|
211
|
+
$colorScheme === "secondary"
|
|
212
|
+
? cssVars.colors.secondary
|
|
213
|
+
: cssVars.colors.dragOutline
|
|
214
|
+
}`,
|
|
215
|
+
}
|
|
216
|
+
: {
|
|
217
|
+
top:
|
|
218
|
+
$relativeDropPosition === "above"
|
|
219
|
+
? -(3 + $gap / 2)
|
|
220
|
+
: undefined,
|
|
221
|
+
bottom:
|
|
222
|
+
$relativeDropPosition === "below"
|
|
223
|
+
? -(3 + $gap / 2)
|
|
224
|
+
: undefined,
|
|
225
|
+
left: $offsetLeft,
|
|
226
|
+
right: 0,
|
|
227
|
+
height: 6,
|
|
228
|
+
backgroundColor:
|
|
229
|
+
$colorScheme === "secondary"
|
|
230
|
+
? cssVars.colors.secondary
|
|
231
|
+
: cssVars.colors.dragOutline,
|
|
232
|
+
border: `2px solid white`,
|
|
233
|
+
boxShadow: "0 0 2px rgba(0,0,0,0.5)",
|
|
234
|
+
}),
|
|
235
|
+
...style,
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
export interface ListViewClickInfo {
|
|
243
|
+
shiftKey: boolean;
|
|
244
|
+
altKey: boolean;
|
|
245
|
+
metaKey: boolean;
|
|
246
|
+
ctrlKey: boolean;
|
|
247
|
+
stopPropagation: () => void;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface ListViewRowProps<MenuItemType extends string = string> {
|
|
251
|
+
id?: string;
|
|
252
|
+
tabIndex?: number;
|
|
253
|
+
role?: string;
|
|
254
|
+
selected?: boolean;
|
|
255
|
+
/** @default 0 */
|
|
256
|
+
depth?: number;
|
|
257
|
+
disabled?: boolean;
|
|
258
|
+
// draggable?: boolean;
|
|
259
|
+
hovered?: boolean;
|
|
260
|
+
sortable?: boolean;
|
|
261
|
+
backgroundColor?: CSSProperties["backgroundColor"];
|
|
262
|
+
onPress?: (info: ListViewClickInfo) => void;
|
|
263
|
+
onDoubleClick?: () => void;
|
|
264
|
+
onHoverChange?: (isHovering: boolean) => void;
|
|
265
|
+
children?: ReactNode;
|
|
266
|
+
isSectionHeader?: boolean;
|
|
267
|
+
menuItems?: MenuItem<MenuItemType>[];
|
|
268
|
+
onSelectMenuItem?: (value: MenuItemType) => void;
|
|
269
|
+
onContextMenu?: () => void;
|
|
270
|
+
onMenuOpenChange?: (isOpen: boolean) => void;
|
|
271
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
272
|
+
style?: CSSProperties;
|
|
273
|
+
className?: string;
|
|
274
|
+
dragIndicatorStyle?:
|
|
275
|
+
| CSSProperties
|
|
276
|
+
| ((props: DragIndicatorStyleProps) => CSSProperties);
|
|
277
|
+
testRelativeDropPosition?: RelativeDropPosition;
|
|
278
|
+
href?: string;
|
|
279
|
+
as?: React.ElementType;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export type DragIndicatorStyleProps = {
|
|
283
|
+
depth: number;
|
|
284
|
+
indentation: number;
|
|
285
|
+
position: RelativeDropPosition;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const ListViewRow = memoGeneric(
|
|
289
|
+
forwardRefGeneric(function ListViewRow<MenuItemType extends string>(
|
|
290
|
+
{
|
|
291
|
+
id,
|
|
292
|
+
tabIndex = 0,
|
|
293
|
+
role,
|
|
294
|
+
backgroundColor,
|
|
295
|
+
selected = false,
|
|
296
|
+
depth = 0,
|
|
297
|
+
disabled = false,
|
|
298
|
+
hovered = false,
|
|
299
|
+
isSectionHeader = false,
|
|
300
|
+
sortable: overrideSortable,
|
|
301
|
+
onPress,
|
|
302
|
+
onDoubleClick,
|
|
303
|
+
onHoverChange,
|
|
304
|
+
children,
|
|
305
|
+
menuItems,
|
|
306
|
+
onContextMenu,
|
|
307
|
+
onSelectMenuItem,
|
|
308
|
+
onMenuOpenChange,
|
|
309
|
+
onKeyDown,
|
|
310
|
+
style,
|
|
311
|
+
dragIndicatorStyle,
|
|
312
|
+
className,
|
|
313
|
+
testRelativeDropPosition,
|
|
314
|
+
href,
|
|
315
|
+
as,
|
|
316
|
+
}: ListViewRowProps<MenuItemType>,
|
|
317
|
+
forwardedRef: ForwardedRef<HTMLElement>
|
|
318
|
+
) {
|
|
319
|
+
depth = Math.max(0, depth);
|
|
320
|
+
|
|
321
|
+
const {
|
|
322
|
+
pressEventName,
|
|
323
|
+
colorScheme,
|
|
324
|
+
gap: listGap,
|
|
325
|
+
sectionHeaderVariant,
|
|
326
|
+
variant,
|
|
327
|
+
divider,
|
|
328
|
+
sortable,
|
|
329
|
+
indentation,
|
|
330
|
+
} = useContext(ListViewContext);
|
|
331
|
+
|
|
332
|
+
const { marginType, selectedPosition } = useContext(ListRowContext);
|
|
333
|
+
const { hoverProps } = useHover({
|
|
334
|
+
onHoverChange,
|
|
335
|
+
});
|
|
336
|
+
const { isDragOverlay } = useContext(ListViewDraggingContext);
|
|
337
|
+
|
|
338
|
+
const handlePress = useCallback(
|
|
339
|
+
(event: React.MouseEvent) => {
|
|
340
|
+
// We use preventDefault as a hack to mark this event as handled. We check for
|
|
341
|
+
// this in the ListView.Root. We can't stopPropagation here or existing ContextMenus
|
|
342
|
+
// won't close (onPointerDownOutside won't fire).
|
|
343
|
+
// event.preventDefault();
|
|
344
|
+
|
|
345
|
+
// We only want to handle left clicks
|
|
346
|
+
if (event.button !== 0) return;
|
|
347
|
+
|
|
348
|
+
onPress?.(event);
|
|
349
|
+
},
|
|
350
|
+
[onPress]
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
const handleDoubleClick = useCallback(
|
|
354
|
+
(event: React.MouseEvent) => {
|
|
355
|
+
event.stopPropagation();
|
|
356
|
+
|
|
357
|
+
onDoubleClick?.();
|
|
358
|
+
},
|
|
359
|
+
[onDoubleClick]
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const mergedStyle = useMemo(() => {
|
|
363
|
+
return isDragOverlay
|
|
364
|
+
? {
|
|
365
|
+
// TODO: Where do these offsets actually come from?
|
|
366
|
+
transform: `translate3d(-36px, -6px, 0)`,
|
|
367
|
+
width: `calc(100% + 48px)`,
|
|
368
|
+
...style,
|
|
369
|
+
}
|
|
370
|
+
: style;
|
|
371
|
+
}, [isDragOverlay, style]);
|
|
372
|
+
|
|
373
|
+
const renderContent = (
|
|
374
|
+
renderProps: React.ComponentProps<typeof RowContainer>,
|
|
375
|
+
ref: Ref<HTMLElement>,
|
|
376
|
+
relativeDropPositionProp: RelativeDropPosition | undefined
|
|
377
|
+
) => {
|
|
378
|
+
const Component = RowContainer;
|
|
379
|
+
const relativeDropPosition =
|
|
380
|
+
testRelativeDropPosition ?? relativeDropPositionProp;
|
|
381
|
+
|
|
382
|
+
const element = (
|
|
383
|
+
<Component
|
|
384
|
+
as={as}
|
|
385
|
+
href={href}
|
|
386
|
+
ref={ref as any}
|
|
387
|
+
$colorScheme={colorScheme}
|
|
388
|
+
onContextMenu={onContextMenu}
|
|
389
|
+
$isSectionHeader={isSectionHeader}
|
|
390
|
+
id={id}
|
|
391
|
+
role={role}
|
|
392
|
+
$backgroundColor={backgroundColor}
|
|
393
|
+
{...hoverProps}
|
|
394
|
+
onDoubleClick={handleDoubleClick}
|
|
395
|
+
$marginType={marginType ?? "none"}
|
|
396
|
+
$disabled={disabled}
|
|
397
|
+
$hovered={hovered}
|
|
398
|
+
$selected={selected}
|
|
399
|
+
$variant={variant}
|
|
400
|
+
$sectionHeaderVariant={sectionHeaderVariant}
|
|
401
|
+
$selectedPosition={selectedPosition}
|
|
402
|
+
$showsActiveState={pressEventName === "onClick"}
|
|
403
|
+
aria-selected={selected}
|
|
404
|
+
$divider={!isDragOverlay && divider}
|
|
405
|
+
onKeyDown={onKeyDown}
|
|
406
|
+
style={mergedStyle}
|
|
407
|
+
{...(renderProps as Partial<
|
|
408
|
+
React.ComponentProps<typeof RowContainer>
|
|
409
|
+
>)}
|
|
410
|
+
{...mergeEventHandlers(
|
|
411
|
+
{ onPointerDown: renderProps.onPointerDown! },
|
|
412
|
+
{ [pressEventName]: handlePress }
|
|
413
|
+
)}
|
|
414
|
+
tabIndex={tabIndex}
|
|
415
|
+
className={className}
|
|
416
|
+
$clickable={!!onPress}
|
|
417
|
+
>
|
|
418
|
+
{relativeDropPosition && (
|
|
419
|
+
<ListViewDragIndicatorElement
|
|
420
|
+
key={relativeDropPosition}
|
|
421
|
+
$colorScheme={colorScheme}
|
|
422
|
+
$relativeDropPosition={relativeDropPosition}
|
|
423
|
+
$offsetLeft={depth * indentation}
|
|
424
|
+
$gap={listGap + (divider ? 1 : 0)}
|
|
425
|
+
style={
|
|
426
|
+
typeof dragIndicatorStyle === "function"
|
|
427
|
+
? dragIndicatorStyle({
|
|
428
|
+
depth,
|
|
429
|
+
indentation,
|
|
430
|
+
position: relativeDropPosition,
|
|
431
|
+
})
|
|
432
|
+
: dragIndicatorStyle
|
|
433
|
+
}
|
|
434
|
+
/>
|
|
435
|
+
)}
|
|
436
|
+
{depth > 0 && <Spacer.Horizontal size={depth * indentation} />}
|
|
437
|
+
{children}
|
|
438
|
+
</Component>
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
if (menuItems && onSelectMenuItem) {
|
|
442
|
+
return (
|
|
443
|
+
<ContextMenu<MenuItemType>
|
|
444
|
+
items={menuItems}
|
|
445
|
+
onSelect={onSelectMenuItem}
|
|
446
|
+
onOpenChange={onMenuOpenChange}
|
|
447
|
+
>
|
|
448
|
+
{element}
|
|
449
|
+
</ContextMenu>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return element;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
if (sortable && id) {
|
|
457
|
+
return (
|
|
458
|
+
<Sortable.Item<HTMLElement>
|
|
459
|
+
id={id}
|
|
460
|
+
disabled={overrideSortable === false}
|
|
461
|
+
>
|
|
462
|
+
{({ ref: sortableRef, ...sortableProps }, { relativeDropPosition }) =>
|
|
463
|
+
renderContent(
|
|
464
|
+
sortableProps as any,
|
|
465
|
+
composeRefs(sortableRef, forwardedRef),
|
|
466
|
+
relativeDropPosition
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
</Sortable.Item>
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return renderContent({} as any, forwardedRef, undefined);
|
|
474
|
+
})
|
|
475
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { HTMLAttributes, memo } from "react";
|
|
4
|
+
import { cx } from "../../utils/classNames";
|
|
5
|
+
|
|
6
|
+
export const ListViewRowTitle = memo(function ListViewRowTitle({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: {
|
|
10
|
+
className?: string;
|
|
11
|
+
} & HTMLAttributes<HTMLSpanElement>) {
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
className={cx(
|
|
15
|
+
"n-flex-1 n-overflow-hidden n-text-ellipsis n-whitespace-pre",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ListRowMarginType = "none" | "top" | "bottom" | "vertical";
|
|
2
|
+
|
|
3
|
+
export type ListRowPosition = "only" | "first" | "middle" | "last";
|
|
4
|
+
|
|
5
|
+
export type ListColorScheme = "primary" | "secondary";
|
|
6
|
+
|
|
7
|
+
export type PressEventName = "onClick" | "onPointerDown";
|
|
8
|
+
|
|
9
|
+
export type ListViewVariant = "normal" | "bare";
|
|
10
|
+
|
|
11
|
+
export type ListViewSectionHeaderVariant = "normal" | "label";
|
|
@@ -5,19 +5,19 @@ import { Small } from "../Text";
|
|
|
5
5
|
|
|
6
6
|
export const PipelineResultLink = ({ url }: { url: string }) => {
|
|
7
7
|
return (
|
|
8
|
-
<div className="flex flex-col gap-0.5">
|
|
8
|
+
<div className="n-flex n-flex-col gap-0.5">
|
|
9
9
|
{/* <Label position="start">{name}</Label> */}
|
|
10
10
|
<a
|
|
11
11
|
href={url}
|
|
12
12
|
target="_blank"
|
|
13
13
|
rel="noopener noreferrer"
|
|
14
|
-
className="flex text-primary hover:opacity-80 border border-divider rounded-md"
|
|
14
|
+
className="n-flex n-text-primary hover:n-opacity-80 n-border n-border-divider n-rounded-md"
|
|
15
15
|
>
|
|
16
|
-
<div className="flex gap-1 items-center p-2">
|
|
17
|
-
<Link1Icon className="w-[15px] h-[15px] flex-shrink-0" />
|
|
16
|
+
<div className="n-flex n-gap-1 n-items-center n-p-2">
|
|
17
|
+
<Link1Icon className="n-w-[15px] n-h-[15px] n-flex-shrink-0" />
|
|
18
18
|
</div>
|
|
19
19
|
<DividerVertical />
|
|
20
|
-
<Small className="truncate p-2 flex-1">{url}</Small>
|
|
20
|
+
<Small className="n-truncate n-p-2 n-flex-1">{url}</Small>
|
|
21
21
|
</a>
|
|
22
22
|
</div>
|
|
23
23
|
);
|
|
@@ -28,7 +28,7 @@ export const PipelineResultLayout = ({
|
|
|
28
28
|
}: {
|
|
29
29
|
children: React.ReactNode;
|
|
30
30
|
}) => {
|
|
31
|
-
return <div className="flex flex-col gap-2">{children}</div>;
|
|
31
|
+
return <div className="n-flex n-flex-col n-gap-2">{children}</div>;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export function getPipelineResultLink(
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { ClientRect, UniqueIdentifier } from "@dnd-kit/core";
|
|
11
11
|
import { AcceptsFromList } from "./sorting";
|
|
12
12
|
|
|
13
|
-
import { Point } from "@noya-app/noya-geometry";
|
|
13
|
+
import { Insets, Point } from "@noya-app/noya-geometry";
|
|
14
14
|
import React from "react";
|
|
15
15
|
|
|
16
16
|
export type GetDropIndicatorParameters = {
|
|
@@ -33,6 +33,7 @@ export interface RegisteredList {
|
|
|
33
33
|
parameters: GetDropIndicatorParameters,
|
|
34
34
|
acceptsDrop: AcceptsDrop
|
|
35
35
|
) => RelativeDropPosition | undefined;
|
|
36
|
+
itemHitSlop?: Insets;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export interface DragRegistrationContextType {
|