@dxos/react-ui 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a
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/dist/lib/browser/{chunk-HFJYTGHU.mjs → chunk-CMHHVHX3.mjs} +4 -1
- package/dist/lib/browser/chunk-CMHHVHX3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F3PLXTDA.mjs → chunk-GTHV4WYK.mjs} +123 -232
- package/dist/lib/browser/chunk-GTHV4WYK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1069 -976
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +5 -5
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/browser/translations.mjs +1 -1
- package/dist/lib/node-esm/{chunk-LLVUYLAM.mjs → chunk-3VSKWNCQ.mjs} +123 -232
- package/dist/lib/node-esm/chunk-3VSKWNCQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OJYUPUCY.mjs → chunk-P4KFQGJI.mjs} +4 -1
- package/dist/lib/node-esm/chunk-P4KFQGJI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1069 -976
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +5 -5
- package/dist/lib/node-esm/testing/index.mjs.map +2 -2
- package/dist/lib/node-esm/translations.mjs +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +3 -3
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/MicButton.d.ts +24 -0
- package/dist/types/src/components/Button/MicButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/MicButton.stories.d.ts +57 -0
- package/dist/types/src/components/Button/MicButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/SystemIconButton.d.ts +15 -2
- package/dist/types/src/components/Button/SystemIconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/SystemIconButton.stories.d.ts +51 -0
- package/dist/types/src/components/Button/SystemIconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/ToggleGroup.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/index.d.ts +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/Calendar.theme.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +8 -8
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +2 -2
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/Carousel.d.ts +29 -6
- package/dist/types/src/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/Carousel.stories.d.ts +48 -2
- package/dist/types/src/components/Carousel/Carousel.stories.d.ts.map +1 -1
- package/dist/types/src/components/Column/Column.d.ts +2 -2
- package/dist/types/src/components/Column/Column.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +2 -2
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +5 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +4 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +3 -3
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.theme.d.ts +10 -10
- package/dist/types/src/components/Input/Input.theme.d.ts.map +1 -1
- package/dist/types/src/components/Input/SegmentedInput.d.ts +8 -8
- package/dist/types/src/components/Input/SegmentedInput.d.ts.map +1 -1
- package/dist/types/src/components/Input/index.d.ts +0 -1
- package/dist/types/src/components/Input/index.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +3 -3
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +2 -2
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.d.ts +1 -1
- package/dist/types/src/components/Panel/Panel.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.theme.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +2 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +1 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +2 -2
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +30 -16
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +6 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.theme.d.ts +3 -1
- package/dist/types/src/components/Splitter/Splitter.theme.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.theme.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.theme.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.theme.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +3 -3
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/theme/defaultTheme.d.ts.map +1 -1
- package/dist/types/src/theme/index.d.ts +0 -2
- package/dist/types/src/theme/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/slots.d.ts +1 -1
- package/dist/types/src/util/slots.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -21
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.theme.ts +1 -1
- package/src/components/Avatars/Avatar.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +6 -6
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Button/MicButton.stories.tsx +60 -0
- package/src/components/Button/MicButton.tsx +117 -0
- package/src/components/Button/SystemIconButton.stories.tsx +91 -0
- package/src/components/Button/SystemIconButton.tsx +113 -2
- package/src/components/Button/ToggleGroup.tsx +2 -2
- package/src/components/Button/index.ts +1 -0
- package/src/components/Calendar/Calendar.theme.ts +2 -0
- package/src/components/Calendar/Calendar.tsx +3 -3
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.tsx +11 -11
- package/src/components/Carousel/Carousel.stories.tsx +42 -18
- package/src/components/Carousel/Carousel.tsx +169 -33
- package/src/components/Column/Column.tsx +4 -7
- package/src/components/Dialog/AlertDialog.stories.tsx +2 -2
- package/src/components/Dialog/AlertDialog.tsx +13 -13
- package/src/components/Dialog/Dialog.stories.tsx +3 -4
- package/src/components/Dialog/Dialog.theme.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +12 -12
- package/src/components/Icon/Icon.stories.tsx +23 -0
- package/src/components/Icon/Icon.theme.ts +1 -1
- package/src/components/Input/Input.stories.tsx +13 -5
- package/src/components/Input/Input.theme.ts +17 -39
- package/src/components/Input/Input.tsx +30 -13
- package/src/components/Input/SegmentedInput.tsx +50 -41
- package/src/components/Input/index.ts +0 -1
- package/src/components/Main/Main.tsx +3 -3
- package/src/components/MediaPlayer/MediaPlayer.tsx +4 -4
- package/src/components/Menu/ContextMenu.tsx +8 -8
- package/src/components/Menu/DropdownMenu.tsx +12 -13
- package/src/components/Message/Message.stories.tsx +2 -2
- package/src/components/Message/Message.theme.ts +1 -1
- package/src/components/Message/Message.tsx +2 -2
- package/src/components/Panel/Panel.theme.ts +2 -1
- package/src/components/Panel/Panel.tsx +1 -1
- package/src/components/Popover/Popover.tsx +9 -9
- package/src/components/ScrollArea/ScrollArea.tsx +7 -4
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +2 -2
- package/src/components/ScrollContainer/ScrollContainer.tsx +2 -2
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.theme.ts +1 -1
- package/src/components/Select/Select.tsx +14 -14
- package/src/components/Separator/Separator.tsx +1 -0
- package/src/components/Splitter/Splitter.stories.tsx +84 -20
- package/src/components/Splitter/Splitter.theme.ts +20 -3
- package/src/components/Splitter/Splitter.tsx +320 -47
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.theme.ts +1 -1
- package/src/components/Tag/Tag.tsx +3 -5
- package/src/components/Toast/Toast.theme.ts +3 -2
- package/src/components/Toast/Toast.tsx +5 -5
- package/src/components/Toolbar/Toolbar.tsx +10 -10
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +0 -1
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/primitives/ThemeProvider/TranslationsProvider.tsx +10 -30
- package/src/testing/decorators/withLayout.tsx +4 -4
- package/src/theme/defaultTheme.ts +0 -4
- package/src/theme/index.ts +0 -2
- package/src/translations.ts +8 -0
- package/src/util/slots.ts +5 -5
- package/dist/lib/browser/chunk-F3PLXTDA.mjs.map +0 -7
- package/dist/lib/browser/chunk-HFJYTGHU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LLVUYLAM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OJYUPUCY.mjs.map +0 -7
- package/dist/types/src/components/Input/constants.d.ts +0 -5
- package/dist/types/src/components/Input/constants.d.ts.map +0 -1
- package/dist/types/src/components/List/List.d.ts +0 -29
- package/dist/types/src/components/List/List.d.ts.map +0 -1
- package/dist/types/src/components/List/List.stories.d.ts +0 -16
- package/dist/types/src/components/List/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/List.theme.d.ts +0 -7
- package/dist/types/src/components/List/List.theme.d.ts.map +0 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts +0 -13
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.d.ts +0 -23
- package/dist/types/src/components/List/Tree.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.stories.d.ts +0 -15
- package/dist/types/src/components/List/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts +0 -8
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.d.ts +0 -33
- package/dist/types/src/components/List/Treegrid.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts +0 -12
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.theme.d.ts +0 -7
- package/dist/types/src/components/List/Treegrid.theme.d.ts.map +0 -1
- package/dist/types/src/components/List/index.d.ts +0 -4
- package/dist/types/src/components/List/index.d.ts.map +0 -1
- package/src/components/Input/constants.ts +0 -8
- package/src/components/List/List.stories.tsx +0 -234
- package/src/components/List/List.theme.ts +0 -47
- package/src/components/List/List.tsx +0 -171
- package/src/components/List/ListDropIndicator.tsx +0 -69
- package/src/components/List/Tree.stories.tsx +0 -87
- package/src/components/List/Tree.tsx +0 -74
- package/src/components/List/TreeDropIndicator.tsx +0 -70
- package/src/components/List/Treegrid.stories.tsx +0 -156
- package/src/components/List/Treegrid.theme.ts +0 -35
- package/src/components/List/Treegrid.tsx +0 -187
- package/src/components/List/index.ts +0 -7
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type Scope } from '@radix-ui/react-context';
|
|
2
|
-
import { Primitive } from '@radix-ui/react-primitive';
|
|
3
|
-
import React, { type CSSProperties, type ComponentPropsWithRef } from 'react';
|
|
4
|
-
import { type ThemedClassName } from '../../util';
|
|
5
|
-
type TreegridRowScopedProps<P> = P & {
|
|
6
|
-
__treegridRowScope?: Scope;
|
|
7
|
-
};
|
|
8
|
-
export declare const TREEGRID_PATH_SEPARATOR = "~";
|
|
9
|
-
export declare const TREEGRID_PARENT_OF_SEPARATOR = " ";
|
|
10
|
-
type TreegridRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
11
|
-
gridTemplateColumns?: CSSProperties['gridTemplateColumns'];
|
|
12
|
-
asChild?: boolean;
|
|
13
|
-
};
|
|
14
|
-
type TreegridRowProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
15
|
-
id: string;
|
|
16
|
-
asChild?: boolean;
|
|
17
|
-
parentOf?: string;
|
|
18
|
-
defaultOpen?: boolean;
|
|
19
|
-
open?: boolean;
|
|
20
|
-
onOpenChange?(open: boolean): void;
|
|
21
|
-
};
|
|
22
|
-
type TreegridCellProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
23
|
-
indent?: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type { TreegridRootProps, TreegridRowProps };
|
|
26
|
-
export declare const Treegrid: {
|
|
27
|
-
Root: React.ForwardRefExoticComponent<Omit<TreegridRootProps, "className"> & {
|
|
28
|
-
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
29
|
-
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
Row: React.ForwardRefExoticComponent<Omit<TreegridRowScopedProps<TreegridRowProps>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
Cell: React.ForwardRefExoticComponent<Omit<TreegridCellProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=Treegrid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Treegrid.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/Treegrid.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAI3B,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAapE,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,KAAK,iBAAiB,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IACtF,mBAAmB,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAsEF,KAAK,gBAAgB,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC,CAAC;AA8CF,KAAK,iBAAiB,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAa7G,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAEpD,eAAO,MAAM,QAAQ;IACnB,IAAI;;;IACJ,GAAG;IACH,IAAI;CACL,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: any;
|
|
6
|
-
render: () => React.JSX.Element;
|
|
7
|
-
decorators: import("@storybook/react").Decorator[];
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof meta>;
|
|
11
|
-
export declare const Default: Story;
|
|
12
|
-
//# sourceMappingURL=Treegrid.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Treegrid.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/Treegrid.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AA2I1B,QAAA,MAAM,IAAI;;eAEoB,GAAG;;;CAGI,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Treegrid.theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/Treegrid.theme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAqB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC;AAoBH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,kBAAkB,CAInD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { DndContext, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';
|
|
6
|
-
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
7
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
8
|
-
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
9
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
10
|
-
import React, { type ReactNode, useCallback, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
import { getSize, ghostHover, mx, surfaceShadow } from '@dxos/ui-theme';
|
|
13
|
-
|
|
14
|
-
import { withTheme } from '../../testing';
|
|
15
|
-
import { Icon } from '../Icon';
|
|
16
|
-
import { List, ListItem, type ListScopedProps } from './List';
|
|
17
|
-
|
|
18
|
-
const meta = {
|
|
19
|
-
title: 'ui/react-ui-core/components/List',
|
|
20
|
-
component: List,
|
|
21
|
-
decorators: [withTheme()],
|
|
22
|
-
} satisfies Meta<typeof List>;
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
|
|
26
|
-
type Story = StoryObj<typeof meta>;
|
|
27
|
-
|
|
28
|
-
const UniformListItem = ({ id, text }: { id: string; text: string }) => {
|
|
29
|
-
const { attributes, listeners, setNodeRef, transform } = useSortable({ id });
|
|
30
|
-
return (
|
|
31
|
-
<ListItem.Root
|
|
32
|
-
id={id}
|
|
33
|
-
ref={setNodeRef}
|
|
34
|
-
{...attributes}
|
|
35
|
-
{...listeners}
|
|
36
|
-
style={{ transform: CSS.Transform.toString(transform) }}
|
|
37
|
-
>
|
|
38
|
-
<ListItem.Endcap>
|
|
39
|
-
<Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mt-2.5')} />
|
|
40
|
-
</ListItem.Endcap>
|
|
41
|
-
<ListItem.Heading classNames='grow pt-2'>{text}</ListItem.Heading>
|
|
42
|
-
<ListItem.Endcap>
|
|
43
|
-
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mt-2.5')} />
|
|
44
|
-
</ListItem.Endcap>
|
|
45
|
-
</ListItem.Root>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const UniformSizeDraggable: Story = {
|
|
50
|
-
render: ({ ...args }) => {
|
|
51
|
-
const [items, setItems] = useState(
|
|
52
|
-
[...Array(12)].map((_, index) => ({
|
|
53
|
-
id: `listItem-${index}`,
|
|
54
|
-
text: `List item ${index + 1}`,
|
|
55
|
-
})),
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const handleDragEnd = useCallback(
|
|
59
|
-
(event: DragEndEvent) => {
|
|
60
|
-
const { active, over } = event;
|
|
61
|
-
if (active.id !== over?.id) {
|
|
62
|
-
setItems((items) => {
|
|
63
|
-
const oldIndex = items.findIndex((item) => item.id === active.id);
|
|
64
|
-
const newIndex = items.findIndex((item) => item.id === over?.id);
|
|
65
|
-
return arrayMove(items, oldIndex, newIndex);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
[items],
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<DndContext onDragEnd={handleDragEnd}>
|
|
74
|
-
<SortableContext items={items.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|
|
75
|
-
<List {...args} itemSizes='one'>
|
|
76
|
-
{items.map((item) => (
|
|
77
|
-
<UniformListItem key={item.id} {...item} />
|
|
78
|
-
))}
|
|
79
|
-
</List>
|
|
80
|
-
</SortableContext>
|
|
81
|
-
</DndContext>
|
|
82
|
-
);
|
|
83
|
-
},
|
|
84
|
-
args: {},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const ManySizesDraggableListItem = ({
|
|
88
|
-
id,
|
|
89
|
-
text,
|
|
90
|
-
className,
|
|
91
|
-
dragging,
|
|
92
|
-
__listScope,
|
|
93
|
-
}: ListScopedProps<{ id: string; text: ReactNode; className?: string; dragging?: boolean }>) => {
|
|
94
|
-
const { attributes, listeners, setNodeRef, transform } = useSortable({ id });
|
|
95
|
-
return (
|
|
96
|
-
<ListItem.Root
|
|
97
|
-
id={id}
|
|
98
|
-
classNames={[dragging && 'relative z-10', className]}
|
|
99
|
-
ref={setNodeRef}
|
|
100
|
-
{...attributes}
|
|
101
|
-
{...listeners}
|
|
102
|
-
style={{ transform: CSS.Translate.toString(transform) }}
|
|
103
|
-
>
|
|
104
|
-
<ListItem.Endcap>
|
|
105
|
-
<Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mt-2.5')} />
|
|
106
|
-
</ListItem.Endcap>
|
|
107
|
-
<ListItem.Heading classNames='grow pt-2' asChild>
|
|
108
|
-
{text}
|
|
109
|
-
</ListItem.Heading>
|
|
110
|
-
<ListItem.Endcap>
|
|
111
|
-
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mt-2.5')} />
|
|
112
|
-
</ListItem.Endcap>
|
|
113
|
-
</ListItem.Root>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export const ManySizesDraggable: Story = {
|
|
118
|
-
render: ({ ...args }) => {
|
|
119
|
-
const [items, setItems] = useState(
|
|
120
|
-
[...Array(12)].map((_, index) => ({
|
|
121
|
-
id: `listItem-${index}`,
|
|
122
|
-
text: (
|
|
123
|
-
<p
|
|
124
|
-
className={mx(
|
|
125
|
-
index % 3 === 0 ? 'h-20' : index % 2 === 0 ? 'h-12' : 'h-8',
|
|
126
|
-
surfaceShadow({ elevation: 'positioned' }),
|
|
127
|
-
'mb-2 p-2 bg-white dark:bg-neutral-800 rounded-sm',
|
|
128
|
-
)}
|
|
129
|
-
>{`List item ${index + 1}`}</p>
|
|
130
|
-
),
|
|
131
|
-
})),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const [activeId, setActiveId] = useState<string | null>(null);
|
|
135
|
-
|
|
136
|
-
const handleDragStart = ({ active: { id } }: DragStartEvent) => setActiveId(id.toString());
|
|
137
|
-
|
|
138
|
-
const handleDragEnd = (event: DragEndEvent) => {
|
|
139
|
-
const { active, over } = event;
|
|
140
|
-
|
|
141
|
-
if (active.id !== over?.id) {
|
|
142
|
-
setItems((items) => {
|
|
143
|
-
const oldIndex = items.findIndex((item) => item.id === active.id);
|
|
144
|
-
const newIndex = items.findIndex((item) => item.id === over?.id);
|
|
145
|
-
return arrayMove(items, oldIndex, newIndex);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<DndContext onDragEnd={handleDragEnd} onDragStart={handleDragStart}>
|
|
152
|
-
<SortableContext items={items.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|
|
153
|
-
<List {...args}>
|
|
154
|
-
{items.map(({ id, text }) => (
|
|
155
|
-
<ManySizesDraggableListItem key={id} {...{ id, text }} dragging={activeId === id} />
|
|
156
|
-
))}
|
|
157
|
-
</List>
|
|
158
|
-
</SortableContext>
|
|
159
|
-
</DndContext>
|
|
160
|
-
);
|
|
161
|
-
},
|
|
162
|
-
args: {},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const Collapsible: Story = {
|
|
166
|
-
render: ({ ...args }) => {
|
|
167
|
-
const [items, _setItems] = useState(
|
|
168
|
-
[...Array(12)].map((_, index) => ({
|
|
169
|
-
id: `listItem-${index}`,
|
|
170
|
-
text: `List item ${index + 1}`,
|
|
171
|
-
body: `Collapsible content for item ${index + 1}`,
|
|
172
|
-
})),
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
<List {...args}>
|
|
177
|
-
{items.map(({ id, text, body }, index) => (
|
|
178
|
-
<ListItem.Root key={id} id={id} collapsible={index !== 2} defaultOpen={index % 2 === 0}>
|
|
179
|
-
<div className='grow flex'>
|
|
180
|
-
{index !== 2 ? <ListItem.OpenTrigger /> : <ListItem.MockOpenTrigger />}
|
|
181
|
-
<ListItem.Heading classNames='grow pt-2'>{text}</ListItem.Heading>
|
|
182
|
-
<ListItem.Endcap>
|
|
183
|
-
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mt-2.5')} />
|
|
184
|
-
</ListItem.Endcap>
|
|
185
|
-
</div>
|
|
186
|
-
{index !== 2 && <ListItem.CollapsibleContent>{body}</ListItem.CollapsibleContent>}
|
|
187
|
-
</ListItem.Root>
|
|
188
|
-
))}
|
|
189
|
-
</List>
|
|
190
|
-
);
|
|
191
|
-
},
|
|
192
|
-
args: {
|
|
193
|
-
variant: 'unordered',
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const SelectableListbox: Story = {
|
|
198
|
-
render: () => {
|
|
199
|
-
const [selectedId, setSelectedId] = useState<string>();
|
|
200
|
-
const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'vertical' });
|
|
201
|
-
const [items, _setItems] = useState(
|
|
202
|
-
[...Array(12)].map((_, index) => ({
|
|
203
|
-
id: `listItem-${index}`,
|
|
204
|
-
text: `List item ${index + 1}`,
|
|
205
|
-
})),
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const handleKeyUp = (event: any, id: string) => {
|
|
209
|
-
switch (event.key) {
|
|
210
|
-
case ' ':
|
|
211
|
-
case 'Enter': {
|
|
212
|
-
setSelectedId(id);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
<List selectable {...arrowNavigationAttrs}>
|
|
219
|
-
{items.map(({ id, text }) => (
|
|
220
|
-
<ListItem.Root
|
|
221
|
-
key={id}
|
|
222
|
-
tabIndex={0}
|
|
223
|
-
selected={selectedId === id}
|
|
224
|
-
classNames={mx(ghostHover, 'dx-selected')}
|
|
225
|
-
onClick={() => setSelectedId(id)}
|
|
226
|
-
onKeyUp={(event) => handleKeyUp(event, id)}
|
|
227
|
-
>
|
|
228
|
-
<ListItem.Heading classNames='flex px-1 items-center grow truncate'>{text}</ListItem.Heading>
|
|
229
|
-
</ListItem.Root>
|
|
230
|
-
))}
|
|
231
|
-
</List>
|
|
232
|
-
);
|
|
233
|
-
},
|
|
234
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { densityBlockSize, ghostHover } from '@dxos/ui-theme';
|
|
6
|
-
import { getSize, mx } from '@dxos/ui-theme';
|
|
7
|
-
import { type ComponentFunction, type Density, type Theme } from '@dxos/ui-types';
|
|
8
|
-
|
|
9
|
-
export type ListStyleProps = Partial<{
|
|
10
|
-
density: Density;
|
|
11
|
-
collapsible: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
const root: ComponentFunction<ListStyleProps> = (_, ...etc) => mx(...etc);
|
|
15
|
-
|
|
16
|
-
const item: ComponentFunction<ListStyleProps> = ({ collapsible }, ...etc) => mx(!collapsible && 'flex', ...etc);
|
|
17
|
-
|
|
18
|
-
const itemEndcap: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
19
|
-
mx(
|
|
20
|
-
density === 'lg' ? getSize(10) : density === 'sm' ? getSize(7) : density === 'xs' ? getSize(6) : getSize(8),
|
|
21
|
-
'shrink-0 flex items-center justify-center',
|
|
22
|
-
...etc,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const itemHeading: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
26
|
-
mx(densityBlockSize(density), 'flex items-center overflow-hidden [&>span]:truncate', ...etc);
|
|
27
|
-
|
|
28
|
-
const itemDragHandleIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) => mx(getSize(5), 'mt-2.5', ...etc);
|
|
29
|
-
|
|
30
|
-
const itemOpenTrigger: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
31
|
-
mx('w-5 rounded-sm flex justify-center items-center', densityBlockSize(density), ghostHover, 'dx-focus-ring', ...etc);
|
|
32
|
-
|
|
33
|
-
const itemOpenTriggerIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) => {
|
|
34
|
-
return mx(getSize(5), ...etc);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const listTheme: Theme<ListStyleProps> = {
|
|
38
|
-
root,
|
|
39
|
-
item: {
|
|
40
|
-
root: item,
|
|
41
|
-
endcap: itemEndcap,
|
|
42
|
-
heading: itemHeading,
|
|
43
|
-
dragHandleIcon: itemDragHandleIcon,
|
|
44
|
-
openTrigger: itemOpenTrigger,
|
|
45
|
-
openTriggerIcon: itemOpenTriggerIcon,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
LIST_ITEM_NAME,
|
|
11
|
-
LIST_NAME,
|
|
12
|
-
ListItemCollapsibleContent,
|
|
13
|
-
type ListItemCollapsibleContentProps,
|
|
14
|
-
type ListItemScopedProps,
|
|
15
|
-
List as ListPrimitive,
|
|
16
|
-
ListItem as ListPrimitiveItem,
|
|
17
|
-
ListItemHeading as ListPrimitiveItemHeading,
|
|
18
|
-
type ListItemHeadingProps as ListPrimitiveItemHeadingProps,
|
|
19
|
-
ListItemOpenTrigger as ListPrimitiveItemOpenTrigger,
|
|
20
|
-
type ListItemOpenTriggerProps as ListPrimitiveItemOpenTriggerProps,
|
|
21
|
-
type ListItemProps as ListPrimitiveItemProps,
|
|
22
|
-
type ListProps as ListPrimitiveProps,
|
|
23
|
-
type ListScopedProps,
|
|
24
|
-
useListContext,
|
|
25
|
-
useListItemContext,
|
|
26
|
-
} from '@dxos/react-list';
|
|
27
|
-
import { type Density } from '@dxos/ui-types';
|
|
28
|
-
|
|
29
|
-
import { useDensityContext, useThemeContext } from '../../hooks';
|
|
30
|
-
import { DensityProvider } from '../../primitives';
|
|
31
|
-
import { composable, composableProps } from '../../util';
|
|
32
|
-
import { type ThemedClassName } from '../../util';
|
|
33
|
-
import { Icon } from '../Icon';
|
|
34
|
-
import { ListDropIndicator } from './ListDropIndicator';
|
|
35
|
-
|
|
36
|
-
type ListProps = ThemedClassName<ListPrimitiveProps & { density?: Density }>;
|
|
37
|
-
|
|
38
|
-
const List = composable<HTMLOListElement, ListProps>(({ children, ...props }, forwardedRef) => {
|
|
39
|
-
const { tx } = useThemeContext();
|
|
40
|
-
const density = useDensityContext(props.density);
|
|
41
|
-
const { className, ...rest } = composableProps(props);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<DensityProvider density={density}>
|
|
45
|
-
<ListPrimitive {...rest} className={tx('list.root', {}, className)} ref={forwardedRef}>
|
|
46
|
-
{children}
|
|
47
|
-
</ListPrimitive>
|
|
48
|
-
</DensityProvider>
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
type ListItemEndcapProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { asChild?: boolean };
|
|
53
|
-
|
|
54
|
-
const ListItemEndcap = forwardRef<HTMLDivElement, ListItemEndcapProps>(
|
|
55
|
-
({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
56
|
-
const Comp = asChild ? Slot : Primitive.div;
|
|
57
|
-
const density = useDensityContext();
|
|
58
|
-
const { tx } = useThemeContext();
|
|
59
|
-
return (
|
|
60
|
-
<Comp
|
|
61
|
-
{...(!asChild && { role: 'none' })}
|
|
62
|
-
{...props}
|
|
63
|
-
className={tx('list.item.endcap', { density }, classNames)}
|
|
64
|
-
ref={forwardedRef}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
</Comp>
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const MockListItemOpenTrigger = ({
|
|
73
|
-
classNames,
|
|
74
|
-
...props
|
|
75
|
-
}: ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'children'>>) => {
|
|
76
|
-
const density = useDensityContext();
|
|
77
|
-
const { tx } = useThemeContext();
|
|
78
|
-
return <div {...props} className={tx('list.item.openTrigger', { density }, classNames)} />;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
type ListItemHeadingProps = ThemedClassName<ListPrimitiveItemHeadingProps>;
|
|
82
|
-
|
|
83
|
-
const ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(
|
|
84
|
-
({ children, classNames, ...props }, forwardedRef) => {
|
|
85
|
-
const { tx } = useThemeContext();
|
|
86
|
-
const density = useDensityContext();
|
|
87
|
-
return (
|
|
88
|
-
<ListPrimitiveItemHeading
|
|
89
|
-
{...props}
|
|
90
|
-
className={tx('list.item.heading', { density }, classNames)}
|
|
91
|
-
ref={forwardedRef}
|
|
92
|
-
>
|
|
93
|
-
<span>{children}</span>
|
|
94
|
-
</ListPrimitiveItemHeading>
|
|
95
|
-
);
|
|
96
|
-
},
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
type ListItemOpenTriggerProps = ThemedClassName<ListPrimitiveItemOpenTriggerProps>;
|
|
100
|
-
|
|
101
|
-
const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerProps>(
|
|
102
|
-
({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
103
|
-
const { tx } = useThemeContext();
|
|
104
|
-
const density = useDensityContext();
|
|
105
|
-
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
106
|
-
return (
|
|
107
|
-
<ListPrimitiveItemOpenTrigger
|
|
108
|
-
{...props}
|
|
109
|
-
className={tx('list.item.openTrigger', { density }, classNames)}
|
|
110
|
-
ref={forwardedRef}
|
|
111
|
-
>
|
|
112
|
-
{children || (
|
|
113
|
-
<Icon
|
|
114
|
-
size={3}
|
|
115
|
-
icon={open ? 'ph--caret-down--bold' : 'ph--caret-right--bold'}
|
|
116
|
-
classNames={tx('list.item.openTriggerIcon', {})}
|
|
117
|
-
/>
|
|
118
|
-
)}
|
|
119
|
-
</ListPrimitiveItemOpenTrigger>
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
type ListItemRootProps = ThemedClassName<ListPrimitiveItemProps>;
|
|
125
|
-
|
|
126
|
-
const ListItemRoot = forwardRef<HTMLLIElement, ListItemRootProps>(
|
|
127
|
-
({ classNames, children, ...props }, forwardedRef) => {
|
|
128
|
-
const { tx } = useThemeContext();
|
|
129
|
-
const density = useDensityContext();
|
|
130
|
-
return (
|
|
131
|
-
<ListPrimitiveItem
|
|
132
|
-
{...props}
|
|
133
|
-
className={tx('list.item.root', { density, collapsible: props.collapsible }, classNames)}
|
|
134
|
-
ref={forwardedRef}
|
|
135
|
-
>
|
|
136
|
-
{children}
|
|
137
|
-
</ListPrimitiveItem>
|
|
138
|
-
);
|
|
139
|
-
},
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
export const ListItem: {
|
|
143
|
-
Root: ForwardRefExoticComponent<ListItemRootProps>;
|
|
144
|
-
Endcap: ForwardRefExoticComponent<ListItemEndcapProps>;
|
|
145
|
-
Heading: ForwardRefExoticComponent<ListItemHeadingProps>;
|
|
146
|
-
OpenTrigger: ForwardRefExoticComponent<ListItemOpenTriggerProps>;
|
|
147
|
-
CollapsibleContent: ForwardRefExoticComponent<ListItemCollapsibleContentProps>;
|
|
148
|
-
MockOpenTrigger: FC<ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'children'>>>;
|
|
149
|
-
DropIndicator: typeof ListDropIndicator;
|
|
150
|
-
} = {
|
|
151
|
-
Root: ListItemRoot,
|
|
152
|
-
Endcap: ListItemEndcap,
|
|
153
|
-
Heading: ListItemHeading,
|
|
154
|
-
OpenTrigger: ListItemOpenTrigger,
|
|
155
|
-
CollapsibleContent: ListItemCollapsibleContent,
|
|
156
|
-
MockOpenTrigger: MockListItemOpenTrigger,
|
|
157
|
-
DropIndicator: ListDropIndicator,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export { List, useListContext, useListItemContext, LIST_NAME, LIST_ITEM_NAME };
|
|
161
|
-
|
|
162
|
-
export type {
|
|
163
|
-
ListProps,
|
|
164
|
-
ListScopedProps,
|
|
165
|
-
ListItemRootProps,
|
|
166
|
-
ListItemScopedProps,
|
|
167
|
-
ListItemEndcapProps,
|
|
168
|
-
ListItemHeadingProps,
|
|
169
|
-
ListItemOpenTriggerProps,
|
|
170
|
-
ListItemCollapsibleContentProps,
|
|
171
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/types';
|
|
6
|
-
import React, { type CSSProperties, type HTMLAttributes } from 'react';
|
|
7
|
-
|
|
8
|
-
type Orientation = 'horizontal' | 'vertical';
|
|
9
|
-
|
|
10
|
-
const edgeToOrientationMap: Record<Edge, Orientation> = {
|
|
11
|
-
top: 'horizontal',
|
|
12
|
-
bottom: 'horizontal',
|
|
13
|
-
left: 'vertical',
|
|
14
|
-
right: 'vertical',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['className']> = {
|
|
18
|
-
horizontal:
|
|
19
|
-
'h-(--line-thickness) left-[calc(var(--line-inset)+var(--terminal-radius))] right-(--line-inset) before:left-(--terminal-inset)',
|
|
20
|
-
vertical:
|
|
21
|
-
'w-(--line-thickness) top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-(--line-inset) before:top-(--terminal-inset)',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {
|
|
25
|
-
top: 'top-(--line-offset) before:top-(--offset-terminal)',
|
|
26
|
-
right: 'right-(--line-offset) before:right-(--offset-terminal)',
|
|
27
|
-
bottom: 'bottom-(--line-offset) before:bottom-(--offset-terminal)',
|
|
28
|
-
left: 'left-(--line-offset) before:left-(--offset-terminal)',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const strokeSize = 2;
|
|
32
|
-
const terminalSize = 8;
|
|
33
|
-
const offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
34
|
-
|
|
35
|
-
export type DropIndicatorProps = {
|
|
36
|
-
edge: Edge;
|
|
37
|
-
gap?: number;
|
|
38
|
-
terminalInset?: number;
|
|
39
|
-
lineInset?: number;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This is a tailwind port of `@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box`
|
|
44
|
-
*/
|
|
45
|
-
export const ListDropIndicator = ({
|
|
46
|
-
edge,
|
|
47
|
-
gap = 0,
|
|
48
|
-
lineInset = 0,
|
|
49
|
-
terminalInset = lineInset - terminalSize,
|
|
50
|
-
}: DropIndicatorProps) => {
|
|
51
|
-
const orientation = edgeToOrientationMap[edge];
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div
|
|
55
|
-
style={
|
|
56
|
-
{
|
|
57
|
-
'--line-thickness': `${strokeSize}px`,
|
|
58
|
-
'--line-offset': `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
59
|
-
'--line-inset': `${lineInset}px`,
|
|
60
|
-
'--terminal-size': `${terminalSize}px`,
|
|
61
|
-
'--terminal-radius': `${terminalSize / 2}px`,
|
|
62
|
-
'--terminal-inset': `${terminalInset}px`,
|
|
63
|
-
'--offset-terminal': `${offsetToAlignTerminalWithLine}px`,
|
|
64
|
-
} as CSSProperties
|
|
65
|
-
}
|
|
66
|
-
className={`absolute z-10 pointer-events-none bg-accent-bg before:content-[''] before:w-(--terminal-size) before:h-(--terminal-size) box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accent-bg before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
};
|