@noya-app/noya-designsystem 0.1.56 → 0.1.58
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 +10 -10
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +61 -46
- package/dist/index.d.ts +61 -46
- package/dist/index.js +1150 -1056
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +356 -265
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/validateDropIndicator.test.ts +64 -31
- package/src/components/Collection.tsx +3 -0
- package/src/components/List.tsx +4 -0
- package/src/components/ListView.tsx +7 -0
- package/src/components/sorting/DragRegistration.tsx +3 -6
- package/src/components/sorting/SharedDragProvider.tsx +258 -135
- package/src/components/sorting/Sortable.tsx +54 -108
- package/src/components/sorting/createSharedDrag.tsx +10 -15
- package/src/components/sorting/sorting.ts +48 -44
- package/src/utils/moveTreeItem.ts +6 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
[34mCLI[39m Target: esnext
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
11
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mCJS[39m [1mdist/index.js [22m[32m400.75 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m786.02 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 101ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m378.26 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m786.18 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 102ms
|
|
16
16
|
DTS Build start
|
|
17
17
|
Browserslist: caniuse-lite is outdated. Please run:
|
|
18
18
|
npx update-browserslist-db@latest
|
|
@@ -20,8 +20,8 @@ Browserslist: caniuse-lite is outdated. Please run:
|
|
|
20
20
|
|
|
21
21
|
Rebuilding...
|
|
22
22
|
|
|
23
|
-
Done in
|
|
23
|
+
Done in 361ms.
|
|
24
24
|
|
|
25
|
-
DTS ⚡️ Build success in
|
|
26
|
-
DTS dist/index.d.ts 96.
|
|
27
|
-
DTS dist/index.d.mts 96.
|
|
25
|
+
DTS ⚡️ Build success in 5824ms
|
|
26
|
+
DTS dist/index.d.ts 96.96 KB
|
|
27
|
+
DTS dist/index.d.mts 96.96 KB
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @noya-app/noya-designsystem
|
|
2
2
|
|
|
3
|
+
## 0.1.58
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b403ae4: Drag improvements
|
|
8
|
+
- Updated dependencies [7bbd2a6]
|
|
9
|
+
- @noya-app/noya-colorpicker@0.1.22
|
|
10
|
+
|
|
11
|
+
## 0.1.57
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 9e59d48: Drag improvements
|
|
16
|
+
|
|
3
17
|
## 0.1.56
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import * as Icons from '@noya-app/noya-icons';
|
|
|
5
5
|
export { Icons };
|
|
6
6
|
import tailwindConfig from '@noya-app/noya-tailwind-config';
|
|
7
7
|
import * as _noya_app_noya_geometry from '@noya-app/noya-geometry';
|
|
8
|
-
import {
|
|
8
|
+
import { Point as Point$1, Size, Rect } from '@noya-app/noya-geometry';
|
|
9
9
|
import { UniqueIdentifier, Active, Over, CollisionDetection } from '@dnd-kit/core';
|
|
10
10
|
import { Property } from 'csstype';
|
|
11
11
|
import * as _noya_app_noya_designsystem from '@noya-app/noya-designsystem';
|
|
@@ -709,23 +709,30 @@ interface ChipProps {
|
|
|
709
709
|
declare const Chip: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<ChipProps & React__default.RefAttributes<HTMLSpanElement>>>;
|
|
710
710
|
|
|
711
711
|
type RelativeDropPosition = "above" | "below" | "inside";
|
|
712
|
-
type
|
|
713
|
-
|
|
714
|
-
|
|
712
|
+
type MoveDragItemParameters = {
|
|
713
|
+
sourceIndex: number;
|
|
714
|
+
sourceListId: string;
|
|
715
|
+
targetIndex: number;
|
|
716
|
+
targetListId: string;
|
|
717
|
+
position: RelativeDropPosition;
|
|
718
|
+
};
|
|
719
|
+
type DropValidator = (parameters: MoveDragItemParameters) => boolean;
|
|
720
|
+
type AcceptsDrop = (parameters: MoveDragItemParameters) => boolean;
|
|
721
|
+
type MoveDragItemHandler = (parameters: MoveDragItemParameters) => void;
|
|
715
722
|
type AcceptsFromList = ({ sourceListId, targetListId, }: {
|
|
716
723
|
sourceListId: string;
|
|
717
724
|
targetListId: string;
|
|
718
725
|
}) => boolean;
|
|
719
726
|
interface DragItem {
|
|
720
|
-
|
|
721
|
-
listId: string;
|
|
722
|
-
index: number;
|
|
723
|
-
}
|
|
724
|
-
interface DropTarget {
|
|
725
|
-
id: UniqueIdentifier;
|
|
727
|
+
itemId: UniqueIdentifier;
|
|
726
728
|
listId: string;
|
|
727
729
|
index: number;
|
|
728
730
|
}
|
|
731
|
+
type DragState = {
|
|
732
|
+
source: DragItem | null;
|
|
733
|
+
target: DragItem | null;
|
|
734
|
+
indicator: RelativeDropPosition | null;
|
|
735
|
+
};
|
|
729
736
|
declare const normalizeListTargetIndex: (index: number, position: "above" | "below") => number;
|
|
730
737
|
declare const defaultAcceptsDrop: DropValidator;
|
|
731
738
|
type SortableItemContextProps = {
|
|
@@ -753,6 +760,38 @@ type ValidateDropIndicatorParams = {
|
|
|
753
760
|
targetListId: string;
|
|
754
761
|
};
|
|
755
762
|
declare function validateDropIndicator({ acceptsDrop, keys, activeId, overId, offsetStart, elementStart, elementSize, sourceListId, targetListId, }: ValidateDropIndicatorParams): RelativeDropPosition | undefined;
|
|
763
|
+
declare const dragItemKeySeparator = "-~-";
|
|
764
|
+
declare function createDragItemKey(listId: string, itemId: UniqueIdentifier): string;
|
|
765
|
+
declare function parseDragItemKey(key: string): {
|
|
766
|
+
listId: string;
|
|
767
|
+
itemId: UniqueIdentifier;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
type GetDropIndicatorParameters = {
|
|
771
|
+
absolutePosition: Point$1;
|
|
772
|
+
active: Active;
|
|
773
|
+
over: Over;
|
|
774
|
+
sourceListId: string;
|
|
775
|
+
targetListId: string;
|
|
776
|
+
};
|
|
777
|
+
interface RegisteredList {
|
|
778
|
+
id: string;
|
|
779
|
+
keys: UniqueIdentifier[];
|
|
780
|
+
onMoveItem: MoveDragItemHandler;
|
|
781
|
+
renderOverlay?: (id: UniqueIdentifier) => React__default.ReactNode;
|
|
782
|
+
acceptsFromList: AcceptsFromList;
|
|
783
|
+
acceptsDrop: AcceptsDrop;
|
|
784
|
+
getDropIndicator: (parameters: GetDropIndicatorParameters) => RelativeDropPosition | undefined;
|
|
785
|
+
}
|
|
786
|
+
interface DragRegistrationContextType {
|
|
787
|
+
registerList: (list: RegisteredList) => void;
|
|
788
|
+
unregisterList: (listId: string) => void;
|
|
789
|
+
}
|
|
790
|
+
type ActiveDragContextType = DragState;
|
|
791
|
+
type SharedDragProps = {
|
|
792
|
+
dragRegistrationContext: React__default.Context<DragRegistrationContextType | null>;
|
|
793
|
+
activeDragContext: React__default.Context<ActiveDragContextType | null>;
|
|
794
|
+
};
|
|
756
795
|
|
|
757
796
|
type ListRowMarginType = "none" | "top" | "bottom" | "vertical";
|
|
758
797
|
type ListRowPosition = "only" | "first" | "middle" | "last";
|
|
@@ -869,6 +908,8 @@ type ListViewRootProps = {
|
|
|
869
908
|
onDrop?: React__default.DragEventHandler<HTMLDivElement>;
|
|
870
909
|
renderEmptyState?: () => ReactNode;
|
|
871
910
|
getDropTargetParentIndex?: SortableItemContextProps["getDropTargetParentIndex"];
|
|
911
|
+
sharedDragProps?: SharedDragProps;
|
|
912
|
+
sortableId?: string;
|
|
872
913
|
};
|
|
873
914
|
declare namespace ListView {
|
|
874
915
|
const RowTitle: React__default.MemoExoticComponent<({ className, children, ...props }: {
|
|
@@ -968,6 +1009,8 @@ interface CollectionProps<T, M extends string = string> {
|
|
|
968
1009
|
/** @default false */
|
|
969
1010
|
sortable?: boolean;
|
|
970
1011
|
dragIndicatorStyle?: ListViewRowProps<M>["dragIndicatorStyle"];
|
|
1012
|
+
sharedDragProps?: SharedDragProps;
|
|
1013
|
+
sortableId?: string;
|
|
971
1014
|
}
|
|
972
1015
|
declare const Collection: <T, M extends string = string>(props: CollectionProps<T, M> & React__default.RefAttributes<CollectionRef>) => React__default.ReactElement | null;
|
|
973
1016
|
type CollectionItemSize = "xxs" | "xs" | "small" | "medium" | "large" | "xl";
|
|
@@ -1784,42 +1827,14 @@ interface Props$4 {
|
|
|
1784
1827
|
}
|
|
1785
1828
|
declare const Slider: React__default.NamedExoticComponent<Props$4>;
|
|
1786
1829
|
|
|
1787
|
-
type GetDropIndicatorParameters = {
|
|
1788
|
-
absolutePosition: Point$1;
|
|
1789
|
-
active: Active;
|
|
1790
|
-
over: Over;
|
|
1791
|
-
sourceListId: string;
|
|
1792
|
-
targetListId: string;
|
|
1793
|
-
};
|
|
1794
|
-
interface RegisteredList {
|
|
1795
|
-
id: string;
|
|
1796
|
-
keys: UniqueIdentifier[];
|
|
1797
|
-
onMoveItem: MoveDragItemHandler;
|
|
1798
|
-
renderOverlay?: (id: UniqueIdentifier) => React__default.ReactNode;
|
|
1799
|
-
acceptsFromList: AcceptsFromList;
|
|
1800
|
-
acceptsDrop: AcceptsDrop;
|
|
1801
|
-
getDropIndicator: (parameters: GetDropIndicatorParameters) => RelativeDropPosition | undefined;
|
|
1802
|
-
}
|
|
1803
|
-
interface DragRegistrationContextType {
|
|
1804
|
-
registerList: (list: RegisteredList) => void;
|
|
1805
|
-
unregisterList: (listId: string) => void;
|
|
1806
|
-
}
|
|
1807
|
-
type ActiveDragContextType = {
|
|
1808
|
-
activeItem: DragItem | null;
|
|
1809
|
-
delta: Point$1;
|
|
1810
|
-
};
|
|
1811
|
-
type SharedDragProviderContexts = {
|
|
1812
|
-
dragRegistrationContext: React__default.Context<DragRegistrationContextType | null>;
|
|
1813
|
-
activeDragContext: React__default.Context<ActiveDragContextType | null>;
|
|
1814
|
-
};
|
|
1815
|
-
|
|
1816
1830
|
type SharedDragProviderProps = {
|
|
1817
1831
|
children: React$1.ReactNode;
|
|
1818
|
-
|
|
1832
|
+
onMoveItem?: MoveDragItemHandler;
|
|
1833
|
+
sharedDragProps?: SharedDragProps;
|
|
1819
1834
|
};
|
|
1820
|
-
declare function SharedDragProvider({ children,
|
|
1835
|
+
declare function SharedDragProvider({ children, onMoveItem, sharedDragProps, }: SharedDragProviderProps): React$1.JSX.Element;
|
|
1821
1836
|
declare function withDragProvider<T extends object>(Component: React$1.ComponentType<T>): (props: T) => React$1.JSX.Element;
|
|
1822
|
-
declare const getItemFirstCollisionDetection: (
|
|
1837
|
+
declare const getItemFirstCollisionDetection: (registeredLists: Map<string, RegisteredList>) => CollisionDetection;
|
|
1823
1838
|
|
|
1824
1839
|
type UseSortableReturnType = ReturnType<typeof useSortable>;
|
|
1825
1840
|
type ItemChildrenProps<T> = {
|
|
@@ -1837,7 +1852,7 @@ interface RootProps {
|
|
|
1837
1852
|
acceptsFromList?: AcceptsFromList;
|
|
1838
1853
|
acceptsDrop?: DropValidator;
|
|
1839
1854
|
getDropTargetParentIndex?: (index: number) => number | undefined;
|
|
1840
|
-
|
|
1855
|
+
sharedDragProps?: SharedDragProps;
|
|
1841
1856
|
containerRef?: React$1.RefObject<HTMLElement>;
|
|
1842
1857
|
}
|
|
1843
1858
|
declare function SortableItem<TElement extends HTMLElement>({ id, disabled, children, }: {
|
|
@@ -1845,7 +1860,7 @@ declare function SortableItem<TElement extends HTMLElement>({ id, disabled, chil
|
|
|
1845
1860
|
disabled?: boolean;
|
|
1846
1861
|
children: (props: ItemChildrenProps<TElement>) => React$1.ReactNode;
|
|
1847
1862
|
}): React$1.ReactNode;
|
|
1848
|
-
declare function SortableRoot_({ id: idProp, keys, onMoveItem, renderOverlay, acceptsFromList, acceptsDrop, axis, children, getDropTargetParentIndex,
|
|
1863
|
+
declare function SortableRoot_({ id: idProp, keys: keysProp, onMoveItem, renderOverlay, acceptsFromList, acceptsDrop, axis, children, getDropTargetParentIndex, sharedDragProps, containerRef, }: RootProps): React$1.JSX.Element;
|
|
1849
1864
|
interface SortableProps<TItem, TElement extends HTMLElement> extends Omit<RootProps, "children" | "keys" | "renderOverlay"> {
|
|
1850
1865
|
items: TItem[];
|
|
1851
1866
|
keyExtractor: (item: TItem) => UniqueIdentifier;
|
|
@@ -1861,8 +1876,8 @@ declare const Sortable: (<TItem, TElement extends HTMLElement>({ items, keyExtra
|
|
|
1861
1876
|
|
|
1862
1877
|
declare function createSharedDrag(): {
|
|
1863
1878
|
Provider: typeof SharedDragProvider;
|
|
1864
|
-
props: SharedDragProviderContexts;
|
|
1865
1879
|
Sortable: <TItem, TElement extends HTMLElement>(props: SortableProps<TItem, TElement>) => React$1.ReactNode;
|
|
1880
|
+
props: SharedDragProps;
|
|
1866
1881
|
};
|
|
1867
1882
|
|
|
1868
1883
|
interface Props$3 {
|
|
@@ -2422,4 +2437,4 @@ interface ToolbarProps<T extends string = string> {
|
|
|
2422
2437
|
}
|
|
2423
2438
|
declare function Toolbar<T extends string = string>({ children, logo, leftMenuItems, rightMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts, }: ToolbarProps<T>): React__default.JSX.Element;
|
|
2424
2439
|
|
|
2425
|
-
export { AIAssistantInput, AIAssistantLayout, AIAssistantLoadingIndicator, type AcceptsDrop, type AcceptsDropOptions, type AcceptsFromList, ActionMenu, ActivityIndicator, AnimatePresence, type AnimatePresenceProps, Avatar, type AvatarProps, AvatarStack, Banner, type BannerProps, type BaseComboboxProps, BaseToolbar, type BaseToolbarProps, Body, BreadcrumbSlash, BreadcrumbText, Button, type ButtonRootProps, CHECKBOX_INDENT_WIDTH, CHECKBOX_RIGHT_INSET, CHECKBOX_WIDTH, CONTENT_AREA_ID, Checkbox$1 as Checkbox, Chip, type ChipProps, Collection, type CollectionItemSize, type CollectionProps, type CollectionRef, type CollectionRenderActionProps, type CollectionThumbnailProps, type CollectionThumbnailSize, type CollectionViewType, ColorSwatch, ColorSwatchControl, type ColorSwatchSize, Combobox, ComboboxMenu, type ComboboxProps, type ComboboxRef, ComboboxState, type ComboboxStateSnapshot, CommandPalette, ConnectedUsersMenuLayout, ContextMenu, type DesignSystemConfigurationContextValue, DesignSystemConfigurationProvider, type DetectSizeType, Dialog, type DialogContextValue, DialogProvider, DimensionInput, type DimensionValue, Divider, DividerVertical, type DragIndicatorStyleProps, type DragItem, DraggableMenuButton, Drawer, type DrawerProps, type
|
|
2440
|
+
export { AIAssistantInput, AIAssistantLayout, AIAssistantLoadingIndicator, type AcceptsDrop, type AcceptsDropOptions, type AcceptsFromList, ActionMenu, ActivityIndicator, AnimatePresence, type AnimatePresenceProps, Avatar, type AvatarProps, AvatarStack, Banner, type BannerProps, type BaseComboboxProps, BaseToolbar, type BaseToolbarProps, Body, BreadcrumbSlash, BreadcrumbText, Button, type ButtonRootProps, CHECKBOX_INDENT_WIDTH, CHECKBOX_RIGHT_INSET, CHECKBOX_WIDTH, CONTENT_AREA_ID, Checkbox$1 as Checkbox, Chip, type ChipProps, Collection, type CollectionItemSize, type CollectionProps, type CollectionRef, type CollectionRenderActionProps, type CollectionThumbnailProps, type CollectionThumbnailSize, type CollectionViewType, ColorSwatch, ColorSwatchControl, type ColorSwatchSize, Combobox, ComboboxMenu, type ComboboxProps, type ComboboxRef, ComboboxState, type ComboboxStateSnapshot, CommandPalette, ConnectedUsersMenuLayout, ContextMenu, type DesignSystemConfigurationContextValue, DesignSystemConfigurationProvider, type DetectSizeType, Dialog, type DialogContextValue, DialogProvider, DimensionInput, type DimensionValue, Divider, DividerVertical, type DragIndicatorStyleProps, type DragItem, type DragState, DraggableMenuButton, Drawer, type DrawerProps, type DropValidator, DropdownMenu, type DropdownRootProps, EDITOR_PANEL_GROUP_ID, type EditableRowProps, EditableText, type EditableTextRef, type ExtractMenuItemType, Fade, type FadeDirection, type FadeProps, FileExplorerCollection, FileExplorerDetail, FileExplorerEmptyState, FileExplorerLayout, FileExplorerUploadButton, FillInputField, FillPreviewBackground, FloatingWindow, FloatingWindowProvider, FullscreenDialog, type GlobalInputBlurContextValue, GlobalInputBlurProvider, GradientPicker, Grid, GridView, Heading1, Heading2, Heading3, Heading4, Heading5, type HoverEvent, type HoverEvents, type HoverProps, type IDialog, INPUT_HEIGHT, type IScoredItem, type ISearchCompletionMenu, type IToken, type IVirtualizedList, IconButton, type IconName, type ImageDataContextValue, ImageDataProvider, IndentContext, InputField, type InputFieldInputProps, type InputFieldProps, type InputFieldSize, InspectorContainer, InspectorPrimitives, Italic, KeyboardShortcut, LEFT_SIDEBAR_ID, Label, LabelContext, type LabelPosition, LabelPositionContext, type LabelPositionContextValue, type LabelProps, LabelWidthContext, type LabelWidthContextValue, LabeledElementView, LabeledField, type LayoutProps, List, type ListRowMarginType, type ListRowPosition, ListView, type ListViewItemInfo, type ListViewRootProps, type ListViewRowProps, Logo, type MatchRange, MediaThumbnail, type MenuComponents, type MenuConfig, type MenuItem, type MenuItemIcon, type MenuItemProps, type MenuItemRole, type MenuProps, MenuViewport, Message, type MessageProps, type MoveDragItemHandler, type MoveDragItemParameters, type MoveTreeItemOptions, type NonSelectableMenuItem, type OpenPortalControlsContextValue, type OpenPortalsContextValue, OpenPortalsProvider, type OptionModeOnlyProps, type OptionModeProps, type Optional, type PanelLayoutState, PatternPreviewBackground, type PercentageSidebarOptions, PipelineResultLayout, PipelineResultLink, Popover, type PortalScopeContextValue, PortalScopeProvider, Progress, RIGHT_SIDEBAR_ID, type RelativeDropPosition, SUPPORTED_CANVAS_UPLOAD_TYPES, SUPPORTED_IMAGE_UPLOAD_TYPES, type ScoredMenuItem, ScrollArea, SearchCompletionMenu, Section$1 as Section, SectionHeader$1 as SectionHeader, type SectionHeaderMenuItem, type SectionProps, SegmentedControl, type SegmentedControlItemProps, type SegmentedControlProps, SelectMenu, type SelectableMenuItem, SelectionToolbarContainer, type SeparatorItem, type SetNumberMode, SharedDragProvider, type SideOptions, type SideType, type SidebarRef, type SketchPattern, Slider, Small, Sortable, SortableItemContext, type SortableItemContextProps, type SortableProps, Spacer, type StringModeOnlyProps, type StringModeProps, type SubMenuItem, type SupportedCanvasUploadType, type SupportedImageUploadType, Switch, Text$1 as Text, TextArea, TextAreaRow, type TextProps, type Theme, type ThemeColor, Toast, ToastProvider, type TokenValue, Toolbar, ToolbarMenu, ToolbarMenuButton, ToolbarMenuDropdown, ToolbarMenuItem, type ToolbarProps, Tooltip, TreeView, type UseThemeReturnType, UserAvatar, UserPointer, type UserPointerProps, type ValidateDropIndicatorParams, WorkspaceLayout, type WorkspaceLayoutProps, type WorkspaceLayoutRef, acceptsDrop, colorForStringValues, colorFromString, colorSwatchSizeMap, createDragItemKey, createSectionedMenu, createSharedDrag, cssVarNames, cssVars, cx, defaultAcceptsDrop, dragItemKeySeparator, filterWithGroupedSections, fuzzyFilter, fuzzyScore, fuzzyTokenize, getClosestPortalScope, getFieldSpacing, getGradientBackground, getGridSize, getItemFirstCollisionDetection, getKeyboardShortcutsForMenuItems, getMenuItemKey, getNewValue, getNextIndex, getPipelineResultLink, getThumbnailColors, isMenuItemSectionHeader, isNonSelectableMenuItem, isSelectableMenuItem, isSelectableMenuItemWithScore, labeledFieldStyles, mediaQuery, mergeConflictingClassNames, moveTreeItem, normalizeListTargetIndex, parseDragItemKey, popoverStyle, portalScopeDataSetName, portalScopePropName, portalScopeProps, renderIcon, rgbaToSketchColor, separator, size, sketchColorToHex, sketchColorToRgba, sketchColorToRgbaString, styles, textStyles, updateSelection, useAutoResize, useComboboxState, useCurrentFloatingWindowInternal, useDesignSystemConfiguration, useDialogContainsElement, useDialogContext, useFloatingWindowManager, useGlobalInputBlur, useGlobalInputBlurListener, useGlobalInputBlurTrigger, useHasOpenPortals, useHover, useImageData, useIndent, useInputFieldContext, useLabel, useLabelPosition, useLabelWidth, useOpenConfirmationDialog, useOpenDialog, useOpenInputDialog, useOpenPortalsControls, usePlatform, usePlatformModKey, usePortalScopeId, usePreservePanelSize, useTheme, validateDropIndicator, withDragProvider, withSeparatorElements };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as Icons from '@noya-app/noya-icons';
|
|
|
5
5
|
export { Icons };
|
|
6
6
|
import tailwindConfig from '@noya-app/noya-tailwind-config';
|
|
7
7
|
import * as _noya_app_noya_geometry from '@noya-app/noya-geometry';
|
|
8
|
-
import {
|
|
8
|
+
import { Point as Point$1, Size, Rect } from '@noya-app/noya-geometry';
|
|
9
9
|
import { UniqueIdentifier, Active, Over, CollisionDetection } from '@dnd-kit/core';
|
|
10
10
|
import { Property } from 'csstype';
|
|
11
11
|
import * as _noya_app_noya_designsystem from '@noya-app/noya-designsystem';
|
|
@@ -709,23 +709,30 @@ interface ChipProps {
|
|
|
709
709
|
declare const Chip: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<ChipProps & React__default.RefAttributes<HTMLSpanElement>>>;
|
|
710
710
|
|
|
711
711
|
type RelativeDropPosition = "above" | "below" | "inside";
|
|
712
|
-
type
|
|
713
|
-
|
|
714
|
-
|
|
712
|
+
type MoveDragItemParameters = {
|
|
713
|
+
sourceIndex: number;
|
|
714
|
+
sourceListId: string;
|
|
715
|
+
targetIndex: number;
|
|
716
|
+
targetListId: string;
|
|
717
|
+
position: RelativeDropPosition;
|
|
718
|
+
};
|
|
719
|
+
type DropValidator = (parameters: MoveDragItemParameters) => boolean;
|
|
720
|
+
type AcceptsDrop = (parameters: MoveDragItemParameters) => boolean;
|
|
721
|
+
type MoveDragItemHandler = (parameters: MoveDragItemParameters) => void;
|
|
715
722
|
type AcceptsFromList = ({ sourceListId, targetListId, }: {
|
|
716
723
|
sourceListId: string;
|
|
717
724
|
targetListId: string;
|
|
718
725
|
}) => boolean;
|
|
719
726
|
interface DragItem {
|
|
720
|
-
|
|
721
|
-
listId: string;
|
|
722
|
-
index: number;
|
|
723
|
-
}
|
|
724
|
-
interface DropTarget {
|
|
725
|
-
id: UniqueIdentifier;
|
|
727
|
+
itemId: UniqueIdentifier;
|
|
726
728
|
listId: string;
|
|
727
729
|
index: number;
|
|
728
730
|
}
|
|
731
|
+
type DragState = {
|
|
732
|
+
source: DragItem | null;
|
|
733
|
+
target: DragItem | null;
|
|
734
|
+
indicator: RelativeDropPosition | null;
|
|
735
|
+
};
|
|
729
736
|
declare const normalizeListTargetIndex: (index: number, position: "above" | "below") => number;
|
|
730
737
|
declare const defaultAcceptsDrop: DropValidator;
|
|
731
738
|
type SortableItemContextProps = {
|
|
@@ -753,6 +760,38 @@ type ValidateDropIndicatorParams = {
|
|
|
753
760
|
targetListId: string;
|
|
754
761
|
};
|
|
755
762
|
declare function validateDropIndicator({ acceptsDrop, keys, activeId, overId, offsetStart, elementStart, elementSize, sourceListId, targetListId, }: ValidateDropIndicatorParams): RelativeDropPosition | undefined;
|
|
763
|
+
declare const dragItemKeySeparator = "-~-";
|
|
764
|
+
declare function createDragItemKey(listId: string, itemId: UniqueIdentifier): string;
|
|
765
|
+
declare function parseDragItemKey(key: string): {
|
|
766
|
+
listId: string;
|
|
767
|
+
itemId: UniqueIdentifier;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
type GetDropIndicatorParameters = {
|
|
771
|
+
absolutePosition: Point$1;
|
|
772
|
+
active: Active;
|
|
773
|
+
over: Over;
|
|
774
|
+
sourceListId: string;
|
|
775
|
+
targetListId: string;
|
|
776
|
+
};
|
|
777
|
+
interface RegisteredList {
|
|
778
|
+
id: string;
|
|
779
|
+
keys: UniqueIdentifier[];
|
|
780
|
+
onMoveItem: MoveDragItemHandler;
|
|
781
|
+
renderOverlay?: (id: UniqueIdentifier) => React__default.ReactNode;
|
|
782
|
+
acceptsFromList: AcceptsFromList;
|
|
783
|
+
acceptsDrop: AcceptsDrop;
|
|
784
|
+
getDropIndicator: (parameters: GetDropIndicatorParameters) => RelativeDropPosition | undefined;
|
|
785
|
+
}
|
|
786
|
+
interface DragRegistrationContextType {
|
|
787
|
+
registerList: (list: RegisteredList) => void;
|
|
788
|
+
unregisterList: (listId: string) => void;
|
|
789
|
+
}
|
|
790
|
+
type ActiveDragContextType = DragState;
|
|
791
|
+
type SharedDragProps = {
|
|
792
|
+
dragRegistrationContext: React__default.Context<DragRegistrationContextType | null>;
|
|
793
|
+
activeDragContext: React__default.Context<ActiveDragContextType | null>;
|
|
794
|
+
};
|
|
756
795
|
|
|
757
796
|
type ListRowMarginType = "none" | "top" | "bottom" | "vertical";
|
|
758
797
|
type ListRowPosition = "only" | "first" | "middle" | "last";
|
|
@@ -869,6 +908,8 @@ type ListViewRootProps = {
|
|
|
869
908
|
onDrop?: React__default.DragEventHandler<HTMLDivElement>;
|
|
870
909
|
renderEmptyState?: () => ReactNode;
|
|
871
910
|
getDropTargetParentIndex?: SortableItemContextProps["getDropTargetParentIndex"];
|
|
911
|
+
sharedDragProps?: SharedDragProps;
|
|
912
|
+
sortableId?: string;
|
|
872
913
|
};
|
|
873
914
|
declare namespace ListView {
|
|
874
915
|
const RowTitle: React__default.MemoExoticComponent<({ className, children, ...props }: {
|
|
@@ -968,6 +1009,8 @@ interface CollectionProps<T, M extends string = string> {
|
|
|
968
1009
|
/** @default false */
|
|
969
1010
|
sortable?: boolean;
|
|
970
1011
|
dragIndicatorStyle?: ListViewRowProps<M>["dragIndicatorStyle"];
|
|
1012
|
+
sharedDragProps?: SharedDragProps;
|
|
1013
|
+
sortableId?: string;
|
|
971
1014
|
}
|
|
972
1015
|
declare const Collection: <T, M extends string = string>(props: CollectionProps<T, M> & React__default.RefAttributes<CollectionRef>) => React__default.ReactElement | null;
|
|
973
1016
|
type CollectionItemSize = "xxs" | "xs" | "small" | "medium" | "large" | "xl";
|
|
@@ -1784,42 +1827,14 @@ interface Props$4 {
|
|
|
1784
1827
|
}
|
|
1785
1828
|
declare const Slider: React__default.NamedExoticComponent<Props$4>;
|
|
1786
1829
|
|
|
1787
|
-
type GetDropIndicatorParameters = {
|
|
1788
|
-
absolutePosition: Point$1;
|
|
1789
|
-
active: Active;
|
|
1790
|
-
over: Over;
|
|
1791
|
-
sourceListId: string;
|
|
1792
|
-
targetListId: string;
|
|
1793
|
-
};
|
|
1794
|
-
interface RegisteredList {
|
|
1795
|
-
id: string;
|
|
1796
|
-
keys: UniqueIdentifier[];
|
|
1797
|
-
onMoveItem: MoveDragItemHandler;
|
|
1798
|
-
renderOverlay?: (id: UniqueIdentifier) => React__default.ReactNode;
|
|
1799
|
-
acceptsFromList: AcceptsFromList;
|
|
1800
|
-
acceptsDrop: AcceptsDrop;
|
|
1801
|
-
getDropIndicator: (parameters: GetDropIndicatorParameters) => RelativeDropPosition | undefined;
|
|
1802
|
-
}
|
|
1803
|
-
interface DragRegistrationContextType {
|
|
1804
|
-
registerList: (list: RegisteredList) => void;
|
|
1805
|
-
unregisterList: (listId: string) => void;
|
|
1806
|
-
}
|
|
1807
|
-
type ActiveDragContextType = {
|
|
1808
|
-
activeItem: DragItem | null;
|
|
1809
|
-
delta: Point$1;
|
|
1810
|
-
};
|
|
1811
|
-
type SharedDragProviderContexts = {
|
|
1812
|
-
dragRegistrationContext: React__default.Context<DragRegistrationContextType | null>;
|
|
1813
|
-
activeDragContext: React__default.Context<ActiveDragContextType | null>;
|
|
1814
|
-
};
|
|
1815
|
-
|
|
1816
1830
|
type SharedDragProviderProps = {
|
|
1817
1831
|
children: React$1.ReactNode;
|
|
1818
|
-
|
|
1832
|
+
onMoveItem?: MoveDragItemHandler;
|
|
1833
|
+
sharedDragProps?: SharedDragProps;
|
|
1819
1834
|
};
|
|
1820
|
-
declare function SharedDragProvider({ children,
|
|
1835
|
+
declare function SharedDragProvider({ children, onMoveItem, sharedDragProps, }: SharedDragProviderProps): React$1.JSX.Element;
|
|
1821
1836
|
declare function withDragProvider<T extends object>(Component: React$1.ComponentType<T>): (props: T) => React$1.JSX.Element;
|
|
1822
|
-
declare const getItemFirstCollisionDetection: (
|
|
1837
|
+
declare const getItemFirstCollisionDetection: (registeredLists: Map<string, RegisteredList>) => CollisionDetection;
|
|
1823
1838
|
|
|
1824
1839
|
type UseSortableReturnType = ReturnType<typeof useSortable>;
|
|
1825
1840
|
type ItemChildrenProps<T> = {
|
|
@@ -1837,7 +1852,7 @@ interface RootProps {
|
|
|
1837
1852
|
acceptsFromList?: AcceptsFromList;
|
|
1838
1853
|
acceptsDrop?: DropValidator;
|
|
1839
1854
|
getDropTargetParentIndex?: (index: number) => number | undefined;
|
|
1840
|
-
|
|
1855
|
+
sharedDragProps?: SharedDragProps;
|
|
1841
1856
|
containerRef?: React$1.RefObject<HTMLElement>;
|
|
1842
1857
|
}
|
|
1843
1858
|
declare function SortableItem<TElement extends HTMLElement>({ id, disabled, children, }: {
|
|
@@ -1845,7 +1860,7 @@ declare function SortableItem<TElement extends HTMLElement>({ id, disabled, chil
|
|
|
1845
1860
|
disabled?: boolean;
|
|
1846
1861
|
children: (props: ItemChildrenProps<TElement>) => React$1.ReactNode;
|
|
1847
1862
|
}): React$1.ReactNode;
|
|
1848
|
-
declare function SortableRoot_({ id: idProp, keys, onMoveItem, renderOverlay, acceptsFromList, acceptsDrop, axis, children, getDropTargetParentIndex,
|
|
1863
|
+
declare function SortableRoot_({ id: idProp, keys: keysProp, onMoveItem, renderOverlay, acceptsFromList, acceptsDrop, axis, children, getDropTargetParentIndex, sharedDragProps, containerRef, }: RootProps): React$1.JSX.Element;
|
|
1849
1864
|
interface SortableProps<TItem, TElement extends HTMLElement> extends Omit<RootProps, "children" | "keys" | "renderOverlay"> {
|
|
1850
1865
|
items: TItem[];
|
|
1851
1866
|
keyExtractor: (item: TItem) => UniqueIdentifier;
|
|
@@ -1861,8 +1876,8 @@ declare const Sortable: (<TItem, TElement extends HTMLElement>({ items, keyExtra
|
|
|
1861
1876
|
|
|
1862
1877
|
declare function createSharedDrag(): {
|
|
1863
1878
|
Provider: typeof SharedDragProvider;
|
|
1864
|
-
props: SharedDragProviderContexts;
|
|
1865
1879
|
Sortable: <TItem, TElement extends HTMLElement>(props: SortableProps<TItem, TElement>) => React$1.ReactNode;
|
|
1880
|
+
props: SharedDragProps;
|
|
1866
1881
|
};
|
|
1867
1882
|
|
|
1868
1883
|
interface Props$3 {
|
|
@@ -2422,4 +2437,4 @@ interface ToolbarProps<T extends string = string> {
|
|
|
2422
2437
|
}
|
|
2423
2438
|
declare function Toolbar<T extends string = string>({ children, logo, leftMenuItems, rightMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts, }: ToolbarProps<T>): React__default.JSX.Element;
|
|
2424
2439
|
|
|
2425
|
-
export { AIAssistantInput, AIAssistantLayout, AIAssistantLoadingIndicator, type AcceptsDrop, type AcceptsDropOptions, type AcceptsFromList, ActionMenu, ActivityIndicator, AnimatePresence, type AnimatePresenceProps, Avatar, type AvatarProps, AvatarStack, Banner, type BannerProps, type BaseComboboxProps, BaseToolbar, type BaseToolbarProps, Body, BreadcrumbSlash, BreadcrumbText, Button, type ButtonRootProps, CHECKBOX_INDENT_WIDTH, CHECKBOX_RIGHT_INSET, CHECKBOX_WIDTH, CONTENT_AREA_ID, Checkbox$1 as Checkbox, Chip, type ChipProps, Collection, type CollectionItemSize, type CollectionProps, type CollectionRef, type CollectionRenderActionProps, type CollectionThumbnailProps, type CollectionThumbnailSize, type CollectionViewType, ColorSwatch, ColorSwatchControl, type ColorSwatchSize, Combobox, ComboboxMenu, type ComboboxProps, type ComboboxRef, ComboboxState, type ComboboxStateSnapshot, CommandPalette, ConnectedUsersMenuLayout, ContextMenu, type DesignSystemConfigurationContextValue, DesignSystemConfigurationProvider, type DetectSizeType, Dialog, type DialogContextValue, DialogProvider, DimensionInput, type DimensionValue, Divider, DividerVertical, type DragIndicatorStyleProps, type DragItem, DraggableMenuButton, Drawer, type DrawerProps, type
|
|
2440
|
+
export { AIAssistantInput, AIAssistantLayout, AIAssistantLoadingIndicator, type AcceptsDrop, type AcceptsDropOptions, type AcceptsFromList, ActionMenu, ActivityIndicator, AnimatePresence, type AnimatePresenceProps, Avatar, type AvatarProps, AvatarStack, Banner, type BannerProps, type BaseComboboxProps, BaseToolbar, type BaseToolbarProps, Body, BreadcrumbSlash, BreadcrumbText, Button, type ButtonRootProps, CHECKBOX_INDENT_WIDTH, CHECKBOX_RIGHT_INSET, CHECKBOX_WIDTH, CONTENT_AREA_ID, Checkbox$1 as Checkbox, Chip, type ChipProps, Collection, type CollectionItemSize, type CollectionProps, type CollectionRef, type CollectionRenderActionProps, type CollectionThumbnailProps, type CollectionThumbnailSize, type CollectionViewType, ColorSwatch, ColorSwatchControl, type ColorSwatchSize, Combobox, ComboboxMenu, type ComboboxProps, type ComboboxRef, ComboboxState, type ComboboxStateSnapshot, CommandPalette, ConnectedUsersMenuLayout, ContextMenu, type DesignSystemConfigurationContextValue, DesignSystemConfigurationProvider, type DetectSizeType, Dialog, type DialogContextValue, DialogProvider, DimensionInput, type DimensionValue, Divider, DividerVertical, type DragIndicatorStyleProps, type DragItem, type DragState, DraggableMenuButton, Drawer, type DrawerProps, type DropValidator, DropdownMenu, type DropdownRootProps, EDITOR_PANEL_GROUP_ID, type EditableRowProps, EditableText, type EditableTextRef, type ExtractMenuItemType, Fade, type FadeDirection, type FadeProps, FileExplorerCollection, FileExplorerDetail, FileExplorerEmptyState, FileExplorerLayout, FileExplorerUploadButton, FillInputField, FillPreviewBackground, FloatingWindow, FloatingWindowProvider, FullscreenDialog, type GlobalInputBlurContextValue, GlobalInputBlurProvider, GradientPicker, Grid, GridView, Heading1, Heading2, Heading3, Heading4, Heading5, type HoverEvent, type HoverEvents, type HoverProps, type IDialog, INPUT_HEIGHT, type IScoredItem, type ISearchCompletionMenu, type IToken, type IVirtualizedList, IconButton, type IconName, type ImageDataContextValue, ImageDataProvider, IndentContext, InputField, type InputFieldInputProps, type InputFieldProps, type InputFieldSize, InspectorContainer, InspectorPrimitives, Italic, KeyboardShortcut, LEFT_SIDEBAR_ID, Label, LabelContext, type LabelPosition, LabelPositionContext, type LabelPositionContextValue, type LabelProps, LabelWidthContext, type LabelWidthContextValue, LabeledElementView, LabeledField, type LayoutProps, List, type ListRowMarginType, type ListRowPosition, ListView, type ListViewItemInfo, type ListViewRootProps, type ListViewRowProps, Logo, type MatchRange, MediaThumbnail, type MenuComponents, type MenuConfig, type MenuItem, type MenuItemIcon, type MenuItemProps, type MenuItemRole, type MenuProps, MenuViewport, Message, type MessageProps, type MoveDragItemHandler, type MoveDragItemParameters, type MoveTreeItemOptions, type NonSelectableMenuItem, type OpenPortalControlsContextValue, type OpenPortalsContextValue, OpenPortalsProvider, type OptionModeOnlyProps, type OptionModeProps, type Optional, type PanelLayoutState, PatternPreviewBackground, type PercentageSidebarOptions, PipelineResultLayout, PipelineResultLink, Popover, type PortalScopeContextValue, PortalScopeProvider, Progress, RIGHT_SIDEBAR_ID, type RelativeDropPosition, SUPPORTED_CANVAS_UPLOAD_TYPES, SUPPORTED_IMAGE_UPLOAD_TYPES, type ScoredMenuItem, ScrollArea, SearchCompletionMenu, Section$1 as Section, SectionHeader$1 as SectionHeader, type SectionHeaderMenuItem, type SectionProps, SegmentedControl, type SegmentedControlItemProps, type SegmentedControlProps, SelectMenu, type SelectableMenuItem, SelectionToolbarContainer, type SeparatorItem, type SetNumberMode, SharedDragProvider, type SideOptions, type SideType, type SidebarRef, type SketchPattern, Slider, Small, Sortable, SortableItemContext, type SortableItemContextProps, type SortableProps, Spacer, type StringModeOnlyProps, type StringModeProps, type SubMenuItem, type SupportedCanvasUploadType, type SupportedImageUploadType, Switch, Text$1 as Text, TextArea, TextAreaRow, type TextProps, type Theme, type ThemeColor, Toast, ToastProvider, type TokenValue, Toolbar, ToolbarMenu, ToolbarMenuButton, ToolbarMenuDropdown, ToolbarMenuItem, type ToolbarProps, Tooltip, TreeView, type UseThemeReturnType, UserAvatar, UserPointer, type UserPointerProps, type ValidateDropIndicatorParams, WorkspaceLayout, type WorkspaceLayoutProps, type WorkspaceLayoutRef, acceptsDrop, colorForStringValues, colorFromString, colorSwatchSizeMap, createDragItemKey, createSectionedMenu, createSharedDrag, cssVarNames, cssVars, cx, defaultAcceptsDrop, dragItemKeySeparator, filterWithGroupedSections, fuzzyFilter, fuzzyScore, fuzzyTokenize, getClosestPortalScope, getFieldSpacing, getGradientBackground, getGridSize, getItemFirstCollisionDetection, getKeyboardShortcutsForMenuItems, getMenuItemKey, getNewValue, getNextIndex, getPipelineResultLink, getThumbnailColors, isMenuItemSectionHeader, isNonSelectableMenuItem, isSelectableMenuItem, isSelectableMenuItemWithScore, labeledFieldStyles, mediaQuery, mergeConflictingClassNames, moveTreeItem, normalizeListTargetIndex, parseDragItemKey, popoverStyle, portalScopeDataSetName, portalScopePropName, portalScopeProps, renderIcon, rgbaToSketchColor, separator, size, sketchColorToHex, sketchColorToRgba, sketchColorToRgbaString, styles, textStyles, updateSelection, useAutoResize, useComboboxState, useCurrentFloatingWindowInternal, useDesignSystemConfiguration, useDialogContainsElement, useDialogContext, useFloatingWindowManager, useGlobalInputBlur, useGlobalInputBlurListener, useGlobalInputBlurTrigger, useHasOpenPortals, useHover, useImageData, useIndent, useInputFieldContext, useLabel, useLabelPosition, useLabelWidth, useOpenConfirmationDialog, useOpenDialog, useOpenInputDialog, useOpenPortalsControls, usePlatform, usePlatformModKey, usePortalScopeId, usePreservePanelSize, useTheme, validateDropIndicator, withDragProvider, withSeparatorElements };
|