@yamada-ui/scroll-area 1.0.40-dev-20241007025246 → 1.0.40-dev-20241007155115
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-IONF7VKP.mjs → chunk-JXGXFEFI.mjs} +5 -5
- package/dist/{chunk-IONF7VKP.mjs.map → chunk-JXGXFEFI.mjs.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/scroll-area.js +4 -4
- package/dist/scroll-area.js.map +1 -1
- package/dist/scroll-area.mjs +1 -1
- package/package.json +3 -3
@@ -21,20 +21,20 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
21
|
import { jsx } from "react/jsx-runtime";
|
22
22
|
var neverStyles = {
|
23
23
|
"&::-webkit-scrollbar": { display: "none" },
|
24
|
-
|
25
|
-
|
24
|
+
scrollbarWidth: "none",
|
25
|
+
_scrollbar: { display: "none" }
|
26
26
|
};
|
27
27
|
var hiddenStyles = {
|
28
28
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
29
29
|
"&::-webkit-scrollbar-track": { bg: "transparent" },
|
30
30
|
"@-moz-document url-prefix()": {
|
31
|
+
scrollbarColor: "transparent transparent",
|
31
32
|
_dark: {
|
32
33
|
scrollbarColor: "transparent transparent"
|
33
34
|
},
|
34
35
|
_light: {
|
35
36
|
scrollbarColor: "transparent transparent"
|
36
|
-
}
|
37
|
-
scrollbarColor: "transparent transparent"
|
37
|
+
}
|
38
38
|
},
|
39
39
|
_dark: {
|
40
40
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
@@ -178,4 +178,4 @@ InternalScrollArea.__ui__ = "InternalScrollArea";
|
|
178
178
|
export {
|
179
179
|
ScrollArea
|
180
180
|
};
|
181
|
-
//# sourceMappingURL=chunk-
|
181
|
+
//# sourceMappingURL=chunk-JXGXFEFI.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n _scrollbar: { display: \"none\" },\n scrollbarWidth: \"none\",\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB,EAAE,SAAS,OAAO;AAAA,EAC1C,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,gBAAgB;AAClB;AAEA,IAAM,eAA4B;AAAA,EAChC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,+BAA+B;AAAA,IAC7B,OAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,gBAAgB;AAAA,IAClB;AAAA,IACA,gBAAgB;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,IACL,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACvC;AAAA,EACA,QAAQ;AAAA,IACN,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACvC;AAAA,EACA,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,iBAAiB,EAAE,IAAI,cAAc;AACvC;AAmCO,IAAM,aAAa,WAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,I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QACV,kBAAgB,SAAS,WAAW;AAAA,QACnC,GAAG;AAAA;AAAA,MALC;AAAA,IAMP;AAAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,gBAAc,SAAS,SAAS;AAAA,QAChC,kBAAgB,SAAS,WAAW;AAAA,QACnC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF,CAAC;AACD,WAAW,cAAc;AACzB,WAAW,SAAS;AAIpB,IAAM,qBAAqB;AAAA,EACzB,CAAC,EAAE,WAAW,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AACrD,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,kBAAkB,SAAS;AAAA,QACzC,UAAU;AAAA,QACT,GAAG;AAAA,QAEH,uBACC,oBAAC,GAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB,EAAE,SAAS,OAAO;AAAA,EAC1C,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAChC;AAEA,IAAM,eAA4B;AAAA,EAChC,8BAA8B,EAA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AA,QAEH,uBACC,oBAAC,GAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":[]}
|
package/dist/index.js
CHANGED
@@ -32,20 +32,20 @@ var import_react = require("react");
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
33
33
|
var neverStyles = {
|
34
34
|
"&::-webkit-scrollbar": { display: "none" },
|
35
|
-
|
36
|
-
|
35
|
+
scrollbarWidth: "none",
|
36
|
+
_scrollbar: { display: "none" }
|
37
37
|
};
|
38
38
|
var hiddenStyles = {
|
39
39
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
40
40
|
"&::-webkit-scrollbar-track": { bg: "transparent" },
|
41
41
|
"@-moz-document url-prefix()": {
|
42
|
+
scrollbarColor: "transparent transparent",
|
42
43
|
_dark: {
|
43
44
|
scrollbarColor: "transparent transparent"
|
44
45
|
},
|
45
46
|
_light: {
|
46
47
|
scrollbarColor: "transparent transparent"
|
47
|
-
}
|
48
|
-
scrollbarColor: "transparent transparent"
|
48
|
+
}
|
49
49
|
},
|
50
50
|
_dark: {
|
51
51
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/scroll-area.tsx"],"sourcesContent":["export { ScrollArea } from \"./scroll-area\"\nexport type { ScrollAreaProps } from \"./scroll-area\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n _scrollbar: { display: \"none\" },\n scrollbarWidth: \"none\",\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAKO;AACP,mBASO;AACP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB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,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AACrD,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,iBAAG,kBAAkB,SAAS;AAAA,QACzC,UAAU;AAAA,QACT,GAAG;AAAA,QAEH,uBACC,4CAAC,eAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/scroll-area.tsx"],"sourcesContent":["export { ScrollArea } from \"./scroll-area\"\nexport type { ScrollAreaProps } from \"./scroll-area\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAKO;AACP,mBASO;AACP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB,EAAE,SAAS,OAAO;AAAA,EAC1C,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAChC;AAEA,IAAM,eAA4B;AAAA,EAChC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,+BAA+B;AAAA,IAC7B,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,gBAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,iBAAiB,EAAE,IAAI,cAAc;AAAA,E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MACH,kBAAc,yBAAW,KAAK,cAAc,YAAY;AAAA,MACxD,kBAAc,yBAAW,KAAK,cAAc,YAAY;AAAA,MACxD,cAAU,yBAAW,KAAK,UAAU,QAAQ;AAAA,IAC9C;AAAA,IACA,CAAC,KAAK,cAAc,cAAc,UAAU,IAAI;AAAA,EAClD;AAEA,MAAI,UAAU;AACZ,UAAM,eAAe,GAAG,SAAS,IAAI,WAAW;AAEhD,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,SAAK,wBAAU,KAAK,aAAa;AAAA,QACjC,oBAAc,uBAAS,SAAS;AAAA,QAChC,YAAU;AAAA,QACV,sBAAgB,uBAAS,WAAW;AAAA,QACnC,GAAG;AAAA;AAAA,MALC;AAAA,IAMP;AAAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,oBAAc,uBAAS,SAAS;AAAA,QAChC,sBAAgB,uBAAS,WAAW;AAAA,QACnC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF,CAAC;AACD,WAAW,cAAc;AACzB,WAAW,SAAS;AAIpB,IAAM,yBAAqB;AAAA,EACzB,CAAC,EAAE,WAAW,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AACrD,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,iBAAG,kBAAkB,SAAS;AAAA,QACzC,UAAU;AAAA,QACT,GAAG;AAAA,QAEH,uBACC,4CAAC,eAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":[]}
|
package/dist/index.mjs
CHANGED
package/dist/scroll-area.js
CHANGED
@@ -30,20 +30,20 @@ var import_react = require("react");
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
31
31
|
var neverStyles = {
|
32
32
|
"&::-webkit-scrollbar": { display: "none" },
|
33
|
-
|
34
|
-
|
33
|
+
scrollbarWidth: "none",
|
34
|
+
_scrollbar: { display: "none" }
|
35
35
|
};
|
36
36
|
var hiddenStyles = {
|
37
37
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
38
38
|
"&::-webkit-scrollbar-track": { bg: "transparent" },
|
39
39
|
"@-moz-document url-prefix()": {
|
40
|
+
scrollbarColor: "transparent transparent",
|
40
41
|
_dark: {
|
41
42
|
scrollbarColor: "transparent transparent"
|
42
43
|
},
|
43
44
|
_light: {
|
44
45
|
scrollbarColor: "transparent transparent"
|
45
|
-
}
|
46
|
-
scrollbarColor: "transparent transparent"
|
46
|
+
}
|
47
47
|
},
|
48
48
|
_dark: {
|
49
49
|
"&::-webkit-scrollbar-thumb": { bg: "transparent" },
|
package/dist/scroll-area.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n _scrollbar: { display: \"none\" },\n scrollbarWidth: \"none\",\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAKO;AACP,mBASO;AACP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB,EAAE,SAAS,OAAO;AAAA,EAC1C,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,gBAAgB;AAClB;AAEA,IAAM,eAA4B;AAAA,EAChC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,+BAA+B;AAAA,IAC7B,OAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,gBAAgB;AAAA,IAClB;AAAA,IACA,gBAAgB;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,IACL,8BAA8B,EAAE,IAAI,cAAc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{ CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { UIEvent } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentStyle,\n} from \"@yamada-ui/core\"\nimport {\n cx,\n dataAttr,\n handlerAll,\n isMac,\n merge,\n mergeRefs,\n useSafeLayoutEffect,\n vendor,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n \"&::-webkit-scrollbar\": { display: \"none\" },\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n _dark: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _light: {\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n },\n _scrollbarThumb: { bg: \"transparent\" },\n _scrollbarTrack: { bg: \"transparent\" },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport interface ScrollAreaProps\n extends HTMLUIProps,\n ThemeProps<\"ScrollArea\">,\n ScrollAreaOptions {}\n\n/**\n * `ScrollArea` is a component that displays a customized scrollbar.\n *\n * @see Docs https://yamada-ui.com/components/data-display/scroll-area\n */\nexport const ScrollArea = forwardRef<ScrollAreaProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentStyle(\"ScrollArea\", props)\n const {\n type = \"hover\",\n overflow = \"overlay\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n } = omitThemeProps(mergedProps)\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isSafari = isMac() && vendor(/apple/i)\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const css: CSSUIObject = useMemo(() => {\n const baseStyle = { overflow, ...styles }\n\n if (isNever) {\n return merge(baseStyle, neverStyles)\n } else {\n return merge(\n baseStyle,\n !isAlways && !isHovered && !isScrolling ? hiddenStyles : {},\n )\n }\n }, [isAlways, isHovered, isNever, isScrolling, overflow, styles])\n\n const computedProps = useMemo(\n () => ({\n __css: css,\n ...rest,\n onMouseEnter: handlerAll(rest.onMouseEnter, onMouseEnter),\n onMouseLeave: handlerAll(rest.onMouseLeave, onMouseLeave),\n onScroll: handlerAll(rest.onScroll, onScroll),\n }),\n [css, onMouseEnter, onMouseLeave, onScroll, rest],\n )\n\n if (isSafari) {\n const componentKey = `${isHovered}-${isScrolling}`\n\n return (\n <InternalScrollArea\n key={componentKey}\n ref={mergeRefs(ref, scrollAreaRef)}\n data-hovered={dataAttr(isHovered)}\n data-key={componentKey}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n } else {\n return (\n <InternalScrollArea\n ref={ref}\n data-hovered={dataAttr(isHovered)}\n data-scrolling={dataAttr(isScrolling)}\n {...computedProps}\n />\n )\n }\n})\nScrollArea.displayName = \"ScrollArea\"\nScrollArea.__ui__ = \"ScrollArea\"\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, children, innerProps, ...rest }, ref) => {\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-scroll-area\", className)}\n tabIndex={0}\n {...rest}\n >\n {innerProps ? (\n <ui.div className=\"ui-scroll-area__inner\" {...innerProps}>\n {children}\n </ui.div>\n ) : (\n children\n )}\n </ui.div>\n )\n },\n)\n\nInternalScrollArea.displayName = \"InternalScrollArea\"\nInternalScrollArea.__ui__ = \"InternalScrollArea\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAKO;AACP,mBASO;AACP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,wBAAwB,EAAE,SAAS,OAAO;AAAA,EAC1C,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAChC;AAEA,IAAM,eAA4B;AAAA,EAChC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,+BAA+B;AAAA,IAC7B,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,gBAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACvC;AAAA,EACA,QAAQ;AAAA,IACN,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACvC;AAAA,EACA,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,iBAAiB,EAAE,IAAI,cAAc;AACvC;AAmCO,IAAM,iBAAa,wBAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,QAAI,+BAAkB,cAAc,KAAK;AACnE,QAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB;AA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AAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,oBAAc,uBAAS,SAAS;AAAA,QAChC,sBAAgB,uBAAS,WAAW;AAAA,QACnC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF,CAAC;AACD,WAAW,cAAc;AACzB,WAAW,SAAS;AAIpB,IAAM,yBAAqB;AAAA,EACzB,CAAC,EAAE,WAAW,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AACrD,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,iBAAG,kBAAkB,SAAS;AAAA,QACzC,UAAU;AAAA,QACT,GAAG;AAAA,QAEH,uBACC,4CAAC,eAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":[]}
|
package/dist/scroll-area.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@yamada-ui/scroll-area",
|
3
|
-
"version": "1.0.40-dev-
|
3
|
+
"version": "1.0.40-dev-20241007155115",
|
4
4
|
"description": "Yamada UI scroll area component",
|
5
5
|
"keywords": [
|
6
6
|
"yamada",
|
@@ -36,8 +36,8 @@
|
|
36
36
|
"url": "https://github.com/yamada-ui/yamada-ui/issues"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@yamada-ui/core": "1.15.2-dev-
|
40
|
-
"@yamada-ui/utils": "1.5.3-dev-
|
39
|
+
"@yamada-ui/core": "1.15.2-dev-20241007155115",
|
40
|
+
"@yamada-ui/utils": "1.5.3-dev-20241007155115"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"clean-package": "2.2.0",
|