@dxos/react-ui 0.6.14-main.2b6a0f3 → 0.6.14-main.f49f251

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.
Files changed (29) hide show
  1. package/dist/lib/browser/index.mjs +697 -169
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +670 -140
  5. package/dist/lib/node/index.cjs.map +3 -3
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +697 -169
  8. package/dist/lib/node-esm/index.mjs.map +3 -3
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/Buttons/Button.d.ts +1 -1
  11. package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
  12. package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
  13. package/dist/types/src/components/Icon/Icon.d.ts +1 -1
  14. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  15. package/dist/types/src/components/Menus/DropdownMenu.d.ts +105 -44
  16. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
  17. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +25 -25
  18. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/Popover/Popover.d.ts +87 -21
  20. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  21. package/dist/types/src/components/Popover/Popover.stories.d.ts +16 -11
  22. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  23. package/package.json +25 -20
  24. package/src/components/Buttons/Button.tsx +46 -36
  25. package/src/components/Icon/Icon.tsx +11 -9
  26. package/src/components/Menus/DropdownMenu.stories.tsx +40 -1
  27. package/src/components/Menus/DropdownMenu.tsx +518 -69
  28. package/src/components/Popover/Popover.stories.tsx +24 -1
  29. package/src/components/Popover/Popover.tsx +524 -55
@@ -3,32 +3,29 @@ import React from 'react';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- Root: React.FC<import("@radix-ui/react-dropdown-menu").DropdownMenuProps>;
7
- Trigger: React.ForwardRefExoticComponent<import("@radix-ui/react-dropdown-menu").DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
8
- Portal: React.FC<import("@radix-ui/react-dropdown-menu").DropdownMenuPortalProps>;
9
- Content: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuContentProps, "className"> & {
10
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
11
- } & {
12
- constrainBlockSize?: boolean;
13
- } & React.RefAttributes<HTMLDivElement>>;
6
+ Root: React.FC<import("./DropdownMenu").DropdownMenuRootProps>;
7
+ Trigger: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
8
+ VirtualTrigger: {
9
+ (props: import("./DropdownMenu").DropdownMenuVirtualTriggerProps & {
10
+ __scopeDropdownMenu?: import("@radix-ui/react-context").Scope;
11
+ }): React.JSX.Element;
12
+ displayName: string;
13
+ };
14
+ Portal: React.FC<import("./DropdownMenu").DropdownMenuPortalProps>;
15
+ Content: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
14
16
  Viewport: React.ForwardRefExoticComponent<Omit<import("./DropdownMenu").DropdownMenuViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
- Arrow: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuArrowProps, "className"> & {
16
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
17
- } & React.RefAttributes<SVGSVGElement>>;
18
- Group: React.ForwardRefExoticComponent<import("@radix-ui/react-dropdown-menu").DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
19
- Item: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuItemProps, "className"> & {
20
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
21
- } & React.RefAttributes<HTMLDivElement>>;
22
- CheckboxItem: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuCheckboxItemProps, "className"> & {
23
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
24
- } & React.RefAttributes<HTMLDivElement>>;
25
- ItemIndicator: React.ForwardRefExoticComponent<import("@radix-ui/react-dropdown-menu").DropdownMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
26
- Separator: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuSeparatorProps, "className"> & {
27
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
28
- } & React.RefAttributes<HTMLDivElement>>;
29
- GroupLabel: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dropdown-menu").DropdownMenuLabelProps, "className"> & {
30
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
31
- } & React.RefAttributes<HTMLDivElement>>;
17
+ Group: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
18
+ GroupLabel: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
19
+ Item: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
20
+ CheckboxItem: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
21
+ RadioGroup: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
22
+ RadioItem: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
23
+ ItemIndicator: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
24
+ Separator: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
25
+ Arrow: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuArrowProps & React.RefAttributes<SVGSVGElement>>;
26
+ Sub: React.FC<import("./DropdownMenu").DropdownMenuSubProps>;
27
+ SubTrigger: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
28
+ SubContent: React.ForwardRefExoticComponent<import("./DropdownMenu").DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
32
29
  };
