@noya-app/noya-designsystem 0.1.63 → 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 +25 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +648 -333
- package/dist/index.d.ts +648 -333
- package/dist/index.js +13813 -9157
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13949 -9269
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -22
- package/src/__tests__/validateDropIndicator.test.ts +26 -41
- package/src/__tests__/workspaceLayout.test.ts +281 -0
- package/src/components/ActionMenu.tsx +2 -0
- package/src/components/ActivityIndicator.tsx +13 -6
- package/src/components/ActivityLog.tsx +197 -0
- package/src/components/AnimatePresence.tsx +43 -26
- package/src/components/Avatar.tsx +45 -26
- package/src/components/Banner.tsx +57 -11
- package/src/components/BaseToolbar.tsx +67 -34
- package/src/components/Breadcrumbs.tsx +4 -2
- package/src/components/Button.tsx +28 -23
- package/src/components/Checkbox.tsx +6 -35
- package/src/components/Chip.tsx +47 -33
- package/src/components/Collection.tsx +20 -12
- package/src/components/ColorSwatch.tsx +42 -22
- package/src/components/ColorSwatchControl.tsx +7 -5
- package/src/components/Combobox.tsx +8 -6
- package/src/components/ComboboxMenu.tsx +6 -5
- package/src/components/CommandPalette.tsx +3 -1
- package/src/components/ContextMenu.tsx +3 -1
- package/src/components/Dialog.tsx +9 -13
- package/src/components/DimensionInput.tsx +2 -0
- package/src/components/Divider.tsx +18 -14
- package/src/components/DraggableMenuButton.tsx +11 -5
- package/src/components/Drawer.tsx +14 -6
- package/src/components/DropdownMenu.tsx +4 -2
- package/src/components/EditableText.tsx +4 -2
- package/src/components/Fade.tsx +13 -13
- package/src/components/FileUploadIndicator.tsx +108 -0
- package/src/components/FloatingWindow.tsx +4 -2
- package/src/components/Grid.tsx +58 -42
- package/src/components/GridView.tsx +65 -36
- package/src/components/IVirtualizedList.tsx +5 -0
- package/src/components/IconButton.tsx +2 -0
- package/src/components/Icons.tsx +24 -4
- package/src/components/InputField.tsx +21 -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 +9 -5
- package/src/components/LabeledField.tsx +8 -6
- package/src/components/List.tsx +112 -46
- package/src/components/ListMenu.tsx +91 -0
- package/src/components/ListNavigator.tsx +106 -0
- package/src/components/ListView.tsx +22 -1147
- package/src/components/MediaThumbnail.tsx +84 -14
- package/src/components/Message.tsx +11 -12
- package/src/components/Navigator.tsx +461 -0
- package/src/components/NoyaLogo.tsx +1 -1
- package/src/components/Popover.tsx +12 -6
- package/src/components/Progress.tsx +31 -8
- package/src/components/ResizableContainer.tsx +187 -0
- package/src/components/RingProgress.tsx +128 -0
- package/src/components/ScrollArea.tsx +7 -5
- package/src/components/ScrollableSidebar.tsx +10 -0
- package/src/components/SearchCompletionMenu.tsx +5 -3
- package/src/components/Section.tsx +109 -57
- package/src/components/SegmentedControl.tsx +51 -25
- package/src/components/SelectMenu.tsx +16 -21
- package/src/components/SelectionToolbar.tsx +7 -4
- package/src/components/Slider.tsx +12 -10
- 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 +7 -5
- package/src/components/Tabs.tsx +6 -4
- package/src/components/Text.tsx +29 -18
- package/src/components/TextArea.tsx +5 -3
- package/src/components/Toast.tsx +5 -5
- package/src/components/Toolbar.tsx +57 -10
- package/src/components/ToolbarDrawer.tsx +29 -0
- package/src/components/Tooltip.tsx +2 -2
- package/src/components/TreeView.tsx +13 -4
- package/src/components/UserPointer.tsx +6 -4
- package/src/components/ai-assistant/AIAssistantLayout.tsx +10 -8
- package/src/components/blocks/ImageBlockComponent.tsx +162 -0
- package/src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx +6 -4
- package/src/components/file-explorer/FileExplorerLayout.tsx +22 -8
- package/src/components/internal/Checkmark.tsx +24 -0
- package/src/components/internal/Menu.tsx +24 -19
- package/src/components/internal/MenuViewport.tsx +15 -6
- package/src/components/internal/SelectItem.tsx +7 -26
- package/src/components/internal/TextInput.tsx +7 -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 +10 -5
- package/src/components/sorting/SharedDragProvider.tsx +134 -27
- package/src/components/sorting/Sortable.tsx +90 -27
- package/src/components/sorting/createSharedDrag.tsx +7 -6
- package/src/components/sorting/sorting.ts +6 -9
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +110 -29
- package/src/components/workspace/PanelWorkspaceLayout.tsx +148 -99
- package/src/components/workspace/VerticalTabMenu.tsx +46 -0
- package/src/components/workspace/WorkspaceLayout.tsx +76 -63
- package/src/components/workspace/constants.ts +4 -0
- package/src/components/workspace/panelStorage.ts +216 -0
- package/src/components/workspace/types.ts +11 -4
- package/src/contexts/DesignSystemConfiguration.tsx +12 -5
- package/src/contexts/DialogContext.tsx +19 -5
- package/src/contexts/FloatingWindowContext.tsx +2 -0
- package/src/contexts/GlobalInputBlurContext.tsx +2 -0
- package/src/contexts/ImageDataContext.tsx +2 -0
- package/src/contexts/LinkComponentContext.tsx +17 -0
- package/src/contexts/OpenPortalsContext.tsx +2 -0
- package/src/contexts/PortalScopeContext.tsx +2 -0
- package/src/hooks/mergeEventHandlers.ts +1 -1
- package/src/hooks/useHover.ts +30 -17
- package/src/hooks/useIndent.ts +5 -8
- package/src/hooks/useLabel.ts +2 -0
- package/src/hooks/useObjectURL.ts +5 -3
- package/src/hooks/usePlatform.ts +5 -3
- package/src/hooks/useTheme.ts +3 -1
- package/src/index.css +43 -10
- package/src/index.tsx +15 -7
- package/src/utils/classNames.ts +56 -9
- package/src/utils/combobox.ts +2 -0
- package/src/utils/editableBlockStyles.ts +2 -2
- package/src/utils/formatByteSize.ts +9 -0
- package/src/utils/inputs.ts +8 -6
- package/src/utils/sketchColor.ts +0 -34
- package/src/utils/withSeparatorElements.ts +1 -1
- package/tailwind.config.ts +1 -0
- package/src/components/FillInputField.tsx +0 -37
- package/src/components/FillPreviewBackground.tsx +0 -132
- package/src/components/GradientPicker.tsx +0 -88
- package/src/hooks/usePreservePanelSize.tsx +0 -183
- package/src/mediaQuery.ts +0 -13
- package/src/utils/getGradientBackground.tsx +0 -31
|
@@ -1,57 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Button,
|
|
3
5
|
IconButton,
|
|
6
|
+
IconName,
|
|
4
7
|
IndentContext,
|
|
5
8
|
INPUT_HEIGHT,
|
|
6
9
|
InspectorPrimitives,
|
|
10
|
+
renderIcon,
|
|
7
11
|
Spacer,
|
|
12
|
+
Text,
|
|
8
13
|
textStyles,
|
|
9
14
|
} from "@noya-app/noya-designsystem";
|
|
10
15
|
import { clientStorage, usePersistentStateString } from "@noya-app/react-utils";
|
|
11
16
|
import React, { CSSProperties, memo, useMemo } from "react";
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
const titleIconStyle: CSSProperties = {
|
|
19
|
+
marginRight: "6px",
|
|
20
|
+
alignSelf: "flex-start",
|
|
21
|
+
position: "relative",
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
minHeight: "27px",
|
|
25
|
+
flex: "none",
|
|
15
26
|
};
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
type SectionHeaderProps = {
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
className?: string;
|
|
19
31
|
title?: React.ReactNode;
|
|
20
|
-
onClickTitle?: () => void;
|
|
21
32
|
titleTextStyle?: "small" | "heading5" | "heading4" | "heading3";
|
|
33
|
+
titleClassName?: string;
|
|
34
|
+
titleIcon?: Exclude<React.ReactNode, string> | IconName;
|
|
35
|
+
onClickTitle?: () => void;
|
|
22
36
|
right?: React.ReactNode;
|
|
37
|
+
headerSeparator?: "space" | "dot";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function SectionHeader({
|
|
41
|
+
style,
|
|
42
|
+
className,
|
|
43
|
+
title,
|
|
44
|
+
titleIcon,
|
|
45
|
+
right,
|
|
46
|
+
headerSeparator = "space",
|
|
47
|
+
titleTextStyle = "heading4",
|
|
48
|
+
titleClassName,
|
|
49
|
+
onClickTitle,
|
|
50
|
+
}: SectionHeaderProps) {
|
|
51
|
+
const headerStyle: CSSProperties = useMemo(
|
|
52
|
+
() => ({
|
|
53
|
+
minHeight: INPUT_HEIGHT,
|
|
54
|
+
...style,
|
|
55
|
+
}),
|
|
56
|
+
[style]
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const titleElement = title ? (
|
|
60
|
+
<InspectorPrimitives.Title
|
|
61
|
+
$textStyle={titleTextStyle}
|
|
62
|
+
className={titleClassName}
|
|
63
|
+
>
|
|
64
|
+
{title}
|
|
65
|
+
</InspectorPrimitives.Title>
|
|
66
|
+
) : null;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<InspectorPrimitives.SectionHeader
|
|
70
|
+
style={headerStyle}
|
|
71
|
+
className={className}
|
|
72
|
+
>
|
|
73
|
+
{titleIcon && (
|
|
74
|
+
<div style={titleIconStyle} className={textStyles[titleTextStyle]}>
|
|
75
|
+
{"\u200B"}
|
|
76
|
+
{renderIcon(titleIcon)}
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
{titleElement && (
|
|
80
|
+
<>
|
|
81
|
+
{onClickTitle ? (
|
|
82
|
+
<Button variant="none" onClick={onClickTitle}>
|
|
83
|
+
{titleElement}
|
|
84
|
+
</Button>
|
|
85
|
+
) : (
|
|
86
|
+
titleElement
|
|
87
|
+
)}
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
{headerSeparator === "space" && <Spacer.Horizontal />}
|
|
91
|
+
{headerSeparator === "dot" && (
|
|
92
|
+
<Text
|
|
93
|
+
variant={titleTextStyle}
|
|
94
|
+
color="textDisabled"
|
|
95
|
+
style={{ padding: "0 4px" }}
|
|
96
|
+
>
|
|
97
|
+
•
|
|
98
|
+
</Text>
|
|
99
|
+
)}
|
|
100
|
+
{right}
|
|
101
|
+
</InspectorPrimitives.SectionHeader>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type SectionProps = {
|
|
106
|
+
children: React.ReactNode;
|
|
23
107
|
hideRightWhenCollapsed?: boolean;
|
|
24
108
|
extraPadding?: boolean;
|
|
25
109
|
className?: string;
|
|
26
110
|
style?: CSSProperties;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const titleIconStyle: CSSProperties = {
|
|
32
|
-
marginRight: "8px",
|
|
33
|
-
alignSelf: "flex-start",
|
|
34
|
-
position: "relative",
|
|
35
|
-
top: "2px",
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const titleIconWrapperStyle: CSSProperties = {
|
|
39
|
-
display: "inline-block",
|
|
40
|
-
};
|
|
111
|
+
headerStyle?: CSSProperties;
|
|
112
|
+
} & Omit<SectionHeaderProps, "style" | "className">;
|
|
41
113
|
|
|
42
114
|
const SectionInternal = ({
|
|
43
115
|
children,
|
|
44
116
|
title,
|
|
45
117
|
onClickTitle,
|
|
46
|
-
titleTextStyle
|
|
118
|
+
titleTextStyle,
|
|
47
119
|
right,
|
|
48
120
|
extraPadding,
|
|
49
121
|
className,
|
|
50
122
|
style: styleProp,
|
|
51
123
|
titleIcon,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
124
|
+
headerSeparator,
|
|
125
|
+
titleClassName,
|
|
126
|
+
headerStyle: headerStyleProp,
|
|
55
127
|
}: SectionProps) => {
|
|
56
128
|
const style: CSSProperties = useMemo(
|
|
57
129
|
() => ({
|
|
@@ -80,46 +152,26 @@ const SectionInternal = ({
|
|
|
80
152
|
const headerStyle: CSSProperties = useMemo(
|
|
81
153
|
() => ({
|
|
82
154
|
marginBottom: hasChildren ? "4px" : undefined,
|
|
83
|
-
|
|
155
|
+
...headerStyleProp,
|
|
84
156
|
}),
|
|
85
|
-
[hasChildren]
|
|
157
|
+
[hasChildren, headerStyleProp]
|
|
86
158
|
);
|
|
87
159
|
|
|
88
160
|
return (
|
|
89
161
|
<div style={style} className={className}>
|
|
90
162
|
{(title || titleIcon || right) && (
|
|
91
|
-
<
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
{title && (
|
|
102
|
-
<>
|
|
103
|
-
{onClickTitle ? (
|
|
104
|
-
<Button variant="none" onClick={onClickTitle}>
|
|
105
|
-
<InspectorPrimitives.Title $textStyle={titleTextStyle}>
|
|
106
|
-
{title}
|
|
107
|
-
</InspectorPrimitives.Title>
|
|
108
|
-
</Button>
|
|
109
|
-
) : (
|
|
110
|
-
<InspectorPrimitives.Title $textStyle={titleTextStyle}>
|
|
111
|
-
{title}
|
|
112
|
-
</InspectorPrimitives.Title>
|
|
113
|
-
)}
|
|
114
|
-
</>
|
|
115
|
-
)}
|
|
116
|
-
<Spacer.Horizontal />
|
|
117
|
-
{right}
|
|
118
|
-
</InspectorPrimitives.SectionHeader>
|
|
163
|
+
<SectionHeader
|
|
164
|
+
style={headerStyle}
|
|
165
|
+
title={title}
|
|
166
|
+
titleIcon={titleIcon}
|
|
167
|
+
titleTextStyle={titleTextStyle}
|
|
168
|
+
titleClassName={titleClassName}
|
|
169
|
+
onClickTitle={onClickTitle}
|
|
170
|
+
right={right}
|
|
171
|
+
headerSeparator={headerSeparator}
|
|
172
|
+
/>
|
|
119
173
|
)}
|
|
120
|
-
<IndentContext.Provider value={{
|
|
121
|
-
{children}
|
|
122
|
-
</IndentContext.Provider>
|
|
174
|
+
<IndentContext.Provider value={0}>{children}</IndentContext.Provider>
|
|
123
175
|
</div>
|
|
124
176
|
);
|
|
125
177
|
};
|
|
@@ -146,7 +198,7 @@ const ExpandableSection = ({
|
|
|
146
198
|
{...props}
|
|
147
199
|
right={!props.hideRightWhenCollapsed || expanded ? props.right : null}
|
|
148
200
|
title={
|
|
149
|
-
<div className="flex gap-1 items-center">
|
|
201
|
+
<div className="n-flex n-gap-1 n-items-center">
|
|
150
202
|
{props.title}
|
|
151
203
|
<IconButton
|
|
152
204
|
iconName={expanded ? "ChevronDownIcon2" : "ChevronRightIcon2"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import { memoGeneric } from "@noya-app/react-utils";
|
|
2
|
-
import
|
|
4
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
3
5
|
import React, {
|
|
4
6
|
createContext,
|
|
5
7
|
forwardRef,
|
|
@@ -15,7 +17,7 @@ import { SelectableMenuItem } from "./internal/Menu";
|
|
|
15
17
|
import { Tooltip } from "./Tooltip";
|
|
16
18
|
|
|
17
19
|
type SegmentedControlColorScheme = "primary" | "secondary";
|
|
18
|
-
type SegmentedControlVariant = "default" | "tabs";
|
|
20
|
+
type SegmentedControlVariant = "default" | "tabs" | "buttons";
|
|
19
21
|
|
|
20
22
|
type SegmentedControlContextValue = {
|
|
21
23
|
/** @default primary */
|
|
@@ -73,37 +75,60 @@ const SegmentedControlItem = forwardRef(function SegmentedControlItem<
|
|
|
73
75
|
value={(value ?? "").toString()}
|
|
74
76
|
disabled={disabled}
|
|
75
77
|
className={cx(
|
|
76
|
-
"group",
|
|
77
|
-
"flex items-center justify-center",
|
|
78
|
-
"font-sans text-button relative flex-1 appearance-none
|
|
79
|
-
|
|
78
|
+
"n-group",
|
|
79
|
+
"n-flex n-items-center n-justify-center",
|
|
80
|
+
"n-font-sans n-text-button n-relative n-flex-1 n-appearance-none focus:n-outline-none n-transition-colors",
|
|
81
|
+
// text color
|
|
82
|
+
variant === "buttons"
|
|
83
|
+
? "n-text-button-text"
|
|
84
|
+
: "n-text-segmented-control-item",
|
|
85
|
+
// font weight
|
|
86
|
+
variant === "tabs"
|
|
87
|
+
? "n-font-semibold"
|
|
88
|
+
: variant === "buttons"
|
|
89
|
+
? "n-font-medium"
|
|
90
|
+
: "n-font-normal",
|
|
91
|
+
// focus ring
|
|
80
92
|
variant === "tabs"
|
|
81
93
|
? ""
|
|
82
|
-
:
|
|
83
|
-
? "focus:ring-2 focus:ring-
|
|
84
|
-
:
|
|
94
|
+
: variant === "buttons"
|
|
95
|
+
? "focus-visible:n-ring-2 focus-visible:n-ring-primary focus:n-shadow-[0_0_0_1px_var(--n-popover-background)_inset] n-transition-all"
|
|
96
|
+
: colorScheme === "secondary"
|
|
97
|
+
? "focus:n-ring-2 focus:n-ring-secondary focus:n-ring-offset-1"
|
|
98
|
+
: "focus:n-ring-2 focus:n-ring-primary focus:n-ring-offset-1",
|
|
99
|
+
// checked
|
|
85
100
|
variant === "tabs"
|
|
86
|
-
? "aria-checked:text-primary"
|
|
87
|
-
:
|
|
88
|
-
? "
|
|
89
|
-
: colorScheme === "
|
|
90
|
-
? "aria-checked:bg-
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
? "aria-checked:n-text-primary"
|
|
102
|
+
: variant === "buttons"
|
|
103
|
+
? "active:n-text-button-text-active active:n-bg-button-background-active aria-checked:n-text-button-text-active aria-checked:n-bg-button-background-active"
|
|
104
|
+
: colorScheme === "secondary"
|
|
105
|
+
? "aria-checked:n-bg-secondary aria-checked:n-text-white"
|
|
106
|
+
: colorScheme === "primary"
|
|
107
|
+
? "aria-checked:n-bg-primary aria-checked:n-text-white"
|
|
108
|
+
: "aria-checked:n-bg-segmented-control-item-active-background aria-checked:n-text-segmented-control-item-active-text",
|
|
109
|
+
"focus:n-z-interactable",
|
|
110
|
+
// checked default (all colorSchemes)
|
|
96
111
|
variant === "default" &&
|
|
97
|
-
"
|
|
112
|
+
"aria-checked:n-border-r-transparent [&:has(+[aria-checked=true])]:n-border-r-transparent aria-checked:n-shadow-segment",
|
|
113
|
+
// hover
|
|
114
|
+
variant === "buttons" && "hover:n-bg-button-background-hover",
|
|
115
|
+
// spacing and borders
|
|
116
|
+
variant === "default"
|
|
117
|
+
? "n-px-1 n-rounded n-border-r n-border-divider last:n-border-r-0"
|
|
118
|
+
: variant === "buttons"
|
|
119
|
+
? "n-px-1 n-rounded-sm n-max-w-fit"
|
|
120
|
+
: "n-px-1.5 n-border-y-2 n-border-y-transparent aria-checked:n-border-b-primary",
|
|
121
|
+
// icon only buttons
|
|
122
|
+
variant === "buttons" && title === "" && icon && "n-min-w-input-height",
|
|
98
123
|
className
|
|
99
124
|
)}
|
|
100
125
|
{...props}
|
|
101
126
|
>
|
|
102
127
|
<span
|
|
103
128
|
className={cx(
|
|
104
|
-
"inline-flex whitespace-pre flex-nowrap gap-1.5 items-center justify-center align-middle text-center",
|
|
129
|
+
"n-inline-flex n-whitespace-pre n-flex-nowrap n-gap-1.5 n-items-center n-justify-center n-align-middle n-text-center",
|
|
105
130
|
variant === "tabs" &&
|
|
106
|
-
"group-focus-visible:ring-2 group-focus-visible:ring-primary-pastel group-focus-visible:ring-offset-2"
|
|
131
|
+
"group-focus-visible:n-ring-2 group-focus-visible:n-ring-primary-pastel group-focus-visible:n-ring-offset-2"
|
|
107
132
|
)}
|
|
108
133
|
>
|
|
109
134
|
{icon && renderIcon(icon)}
|
|
@@ -151,10 +176,11 @@ export const SegmentedControl = memoGeneric(function SegmentedControl<
|
|
|
151
176
|
value={value}
|
|
152
177
|
onValueChange={handleValueChange}
|
|
153
178
|
className={cx(
|
|
154
|
-
`appearance-none relative outline-none`,
|
|
179
|
+
`n-appearance-none n-relative n-outline-none`,
|
|
155
180
|
variant === "default" &&
|
|
156
|
-
"grid min-h-input-height bg-input-background rounded py-0.5 px-0.5",
|
|
157
|
-
variant === "tabs" && "flex gap-1.5 min-h-[33px]",
|
|
181
|
+
"n-grid n-min-h-input-height n-bg-input-background n-rounded n-py-0.5 n-px-0.5",
|
|
182
|
+
variant === "tabs" && "n-flex n-gap-1.5 n-min-h-[33px]",
|
|
183
|
+
variant === "buttons" && "n-flex n-gap-1.5 n-min-h-input-height",
|
|
158
184
|
className
|
|
159
185
|
)}
|
|
160
186
|
style={{
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
ChevronDownIcon,
|
|
3
5
|
ChevronUpIcon,
|
|
4
6
|
DropdownChevronIcon,
|
|
5
7
|
} from "@noya-app/noya-icons";
|
|
6
8
|
import { memoGeneric } from "@noya-app/react-utils";
|
|
7
|
-
import
|
|
9
|
+
import { Select } from "radix-ui";
|
|
8
10
|
import { type SelectProps } from "@radix-ui/react-select";
|
|
9
11
|
import React, {
|
|
10
12
|
CSSProperties,
|
|
@@ -52,15 +54,8 @@ const readOnlyStyle: CSSProperties = {
|
|
|
52
54
|
textAlign: "left",
|
|
53
55
|
};
|
|
54
56
|
|
|
55
|
-
const scrollButtonStyles =
|
|
56
|
-
flex
|
|
57
|
-
items-center
|
|
58
|
-
justify-center
|
|
59
|
-
h-[25px]
|
|
60
|
-
cursor-default
|
|
61
|
-
text-text-muted
|
|
62
|
-
hover:text-text
|
|
63
|
-
`;
|
|
57
|
+
const scrollButtonStyles =
|
|
58
|
+
"n-flex n-items-center n-justify-center n-h-[25px] n-cursor-default n-text-text-muted hover:n-text-text";
|
|
64
59
|
|
|
65
60
|
const insetEndStyles = getInsetEndStyles();
|
|
66
61
|
|
|
@@ -100,27 +95,27 @@ const SelectMenuTrigger = memoGeneric(function SelectMenuTrigger({
|
|
|
100
95
|
id={id}
|
|
101
96
|
style={style}
|
|
102
97
|
className={cx(
|
|
103
|
-
className ?? "flex w-full",
|
|
104
|
-
"flex-1 focus:z-interactable relative",
|
|
105
|
-
isOpen && "ring-2 ring-primary"
|
|
98
|
+
className ?? "n-flex n-w-full",
|
|
99
|
+
"n-flex-1 focus:n-z-interactable n-relative",
|
|
100
|
+
isOpen && "n-ring-2 n-ring-primary"
|
|
106
101
|
)}
|
|
107
102
|
disabled={disabled}
|
|
108
103
|
>
|
|
109
|
-
{icon && <span className="pr-1.5">{renderIcon(icon)}</span>}
|
|
104
|
+
{icon && <span className="n-pr-1.5">{renderIcon(icon)}</span>}
|
|
110
105
|
{label && labelType === "inset" && (
|
|
111
106
|
<div className={insetEndStyles}>
|
|
112
|
-
<Label className="pr-4 text-text-disabled" htmlFor={id}>
|
|
107
|
+
<Label className="n-pr-4 n-text-text-disabled" htmlFor={id}>
|
|
113
108
|
{label}
|
|
114
109
|
</Label>
|
|
115
110
|
</div>
|
|
116
111
|
)}
|
|
117
|
-
<span className="flex-1 flex">
|
|
112
|
+
<span className="n-flex-1 n-flex">
|
|
118
113
|
<Select.Value placeholder={placeholder} />
|
|
119
114
|
</span>
|
|
120
115
|
<DropdownChevronIcon
|
|
121
116
|
className={cx(
|
|
122
|
-
"transition-transform duration-100 ml-1.5",
|
|
123
|
-
isOpen ? "rotate-180" : "rotate-0"
|
|
117
|
+
"n-transition-transform n-duration-100 n-ml-1.5",
|
|
118
|
+
isOpen ? "n-rotate-180" : "n-rotate-0"
|
|
124
119
|
)}
|
|
125
120
|
/>
|
|
126
121
|
</Button>
|
|
@@ -179,11 +174,11 @@ export const SelectMenu = memoGeneric(function SelectMenu<
|
|
|
179
174
|
id={id}
|
|
180
175
|
style={style}
|
|
181
176
|
contentStyle={readOnlyStyle}
|
|
182
|
-
className={cx(
|
|
177
|
+
className={cx("n-flex-1 focus:n-z-interactable n-gap-1.5", className)}
|
|
183
178
|
disabled={disabled}
|
|
184
179
|
>
|
|
185
180
|
{icon && renderIcon(icon)}
|
|
186
|
-
<span className="flex flex-1">{selectedItem?.title ?? value}</span>
|
|
181
|
+
<span className="n-flex n-flex-1">{selectedItem?.title ?? value}</span>
|
|
187
182
|
</Button>
|
|
188
183
|
),
|
|
189
184
|
[icon, id, style, className, disabled, value, selectedItem]
|
|
@@ -229,7 +224,7 @@ export const SelectMenu = memoGeneric(function SelectMenu<
|
|
|
229
224
|
>
|
|
230
225
|
<Select.ScrollUpButton className={scrollButtonStyles}>
|
|
231
226
|
<ChevronUpIcon
|
|
232
|
-
className={cx("transition-transform duration-100")}
|
|
227
|
+
className={cx("n-transition-transform n-duration-100")}
|
|
233
228
|
/>
|
|
234
229
|
</Select.ScrollUpButton>
|
|
235
230
|
<Select.Viewport>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
cssVarNames,
|
|
3
5
|
cx,
|
|
@@ -32,7 +34,7 @@ type PopperPrimitiveContentProps = ComponentProps<
|
|
|
32
34
|
|
|
33
35
|
type SelectionToolbarContainerProps = Pick<
|
|
34
36
|
PopperPrimitiveContentProps,
|
|
35
|
-
"side" | "sideOffset" | "align"
|
|
37
|
+
"side" | "sideOffset" | "align" | "avoidCollisions"
|
|
36
38
|
> & {
|
|
37
39
|
rect: Rect;
|
|
38
40
|
children: React.ReactNode;
|
|
@@ -50,6 +52,7 @@ export const SelectionToolbarContainer = memo(
|
|
|
50
52
|
side = "top",
|
|
51
53
|
sideOffset = 10,
|
|
52
54
|
align = "center",
|
|
55
|
+
avoidCollisions = true,
|
|
53
56
|
containerClassName,
|
|
54
57
|
containerStyle,
|
|
55
58
|
transitionDuration = 0.2,
|
|
@@ -72,11 +75,11 @@ export const SelectionToolbarContainer = memo(
|
|
|
72
75
|
side={side}
|
|
73
76
|
sideOffset={sideOffset}
|
|
74
77
|
align={align}
|
|
75
|
-
avoidCollisions
|
|
78
|
+
avoidCollisions={avoidCollisions}
|
|
76
79
|
collisionPadding={10}
|
|
77
80
|
contentEditable={false}
|
|
78
81
|
style={{
|
|
79
|
-
zIndex:
|
|
82
|
+
zIndex: 10,
|
|
80
83
|
opacity: size ? 1 : 0,
|
|
81
84
|
transition: `opacity ${transitionDuration}s ease-in-out`,
|
|
82
85
|
[cssVarNames.colors.inputBackground]: "transparent",
|
|
@@ -86,7 +89,7 @@ export const SelectionToolbarContainer = memo(
|
|
|
86
89
|
<div
|
|
87
90
|
ref={containerRef}
|
|
88
91
|
className={cx(
|
|
89
|
-
"flex gap-1 bg-popover-background rounded shadow-popover p-1",
|
|
92
|
+
"n-flex n-gap-1 n-bg-popover-background n-rounded n-shadow-popover n-p-1",
|
|
90
93
|
containerClassName
|
|
91
94
|
)}
|
|
92
95
|
style={containerStyle}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Slider as RadixSlider } from "radix-ui";
|
|
2
4
|
import React, { FocusEventHandler, memo, useCallback, useMemo } from "react";
|
|
3
5
|
import { useLabel } from "../hooks/useLabel";
|
|
4
6
|
import { cx } from "../utils/classNames";
|
|
@@ -68,7 +70,7 @@ export const Slider = memo(function Slider({
|
|
|
68
70
|
value={arrayValue}
|
|
69
71
|
onValueChange={handleValueChange}
|
|
70
72
|
className={cx(
|
|
71
|
-
"flex relative items-center select-none touch-none h-input-height rounded flex-grow max-h-input-height cursor-pointer",
|
|
73
|
+
"n-flex n-relative n-items-center n-select-none n-touch-none n-h-input-height n-rounded n-flex-grow n-max-h-input-height n-cursor-pointer",
|
|
72
74
|
className
|
|
73
75
|
)}
|
|
74
76
|
style={style}
|
|
@@ -76,16 +78,16 @@ export const Slider = memo(function Slider({
|
|
|
76
78
|
onBlur={onBlur}
|
|
77
79
|
disabled={readOnly}
|
|
78
80
|
>
|
|
79
|
-
<div className="relative flex-grow h-[3px] overflow-hidden">
|
|
81
|
+
<div className="n-relative n-flex-grow n-h-[3px] n-overflow-hidden">
|
|
80
82
|
<div
|
|
81
|
-
className="absolute h-full rounded-l bg-slider-active-background"
|
|
83
|
+
className="n-absolute n-h-full n-rounded-l n-bg-slider-active-background"
|
|
82
84
|
style={{
|
|
83
85
|
left: 0,
|
|
84
86
|
width: `calc(${ratio * 100}% - ${ratio * 8}px - 2px)`,
|
|
85
87
|
}}
|
|
86
88
|
/>
|
|
87
89
|
<div
|
|
88
|
-
className="absolute h-full rounded-r bg-input-background"
|
|
90
|
+
className="n-absolute n-h-full n-rounded-r n-bg-input-background"
|
|
89
91
|
style={{
|
|
90
92
|
right: 0,
|
|
91
93
|
width: `calc(100% - ${ratio * 100}% + ${ratio * 8}px - 10px)`,
|
|
@@ -95,12 +97,12 @@ export const Slider = memo(function Slider({
|
|
|
95
97
|
<RadixSlider.Thumb
|
|
96
98
|
style={thumbStyle}
|
|
97
99
|
className={cx(
|
|
98
|
-
"block h-[21px] rounded-sm bg-slider-thumb-background shadow-sliderThumb transition-colors focus:outline-primary focus:outline-2",
|
|
99
|
-
"cursor-ew-resize",
|
|
100
|
+
"n-block n-h-[21px] n-rounded-sm n-bg-slider-thumb-background n-shadow-sliderThumb n-transition-colors focus:n-outline-primary focus:n-outline-2",
|
|
101
|
+
"n-cursor-ew-resize",
|
|
100
102
|
// "outline-none outline outline-2 outline-offset-[0px] outline-background",
|
|
101
|
-
colorScheme === undefined && "border-slider-border",
|
|
102
|
-
colorScheme === "primary" && "border-primary",
|
|
103
|
-
colorScheme === "secondary" && "border-secondary"
|
|
103
|
+
colorScheme === undefined && "n-border-slider-border",
|
|
104
|
+
colorScheme === "primary" && "n-border-primary",
|
|
105
|
+
colorScheme === "secondary" && "n-border-secondary"
|
|
104
106
|
)}
|
|
105
107
|
/>
|
|
106
108
|
</RadixSlider.Root>
|
|
@@ -14,7 +14,7 @@ const SpacerVertical = React.forwardRef<HTMLSpanElement, Props>(
|
|
|
14
14
|
({ size, inline, ...props }, ref: ForwardedRef<HTMLSpanElement>) => {
|
|
15
15
|
return (
|
|
16
16
|
<span
|
|
17
|
-
className={`${inline ? "inline-block" : "block"} ${size === undefined ? "flex flex-1" : ""}`}
|
|
17
|
+
className={`${inline ? "n-inline-block" : "n-block"} ${size === undefined ? "n-flex n-flex-1" : ""}`}
|
|
18
18
|
style={
|
|
19
19
|
size
|
|
20
20
|
? {
|
|
@@ -37,7 +37,7 @@ const SpacerHorizontal = React.forwardRef<HTMLSpanElement, Props>(
|
|
|
37
37
|
({ size, inline, ...props }, ref: ForwardedRef<HTMLSpanElement>) => {
|
|
38
38
|
return (
|
|
39
39
|
<span
|
|
40
|
-
className={`${inline ? "inline-block" : "block"} ${size === undefined ? "flex flex-1" : ""}`}
|
|
40
|
+
className={`${inline ? "n-inline-block" : "n-block"} ${size === undefined ? "n-flex n-flex-1" : ""}`}
|
|
41
41
|
style={
|
|
42
42
|
size
|
|
43
43
|
? {
|