@yamada-ui/scroll-area 1.0.39-next-20240927162226 → 1.0.40-next-20240929092321
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-QHYMGAA2.mjs → chunk-O3DMBP23.mjs} +5 -1
- package/dist/{chunk-QHYMGAA2.mjs.map → chunk-O3DMBP23.mjs.map} +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/scroll-area.js +4 -0
- package/dist/scroll-area.js.map +1 -1
- package/dist/scroll-area.mjs +1 -1
- package/package.json +3 -3
@@ -156,6 +156,8 @@ var ScrollArea = forwardRef((props, ref) => {
|
|
156
156
|
);
|
157
157
|
}
|
158
158
|
});
|
159
|
+
ScrollArea.displayName = "ScrollArea";
|
160
|
+
ScrollArea.__ui__ = "ScrollArea";
|
159
161
|
var InternalScrollArea = forwardRef(
|
160
162
|
({ className, innerProps, children, ...rest }, ref) => {
|
161
163
|
return /* @__PURE__ */ jsx(
|
@@ -170,8 +172,10 @@ var InternalScrollArea = forwardRef(
|
|
170
172
|
);
|
171
173
|
}
|
172
174
|
);
|
175
|
+
InternalScrollArea.displayName = "InternalScrollArea";
|
176
|
+
InternalScrollArea.__ui__ = "InternalScrollArea";
|
173
177
|
|
174
178
|
export {
|
175
179
|
ScrollArea
|
176
180
|
};
|
177
|
-
//# sourceMappingURL=chunk-
|
181
|
+
//# sourceMappingURL=chunk-O3DMBP23.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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})\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, innerProps, children, ...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"],"mappings":";;;AACA;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;AAEP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,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A,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;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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, innerProps, children, ...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":";;;AACA;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;AAEP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,wBAAwB,EAAE,SAAS,OAAO;AAC5C;AAEA,IAAM,eAA4B;AAAA,EAChC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,QAAQ;AAAA,IACN,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,IACL,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE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AAQ;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,KAAK,UAAU,KAAK,aAAa;AAAA,QACjC,YAAU;AAAA,QACV,gBAAc,SAAS,SAAS;AAAA,QAChC,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,YAAY,UAAU,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":[]}
|
package/dist/index.js
CHANGED
@@ -167,6 +167,8 @@ var ScrollArea = (0, import_core.forwardRef)((props, ref) => {
|
|
167
167
|
);
|
168
168
|
}
|
169
169
|
});
|
170
|
+
ScrollArea.displayName = "ScrollArea";
|
171
|
+
ScrollArea.__ui__ = "ScrollArea";
|
170
172
|
var InternalScrollArea = (0, import_core.forwardRef)(
|
171
173
|
({ className, innerProps, children, ...rest }, ref) => {
|
172
174
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -181,6 +183,8 @@ var InternalScrollArea = (0, import_core.forwardRef)(
|
|
181
183
|
);
|
182
184
|
}
|
183
185
|
);
|
186
|
+
InternalScrollArea.displayName = "InternalScrollArea";
|
187
|
+
InternalScrollArea.__ui__ = "InternalScrollArea";
|
184
188
|
// Annotate the CommonJS export names for ESM import in node:
|
185
189
|
0 && (module.exports = {
|
186
190
|
ScrollArea
|
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 {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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})\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, innerProps, children, ...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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAKO;AACP,mBASO;AAEP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,wBAAwB,EAAE,SAAS,OAAO;AAC5C;AAEA,IAAM,eAA4B;AAAA,EAChC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,QAAQ;AAAA,IACN,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,IACL,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EACpD;AAAA,EACA,+BAA+B;AAAA,IAC7B,gBAAgB;AAAA,IACh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Ac,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,YAAU;AAAA,QACV,oBAAc,uBAAS,SAAS;AAAA,QAChC,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;AAID,IAAM,yBAAqB;AAAA,EACzB,CAAC,EAAE,WAAW,YAAY,UAAU,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;","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 {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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, innerProps, children, ...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;;;ACCA,kBAKO;AACP,mBASO;AAEP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,EAAE,S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AAG,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
@@ -165,6 +165,8 @@ var ScrollArea = (0, import_core.forwardRef)((props, ref) => {
|
|
165
165
|
);
|
166
166
|
}
|
167
167
|
});
|
168
|
+
ScrollArea.displayName = "ScrollArea";
|
169
|
+
ScrollArea.__ui__ = "ScrollArea";
|
168
170
|
var InternalScrollArea = (0, import_core.forwardRef)(
|
169
171
|
({ className, innerProps, children, ...rest }, ref) => {
|
170
172
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -179,6 +181,8 @@ var InternalScrollArea = (0, import_core.forwardRef)(
|
|
179
181
|
);
|
180
182
|
}
|
181
183
|
);
|
184
|
+
InternalScrollArea.displayName = "InternalScrollArea";
|
185
|
+
InternalScrollArea.__ui__ = "InternalScrollArea";
|
182
186
|
// Annotate the CommonJS export names for ESM import in node:
|
183
187
|
0 && (module.exports = {
|
184
188
|
ScrollArea
|
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 {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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})\n\ntype InternalScrollAreaProps = HTMLUIProps & Pick<ScrollAreaProps, \"innerProps\">\n\nconst InternalScrollArea = forwardRef<InternalScrollAreaProps, \"div\">(\n ({ className, innerProps, children, ...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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AACP,mBASO;AAEP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,wBAAwB,EAAE,SAAS,OAAO;AAC5C;AAEA,IAAM,eAA4B;AAA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U;AAAA,QACT,GAAG;AAAA,QAEH,uBACC,4CAAC,eAAG,KAAH,EAAO,WAAU,yBAAyB,GAAG,YAC3C,UACH,IAEA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/scroll-area.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\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 type { UIEvent } from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst neverStyles: CSSUIObject = {\n scrollbarWidth: \"none\",\n _scrollbar: { display: \"none\" },\n \"&::-webkit-scrollbar\": { display: \"none\" },\n}\n\nconst hiddenStyles: CSSUIObject = {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n _light: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n _dark: {\n _scrollbarTrack: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-track\": { bg: \"transparent\" },\n _scrollbarThumb: { bg: \"transparent\" },\n \"&::-webkit-scrollbar-thumb\": { bg: \"transparent\" },\n },\n \"@-moz-document url-prefix()\": {\n scrollbarColor: \"transparent transparent\",\n _light: {\n scrollbarColor: \"transparent transparent\",\n },\n _dark: {\n scrollbarColor: \"transparent transparent\",\n },\n },\n}\n\ninterface ScrollAreaOptions {\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"scroll\" | \"hover\" | \"never\"\n /**\n * Props for inner element.\n */\n innerProps?: HTMLUIProps\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\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-key={componentKey}\n data-hovered={dataAttr(isHovered)}\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, innerProps, children, ...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;AACA,kBAKO;AACP,mBASO;AAEP,mBAAkE;AA6K5D;AA3KN,IAAM,cAA2B;AAAA,EAC/B,gBAAgB;AAAA,EAChB,YAAY,EAAE,SAAS,OAAO;AAAA,EAC9B,wBAAwB,EAAE,SAAS,OAAO;AAC5C;AAEA,IAAM,eAA4B;AAAA,EAChC,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,EACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EAClD,QAAQ;AAAA,IACN,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,IACL,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,IAClD,iBAAiB,EAAE,IAAI,cAAc;AAAA,IACrC,8BAA8B,EAAE,IAAI,cAAc;AAAA,EACpD;AAAA,EACA,+BAA+B;AAAA,IAC7B,gBAAgB;AAAA,IAChB,QAAQ;AAAA,MACN,gBAAgB;AAAA,IAClB;AAAA,IACA,OAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AA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W;AAEhD,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,SAAK,wBAAU,KAAK,aAAa;AAAA,QACjC,YAAU;AAAA,QACV,oBAAc,uBAAS,SAAS;AAAA,QAChC,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,YAAY,UAAU,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.
|
3
|
+
"version": "1.0.40-next-20240929092321",
|
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.
|
40
|
-
"@yamada-ui/utils": "1.5.2
|
39
|
+
"@yamada-ui/core": "1.15.2-next-20240929092321",
|
40
|
+
"@yamada-ui/utils": "1.5.2"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"clean-package": "2.2.0",
|