33
30
  render: () => React.JSX.Element;
34
31
  decorators: import("@storybook/react/*").Decorator[];
@@ -47,4 +44,7 @@ export declare const Default: {
47
44
  };
48
45
  };
49
46
  };
47
+ export declare const VirtualTrigger: {
48
+ render: () => React.JSX.Element;
49
+ };
50
50
  //# sourceMappingURL=DropdownMenu.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Menus/DropdownMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuF1B,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;;;CAKnB,CAAC"}
1
+ {"version":3,"file":"DropdownMenu.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Menus/DropdownMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA2B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFhD,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,cAAc;;CAqC1B,CAAC"}
@@ -1,32 +1,98 @@
1
- import { type PopoverProps as PopoverRootPrimitiveProps, type PopoverContentProps as PopoverContentPrimitiveProps, type PopoverTriggerProps as PopoverTriggerPrimitiveProps, type PopoverAnchorProps as PopoverAnchorPrimitiveProps, type PopoverPortalProps as PopoverPortalPrimitiveProps, type PopoverArrowProps as PopoverArrowPrimitiveProps, type PopoverCloseProps as PopoverClosePrimitiveProps } from '@radix-ui/react-popover';
1
+ import type { Scope } from '@radix-ui/react-context';
2
+ import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
3
+ import { FocusScope } from '@radix-ui/react-focus-scope';
4
+ import * as PopperPrimitive from '@radix-ui/react-popper';
5
+ import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
2
6
  import { Primitive } from '@radix-ui/react-primitive';
3
- import React, { type ComponentPropsWithRef } from 'react';
7
+ import React, { type ComponentPropsWithRef, type ElementRef, type RefObject, type ReactNode, type ComponentPropsWithoutRef } from 'react';
4
8
  import { type ThemedClassName } from '../../util';
5
- type PopoverRootProps = PopoverRootPrimitiveProps;
6
- type PopoverPortalProps = PopoverPortalPrimitiveProps;
7
- type PopoverTriggerProps = PopoverTriggerPrimitiveProps;
8
- type PopoverAnchorProps = PopoverAnchorPrimitiveProps;
9
- type PopoverCloseProps = PopoverClosePrimitiveProps;
10
- type PopoverArrowProps = ThemedClassName<PopoverArrowPrimitiveProps>;
11
- type PopoverContentProps = ThemedClassName<PopoverContentPrimitiveProps>;
9
+ type ScopedProps<P> = P & {
10
+ __scopePopover?: Scope;
11
+ };
12
+ declare const createPopoverScope: import("@radix-ui/react-context").CreateScope;
13
+ interface PopoverRootProps {
14
+ children?: ReactNode;
15
+ open?: boolean;
16
+ defaultOpen?: boolean;
17
+ onOpenChange?: (open: boolean) => void;
18
+ modal?: boolean;
19
+ }
20
+ type PopperAnchorProps = ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
21
+ interface PopoverAnchorProps extends PopperAnchorProps {
22
+ }
23
+ type PopoverTriggerElement = ElementRef<typeof Primitive.button>;
24
+ type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
25
+ interface PopoverTriggerProps extends PrimitiveButtonProps {
26
+ }
27
+ interface PopoverVirtualTriggerProps {
28
+ virtualRef: RefObject<PopoverTriggerElement>;
29
+ }
30
+ type PortalProps = ComponentPropsWithoutRef<typeof PortalPrimitive>;
31
+ interface PopoverPortalProps {
32
+ children?: ReactNode;
33
+ /**
34
+ * Specify a container element to portal the content into.
35
+ */
36
+ container?: PortalProps['container'];
37
+ /**
38
+ * Used to force mounting when more control is needed. Useful when
39
+ * controlling animation with React animation libraries.
40
+ */
41
+ forceMount?: true;
42
+ }
43
+ interface PopoverContentProps extends PopoverContentTypeProps {
44
+ /**
45
+ * Used to force mounting when more control is needed. Useful when
46
+ * controlling animation with React animation libraries.
47
+ */
48
+ forceMount?: true;
49
+ }
50
+ interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
51
+ }
52
+ type FocusScopeProps = ComponentPropsWithoutRef<typeof FocusScope>;
53
+ type DismissableLayerProps = ComponentPropsWithoutRef<typeof DismissableLayer>;
54
+ type PopperContentProps = ThemedClassName<ComponentPropsWithoutRef<typeof PopperPrimitive.Content>>;
55
+ interface PopoverContentImplProps extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {
56
+ /**
57
+ * Whether focus should be trapped within the `Popover`
58
+ * (default: false)
59
+ */
60
+ trapFocus?: FocusScopeProps['trapped'];
61
+ /**
62
+ * Event handler called when auto-focusing on open.
63
+ * Can be prevented.
64
+ */
65
+ onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
66
+ /**
67
+ * Event handler called when auto-focusing on close.
68
+ * Can be prevented.
69
+ */
70
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
71
+ }
72
+ interface PopoverCloseProps extends PrimitiveButtonProps {
73
+ }
74
+ type PopperArrowProps = ThemedClassName<ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>>;
75
+ interface PopoverArrowProps extends PopperArrowProps {
76
+ }
12
77
  type PopoverViewportProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
