@mirohq/design-system-popover 6.3.49 → 6.3.50-reactdismissablelayer.0
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/main.js +28 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +29 -2
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +19 -5
- package/package.json +8 -7
package/dist/main.js
CHANGED
|
@@ -10,6 +10,7 @@ var designSystemExperiments = require('@mirohq/design-system-experiments');
|
|
|
10
10
|
var designSystemStyles = require('@mirohq/design-system-styles');
|
|
11
11
|
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
12
12
|
var designSystemIcons = require('@mirohq/design-system-icons');
|
|
13
|
+
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
13
14
|
|
|
14
15
|
function _interopNamespaceDefault(e) {
|
|
15
16
|
var n = Object.create(null);
|
|
@@ -245,6 +246,32 @@ const Close = React.forwardRef((props, forwardRef) => {
|
|
|
245
246
|
|
|
246
247
|
const Portal = (props) => /* @__PURE__ */ jsxRuntime.jsx(RadixPopover.Portal, { ...props });
|
|
247
248
|
|
|
249
|
+
const Anchor = React.forwardRef(
|
|
250
|
+
({ virtualRef, ...restProps }, forwardRef) => {
|
|
251
|
+
const anchorRef = React.useRef(null);
|
|
252
|
+
if (virtualRef != null) {
|
|
253
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
+
RadixPopover__namespace.Anchor,
|
|
255
|
+
{
|
|
256
|
+
...restProps,
|
|
257
|
+
virtualRef,
|
|
258
|
+
ref: forwardRef
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
264
|
+
RadixPopover__namespace.Anchor,
|
|
265
|
+
{
|
|
266
|
+
...restProps,
|
|
267
|
+
ref: designSystemUtils.mergeRefs([forwardRef, anchorRef])
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Anchor, { virtualRef: anchorRef })
|
|
271
|
+
] });
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
|
|
248
275
|
const Root = ({
|
|
249
276
|
open,
|
|
250
277
|
onOpen,
|
|
@@ -298,7 +325,7 @@ Popover.Trigger = Trigger;
|
|
|
298
325
|
Popover.Content = Content;
|
|
299
326
|
Popover.Close = Close;
|
|
300
327
|
Popover.Portal = Portal;
|
|
301
|
-
Popover.Anchor =
|
|
328
|
+
Popover.Anchor = Anchor;
|
|
302
329
|
|
|
303
330
|
var types = /*#__PURE__*/Object.freeze({
|
|
304
331
|
__proto__: null
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/content.styled.tsx","../src/partials/line.styled.tsx","../src/partials/line.tsx","../src/partials/arrow.styled.tsx","../src/use-popover-context.tsx","../src/partials/arrow.tsx","../src/partials/content.tsx","../src/partials/close.styled.tsx","../src/partials/close.tsx","../src/partials/portal.tsx","../src/popover.tsx"],"sourcesContent":["import { Trigger as RadixTrigger } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(RadixTrigger)\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\n\nexport interface TriggerProps extends StyledTriggerProps {}\n\n/**\n * The trigger component is used to render the trigger element for the popover.\n */\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>((props, forwardRef) => <StyledTrigger {...props} ref={forwardRef} />)\n","import { Content as RadixContent } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { floating, animations } from '@mirohq/design-system-styles'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$popover-background',\n color: '$text-on-static-dark-subtle',\n padding: '$200 $300 $200 $200',\n fontSize: '14px',\n lineHeight: '20px',\n variants: {\n canvas26: {\n true: { padding: '$200 $400 $200 $200' },\n false: {},\n },\n variant: {\n light: {\n ...floating.css({\n radius: '$popover',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n background: '$white',\n color: '$black',\n },\n dark: {\n ...floating.css({\n radius: '$popover',\n shadow: 'none',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n border: '1px solid $popover-border',\n },\n },\n },\n zIndex: '$popover',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const LINE_HEIGHT = 50\nexport const LINE_WIDTH = 6\n\nexport const StyledLine = styled(Primitive.svg, {\n display: 'block',\n width: `${LINE_WIDTH}px`,\n height: `${LINE_HEIGHT}px`,\n fill: '$popover-background',\n stroke: '$popover-border',\n})\n\nexport type StyledLineProps = StrictComponentProps<typeof StyledLine>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nimport { LINE_HEIGHT, LINE_WIDTH, StyledLine } from './line.styled'\nimport type { StyledLineProps } from './line.styled'\n\nexport interface LineProps extends StyledLineProps {}\n\nexport const Line = React.forwardRef<ElementRef<typeof StyledLine>, LineProps>(\n (props, forwardRef) => (\n // We have to use RadixArrow with asChild here instead of styling it,\n // otherwise it's not possible to pass children, it will use arrow svg.\n // In this case asChild won't merge the nodes, but will apply some properties to the first child,\n // so we also need to add an additional span to avoid Stitches error.\n // In the end we get 2 nodes: Radix's span with positioning, span with radix svg props and our svg with styling\n <RadixArrow asChild>\n <span>\n <StyledLine ref={forwardRef} {...props} aria-hidden viewBox='0 0 6 50'>\n <rect\n x={LINE_WIDTH / 2 - 0.5}\n y='0'\n width='1'\n height={LINE_HEIGHT - LINE_WIDTH}\n />\n <circle\n cx={LINE_WIDTH / 2}\n cy={LINE_HEIGHT - LINE_WIDTH / 2}\n r={LINE_WIDTH / 2}\n />\n </StyledLine>\n </span>\n </RadixArrow>\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nexport const StyledArrow = styled(RadixArrow, {\n fill: '$popover-background',\n height: '$1',\n paddingX: '2px',\n width: '$3',\n variants: {\n variant: {\n light: {\n fill: '$white',\n },\n dark: {},\n },\n },\n})\n\nexport type StyledArrowProps = StrictComponentProps<typeof StyledArrow>\n","import React, { createContext, useContext } from 'react'\n\nimport type { Variant } from './types'\n\ninterface PopoverValues {\n children: React.ReactNode\n variant?: Variant\n}\n\ninterface PopoverContextProps {\n variant?: Variant\n}\n\nconst PopoverContext = createContext<PopoverContextProps>({} as any)\n\n/**\n * The PopoverProvider is used to manage the state of the popover,\n * when it opens or closes, and what triggers it.\n */\nexport const PopoverProvider = ({\n children,\n variant,\n}: PopoverValues): React.ReactNode => (\n <PopoverContext.Provider\n value={{\n variant,\n }}\n >\n {children}\n </PopoverContext.Provider>\n)\n\n/**\n * The usePopoverContext hook is used to access the state of the popover.\n */\nexport const usePopoverContext = (): PopoverContextProps =>\n useContext(PopoverContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledArrow } from './arrow.styled'\nimport type { StyledArrowProps } from './arrow.styled'\nimport { usePopoverContext } from '../use-popover-context'\n\nexport interface ArrowProps extends StyledArrowProps {\n /**\n * The appearance of arrow.\n */\n variant?: StyledArrowProps['variant']\n}\n\nexport const Arrow = React.forwardRef<\n ElementRef<typeof StyledArrow>,\n ArrowProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n return (\n <StyledArrow {...props} variant={variant} aria-hidden ref={forwardRef} />\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\nimport { StyledContent } from './content.styled'\nimport { Line } from './line'\nimport { Arrow } from './arrow'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledContentProps } from './content.styled'\nimport type {\n Align,\n Side,\n AnchorType,\n PointerDownOutsideEvent,\n FocusOutsideEvent,\n} from '../types'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment option.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger's edge to the popover's anchor.\n * Works only with the \"arrow\" or \"none\" anchor.\n * @default 0\n */\n sideOffset?: number\n\n /**\n * The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * The distance in pixels from the boundary edges where collision detection\n * should occur. Accepts a number (same for all sides).\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * The type of anchor to render.\n * @default 'line'\n */\n anchor?: AnchorType\n\n /**\n * Whether to render in a Portal when open.\n */\n portalled?: boolean\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default false\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n\n /**\n * Event handler called when focus moves outside the bounds of the component.\n * It can be prevented by calling event.preventDefault.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when an interaction (pointer or focus event) happens\n * outside the bounds of the component. It can be prevented by calling\n * event.preventDefault.\n */\n onInteractOutside?: (\n event: PointerDownOutsideEvent | FocusOutsideEvent\n ) => void\n\n /**\n * Event handler called when focus moves into the component after opening.\n * It can be prevented by calling event.preventDefault().\n */\n onOpenAutoFocus?: (event: Event) => void\n\n /**\n * Event handler called when focus moves to the trigger after closing.\n * It can be prevented by calling event.preventDefault().\n */\n onCloseAutoFocus?: (event: Event) => void\n}\n\n/**\n * The content component is used to render rich content elements for the popover.\n */\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n sideOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n side = 'top',\n children,\n anchor = 'line',\n sticky = 'partial',\n hideWhenDetached = false,\n ...restProps\n },\n forwardRef\n ) => {\n const { variant } = usePopoverContext()\n const [canvas26] = useCanvas26()\n\n const anchorEl = React.useMemo(() => {\n switch (anchor) {\n case 'arrow':\n return <Arrow />\n case 'line':\n return <Line />\n default:\n return null\n }\n }, [anchor])\n\n return (\n <StyledContent\n {...restProps}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n side={side}\n sideOffset={sideOffset}\n ref={forwardRef}\n role='dialog'\n aria-modal='true'\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n variant={variant}\n canvas26={canvas26}\n >\n {children}\n {anchorEl}\n </StyledContent>\n )\n }\n)\n","import { Close as RadixClose } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { focus } from '@mirohq/design-system-styles'\n\nexport const StyledClose = styled(RadixClose, {\n all: 'unset',\n fontFamily: 'inherit',\n height: '$6',\n width: '$6',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: '$icon-on-static-dark-subtle',\n position: 'absolute',\n top: '5px',\n right: '5px',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&:hover': {\n backgroundColor: 'rgba(255, 255, 255, 0.12)',\n },\n '&:focus-visible': {\n ...focus.css({\n boxShadow: '$focus',\n }),\n },\n\n variants: {\n variant: {\n light: {\n color: '$black',\n },\n dark: {\n '&:focus-visible': {\n boxShadow: '0 0 0 2px #0F0F0F, 0 0 0 4px $colors$focus-keyboard',\n },\n },\n },\n },\n})\n\nexport type StyledCloseProps = StrictComponentProps<typeof StyledClose>\n","import React from 'react'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport type { ElementRef } from 'react'\n\nimport { StyledClose } from './close.styled'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledCloseProps } from './close.styled'\n\nexport interface CloseProps extends StyledCloseProps {\n /**\n * The appearance of close's button.\n */\n variant?: StyledCloseProps['variant']\n}\n\nexport const Close = React.forwardRef<\n ElementRef<typeof StyledClose>,\n CloseProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n\n return (\n <StyledClose\n {...props}\n ref={forwardRef}\n data-testid='close-icon'\n variant={variant}\n >\n <IconCross size='small' />\n </StyledClose>\n )\n})\n","import React from 'react'\nimport type { PopoverPortalProps } from '@radix-ui/react-popover'\nimport { Portal as RadixPortal } from '@radix-ui/react-popover'\n\nexport interface PortalProps extends PopoverPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries. If used on this part,\n * it will be inherited by Popover.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\n","import React, { useEffect } from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport {\n BaseTooltipProvider,\n useBaseTooltipContext,\n} from '@mirohq/design-system-base-tooltip'\nimport { usePrevious } from '@mirohq/design-system-use-previous'\n\nimport { Trigger } from './partials/trigger'\nimport { Content } from './partials/content'\nimport { Close } from './partials/close'\nimport { Portal } from './partials/portal'\nimport { PopoverProvider } from './use-popover-context'\nimport type { Variant } from './types'\n\nexport interface PopoverProps {\n /**\n * The current controlled state of the popover.\n */\n open?: boolean\n\n /**\n * The initial open state of the popover. Use when you don't need to control\n * its open state.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Event handler called when the popover opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the popover closes.\n */\n onClose?: () => void\n\n /**\n * Defines whether the interaction with outside elements will be enabled.\n */\n interactOutside?: boolean\n\n /**\n * Change the popover's appearance.\n * @default 'dark'\n */\n variant?: Variant\n\n /**\n * The content.\n */\n children: React.ReactNode\n}\n\nconst Root = ({\n open,\n onOpen,\n onClose,\n ...restProps\n}: PopoverProps): React.ReactNode => {\n const { ignoreNextTooltip } = useBaseTooltipContext()\n const prevOpen = usePrevious(open)\n\n useEffect(() => {\n if (prevOpen === true && open === false) {\n ignoreNextTooltip()\n }\n }, [ignoreNextTooltip, open, prevOpen])\n\n return (\n <RadixPopover.Root\n open={open}\n {...restProps}\n onOpenChange={value => {\n if (value) {\n onOpen?.()\n } else {\n if (open === undefined) {\n ignoreNextTooltip()\n }\n onClose?.()\n }\n }}\n modal={false}\n />\n )\n}\n\nexport const Popover: ((props: PopoverProps) => React.ReactNode) & Partials = ({\n open,\n defaultOpen = false,\n onOpen,\n onClose,\n variant = 'dark',\n ...restProps\n}) => (\n <PopoverProvider variant={variant}>\n <BaseTooltipProvider>\n <Root\n {...restProps}\n open={open}\n defaultOpen={defaultOpen}\n onOpen={onOpen}\n onClose={onClose}\n />\n </BaseTooltipProvider>\n </PopoverProvider>\n)\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Close: typeof Close\n Portal: typeof Portal\n Anchor: typeof RadixPopover.Anchor\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\nPopover.Close = Close\nPopover.Portal = Portal\nPopover.Anchor = RadixPopover.Anchor\n"],"names":["styled","RadixTrigger","jsx","RadixContent","floating","animations","Primitive","RadixArrow","jsxs","createContext","useContext","useCanvas26","RadixClose","focus","IconCross","RadixPortal","useBaseTooltipContext","usePrevious","useEffect","RadixPopover","BaseTooltipProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,aAAA,GAAgBA,4BAAOC,oBAAY,CAAA;;ACOzC,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAG3B,CAAC,KAAA,EAAO,UAAA,qBAAeC,cAAA,CAAC,aAAA,EAAA,EAAe,GAAG,KAAA,EAAO,GAAA,EAAK,UAAA,EAAY,CAAE,CAAA;;ACT/D,MAAM,aAAA,GAAgBF,4BAAOG,oBAAA,EAAc;AAAA,EAChD,eAAA,EAAiB,qBAAA;AAAA,EACjB,KAAA,EAAO,6BAAA;AAAA,EACP,OAAA,EAAS,qBAAA;AAAA,EACT,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,MAAA;AAAA,EACZ,QAAA,EAAU;AAAA,IACR,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,EAAE,OAAA,EAAS,qBAAA,EAAsB;AAAA,MACvC,OAAO;AAAC,KACV;AAAA,IACA,OAAA,EAAS;AAAA,MACP,KAAA,EAAO;AAAA,QACL,GAAGC,4BAAS,GAAA,CAAI;AAAA,UACd,MAAA,EAAQ,UAAA;AAAA,UACR,W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AAA,EAAA,EAAgB,OAAA,EACf,QAAA,kBAAAA,cAAA,CAACkB,2CAAA,EAAA,EACC,QAAA,kBAAAlB,cAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA;AACF,CAAA,EACF,CAAA,EACF;AAcF,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAChB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,SAASiB,uBAAA,CAAa,MAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/content.styled.tsx","../src/partials/line.styled.tsx","../src/partials/line.tsx","../src/partials/arrow.styled.tsx","../src/use-popover-context.tsx","../src/partials/arrow.tsx","../src/partials/content.tsx","../src/partials/close.styled.tsx","../src/partials/close.tsx","../src/partials/portal.tsx","../src/partials/anchor.tsx","../src/popover.tsx"],"sourcesContent":["import { Trigger as RadixTrigger } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(RadixTrigger)\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\n\nexport interface TriggerProps extends StyledTriggerProps {}\n\n/**\n * The trigger component is used to render the trigger element for the popover.\n */\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>((props, forwardRef) => <StyledTrigger {...props} ref={forwardRef} />)\n","import { Content as RadixContent } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { floating, animations } from '@mirohq/design-system-styles'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$popover-background',\n color: '$text-on-static-dark-subtle',\n padding: '$200 $300 $200 $200',\n fontSize: '14px',\n lineHeight: '20px',\n variants: {\n canvas26: {\n true: { padding: '$200 $400 $200 $200' },\n false: {},\n },\n variant: {\n light: {\n ...floating.css({\n radius: '$popover',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n background: '$white',\n color: '$black',\n },\n dark: {\n ...floating.css({\n radius: '$popover',\n shadow: 'none',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n border: '1px solid $popover-border',\n },\n },\n },\n zIndex: '$popover',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const LINE_HEIGHT = 50\nexport const LINE_WIDTH = 6\n\nexport const StyledLine = styled(Primitive.svg, {\n display: 'block',\n width: `${LINE_WIDTH}px`,\n height: `${LINE_HEIGHT}px`,\n fill: '$popover-background',\n stroke: '$popover-border',\n})\n\nexport type StyledLineProps = StrictComponentProps<typeof StyledLine>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nimport { LINE_HEIGHT, LINE_WIDTH, StyledLine } from './line.styled'\nimport type { StyledLineProps } from './line.styled'\n\nexport interface LineProps extends StyledLineProps {}\n\nexport const Line = React.forwardRef<ElementRef<typeof StyledLine>, LineProps>(\n (props, forwardRef) => (\n // We have to use RadixArrow with asChild here instead of styling it,\n // otherwise it's not possible to pass children, it will use arrow svg.\n // In this case asChild won't merge the nodes, but will apply some properties to the first child,\n // so we also need to add an additional span to avoid Stitches error.\n // In the end we get 2 nodes: Radix's span with positioning, span with radix svg props and our svg with styling\n <RadixArrow asChild>\n <span>\n <StyledLine ref={forwardRef} {...props} aria-hidden viewBox='0 0 6 50'>\n <rect\n x={LINE_WIDTH / 2 - 0.5}\n y='0'\n width='1'\n height={LINE_HEIGHT - LINE_WIDTH}\n />\n <circle\n cx={LINE_WIDTH / 2}\n cy={LINE_HEIGHT - LINE_WIDTH / 2}\n r={LINE_WIDTH / 2}\n />\n </StyledLine>\n </span>\n </RadixArrow>\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nexport const StyledArrow = styled(RadixArrow, {\n fill: '$popover-background',\n height: '$1',\n paddingX: '2px',\n width: '$3',\n variants: {\n variant: {\n light: {\n fill: '$white',\n },\n dark: {},\n },\n },\n})\n\nexport type StyledArrowProps = StrictComponentProps<typeof StyledArrow>\n","import React, { createContext, useContext } from 'react'\n\nimport type { Variant } from './types'\n\ninterface PopoverValues {\n children: React.ReactNode\n variant?: Variant\n}\n\ninterface PopoverContextProps {\n variant?: Variant\n}\n\nconst PopoverContext = createContext<PopoverContextProps>({} as any)\n\n/**\n * The PopoverProvider is used to manage the state of the popover,\n * when it opens or closes, and what triggers it.\n */\nexport const PopoverProvider = ({\n children,\n variant,\n}: PopoverValues): React.ReactNode => (\n <PopoverContext.Provider\n value={{\n variant,\n }}\n >\n {children}\n </PopoverContext.Provider>\n)\n\n/**\n * The usePopoverContext hook is used to access the state of the popover.\n */\nexport const usePopoverContext = (): PopoverContextProps =>\n useContext(PopoverContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledArrow } from './arrow.styled'\nimport type { StyledArrowProps } from './arrow.styled'\nimport { usePopoverContext } from '../use-popover-context'\n\nexport interface ArrowProps extends StyledArrowProps {\n /**\n * The appearance of arrow.\n */\n variant?: StyledArrowProps['variant']\n}\n\nexport const Arrow = React.forwardRef<\n ElementRef<typeof StyledArrow>,\n ArrowProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n return (\n <StyledArrow {...props} variant={variant} aria-hidden ref={forwardRef} />\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\nimport { StyledContent } from './content.styled'\nimport { Line } from './line'\nimport { Arrow } from './arrow'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledContentProps } from './content.styled'\nimport type {\n Align,\n Side,\n AnchorType,\n PointerDownOutsideEvent,\n FocusOutsideEvent,\n} from '../types'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment option.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger's edge to the popover's anchor.\n * Works only with the \"arrow\" or \"none\" anchor.\n * @default 0\n */\n sideOffset?: number\n\n /**\n * The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * The distance in pixels from the boundary edges where collision detection\n * should occur. Accepts a number (same for all sides).\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * The type of anchor to render.\n * @default 'line'\n */\n anchor?: AnchorType\n\n /**\n * Whether to render in a Portal when open.\n */\n portalled?: boolean\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default false\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n\n /**\n * Event handler called when focus moves outside the bounds of the component.\n * It can be prevented by calling event.preventDefault.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when an interaction (pointer or focus event) happens\n * outside the bounds of the component. It can be prevented by calling\n * event.preventDefault.\n */\n onInteractOutside?: (\n event: PointerDownOutsideEvent | FocusOutsideEvent\n ) => void\n\n /**\n * Event handler called when focus moves into the component after opening.\n * It can be prevented by calling event.preventDefault().\n */\n onOpenAutoFocus?: (event: Event) => void\n\n /**\n * Event handler called when focus moves to the trigger after closing.\n * It can be prevented by calling event.preventDefault().\n */\n onCloseAutoFocus?: (event: Event) => void\n}\n\n/**\n * The content component is used to render rich content elements for the popover.\n */\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n sideOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n side = 'top',\n children,\n anchor = 'line',\n sticky = 'partial',\n hideWhenDetached = false,\n ...restProps\n },\n forwardRef\n ) => {\n const { variant } = usePopoverContext()\n const [canvas26] = useCanvas26()\n\n const anchorEl = React.useMemo(() => {\n switch (anchor) {\n case 'arrow':\n return <Arrow />\n case 'line':\n return <Line />\n default:\n return null\n }\n }, [anchor])\n\n return (\n <StyledContent\n {...restProps}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n side={side}\n sideOffset={sideOffset}\n ref={forwardRef}\n role='dialog'\n aria-modal='true'\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n variant={variant}\n canvas26={canvas26}\n >\n {children}\n {anchorEl}\n </StyledContent>\n )\n }\n)\n","import { Close as RadixClose } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { focus } from '@mirohq/design-system-styles'\n\nexport const StyledClose = styled(RadixClose, {\n all: 'unset',\n fontFamily: 'inherit',\n height: '$6',\n width: '$6',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: '$icon-on-static-dark-subtle',\n position: 'absolute',\n top: '5px',\n right: '5px',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&:hover': {\n backgroundColor: 'rgba(255, 255, 255, 0.12)',\n },\n '&:focus-visible': {\n ...focus.css({\n boxShadow: '$focus',\n }),\n },\n\n variants: {\n variant: {\n light: {\n color: '$black',\n },\n dark: {\n '&:focus-visible': {\n boxShadow: '0 0 0 2px #0F0F0F, 0 0 0 4px $colors$focus-keyboard',\n },\n },\n },\n },\n})\n\nexport type StyledCloseProps = StrictComponentProps<typeof StyledClose>\n","import React from 'react'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport type { ElementRef } from 'react'\n\nimport { StyledClose } from './close.styled'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledCloseProps } from './close.styled'\n\nexport interface CloseProps extends StyledCloseProps {\n /**\n * The appearance of close's button.\n */\n variant?: StyledCloseProps['variant']\n}\n\nexport const Close = React.forwardRef<\n ElementRef<typeof StyledClose>,\n CloseProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n\n return (\n <StyledClose\n {...props}\n ref={forwardRef}\n data-testid='close-icon'\n variant={variant}\n >\n <IconCross size='small' />\n </StyledClose>\n )\n})\n","import React from 'react'\nimport type { PopoverPortalProps } from '@radix-ui/react-popover'\nimport { Portal as RadixPortal } from '@radix-ui/react-popover'\n\nexport interface PortalProps extends PopoverPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries. If used on this part,\n * it will be inherited by Popover.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\n","import React from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport { mergeRefs } from '@mirohq/design-system-utils'\n\nexport type AnchorProps = React.ComponentPropsWithoutRef<\n typeof RadixPopover.Anchor\n>\n\n/**\n * The anchor component positions the popover against an element other than the\n * trigger.\n *\n * Radix uses the trigger as the anchor until a custom one registers, then\n * re-renders without wrapping the trigger — which unmounts the node the popper\n * captured. Since `@radix-ui/react-popper` 1.3 the popper records an anchor\n * only when a ref attaches, and never when one detaches, so that swap leaves it\n * measuring the discarded trigger and the content collapses into the corner of\n * the viewport. The second, element-less anchor restates the same node through\n * `virtualRef`, which the popper re-reads on every render and so survives the\n * swap.\n */\nexport const Anchor = React.forwardRef<HTMLDivElement, AnchorProps>(\n ({ virtualRef, ...restProps }, forwardRef) => {\n const anchorRef = React.useRef<HTMLDivElement>(null)\n\n // Anchoring to a virtual element already goes through the per-render path,\n // so it needs no help and renders no element of its own.\n if (virtualRef != null) {\n return (\n <RadixPopover.Anchor\n {...restProps}\n virtualRef={virtualRef}\n ref={forwardRef}\n />\n )\n }\n\n return (\n <>\n <RadixPopover.Anchor\n {...restProps}\n ref={mergeRefs([forwardRef, anchorRef])}\n />\n <RadixPopover.Anchor virtualRef={anchorRef} />\n </>\n )\n }\n)\n","import React, { useEffect } from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport {\n BaseTooltipProvider,\n useBaseTooltipContext,\n} from '@mirohq/design-system-base-tooltip'\nimport { usePrevious } from '@mirohq/design-system-use-previous'\n\nimport { Trigger } from './partials/trigger'\nimport { Content } from './partials/content'\nimport { Close } from './partials/close'\nimport { Portal } from './partials/portal'\nimport { Anchor } from './partials/anchor'\nimport { PopoverProvider } from './use-popover-context'\nimport type { Variant } from './types'\n\nexport interface PopoverProps {\n /**\n * The current controlled state of the popover.\n */\n open?: boolean\n\n /**\n * The initial open state of the popover. Use when you don't need to control\n * its open state.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Event handler called when the popover opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the popover closes.\n */\n onClose?: () => void\n\n /**\n * Defines whether the interaction with outside elements will be enabled.\n */\n interactOutside?: boolean\n\n /**\n * Change the popover's appearance.\n * @default 'dark'\n */\n variant?: Variant\n\n /**\n * The content.\n */\n children: React.ReactNode\n}\n\nconst Root = ({\n open,\n onOpen,\n onClose,\n ...restProps\n}: PopoverProps): React.ReactNode => {\n const { ignoreNextTooltip } = useBaseTooltipContext()\n const prevOpen = usePrevious(open)\n\n useEffect(() => {\n if (prevOpen === true && open === false) {\n ignoreNextTooltip()\n }\n }, [ignoreNextTooltip, open, prevOpen])\n\n return (\n <RadixPopover.Root\n open={open}\n {...restProps}\n onOpenChange={value => {\n if (value) {\n onOpen?.()\n } else {\n if (open === undefined) {\n ignoreNextTooltip()\n }\n onClose?.()\n }\n }}\n modal={false}\n />\n )\n}\n\nexport const Popover: ((props: PopoverProps) => React.ReactNode) & Partials = ({\n open,\n defaultOpen = false,\n onOpen,\n onClose,\n variant = 'dark',\n ...restProps\n}) => (\n <PopoverProvider variant={variant}>\n <BaseTooltipProvider>\n <Root\n {...restProps}\n open={open}\n defaultOpen={defaultOpen}\n onOpen={onOpen}\n onClose={onClose}\n />\n </BaseTooltipProvider>\n </PopoverProvider>\n)\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Close: typeof Close\n Portal: typeof Portal\n Anchor: typeof Anchor\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\nPopover.Close = Close\nPopover.Portal = Portal\nPopover.Anchor = Anchor\n"],"names":["styled","RadixTrigger","jsx","RadixContent","floating","animations","Primitive","RadixArrow","jsxs","createContext","useContext","useCanvas26","RadixClose","focus","IconCross","RadixPortal","RadixPopover","Fragment","mergeRefs","useBaseTooltipContext","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F,CAAA;AAAA,MACA,KAAA,EAAO;AAAA;AAAA,GACT;AAEJ,CAAA;AAEO,MAAM,UAAiE,CAAC;AAAA,EAC7E,IAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA,GAAU,MAAA;AAAA,EACV,GAAG;AACL,CAAA,qBACEd,cAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EACf,QAAA,kBAAAA,cAAA,CAACoB,2CAAA,EAAA,EACC,QAAA,kBAAApB,cAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA;AACF,CAAA,EACF,CAAA,EACF;AAcF,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAChB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,MAAA,GAAS,MAAA;;;;;;;;;"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { createContext, useContext, useEffect } from 'react';
|
|
3
3
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
4
4
|
import { Trigger as Trigger$1, Content as Content$1, Arrow as Arrow$1, Close as Close$1, Portal as Portal$1 } from '@radix-ui/react-popover';
|
|
@@ -9,6 +9,7 @@ import { useCanvas26 } from '@mirohq/design-system-experiments';
|
|
|
9
9
|
import { floating, animations, focus } from '@mirohq/design-system-styles';
|
|
10
10
|
import { Primitive } from '@mirohq/design-system-primitive';
|
|
11
11
|
import { IconCross } from '@mirohq/design-system-icons';
|
|
12
|
+
import { mergeRefs } from '@mirohq/design-system-utils';
|
|
12
13
|
|
|
13
14
|
const StyledTrigger = styled(Trigger$1);
|
|
14
15
|
|
|
@@ -225,6 +226,32 @@ const Close = React.forwardRef((props, forwardRef) => {
|
|
|
225
226
|
|
|
226
227
|
const Portal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
|
|
227
228
|
|
|
229
|
+
const Anchor = React.forwardRef(
|
|
230
|
+
({ virtualRef, ...restProps }, forwardRef) => {
|
|
231
|
+
const anchorRef = React.useRef(null);
|
|
232
|
+
if (virtualRef != null) {
|
|
233
|
+
return /* @__PURE__ */ jsx(
|
|
234
|
+
RadixPopover.Anchor,
|
|
235
|
+
{
|
|
236
|
+
...restProps,
|
|
237
|
+
virtualRef,
|
|
238
|
+
ref: forwardRef
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
RadixPopover.Anchor,
|
|
245
|
+
{
|
|
246
|
+
...restProps,
|
|
247
|
+
ref: mergeRefs([forwardRef, anchorRef])
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
/* @__PURE__ */ jsx(RadixPopover.Anchor, { virtualRef: anchorRef })
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
|
|
228
255
|
const Root = ({
|
|
229
256
|
open,
|
|
230
257
|
onOpen,
|
|
@@ -278,7 +305,7 @@ Popover.Trigger = Trigger;
|
|
|
278
305
|
Popover.Content = Content;
|
|
279
306
|
Popover.Close = Close;
|
|
280
307
|
Popover.Portal = Portal;
|
|
281
|
-
Popover.Anchor =
|
|
308
|
+
Popover.Anchor = Anchor;
|
|
282
309
|
|
|
283
310
|
var types = /*#__PURE__*/Object.freeze({
|
|
284
311
|
__proto__: null
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/content.styled.tsx","../src/partials/line.styled.tsx","../src/partials/line.tsx","../src/partials/arrow.styled.tsx","../src/use-popover-context.tsx","../src/partials/arrow.tsx","../src/partials/content.tsx","../src/partials/close.styled.tsx","../src/partials/close.tsx","../src/partials/portal.tsx","../src/popover.tsx"],"sourcesContent":["import { Trigger as RadixTrigger } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(RadixTrigger)\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\n\nexport interface TriggerProps extends StyledTriggerProps {}\n\n/**\n * The trigger component is used to render the trigger element for the popover.\n */\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>((props, forwardRef) => <StyledTrigger {...props} ref={forwardRef} />)\n","import { Content as RadixContent } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { floating, animations } from '@mirohq/design-system-styles'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$popover-background',\n color: '$text-on-static-dark-subtle',\n padding: '$200 $300 $200 $200',\n fontSize: '14px',\n lineHeight: '20px',\n variants: {\n canvas26: {\n true: { padding: '$200 $400 $200 $200' },\n false: {},\n },\n variant: {\n light: {\n ...floating.css({\n radius: '$popover',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n background: '$white',\n color: '$black',\n },\n dark: {\n ...floating.css({\n radius: '$popover',\n shadow: 'none',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n border: '1px solid $popover-border',\n },\n },\n },\n zIndex: '$popover',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const LINE_HEIGHT = 50\nexport const LINE_WIDTH = 6\n\nexport const StyledLine = styled(Primitive.svg, {\n display: 'block',\n width: `${LINE_WIDTH}px`,\n height: `${LINE_HEIGHT}px`,\n fill: '$popover-background',\n stroke: '$popover-border',\n})\n\nexport type StyledLineProps = StrictComponentProps<typeof StyledLine>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nimport { LINE_HEIGHT, LINE_WIDTH, StyledLine } from './line.styled'\nimport type { StyledLineProps } from './line.styled'\n\nexport interface LineProps extends StyledLineProps {}\n\nexport const Line = React.forwardRef<ElementRef<typeof StyledLine>, LineProps>(\n (props, forwardRef) => (\n // We have to use RadixArrow with asChild here instead of styling it,\n // otherwise it's not possible to pass children, it will use arrow svg.\n // In this case asChild won't merge the nodes, but will apply some properties to the first child,\n // so we also need to add an additional span to avoid Stitches error.\n // In the end we get 2 nodes: Radix's span with positioning, span with radix svg props and our svg with styling\n <RadixArrow asChild>\n <span>\n <StyledLine ref={forwardRef} {...props} aria-hidden viewBox='0 0 6 50'>\n <rect\n x={LINE_WIDTH / 2 - 0.5}\n y='0'\n width='1'\n height={LINE_HEIGHT - LINE_WIDTH}\n />\n <circle\n cx={LINE_WIDTH / 2}\n cy={LINE_HEIGHT - LINE_WIDTH / 2}\n r={LINE_WIDTH / 2}\n />\n </StyledLine>\n </span>\n </RadixArrow>\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nexport const StyledArrow = styled(RadixArrow, {\n fill: '$popover-background',\n height: '$1',\n paddingX: '2px',\n width: '$3',\n variants: {\n variant: {\n light: {\n fill: '$white',\n },\n dark: {},\n },\n },\n})\n\nexport type StyledArrowProps = StrictComponentProps<typeof StyledArrow>\n","import React, { createContext, useContext } from 'react'\n\nimport type { Variant } from './types'\n\ninterface PopoverValues {\n children: React.ReactNode\n variant?: Variant\n}\n\ninterface PopoverContextProps {\n variant?: Variant\n}\n\nconst PopoverContext = createContext<PopoverContextProps>({} as any)\n\n/**\n * The PopoverProvider is used to manage the state of the popover,\n * when it opens or closes, and what triggers it.\n */\nexport const PopoverProvider = ({\n children,\n variant,\n}: PopoverValues): React.ReactNode => (\n <PopoverContext.Provider\n value={{\n variant,\n }}\n >\n {children}\n </PopoverContext.Provider>\n)\n\n/**\n * The usePopoverContext hook is used to access the state of the popover.\n */\nexport const usePopoverContext = (): PopoverContextProps =>\n useContext(PopoverContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledArrow } from './arrow.styled'\nimport type { StyledArrowProps } from './arrow.styled'\nimport { usePopoverContext } from '../use-popover-context'\n\nexport interface ArrowProps extends StyledArrowProps {\n /**\n * The appearance of arrow.\n */\n variant?: StyledArrowProps['variant']\n}\n\nexport const Arrow = React.forwardRef<\n ElementRef<typeof StyledArrow>,\n ArrowProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n return (\n <StyledArrow {...props} variant={variant} aria-hidden ref={forwardRef} />\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\nimport { StyledContent } from './content.styled'\nimport { Line } from './line'\nimport { Arrow } from './arrow'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledContentProps } from './content.styled'\nimport type {\n Align,\n Side,\n AnchorType,\n PointerDownOutsideEvent,\n FocusOutsideEvent,\n} from '../types'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment option.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger's edge to the popover's anchor.\n * Works only with the \"arrow\" or \"none\" anchor.\n * @default 0\n */\n sideOffset?: number\n\n /**\n * The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * The distance in pixels from the boundary edges where collision detection\n * should occur. Accepts a number (same for all sides).\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * The type of anchor to render.\n * @default 'line'\n */\n anchor?: AnchorType\n\n /**\n * Whether to render in a Portal when open.\n */\n portalled?: boolean\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default false\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n\n /**\n * Event handler called when focus moves outside the bounds of the component.\n * It can be prevented by calling event.preventDefault.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when an interaction (pointer or focus event) happens\n * outside the bounds of the component. It can be prevented by calling\n * event.preventDefault.\n */\n onInteractOutside?: (\n event: PointerDownOutsideEvent | FocusOutsideEvent\n ) => void\n\n /**\n * Event handler called when focus moves into the component after opening.\n * It can be prevented by calling event.preventDefault().\n */\n onOpenAutoFocus?: (event: Event) => void\n\n /**\n * Event handler called when focus moves to the trigger after closing.\n * It can be prevented by calling event.preventDefault().\n */\n onCloseAutoFocus?: (event: Event) => void\n}\n\n/**\n * The content component is used to render rich content elements for the popover.\n */\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n sideOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n side = 'top',\n children,\n anchor = 'line',\n sticky = 'partial',\n hideWhenDetached = false,\n ...restProps\n },\n forwardRef\n ) => {\n const { variant } = usePopoverContext()\n const [canvas26] = useCanvas26()\n\n const anchorEl = React.useMemo(() => {\n switch (anchor) {\n case 'arrow':\n return <Arrow />\n case 'line':\n return <Line />\n default:\n return null\n }\n }, [anchor])\n\n return (\n <StyledContent\n {...restProps}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n side={side}\n sideOffset={sideOffset}\n ref={forwardRef}\n role='dialog'\n aria-modal='true'\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n variant={variant}\n canvas26={canvas26}\n >\n {children}\n {anchorEl}\n </StyledContent>\n )\n }\n)\n","import { Close as RadixClose } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { focus } from '@mirohq/design-system-styles'\n\nexport const StyledClose = styled(RadixClose, {\n all: 'unset',\n fontFamily: 'inherit',\n height: '$6',\n width: '$6',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: '$icon-on-static-dark-subtle',\n position: 'absolute',\n top: '5px',\n right: '5px',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&:hover': {\n backgroundColor: 'rgba(255, 255, 255, 0.12)',\n },\n '&:focus-visible': {\n ...focus.css({\n boxShadow: '$focus',\n }),\n },\n\n variants: {\n variant: {\n light: {\n color: '$black',\n },\n dark: {\n '&:focus-visible': {\n boxShadow: '0 0 0 2px #0F0F0F, 0 0 0 4px $colors$focus-keyboard',\n },\n },\n },\n },\n})\n\nexport type StyledCloseProps = StrictComponentProps<typeof StyledClose>\n","import React from 'react'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport type { ElementRef } from 'react'\n\nimport { StyledClose } from './close.styled'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledCloseProps } from './close.styled'\n\nexport interface CloseProps extends StyledCloseProps {\n /**\n * The appearance of close's button.\n */\n variant?: StyledCloseProps['variant']\n}\n\nexport const Close = React.forwardRef<\n ElementRef<typeof StyledClose>,\n CloseProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n\n return (\n <StyledClose\n {...props}\n ref={forwardRef}\n data-testid='close-icon'\n variant={variant}\n >\n <IconCross size='small' />\n </StyledClose>\n )\n})\n","import React from 'react'\nimport type { PopoverPortalProps } from '@radix-ui/react-popover'\nimport { Portal as RadixPortal } from '@radix-ui/react-popover'\n\nexport interface PortalProps extends PopoverPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries. If used on this part,\n * it will be inherited by Popover.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\n","import React, { useEffect } from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport {\n BaseTooltipProvider,\n useBaseTooltipContext,\n} from '@mirohq/design-system-base-tooltip'\nimport { usePrevious } from '@mirohq/design-system-use-previous'\n\nimport { Trigger } from './partials/trigger'\nimport { Content } from './partials/content'\nimport { Close } from './partials/close'\nimport { Portal } from './partials/portal'\nimport { PopoverProvider } from './use-popover-context'\nimport type { Variant } from './types'\n\nexport interface PopoverProps {\n /**\n * The current controlled state of the popover.\n */\n open?: boolean\n\n /**\n * The initial open state of the popover. Use when you don't need to control\n * its open state.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Event handler called when the popover opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the popover closes.\n */\n onClose?: () => void\n\n /**\n * Defines whether the interaction with outside elements will be enabled.\n */\n interactOutside?: boolean\n\n /**\n * Change the popover's appearance.\n * @default 'dark'\n */\n variant?: Variant\n\n /**\n * The content.\n */\n children: React.ReactNode\n}\n\nconst Root = ({\n open,\n onOpen,\n onClose,\n ...restProps\n}: PopoverProps): React.ReactNode => {\n const { ignoreNextTooltip } = useBaseTooltipContext()\n const prevOpen = usePrevious(open)\n\n useEffect(() => {\n if (prevOpen === true && open === false) {\n ignoreNextTooltip()\n }\n }, [ignoreNextTooltip, open, prevOpen])\n\n return (\n <RadixPopover.Root\n open={open}\n {...restProps}\n onOpenChange={value => {\n if (value) {\n onOpen?.()\n } else {\n if (open === undefined) {\n ignoreNextTooltip()\n }\n onClose?.()\n }\n }}\n modal={false}\n />\n )\n}\n\nexport const Popover: ((props: PopoverProps) => React.ReactNode) & Partials = ({\n open,\n defaultOpen = false,\n onOpen,\n onClose,\n variant = 'dark',\n ...restProps\n}) => (\n <PopoverProvider variant={variant}>\n <BaseTooltipProvider>\n <Root\n {...restProps}\n open={open}\n defaultOpen={defaultOpen}\n onOpen={onOpen}\n onClose={onClose}\n />\n </BaseTooltipProvider>\n </PopoverProvider>\n)\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Close: typeof Close\n Portal: typeof Portal\n Anchor: typeof RadixPopover.Anchor\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\nPopover.Close = Close\nPopover.Portal = Portal\nPopover.Anchor = RadixPopover.Anchor\n"],"names":["RadixTrigger","RadixContent","RadixArrow","RadixClose","RadixPortal"],"mappings":";;;;;;;;;;;;AAIO,MAAM,aAAA,GAAgB,OAAOA,SAAY,CAAA;;ACOzC,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAG3B,CAAC,KAAA,EAAO,UAAA,qBAAe,GAAA,CAAC,aAAA,EAAA,EAAe,GAAG,K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AAA,MAAA,EAAA;AAAA,QACF,CAAA,MAAO;AACL,UAAA,IAAI,SAAS,MAAA,EAAW;AACtB,YAAA,iBAAA,EAAkB;AAAA,UACpB;AACA,UAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,EAAA;AAAA,QACF;AAAA,MACF,CAAA;AAAA,MACA,KAAA,EAAO;AAAA;AAAA,GACT;AAEJ,CAAA;AAEO,MAAM,UAAiE,CAAC;AAAA,EAC7E,IAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA,GAAU,MAAA;AAAA,EACV,GAAG;AACL,CAAA,qBACE,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EACf,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA;AACF,CAAA,EACF,CAAA,EACF;AAcF,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAChB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,SAAS,YAAA,CAAa,MAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/content.styled.tsx","../src/partials/line.styled.tsx","../src/partials/line.tsx","../src/partials/arrow.styled.tsx","../src/use-popover-context.tsx","../src/partials/arrow.tsx","../src/partials/content.tsx","../src/partials/close.styled.tsx","../src/partials/close.tsx","../src/partials/portal.tsx","../src/partials/anchor.tsx","../src/popover.tsx"],"sourcesContent":["import { Trigger as RadixTrigger } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(RadixTrigger)\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\n\nexport interface TriggerProps extends StyledTriggerProps {}\n\n/**\n * The trigger component is used to render the trigger element for the popover.\n */\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>((props, forwardRef) => <StyledTrigger {...props} ref={forwardRef} />)\n","import { Content as RadixContent } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { floating, animations } from '@mirohq/design-system-styles'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$popover-background',\n color: '$text-on-static-dark-subtle',\n padding: '$200 $300 $200 $200',\n fontSize: '14px',\n lineHeight: '20px',\n variants: {\n canvas26: {\n true: { padding: '$200 $400 $200 $200' },\n false: {},\n },\n variant: {\n light: {\n ...floating.css({\n radius: '$popover',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n background: '$white',\n color: '$black',\n },\n dark: {\n ...floating.css({\n radius: '$popover',\n shadow: 'none',\n animation: { in: animations.fadeIn, out: animations.fadeOut },\n }),\n border: '1px solid $popover-border',\n },\n },\n },\n zIndex: '$popover',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const LINE_HEIGHT = 50\nexport const LINE_WIDTH = 6\n\nexport const StyledLine = styled(Primitive.svg, {\n display: 'block',\n width: `${LINE_WIDTH}px`,\n height: `${LINE_HEIGHT}px`,\n fill: '$popover-background',\n stroke: '$popover-border',\n})\n\nexport type StyledLineProps = StrictComponentProps<typeof StyledLine>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nimport { LINE_HEIGHT, LINE_WIDTH, StyledLine } from './line.styled'\nimport type { StyledLineProps } from './line.styled'\n\nexport interface LineProps extends StyledLineProps {}\n\nexport const Line = React.forwardRef<ElementRef<typeof StyledLine>, LineProps>(\n (props, forwardRef) => (\n // We have to use RadixArrow with asChild here instead of styling it,\n // otherwise it's not possible to pass children, it will use arrow svg.\n // In this case asChild won't merge the nodes, but will apply some properties to the first child,\n // so we also need to add an additional span to avoid Stitches error.\n // In the end we get 2 nodes: Radix's span with positioning, span with radix svg props and our svg with styling\n <RadixArrow asChild>\n <span>\n <StyledLine ref={forwardRef} {...props} aria-hidden viewBox='0 0 6 50'>\n <rect\n x={LINE_WIDTH / 2 - 0.5}\n y='0'\n width='1'\n height={LINE_HEIGHT - LINE_WIDTH}\n />\n <circle\n cx={LINE_WIDTH / 2}\n cy={LINE_HEIGHT - LINE_WIDTH / 2}\n r={LINE_WIDTH / 2}\n />\n </StyledLine>\n </span>\n </RadixArrow>\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Arrow as RadixArrow } from '@radix-ui/react-popover'\n\nexport const StyledArrow = styled(RadixArrow, {\n fill: '$popover-background',\n height: '$1',\n paddingX: '2px',\n width: '$3',\n variants: {\n variant: {\n light: {\n fill: '$white',\n },\n dark: {},\n },\n },\n})\n\nexport type StyledArrowProps = StrictComponentProps<typeof StyledArrow>\n","import React, { createContext, useContext } from 'react'\n\nimport type { Variant } from './types'\n\ninterface PopoverValues {\n children: React.ReactNode\n variant?: Variant\n}\n\ninterface PopoverContextProps {\n variant?: Variant\n}\n\nconst PopoverContext = createContext<PopoverContextProps>({} as any)\n\n/**\n * The PopoverProvider is used to manage the state of the popover,\n * when it opens or closes, and what triggers it.\n */\nexport const PopoverProvider = ({\n children,\n variant,\n}: PopoverValues): React.ReactNode => (\n <PopoverContext.Provider\n value={{\n variant,\n }}\n >\n {children}\n </PopoverContext.Provider>\n)\n\n/**\n * The usePopoverContext hook is used to access the state of the popover.\n */\nexport const usePopoverContext = (): PopoverContextProps =>\n useContext(PopoverContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport { StyledArrow } from './arrow.styled'\nimport type { StyledArrowProps } from './arrow.styled'\nimport { usePopoverContext } from '../use-popover-context'\n\nexport interface ArrowProps extends StyledArrowProps {\n /**\n * The appearance of arrow.\n */\n variant?: StyledArrowProps['variant']\n}\n\nexport const Arrow = React.forwardRef<\n ElementRef<typeof StyledArrow>,\n ArrowProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n return (\n <StyledArrow {...props} variant={variant} aria-hidden ref={forwardRef} />\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\nimport { StyledContent } from './content.styled'\nimport { Line } from './line'\nimport { Arrow } from './arrow'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledContentProps } from './content.styled'\nimport type {\n Align,\n Side,\n AnchorType,\n PointerDownOutsideEvent,\n FocusOutsideEvent,\n} from '../types'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment option.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger's edge to the popover's anchor.\n * Works only with the \"arrow\" or \"none\" anchor.\n * @default 0\n */\n sideOffset?: number\n\n /**\n * The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * The distance in pixels from the boundary edges where collision detection\n * should occur. Accepts a number (same for all sides).\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * The type of anchor to render.\n * @default 'line'\n */\n anchor?: AnchorType\n\n /**\n * Whether to render in a Portal when open.\n */\n portalled?: boolean\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default false\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n\n /**\n * Event handler called when focus moves outside the bounds of the component.\n * It can be prevented by calling event.preventDefault.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when an interaction (pointer or focus event) happens\n * outside the bounds of the component. It can be prevented by calling\n * event.preventDefault.\n */\n onInteractOutside?: (\n event: PointerDownOutsideEvent | FocusOutsideEvent\n ) => void\n\n /**\n * Event handler called when focus moves into the component after opening.\n * It can be prevented by calling event.preventDefault().\n */\n onOpenAutoFocus?: (event: Event) => void\n\n /**\n * Event handler called when focus moves to the trigger after closing.\n * It can be prevented by calling event.preventDefault().\n */\n onCloseAutoFocus?: (event: Event) => void\n}\n\n/**\n * The content component is used to render rich content elements for the popover.\n */\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n sideOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n side = 'top',\n children,\n anchor = 'line',\n sticky = 'partial',\n hideWhenDetached = false,\n ...restProps\n },\n forwardRef\n ) => {\n const { variant } = usePopoverContext()\n const [canvas26] = useCanvas26()\n\n const anchorEl = React.useMemo(() => {\n switch (anchor) {\n case 'arrow':\n return <Arrow />\n case 'line':\n return <Line />\n default:\n return null\n }\n }, [anchor])\n\n return (\n <StyledContent\n {...restProps}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n side={side}\n sideOffset={sideOffset}\n ref={forwardRef}\n role='dialog'\n aria-modal='true'\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n variant={variant}\n canvas26={canvas26}\n >\n {children}\n {anchorEl}\n </StyledContent>\n )\n }\n)\n","import { Close as RadixClose } from '@radix-ui/react-popover'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { focus } from '@mirohq/design-system-styles'\n\nexport const StyledClose = styled(RadixClose, {\n all: 'unset',\n fontFamily: 'inherit',\n height: '$6',\n width: '$6',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: '$icon-on-static-dark-subtle',\n position: 'absolute',\n top: '5px',\n right: '5px',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&:hover': {\n backgroundColor: 'rgba(255, 255, 255, 0.12)',\n },\n '&:focus-visible': {\n ...focus.css({\n boxShadow: '$focus',\n }),\n },\n\n variants: {\n variant: {\n light: {\n color: '$black',\n },\n dark: {\n '&:focus-visible': {\n boxShadow: '0 0 0 2px #0F0F0F, 0 0 0 4px $colors$focus-keyboard',\n },\n },\n },\n },\n})\n\nexport type StyledCloseProps = StrictComponentProps<typeof StyledClose>\n","import React from 'react'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport type { ElementRef } from 'react'\n\nimport { StyledClose } from './close.styled'\nimport { usePopoverContext } from '../use-popover-context'\nimport type { StyledCloseProps } from './close.styled'\n\nexport interface CloseProps extends StyledCloseProps {\n /**\n * The appearance of close's button.\n */\n variant?: StyledCloseProps['variant']\n}\n\nexport const Close = React.forwardRef<\n ElementRef<typeof StyledClose>,\n CloseProps\n>((props, forwardRef) => {\n const { variant } = usePopoverContext()\n\n return (\n <StyledClose\n {...props}\n ref={forwardRef}\n data-testid='close-icon'\n variant={variant}\n >\n <IconCross size='small' />\n </StyledClose>\n )\n})\n","import React from 'react'\nimport type { PopoverPortalProps } from '@radix-ui/react-popover'\nimport { Portal as RadixPortal } from '@radix-ui/react-popover'\n\nexport interface PortalProps extends PopoverPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries. If used on this part,\n * it will be inherited by Popover.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\n","import React from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport { mergeRefs } from '@mirohq/design-system-utils'\n\nexport type AnchorProps = React.ComponentPropsWithoutRef<\n typeof RadixPopover.Anchor\n>\n\n/**\n * The anchor component positions the popover against an element other than the\n * trigger.\n *\n * Radix uses the trigger as the anchor until a custom one registers, then\n * re-renders without wrapping the trigger — which unmounts the node the popper\n * captured. Since `@radix-ui/react-popper` 1.3 the popper records an anchor\n * only when a ref attaches, and never when one detaches, so that swap leaves it\n * measuring the discarded trigger and the content collapses into the corner of\n * the viewport. The second, element-less anchor restates the same node through\n * `virtualRef`, which the popper re-reads on every render and so survives the\n * swap.\n */\nexport const Anchor = React.forwardRef<HTMLDivElement, AnchorProps>(\n ({ virtualRef, ...restProps }, forwardRef) => {\n const anchorRef = React.useRef<HTMLDivElement>(null)\n\n // Anchoring to a virtual element already goes through the per-render path,\n // so it needs no help and renders no element of its own.\n if (virtualRef != null) {\n return (\n <RadixPopover.Anchor\n {...restProps}\n virtualRef={virtualRef}\n ref={forwardRef}\n />\n )\n }\n\n return (\n <>\n <RadixPopover.Anchor\n {...restProps}\n ref={mergeRefs([forwardRef, anchorRef])}\n />\n <RadixPopover.Anchor virtualRef={anchorRef} />\n </>\n )\n }\n)\n","import React, { useEffect } from 'react'\nimport * as RadixPopover from '@radix-ui/react-popover'\nimport {\n BaseTooltipProvider,\n useBaseTooltipContext,\n} from '@mirohq/design-system-base-tooltip'\nimport { usePrevious } from '@mirohq/design-system-use-previous'\n\nimport { Trigger } from './partials/trigger'\nimport { Content } from './partials/content'\nimport { Close } from './partials/close'\nimport { Portal } from './partials/portal'\nimport { Anchor } from './partials/anchor'\nimport { PopoverProvider } from './use-popover-context'\nimport type { Variant } from './types'\n\nexport interface PopoverProps {\n /**\n * The current controlled state of the popover.\n */\n open?: boolean\n\n /**\n * The initial open state of the popover. Use when you don't need to control\n * its open state.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Event handler called when the popover opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the popover closes.\n */\n onClose?: () => void\n\n /**\n * Defines whether the interaction with outside elements will be enabled.\n */\n interactOutside?: boolean\n\n /**\n * Change the popover's appearance.\n * @default 'dark'\n */\n variant?: Variant\n\n /**\n * The content.\n */\n children: React.ReactNode\n}\n\nconst Root = ({\n open,\n onOpen,\n onClose,\n ...restProps\n}: PopoverProps): React.ReactNode => {\n const { ignoreNextTooltip } = useBaseTooltipContext()\n const prevOpen = usePrevious(open)\n\n useEffect(() => {\n if (prevOpen === true && open === false) {\n ignoreNextTooltip()\n }\n }, [ignoreNextTooltip, open, prevOpen])\n\n return (\n <RadixPopover.Root\n open={open}\n {...restProps}\n onOpenChange={value => {\n if (value) {\n onOpen?.()\n } else {\n if (open === undefined) {\n ignoreNextTooltip()\n }\n onClose?.()\n }\n }}\n modal={false}\n />\n )\n}\n\nexport const Popover: ((props: PopoverProps) => React.ReactNode) & Partials = ({\n open,\n defaultOpen = false,\n onOpen,\n onClose,\n variant = 'dark',\n ...restProps\n}) => (\n <PopoverProvider variant={variant}>\n <BaseTooltipProvider>\n <Root\n {...restProps}\n open={open}\n defaultOpen={defaultOpen}\n onOpen={onOpen}\n onClose={onClose}\n />\n </BaseTooltipProvider>\n </PopoverProvider>\n)\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Close: typeof Close\n Portal: typeof Portal\n Anchor: typeof Anchor\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\nPopover.Close = Close\nPopover.Portal = Portal\nPopover.Anchor = Anchor\n"],"names":["RadixTrigger","RadixContent","RadixArrow","RadixClose","RadixPortal"],"mappings":";;;;;;;;;;;;;AAIO,MAAM,aAAA,GAAgB,OAAOA,SAAY,CAAA;;ACOzC,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAG3B,CAAC,KAAA,EAAO,UAAA,qBAAe,GAAA,CAAC,aAAA,EAAA,EAAe,GAAG,KAAA,EAAO,GAAA,EAAK,UAAA,EAAY,CAAE,CAAA;;ACT/D,MAAM,aAAA,GAAgB,OAAOC,SAAA,EAAc;AAAA,EAChD,eAAA,EAAiB,qBAAA;AAAA,EACjB,KAAA,EAAO,6BAAA;AAAA,EACP,OAAA,EAAS,qBAAA;AAAA,EACT,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,MAAA;AAAA,EACZ,QAAA,EAAU;AAAA,IACR,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,EAAE,OAAA,EAAS,qBAAA,EAAsB;AAAA,MACvC,OAAO;AAAC,KACV;AAAA,IACA,OAAA,EAAS;AAAA,MACP,KAAA,EAAO;AAAA,QACL,GAAG,SAAS,GAAA,CAAI;AAAA,UACd,MAAA,EAAQ,UAAA;AAAA,UACR,WAAW,EAAE,EAAA,EAAI,WAAW,MAAA,EAAQ,GAAA,EAAK,WAAW,OAAA;AAAQ,SAC7D,CAAA;AAAA,QACD,UAAA,EAAY,QAAA;AAAA,QACZ,KAAA,EAAO;AAAA,OACT;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,GAAG,SAAS,GAAA,CAAI;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A,MAAA,GAAA,MAAA,EAAA;AAAA,QACF,CAAA,MAAO;AACL,UAAA,IAAI,SAAS,MAAA,EAAW;AACtB,YAAA,iBAAA,EAAkB;AAAA,UACpB;AACA,UAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,EAAA;AAAA,QACF;AAAA,MACF,CAAA;AAAA,MACA,KAAA,EAAO;AAAA;AAAA,GACT;AAEJ,CAAA;AAEO,MAAM,UAAiE,CAAC;AAAA,EAC7E,IAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA,GAAU,MAAA;AAAA,EACV,GAAG;AACL,CAAA,qBACE,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EACf,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,EAAC,IAAA;AAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,IAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA;AACF,CAAA,EACF,CAAA,EACF;AAcF,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAChB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,MAAA,GAAS,MAAA;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as _radix_ui_react_popover from '@radix-ui/react-popover';
|
|
2
|
-
import { PopoverPortalProps, PopoverAnchorProps } from '@radix-ui/react-popover';
|
|
3
1
|
import * as React from 'react';
|
|
4
2
|
import React__default from 'react';
|
|
5
3
|
import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
|
|
6
4
|
import { StrictComponentProps } from '@mirohq/design-system-stitches';
|
|
5
|
+
import * as _radix_ui_react_popover from '@radix-ui/react-popover';
|
|
6
|
+
import { PopoverPortalProps } from '@radix-ui/react-popover';
|
|
7
7
|
|
|
8
8
|
/* Utilities */
|
|
9
9
|
/* ========================================================================== */
|
|
@@ -199,6 +199,22 @@ interface PortalProps extends PopoverPortalProps {
|
|
|
199
199
|
}
|
|
200
200
|
declare const Portal: (props: PortalProps) => React__default.ReactNode;
|
|
201
201
|
|
|
202
|
+
type AnchorProps = React__default.ComponentPropsWithoutRef<typeof _radix_ui_react_popover.Anchor>;
|
|
203
|
+
/**
|
|
204
|
+
* The anchor component positions the popover against an element other than the
|
|
205
|
+
* trigger.
|
|
206
|
+
*
|
|
207
|
+
* Radix uses the trigger as the anchor until a custom one registers, then
|
|
208
|
+
* re-renders without wrapping the trigger — which unmounts the node the popper
|
|
209
|
+
* captured. Since `@radix-ui/react-popper` 1.3 the popper records an anchor
|
|
210
|
+
* only when a ref attaches, and never when one detaches, so that swap leaves it
|
|
211
|
+
* measuring the discarded trigger and the content collapses into the corner of
|
|
212
|
+
* the viewport. The second, element-less anchor restates the same node through
|
|
213
|
+
* `virtualRef`, which the popper re-reads on every render and so survives the
|
|
214
|
+
* swap.
|
|
215
|
+
*/
|
|
216
|
+
declare const Anchor: React__default.ForwardRefExoticComponent<Omit<_radix_ui_react_popover.PopoverAnchorProps & React__default.RefAttributes<HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
217
|
+
|
|
202
218
|
interface PopoverProps {
|
|
203
219
|
/**
|
|
204
220
|
* The current controlled state of the popover.
|
|
@@ -238,7 +254,7 @@ interface Partials {
|
|
|
238
254
|
Content: typeof Content;
|
|
239
255
|
Close: typeof Close;
|
|
240
256
|
Portal: typeof Portal;
|
|
241
|
-
Anchor: typeof
|
|
257
|
+
Anchor: typeof Anchor;
|
|
242
258
|
}
|
|
243
259
|
|
|
244
260
|
declare const StyledArrow: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_radix_ui_react_popover.PopoverArrowProps & React.RefAttributes<SVGSVGElement>>>, "variant"> & TransformProps<{
|
|
@@ -255,7 +271,5 @@ interface ArrowProps extends StyledArrowProps {
|
|
|
255
271
|
variant?: StyledArrowProps['variant'];
|
|
256
272
|
}
|
|
257
273
|
|
|
258
|
-
type AnchorProps = PopoverAnchorProps;
|
|
259
|
-
|
|
260
274
|
export { Popover, types as PopoverTypes };
|
|
261
275
|
export type { AnchorProps as PopoverAnchorProps, ArrowProps as PopoverArrowProps, CloseProps as PopoverCloseProps, ContentProps as PopoverContentProps, PortalProps as PopoverPortalProps, PopoverProps, TriggerProps as PopoverTriggerProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-popover",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.50-reactdismissablelayer.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -27,14 +27,15 @@
|
|
|
27
27
|
"react-dom": "^16.14 || ^17 || ^18 || ^19"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@radix-ui/react-popover": "^1.
|
|
30
|
+
"@radix-ui/react-popover": "^1.1.23",
|
|
31
31
|
"@mirohq/design-system-base-tooltip": "^1.2.1",
|
|
32
|
-
"@mirohq/design-system-icons": "^1.46.2",
|
|
33
32
|
"@mirohq/design-system-experiments": "^1.1.0",
|
|
34
|
-
"@mirohq/design-system-
|
|
35
|
-
"@mirohq/design-system-primitive": "^2.2.
|
|
36
|
-
"@mirohq/design-system-
|
|
37
|
-
"@mirohq/design-system-
|
|
33
|
+
"@mirohq/design-system-icons": "^1.46.3-reactdismissablelayer.0",
|
|
34
|
+
"@mirohq/design-system-primitive": "^2.2.2-reactdismissablelayer.0",
|
|
35
|
+
"@mirohq/design-system-stitches": "^3.3.32",
|
|
36
|
+
"@mirohq/design-system-styles": "^3.2.32",
|
|
37
|
+
"@mirohq/design-system-use-previous": "^1.1.1",
|
|
38
|
+
"@mirohq/design-system-utils": "^1.3.0"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "rollup -c ../../../rollup.config.js",
|