@noya-app/noya-designsystem 0.1.9 → 0.1.10
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 +8 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +116 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/Button.tsx +111 -95
- package/src/components/DropdownMenu.tsx +36 -19
- package/src/components/internal/Menu.tsx +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
[34mCLI[39m Target: esnext
|
|
6
6
|
[34mCJS[39m Build start
|
|
7
7
|
[34mESM[39m Build start
|
|
8
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
9
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
10
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
8
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m186.07 KB[39m
|
|
9
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m412.81 KB[39m
|
|
10
|
+
[32mESM[39m ⚡️ Build success in 109ms
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m202.28 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m413.01 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 112ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m54.
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m54.
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 6370ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m54.64 KB[39m
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m54.64 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import React__default, { CSSProperties, ReactNode, ReactElement, ComponentProps,
|
|
|
3
3
|
import * as styled_components from 'styled-components';
|
|
4
4
|
import { CSSObject, CSSProperties as CSSProperties$1 } from 'styled-components';
|
|
5
5
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
|
+
import * as RadixDropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
6
7
|
import { Sketch } from '@noya-app/noya-file-format';
|
|
7
8
|
import * as csstype from 'csstype';
|
|
8
9
|
import { Property } from 'csstype';
|
|
@@ -40,6 +41,7 @@ declare const ButtonElement: styled_components.StyledComponent<"button", styled_
|
|
|
40
41
|
variant: ButtonVariant;
|
|
41
42
|
size: ButtonSize;
|
|
42
43
|
flex?: CSSProperties["flex"];
|
|
44
|
+
defaultBackground?: string | undefined;
|
|
43
45
|
}, never>;
|
|
44
46
|
interface ButtonRootProps {
|
|
45
47
|
id?: string;
|
|
@@ -56,6 +58,7 @@ interface ButtonRootProps {
|
|
|
56
58
|
onClick?: (event: React__default.MouseEvent) => void;
|
|
57
59
|
onPointerDown?: (event: React__default.PointerEvent) => void;
|
|
58
60
|
contentStyle?: CSSProperties;
|
|
61
|
+
defaultBackground?: string;
|
|
59
62
|
as?: React__default.ElementType;
|
|
60
63
|
href?: string;
|
|
61
64
|
target?: string;
|
|
@@ -291,7 +294,7 @@ declare const DraggableMenuButton: <T extends string>(props: {
|
|
|
291
294
|
declare const DropdownMenu: <T extends string>(props: MenuProps<T> & {
|
|
292
295
|
open?: boolean | undefined;
|
|
293
296
|
onCloseAutoFocus?: ((event: React__default.SyntheticEvent<unknown, Event>) => void) | undefined;
|
|
294
|
-
} & React__default.RefAttributes<HTMLElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
297
|
+
} & Pick<RadixDropdownMenu.DropdownMenuContentProps & React__default.RefAttributes<HTMLDivElement>, "side" | "sideOffset" | "align" | "alignOffset" | "collisionPadding"> & React__default.RefAttributes<HTMLElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
295
298
|
|
|
296
299
|
declare const SUPPORTED_IMAGE_UPLOAD_TYPES: ("image/png" | "image/jpeg" | "image/webp" | "image/svg+xml" | "application/pdf")[];
|
|
297
300
|
declare const SUPPORTED_CANVAS_UPLOAD_TYPES: ("" | "image/png" | "image/jpeg" | "image/webp" | "image/svg+xml" | "application/pdf")[];
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import React__default, { CSSProperties, ReactNode, ReactElement, ComponentProps,
|
|
|
3
3
|
import * as styled_components from 'styled-components';
|
|
4
4
|
import { CSSObject, CSSProperties as CSSProperties$1 } from 'styled-components';
|
|
5
5
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
|
+
import * as RadixDropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
6
7
|
import { Sketch } from '@noya-app/noya-file-format';
|
|
7
8
|
import * as csstype from 'csstype';
|
|
8
9
|
import { Property } from 'csstype';
|
|
@@ -40,6 +41,7 @@ declare const ButtonElement: styled_components.StyledComponent<"button", styled_
|
|
|
40
41
|
variant: ButtonVariant;
|
|
41
42
|
size: ButtonSize;
|
|
42
43
|
flex?: CSSProperties["flex"];
|
|
44
|
+
defaultBackground?: string | undefined;
|
|
43
45
|
}, never>;
|
|
44
46
|
interface ButtonRootProps {
|
|
45
47
|
id?: string;
|
|
@@ -56,6 +58,7 @@ interface ButtonRootProps {
|
|
|
56
58
|
onClick?: (event: React__default.MouseEvent) => void;
|
|
57
59
|
onPointerDown?: (event: React__default.PointerEvent) => void;
|
|
58
60
|
contentStyle?: CSSProperties;
|
|
61
|
+
defaultBackground?: string;
|
|
59
62
|
as?: React__default.ElementType;
|
|
60
63
|
href?: string;
|
|
61
64
|
target?: string;
|
|
@@ -291,7 +294,7 @@ declare const DraggableMenuButton: <T extends string>(props: {
|
|
|
291
294
|
declare const DropdownMenu: <T extends string>(props: MenuProps<T> & {
|
|
292
295
|
open?: boolean | undefined;
|
|
293
296
|
onCloseAutoFocus?: ((event: React__default.SyntheticEvent<unknown, Event>) => void) | undefined;
|
|
294
|
-
} & React__default.RefAttributes<HTMLElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
297
|
+
} & Pick<RadixDropdownMenu.DropdownMenuContentProps & React__default.RefAttributes<HTMLDivElement>, "side" | "sideOffset" | "align" | "alignOffset" | "collisionPadding"> & React__default.RefAttributes<HTMLElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
295
298
|
|
|
296
299
|
declare const SUPPORTED_IMAGE_UPLOAD_TYPES: ("image/png" | "image/jpeg" | "image/webp" | "image/svg+xml" | "application/pdf")[];
|
|
297
300
|
declare const SUPPORTED_CANVAS_UPLOAD_TYPES: ("" | "image/png" | "image/jpeg" | "image/webp" | "image/svg+xml" | "application/pdf")[];
|
package/dist/index.js
CHANGED
|
@@ -230,94 +230,104 @@ var Tooltip = (0, import_react3.memo)(function Tooltip2({ children, content }) {
|
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
// src/components/Button.tsx
|
|
233
|
-
var ButtonElement = import_styled_components4.default.button(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
},
|
|
265
|
-
"&:active": {
|
|
266
|
-
background: variant === "primaryGradient" ? theme.colors.primary : theme.colors.activeBackground
|
|
267
|
-
},
|
|
268
|
-
...variant === "primary" && {
|
|
269
|
-
background: theme.colors.primary,
|
|
270
|
-
color: "white",
|
|
271
|
-
"&:hover": {
|
|
272
|
-
background: theme.colors.primaryLight
|
|
233
|
+
var ButtonElement = import_styled_components4.default.button(
|
|
234
|
+
({
|
|
235
|
+
theme,
|
|
236
|
+
active,
|
|
237
|
+
disabled,
|
|
238
|
+
variant,
|
|
239
|
+
size: size2,
|
|
240
|
+
flex,
|
|
241
|
+
defaultBackground = theme.colors.inputBackground
|
|
242
|
+
}) => ({
|
|
243
|
+
...size2 === "large" ? theme.textStyles.heading4 : theme.textStyles.small,
|
|
244
|
+
textDecoration: "none",
|
|
245
|
+
lineHeight: "1",
|
|
246
|
+
flex: flex ?? "0 0 auto",
|
|
247
|
+
position: "relative",
|
|
248
|
+
border: "0",
|
|
249
|
+
outline: "none",
|
|
250
|
+
WebkitAppRegion: "no-drag",
|
|
251
|
+
userSelect: "none",
|
|
252
|
+
minWidth: variant === "normal" ? "31px" : void 0,
|
|
253
|
+
textAlign: "left",
|
|
254
|
+
borderRadius: "4px",
|
|
255
|
+
paddingTop: variant === "none" ? "0px" : "4px",
|
|
256
|
+
paddingRight: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
|
|
257
|
+
paddingBottom: variant === "none" ? "0px" : "4px",
|
|
258
|
+
paddingLeft: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
|
|
259
|
+
...size2 === "large" && {
|
|
260
|
+
paddingTop: "12px",
|
|
261
|
+
paddingRight: "16px",
|
|
262
|
+
paddingBottom: "12px",
|
|
263
|
+
paddingLeft: "16px"
|
|
273
264
|
},
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
background: theme.colors.secondary,
|
|
280
|
-
color: "white",
|
|
281
|
-
"&:hover": {
|
|
282
|
-
background: theme.colors.secondaryLight
|
|
265
|
+
background: active ? theme.colors.primary : variant === "primaryGradient" ? `linear-gradient(90deg, ${theme.colors.primary}, ${theme.colors.primaryLight})` : variant === "none" || variant === "thin" ? "transparent" : defaultBackground,
|
|
266
|
+
color: active ? "white" : theme.colors.text,
|
|
267
|
+
opacity: disabled ? 0.25 : 1,
|
|
268
|
+
"&:focus": {
|
|
269
|
+
boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`
|
|
283
270
|
},
|
|
284
|
-
"&:active": {
|
|
285
|
-
background: theme.colors.secondary
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
...variant === "secondaryBright" && {
|
|
289
|
-
background: "#0ab557",
|
|
290
|
-
color: "white",
|
|
291
271
|
"&:hover": {
|
|
292
|
-
|
|
272
|
+
background: variant === "primaryGradient" || active ? theme.colors.primaryLight : theme.colors.inputBackgroundLight
|
|
293
273
|
},
|
|
294
274
|
"&:active": {
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
...variant === "white" && {
|
|
299
|
-
background: "white",
|
|
300
|
-
"&:hover": {
|
|
301
|
-
opacity: 0.8
|
|
275
|
+
background: variant === "primaryGradient" || active ? theme.colors.primary : theme.colors.activeBackground
|
|
302
276
|
},
|
|
303
|
-
"
|
|
304
|
-
|
|
277
|
+
...variant === "primary" && {
|
|
278
|
+
background: theme.colors.primary,
|
|
279
|
+
color: "white",
|
|
280
|
+
"&:hover": {
|
|
281
|
+
background: theme.colors.primaryLight
|
|
282
|
+
},
|
|
283
|
+
"&:active": {
|
|
284
|
+
background: theme.colors.primary
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
...variant === "secondary" && {
|
|
288
|
+
background: theme.colors.secondary,
|
|
289
|
+
color: "white",
|
|
290
|
+
"&:hover": {
|
|
291
|
+
background: theme.colors.secondaryLight
|
|
292
|
+
},
|
|
293
|
+
"&:active": {
|
|
294
|
+
background: theme.colors.secondary
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
...variant === "secondaryBright" && {
|
|
298
|
+
background: "#0ab557",
|
|
299
|
+
color: "white",
|
|
300
|
+
"&:hover": {
|
|
301
|
+
opacity: 0.8
|
|
302
|
+
},
|
|
303
|
+
"&:active": {
|
|
304
|
+
opacity: 0.9
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
...variant === "white" && {
|
|
308
|
+
background: "white",
|
|
309
|
+
"&:hover": {
|
|
310
|
+
opacity: 0.8
|
|
311
|
+
},
|
|
312
|
+
"&:active": {
|
|
313
|
+
opacity: 0.9
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
...variant === "floating" && {
|
|
317
|
+
background: "white",
|
|
318
|
+
color: theme.colors.text,
|
|
319
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
320
|
+
fontSize: "12px",
|
|
321
|
+
padding: "0px 4px"
|
|
322
|
+
},
|
|
323
|
+
display: "flex",
|
|
324
|
+
alignItems: "center",
|
|
325
|
+
justifyContent: "center",
|
|
326
|
+
"& *": {
|
|
327
|
+
pointerEvents: "none"
|
|
305
328
|
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
background: "white",
|
|
309
|
-
color: theme.colors.text,
|
|
310
|
-
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
311
|
-
fontSize: "12px",
|
|
312
|
-
padding: "0px 4px"
|
|
313
|
-
},
|
|
314
|
-
display: "flex",
|
|
315
|
-
alignItems: "center",
|
|
316
|
-
justifyContent: "center",
|
|
317
|
-
"& *": {
|
|
318
|
-
pointerEvents: "none"
|
|
319
|
-
}
|
|
320
|
-
}));
|
|
329
|
+
})
|
|
330
|
+
);
|
|
321
331
|
var ButtonContent = import_styled_components4.default.span(({ theme }) => ({
|
|
322
332
|
// Line height of small text - maybe figure out better way to ensure
|
|
323
333
|
// icons don't have a smaller height
|
|
@@ -341,6 +351,7 @@ var Button = (0, import_react4.forwardRef)(function Button2({
|
|
|
341
351
|
variant = "normal",
|
|
342
352
|
size: size2 = "normal",
|
|
343
353
|
contentStyle,
|
|
354
|
+
defaultBackground,
|
|
344
355
|
onClick,
|
|
345
356
|
children,
|
|
346
357
|
...rest
|
|
@@ -359,6 +370,7 @@ var Button = (0, import_react4.forwardRef)(function Button2({
|
|
|
359
370
|
disabled,
|
|
360
371
|
variant,
|
|
361
372
|
size: size2,
|
|
373
|
+
defaultBackground,
|
|
362
374
|
onClick,
|
|
363
375
|
onDoubleClick: (0, import_react4.useCallback)((event) => {
|
|
364
376
|
event.stopPropagation();
|
|
@@ -946,7 +958,7 @@ var styles = {
|
|
|
946
958
|
separatorStyle: ({ theme }) => ({
|
|
947
959
|
height: "1px",
|
|
948
960
|
backgroundColor: theme.colors.divider,
|
|
949
|
-
margin: "4px
|
|
961
|
+
margin: "4px -4px"
|
|
950
962
|
}),
|
|
951
963
|
itemStyle: ({
|
|
952
964
|
theme,
|
|
@@ -959,7 +971,7 @@ var styles = {
|
|
|
959
971
|
userSelect: "none",
|
|
960
972
|
cursor: "pointer",
|
|
961
973
|
borderRadius: "3px",
|
|
962
|
-
padding: "
|
|
974
|
+
padding: "6px 8px",
|
|
963
975
|
...disabled && {
|
|
964
976
|
color: theme.colors.textDisabled
|
|
965
977
|
},
|
|
@@ -1090,7 +1102,16 @@ var DropdownMenuItem = (0, import_react26.memo)(function ContextMenuItem({
|
|
|
1090
1102
|
}
|
|
1091
1103
|
const element = /* @__PURE__ */ import_react26.default.createElement(ItemElement, { disabled, onSelect: handleSelectItem }, indented && /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }), icon && /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, icon, /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, { size: 8 })), children, shortcut && /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, null), /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, { size: 24 }), /* @__PURE__ */ import_react26.default.createElement(KeyboardShortcut, { shortcut })), items && items.length > 0 && /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, null), /* @__PURE__ */ import_react26.default.createElement(Spacer.Horizontal, { size: 16 }), /* @__PURE__ */ import_react26.default.createElement(import_noya_icons.ChevronRightIcon, null)));
|
|
1092
1104
|
if (items && items.length > 0) {
|
|
1093
|
-
return /* @__PURE__ */ import_react26.default.createElement(
|
|
1105
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
1106
|
+
DropdownMenuRoot,
|
|
1107
|
+
{
|
|
1108
|
+
isNested: true,
|
|
1109
|
+
items,
|
|
1110
|
+
onSelect,
|
|
1111
|
+
alignOffset: -5
|
|
1112
|
+
},
|
|
1113
|
+
element
|
|
1114
|
+
);
|
|
1094
1115
|
} else {
|
|
1095
1116
|
return element;
|
|
1096
1117
|
}
|
|
@@ -1105,7 +1126,12 @@ var DropdownMenuRoot = (0, import_react26.forwardRef)(function DropdownMenuRoot2
|
|
|
1105
1126
|
shouldBindKeyboardShortcuts,
|
|
1106
1127
|
onOpenChange,
|
|
1107
1128
|
open,
|
|
1108
|
-
onCloseAutoFocus
|
|
1129
|
+
onCloseAutoFocus,
|
|
1130
|
+
side,
|
|
1131
|
+
sideOffset = 4,
|
|
1132
|
+
align,
|
|
1133
|
+
alignOffset,
|
|
1134
|
+
collisionPadding = 8
|
|
1109
1135
|
}, forwardedRef) {
|
|
1110
1136
|
const hasCheckedItem = items.some(
|
|
1111
1137
|
(item) => item !== SEPARATOR_ITEM && item.checked
|
|
@@ -1122,9 +1148,12 @@ var DropdownMenuRoot = (0, import_react26.forwardRef)(function DropdownMenuRoot2
|
|
|
1122
1148
|
return /* @__PURE__ */ import_react26.default.createElement(RootComponent, { onOpenChange, open }, /* @__PURE__ */ import_react26.default.createElement(TriggerComponent, { ref: forwardedRef, asChild: true }, children), /* @__PURE__ */ import_react26.default.createElement(RadixDropdownMenu.Portal, null, /* @__PURE__ */ import_react26.default.createElement(
|
|
1123
1149
|
ContentComponent,
|
|
1124
1150
|
{
|
|
1125
|
-
|
|
1151
|
+
side,
|
|
1152
|
+
sideOffset,
|
|
1153
|
+
align,
|
|
1154
|
+
alignOffset,
|
|
1126
1155
|
style: contentStyle,
|
|
1127
|
-
collisionPadding
|
|
1156
|
+
collisionPadding,
|
|
1128
1157
|
...{ onCloseAutoFocus }
|
|
1129
1158
|
},
|
|
1130
1159
|
items.map(
|