@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { cssVarNames, cssVars } from "../theme";
|
|
3
|
+
import { cx } from "../utils/classNames";
|
|
3
4
|
import { Divider, DividerVertical } from "./Divider";
|
|
4
5
|
import { Spacer } from "./Spacer";
|
|
5
6
|
|
|
@@ -9,6 +10,9 @@ export interface BaseToolbarProps {
|
|
|
9
10
|
right?: React.ReactNode;
|
|
10
11
|
logo?: React.ReactNode;
|
|
11
12
|
showDivider?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
innerClassName?: string;
|
|
15
|
+
enableAbsoluteBreakpoint?: boolean;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
const toolbarStyle = {
|
|
@@ -19,14 +23,24 @@ const toolbarStyle = {
|
|
|
19
23
|
export function BaseToolbarContainer({
|
|
20
24
|
children,
|
|
21
25
|
showDivider = true,
|
|
26
|
+
className,
|
|
27
|
+
innerClassName,
|
|
28
|
+
enableAbsoluteBreakpoint = true,
|
|
22
29
|
}: {
|
|
23
30
|
children: React.ReactNode;
|
|
24
31
|
showDivider?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
innerClassName?: string;
|
|
34
|
+
enableAbsoluteBreakpoint?: boolean;
|
|
25
35
|
}) {
|
|
26
36
|
return (
|
|
27
|
-
<div className="flex flex-col" style={toolbarStyle}>
|
|
37
|
+
<div className={cx("n-flex n-flex-col", className)} style={toolbarStyle}>
|
|
28
38
|
<div
|
|
29
|
-
className=
|
|
39
|
+
className={cx(
|
|
40
|
+
"n-flex n-items-center n-bg-sidebar-background n-flex-none n-relative",
|
|
41
|
+
enableAbsoluteBreakpoint && "n-@container/toolbar",
|
|
42
|
+
innerClassName
|
|
43
|
+
)}
|
|
30
44
|
style={{
|
|
31
45
|
flex: `0 0 ${cssVars.spacing.toolbarHeight}`,
|
|
32
46
|
}}
|
|
@@ -44,9 +58,17 @@ export function BaseToolbar({
|
|
|
44
58
|
right,
|
|
45
59
|
logo,
|
|
46
60
|
showDivider = true,
|
|
61
|
+
className,
|
|
62
|
+
innerClassName,
|
|
63
|
+
enableAbsoluteBreakpoint = true,
|
|
47
64
|
}: BaseToolbarProps) {
|
|
48
65
|
return (
|
|
49
|
-
<BaseToolbarContainer
|
|
66
|
+
<BaseToolbarContainer
|
|
67
|
+
showDivider={showDivider}
|
|
68
|
+
className={className}
|
|
69
|
+
innerClassName={innerClassName}
|
|
70
|
+
enableAbsoluteBreakpoint={enableAbsoluteBreakpoint}
|
|
71
|
+
>
|
|
50
72
|
{logo && (
|
|
51
73
|
<>
|
|
52
74
|
{logo}
|
|
@@ -56,22 +78,22 @@ export function BaseToolbar({
|
|
|
56
78
|
<Spacer.Horizontal size={10} />
|
|
57
79
|
{left && (
|
|
58
80
|
<>
|
|
59
|
-
<div className="flex gap-toolbar-separator">{left}</div>
|
|
81
|
+
<div className="n-flex n-gap-toolbar-separator">{left}</div>
|
|
60
82
|
<Spacer.Horizontal size={10} />
|
|
61
83
|
</>
|
|
62
84
|
)}
|
|
63
85
|
<div
|
|
64
86
|
className={
|
|
65
|
-
"flex items-center justify-center text-text-muted pointer-events-none @2xl/toolbar:absolute inset-0"
|
|
87
|
+
"n-flex n-items-center n-justify-center n-text-text-muted n-pointer-events-none @2xl/toolbar:n-absolute n-inset-0"
|
|
66
88
|
}
|
|
67
89
|
>
|
|
68
|
-
<div className="flex items-center justify-center pointer-events-auto">
|
|
90
|
+
<div className="n-flex n-items-center n-justify-center n-pointer-events-auto">
|
|
69
91
|
{children}
|
|
70
92
|
</div>
|
|
71
93
|
</div>
|
|
72
94
|
<Spacer.Horizontal />
|
|
73
95
|
<Spacer.Horizontal size={10} />
|
|
74
|
-
<div className="flex gap-toolbar-separator">{right}</div>
|
|
96
|
+
<div className="n-flex n-gap-toolbar-separator">{right}</div>
|
|
75
97
|
</BaseToolbarContainer>
|
|
76
98
|
);
|
|
77
99
|
}
|
|
@@ -21,9 +21,9 @@ export const BreadcrumbText = forwardRef(function BreadcrumbText(
|
|
|
21
21
|
{...props}
|
|
22
22
|
variant="small"
|
|
23
23
|
className={cx(
|
|
24
|
-
"whitespace-pre leading-[15px] select-none",
|
|
24
|
+
"n-whitespace-pre n-leading-[15px] n-select-none",
|
|
25
25
|
onClick &&
|
|
26
|
-
"hover:text-breadcrumb-text-hover hover:cursor-pointer hover:whitespace-pre hover:select-none",
|
|
26
|
+
"hover:n-text-breadcrumb-text-hover hover:n-cursor-pointer hover:n-whitespace-pre hover:n-select-none",
|
|
27
27
|
className
|
|
28
28
|
)}
|
|
29
29
|
ref={ref}
|
|
@@ -22,28 +22,29 @@ type ButtonColorScheme = "primary" | "secondary";
|
|
|
22
22
|
|
|
23
23
|
const colorSchemeStyles: Record<ButtonColorScheme | "default", string> = {
|
|
24
24
|
default:
|
|
25
|
-
"bg-button-background text-button-text hover:bg-button-background-hover active:bg-button-background-active",
|
|
26
|
-
primary:
|
|
25
|
+
"n-bg-button-background n-text-button-text hover:n-bg-button-background-hover active:n-bg-button-background-active",
|
|
26
|
+
primary:
|
|
27
|
+
"n-bg-primary n-text-white hover:n-bg-primary-light active:n-bg-primary",
|
|
27
28
|
secondary:
|
|
28
|
-
"bg-secondary text-white hover:bg-secondary-light active:bg-secondary",
|
|
29
|
+
"n-bg-secondary n-text-white hover:n-bg-secondary-light active:n-bg-secondary",
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const variantStyles: Record<ButtonVariant, string> = {
|
|
32
33
|
normal: "",
|
|
33
34
|
floating:
|
|
34
|
-
"bg-floating-button text-text shadow-[0_1px_2px_rgba(0,0,0,0.1)] hover:opacity-80 active:opacity-90",
|
|
35
|
-
thin: "bg-transparent text-text hover:bg-input-background-light",
|
|
36
|
-
none: "bg-transparent text-text hover:bg-input-background-light",
|
|
37
|
-
ghost: "bg-transparent text-text hover:bg-input-background-light",
|
|
35
|
+
"n-bg-floating-button n-text-text n-shadow-[0_1px_2px_rgba(0,0,0,0.1)] hover:n-opacity-80 active:n-opacity-90",
|
|
36
|
+
thin: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
37
|
+
none: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
38
|
+
ghost: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
const sizeStyles: Record<ButtonSize | "thin" | "none", string> = {
|
|
41
|
-
small: "px-[2px] font-sans text-[10px] font-medium",
|
|
42
|
-
normal: "px-[6px] py-1 font-sans text-button font-medium",
|
|
43
|
-
large: "p-3 px-4 font-sans text-heading4 font-medium",
|
|
44
|
-
thin: "px-[1px] py-1 font-sans text-button font-medium",
|
|
45
|
-
floating: "px-1 py-0 font-sans text-[12px] font-medium",
|
|
46
|
-
none: "py-0 px-0",
|
|
42
|
+
small: "n-px-[2px] n-font-sans n-text-[10px] n-font-medium",
|
|
43
|
+
normal: "n-px-[6px] n-py-1 n-font-sans n-text-button n-font-medium",
|
|
44
|
+
large: "n-p-3 n-px-4 n-font-sans n-text-heading4 n-font-medium",
|
|
45
|
+
thin: "n-px-[1px] n-py-1 n-font-sans n-text-button n-font-medium",
|
|
46
|
+
floating: "n-px-1 n-py-0 n-font-sans n-text-[12px] n-font-medium",
|
|
47
|
+
none: "n-py-0 n-px-0",
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export interface ButtonProps
|
|
@@ -100,12 +101,12 @@ export const Button = forwardRef(function Button(
|
|
|
100
101
|
const colorScheme = colorSchemeProp ?? "default";
|
|
101
102
|
|
|
102
103
|
const baseClassName = cx(
|
|
103
|
-
"no-underline leading-[1] relative outline-none select-none text-left rounded flex items-center justify-center [&>*]:pointer-events-none [-webkit-app-region:no-drag] focus:ring-2 focus:ring-primary focus:shadow-[0_0_0_1px_var(--n-popover-background)_inset] transition-all",
|
|
104
|
-
variant === "ghost" ? "border" : "border-0",
|
|
105
|
-
disabled ? "opacity-25" : "",
|
|
106
|
-
!className?.includes("flex") ? "flex-none" : "",
|
|
104
|
+
"n-no-underline n-leading-[1] n-relative n-outline-none n-select-none n-text-left n-rounded n-flex n-items-center n-justify-center [&>*]:n-pointer-events-none n-[-webkit-app-region:no-drag] focus:n-ring-2 focus:n-ring-primary focus:n-shadow-[0_0_0_1px_var(--n-popover-background)_inset] n-transition-all",
|
|
105
|
+
variant === "ghost" ? "n-border" : "n-border-0",
|
|
106
|
+
disabled ? "n-opacity-25" : "",
|
|
107
|
+
!className?.includes("flex") ? "n-flex-none" : "",
|
|
107
108
|
active
|
|
108
|
-
? "bg-button-background-active text-button-text-active hover:bg-button-background-active-hover"
|
|
109
|
+
? "n-bg-button-background-active n-text-button-text-active hover:n-bg-button-background-active-hover"
|
|
109
110
|
: variantStyles[variant],
|
|
110
111
|
sizeStyles[
|
|
111
112
|
variant === "thin"
|
|
@@ -116,11 +117,11 @@ export const Button = forwardRef(function Button(
|
|
|
116
117
|
? "none"
|
|
117
118
|
: size
|
|
118
119
|
],
|
|
119
|
-
variant === "normal" && (children ? "min-w-[31px]" : "min-w-[27px]"),
|
|
120
|
+
variant === "normal" && (children ? "n-min-w-[31px]" : "n-min-w-[27px]"),
|
|
120
121
|
variant === "ghost"
|
|
121
|
-
? "border-solid border-input-background hover:bg-input-background-light"
|
|
122
|
+
? "n-border-solid n-border-input-background hover:n-bg-input-background-light"
|
|
122
123
|
: colorSchemeStyles[colorScheme],
|
|
123
|
-
!children && (icon || iconRight) && !(icon && iconRight) && "w-[27px]"
|
|
124
|
+
!children && (icon || iconRight) && !(icon && iconRight) && "n-w-[27px]"
|
|
124
125
|
);
|
|
125
126
|
|
|
126
127
|
const buttonClassName = useMemo(() => {
|
|
@@ -146,7 +147,7 @@ export const Button = forwardRef(function Button(
|
|
|
146
147
|
{...rest}
|
|
147
148
|
>
|
|
148
149
|
<span
|
|
149
|
-
className="min-h-[19px] flex items-center flex-1 justify-center leading-[15px]"
|
|
150
|
+
className="n-min-h-[19px] n-flex n-items-center n-flex-1 n-justify-center n-leading-[15px]"
|
|
150
151
|
style={contentStyle}
|
|
151
152
|
>
|
|
152
153
|
{icon && renderIcon(icon)}
|
|
@@ -166,5 +167,3 @@ export const Button = forwardRef(function Button(
|
|
|
166
167
|
buttonElement
|
|
167
168
|
);
|
|
168
169
|
});
|
|
169
|
-
|
|
170
|
-
export default Button;
|
|
@@ -8,9 +8,9 @@ interface CheckboxProps
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const colorSchemeStyles = {
|
|
11
|
-
normal: "text-text-subtle",
|
|
12
|
-
primary: "text-primary",
|
|
13
|
-
secondary: "text-secondary",
|
|
11
|
+
normal: "n-text-text-subtle",
|
|
12
|
+
primary: "n-text-primary",
|
|
13
|
+
secondary: "n-text-secondary",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const Checkbox = React.memo(
|
|
@@ -22,7 +22,7 @@ export const Checkbox = React.memo(
|
|
|
22
22
|
return (
|
|
23
23
|
<div
|
|
24
24
|
className={cx(
|
|
25
|
-
"flex-none relative inline-flex w-[19px] h-[19px]",
|
|
25
|
+
"n-flex-none n-relative n-inline-flex n-w-[19px] n-h-[19px]",
|
|
26
26
|
colorSchemeStyles[colorScheme],
|
|
27
27
|
className
|
|
28
28
|
)}
|
|
@@ -31,42 +31,13 @@ export const Checkbox = React.memo(
|
|
|
31
31
|
<input
|
|
32
32
|
ref={ref}
|
|
33
33
|
type="checkbox"
|
|
34
|
-
className={`
|
|
35
|
-
w-full
|
|
36
|
-
h-full
|
|
37
|
-
peer
|
|
38
|
-
appearance-none
|
|
39
|
-
m-0
|
|
40
|
-
rounded
|
|
41
|
-
bg-input-background
|
|
42
|
-
border
|
|
43
|
-
border-divider
|
|
44
|
-
disabled:opacity-50
|
|
45
|
-
cursor-pointer
|
|
46
|
-
disabled:cursor-not-allowed
|
|
47
|
-
focus:ring-2
|
|
48
|
-
focus:ring-primary
|
|
49
|
-
focus:ring-offset-1
|
|
50
|
-
focus:z-interactable
|
|
51
|
-
transition-all
|
|
52
|
-
`}
|
|
34
|
+
className={`n-w-full n-h-full n-peer n-appearance-none n-m-0 n-rounded n-bg-input-background n-border n-border-divider disabled:n-opacity-50 n-cursor-pointer disabled:n-cursor-not-allowed focus:n-ring-2 focus:n-ring-primary focus:n-ring-offset-1 focus:n-z-interactable n-transition-all`}
|
|
53
35
|
aria-checked={props.checked}
|
|
54
36
|
{...props}
|
|
55
37
|
id={id}
|
|
56
38
|
/>
|
|
57
39
|
<svg
|
|
58
|
-
className={`
|
|
59
|
-
absolute
|
|
60
|
-
inset-0
|
|
61
|
-
h-input-height
|
|
62
|
-
w-input-height
|
|
63
|
-
pointer-events-none
|
|
64
|
-
stroke-white
|
|
65
|
-
opacity-0
|
|
66
|
-
peer-checked:opacity-100
|
|
67
|
-
z-label
|
|
68
|
-
stroke-[1.3px]
|
|
69
|
-
`}
|
|
40
|
+
className={`n-absolute n-inset-0 n-h-input-height n-w-input-height n-pointer-events-none n-stroke-white n-opacity-0 peer-checked:n-opacity-100 n-z-label stroke-[1.3px]`}
|
|
70
41
|
viewBox="0 0 16 16"
|
|
71
42
|
fill="none"
|
|
72
43
|
xmlns="http://www.w3.org/2000/svg"
|
package/src/components/Chip.tsx
CHANGED
|
@@ -6,64 +6,76 @@ import { useHover } from "../hooks/useHover";
|
|
|
6
6
|
import { cssVars } from "../theme";
|
|
7
7
|
import { cx } from "../utils/classNames";
|
|
8
8
|
|
|
9
|
-
type ChipColorScheme = "primary" | "secondary" | "error";
|
|
10
|
-
type ChipSize = "small" | "medium" | "large";
|
|
9
|
+
type ChipColorScheme = "primary" | "secondary" | "info" | "error";
|
|
10
|
+
type ChipSize = "small" | "medium" | "large" | "xl";
|
|
11
11
|
type ChipVariant = "solid" | "outlined" | "ghost";
|
|
12
12
|
|
|
13
13
|
// Hoisted constants for styles
|
|
14
14
|
const BASE_STYLES =
|
|
15
|
-
"inline-flex items-center whitespace-pre rounded select-none leading-[15px]";
|
|
15
|
+
"n-inline-flex n-items-center n-whitespace-pre n-rounded n-select-none n-leading-[15px]";
|
|
16
16
|
|
|
17
17
|
const SIZE_STYLES = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
xl: "n-text-[12px] n-p-[6px_12px]",
|
|
19
|
+
large: "n-text-[11px] n-p-[4px_8px]",
|
|
20
|
+
medium: "n-text-[10px] n-p-[2px_6px]",
|
|
21
|
+
small: "n-text-[9px] n-p-[0px_4px]",
|
|
21
22
|
} as const;
|
|
22
23
|
|
|
23
24
|
const SHADOW_STYLES = {
|
|
24
|
-
primary: "shadow-[0_0_0_1px_var(--n-chip-primary-shadow)_inset]",
|
|
25
|
-
secondary: "shadow-[0_0_0_1px_var(--n-chip-secondary-shadow)_inset]",
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
primary: "n-shadow-[0_0_0_1px_var(--n-chip-primary-shadow)_inset]",
|
|
26
|
+
secondary: "n-shadow-[0_0_0_1px_var(--n-chip-secondary-shadow)_inset]",
|
|
27
|
+
info: "n-shadow-[0_0_0_1px_var(--n-chip-default-shadow)_inset]",
|
|
28
|
+
error: "n-shadow-[0_0_0_1px_var(--n-chip-error-shadow)_inset]",
|
|
29
|
+
default: "n-shadow-[0_0_0_1px_var(--n-chip-default-shadow)_inset]",
|
|
28
30
|
} as const;
|
|
29
31
|
|
|
30
32
|
const COLOR_STYLES = {
|
|
31
33
|
primary: {
|
|
32
|
-
text: "text-primary",
|
|
33
|
-
bg: "bg-primary-pastel",
|
|
34
|
-
subtle: "bg-[var(--n-chip-primary-bg)]",
|
|
34
|
+
text: "n-text-primary",
|
|
35
|
+
bg: "n-bg-primary-pastel",
|
|
36
|
+
subtle: "n-bg-[var(--n-chip-primary-bg)]",
|
|
35
37
|
},
|
|
36
38
|
secondary: {
|
|
37
|
-
text: "text-secondary",
|
|
38
|
-
bg: "bg-secondary-pastel",
|
|
39
|
-
subtle: "bg-[var(--n-chip-secondary-bg)]",
|
|
39
|
+
text: "n-text-secondary",
|
|
40
|
+
bg: "n-bg-secondary-pastel",
|
|
41
|
+
subtle: "n-bg-[var(--n-chip-secondary-bg)]",
|
|
42
|
+
},
|
|
43
|
+
info: {
|
|
44
|
+
text: "n-text-[#4071e8]",
|
|
45
|
+
bg: "n-bg-[#dce8ff]",
|
|
46
|
+
subtle: "n-bg-[var(--n-banner-info-border)]",
|
|
40
47
|
},
|
|
41
48
|
error: {
|
|
42
|
-
text: "text-text",
|
|
43
|
-
bg: "bg-[rgb(255,219,219)]",
|
|
44
|
-
subtle: "bg-[var(--n-chip-error-bg)]",
|
|
49
|
+
text: "n-text-text",
|
|
50
|
+
bg: "n-bg-[rgb(255,219,219)]",
|
|
51
|
+
subtle: "n-bg-[var(--n-chip-error-bg)]",
|
|
45
52
|
},
|
|
46
53
|
default: {
|
|
47
|
-
text: "text-text",
|
|
48
|
-
bg: "bg-input-background",
|
|
49
|
-
subtle: "bg-[var(--n-chip-default-bg)]",
|
|
54
|
+
text: "n-text-text",
|
|
55
|
+
bg: "n-bg-input-background",
|
|
56
|
+
subtle: "n-bg-[var(--n-chip-default-bg)]",
|
|
50
57
|
},
|
|
51
58
|
} as const;
|
|
52
59
|
|
|
53
|
-
const ICON_BASE_STYLES =
|
|
60
|
+
const ICON_BASE_STYLES =
|
|
61
|
+
"n-relative n-opacity-50 n-cursor-pointer hover:n-opacity-85";
|
|
54
62
|
|
|
55
63
|
const ICON_SIZE_STYLES = {
|
|
64
|
+
xl: {
|
|
65
|
+
add: "n-ml-[-2px] n-mr-[2px] -n-top-[1px] n-scale-[0.75]",
|
|
66
|
+
delete: "n-mr-[-2px] n-ml-[2px] n-scale-[0.75]",
|
|
67
|
+
},
|
|
56
68
|
large: {
|
|
57
|
-
add: "ml-[-2px] mr-[2px] -top-[1px] scale-[0.75]",
|
|
58
|
-
delete: "mr-[-2px] ml-[2px] scale-[0.75]",
|
|
69
|
+
add: "n-ml-[-2px] n-mr-[2px] -n-top-[1px] n-scale-[0.75]",
|
|
70
|
+
delete: "n-mr-[-2px] n-ml-[2px] n-scale-[0.75]",
|
|
59
71
|
},
|
|
60
72
|
medium: {
|
|
61
|
-
add: "ml-[-2px] mr-[-2px] scale-[0.60]",
|
|
62
|
-
delete: "mr-[-2px] scale-[0.60]",
|
|
73
|
+
add: "n-ml-[-2px] n-mr-[-2px] n-scale-[0.60]",
|
|
74
|
+
delete: "n-mr-[-2px] n-scale-[0.60]",
|
|
63
75
|
},
|
|
64
76
|
small: {
|
|
65
|
-
add: "ml-[-2px] mr-[-2px] scale-[0.60]",
|
|
66
|
-
delete: "mr-[-2px] scale-[0.60]",
|
|
77
|
+
add: "n-ml-[-2px] n-mr-[-2px] n-scale-[0.60]",
|
|
78
|
+
delete: "n-mr-[-2px] n-scale-[0.60]",
|
|
67
79
|
},
|
|
68
80
|
} as const;
|
|
69
81
|
|
|
@@ -123,16 +135,16 @@ export const Chip = memo(
|
|
|
123
135
|
variant === "solid"
|
|
124
136
|
? `${colors.text} ${colors.bg}`
|
|
125
137
|
: variant === "outlined"
|
|
126
|
-
? `${colors.text} bg-transparent ${SHADOW_STYLES[colorScheme ?? "default"]} hover:${colors.subtle} hover:shadow-none`
|
|
138
|
+
? `${colors.text} n-bg-transparent ${SHADOW_STYLES[colorScheme ?? "default"]} hover:${colors.subtle} hover:n-shadow-none`
|
|
127
139
|
: "";
|
|
128
140
|
|
|
129
141
|
const chipClasses = cx(
|
|
130
142
|
BASE_STYLES,
|
|
131
143
|
SIZE_STYLES[size],
|
|
132
|
-
monospace && "font-mono",
|
|
144
|
+
monospace && "n-font-mono",
|
|
133
145
|
variantClasses,
|
|
134
|
-
isInteractive && "cursor-pointer hover:opacity-85",
|
|
135
|
-
disabled && "opacity-50",
|
|
146
|
+
isInteractive && "n-cursor-pointer hover:n-opacity-85",
|
|
147
|
+
disabled && "n-opacity-50",
|
|
136
148
|
className
|
|
137
149
|
);
|
|
138
150
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Size } from "@noya-app/noya-geometry";
|
|
3
4
|
import { forwardRefGeneric } from "@noya-app/react-utils";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { Grid } from "
|
|
6
|
-
import { MenuItem } from "
|
|
7
|
-
import {
|
|
8
|
-
ListView,
|
|
9
|
-
ListViewRootProps,
|
|
10
|
-
ListViewRowProps,
|
|
11
|
-
} from "../components/ListView";
|
|
5
|
+
import React, { CSSProperties } from "react";
|
|
6
|
+
import { Grid } from "./Grid";
|
|
7
|
+
import { MenuItem } from "./internal/Menu";
|
|
12
8
|
import { List } from "./List";
|
|
9
|
+
import { ListView } from "./ListView";
|
|
10
|
+
import { ListViewRootProps } from "./listView/ListViewRoot";
|
|
11
|
+
import { ListViewRowProps } from "./listView/ListViewRow";
|
|
13
12
|
import { SharedDragProps } from "./sorting/DragRegistration";
|
|
14
13
|
|
|
15
14
|
export type CollectionViewType = "grid" | "list";
|
|
@@ -35,6 +34,7 @@ export type CollectionRenderActionProps<T> = {
|
|
|
35
34
|
export interface CollectionProps<T, M extends string = string> {
|
|
36
35
|
className?: string;
|
|
37
36
|
items: T[];
|
|
37
|
+
virtualized?: Size;
|
|
38
38
|
getId: (item: T) => string;
|
|
39
39
|
getName: (item: T) => string;
|
|
40
40
|
getHref?: (item: T) => string;
|
|
@@ -62,12 +62,16 @@ export interface CollectionProps<T, M extends string = string> {
|
|
|
62
62
|
| "menu"
|
|
63
63
|
| ((props: CollectionRenderActionProps<T>) => React.ReactNode);
|
|
64
64
|
renderDetail?: (item: T, selected: boolean) => React.ReactNode;
|
|
65
|
+
/** Optional right-side content renderer for each item */
|
|
66
|
+
renderRight?: (item: T, selected: boolean) => React.ReactNode;
|
|
65
67
|
/** Callback when selection changes. If not provided, selection will be disabled. */
|
|
66
68
|
onSelectionChange?: (
|
|
67
69
|
selectedItemIds: string[],
|
|
68
70
|
event?: ListView.ClickInfo
|
|
69
71
|
) => void;
|
|
70
72
|
scrollable?: boolean;
|
|
73
|
+
itemStyle?: CSSProperties;
|
|
74
|
+
itemClassName?: string;
|
|
71
75
|
itemRoleDescription?: string;
|
|
72
76
|
/** Position of the detail content. Defaults to 'end'. */
|
|
73
77
|
detailPosition?: "end" | "below";
|
|
@@ -82,15 +86,16 @@ export interface CollectionProps<T, M extends string = string> {
|
|
|
82
86
|
/** For testing: Override the drop indicator state with a specific item ID */
|
|
83
87
|
testShowDropIndicatorId?: string;
|
|
84
88
|
setExpanded?: (item: T, expanded: boolean) => void;
|
|
85
|
-
acceptsDrop?: ListViewRootProps["acceptsDrop"];
|
|
86
|
-
onMoveItem?: ListViewRootProps["onMoveItem"];
|
|
87
|
-
getDropTargetParentIndex?: ListViewRootProps["getDropTargetParentIndex"];
|
|
89
|
+
acceptsDrop?: ListViewRootProps<T>["acceptsDrop"];
|
|
90
|
+
onMoveItem?: ListViewRootProps<T>["onMoveItem"];
|
|
91
|
+
getDropTargetParentIndex?: ListViewRootProps<T>["getDropTargetParentIndex"];
|
|
88
92
|
getDepth?: (item: T) => number;
|
|
89
93
|
onFilesDrop?: (event: React.DragEvent<Element>) => void;
|
|
90
94
|
getRenamable?: (item: T) => boolean;
|
|
91
95
|
/** Currently selected file IDs */
|
|
92
96
|
selectedIds?: string[];
|
|
93
97
|
viewType?: CollectionViewType;
|
|
98
|
+
onClick?: () => void;
|
|
94
99
|
onClickItem?: (itemId: string) => void;
|
|
95
100
|
onDoubleClickItem?: (itemId: string) => void;
|
|
96
101
|
renderEmptyState?: () => React.ReactElement<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getContrastColorForBackground } from "@noya-app/noya-
|
|
1
|
+
import { getContrastColorForBackground } from "@noya-app/noya-color";
|
|
2
2
|
import { CheckIcon } from "@noya-app/noya-icons";
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
4
|
|
|
@@ -39,7 +39,7 @@ export const ColorSwatch = forwardRef(function ColorSwatch(
|
|
|
39
39
|
const checkedColor = getContrastColorForBackground(color);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<div className="relative" style={{ width: sizePx, height: sizePx }}>
|
|
42
|
+
<div className="n-relative" style={{ width: sizePx, height: sizePx }}>
|
|
43
43
|
<Component
|
|
44
44
|
{...props}
|
|
45
45
|
ref={ref}
|
|
@@ -57,7 +57,7 @@ export const ColorSwatch = forwardRef(function ColorSwatch(
|
|
|
57
57
|
{checked && (
|
|
58
58
|
<CheckIcon
|
|
59
59
|
color={checkedColor}
|
|
60
|
-
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
60
|
+
className="n-absolute n-top-1/2 n-left-1/2 -n-translate-x-1/2 -n-translate-y-1/2"
|
|
61
61
|
/>
|
|
62
62
|
)}
|
|
63
63
|
</div>
|
|
@@ -61,7 +61,7 @@ export function ColorSwatchControl(props: ColorSwatchControlProps) {
|
|
|
61
61
|
onBlur={onBlur}
|
|
62
62
|
disabled={disabled}
|
|
63
63
|
// TODO: decide on "checked" visual treatment
|
|
64
|
-
className={cx(readOnly ? "cursor-default" : "cursor-pointer")}
|
|
64
|
+
className={cx(readOnly ? "n-cursor-default" : "n-cursor-pointer")}
|
|
65
65
|
checked={value === option}
|
|
66
66
|
/>
|
|
67
67
|
);
|
|
@@ -83,7 +83,7 @@ export function ColorSwatchControl(props: ColorSwatchControlProps) {
|
|
|
83
83
|
type="single"
|
|
84
84
|
value={value as string}
|
|
85
85
|
onValueChange={onValueChange}
|
|
86
|
-
className="w-full"
|
|
86
|
+
className="n-w-full"
|
|
87
87
|
disabled={readOnly}
|
|
88
88
|
>
|
|
89
89
|
{content}
|
|
@@ -466,8 +466,8 @@ export const Combobox = memoGeneric(
|
|
|
466
466
|
>
|
|
467
467
|
<DropdownChevronIcon
|
|
468
468
|
className={cx(
|
|
469
|
-
"transition-transform duration-100",
|
|
470
|
-
shouldShowMenu ? "rotate-180" : "rotate-0"
|
|
469
|
+
"n-transition-transform n-duration-100",
|
|
470
|
+
shouldShowMenu ? "n-rotate-180" : "n-rotate-0"
|
|
471
471
|
)}
|
|
472
472
|
/>
|
|
473
473
|
</InputField.Button>
|
|
@@ -488,8 +488,8 @@ export const Combobox = memoGeneric(
|
|
|
488
488
|
return (
|
|
489
489
|
<div
|
|
490
490
|
className={cx(
|
|
491
|
-
"flex-col",
|
|
492
|
-
shouldShowMenu && !readOnly ? "flex" : "hidden"
|
|
491
|
+
"n-flex-col",
|
|
492
|
+
shouldShowMenu && !readOnly ? "n-flex" : "n-hidden"
|
|
493
493
|
)}
|
|
494
494
|
>
|
|
495
495
|
{filteredItems.length > 0 && !loading ? (
|
|
@@ -506,8 +506,8 @@ export const Combobox = memoGeneric(
|
|
|
506
506
|
indented={hasCheckedItems}
|
|
507
507
|
/>
|
|
508
508
|
) : (
|
|
509
|
-
<div className="flex flex-col h-[50px] p-5 items-center justify-center">
|
|
510
|
-
<Small className="text-text-disabled">
|
|
509
|
+
<div className="n-flex n-flex-col n-h-[50px] n-p-5 n-items-center n-justify-center">
|
|
510
|
+
<Small className="n-text-text-disabled">
|
|
511
511
|
{loading ? "Loading..." : "No results"}
|
|
512
512
|
</Small>
|
|
513
513
|
</div>
|
|
@@ -6,8 +6,6 @@ import { cx } from "../utils/classNames";
|
|
|
6
6
|
|
|
7
7
|
import { fuzzyTokenize } from "../utils/fuzzyScorer";
|
|
8
8
|
import { renderIcon } from "./Icons";
|
|
9
|
-
import { IVirtualizedList, ListView } from "./ListView";
|
|
10
|
-
import { Spacer } from "./Spacer";
|
|
11
9
|
import {
|
|
12
10
|
CHECKBOX_INDENT_WIDTH,
|
|
13
11
|
CHECKBOX_RIGHT_INSET,
|
|
@@ -16,6 +14,9 @@ import {
|
|
|
16
14
|
ScoredMenuItem,
|
|
17
15
|
styles,
|
|
18
16
|
} from "./internal/Menu";
|
|
17
|
+
import { IVirtualizedList } from "./IVirtualizedList";
|
|
18
|
+
import { ListView } from "./ListView";
|
|
19
|
+
import { Spacer } from "./Spacer";
|
|
19
20
|
|
|
20
21
|
interface ComboboxMenuProps<T extends string> {
|
|
21
22
|
items: ScoredMenuItem<T>[];
|
|
@@ -92,7 +93,7 @@ export const ComboboxMenu = memoGeneric(
|
|
|
92
93
|
}
|
|
93
94
|
}}
|
|
94
95
|
>
|
|
95
|
-
<div className="flex flex-1 min-w-0 items-center">
|
|
96
|
+
<div className="n-flex n-flex-1 n-min-w-0 n-items-center">
|
|
96
97
|
{indented && <Spacer.Horizontal size={CHECKBOX_INDENT_WIDTH} />}
|
|
97
98
|
{item.checked ? (
|
|
98
99
|
<div {...styles.itemIndicator}>
|
|
@@ -113,8 +114,8 @@ export const ComboboxMenu = memoGeneric(
|
|
|
113
114
|
<span
|
|
114
115
|
key={`${item.value}-token-${j}`}
|
|
115
116
|
className={cx(
|
|
116
|
-
token.type === "match" ? "font-bold" : "font-normal",
|
|
117
|
-
"whitespace-pre truncate"
|
|
117
|
+
token.type === "match" ? "n-font-bold" : "n-font-normal",
|
|
118
|
+
"n-whitespace-pre n-truncate"
|
|
118
119
|
)}
|
|
119
120
|
>
|
|
120
121
|
{token.text}
|
|
@@ -19,7 +19,7 @@ const StyledOverlay = forwardRef<
|
|
|
19
19
|
>(({ className, ...props }, ref) => (
|
|
20
20
|
<DialogPrimitive.Overlay
|
|
21
21
|
ref={ref}
|
|
22
|
-
className={cx(`fixed inset-0 bg-[rgba(0,0,0,0.5)]
|
|
22
|
+
className={cx(`n-fixed n-inset-0 n-bg-[rgba(0,0,0,0.5)]`, className)}
|
|
23
23
|
{...props}
|
|
24
24
|
/>
|
|
25
25
|
));
|
|
@@ -32,13 +32,7 @@ const StyledContent = forwardRef<
|
|
|
32
32
|
<DialogPrimitive.Content
|
|
33
33
|
ref={ref}
|
|
34
34
|
className={cx(
|
|
35
|
-
`fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
|
|
36
|
-
w-[90vw] max-w-[550px] max-h-[85vh] p-dialog-padding rounded-[2px]
|
|
37
|
-
font-sans text-heading5 font-normal leading-[19px] text-text-muted
|
|
38
|
-
bg-popover-background pointer-events-all z-[1000] focus:outline-none
|
|
39
|
-
shadow-dialog-shadow
|
|
40
|
-
flex flex-col
|
|
41
|
-
`,
|
|
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`,
|
|
42
36
|
className
|
|
43
37
|
)}
|
|
44
38
|
{...props}
|
|
@@ -55,7 +49,7 @@ const StyledTitle = forwardRef<
|
|
|
55
49
|
<DialogPrimitive.Title
|
|
56
50
|
ref={ref}
|
|
57
51
|
className={cx(
|
|
58
|
-
`m-0 font-sans text-heading3 font-medium leading-[1.4] text-text
|
|
52
|
+
`n-m-0 n-font-sans n-text-heading3 n-font-medium n-leading-[1.4] n-text-text`,
|
|
59
53
|
className
|
|
60
54
|
)}
|
|
61
55
|
{...props}
|
|
@@ -69,7 +63,7 @@ const StyledDescription = forwardRef<
|
|
|
69
63
|
<DialogPrimitive.Description
|
|
70
64
|
ref={ref}
|
|
71
65
|
className={cx(
|
|
72
|
-
`m-0 font-sans text-heading5 font-normal leading-[19px] text-text-muted
|
|
66
|
+
`n-m-0 n-font-sans n-text-heading5 n-font-normal n-leading-[19px] n-text-text-muted`,
|
|
73
67
|
className
|
|
74
68
|
)}
|
|
75
69
|
{...props}
|
|
@@ -136,7 +130,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
136
130
|
<DialogPrimitive.Close asChild>
|
|
137
131
|
<IconButton
|
|
138
132
|
iconName="Cross1Icon"
|
|
139
|
-
className="z-[1]"
|
|
133
|
+
className="n-z-[1]"
|
|
140
134
|
style={{
|
|
141
135
|
position: "absolute",
|
|
142
136
|
top: "var(--n-dialog-padding)",
|
|
@@ -170,7 +164,7 @@ export const FullscreenDialog = forwardRef(function FullscreenDialog(
|
|
|
170
164
|
return (
|
|
171
165
|
<Dialog
|
|
172
166
|
ref={forwardedRef}
|
|
173
|
-
className="w-full h-full max-w-full max-h-full top-0 left-0 translate-none flex flex-col p-0"
|
|
167
|
+
className="n-w-full n-h-full n-max-w-full n-max-h-full n-top-0 n-left-0 n-translate-none n-flex n-flex-col n-p-0"
|
|
174
168
|
style={style}
|
|
175
169
|
{...rest}
|
|
176
170
|
/>
|