@dxos/react-ui-text-tooltip 0.8.4-main.b97322e → 0.8.4-main.dedc0f3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/TextTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React, {\n type ComponentPropsWithoutRef,\n
|
|
5
|
-
"mappings": ";;AAIA,SAASA,uBAAuB;AAChC,OAAOC,
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React, {\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n type SyntheticEvent,\n forwardRef,\n useCallback,\n useRef,\n} from 'react';\n\nimport { Tooltip, type TooltipScopedProps, type TooltipTriggerProps } from '@dxos/react-ui';\n\nexport type TextTooltipProps = PropsWithChildren<\n {\n text: string;\n asChild?: boolean;\n onlyWhenTruncating?: boolean;\n truncateQuery?: string;\n } & Pick<TooltipTriggerProps, 'side'> &\n ComponentPropsWithoutRef<'button'>\n>;\n\nexport const TextTooltip = forwardRef<HTMLButtonElement, TooltipScopedProps<TextTooltipProps>>(\n (\n { __scopeTooltip, text, children, onlyWhenTruncating, asChild = true, side, truncateQuery, ...props },\n forwardedRef,\n ) => {\n const content = useRef<HTMLButtonElement | null>(null);\n const ref = useComposedRefs(content, forwardedRef);\n const handleInteract = useCallback(\n (event: SyntheticEvent) => {\n if (onlyWhenTruncating && content.current) {\n const element: HTMLElement | null = truncateQuery\n ? content.current.querySelector(truncateQuery)\n : content.current;\n if (!element || element.scrollWidth <= element.offsetWidth) {\n event.preventDefault();\n }\n }\n },\n [onlyWhenTruncating, truncateQuery],\n );\n return (\n <Tooltip.Trigger asChild={asChild} {...props} content={text} side={side} onInteract={handleInteract} ref={ref}>\n {children}\n </Tooltip.Trigger>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": ";;AAIA,SAASA,uBAAuB;AAChC,OAAOC,SAILC,YACAC,aACAC,cACK;AAEP,SAASC,eAAkE;AAYpE,IAAMC,cAAcC,2BACzB,CACE,EAAEC,gBAAgBC,MAAMC,UAAUC,oBAAoBC,UAAU,MAAMC,MAAMC,eAAe,GAAGC,MAAAA,GAC9FC,iBAAAA;;;AAEA,UAAMC,UAAUC,OAAiC,IAAA;AACjD,UAAMC,MAAMC,gBAAgBH,SAASD,YAAAA;AACrC,UAAMK,iBAAiBC,YACrB,CAACC,UAAAA;AACC,UAAIZ,sBAAsBM,QAAQO,SAAS;AACzC,cAAMC,UAA8BX,gBAChCG,QAAQO,QAAQE,cAAcZ,aAAAA,IAC9BG,QAAQO;AACZ,YAAI,CAACC,WAAWA,QAAQE,eAAeF,QAAQG,aAAa;AAC1DL,gBAAMM,eAAc;QACtB;MACF;IACF,GACA;MAAClB;MAAoBG;KAAc;AAErC,WACE,sBAAA,cAACgB,QAAQC,SAAO;MAACnB;MAAmB,GAAGG;MAAOE,SAASR;MAAMI;MAAYmB,YAAYX;MAAgBF;OAClGT,QAAAA;;;;AAGP,CAAA;",
|
|
6
6
|
"names": ["useComposedRefs", "React", "forwardRef", "useCallback", "useRef", "Tooltip", "TextTooltip", "forwardRef", "__scopeTooltip", "text", "children", "onlyWhenTruncating", "asChild", "side", "truncateQuery", "props", "forwardedRef", "content", "useRef", "ref", "useComposedRefs", "handleInteract", "useCallback", "event", "current", "element", "querySelector", "scrollWidth", "offsetWidth", "preventDefault", "Tooltip", "Trigger", "onInteract"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/TextTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React, {\n type ComponentPropsWithoutRef,\n
|
|
5
|
-
"mappings": ";;;;AAIA,SAASA,uBAAuB;AAChC,OAAOC,
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React, {\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n type SyntheticEvent,\n forwardRef,\n useCallback,\n useRef,\n} from 'react';\n\nimport { Tooltip, type TooltipScopedProps, type TooltipTriggerProps } from '@dxos/react-ui';\n\nexport type TextTooltipProps = PropsWithChildren<\n {\n text: string;\n asChild?: boolean;\n onlyWhenTruncating?: boolean;\n truncateQuery?: string;\n } & Pick<TooltipTriggerProps, 'side'> &\n ComponentPropsWithoutRef<'button'>\n>;\n\nexport const TextTooltip = forwardRef<HTMLButtonElement, TooltipScopedProps<TextTooltipProps>>(\n (\n { __scopeTooltip, text, children, onlyWhenTruncating, asChild = true, side, truncateQuery, ...props },\n forwardedRef,\n ) => {\n const content = useRef<HTMLButtonElement | null>(null);\n const ref = useComposedRefs(content, forwardedRef);\n const handleInteract = useCallback(\n (event: SyntheticEvent) => {\n if (onlyWhenTruncating && content.current) {\n const element: HTMLElement | null = truncateQuery\n ? content.current.querySelector(truncateQuery)\n : content.current;\n if (!element || element.scrollWidth <= element.offsetWidth) {\n event.preventDefault();\n }\n }\n },\n [onlyWhenTruncating, truncateQuery],\n );\n return (\n <Tooltip.Trigger asChild={asChild} {...props} content={text} side={side} onInteract={handleInteract} ref={ref}>\n {children}\n </Tooltip.Trigger>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": ";;;;AAIA,SAASA,uBAAuB;AAChC,OAAOC,SAILC,YACAC,aACAC,cACK;AAEP,SAASC,eAAkE;AAYpE,IAAMC,cAAcC,2BACzB,CACE,EAAEC,gBAAgBC,MAAMC,UAAUC,oBAAoBC,UAAU,MAAMC,MAAMC,eAAe,GAAGC,MAAAA,GAC9FC,iBAAAA;;;AAEA,UAAMC,UAAUC,OAAiC,IAAA;AACjD,UAAMC,MAAMC,gBAAgBH,SAASD,YAAAA;AACrC,UAAMK,iBAAiBC,YACrB,CAACC,UAAAA;AACC,UAAIZ,sBAAsBM,QAAQO,SAAS;AACzC,cAAMC,UAA8BX,gBAChCG,QAAQO,QAAQE,cAAcZ,aAAAA,IAC9BG,QAAQO;AACZ,YAAI,CAACC,WAAWA,QAAQE,eAAeF,QAAQG,aAAa;AAC1DL,gBAAMM,eAAc;QACtB;MACF;IACF,GACA;MAAClB;MAAoBG;KAAc;AAErC,WACE,sBAAA,cAACgB,QAAQC,SAAO;MAACnB;MAAmB,GAAGG;MAAOE,SAASR;MAAMI;MAAYmB,YAAYX;MAAgBF;OAClGT,QAAAA;;;;AAGP,CAAA;",
|
|
6
6
|
"names": ["useComposedRefs", "React", "forwardRef", "useCallback", "useRef", "Tooltip", "TextTooltip", "forwardRef", "__scopeTooltip", "text", "children", "onlyWhenTruncating", "asChild", "side", "truncateQuery", "props", "forwardedRef", "content", "useRef", "ref", "useComposedRefs", "handleInteract", "useCallback", "event", "current", "element", "querySelector", "scrollWidth", "offsetWidth", "preventDefault", "Tooltip", "Trigger", "onInteract"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/TextTooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EACZ,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"TextTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/TextTooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EACZ,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAoC,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE5F,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAC9C;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,GACnC,wBAAwB,CAAC,QAAQ,CAAC,CACrC,CAAC;AAEF,eAAO,MAAM,WAAW;UARd,MAAM;cACF,OAAO;yBACI,OAAO;oBACZ,MAAM;;;;;2CA+BzB,CAAC"}
|