13
78
  asChild?: boolean;
14
79
  constrainInline?: boolean;
15
80
  constrainBlock?: boolean;
16
81
  };
17
82
  export declare const Popover: {
18
- Root: React.FunctionComponent<PopoverRootPrimitiveProps>;
19
- Portal: React.FC<PopoverPortalPrimitiveProps>;
20
- Trigger: React.ForwardRefExoticComponent<PopoverTriggerPrimitiveProps & React.RefAttributes<HTMLButtonElement>>;
21
- Anchor: React.ForwardRefExoticComponent<PopoverAnchorPrimitiveProps & React.RefAttributes<HTMLDivElement>>;
22
- Arrow: React.ForwardRefExoticComponent<Omit<PopoverArrowPrimitiveProps, "className"> & {
23
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
24
- } & React.RefAttributes<SVGSVGElement>>;
25
- Close: React.ForwardRefExoticComponent<PopoverClosePrimitiveProps & React.RefAttributes<HTMLButtonElement>>;
26
- Content: React.ForwardRefExoticComponent<Omit<PopoverContentPrimitiveProps, "className"> & {
27
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
28
- } & React.RefAttributes<HTMLDivElement>>;
83
+ Root: React.FC<PopoverRootProps>;
84
+ Anchor: React.ForwardRefExoticComponent<PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
85
+ Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
86
+ VirtualTrigger: {
87
+ (props: ScopedProps<PopoverVirtualTriggerProps>): React.JSX.Element;
88
+ displayName: string;
89
+ };
90
+ Portal: React.FC<PopoverPortalProps>;
91
+ Content: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
92
+ Close: React.ForwardRefExoticComponent<PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
93
+ Arrow: React.ForwardRefExoticComponent<PopoverArrowProps & React.RefAttributes<SVGSVGElement>>;
29
94
  Viewport: React.ForwardRefExoticComponent<Omit<PopoverViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
95
  };
