@dxos/react-ui 0.7.5-labs.e27f9b9 → 0.7.5-labs.ea4b4c2

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.
@@ -85,7 +85,7 @@ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLa
85
85
  inOverlayLayout: false,
86
86
  });
87
87
 
88
- type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps> & { blockAlign?: 'center' | 'start' };
88
+ type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps> & { blockAlign?: 'center' | 'start' | 'end' };
89
89
 
90
90
  const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<HTMLDivElement, DialogOverlayProps>(
91
91
  ({ classNames, children, blockAlign, ...props }, forwardedRef) => {
@@ -106,17 +106,22 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
106
106
 
107
107
  DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
108
108
 
109
- type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps>;
109
+ type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps> & { inOverlayLayout?: boolean };
110
110
 
111
111
  const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
112
- ({ classNames, children, ...props }, forwardedRef) => {
112
+ ({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
113
113
  const { tx } = useThemeContext();
114
114
  const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
115
115
 
116
116
  return (
117
117
  <DialogContentPrimitive
118
118
  {...props}
119
- className={tx('dialog.content', 'dialog', { inOverlayLayout }, classNames)}
119
+ className={tx(
120
+ 'dialog.content',
121
+ 'dialog',
122
+ { inOverlayLayout: propsInOverlayLayout || inOverlayLayout },
123
+ classNames,
124
+ )}
120
125
  ref={forwardedRef}
121
126
  >
122
127
  {children}
@@ -15,8 +15,10 @@ const edgeToOrientationMap: Record<Edge, Orientation> = {
15
15
  };
16
16
 
17
17
  const orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['className']> = {
18
- horizontal: 'h-[--line-thickness] left-[--terminal-radius] right-0 before:left-[--negative-terminal-size]',
19
- vertical: 'w-[--line-thickness] top-[--terminal-radius] bottom-0 before:top-[--negative-terminal-size]',
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]',
20
22
  };
21
23
 
22
24
  const edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {
@@ -33,14 +35,19 @@ const offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
33
35
  export type DropIndicatorProps = {
34
36
  edge: Edge;
35
37
  gap?: number;
38
+ terminalInset?: number;
39
+ lineInset?: number;
36
40
  };
37
41
 
38
42
  /**
39
43
  * This is a tailwind port of `@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box`
40
44
  */
41
- export const ListDropIndicator = ({ edge, gap = 0 }: DropIndicatorProps) => {
42
- const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize}px))`;
43
-
45
+ export const ListDropIndicator = ({
46
+ edge,
47
+ gap = 0,
48
+ lineInset = 0,
49
+ terminalInset = lineInset - terminalSize,
50
+ }: DropIndicatorProps) => {
44
51
  const orientation = edgeToOrientationMap[edge];
45
52
 
46
53
  return (
@@ -49,10 +56,11 @@ export const ListDropIndicator = ({ edge, gap = 0 }: DropIndicatorProps) => {
49
56
  style={
50
57
  {
51
58
  '--line-thickness': `${strokeSize}px`,
52
- '--line-offset': `${lineOffset}`,
59
+ '--line-offset': `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
60
+ '--line-inset': `${lineInset}px`,
53
61
  '--terminal-size': `${terminalSize}px`,
54
62
  '--terminal-radius': `${terminalSize / 2}px`,
55
- '--negative-terminal-size': `-${terminalSize}px`,
63
+ '--terminal-inset': `${terminalInset}px`,
56
64
  '--offset-terminal': `${offsetToAlignTerminalWithLine}px`,
57
65
  } as CSSProperties
58
66
  }