@tamagui/tooltip 1.2.10 → 1.2.12
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/cjs/Tooltip.js +4 -2
- package/dist/cjs/Tooltip.js.map +2 -2
- package/dist/esm/Tooltip.js +4 -2
- package/dist/esm/Tooltip.js.map +2 -2
- package/dist/esm/Tooltip.mjs +4 -2
- package/dist/esm/Tooltip.mjs.map +2 -2
- package/dist/jsx/Tooltip.js +4 -2
- package/dist/jsx/Tooltip.js.map +2 -2
- package/dist/jsx/Tooltip.mjs +4 -2
- package/dist/jsx/Tooltip.mjs.map +2 -2
- package/package.json +13 -13
- package/src/Tooltip.tsx +6 -4
- package/types/Tooltip.d.ts +11 -10
- package/types/Tooltip.d.ts.map +1 -1
package/dist/cjs/Tooltip.js
CHANGED
|
@@ -45,13 +45,14 @@ const TooltipContent = React.forwardRef(
|
|
|
45
45
|
({ __scopePopover, ...props }, ref) => {
|
|
46
46
|
const popperScope = (0, import_popover.usePopoverScope)(__scopePopover);
|
|
47
47
|
const popper = (0, import_popper.usePopperContext)("PopperContent", popperScope["__scopePopper"]);
|
|
48
|
+
const padding = props.size || popper.size || (0, import_get_size.stepTokenUpOrDown)("size", "$true", -2);
|
|
48
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
50
|
import_popover.PopoverContent,
|
|
50
51
|
{
|
|
51
52
|
componentName: "TooltipContent",
|
|
52
53
|
disableRemoveScroll: true,
|
|
53
54
|
trapFocus: false,
|
|
54
|
-
padding
|
|
55
|
+
padding,
|
|
55
56
|
pointerEvents: "none",
|
|
56
57
|
ref,
|
|
57
58
|
...props
|
|
@@ -112,7 +113,8 @@ const Tooltip = (0, import_core.withStaticProperties)(
|
|
|
112
113
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
113
114
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
114
115
|
const contentId = (0, import_core.useId)();
|
|
115
|
-
const
|
|
116
|
+
const twoSmallerKey = (0, import_get_size.stepTokenUpOrDown)("size", "$true", -2).key;
|
|
117
|
+
const size = `$${twoSmallerKey}`;
|
|
116
118
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_floating.FloatingOverrideContext.Provider, { value: useFloatingContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.Popper, { size, ...popperScope, ...restProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
119
|
import_popover.__PopoverProviderInternal,
|
|
118
120
|
{
|
package/dist/cjs/Tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={padding}\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\ntype Delay =\n | number\n | Partial<{\n open: number\n close: number\n }>\n\nexport const TooltipGroup = ({ children, delay }: { children?: any; delay: Delay }) => {\n return (\n <FloatingDelayGroup delay={React.useMemo(() => delay, [JSON.stringify(delay)])}>\n {children}\n </FloatingDelayGroup>\n )\n}\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n delay: delayProp,\n restMs = typeof delayProp === 'undefined'\n ? 500\n : typeof delayProp === 'number'\n ? delayProp\n : 0,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n const onOpenChange = useEvent((open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n // @ts-ignore\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])\n const contentId = useId()\n const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key\n const size = `$${twoSmallerKey}`\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size={size as SizeTokens} {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n popperScope={popperScope.__scopePopper}\n contentId={contentId}\n triggerRef={triggerRef}\n sheetBreakpoint={false}\n scopeKey=\"\"\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={onCustomAnchorAdd}\n onCustomAnchorRemove={onCustomAnchorRemove}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nconst voidFn = () => {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCM;AAvCN,0BAAO;AAEP,oCAUO;AACP,kBAAkE;AAElE,sBAAuD;AACvD,sBAAkC;AAClC,qBASO;AACP,oBAAsD;AACtD,YAAuB;AAEvB,MAAM,iBAAiB,MAAM;AAAA,EAC3B,CACE,EAAE,gBAAgB,GAAG,MAAM,GAC3B,QACG;AACH,UAAM,kBAAc,gCAAgB,cAAc;AAClD,UAAM,aAAS,gCAAiB,iBAAiB,YAAY,eAAe,CAAC;AAC7E,UAAM,UAAU,MAAM,QAAQ,OAAO,YAAQ,mCAAkB,QAAQ,SAAS,EAAE;AAClF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,qBAAmB;AAAA,QACnB,WAAW;AAAA,QACX;AAAA,QACA,eAAc;AAAA,QACd;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,MAAM,eAAe,MAAM,WAAW,CAAC,OAA0B,QAAa;AAC5E,SAAO,4CAAC,+BAAa,eAAc,gBAAe,KAAW,GAAG,OAAO;AACzE,CAAC;AAsBM,MAAM,eAAe,CAAC,EAAE,UAAU,MAAM,MAAwC;AACrF,SACE,4CAAC,oDAAmB,OAAO,MAAM,QAAQ,MAAM,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,C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B,MAAM,YAAY,MAAM,mBAAmB,IAAI,GAAG,CAAC,CAAC;AAC9E,UAAM,uBAAuB,MAAM,YAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,CAAC;AAClF,UAAM,gBAAY,mBAAM;AACxB,UAAM,oBAAgB,mCAAkB,QAAQ,SAAS,EAAE,EAAE;AAC7D,UAAM,OAAO,IAAI;AAEjB,WACE,4CAAC,wCAAwB,UAAxB,EAAiC,OAAO,oBAEvC,sDAAC,wBAAO,MAA2B,GAAG,aAAc,GAAG,WACrD;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,aAAa,YAAY;AAAA,QACzB;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,UAAS;AAAA,QACT;AAAA,QACA,cAAc;AAAA,QACd,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH,GACF,GACF;AAAA,EAEJ;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF;AAEA,QAAQ,cAAc;AAEtB,MAAM,SAAS,MAAM;AAAC;",
|
|
6
6
|
"names": ["open", "props"]
|
|
7
7
|
}
|
package/dist/esm/Tooltip.js
CHANGED
|
@@ -28,13 +28,14 @@ const TooltipContent = React.forwardRef(
|
|
|
28
28
|
({ __scopePopover, ...props }, ref) => {
|
|
29
29
|
const popperScope = usePopoverScope(__scopePopover);
|
|
30
30
|
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
31
|
+
const padding = props.size || popper.size || stepTokenUpOrDown("size", "$true", -2);
|
|
31
32
|
return /* @__PURE__ */ jsx(
|
|
32
33
|
PopoverContent,
|
|
33
34
|
{
|
|
34
35
|
componentName: "TooltipContent",
|
|
35
36
|
disableRemoveScroll: true,
|
|
36
37
|
trapFocus: false,
|
|
37
|
-
padding
|
|
38
|
+
padding,
|
|
38
39
|
pointerEvents: "none",
|
|
39
40
|
ref,
|
|
40
41
|
...props
|
|
@@ -95,7 +96,8 @@ const Tooltip = withStaticProperties(
|
|
|
95
96
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
96
97
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
97
98
|
const contentId = useId();
|
|
98
|
-
const
|
|
99
|
+
const twoSmallerKey = stepTokenUpOrDown("size", "$true", -2).key;
|
|
100
|
+
const size = `$${twoSmallerKey}`;
|
|
99
101
|
return /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: useFloatingContext, children: /* @__PURE__ */ jsx(Popper, { size, ...popperScope, ...restProps, children: /* @__PURE__ */ jsx(
|
|
100
102
|
__PopoverProviderInternal,
|
|
101
103
|
{
|
package/dist/esm/Tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={padding}\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\ntype Delay =\n | number\n | Partial<{\n open: number\n close: number\n }>\n\nexport const TooltipGroup = ({ children, delay }: { children?: any; delay: Delay }) => {\n return (\n <FloatingDelayGroup delay={React.useMemo(() => delay, [JSON.stringify(delay)])}>\n {children}\n </FloatingDelayGroup>\n )\n}\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n delay: delayProp,\n restMs = typeof delayProp === 'undefined'\n ? 500\n : typeof delayProp === 'number'\n ? delayProp\n : 0,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n const onOpenChange = useEvent((open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n // @ts-ignore\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])\n const contentId = useId()\n const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key\n const size = `$${twoSmallerKey}`\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size={size as SizeTokens} {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n popperScope={popperScope.__scopePopper}\n contentId={contentId}\n triggerRef={triggerRef}\n sheetBreakpoint={false}\n scopeKey=\"\"\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={onCustomAnchorAdd}\n onCustomAnchorRemove={onCustomAnchorRemove}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nconst voidFn = () => {}\n"],
|
|
5
|
+
"mappings": "AAuCM;AAvCN,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAqB,UAAU,OAAO,4BAA4B;AAElE,SAAS,+BAA8C;AACvD,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAqB,wBAAwB;AACtD,YAAY,WAAW;AAEvB,MAAM,iBAAiB,MAAM;AAAA,EAC3B,CACE,EAAE,gBAAgB,GAAG,MAAM,GAC3B,QACG;AACH,UAAM,cAAc,gBAAgB,cAAc;AAClD,UAAM,SAAS,iBAAiB,iBAAiB,YAAY,eAAe,CAAC;AAC7E,UAAM,UAAU,MAAM,QAAQ,OAAO,QAAQ,kBAAkB,QAAQ,SAAS,EAAE;AAClF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,qBAAmB;AAAA,QACnB,WAAW;AAAA,QACX;AAAA,QACA,eAAc;AAAA,QACd;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,MAAM,eAAe,MAAM,WAAW,CAAC,OAA0B,QAAa;AAC5E,SAAO,oB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,CAAC;AAAA,MACxC,CAAC;AACD,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,qBAAqB,MAAM,YAAY,eAAe,CAAC,IAAI,OAAO,IAAI,CAAC;AAC7E,UAAM,oBAAoB,MAAM,YAAY,MAAM,mBAAmB,IAAI,GAAG,CAAC,CAAC;AAC9E,UAAM,uBAAuB,MAAM,YAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,CAAC;AAClF,UAAM,YAAY,MAAM;AACxB,UAAM,gBAAgB,kBAAkB,QAAQ,SAAS,EAAE,EAAE;AAC7D,UAAM,OAAO,IAAI;AAEjB,WACE,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,oBAEvC,8BAAC,UAAO,MAA2B,GAAG,aAAc,GAAG,WACrD;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,aAAa,YAAY;AAAA,QACzB;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,UAAS;AAAA,QACT;AAAA,QACA,cAAc;AAAA,QACd,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH,GACF,GACF;AAAA,EAEJ;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF;AAEA,QAAQ,cAAc;AAEtB,MAAM,SAAS,MAAM;AAAC;",
|
|
6
6
|
"names": ["open", "props"]
|
|
7
7
|
}
|
package/dist/esm/Tooltip.mjs
CHANGED
|
@@ -28,13 +28,14 @@ const TooltipContent = React.forwardRef(
|
|
|
28
28
|
({ __scopePopover, ...props }, ref) => {
|
|
29
29
|
const popperScope = usePopoverScope(__scopePopover);
|
|
30
30
|
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
31
|
+
const padding = props.size || popper.size || stepTokenUpOrDown("size", "$true", -2);
|
|
31
32
|
return /* @__PURE__ */ jsx(
|
|
32
33
|
PopoverContent,
|
|
33
34
|
{
|
|
34
35
|
componentName: "TooltipContent",
|
|
35
36
|
disableRemoveScroll: true,
|
|
36
37
|
trapFocus: false,
|
|
37
|
-
padding
|
|
38
|
+
padding,
|
|
38
39
|
pointerEvents: "none",
|
|
39
40
|
ref,
|
|
40
41
|
...props
|
|
@@ -95,7 +96,8 @@ const Tooltip = withStaticProperties(
|
|
|
95
96
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
96
97
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
97
98
|
const contentId = useId();
|
|
98
|
-
const
|
|
99
|
+
const twoSmallerKey = stepTokenUpOrDown("size", "$true", -2).key;
|
|
100
|
+
const size = `$${twoSmallerKey}`;
|
|
99
101
|
return /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: useFloatingContext, children: /* @__PURE__ */ jsx(Popper, { size, ...popperScope, ...restProps, children: /* @__PURE__ */ jsx(
|
|
100
102
|
__PopoverProviderInternal,
|
|
101
103
|
{
|
package/dist/esm/Tooltip.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={padding}\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\ntype Delay =\n | number\n | Partial<{\n open: number\n close: number\n }>\n\nexport const TooltipGroup = ({ children, delay }: { children?: any; delay: Delay }) => {\n return (\n <FloatingDelayGroup delay={React.useMemo(() => delay, [JSON.stringify(delay)])}>\n {children}\n </FloatingDelayGroup>\n )\n}\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n delay: delayProp,\n restMs = typeof delayProp === 'undefined'\n ? 500\n : typeof delayProp === 'number'\n ? delayProp\n : 0,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n const onOpenChange = useEvent((open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n // @ts-ignore\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])\n const contentId = useId()\n const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key\n const size = `$${twoSmallerKey}`\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size={size as SizeTokens} {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n popperScope={popperScope.__scopePopper}\n contentId={contentId}\n triggerRef={triggerRef}\n sheetBreakpoint={false}\n scopeKey=\"\"\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={onCustomAnchorAdd}\n onCustomAnchorRemove={onCustomAnchorRemove}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nconst voidFn = () => {}\n"],
|
|
5
|
+
"mappings": "AAuCM;AAvCN,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAqB,UAAU,OAAO,4BAA4B;AAElE,SAAS,+BAA8C;AACvD,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAqB,wBAAwB;AACtD,YAAY,WAAW;AAEvB,MAAM,iBAAiB,MAAM;AAAA,EAC3B,CACE,EAAE,gBAAgB,GAAG,MAAM,GAC3B,QACG;AACH,UAAM,cAAc,gBAAgB,cAAc;AAClD,UAAM,SAAS,iBAAiB,iBAAiB,YAAY,eAAe,CAAC;AAC7E,UAAM,UAAU,MAAM,QAAQ,OAAO,QAAQ,kBAAkB,QAAQ,SAAS,EAAE;AAClF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,Q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...props }, ref) => {
|
|
28
28
|
const popperScope = usePopoverScope(__scopePopover);
|
|
29
29
|
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
30
|
+
const padding = props.size || popper.size || stepTokenUpOrDown("size", "$true", -2);
|
|
30
31
|
return <PopoverContent
|
|
31
32
|
componentName="TooltipContent"
|
|
32
33
|
disableRemoveScroll
|
|
33
34
|
trapFocus={false}
|
|
34
|
-
padding={
|
|
35
|
+
padding={padding}
|
|
35
36
|
pointerEvents="none"
|
|
36
37
|
ref={ref}
|
|
37
38
|
{...props}
|
|
@@ -91,7 +92,8 @@ const Tooltip = withStaticProperties(
|
|
|
91
92
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
92
93
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
93
94
|
const contentId = useId();
|
|
94
|
-
const
|
|
95
|
+
const twoSmallerKey = stepTokenUpOrDown("size", "$true", -2).key;
|
|
96
|
+
const size = `$${twoSmallerKey}`;
|
|
95
97
|
return <FloatingOverrideContext.Provider value={useFloatingContext}><Popper size={size} {...popperScope} {...restProps}><__PopoverProviderInternal
|
|
96
98
|
scope={__scopePopover}
|
|
97
99
|
popperScope={popperScope.__scopePopper}
|
package/dist/jsx/Tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={
|
|
5
|
-
"mappings": "AAAA,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={padding}\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\ntype Delay =\n | number\n | Partial<{\n open: number\n close: number\n }>\n\nexport const TooltipGroup = ({ children, delay }: { children?: any; delay: Delay }) => {\n return (\n <FloatingDelayGroup delay={React.useMemo(() => delay, [JSON.stringify(delay)])}>\n {children}\n </FloatingDelayGroup>\n )\n}\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n delay: delayProp,\n restMs = typeof delayProp === 'undefined'\n ? 500\n : typeof delayProp === 'number'\n ? delayProp\n : 0,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n const onOpenChange = useEvent((open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n // @ts-ignore\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])\n const contentId = useId()\n const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key\n const size = `$${twoSmallerKey}`\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size={size as SizeTokens} {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n popperScope={popperScope.__scopePopper}\n contentId={contentId}\n triggerRef={triggerRef}\n sheetBreakpoint={false}\n scopeKey=\"\"\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={onCustomAnchorAdd}\n onCustomAnchorRemove={onCustomAnchorRemove}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nconst voidFn = () => {}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAqB,UAAU,OAAO,4BAA4B;AAElE,SAAS,+BAA8C;AACvD,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAqB,wBAAwB;AACtD,YAAY,WAAW;AAEvB,MAAM,iBAAiB,MAAM;AAAA,EAC3B,CACE,EAAE,gBAAg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QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF;AAEA,QAAQ,cAAc;AAEtB,MAAM,SAAS,MAAM;AAAC;",
|
|
6
6
|
"names": ["open", "props"]
|
|
7
7
|
}
|
package/dist/jsx/Tooltip.mjs
CHANGED
|
@@ -27,11 +27,12 @@ const TooltipContent = React.forwardRef(
|
|
|
27
27
|
({ __scopePopover, ...props }, ref) => {
|
|
28
28
|
const popperScope = usePopoverScope(__scopePopover);
|
|
29
29
|
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
30
|
+
const padding = props.size || popper.size || stepTokenUpOrDown("size", "$true", -2);
|
|
30
31
|
return <PopoverContent
|
|
31
32
|
componentName="TooltipContent"
|
|
32
33
|
disableRemoveScroll
|
|
33
34
|
trapFocus={false}
|
|
34
|
-
padding={
|
|
35
|
+
padding={padding}
|
|
35
36
|
pointerEvents="none"
|
|
36
37
|
ref={ref}
|
|
37
38
|
{...props}
|
|
@@ -91,7 +92,8 @@ const Tooltip = withStaticProperties(
|
|
|
91
92
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
92
93
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
93
94
|
const contentId = useId();
|
|
94
|
-
const
|
|
95
|
+
const twoSmallerKey = stepTokenUpOrDown("size", "$true", -2).key;
|
|
96
|
+
const size = `$${twoSmallerKey}`;
|
|
95
97
|
return <FloatingOverrideContext.Provider value={useFloatingContext}><Popper size={size} {...popperScope} {...restProps}><__PopoverProviderInternal
|
|
96
98
|
scope={__scopePopover}
|
|
97
99
|
popperScope={popperScope.__scopePopper}
|
package/dist/jsx/Tooltip.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={
|
|
5
|
-
"mappings": "AAAA,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'\nimport { stepTokenUpOrDown } from '@tamagui/get-size'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport { Popper, PopperProps, usePopperContext } from '@tamagui/popper'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n (\n { __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>,\n ref: any\n ) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)\n return (\n <PopoverContent\n componentName=\"TooltipContent\"\n disableRemoveScroll\n trapFocus={false}\n padding={padding}\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\ntype Delay =\n | number\n | Partial<{\n open: number\n close: number\n }>\n\nexport const TooltipGroup = ({ children, delay }: { children?: any; delay: Delay }) => {\n return (\n <FloatingDelayGroup delay={React.useMemo(() => delay, [JSON.stringify(delay)])}>\n {children}\n </FloatingDelayGroup>\n )\n}\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n delay: delayProp,\n restMs = typeof delayProp === 'undefined'\n ? 500\n : typeof delayProp === 'number'\n ? delayProp\n : 0,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n const onOpenChange = useEvent((open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n // @ts-ignore\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])\n const contentId = useId()\n const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key\n const size = `$${twoSmallerKey}`\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size={size as SizeTokens} {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n popperScope={popperScope.__scopePopper}\n contentId={contentId}\n triggerRef={triggerRef}\n sheetBreakpoint={false}\n scopeKey=\"\"\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={onCustomAnchorAdd}\n onCustomAnchorRemove={onCustomAnchorRemove}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nconst voidFn = () => {}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,MACd,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,sBAAsB;AAAA,MAErB,SACH,EAfC,0BAgBH,EAjBC,OAkBH,EApBC,wBAAwB;AAAA,EAsB7B;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF;AAEA,QAAQ,cAAc;AAEtB,MAAM,SAAS,MAAM;AAAC;",
|
|
6
6
|
"names": ["open", "props"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/tooltip",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@floating-ui/react-dom-interactions": "0.8.1",
|
|
27
|
-
"@tamagui/compose-refs": "^1.2.
|
|
28
|
-
"@tamagui/core": "^1.2.
|
|
29
|
-
"@tamagui/create-context": "^1.2.
|
|
30
|
-
"@tamagui/floating": "^1.2.
|
|
31
|
-
"@tamagui/get-size": "^1.2.
|
|
32
|
-
"@tamagui/polyfill-dev": "^1.2.
|
|
33
|
-
"@tamagui/popover": "^1.2.
|
|
34
|
-
"@tamagui/popper": "^1.2.
|
|
35
|
-
"@tamagui/stacks": "^1.2.
|
|
36
|
-
"@tamagui/text": "^1.2.
|
|
37
|
-
"@tamagui/use-controllable-state": "^1.2.
|
|
27
|
+
"@tamagui/compose-refs": "^1.2.12",
|
|
28
|
+
"@tamagui/core": "^1.2.12",
|
|
29
|
+
"@tamagui/create-context": "^1.2.12",
|
|
30
|
+
"@tamagui/floating": "^1.2.12",
|
|
31
|
+
"@tamagui/get-size": "^1.2.12",
|
|
32
|
+
"@tamagui/polyfill-dev": "^1.2.12",
|
|
33
|
+
"@tamagui/popover": "^1.2.12",
|
|
34
|
+
"@tamagui/popper": "^1.2.12",
|
|
35
|
+
"@tamagui/stacks": "^1.2.12",
|
|
36
|
+
"@tamagui/text": "^1.2.12",
|
|
37
|
+
"@tamagui/use-controllable-state": "^1.2.12"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "*",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-native": "*"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "^1.2.
|
|
45
|
+
"@tamagui/build": "^1.2.12",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"react-dom": "^18.2.0",
|
|
48
48
|
"react-native": "*"
|
package/src/Tooltip.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useInteractions,
|
|
12
12
|
useRole,
|
|
13
13
|
} from '@floating-ui/react-dom-interactions'
|
|
14
|
-
import { useEvent, useId, withStaticProperties } from '@tamagui/core'
|
|
14
|
+
import { SizeTokens, useEvent, useId, withStaticProperties } from '@tamagui/core'
|
|
15
15
|
import { ScopedProps } from '@tamagui/create-context'
|
|
16
16
|
import { FloatingOverrideContext, UseFloatingFn } from '@tamagui/floating'
|
|
17
17
|
import { stepTokenUpOrDown } from '@tamagui/get-size'
|
|
@@ -35,12 +35,13 @@ const TooltipContent = React.forwardRef(
|
|
|
35
35
|
) => {
|
|
36
36
|
const popperScope = usePopoverScope(__scopePopover)
|
|
37
37
|
const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])
|
|
38
|
+
const padding = props.size || popper.size || stepTokenUpOrDown('size', '$true', -2)
|
|
38
39
|
return (
|
|
39
40
|
<PopoverContent
|
|
40
41
|
componentName="TooltipContent"
|
|
41
42
|
disableRemoveScroll
|
|
42
43
|
trapFocus={false}
|
|
43
|
-
padding={
|
|
44
|
+
padding={padding}
|
|
44
45
|
pointerEvents="none"
|
|
45
46
|
ref={ref}
|
|
46
47
|
{...props}
|
|
@@ -136,12 +137,13 @@ export const Tooltip = withStaticProperties(
|
|
|
136
137
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])
|
|
137
138
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])
|
|
138
139
|
const contentId = useId()
|
|
139
|
-
const
|
|
140
|
+
const twoSmallerKey = stepTokenUpOrDown('size', '$true', -2).key
|
|
141
|
+
const size = `$${twoSmallerKey}`
|
|
140
142
|
|
|
141
143
|
return (
|
|
142
144
|
<FloatingOverrideContext.Provider value={useFloatingContext}>
|
|
143
145
|
{/* default tooltip to a smaller size */}
|
|
144
|
-
<Popper size={size} {...popperScope} {...restProps}>
|
|
146
|
+
<Popper size={size as SizeTokens} {...popperScope} {...restProps}>
|
|
145
147
|
<__PopoverProviderInternal
|
|
146
148
|
scope={__scopePopover}
|
|
147
149
|
popperScope={popperScope.__scopePopper}
|
package/types/Tooltip.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@tamagui/polyfill-dev';
|
|
2
|
+
import { SizeTokens } from '@tamagui/core';
|
|
2
3
|
import { PopperProps } from '@tamagui/popper';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
export type TooltipProps = PopperProps & {
|
|
@@ -22,39 +23,39 @@ export declare const TooltipGroup: ({ children, delay }: {
|
|
|
22
23
|
export declare const Tooltip: React.FC<TooltipProps> & {
|
|
23
24
|
Anchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
24
25
|
readonly fullscreen?: boolean | undefined;
|
|
25
|
-
readonly elevation?:
|
|
26
|
+
readonly elevation?: SizeTokens | undefined;
|
|
26
27
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
27
28
|
readonly fullscreen?: boolean | undefined;
|
|
28
|
-
readonly elevation?:
|
|
29
|
+
readonly elevation?: SizeTokens | undefined;
|
|
29
30
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
30
31
|
readonly fullscreen?: boolean | undefined;
|
|
31
|
-
readonly elevation?:
|
|
32
|
+
readonly elevation?: SizeTokens | undefined;
|
|
32
33
|
}>> & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
33
34
|
Arrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
34
35
|
readonly fullscreen?: boolean | undefined;
|
|
35
|
-
readonly elevation?:
|
|
36
|
+
readonly elevation?: SizeTokens | undefined;
|
|
36
37
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
37
38
|
readonly fullscreen?: boolean | undefined;
|
|
38
|
-
readonly elevation?:
|
|
39
|
+
readonly elevation?: SizeTokens | undefined;
|
|
39
40
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
40
41
|
readonly fullscreen?: boolean | undefined;
|
|
41
|
-
readonly elevation?:
|
|
42
|
+
readonly elevation?: SizeTokens | undefined;
|
|
42
43
|
}>> & {
|
|
43
44
|
offset?: number | undefined;
|
|
44
|
-
size?:
|
|
45
|
+
size?: SizeTokens | undefined;
|
|
45
46
|
} & React.RefAttributes<unknown>>;
|
|
46
47
|
Content: React.ForwardRefExoticComponent<import("@tamagui/popover").PopoverContentTypeProps & {
|
|
47
48
|
__scopePopover?: import("@tamagui/create-context").Scope<any>;
|
|
48
49
|
} & React.RefAttributes<unknown>>;
|
|
49
50
|
Trigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
50
51
|
readonly fullscreen?: boolean | undefined;
|
|
51
|
-
readonly elevation?:
|
|
52
|
+
readonly elevation?: SizeTokens | undefined;
|
|
52
53
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
53
54
|
readonly fullscreen?: boolean | undefined;
|
|
54
|
-
readonly elevation?:
|
|
55
|
+
readonly elevation?: SizeTokens | undefined;
|
|
55
56
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children" | "onLayout" | keyof import("react-native").GestureResponderHandlers> & import("@tamagui/core").ExtendBaseStackProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & import("@tamagui/core/types/reactNativeTypes").RNViewProps & Omit<{}, "elevation" | "fullscreen"> & {
|
|
56
57
|
readonly fullscreen?: boolean | undefined;
|
|
57
|
-
readonly elevation?:
|
|
58
|
+
readonly elevation?: SizeTokens | undefined;
|
|
58
59
|
}>> & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
59
60
|
};
|
|
60
61
|
export {};
|
package/types/Tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAa9B,OAAO,EAAE,UAAU,EAAyC,MAAM,eAAe,CAAA;AAcjF,OAAO,EAAU,WAAW,EAAoB,MAAM,iBAAiB,CAAA;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA4B9B,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EACF,MAAM,GACN;QACE,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACN,CAAA;AAED,KAAK,KAAK,GACN,MAAM,GACN,OAAO,CAAC;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEN,eAAO,MAAM,YAAY;eAAsC,GAAG;WAAS,KAAK;iBAM/E,CAAA;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFnB,CAAA"}
|