@noya-app/noya-designsystem 0.1.6 → 0.1.7
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 +10 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/DraggableMenuButton.tsx +21 -15
- package/src/components/InspectorPrimitives.tsx +1 -0
- package/src/components/ListView.tsx +10 -5
- package/src/components/Select.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noya-app/noya-designsystem",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@dnd-kit/core": "3.1.1",
|
|
14
14
|
"@dnd-kit/modifiers": "3.0.0",
|
|
15
15
|
"@dnd-kit/sortable": "4.0.0",
|
|
16
|
-
"@noya-app/noya-colorpicker": "0.1.
|
|
16
|
+
"@noya-app/noya-colorpicker": "0.1.5",
|
|
17
17
|
"@noya-app/noya-utils": "0.1.0",
|
|
18
|
-
"@noya-app/noya-geometry": "0.1.
|
|
19
|
-
"@noya-app/noya-icons": "0.1.
|
|
18
|
+
"@noya-app/noya-geometry": "0.1.2",
|
|
19
|
+
"@noya-app/noya-icons": "0.1.2",
|
|
20
20
|
"@noya-app/noya-keymap": "0.1.0",
|
|
21
21
|
"@radix-ui/primitive": "^1.0.0",
|
|
22
22
|
"@radix-ui/react-avatar": "^1.0.1",
|
|
@@ -35,8 +35,8 @@ export const DraggableMenuButton = memo(function DraggableMenuButton<
|
|
|
35
35
|
onSelect,
|
|
36
36
|
isVisible = true,
|
|
37
37
|
}: {
|
|
38
|
-
items
|
|
39
|
-
onSelect
|
|
38
|
+
items?: MenuItem<T>[];
|
|
39
|
+
onSelect?: (value: T) => void;
|
|
40
40
|
isVisible?: boolean;
|
|
41
41
|
}) {
|
|
42
42
|
const color = useDesignSystemTheme().colors.icon;
|
|
@@ -98,19 +98,25 @@ export const DraggableMenuButton = memo(function DraggableMenuButton<
|
|
|
98
98
|
event.preventDefault();
|
|
99
99
|
}}
|
|
100
100
|
>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
{items && onSelect ? (
|
|
102
|
+
<DropdownMenu
|
|
103
|
+
open={open}
|
|
104
|
+
onOpenChange={handleOpenChange}
|
|
105
|
+
items={items}
|
|
106
|
+
onSelect={onSelect}
|
|
107
|
+
shouldBindKeyboardShortcuts={false}
|
|
108
|
+
>
|
|
109
|
+
<TriggerElement>
|
|
110
|
+
<DragHandleDots2Icon
|
|
111
|
+
color={isVisible || open ? color : "transparent"}
|
|
112
|
+
/>
|
|
113
|
+
</TriggerElement>
|
|
114
|
+
</DropdownMenu>
|
|
115
|
+
) : (
|
|
116
|
+
<DragHandleDots2Icon
|
|
117
|
+
color={isVisible || open ? color : "transparent"}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
114
120
|
</DotButtonElement>
|
|
115
121
|
);
|
|
116
122
|
});
|
|
@@ -332,6 +332,7 @@ interface ListViewRowProps<MenuItemType extends string = string> {
|
|
|
332
332
|
onContextMenu?: () => void;
|
|
333
333
|
onMenuOpenChange?: (isOpen: boolean) => void;
|
|
334
334
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
335
|
+
style?: CSSProperties;
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
const ListViewRow = forwardRef(function ListViewRow<
|
|
@@ -357,6 +358,7 @@ const ListViewRow = forwardRef(function ListViewRow<
|
|
|
357
358
|
onSelectMenuItem,
|
|
358
359
|
onMenuOpenChange,
|
|
359
360
|
onKeyDown,
|
|
361
|
+
style,
|
|
360
362
|
}: ListViewRowProps<MenuItemType>,
|
|
361
363
|
forwardedRef: ForwardedRef<HTMLElement>
|
|
362
364
|
) {
|
|
@@ -402,15 +404,16 @@ const ListViewRow = forwardRef(function ListViewRow<
|
|
|
402
404
|
[onDoubleClick]
|
|
403
405
|
);
|
|
404
406
|
|
|
405
|
-
const
|
|
407
|
+
const mergedStyle = useMemo(() => {
|
|
406
408
|
return isDragging
|
|
407
409
|
? {
|
|
408
410
|
// TODO: Where do these offsets actually come from?
|
|
409
411
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
410
412
|
width: `calc(100% + 48px)`,
|
|
413
|
+
...style,
|
|
411
414
|
}
|
|
412
|
-
:
|
|
413
|
-
}, [isDragging]);
|
|
415
|
+
: style;
|
|
416
|
+
}, [isDragging, style]);
|
|
414
417
|
|
|
415
418
|
const renderContent = (
|
|
416
419
|
{
|
|
@@ -443,7 +446,7 @@ const ListViewRow = forwardRef(function ListViewRow<
|
|
|
443
446
|
aria-selected={selected}
|
|
444
447
|
divider={!isDragging && divider}
|
|
445
448
|
onKeyDown={onKeyDown}
|
|
446
|
-
style={
|
|
449
|
+
style={mergedStyle}
|
|
447
450
|
{...renderProps}
|
|
448
451
|
{...mergeEventHandlers(
|
|
449
452
|
{ onPointerDown: renderProps.onPointerDown },
|
|
@@ -655,7 +658,9 @@ type RenderProps<T> = {
|
|
|
655
658
|
renderItem: (item: T, index: number, info: ListViewItemInfo) => ReactNode;
|
|
656
659
|
keyExtractor: (item: T, index: number) => string;
|
|
657
660
|
/**
|
|
658
|
-
* Each item must have an `id` in order to be sortable
|
|
661
|
+
* Each item must have an `id` in order to be sortable.
|
|
662
|
+
*
|
|
663
|
+
* Additionally, the key extracted with `keyExtractor` must match the ListItem.Row `id`.
|
|
659
664
|
*/
|
|
660
665
|
sortable?: boolean;
|
|
661
666
|
virtualized?: Size;
|