@raystack/apsara 0.46.0-rc.4 → 0.46.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/_virtual/index.cjs +2 -2
- package/dist/_virtual/index.js +2 -2
- package/dist/_virtual/index2.cjs +2 -2
- package/dist/_virtual/index2.js +2 -2
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.cjs +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.cjs +1 -1
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/v1/components/avatar/avatar.cjs +18 -2
- package/dist/v1/components/avatar/avatar.cjs.map +1 -1
- package/dist/v1/components/avatar/avatar.d.ts +2 -1
- package/dist/v1/components/avatar/avatar.d.ts.map +1 -1
- package/dist/v1/components/avatar/avatar.js +18 -3
- package/dist/v1/components/avatar/avatar.js.map +1 -1
- package/dist/v1/components/avatar/utils.cjs +14 -34
- package/dist/v1/components/avatar/utils.cjs.map +1 -1
- package/dist/v1/components/avatar/utils.d.ts +1 -4
- package/dist/v1/components/avatar/utils.d.ts.map +1 -1
- package/dist/v1/components/avatar/utils.js +15 -34
- package/dist/v1/components/avatar/utils.js.map +1 -1
- package/dist/v1/components/breadcrumb/breadcrumb.cjs +35 -19
- package/dist/v1/components/breadcrumb/breadcrumb.cjs.map +1 -1
- package/dist/v1/components/breadcrumb/breadcrumb.d.ts +15 -12
- package/dist/v1/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/v1/components/breadcrumb/breadcrumb.js +37 -21
- package/dist/v1/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.cjs +5 -5
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.cjs.map +1 -1
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.d.ts +3 -3
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.d.ts.map +1 -1
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.js +5 -5
- package/dist/v1/components/dropdown-menu/dropdown-menu-content.js.map +1 -1
- package/dist/v1/components/icon-button/icon-button.cjs +8 -7
- package/dist/v1/components/icon-button/icon-button.cjs.map +1 -1
- package/dist/v1/components/icon-button/icon-button.d.ts +1 -1
- package/dist/v1/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/v1/components/icon-button/icon-button.js +8 -7
- package/dist/v1/components/icon-button/icon-button.js.map +1 -1
- package/dist/v1/components/select/select-content.cjs +16 -7
- package/dist/v1/components/select/select-content.cjs.map +1 -1
- package/dist/v1/components/select/select-content.d.ts +1 -1
- package/dist/v1/components/select/select-content.d.ts.map +1 -1
- package/dist/v1/components/select/select-content.js +16 -7
- package/dist/v1/components/select/select-content.js.map +1 -1
- package/dist/v1/components/select/select-item.cjs +19 -18
- package/dist/v1/components/select/select-item.cjs.map +1 -1
- package/dist/v1/components/select/select-item.d.ts +1 -3
- package/dist/v1/components/select/select-item.d.ts.map +1 -1
- package/dist/v1/components/select/select-item.js +19 -18
- package/dist/v1/components/select/select-item.js.map +1 -1
- package/dist/v1/components/select/select-multiple-value.cjs +67 -0
- package/dist/v1/components/select/select-multiple-value.cjs.map +1 -0
- package/dist/v1/components/select/select-multiple-value.d.ts +8 -0
- package/dist/v1/components/select/select-multiple-value.d.ts.map +1 -0
- package/dist/v1/components/select/select-multiple-value.js +65 -0
- package/dist/v1/components/select/select-multiple-value.js.map +1 -0
- package/dist/v1/components/select/select-root.cjs +64 -22
- package/dist/v1/components/select/select-root.cjs.map +1 -1
- package/dist/v1/components/select/select-root.d.ts +25 -26
- package/dist/v1/components/select/select-root.d.ts.map +1 -1
- package/dist/v1/components/select/select-root.js +64 -22
- package/dist/v1/components/select/select-root.js.map +1 -1
- package/dist/v1/components/select/select-trigger.cjs +18 -20
- package/dist/v1/components/select/select-trigger.cjs.map +1 -1
- package/dist/v1/components/select/select-trigger.d.ts +10 -18
- package/dist/v1/components/select/select-trigger.d.ts.map +1 -1
- package/dist/v1/components/select/select-trigger.js +16 -18
- package/dist/v1/components/select/select-trigger.js.map +1 -1
- package/dist/v1/components/select/select-value.cjs +23 -7
- package/dist/v1/components/select/select-value.cjs.map +1 -1
- package/dist/v1/components/select/select-value.d.ts +8 -2
- package/dist/v1/components/select/select-value.d.ts.map +1 -1
- package/dist/v1/components/select/select-value.js +22 -6
- package/dist/v1/components/select/select-value.js.map +1 -1
- package/dist/v1/components/select/select.d.ts +11 -9
- package/dist/v1/components/select/select.d.ts.map +1 -1
- package/dist/v1/components/select/select.module.css.cjs +1 -1
- package/dist/v1/components/select/select.module.css.js +1 -1
- package/dist/v1/components/select/types.d.ts +7 -0
- package/dist/v1/components/select/types.d.ts.map +1 -0
- package/dist/v1/components/sidebar/sidebar.cjs +26 -26
- package/dist/v1/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/v1/components/sidebar/sidebar.d.ts +8 -8
- package/dist/v1/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/v1/components/sidebar/sidebar.js +26 -26
- package/dist/v1/components/sidebar/sidebar.js.map +1 -1
- package/dist/v1/components/tooltip/tooltip.cjs +34 -12
- package/dist/v1/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/v1/components/tooltip/tooltip.d.ts +16 -9
- package/dist/v1/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/v1/components/tooltip/tooltip.js +35 -13
- package/dist/v1/components/tooltip/tooltip.js.map +1 -1
- package/dist/v1/components/tooltip/tooltip.module.css.cjs +1 -1
- package/dist/v1/components/tooltip/tooltip.module.css.js +1 -1
- package/dist/v1/components/tooltip/utils.cjs +30 -0
- package/dist/v1/components/tooltip/utils.cjs.map +1 -0
- package/dist/v1/components/tooltip/utils.d.ts +10 -0
- package/dist/v1/components/tooltip/utils.d.ts.map +1 -0
- package/dist/v1/components/tooltip/utils.js +28 -0
- package/dist/v1/components/tooltip/utils.js.map +1 -0
- package/dist/v1/hooks/index.cjs +2 -0
- package/dist/v1/hooks/index.cjs.map +1 -1
- package/dist/v1/hooks/index.d.ts +2 -1
- package/dist/v1/hooks/index.d.ts.map +1 -1
- package/dist/v1/hooks/index.js +1 -0
- package/dist/v1/hooks/index.js.map +1 -1
- package/dist/v1/hooks/useMouse.cjs +53 -0
- package/dist/v1/hooks/useMouse.cjs.map +1 -0
- package/dist/v1/hooks/useMouse.d.ts +20 -0
- package/dist/v1/hooks/useMouse.d.ts.map +1 -0
- package/dist/v1/hooks/useMouse.js +51 -0
- package/dist/v1/hooks/useMouse.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-select@2.2.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.cjs +0 -2
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-select@2.2.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.cjs.map +1 -1
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-select@2.2.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.js +1 -2
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-select@2.2.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.js.map +1 -1
- package/dist/v1/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import * as TooltipPrimitive from
|
|
2
|
-
import { VariantProps } from
|
|
3
|
-
import
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
declare const tooltip: (props?: ({
|
|
5
5
|
side?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
interface TooltipProps extends VariantProps<typeof tooltip> {
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
children:
|
|
10
|
-
message:
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
message: ReactNode;
|
|
11
11
|
classNames?: {
|
|
12
12
|
trigger?: string;
|
|
13
13
|
content?: string;
|
|
14
14
|
arrow?: string;
|
|
15
15
|
};
|
|
16
|
-
triggerStyle?:
|
|
17
|
-
contentStyle?:
|
|
16
|
+
triggerStyle?: CSSProperties;
|
|
17
|
+
contentStyle?: CSSProperties;
|
|
18
18
|
delayDuration?: number;
|
|
19
19
|
skipDelayDuration?: number;
|
|
20
20
|
'aria-label'?: string;
|
|
21
21
|
asChild?: boolean;
|
|
22
|
+
id?: string;
|
|
22
23
|
showArrow?: boolean;
|
|
24
|
+
followCursor?: boolean;
|
|
25
|
+
sideOffset?: number;
|
|
26
|
+
alignOffset?: number;
|
|
23
27
|
}
|
|
24
|
-
export declare const Tooltip:
|
|
25
|
-
|
|
28
|
+
export declare const Tooltip: {
|
|
29
|
+
({ children, message, disabled, side, classNames, triggerStyle, contentStyle, delayDuration, skipDelayDuration, "aria-label": ariaLabel, asChild, showArrow, id, followCursor, sideOffset, alignOffset }: TooltipProps): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const TooltipProvider: import("react").FC<TooltipPrimitive.TooltipProviderProps>;
|
|
26
33
|
export {};
|
|
27
34
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../v1/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../v1/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAW,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AAMjE,QAAA,MAAM,OAAO;;8EAgBX,CAAC;AAEH,UAAU,YAAa,SAAQ,YAAY,CAAC,OAAO,OAAO,CAAC;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,OAAO;8MAiBjB,YAAY;;CAsFd,CAAC;AAIF,eAAO,MAAM,eAAe,2DAA4B,CAAC"}
|
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
|
|
2
2
|
import { Provider as $a093c7e1ec25a057$export$2881499e37b75b9a, Root as $a093c7e1ec25a057$export$be92b6f5f03c0fe9, Trigger as $a093c7e1ec25a057$export$41fb9f06171c75f4, Portal as $a093c7e1ec25a057$export$602eac185826482c, Content as $a093c7e1ec25a057$export$7c6e2c02157bb7d2, Arrow as $a093c7e1ec25a057$export$21b07c8f274aebd5 } from '../../node_modules/.pnpm/@radix-ui_react-tooltip@1.0.7_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-tooltip/dist/index.js';
|
|
3
|
-
import { cva } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
|
|
4
|
-
import {
|
|
3
|
+
import { cx, cva } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
|
|
4
|
+
import { useId, useMemo } from 'react';
|
|
5
|
+
import { useMouse } from '../../hooks/useMouse.js';
|
|
5
6
|
import { Text } from '../text/text.js';
|
|
6
7
|
import styles from './tooltip.module.css.js';
|
|
8
|
+
import { getTransformForPlacement } from './utils.js';
|
|
7
9
|
|
|
8
10
|
const tooltip = cva(styles.content, {
|
|
9
11
|
variants: {
|
|
10
12
|
side: {
|
|
11
|
-
top: styles[
|
|
12
|
-
right: styles[
|
|
13
|
-
bottom: styles[
|
|
14
|
-
left: styles[
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
top: styles['side-top'],
|
|
14
|
+
right: styles['side-right'],
|
|
15
|
+
bottom: styles['side-bottom'],
|
|
16
|
+
left: styles['side-left'],
|
|
17
|
+
'top-left': styles['side-top-left'],
|
|
18
|
+
'top-right': styles['side-top-right'],
|
|
19
|
+
'bottom-left': styles['side-bottom-left'],
|
|
20
|
+
'bottom-right': styles['side-bottom-right']
|
|
19
21
|
}
|
|
20
22
|
},
|
|
21
23
|
defaultVariants: {
|
|
22
|
-
side:
|
|
24
|
+
side: 'top'
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
|
-
const Tooltip = ({ children, message, disabled, side =
|
|
26
|
-
|
|
27
|
+
const Tooltip = ({ children, message, disabled, side = 'top', classNames, triggerStyle, contentStyle, delayDuration = 200, skipDelayDuration = 200, 'aria-label': ariaLabel, asChild = true, showArrow = true, id, followCursor = false, sideOffset = 4, alignOffset = 0 }) => {
|
|
28
|
+
const generatedId = useId();
|
|
29
|
+
const tooltipId = id ?? generatedId;
|
|
30
|
+
const { ref, value: mouseValue, reset } = useMouse({
|
|
31
|
+
resetOnExit: false,
|
|
32
|
+
enabled: followCursor
|
|
33
|
+
});
|
|
34
|
+
const computedSide = useMemo(() => (side?.split('-')[0] || 'top'), [side]);
|
|
35
|
+
const computedAlign = useMemo(() => (side?.includes('-')
|
|
36
|
+
? side.split('-')[1] === 'left'
|
|
37
|
+
? 'start'
|
|
38
|
+
: 'end'
|
|
39
|
+
: 'center'), [side]);
|
|
40
|
+
if (disabled)
|
|
41
|
+
return children;
|
|
42
|
+
return (jsxRuntimeExports.jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { delayDuration: delayDuration, skipDelayDuration: skipDelayDuration, children: jsxRuntimeExports.jsxs($a093c7e1ec25a057$export$be92b6f5f03c0fe9, { children: [jsxRuntimeExports.jsx($a093c7e1ec25a057$export$41fb9f06171c75f4, { "aria-describedby": tooltipId, asChild: asChild, onFocus: followCursor ? reset : undefined, children: jsxRuntimeExports.jsx("div", { ref: ref, className: cx(styles.trigger, classNames?.trigger), style: triggerStyle, children: children }) }), jsxRuntimeExports.jsx($a093c7e1ec25a057$export$602eac185826482c, { children: jsxRuntimeExports.jsxs($a093c7e1ec25a057$export$7c6e2c02157bb7d2, { id: tooltipId, role: 'tooltip', "aria-label": ariaLabel || (typeof message === 'string' ? message : undefined), side: computedSide, align: computedAlign, alignOffset: alignOffset, sideOffset: sideOffset, className: tooltip({ side, className: classNames?.content }), "data-follow-cursor": followCursor, style: {
|
|
43
|
+
...contentStyle,
|
|
44
|
+
pointerEvents: followCursor ? 'none' : undefined,
|
|
45
|
+
transform: followCursor && mouseValue
|
|
46
|
+
? getTransformForPlacement(computedSide, computedAlign, mouseValue)
|
|
47
|
+
: undefined
|
|
48
|
+
}, children: [typeof message === 'string' ? jsxRuntimeExports.jsx(Text, { children: message }) : message, showArrow && (jsxRuntimeExports.jsx($a093c7e1ec25a057$export$21b07c8f274aebd5, { className: cx(styles.arrow, classNames?.arrow), width: 7, height: 7 }))] }) })] }) }));
|
|
27
49
|
};
|
|
28
50
|
Tooltip.displayName = 'Tooltip';
|
|
29
51
|
const TooltipProvider = $a093c7e1ec25a057$export$2881499e37b75b9a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../../../../v1/components/tooltip/tooltip.tsx"],"sourcesContent":["import * as TooltipPrimitive from
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../../../../v1/components/tooltip/tooltip.tsx"],"sourcesContent":["import * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport { VariantProps, cva, cx } from 'class-variance-authority';\nimport { CSSProperties, ReactNode, useId, useMemo } from 'react';\nimport { useMouse } from '~/v1/hooks';\nimport { Text } from '../text';\nimport styles from './tooltip.module.css';\nimport { getTransformForPlacement } from './utils';\n\nconst tooltip = cva(styles.content, {\n variants: {\n side: {\n top: styles['side-top'],\n right: styles['side-right'],\n bottom: styles['side-bottom'],\n left: styles['side-left'],\n 'top-left': styles['side-top-left'],\n 'top-right': styles['side-top-right'],\n 'bottom-left': styles['side-bottom-left'],\n 'bottom-right': styles['side-bottom-right']\n }\n },\n defaultVariants: {\n side: 'top'\n }\n});\n\ninterface TooltipProps extends VariantProps<typeof tooltip> {\n disabled?: boolean;\n children: ReactNode;\n message: ReactNode;\n classNames?: {\n trigger?: string;\n content?: string;\n arrow?: string;\n };\n triggerStyle?: CSSProperties;\n contentStyle?: CSSProperties;\n delayDuration?: number;\n skipDelayDuration?: number;\n 'aria-label'?: string;\n asChild?: boolean;\n id?: string;\n showArrow?: boolean;\n followCursor?: boolean;\n sideOffset?: number;\n alignOffset?: number;\n}\ntype TooltipSide = NonNullable<TooltipPrimitive.TooltipContentProps['side']>;\ntype TooltipAlign = NonNullable<TooltipPrimitive.TooltipContentProps['align']>;\n\nexport const Tooltip = ({\n children,\n message,\n disabled,\n side = 'top',\n classNames,\n triggerStyle,\n contentStyle,\n delayDuration = 200,\n skipDelayDuration = 200,\n 'aria-label': ariaLabel,\n asChild = true,\n showArrow = true,\n id,\n followCursor = false,\n sideOffset = 4,\n alignOffset = 0\n}: TooltipProps) => {\n const generatedId = useId();\n const tooltipId = id ?? generatedId;\n const {\n ref,\n value: mouseValue,\n reset\n } = useMouse<HTMLDivElement>({\n resetOnExit: false,\n enabled: followCursor\n });\n\n const computedSide = useMemo(\n () => (side?.split('-')[0] || 'top') as TooltipSide,\n [side]\n );\n const computedAlign = useMemo(\n () =>\n (side?.includes('-')\n ? side.split('-')[1] === 'left'\n ? 'start'\n : 'end'\n : 'center') as TooltipAlign,\n [side]\n );\n\n if (disabled) return children;\n\n return (\n <TooltipPrimitive.Provider\n delayDuration={delayDuration}\n skipDelayDuration={skipDelayDuration}\n >\n <TooltipPrimitive.Root>\n <TooltipPrimitive.Trigger\n aria-describedby={tooltipId}\n asChild={asChild}\n onFocus={followCursor ? reset : undefined}\n >\n <div\n ref={ref}\n className={cx(styles.trigger, classNames?.trigger)}\n style={triggerStyle}\n >\n {children}\n </div>\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n id={tooltipId}\n role='tooltip'\n aria-label={\n ariaLabel || (typeof message === 'string' ? message : undefined)\n }\n side={computedSide}\n align={computedAlign}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n className={tooltip({ side, className: classNames?.content })}\n data-follow-cursor={followCursor}\n style={{\n ...contentStyle,\n pointerEvents: followCursor ? 'none' : undefined,\n transform:\n followCursor && mouseValue\n ? getTransformForPlacement(\n computedSide,\n computedAlign,\n mouseValue\n )\n : undefined\n }}\n >\n {typeof message === 'string' ? <Text>{message}</Text> : message}\n {showArrow && (\n <TooltipPrimitive.Arrow\n className={cx(styles.arrow, classNames?.arrow)}\n width={7}\n height={7}\n />\n )}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport const TooltipProvider = TooltipPrimitive.Provider;\n"],"names":["_jsx","TooltipPrimitive.Provider","_jsxs","TooltipPrimitive.Root","TooltipPrimitive.Trigger","TooltipPrimitive.Portal","TooltipPrimitive.Content","TooltipPrimitive.Arrow"],"mappings":";;;;;;;;;AAQA,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;AAClC,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;AACvB,YAAA,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;AAC3B,YAAA,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC;AAC7B,YAAA,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;AACzB,YAAA,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC;AACnC,YAAA,WAAW,EAAE,MAAM,CAAC,gBAAgB,CAAC;AACrC,YAAA,aAAa,EAAE,MAAM,CAAC,kBAAkB,CAAC;AACzC,YAAA,cAAc,EAAE,MAAM,CAAC,mBAAmB,CAAC;AAC5C,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,IAAI,EAAE,KAAK;AACZ,KAAA;AACF,CAAA,CAAC,CAAC;AA0BU,MAAA,OAAO,GAAG,CAAC,EACtB,QAAQ,EACR,OAAO,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AAC,EACT,CAAA,CACH,IACwB,EACH,CAAA,CAAA,EAAA,CACJ,EACE,CAAA,EAC5B;AACJ,EAAE;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAEnB,MAAA,eAAe,GAAGN;;;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var styles = {"trigger":"tooltip-module_trigger__OsA69","content":"tooltip-module_content__K9qSW","slideDownAndFade":"tooltip-module_slideDownAndFade__Ikznd","slideLeftAndFade":"tooltip-module_slideLeftAndFade__on1wW","slideUpAndFade":"tooltip-module_slideUpAndFade__vlPm9","slideRightAndFade":"tooltip-module_slideRightAndFade__z-LBv","arrow":"tooltip-module_arrow__2aDyJ","slideDownRightAndFade":"tooltip-module_slideDownRightAndFade__RR0cg","slideDownLeftAndFade":"tooltip-module_slideDownLeftAndFade__CBwSL","slideUpRightAndFade":"tooltip-module_slideUpRightAndFade__E3TWo","slideUpLeftAndFade":"tooltip-module_slideUpLeftAndFade__Vg9xM"};
|
|
5
|
+
var styles = {"trigger":"tooltip-module_trigger__OsA69","content":"tooltip-module_content__K9qSW","slideDownAndFade":"tooltip-module_slideDownAndFade__Ikznd","slideLeftAndFade":"tooltip-module_slideLeftAndFade__on1wW","slideUpAndFade":"tooltip-module_slideUpAndFade__vlPm9","slideRightAndFade":"tooltip-module_slideRightAndFade__z-LBv","arrow":"tooltip-module_arrow__2aDyJ","slideDownRightAndFade":"tooltip-module_slideDownRightAndFade__RR0cg","slideDownLeftAndFade":"tooltip-module_slideDownLeftAndFade__CBwSL","slideUpRightAndFade":"tooltip-module_slideUpRightAndFade__E3TWo","slideUpLeftAndFade":"tooltip-module_slideUpLeftAndFade__Vg9xM","fade":"tooltip-module_fade__pKfjn"};
|
|
6
6
|
|
|
7
7
|
exports.default = styles;
|
|
8
8
|
//# sourceMappingURL=tooltip.module.css.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var styles = {"trigger":"tooltip-module_trigger__OsA69","content":"tooltip-module_content__K9qSW","slideDownAndFade":"tooltip-module_slideDownAndFade__Ikznd","slideLeftAndFade":"tooltip-module_slideLeftAndFade__on1wW","slideUpAndFade":"tooltip-module_slideUpAndFade__vlPm9","slideRightAndFade":"tooltip-module_slideRightAndFade__z-LBv","arrow":"tooltip-module_arrow__2aDyJ","slideDownRightAndFade":"tooltip-module_slideDownRightAndFade__RR0cg","slideDownLeftAndFade":"tooltip-module_slideDownLeftAndFade__CBwSL","slideUpRightAndFade":"tooltip-module_slideUpRightAndFade__E3TWo","slideUpLeftAndFade":"tooltip-module_slideUpLeftAndFade__Vg9xM"};
|
|
1
|
+
var styles = {"trigger":"tooltip-module_trigger__OsA69","content":"tooltip-module_content__K9qSW","slideDownAndFade":"tooltip-module_slideDownAndFade__Ikznd","slideLeftAndFade":"tooltip-module_slideLeftAndFade__on1wW","slideUpAndFade":"tooltip-module_slideUpAndFade__vlPm9","slideRightAndFade":"tooltip-module_slideRightAndFade__z-LBv","arrow":"tooltip-module_arrow__2aDyJ","slideDownRightAndFade":"tooltip-module_slideDownRightAndFade__RR0cg","slideDownLeftAndFade":"tooltip-module_slideDownLeftAndFade__CBwSL","slideUpRightAndFade":"tooltip-module_slideUpRightAndFade__E3TWo","slideUpLeftAndFade":"tooltip-module_slideUpLeftAndFade__Vg9xM","fade":"tooltip-module_fade__pKfjn"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
4
4
|
//# sourceMappingURL=tooltip.module.css.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getTransformForPlacement = (side, align, { x, y, width, height }) => {
|
|
4
|
+
const transforms = {
|
|
5
|
+
top: {
|
|
6
|
+
start: `translate(${x}px, ${y}px)`,
|
|
7
|
+
center: `translate(${x - width / 2}px, ${y}px)`,
|
|
8
|
+
end: `translate(${x - width}px, ${y}px)`
|
|
9
|
+
},
|
|
10
|
+
bottom: {
|
|
11
|
+
start: `translate(${x}px, ${y - height}px)`,
|
|
12
|
+
center: `translate(${x - width / 2}px, ${y - height}px)`,
|
|
13
|
+
end: `translate(${x - width}px, ${y - height}px)`
|
|
14
|
+
},
|
|
15
|
+
left: {
|
|
16
|
+
start: `translate(${x}px, ${y}px)`,
|
|
17
|
+
center: `translate(${x}px, ${y - height / 2}px)`,
|
|
18
|
+
end: `translate(${x}px, ${y - height}px)`
|
|
19
|
+
},
|
|
20
|
+
right: {
|
|
21
|
+
start: `translate(${x - width}px, ${y}px)`,
|
|
22
|
+
center: `translate(${x - width}px, ${y - height / 2}px)`,
|
|
23
|
+
end: `translate(${x - width}px, ${y - height}px)`
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return transforms[side][align];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.getTransformForPlacement = getTransformForPlacement;
|
|
30
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../v1/components/tooltip/utils.ts"],"sourcesContent":["import { TooltipContentProps } from '@radix-ui/react-tooltip';\n\ntype MousePosition = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport const getTransformForPlacement = (\n side: NonNullable<TooltipContentProps['side']>,\n align: NonNullable<TooltipContentProps['align']>,\n { x, y, width, height }: MousePosition\n): string => {\n const transforms = {\n top: {\n start: `translate(${x}px, ${y}px)`,\n center: `translate(${x - width / 2}px, ${y}px)`,\n end: `translate(${x - width}px, ${y}px)`\n },\n bottom: {\n start: `translate(${x}px, ${y - height}px)`,\n center: `translate(${x - width / 2}px, ${y - height}px)`,\n end: `translate(${x - width}px, ${y - height}px)`\n },\n left: {\n start: `translate(${x}px, ${y}px)`,\n center: `translate(${x}px, ${y - height / 2}px)`,\n end: `translate(${x}px, ${y - height}px)`\n },\n right: {\n start: `translate(${x - width}px, ${y}px)`,\n center: `translate(${x - width}px, ${y - height / 2}px)`,\n end: `translate(${x - width}px, ${y - height}px)`\n }\n };\n\n return transforms[side][align];\n};\n"],"names":[],"mappings":";;AASa,MAAA,wBAAwB,GAAG,CACtC,IAA8C,EAC9C,KAAgD,EAChD,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAiB,KAC5B;AACV,IAAA,MAAM,UAAU,GAAG;AACjB,QAAA,GAAG,EAAE;AACH,YAAA,KAAK,EAAE,CAAA,UAAA,EAAa,CAAC,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAClC,MAAM,EAAE,aAAa,CAAC,GAAG,KAAK,GAAG,CAAC,CAAO,IAAA,EAAA,CAAC,CAAK,GAAA,CAAA;AAC/C,YAAA,GAAG,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;AACzC,SAAA;AACD,QAAA,MAAM,EAAE;AACN,YAAA,KAAK,EAAE,CAAa,UAAA,EAAA,CAAC,OAAO,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;YAC3C,MAAM,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,GAAG,CAAC,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;YACxD,GAAG,EAAE,aAAa,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAClD,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAE,CAAA,UAAA,EAAa,CAAC,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAClC,MAAM,EAAE,aAAa,CAAC,CAAA,IAAA,EAAO,CAAC,GAAG,MAAM,GAAG,CAAC,CAAK,GAAA,CAAA;AAChD,YAAA,GAAG,EAAE,CAAa,UAAA,EAAA,CAAC,OAAO,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAC1C,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,KAAK,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAC1C,MAAM,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,GAAG,CAAC,CAAK,GAAA,CAAA;YACxD,GAAG,EAAE,aAAa,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAClD,SAAA;KACF,CAAC;AAEF,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;AACjC;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TooltipContentProps } from '@radix-ui/react-tooltip';
|
|
2
|
+
type MousePosition = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getTransformForPlacement: (side: NonNullable<TooltipContentProps['side']>, align: NonNullable<TooltipContentProps['align']>, { x, y, width, height }: MousePosition) => string;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../v1/components/tooltip/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,KAAK,aAAa,GAAG;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,wBAAwB,SAC7B,YAAY,mBAAmB,CAAC,MAAM,CAAC,CAAC,SACvC,YAAY,mBAAmB,CAAC,OAAO,CAAC,CAAC,2BACvB,aAAa,KACrC,MAyBF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const getTransformForPlacement = (side, align, { x, y, width, height }) => {
|
|
2
|
+
const transforms = {
|
|
3
|
+
top: {
|
|
4
|
+
start: `translate(${x}px, ${y}px)`,
|
|
5
|
+
center: `translate(${x - width / 2}px, ${y}px)`,
|
|
6
|
+
end: `translate(${x - width}px, ${y}px)`
|
|
7
|
+
},
|
|
8
|
+
bottom: {
|
|
9
|
+
start: `translate(${x}px, ${y - height}px)`,
|
|
10
|
+
center: `translate(${x - width / 2}px, ${y - height}px)`,
|
|
11
|
+
end: `translate(${x - width}px, ${y - height}px)`
|
|
12
|
+
},
|
|
13
|
+
left: {
|
|
14
|
+
start: `translate(${x}px, ${y}px)`,
|
|
15
|
+
center: `translate(${x}px, ${y - height / 2}px)`,
|
|
16
|
+
end: `translate(${x}px, ${y - height}px)`
|
|
17
|
+
},
|
|
18
|
+
right: {
|
|
19
|
+
start: `translate(${x - width}px, ${y}px)`,
|
|
20
|
+
center: `translate(${x - width}px, ${y - height / 2}px)`,
|
|
21
|
+
end: `translate(${x - width}px, ${y - height}px)`
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return transforms[side][align];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { getTransformForPlacement };
|
|
28
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../v1/components/tooltip/utils.ts"],"sourcesContent":["import { TooltipContentProps } from '@radix-ui/react-tooltip';\n\ntype MousePosition = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport const getTransformForPlacement = (\n side: NonNullable<TooltipContentProps['side']>,\n align: NonNullable<TooltipContentProps['align']>,\n { x, y, width, height }: MousePosition\n): string => {\n const transforms = {\n top: {\n start: `translate(${x}px, ${y}px)`,\n center: `translate(${x - width / 2}px, ${y}px)`,\n end: `translate(${x - width}px, ${y}px)`\n },\n bottom: {\n start: `translate(${x}px, ${y - height}px)`,\n center: `translate(${x - width / 2}px, ${y - height}px)`,\n end: `translate(${x - width}px, ${y - height}px)`\n },\n left: {\n start: `translate(${x}px, ${y}px)`,\n center: `translate(${x}px, ${y - height / 2}px)`,\n end: `translate(${x}px, ${y - height}px)`\n },\n right: {\n start: `translate(${x - width}px, ${y}px)`,\n center: `translate(${x - width}px, ${y - height / 2}px)`,\n end: `translate(${x - width}px, ${y - height}px)`\n }\n };\n\n return transforms[side][align];\n};\n"],"names":[],"mappings":"AASa,MAAA,wBAAwB,GAAG,CACtC,IAA8C,EAC9C,KAAgD,EAChD,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAiB,KAC5B;AACV,IAAA,MAAM,UAAU,GAAG;AACjB,QAAA,GAAG,EAAE;AACH,YAAA,KAAK,EAAE,CAAA,UAAA,EAAa,CAAC,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAClC,MAAM,EAAE,aAAa,CAAC,GAAG,KAAK,GAAG,CAAC,CAAO,IAAA,EAAA,CAAC,CAAK,GAAA,CAAA;AAC/C,YAAA,GAAG,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;AACzC,SAAA;AACD,QAAA,MAAM,EAAE;AACN,YAAA,KAAK,EAAE,CAAa,UAAA,EAAA,CAAC,OAAO,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;YAC3C,MAAM,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,GAAG,CAAC,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;YACxD,GAAG,EAAE,aAAa,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAClD,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAE,CAAA,UAAA,EAAa,CAAC,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAClC,MAAM,EAAE,aAAa,CAAC,CAAA,IAAA,EAAO,CAAC,GAAG,MAAM,GAAG,CAAC,CAAK,GAAA,CAAA;AAChD,YAAA,GAAG,EAAE,CAAa,UAAA,EAAA,CAAC,OAAO,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAC1C,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,KAAK,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAA,IAAA,EAAO,CAAC,CAAK,GAAA,CAAA;YAC1C,MAAM,EAAE,CAAa,UAAA,EAAA,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,GAAG,CAAC,CAAK,GAAA,CAAA;YACxD,GAAG,EAAE,aAAa,CAAC,GAAG,KAAK,CAAO,IAAA,EAAA,CAAC,GAAG,MAAM,CAAK,GAAA,CAAA;AAClD,SAAA;KACF,CAAC;AAEF,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;AACjC;;;;"}
|
package/dist/v1/hooks/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var useCopyToClipboard = require('./useCopyToClipboard.cjs');
|
|
4
|
+
var useMouse = require('./useMouse.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
exports.useCopyToClipboard = useCopyToClipboard.useCopyToClipboard;
|
|
9
|
+
exports.useMouse = useMouse.useMouse;
|
|
8
10
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/v1/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../v1/hooks/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../v1/hooks/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/v1/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
function useMouse(options = {}) {
|
|
6
|
+
const { resetOnExit = false, enabled = true } = options;
|
|
7
|
+
const [value, setValue] = react.useState(null);
|
|
8
|
+
const elementRef = react.useRef(null);
|
|
9
|
+
// Handle mouse movement using native MouseEvent
|
|
10
|
+
const handleMouseMove = react.useCallback((event) => {
|
|
11
|
+
if (!enabled)
|
|
12
|
+
return;
|
|
13
|
+
const element = elementRef.current;
|
|
14
|
+
if (element) {
|
|
15
|
+
const rect = element.getBoundingClientRect();
|
|
16
|
+
// Calculate coordinates relative to the element
|
|
17
|
+
const x = Math.max(0, Math.round(event.clientX - rect.left));
|
|
18
|
+
const y = Math.max(0, Math.round(event.clientY - rect.top));
|
|
19
|
+
setValue({ x, y, width: rect.width, height: rect.height });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
setValue({
|
|
23
|
+
x: event.clientX,
|
|
24
|
+
y: event.clientY,
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [enabled]);
|
|
30
|
+
const reset = react.useCallback(() => {
|
|
31
|
+
setValue(null);
|
|
32
|
+
}, []);
|
|
33
|
+
react.useEffect(() => {
|
|
34
|
+
if (!enabled)
|
|
35
|
+
return;
|
|
36
|
+
// If no element is provided, default to document for global tracking
|
|
37
|
+
const target = elementRef.current || document;
|
|
38
|
+
target.addEventListener('mousemove', handleMouseMove);
|
|
39
|
+
if (resetOnExit) {
|
|
40
|
+
target.addEventListener('mouseleave', reset);
|
|
41
|
+
}
|
|
42
|
+
return () => {
|
|
43
|
+
target.removeEventListener('mousemove', handleMouseMove);
|
|
44
|
+
if (resetOnExit) {
|
|
45
|
+
target.removeEventListener('mouseleave', reset);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, [enabled, handleMouseMove, reset, resetOnExit]);
|
|
49
|
+
return { ref: elementRef, value, reset };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
exports.useMouse = useMouse;
|
|
53
|
+
//# sourceMappingURL=useMouse.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMouse.cjs","sources":["../../../v1/hooks/useMouse.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\ntype PositionType = {\n x: number;\n y: number;\n};\ntype SizeType = {\n width: number;\n height: number;\n};\ntype UseMouseValue = PositionType & SizeType;\n\ntype UseMouseOptions = {\n resetOnExit?: boolean;\n enabled?: boolean;\n};\n\nexport function useMouse<T extends HTMLElement = HTMLElement>(\n options: UseMouseOptions = {}\n) {\n const { resetOnExit = false, enabled = true } = options;\n const [value, setValue] = useState<UseMouseValue | null>(null);\n const elementRef = useRef<T | null>(null);\n\n // Handle mouse movement using native MouseEvent\n const handleMouseMove = useCallback(\n (event: MouseEvent) => {\n if (!enabled) return;\n\n const element = elementRef.current;\n if (element) {\n const rect = element.getBoundingClientRect();\n // Calculate coordinates relative to the element\n const x = Math.max(0, Math.round(event.clientX - rect.left));\n const y = Math.max(0, Math.round(event.clientY - rect.top));\n setValue({ x, y, width: rect.width, height: rect.height });\n } else {\n setValue({\n x: event.clientX,\n y: event.clientY,\n width: 0,\n height: 0\n });\n }\n },\n [enabled]\n );\n\n const reset = useCallback(() => {\n setValue(null);\n }, []);\n\n useEffect(() => {\n if (!enabled) return;\n\n // If no element is provided, default to document for global tracking\n const target: HTMLElement | Document = elementRef.current || document;\n\n target.addEventListener('mousemove', handleMouseMove as EventListener);\n if (resetOnExit) {\n target.addEventListener('mouseleave', reset);\n }\n\n return () => {\n target.removeEventListener('mousemove', handleMouseMove as EventListener);\n if (resetOnExit) {\n target.removeEventListener('mouseleave', reset);\n }\n };\n }, [enabled, handleMouseMove, reset, resetOnExit]);\n\n return { ref: elementRef, value, reset };\n}\n"],"names":["useState","useRef","useCallback","useEffect"],"mappings":";;;;AAiBgB,SAAA,QAAQ,CACtB,OAAA,GAA2B,EAAE,EAAA;IAE7B,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAuB,IAAI,CAAC,CAAC;AAC/D,IAAA,MAAM,UAAU,GAAGC,YAAM,CAAW,IAAI,CAAC,CAAC;;AAG1C,IAAA,MAAM,eAAe,GAAGC,iBAAW,CACjC,CAAC,KAAiB,KAAI;AACpB,QAAA,IAAI,CAAC,OAAO;YAAE,OAAO;AAErB,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,IAAI,OAAO,EAAE;AACX,YAAA,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;;YAE7C,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,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AAE,KAAK,EAAE,CAAC;AAC3C;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type PositionType = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
type SizeType = {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
type UseMouseValue = PositionType & SizeType;
|
|
10
|
+
type UseMouseOptions = {
|
|
11
|
+
resetOnExit?: boolean;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function useMouse<T extends HTMLElement = HTMLElement>(options?: UseMouseOptions): {
|
|
15
|
+
ref: import("react").MutableRefObject<T | null>;
|
|
16
|
+
value: UseMouseValue | null;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=useMouse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMouse.d.ts","sourceRoot":"","sources":["../../../v1/hooks/useMouse.tsx"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AACF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,KAAK,aAAa,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE7C,KAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC1D,OAAO,GAAE,eAAoB;;;;EAsD9B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function useMouse(options = {}) {
|
|
4
|
+
const { resetOnExit = false, enabled = true } = options;
|
|
5
|
+
const [value, setValue] = useState(null);
|
|
6
|
+
const elementRef = useRef(null);
|
|
7
|
+
// Handle mouse movement using native MouseEvent
|
|
8
|
+
const handleMouseMove = useCallback((event) => {
|
|
9
|
+
if (!enabled)
|
|
10
|
+
return;
|
|
11
|
+
const element = elementRef.current;
|
|
12
|
+
if (element) {
|
|
13
|
+
const rect = element.getBoundingClientRect();
|
|
14
|
+
// Calculate coordinates relative to the element
|
|
15
|
+
const x = Math.max(0, Math.round(event.clientX - rect.left));
|
|
16
|
+
const y = Math.max(0, Math.round(event.clientY - rect.top));
|
|
17
|
+
setValue({ x, y, width: rect.width, height: rect.height });
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
setValue({
|
|
21
|
+
x: event.clientX,
|
|
22
|
+
y: event.clientY,
|
|
23
|
+
width: 0,
|
|
24
|
+
height: 0
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, [enabled]);
|
|
28
|
+
const reset = useCallback(() => {
|
|
29
|
+
setValue(null);
|
|
30
|
+
}, []);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!enabled)
|
|
33
|
+
return;
|
|
34
|
+
// If no element is provided, default to document for global tracking
|
|
35
|
+
const target = elementRef.current || document;
|
|
36
|
+
target.addEventListener('mousemove', handleMouseMove);
|
|
37
|
+
if (resetOnExit) {
|
|
38
|
+
target.addEventListener('mouseleave', reset);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
target.removeEventListener('mousemove', handleMouseMove);
|
|
42
|
+
if (resetOnExit) {
|
|
43
|
+
target.removeEventListener('mouseleave', reset);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, [enabled, handleMouseMove, reset, resetOnExit]);
|
|
47
|
+
return { ref: elementRef, value, reset };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { useMouse };
|
|
51
|
+
//# sourceMappingURL=useMouse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMouse.js","sources":["../../../v1/hooks/useMouse.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\ntype PositionType = {\n x: number;\n y: number;\n};\ntype SizeType = {\n width: number;\n height: number;\n};\ntype UseMouseValue = PositionType & SizeType;\n\ntype UseMouseOptions = {\n resetOnExit?: boolean;\n enabled?: boolean;\n};\n\nexport function useMouse<T extends HTMLElement = HTMLElement>(\n options: UseMouseOptions = {}\n) {\n const { resetOnExit = false, enabled = true } = options;\n const [value, setValue] = useState<UseMouseValue | null>(null);\n const elementRef = useRef<T | null>(null);\n\n // Handle mouse movement using native MouseEvent\n const handleMouseMove = useCallback(\n (event: MouseEvent) => {\n if (!enabled) return;\n\n const element = elementRef.current;\n if (element) {\n const rect = element.getBoundingClientRect();\n // Calculate coordinates relative to the element\n const x = Math.max(0, Math.round(event.clientX - rect.left));\n const y = Math.max(0, Math.round(event.clientY - rect.top));\n setValue({ x, y, width: rect.width, height: rect.height });\n } else {\n setValue({\n x: event.clientX,\n y: event.clientY,\n width: 0,\n height: 0\n });\n }\n },\n [enabled]\n );\n\n const reset = useCallback(() => {\n setValue(null);\n }, []);\n\n useEffect(() => {\n if (!enabled) return;\n\n // If no element is provided, default to document for global tracking\n const target: HTMLElement | Document = elementRef.current || document;\n\n target.addEventListener('mousemove', handleMouseMove as EventListener);\n if (resetOnExit) {\n target.addEventListener('mouseleave', reset);\n }\n\n return () => {\n target.removeEventListener('mousemove', handleMouseMove as EventListener);\n if (resetOnExit) {\n target.removeEventListener('mouseleave', reset);\n }\n };\n }, [enabled, handleMouseMove, reset, resetOnExit]);\n\n return { ref: elementRef, value, reset };\n}\n"],"names":[],"mappings":";;AAiBgB,SAAA,QAAQ,CACtB,OAAA,GAA2B,EAAE,EAAA;IAE7B,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,CAAC,KAAK,E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QAAA,MAAM,MAAM,GAA2B,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;AAEtE,QAAA,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,eAAgC,CAAC,CAAC;QACvE,IAAI,WAAW,EAAE;AACf,YAAA,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;SAC9C;AAED,QAAA,OAAO,MAAK;AACV,YAAA,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,eAAgC,CAAC,CAAC;YAC1E,IAAI,WAAW,EAAE;AACf,gBAAA,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;aACjD;AACH,SAAC,CAAC;KACH,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAEnD,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC3C;;;;"}
|
|
@@ -1169,7 +1169,6 @@ var Viewport = SelectViewport;
|
|
|
1169
1169
|
var Group = SelectGroup;
|
|
1170
1170
|
var Label = SelectLabel;
|
|
1171
1171
|
var Item = SelectItem;
|
|
1172
|
-
var ItemText = SelectItemText;
|
|
1173
1172
|
var ScrollDownButton = SelectScrollDownButton;
|
|
1174
1173
|
var Separator = SelectSeparator;
|
|
1175
1174
|
|
|
@@ -1177,7 +1176,6 @@ exports.Content = Content2;
|
|
|
1177
1176
|
exports.Group = Group;
|
|
1178
1177
|
exports.Icon = Icon;
|
|
1179
1178
|
exports.Item = Item;
|
|
1180
|
-
exports.ItemText = ItemText;
|
|
1181
1179
|
exports.Label = Label;
|
|
1182
1180
|
exports.Portal = Portal;
|
|
1183
1181
|
exports.Root = Root2;
|