@noya-app/noya-designsystem 0.0.13 → 0.0.14
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 +9 -9
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +50 -33
- package/dist/index.d.ts +50 -33
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/Button.tsx +84 -78
- package/src/components/GridView.tsx +113 -100
- package/src/components/IconButton.tsx +10 -8
- package/src/components/InputFieldWithCompletions.tsx +3 -0
- package/src/components/InspectorPrimitives.tsx +1 -1
- package/src/components/Text.tsx +57 -56
- package/src/theme/dark.ts +33 -31
- package/src/theme/light.ts +76 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noya-app/noya-designsystem",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"@dnd-kit/core": "3.1.1",
|
|
13
13
|
"@dnd-kit/modifiers": "3.0.0",
|
|
14
14
|
"@dnd-kit/sortable": "4.0.0",
|
|
15
|
-
"@noya-app/noya-colorpicker": "0.0.
|
|
16
|
-
"@noya-app/noya-utils": "0.0.
|
|
17
|
-
"@noya-app/noya-geometry": "0.0.
|
|
18
|
-
"@noya-app/noya-icons": "0.0.
|
|
19
|
-
"@noya-app/noya-keymap": "0.0.
|
|
15
|
+
"@noya-app/noya-colorpicker": "0.0.8",
|
|
16
|
+
"@noya-app/noya-utils": "0.0.11",
|
|
17
|
+
"@noya-app/noya-geometry": "0.0.12",
|
|
18
|
+
"@noya-app/noya-icons": "0.0.5",
|
|
19
|
+
"@noya-app/noya-keymap": "0.0.7",
|
|
20
20
|
"@radix-ui/primitive": "^1.0.0",
|
|
21
21
|
"@radix-ui/react-avatar": "^1.0.1",
|
|
22
22
|
"@radix-ui/react-compose-refs": "^1.0.0",
|
|
@@ -4,21 +4,21 @@ import React, {
|
|
|
4
4
|
forwardRef,
|
|
5
5
|
ReactNode,
|
|
6
6
|
useCallback,
|
|
7
|
-
} from
|
|
8
|
-
import styled from
|
|
9
|
-
import { Tooltip } from
|
|
7
|
+
} from "react";
|
|
8
|
+
import styled from "styled-components";
|
|
9
|
+
import { Tooltip } from "./Tooltip";
|
|
10
10
|
|
|
11
11
|
type ButtonVariant =
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
12
|
+
| "normal"
|
|
13
|
+
| "primary"
|
|
14
|
+
| "secondary"
|
|
15
|
+
| "secondaryBright"
|
|
16
|
+
| "white"
|
|
17
|
+
| "thin"
|
|
18
|
+
| "floating"
|
|
19
|
+
| "none";
|
|
20
20
|
|
|
21
|
-
type ButtonSize =
|
|
21
|
+
type ButtonSize = "normal" | "large";
|
|
22
22
|
|
|
23
23
|
/* ----------------------------------------------------------------------------
|
|
24
24
|
* Element
|
|
@@ -28,98 +28,98 @@ export const ButtonElement = styled.button<{
|
|
|
28
28
|
active: boolean;
|
|
29
29
|
variant: ButtonVariant;
|
|
30
30
|
size: ButtonSize;
|
|
31
|
-
flex?: CSSProperties[
|
|
31
|
+
flex?: CSSProperties["flex"];
|
|
32
32
|
}>(({ theme, active, disabled, variant, size, flex }) => ({
|
|
33
|
-
...(size ===
|
|
34
|
-
textDecoration:
|
|
35
|
-
lineHeight:
|
|
36
|
-
flex: flex ??
|
|
37
|
-
position:
|
|
38
|
-
border:
|
|
39
|
-
outline:
|
|
40
|
-
WebkitAppRegion:
|
|
41
|
-
userSelect:
|
|
42
|
-
minWidth: variant ===
|
|
43
|
-
textAlign:
|
|
44
|
-
borderRadius:
|
|
45
|
-
paddingTop: variant ===
|
|
46
|
-
paddingRight: variant ===
|
|
47
|
-
paddingBottom: variant ===
|
|
48
|
-
paddingLeft: variant ===
|
|
49
|
-
...(size ===
|
|
50
|
-
paddingTop:
|
|
51
|
-
paddingRight:
|
|
52
|
-
paddingBottom:
|
|
53
|
-
paddingLeft:
|
|
33
|
+
...(size === "large" ? theme.textStyles.heading4 : theme.textStyles.small),
|
|
34
|
+
textDecoration: "none",
|
|
35
|
+
lineHeight: "1",
|
|
36
|
+
flex: flex ?? "0 0 auto",
|
|
37
|
+
position: "relative",
|
|
38
|
+
border: "0",
|
|
39
|
+
outline: "none",
|
|
40
|
+
WebkitAppRegion: "no-drag",
|
|
41
|
+
userSelect: "none",
|
|
42
|
+
minWidth: variant === "normal" ? "31px" : undefined,
|
|
43
|
+
textAlign: "left",
|
|
44
|
+
borderRadius: "4px",
|
|
45
|
+
paddingTop: variant === "none" ? "0px" : "4px",
|
|
46
|
+
paddingRight: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
|
|
47
|
+
paddingBottom: variant === "none" ? "0px" : "4px",
|
|
48
|
+
paddingLeft: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
|
|
49
|
+
...(size === "large" && {
|
|
50
|
+
paddingTop: "12px",
|
|
51
|
+
paddingRight: "16px",
|
|
52
|
+
paddingBottom: "12px",
|
|
53
|
+
paddingLeft: "16px",
|
|
54
54
|
}),
|
|
55
55
|
background: active
|
|
56
56
|
? theme.colors.primary
|
|
57
|
-
: variant ===
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
color: active ?
|
|
57
|
+
: variant === "none" || variant === "thin"
|
|
58
|
+
? "transparent"
|
|
59
|
+
: theme.colors.inputBackground,
|
|
60
|
+
color: active ? "white" : theme.colors.text,
|
|
61
61
|
opacity: disabled ? 0.25 : 1,
|
|
62
|
-
|
|
62
|
+
"&:focus": {
|
|
63
63
|
boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`,
|
|
64
64
|
},
|
|
65
|
-
|
|
65
|
+
"&:hover": {
|
|
66
66
|
background: theme.colors.inputBackgroundLight,
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
"&:active": {
|
|
69
69
|
background: theme.colors.activeBackground,
|
|
70
70
|
},
|
|
71
|
-
...(variant ===
|
|
71
|
+
...(variant === "primary" && {
|
|
72
72
|
background: theme.colors.primary,
|
|
73
|
-
color:
|
|
74
|
-
|
|
73
|
+
color: "white",
|
|
74
|
+
"&:hover": {
|
|
75
75
|
background: theme.colors.primaryLight,
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
"&:active": {
|
|
78
78
|
background: theme.colors.primary,
|
|
79
79
|
},
|
|
80
80
|
}),
|
|
81
|
-
...(variant ===
|
|
81
|
+
...(variant === "secondary" && {
|
|
82
82
|
background: theme.colors.secondary,
|
|
83
|
-
color:
|
|
84
|
-
|
|
83
|
+
color: "white",
|
|
84
|
+
"&:hover": {
|
|
85
85
|
background: theme.colors.secondaryLight,
|
|
86
86
|
},
|
|
87
|
-
|
|
87
|
+
"&:active": {
|
|
88
88
|
background: theme.colors.secondary,
|
|
89
89
|
},
|
|
90
90
|
}),
|
|
91
|
-
...(variant ===
|
|
92
|
-
background:
|
|
93
|
-
color:
|
|
94
|
-
|
|
91
|
+
...(variant === "secondaryBright" && {
|
|
92
|
+
background: "#0ab557",
|
|
93
|
+
color: "white",
|
|
94
|
+
"&:hover": {
|
|
95
95
|
opacity: 0.8,
|
|
96
96
|
},
|
|
97
|
-
|
|
97
|
+
"&:active": {
|
|
98
98
|
opacity: 0.9,
|
|
99
99
|
},
|
|
100
100
|
}),
|
|
101
|
-
...(variant ===
|
|
102
|
-
background:
|
|
103
|
-
|
|
101
|
+
...(variant === "white" && {
|
|
102
|
+
background: "white",
|
|
103
|
+
"&:hover": {
|
|
104
104
|
opacity: 0.8,
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
"&:active": {
|
|
107
107
|
opacity: 0.9,
|
|
108
108
|
},
|
|
109
109
|
}),
|
|
110
|
-
...(variant ===
|
|
111
|
-
background:
|
|
110
|
+
...(variant === "floating" && {
|
|
111
|
+
background: "white",
|
|
112
112
|
color: theme.colors.text,
|
|
113
|
-
boxShadow:
|
|
114
|
-
fontSize:
|
|
115
|
-
padding:
|
|
113
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
114
|
+
fontSize: "12px",
|
|
115
|
+
padding: "0px 4px",
|
|
116
116
|
}),
|
|
117
|
-
display:
|
|
118
|
-
alignItems:
|
|
119
|
-
justifyContent:
|
|
117
|
+
display: "flex",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
justifyContent: "center",
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
pointerEvents:
|
|
121
|
+
"& *": {
|
|
122
|
+
pointerEvents: "none",
|
|
123
123
|
},
|
|
124
124
|
}));
|
|
125
125
|
|
|
@@ -130,14 +130,14 @@ export const ButtonElement = styled.button<{
|
|
|
130
130
|
const ButtonContent = styled.span(({ theme }) => ({
|
|
131
131
|
// Line height of small text - maybe figure out better way to ensure
|
|
132
132
|
// icons don't have a smaller height
|
|
133
|
-
minHeight:
|
|
134
|
-
display:
|
|
135
|
-
alignItems:
|
|
136
|
-
flex:
|
|
137
|
-
justifyContent:
|
|
133
|
+
minHeight: "19px",
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
flex: "1",
|
|
137
|
+
justifyContent: "center",
|
|
138
138
|
|
|
139
139
|
// Helps with alignment with the default small text
|
|
140
|
-
lineHeight:
|
|
140
|
+
lineHeight: "15px",
|
|
141
141
|
}));
|
|
142
142
|
|
|
143
143
|
/* ----------------------------------------------------------------------------
|
|
@@ -146,7 +146,9 @@ const ButtonContent = styled.span(({ theme }) => ({
|
|
|
146
146
|
|
|
147
147
|
export interface ButtonRootProps {
|
|
148
148
|
id?: string;
|
|
149
|
-
|
|
149
|
+
className?: string;
|
|
150
|
+
style?: CSSProperties;
|
|
151
|
+
flex?: CSSProperties["flex"];
|
|
150
152
|
tabIndex?: number;
|
|
151
153
|
children: ReactNode;
|
|
152
154
|
active?: boolean;
|
|
@@ -166,24 +168,28 @@ export interface ButtonRootProps {
|
|
|
166
168
|
export const Button = forwardRef(function Button(
|
|
167
169
|
{
|
|
168
170
|
id,
|
|
171
|
+
className,
|
|
172
|
+
style,
|
|
169
173
|
flex,
|
|
170
174
|
tabIndex,
|
|
171
175
|
tooltip,
|
|
172
176
|
active = false,
|
|
173
177
|
disabled = false,
|
|
174
|
-
variant =
|
|
175
|
-
size =
|
|
178
|
+
variant = "normal",
|
|
179
|
+
size = "normal",
|
|
176
180
|
contentStyle,
|
|
177
181
|
onClick,
|
|
178
182
|
children,
|
|
179
183
|
...rest // Propagate any other props so this component works as a Slot
|
|
180
184
|
}: ButtonRootProps,
|
|
181
|
-
forwardedRef: ForwardedRef<HTMLButtonElement
|
|
185
|
+
forwardedRef: ForwardedRef<HTMLButtonElement>
|
|
182
186
|
) {
|
|
183
187
|
const buttonElement = (
|
|
184
188
|
<ButtonElement
|
|
185
189
|
ref={forwardedRef}
|
|
186
190
|
id={id}
|
|
191
|
+
className={className}
|
|
192
|
+
style={style}
|
|
187
193
|
flex={flex}
|
|
188
194
|
tabIndex={tabIndex}
|
|
189
195
|
active={active}
|