31
- export type { PopoverRootProps, PopoverPortalProps, PopoverTriggerProps, PopoverAnchorProps, PopoverArrowProps, PopoverCloseProps, PopoverContentProps, PopoverViewportProps, };
96
+ export { createPopoverScope };
97
+ export type { PopoverRootProps, PopoverAnchorProps, PopoverTriggerProps, PopoverVirtualTriggerProps, PopoverPortalProps, PopoverContentProps, PopoverCloseProps, PopoverArrowProps, PopoverViewportProps, };
32
98
  //# sourceMappingURL=Popover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,YAAY,IAAI,yBAAyB,EAC9C,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,kBAAkB,IAAI,2BAA2B,EAEtD,KAAK,kBAAkB,IAAI,2BAA2B,EAEtD,KAAK,iBAAiB,IAAI,0BAA0B,EAEpD,KAAK,iBAAiB,IAAI,0BAA0B,EAErD,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,EAAsC,MAAM,OAAO,CAAC;AAG9F,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,KAAK,gBAAgB,GAAG,yBAAyB,CAAC;AAIlD,KAAK,kBAAkB,GAAG,2BAA2B,CAAC;AAItD,KAAK,mBAAmB,GAAG,4BAA4B,CAAC;AAIxD,KAAK,kBAAkB,GAAG,2BAA2B,CAAC;AAItD,KAAK,iBAAiB,GAAG,0BAA0B,CAAC;AAIpD,KAAK,iBAAiB,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC;AAarE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AAe,CAAC,OAAO,CAAC,CAAC,CAAC;AACpG,UAAU,uBACR,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAC1C,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAEtD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AA2ED,UAAU,iBAAkB,SAAQ,oBAAoB;CAAG;AA0B3D,KAAK,gBAAgB,GAAG,eAAe,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAChG,UAAU,iBAAkB,SAAQ,gBAAgB;CAAG;AAwBvD,KAAK,oBAAoB,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IACzF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,OAAO;;;;;gBA7XkB,WAAW,CAAC,0BAA0B,CAAC;;;;;;;;CAuY5E,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,CAAC"}
@@ -3,17 +3,19 @@ import React, { type PropsWithChildren, type ReactNode } from 'react';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- Root: React.FunctionComponent<import("@radix-ui/react-popover").PopoverProps>;
7
- Portal: React.FC<import("@radix-ui/react-popover").PopoverPortalProps>;
8
- Trigger: React.ForwardRefExoticComponent<import("@radix-ui/react-popover").PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
9
- Anchor: React.ForwardRefExoticComponent<import("@radix-ui/react-popover").PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
10
- Arrow: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-popover").PopoverArrowProps, "className"> & {
11
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
12
- } & React.RefAttributes<SVGSVGElement>>;
13
- Close: React.ForwardRefExoticComponent<import("@radix-ui/react-popover").PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
14
- Content: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-popover").PopoverContentProps, "className"> & {
15
- classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
16
- } & React.RefAttributes<HTMLDivElement>>;
6
+ Root: React.FC<import("./Popover").PopoverRootProps>;
7
+ Anchor: React.ForwardRefExoticComponent<import("./Popover").PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
8
+ Trigger: React.ForwardRefExoticComponent<import("./Popover").PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
9
+ VirtualTrigger: {
10
+ (props: import("./Popover").PopoverVirtualTriggerProps & {
11
+ __scopePopover?: import("@radix-ui/react-context").Scope;
12
+ }): React.JSX.Element;
13
+ displayName: string;
14
+ };
15
+ Portal: React.FC<import("./Popover").PopoverPortalProps>;
16
+ Content: React.ForwardRefExoticComponent<import("./Popover").PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
17
+ Close: React.ForwardRefExoticComponent<import("./Popover").PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
18
+ Arrow: React.ForwardRefExoticComponent<import("./Popover").PopoverArrowProps & React.RefAttributes<SVGSVGElement>>;
17
19
  Viewport: React.ForwardRefExoticComponent<Omit<import("./Popover").PopoverViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
20
  };
