@noya-app/noya-designsystem 0.1.31 → 0.1.33
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/.turbo/turbo-lint.log +2 -1
- package/CHANGELOG.md +14 -0
- package/README.md +13 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +132 -509
- package/dist/index.js +4167 -2716
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4097 -2643
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -6
- package/src/components/ActivityIndicator.tsx +4 -36
- package/src/components/Avatar.tsx +63 -62
- package/src/components/Button.tsx +53 -172
- package/src/components/Chip.tsx +117 -150
- package/src/components/ContextMenu.tsx +13 -35
- package/src/components/Dialog.tsx +66 -54
- package/src/components/Divider.tsx +31 -41
- package/src/components/DraggableMenuButton.tsx +29 -30
- package/src/components/DropdownMenu.tsx +30 -40
- package/src/components/FillInputField.tsx +16 -26
- package/src/components/FillPreviewBackground.tsx +18 -22
- package/src/components/FloatingWindow.tsx +4 -7
- package/src/components/GridView.tsx +70 -200
- package/src/components/IconButton.tsx +1 -5
- package/src/components/InputField.tsx +191 -194
- package/src/components/InputFieldWithCompletions.tsx +20 -27
- package/src/components/InspectorContainer.tsx +4 -9
- package/src/components/InspectorPrimitives.tsx +135 -109
- package/src/components/Label.tsx +5 -36
- package/src/components/LabeledElementView.tsx +5 -26
- package/src/components/ListView.tsx +239 -167
- package/src/components/Popover.tsx +15 -39
- package/src/components/Progress.tsx +21 -44
- package/src/components/RadioGroup.tsx +6 -71
- package/src/components/ScrollArea.tsx +11 -39
- package/src/components/SelectMenu.tsx +31 -48
- package/src/components/Slider.tsx +7 -43
- package/src/components/Spacer.tsx +6 -18
- package/src/components/Switch.tsx +4 -42
- package/src/components/Text.tsx +31 -66
- package/src/components/TextArea.tsx +5 -31
- package/src/components/Toast.tsx +15 -57
- package/src/components/Tooltip.tsx +4 -13
- package/src/components/WorkspaceLayout.tsx +4 -14
- package/src/components/internal/Menu.tsx +37 -83
- package/src/contexts/DesignSystemConfiguration.tsx +1 -47
- package/src/contexts/DialogContext.tsx +2 -10
- package/src/hooks/useDarkMode.ts +14 -0
- package/src/index.css +108 -0
- package/src/index.tsx +3 -4
- package/src/theme/index.ts +4 -16
- package/src/utils/tailwind.ts +17 -0
- package/tailwind.config.ts +106 -166
- package/tsup.config.ts +16 -0
- package/dist/index.d.mts +0 -1443
- package/src/components/Grid.tsx +0 -54
- package/src/components/Stack.tsx +0 -164
- package/src/theme/dark.ts +0 -45
- package/src/theme/light.ts +0 -226
- package/src/utils/breakpoints.ts +0 -45
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Divider,
|
|
3
3
|
ScrollArea,
|
|
4
|
-
Stack,
|
|
5
|
-
useDesignSystemTheme,
|
|
6
4
|
withSeparatorElements,
|
|
7
5
|
} from "@noya-app/noya-designsystem";
|
|
8
6
|
import React, { forwardRef, memo } from "react";
|
|
@@ -28,7 +26,6 @@ export const InspectorContainer = memo(
|
|
|
28
26
|
},
|
|
29
27
|
forwardedRef: React.ForwardedRef<HTMLDivElement>
|
|
30
28
|
) {
|
|
31
|
-
const theme = useDesignSystemTheme();
|
|
32
29
|
|
|
33
30
|
return (
|
|
34
31
|
<div
|
|
@@ -39,23 +36,21 @@ export const InspectorContainer = memo(
|
|
|
39
36
|
display: "flex",
|
|
40
37
|
flexDirection: "column",
|
|
41
38
|
position: "relative",
|
|
42
|
-
background:
|
|
39
|
+
background: "var(--sidebar-background)",
|
|
43
40
|
...style,
|
|
44
41
|
}}
|
|
45
42
|
>
|
|
46
43
|
{header}
|
|
47
44
|
{children ? (
|
|
48
45
|
<ScrollArea>
|
|
49
|
-
<
|
|
46
|
+
<div className="flex flex-col relative">
|
|
50
47
|
{showDividers
|
|
51
48
|
? withSeparatorElements(children, <Divider />)
|
|
52
49
|
: children}
|
|
53
|
-
</
|
|
50
|
+
</div>
|
|
54
51
|
</ScrollArea>
|
|
55
52
|
) : fallback ? (
|
|
56
|
-
<
|
|
57
|
-
{fallback}
|
|
58
|
-
</Stack.V>
|
|
53
|
+
<div className="flex flex-col relative h-full">{fallback}</div>
|
|
59
54
|
) : null}
|
|
60
55
|
</div>
|
|
61
56
|
);
|
|
@@ -1,140 +1,166 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
1
|
+
import React, { memo, ReactNode, forwardRef } from "react";
|
|
2
|
+
import { cn } from "../utils/tailwind";
|
|
3
3
|
import { Spacer } from "./Spacer";
|
|
4
|
+
import { textStyles } from "./Text";
|
|
4
5
|
|
|
5
|
-
export const Section =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const SectionHeader =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
export const Row = styled.div<{ $gap?: CSSProperties["gap"] }>(
|
|
40
|
-
({ theme, $gap }) => ({
|
|
41
|
-
flex: "1",
|
|
42
|
-
display: "flex",
|
|
43
|
-
flexDirection: "row",
|
|
44
|
-
alignItems: "center",
|
|
45
|
-
gap: $gap,
|
|
46
|
-
})
|
|
47
|
-
);
|
|
6
|
+
export const Section = forwardRef<
|
|
7
|
+
HTMLDivElement,
|
|
8
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<div
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn("flex-none flex flex-col", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
));
|
|
16
|
+
|
|
17
|
+
export const SectionHeader = forwardRef<
|
|
18
|
+
HTMLDivElement,
|
|
19
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<div ref={ref} className={cn("flex items-center", className)} {...props} />
|
|
22
|
+
));
|
|
23
|
+
|
|
24
|
+
type TitleTextStyle = "small" | "heading5" | "heading4" | "heading3";
|
|
25
|
+
|
|
26
|
+
export const Title = forwardRef<
|
|
27
|
+
HTMLDivElement,
|
|
28
|
+
React.HTMLAttributes<HTMLDivElement> & {
|
|
29
|
+
$textStyle?: TitleTextStyle;
|
|
30
|
+
}
|
|
31
|
+
>(({ className, $textStyle, ...props }, ref) => (
|
|
32
|
+
<div
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={`flex select-none ${$textStyle ? `${textStyles[$textStyle]} text-text` : "font-sans text-label uppercase text-text-muted font-bold"} ${className ?? ""}`}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
));
|
|
48
38
|
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
39
|
+
export const Row = forwardRef<
|
|
40
|
+
HTMLDivElement,
|
|
41
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<div
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn("flex-1 flex flex-row items-center", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
));
|
|
55
49
|
|
|
56
|
-
export const
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
export const Column = forwardRef<
|
|
51
|
+
HTMLDivElement,
|
|
52
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
53
|
+
>(({ className, ...props }, ref) => (
|
|
54
|
+
<div
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn("flex-1 flex flex-col gap-1", className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
));
|
|
59
60
|
|
|
60
|
-
export const
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
export const Checkbox = forwardRef<
|
|
62
|
+
HTMLInputElement,
|
|
63
|
+
React.InputHTMLAttributes<HTMLInputElement>
|
|
64
|
+
>(({ className, ...props }, ref) => (
|
|
65
|
+
<input
|
|
66
|
+
ref={ref}
|
|
67
|
+
type="checkbox"
|
|
68
|
+
className={cn("m-0", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
));
|
|
72
|
+
|
|
73
|
+
export const Text = forwardRef<
|
|
74
|
+
HTMLSpanElement,
|
|
75
|
+
React.HTMLAttributes<HTMLSpanElement>
|
|
76
|
+
>(({ className, ...props }, ref) => (
|
|
77
|
+
<span
|
|
78
|
+
ref={ref}
|
|
79
|
+
className={cn("font-sans text-heading5 font-normal", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
));
|
|
63
83
|
|
|
64
84
|
export const VerticalSeparator = () => (
|
|
65
|
-
<Spacer.Vertical size=
|
|
85
|
+
<Spacer.Vertical size="inspector-v-separator" />
|
|
66
86
|
);
|
|
67
87
|
|
|
68
88
|
export const HorizontalSeparator = () => (
|
|
69
|
-
<Spacer.Horizontal size=
|
|
89
|
+
<Spacer.Horizontal size="inspector-h-separator" />
|
|
70
90
|
);
|
|
71
91
|
|
|
72
|
-
const SliderRowLabel =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
// const SliderRowLabel = forwardRef<
|
|
93
|
+
// HTMLSpanElement,
|
|
94
|
+
// React.HTMLAttributes<HTMLSpanElement>
|
|
95
|
+
// >(({ className, ...props }, ref) => (
|
|
96
|
+
// <span
|
|
97
|
+
// ref={ref}
|
|
98
|
+
// className={`font-sans text-heading5 font-normal text-text-muted -mb-[6px] ${className ?? ""}`}
|
|
99
|
+
// {...props}
|
|
100
|
+
// />
|
|
101
|
+
// ));
|
|
102
|
+
|
|
103
|
+
export const RowLabel = forwardRef<
|
|
104
|
+
HTMLSpanElement,
|
|
105
|
+
React.HTMLAttributes<HTMLSpanElement> & {
|
|
106
|
+
$textStyle?: TitleTextStyle | "label";
|
|
107
|
+
}
|
|
108
|
+
>(function RowLabel({ className, $textStyle, ...props }, ref) {
|
|
109
|
+
return (
|
|
110
|
+
<span
|
|
111
|
+
ref={ref}
|
|
112
|
+
className={`font-sans text-label uppercase flex items-center leading-[19px] font-bold text-text-subtle ${$textStyle && textStyles[$textStyle]} ${className ?? ""}`}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
interface LabeledRowProps {
|
|
119
|
+
id?: string;
|
|
120
|
+
children: ReactNode;
|
|
121
|
+
label: ReactNode;
|
|
122
|
+
labelTextStyle?: TitleTextStyle;
|
|
123
|
+
right?: ReactNode;
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
95
126
|
|
|
96
127
|
export const LabeledRow = memo(function LabeledRow({
|
|
97
128
|
id,
|
|
98
129
|
children,
|
|
99
130
|
label,
|
|
100
131
|
labelTextStyle,
|
|
101
|
-
gap,
|
|
102
132
|
right,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
children: ReactNode;
|
|
106
|
-
label: ReactNode;
|
|
107
|
-
labelTextStyle?: "small" | "heading5" | "heading4" | "heading3";
|
|
108
|
-
gap?: CSSProperties["gap"];
|
|
109
|
-
right?: ReactNode;
|
|
110
|
-
}) {
|
|
133
|
+
className,
|
|
134
|
+
}: LabeledRowProps) {
|
|
111
135
|
return (
|
|
112
|
-
<Row id={id}>
|
|
136
|
+
<Row id={id} className={className ?? ""}>
|
|
113
137
|
<Column>
|
|
114
138
|
<RowLabel $textStyle={labelTextStyle}>
|
|
115
139
|
{label}
|
|
116
140
|
{right && <Spacer.Horizontal />}
|
|
117
141
|
{right}
|
|
118
142
|
</RowLabel>
|
|
119
|
-
<Row $gap={gap}>{children}</Row>
|
|
120
|
-
</Column>
|
|
121
|
-
</Row>
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
export const LabeledSliderRow = memo(function LabeledRow({
|
|
126
|
-
children,
|
|
127
|
-
label,
|
|
128
|
-
}: {
|
|
129
|
-
children: ReactNode;
|
|
130
|
-
label: string;
|
|
131
|
-
}) {
|
|
132
|
-
return (
|
|
133
|
-
<Row>
|
|
134
|
-
<Column>
|
|
135
|
-
<SliderRowLabel>{label}</SliderRowLabel>
|
|
136
143
|
<Row>{children}</Row>
|
|
137
144
|
</Column>
|
|
138
145
|
</Row>
|
|
139
146
|
);
|
|
140
147
|
});
|
|
148
|
+
|
|
149
|
+
// interface LabeledSliderRowProps {
|
|
150
|
+
// children: ReactNode;
|
|
151
|
+
// label: string;
|
|
152
|
+
// }
|
|
153
|
+
|
|
154
|
+
// export const LabeledSliderRow = memo(function LabeledSliderRow({
|
|
155
|
+
// children,
|
|
156
|
+
// label,
|
|
157
|
+
// }: LabeledSliderRowProps) {
|
|
158
|
+
// return (
|
|
159
|
+
// <Row>
|
|
160
|
+
// <Column>
|
|
161
|
+
// <SliderRowLabel>{label}</SliderRowLabel>
|
|
162
|
+
// <Row>{children}</Row>
|
|
163
|
+
// </Column>
|
|
164
|
+
// </Row>
|
|
165
|
+
// );
|
|
166
|
+
// });
|
package/src/components/Label.tsx
CHANGED
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
import React, { memo, ReactNode } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { Spacer } from "./Spacer";
|
|
4
|
-
|
|
5
|
-
/* ----------------------------------------------------------------------------
|
|
6
|
-
* Label
|
|
7
|
-
* ------------------------------------------------------------------------- */
|
|
8
|
-
|
|
9
|
-
const LabelLabel = styled.label<{ $selected?: boolean }>(
|
|
10
|
-
({ theme, $selected }) => ({
|
|
11
|
-
...theme.textStyles.small,
|
|
12
|
-
color: theme.colors.textMuted,
|
|
13
|
-
...($selected && {
|
|
14
|
-
color: theme.colors.text,
|
|
15
|
-
}),
|
|
16
|
-
fontSize: "11px",
|
|
17
|
-
flex: "0 0 auto",
|
|
18
|
-
minWidth: "0",
|
|
19
|
-
letterSpacing: "0.4px",
|
|
20
|
-
whiteSpace: "pre", // prevent breaking - may need to make this an option
|
|
21
|
-
})
|
|
22
|
-
);
|
|
3
|
+
import { textStyles } from "./Text";
|
|
23
4
|
|
|
24
5
|
/* ----------------------------------------------------------------------------
|
|
25
6
|
* Root
|
|
26
7
|
* ------------------------------------------------------------------------- */
|
|
27
8
|
|
|
28
|
-
const LabelContainer = styled.span(({ theme }) => ({
|
|
29
|
-
flex: "0 0 auto",
|
|
30
|
-
position: "relative",
|
|
31
|
-
border: "0",
|
|
32
|
-
outline: "none",
|
|
33
|
-
minWidth: "0",
|
|
34
|
-
textAlign: "left",
|
|
35
|
-
display: "flex",
|
|
36
|
-
flexDirection: "column",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
9
|
interface LabelRootProps {
|
|
41
10
|
label: ReactNode;
|
|
42
11
|
children: ReactNode;
|
|
@@ -44,19 +13,19 @@ interface LabelRootProps {
|
|
|
44
13
|
|
|
45
14
|
function LabelRoot({ label, children }: LabelRootProps) {
|
|
46
15
|
return (
|
|
47
|
-
<
|
|
16
|
+
<span className={`flex-none relative outline-none border-0 min-w-0 text-left flex flex-col items-center`}>
|
|
48
17
|
{children}
|
|
49
18
|
{label && (
|
|
50
19
|
<>
|
|
51
20
|
<Spacer.Vertical size={2} />
|
|
52
|
-
<
|
|
21
|
+
<span className={`${textStyles.small} text-text-muted text-xs flex-none min-w-0 tracking-[0.4px] whitespace-pre`}>{label}</span>
|
|
22
|
+
|
|
53
23
|
</>
|
|
54
24
|
)}
|
|
55
|
-
</
|
|
25
|
+
</span>
|
|
56
26
|
);
|
|
57
27
|
}
|
|
58
28
|
|
|
59
29
|
export namespace Label {
|
|
60
|
-
export const Label = memo(LabelLabel);
|
|
61
30
|
export const Root = memo(LabelRoot);
|
|
62
31
|
}
|
|
@@ -10,27 +10,6 @@ import React, {
|
|
|
10
10
|
useMemo,
|
|
11
11
|
useRef,
|
|
12
12
|
} from 'react';
|
|
13
|
-
import styled from 'styled-components';
|
|
14
|
-
|
|
15
|
-
const Container = styled.div(({ theme }) => ({
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flex: '1',
|
|
18
|
-
flexDirection: 'column',
|
|
19
|
-
position: 'relative',
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
const Tools = styled.div(({ theme }) => ({
|
|
23
|
-
display: 'flex',
|
|
24
|
-
flex: '1',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
const Labels = styled.div(({ theme }) => ({
|
|
29
|
-
height: 'var(--height)',
|
|
30
|
-
position: 'relative',
|
|
31
|
-
overflow: 'hidden',
|
|
32
|
-
userSelect: 'none',
|
|
33
|
-
}));
|
|
34
13
|
|
|
35
14
|
interface ContainerProps {
|
|
36
15
|
children: ReactNode;
|
|
@@ -177,9 +156,9 @@ export const LabeledElementView = memo(function LabeledElementView({
|
|
|
177
156
|
}, [refs, labelElements]);
|
|
178
157
|
|
|
179
158
|
return (
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
</
|
|
159
|
+
<div className="flex flex-1 flex-col relative" ref={containerRef}>
|
|
160
|
+
<div className="flex flex-1 items-center">{children}</div>
|
|
161
|
+
<div className="relative overflow-hidden select-none">{labelElements}</div>
|
|
162
|
+
</div>
|
|
184
163
|
);
|
|
185
|
-
});
|
|
164
|
+
});
|