19
21
  render: ({ openTrigger, children }: PropsWithChildren<{
@@ -33,4 +35,7 @@ export declare const Default: {
33
35
  children: string;
34
36
  };
35
37
  };
38
+ export declare const VirtualTrigger: {
39
+ render: () => React.JSX.Element;
40
+ };
36
41
  //# sourceMappingURL=Popover.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/Popover.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;wCAUjB,iBAAiB,CAAC;QAAE,WAAW,EAAE,SAAS,CAAA;KAAE,CAAC;;;;;;;;AAclG,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC"}
1
+ {"version":3,"file":"Popover.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/Popover.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;wCAUnC,iBAAiB,CAAC;QAAE,WAAW,EAAE,SAAS,CAAA;KAAE,CAAC;;;;;;;;AAclG,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,cAAc;;CAqB1B,CAAC"}
package/package.json CHANGED
@@ -1,20 +1,17 @@
1
1
  {
2
2
  "name": "@dxos/react-ui",
3
- "version": "0.6.14-main.2b6a0f3",
3
+ "version": "0.6.14-main.f49f251",
4
4
  "description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
- "sideEffects": false,
9
+ "sideEffects": true,
10
10
  "exports": {
11
11
  ".": {
12
+ "types": "./dist/types/src/index.d.ts",
12
13
  "browser": "./dist/lib/browser/index.mjs",
13
- "node": {
14
- "require": "./dist/lib/node/index.cjs",
15
- "default": "./dist/lib/node-esm/index.mjs"
16
- },
17
- "types": "./dist/types/src/index.d.ts"
14
+ "node": "./dist/lib/node-esm/index.mjs"
18
15
  }
19
16
  },
20
17
  "types": "dist/types/src/index.d.ts",
@@ -27,6 +24,7 @@
27
24
  ],
28
25
  "dependencies": {
29
26
  "@fluentui/react-tabster": "^9.19.0",
27
+ "@radix-ui/primitive": "^1.0.0",
30
28
  "@radix-ui/react-alert-dialog": "^1.0.3",
31
29
  "@radix-ui/react-avatar": "^1.0.2",
32
30
  "@radix-ui/react-checkbox": "^1.0.3",
@@ -35,9 +33,14 @@
35
33
  "@radix-ui/react-context": "^1.0.0",
36
34
  "@radix-ui/react-context-menu": "^2.1.5",
37
35
  "@radix-ui/react-dialog": "^1.0.3",
38
- "@radix-ui/react-dropdown-menu": "2.0.7-rc.10",
39
- "@radix-ui/react-popover": "1.0.8-rc.8",
36
+ "@radix-ui/react-dismissable-layer": "^1.1.1",
37
+ "@radix-ui/react-focus-guards": "^1.1.1",
38
+ "@radix-ui/react-focus-scope": "^1.1.0",
39
+ "@radix-ui/react-id": "^1.1.0",
40
+ "@radix-ui/react-menu": "^2.0.6",
40
41
  "@radix-ui/react-popper": "^1.1.2",
42
+ "@radix-ui/react-portal": "^1.1.2",
43
+ "@radix-ui/react-presence": "^1.1.1",
41
44
  "@radix-ui/react-primitive": "^1.0.2",
42
45
  "@radix-ui/react-scroll-area": "^1.0.3",
43
46
  "@radix-ui/react-select": "^1.2.1",
@@ -50,17 +53,19 @@
50
53
  "@radix-ui/react-toolbar": "^1.0.3",
51
54
  "@radix-ui/react-tooltip": "^1.1.2",
52
55
  "@radix-ui/react-use-controllable-state": "^1.0.0",
56
+ "aria-hidden": "^1.2.4",
53
57
  "date-fns": "^3.3.1",
54
58
  "i18next": "^21.10.0",
55
59
  "keyborg": "^2.5.0",
56
60
  "react-i18next": "^11.18.6",
57
- "@dxos/debug": "0.6.14-main.2b6a0f3",
58
- "@dxos/log": "0.6.14-main.2b6a0f3",
59
- "@dxos/react-hooks": "0.6.14-main.2b6a0f3",
60
- "@dxos/react-input": "0.6.14-main.2b6a0f3",
61
- "@dxos/react-ui-types": "0.6.14-main.2b6a0f3",
62
- "@dxos/util": "0.6.14-main.2b6a0f3",
63
- "@dxos/react-list": "0.6.14-main.2b6a0f3"
61
+ "react-remove-scroll": "^2.6.0",
62
+ "@dxos/log": "0.6.14-main.f49f251",
63
+ "@dxos/debug": "0.6.14-main.f49f251",
64
+ "@dxos/react-hooks": "0.6.14-main.f49f251",
65
+ "@dxos/react-input": "0.6.14-main.f49f251",
66
+ "@dxos/react-list": "0.6.14-main.f49f251",
67
+ "@dxos/util": "0.6.14-main.f49f251",
68
+ "@dxos/react-ui-types": "0.6.14-main.f49f251"
64
69
  },
65
70
  "devDependencies": {
66
71
  "@dnd-kit/core": "^6.0.5",
@@ -72,15 +77,15 @@
72
77
  "react": "~18.2.0",
73
78
  "react-dom": "~18.2.0",
74
79
  "vite": "5.4.7",
75
- "@dxos/random": "0.6.14-main.2b6a0f3",
76
- "@dxos/util": "0.6.14-main.2b6a0f3",
77
- "@dxos/react-ui-theme": "0.6.14-main.2b6a0f3"
80
+ "@dxos/random": "0.6.14-main.f49f251",
81
+ "@dxos/react-ui-theme": "0.6.14-main.f49f251",
82
+ "@dxos/util": "0.6.14-main.f49f251"
78
83
  },
79
84
  "peerDependencies": {
80
85
  "@phosphor-icons/react": "^2.1.5",
81
86
  "react": "~18.2.0",
82
87
  "react-dom": "~18.2.0",
83
- "@dxos/react-ui-theme": "0.6.14-main.2b6a0f3"
88
+ "@dxos/react-ui-theme": "0.6.14-main.f49f251"
84
89
  },
85
90
  "publishConfig": {
86
91
  "access": "public"
@@ -5,7 +5,7 @@
5
5
  import { createContext } from '@radix-ui/react-context';
6
6
  import { Primitive } from '@radix-ui/react-primitive';
7
7
  import { Slot } from '@radix-ui/react-slot';
8
- import React, { type ComponentPropsWithRef, forwardRef } from 'react';
8
+ import React, { type ComponentPropsWithRef, forwardRef, memo } from 'react';
9
9
 
10
10
  import { type Density, type Elevation } from '@dxos/react-ui-types';
11
11
 
@@ -27,41 +27,51 @@ const [ButtonGroupProvider, useButtonGroupContext] = createContext<ButtonGroupCo
27
27
  inGroup: false,
28
28
  });
29
29
 
30
- const Button = forwardRef<HTMLButtonElement, ButtonProps>(
31
- (
32
- { classNames, children, density: propsDensity, elevation: propsElevation, variant = 'default', asChild, ...props },
33
- ref,
34
- ) => {
35
- const { inGroup } = useButtonGroupContext(BUTTON_NAME);
36
- const { tx } = useThemeContext();
37
- const elevation = useElevationContext(propsElevation);
38
- const density = useDensityContext(propsDensity);
39
- const Root = asChild ? Slot : Primitive.button;
40
- return (
41
- <Root
42
- ref={ref}
43
- {...props}
44
- data-variant={variant}
45
- data-density={density}
46
- data-props={inGroup ? 'grouped' : ''}
47
- className={tx(
48
- 'button.root',
49
- 'button',
50
- {
51
- variant,
52
- inGroup,
53
- disabled: props.disabled,
54
- density,
55
- elevation,
56
- },
57
- classNames,
58
- )}
59
- {...(props.disabled && { disabled: true })}
60
- >
61
- {children}
62
- </Root>
63
- );
64
- },
30
+ const Button = memo(
31
+ forwardRef<HTMLButtonElement, ButtonProps>(
32
+ (
33
+ {
34
+ classNames,
35
+ children,
36
+ density: propsDensity,
37
+ elevation: propsElevation,
38
+ variant = 'default',
39
+ asChild,
40
+ ...props
41
+ },
42
+ ref,
43
+ ) => {
44
+ const { inGroup } = useButtonGroupContext(BUTTON_NAME);
45
+ const { tx } = useThemeContext();
46
+ const elevation = useElevationContext(propsElevation);
47
+ const density = useDensityContext(propsDensity);
48
+ const Root = asChild ? Slot : Primitive.button;
49
+ return (
50
+ <Root
51
+ ref={ref}
52
+ {...props}
53
+ data-variant={variant}
54
+ data-density={density}
55
+ data-props={inGroup ? 'grouped' : ''}
56
+ className={tx(
57
+ 'button.root',
58
+ 'button',
59
+ {
60
+ variant,
61
+ inGroup,
62
+ disabled: props.disabled,
63
+ density,
64
+ elevation,
65
+ },
66
+ classNames,
67
+ )}
68
+ {...(props.disabled && { disabled: true })}
69
+ >
70
+ {children}
71
+ </Root>
72
+ );
73
+ },
74
+ ),
65
75
  );
66
76
 
67
77
  Button.displayName = BUTTON_NAME;
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Primitive } from '@radix-ui/react-primitive';
6
- import React, { type ComponentPropsWithRef, forwardRef } from 'react';
6
+ import React, { type ComponentPropsWithRef, forwardRef, memo } from 'react';
7
7
 
8
8
  import { type Size } from '@dxos/react-ui-types';
9
9
 
@@ -12,11 +12,13 @@ import { type ThemedClassName } from '../../util';
12
12
 
13
13
  export type IconProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.svg>> & { icon: string; size?: Size };
14
14
 
15
- export const Icon = forwardRef<SVGSVGElement, IconProps>(({ icon, classNames, size, ...props }, forwardedRef) => {
16
- const { tx } = useThemeContext();
17
- return (
18
- <svg {...props} className={tx('icon.root', 'icon', { size }, classNames)} ref={forwardedRef}>
19
- <use href={`/icons.svg#${icon}`} />
20
- </svg>
21
- );
22
- });
15
+ export const Icon = memo(
16
+ forwardRef<SVGSVGElement, IconProps>(({ icon, classNames, size, ...props }, forwardedRef) => {
17
+ const { tx } = useThemeContext();
18
+ return (
19
+ <svg {...props} className={tx('icon.root', 'icon', { size }, classNames)} ref={forwardedRef}>
20
+ <use href={`/icons.svg#${icon}`} />
21
+ </svg>
22
+ );
23
+ }),
24
+ );
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import React from 'react';
7
+ import React, { useRef, useState } from 'react';
8
8
 
9
9
  import { DropdownMenu } from './DropdownMenu';
10
10
  import { withTheme } from '../../testing';
@@ -105,3 +105,42 @@ export const Default = {
105
105
  chromatic: { delay: 1600 },
106
106
  },
107
107
  };
108
+
109
+ export const VirtualTrigger = {
110
+ render: () => {
111
+ const [menuOpen, setMenuOpen] = useState(true);
112
+ const buttonRef = useRef<HTMLButtonElement | null>(null);
113
+ return (
114
+ <>
115
+ <Button onClick={() => setMenuOpen(true)} ref={buttonRef}>
116
+ Customise options
117
+ </Button>
118
+ <DropdownMenu.Root open={menuOpen} onOpenChange={setMenuOpen}>
119
+ <DropdownMenu.VirtualTrigger virtualRef={buttonRef} />
120
+ <DropdownMenu.Content sideOffset={4} collisionPadding={8}>
121
+ <DropdownMenu.Viewport>
122
+ <DropdownMenu.Item>
123
+ <span className='grow'>New Tab</span>
124
+ <span className='opacity-50'>⌘+T</span>
125
+ </DropdownMenu.Item>
126
+ <DropdownMenu.Item>
127
+ <span className='grow'>New Window</span>
128
+ <span className='opacity-50'>⌘+N</span>
129
+ </DropdownMenu.Item>
130
+ <DropdownMenu.Item disabled>
131
+ <span className='grow'>New Private Window</span>
132
+ <span className='opacity-50'>⇧+⌘+N</span>
133
+ </DropdownMenu.Item>
134
+
135
+ <DropdownMenu.Separator />
136
+
137
+ <DropdownMenu.GroupLabel>People</DropdownMenu.GroupLabel>
138
+ </DropdownMenu.Viewport>
139
+
140
+ <DropdownMenu.Arrow />
141
+ </DropdownMenu.Content>
142
+ </DropdownMenu.Root>
143
+ </>
144
+ );
145
+ },
146
+ };