@yamada-ui/react 2.3.0-dev-20261026085945 → 2.3.0-dev-20261027031124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/marquee/index.cjs +21 -0
- package/dist/cjs/components/marquee/marquee.cjs +74 -0
- package/dist/cjs/components/marquee/marquee.cjs.map +1 -0
- package/dist/cjs/components/marquee/marquee.style.cjs +121 -0
- package/dist/cjs/components/marquee/marquee.style.cjs.map +1 -0
- package/dist/cjs/components/marquee/namespace.cjs +26 -0
- package/dist/cjs/components/marquee/namespace.cjs.map +1 -0
- package/dist/cjs/components/marquee/use-marquee.cjs +183 -0
- package/dist/cjs/components/marquee/use-marquee.cjs.map +1 -0
- package/dist/cjs/components/prose/index.cjs +7 -0
- package/dist/cjs/components/prose/prose.cjs +17 -0
- package/dist/cjs/components/prose/prose.cjs.map +1 -0
- package/dist/cjs/components/prose/prose.style.cjs +205 -0
- package/dist/cjs/components/prose/prose.style.cjs.map +1 -0
- package/dist/cjs/index.cjs +88 -47
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/marquee/index.js +5 -0
- package/dist/esm/components/marquee/marquee.js +69 -0
- package/dist/esm/components/marquee/marquee.js.map +1 -0
- package/dist/esm/components/marquee/marquee.style.js +122 -0
- package/dist/esm/components/marquee/marquee.style.js.map +1 -0
- package/dist/esm/components/marquee/namespace.js +15 -0
- package/dist/esm/components/marquee/namespace.js.map +1 -0
- package/dist/esm/components/marquee/use-marquee.js +181 -0
- package/dist/esm/components/marquee/use-marquee.js.map +1 -0
- package/dist/esm/components/prose/index.js +3 -0
- package/dist/esm/components/prose/prose.js +15 -0
- package/dist/esm/components/prose/prose.js.map +1 -0
- package/dist/esm/components/prose/prose.style.js +205 -0
- package/dist/esm/components/prose/prose.style.js.map +1 -0
- package/dist/esm/index.js +72 -51
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/marquee/index.d.ts +5 -0
- package/dist/types/components/marquee/marquee.d.ts +50 -0
- package/dist/types/components/marquee/marquee.style.d.ts +8 -0
- package/dist/types/components/marquee/namespace.d.ts +8 -0
- package/dist/types/components/marquee/use-marquee.d.ts +127 -0
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/prose/index.d.ts +3 -0
- package/dist/types/components/prose/prose.d.ts +17 -0
- package/dist/types/components/prose/prose.style.d.ts +121 -0
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/timeline/timeline.d.ts +1 -1
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/index.d.ts +34 -26
- package/package.json +5 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_marquee_style = require("./marquee.style.cjs");
|
|
3
|
+
const require_use_marquee = require("./use-marquee.cjs");
|
|
4
|
+
const require_marquee = require("./marquee.cjs");
|
|
5
|
+
const require_namespace = require("./namespace.cjs");
|
|
6
|
+
Object.defineProperty(exports, "Marquee", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return require_namespace.namespace_exports;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.MarqueeContent = require_marquee.MarqueeContent;
|
|
13
|
+
exports.MarqueeContext = require_use_marquee.MarqueeContext;
|
|
14
|
+
exports.MarqueeEdge = require_marquee.MarqueeEdge;
|
|
15
|
+
exports.MarqueeItem = require_marquee.MarqueeItem;
|
|
16
|
+
exports.MarqueePropsContext = require_marquee.MarqueePropsContext;
|
|
17
|
+
exports.MarqueeRoot = require_marquee.MarqueeRoot;
|
|
18
|
+
exports.marqueeStyle = require_marquee_style.marqueeStyle;
|
|
19
|
+
exports.useMarquee = require_use_marquee.useMarquee;
|
|
20
|
+
exports.useMarqueeContext = require_use_marquee.useMarqueeContext;
|
|
21
|
+
exports.useMarqueePropsContext = require_marquee.useMarqueePropsContext;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_children = require("../../utils/children.cjs");
|
|
3
|
+
const require_var = require("../../core/system/var.cjs");
|
|
4
|
+
const require_factory = require("../../core/system/factory.cjs");
|
|
5
|
+
const require_create_component = require("../../core/components/create-component.cjs");
|
|
6
|
+
const require_marquee_style = require("./marquee.style.cjs");
|
|
7
|
+
const require_use_marquee = require("./use-marquee.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/marquee/marquee.tsx
|
|
11
|
+
const { PropsContext: MarqueePropsContext, usePropsContext: useMarqueePropsContext, withContext, withProvider } = require_create_component.createSlotComponent("marquee", require_marquee_style.marqueeStyle);
|
|
12
|
+
/**
|
|
13
|
+
* `Marquee` continuously scrolls content horizontally or vertically.
|
|
14
|
+
*
|
|
15
|
+
* @see https://yamada-ui.com/docs/components/marquee
|
|
16
|
+
*/
|
|
17
|
+
const MarqueeRoot = withProvider(({ children, contentProps, ...rest }) => {
|
|
18
|
+
const validChildren = require_children.useValidChildren(children);
|
|
19
|
+
const customContent = require_children.useFindChild(validChildren, MarqueeContent);
|
|
20
|
+
const items = require_children.usePickChildren(validChildren, MarqueeItem);
|
|
21
|
+
const otherChildren = require_children.useOmitChildren(validChildren, MarqueeItem);
|
|
22
|
+
const { copies, getContentProps, getEdgeProps, getGroupProps, getRootProps } = require_use_marquee.useMarquee(rest);
|
|
23
|
+
const context = (0, react.useMemo)(() => ({
|
|
24
|
+
copies,
|
|
25
|
+
getContentProps,
|
|
26
|
+
getEdgeProps,
|
|
27
|
+
getGroupProps
|
|
28
|
+
}), [
|
|
29
|
+
copies,
|
|
30
|
+
getContentProps,
|
|
31
|
+
getEdgeProps,
|
|
32
|
+
getGroupProps
|
|
33
|
+
]);
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_marquee.MarqueeContext, {
|
|
35
|
+
value: context,
|
|
36
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.div, {
|
|
37
|
+
...getRootProps(),
|
|
38
|
+
children: customContent ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarqueeContent, {
|
|
39
|
+
...contentProps,
|
|
40
|
+
children: items
|
|
41
|
+
}), otherChildren] })
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}, "root")(void 0, ({ edgeColor, edgeSize, gap, ...rest }) => ({
|
|
45
|
+
...rest,
|
|
46
|
+
"--marquee-edge-color": require_var.varAttr(edgeColor, "colors"),
|
|
47
|
+
"--marquee-edge-size": require_var.varAttr(edgeSize, "sizes"),
|
|
48
|
+
"--marquee-gap": require_var.varAttr(gap, "spaces")
|
|
49
|
+
}));
|
|
50
|
+
const MarqueeContent = withContext(({ children, ...rest }) => {
|
|
51
|
+
const { copies, getContentProps, getGroupProps } = require_use_marquee.useMarqueeContext();
|
|
52
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.div, {
|
|
53
|
+
...getContentProps(rest),
|
|
54
|
+
children: Array.from({ length: copies + 1 }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarqueeGroup, {
|
|
55
|
+
...getGroupProps({ index }),
|
|
56
|
+
children
|
|
57
|
+
}, index))
|
|
58
|
+
});
|
|
59
|
+
}, "content")();
|
|
60
|
+
const MarqueeGroup = withContext("div", "group")();
|
|
61
|
+
const MarqueeItem = withContext("div", "item")();
|
|
62
|
+
const MarqueeEdge = withContext("div", "edge")(void 0, (props) => {
|
|
63
|
+
const { getEdgeProps } = require_use_marquee.useMarqueeContext();
|
|
64
|
+
return getEdgeProps(props);
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.MarqueeContent = MarqueeContent;
|
|
68
|
+
exports.MarqueeEdge = MarqueeEdge;
|
|
69
|
+
exports.MarqueeItem = MarqueeItem;
|
|
70
|
+
exports.MarqueePropsContext = MarqueePropsContext;
|
|
71
|
+
exports.MarqueeRoot = MarqueeRoot;
|
|
72
|
+
exports.useMarqueePropsContext = useMarqueePropsContext;
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=marquee.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marquee.cjs","names":["createSlotComponent","marqueeStyle","useValidChildren","useFindChild","usePickChildren","useOmitChildren","useMarquee","useMemo","MarqueeContext","styled","varAttr","useMarqueeContext"],"sources":["../../../../src/components/marquee/marquee.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n CSSProps,\n HTMLStyledProps,\n SimpleDirection,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { MarqueeStyle } from \"./marquee.style\"\nimport type { UseMarqueeProps } from \"./use-marquee\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled, varAttr } from \"../../core\"\nimport {\n useFindChild,\n useOmitChildren,\n usePickChildren,\n useValidChildren,\n} from \"../../utils\"\nimport { marqueeStyle } from \"./marquee.style\"\nimport { MarqueeContext, useMarquee, useMarqueeContext } from \"./use-marquee\"\n\nexport interface MarqueeRootProps\n extends Merge<HTMLStyledProps, UseMarqueeProps>, ThemeProps<MarqueeStyle> {\n /**\n * The color of the edge gradient.\n *\n * @default 'bg'\n */\n edgeColor?: CSSProps[\"color\"]\n /**\n * The size of the edge gradient.\n *\n * @default '20%'\n */\n edgeSize?: CSSProps[\"width\"]\n /**\n * Props for content component.\n */\n contentProps?: MarqueeContentProps\n}\n\nconst {\n PropsContext: MarqueePropsContext,\n usePropsContext: useMarqueePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<MarqueeRootProps, MarqueeStyle>(\"marquee\", marqueeStyle)\n\nexport { MarqueePropsContext, useMarqueePropsContext }\n\n/**\n * `Marquee` continuously scrolls content horizontally or vertically.\n *\n * @see https://yamada-ui.com/docs/components/marquee\n */\nexport const MarqueeRoot = withProvider<\"div\", MarqueeRootProps>(\n ({ children, contentProps, ...rest }) => {\n const validChildren = useValidChildren(children)\n const customContent = useFindChild(validChildren, MarqueeContent)\n const items = usePickChildren(validChildren, MarqueeItem)\n const otherChildren = useOmitChildren(validChildren, MarqueeItem)\n const {\n copies,\n getContentProps,\n getEdgeProps,\n getGroupProps,\n getRootProps,\n } = useMarquee(rest)\n const context = useMemo(\n () => ({ copies, getContentProps, getEdgeProps, getGroupProps }),\n [copies, getContentProps, getEdgeProps, getGroupProps],\n )\n\n return (\n <MarqueeContext value={context}>\n <styled.div {...getRootProps()}>\n {customContent ? (\n children\n ) : (\n <>\n <MarqueeContent {...contentProps}>{items}</MarqueeContent>\n {otherChildren}\n </>\n )}\n </styled.div>\n </MarqueeContext>\n )\n },\n \"root\",\n)(undefined, ({ edgeColor, edgeSize, gap, ...rest }) => ({\n ...rest,\n \"--marquee-edge-color\": varAttr(edgeColor, \"colors\"),\n \"--marquee-edge-size\": varAttr(edgeSize, \"sizes\"),\n \"--marquee-gap\": varAttr(gap, \"spaces\"),\n}))\n\nexport interface MarqueeContentProps extends HTMLStyledProps {}\n\nexport const MarqueeContent = withContext<\"div\", MarqueeContentProps>(\n ({ children, ...rest }) => {\n const { copies, getContentProps, getGroupProps } = useMarqueeContext()\n\n return (\n <styled.div {...getContentProps(rest)}>\n {Array.from({ length: copies + 1 }, (_, index) => (\n <MarqueeGroup key={index} {...getGroupProps({ index })}>\n {children}\n </MarqueeGroup>\n ))}\n </styled.div>\n )\n },\n \"content\",\n)()\n\nconst MarqueeGroup = withContext(\"div\", \"group\")()\n\nexport interface MarqueeItemProps extends HTMLStyledProps {}\n\nexport const MarqueeItem = withContext<\"div\", MarqueeItemProps>(\"div\", \"item\")()\n\nexport interface MarqueeEdgeProps extends Omit<HTMLStyledProps, \"direction\"> {\n /**\n * The edge to fade, relative to the marquee orientation.\n *\n * @default 'start'\n */\n direction?: SimpleDirection\n}\n\nexport const MarqueeEdge = withContext<\"div\", MarqueeEdgeProps>(\"div\", \"edge\")(\n undefined,\n (props) => {\n const { getEdgeProps } = useMarqueeContext()\n\n return getEdgeProps(props)\n },\n)\n"],"mappings":";;;;;;;;;;AA0CA,MAAM,EACJ,cAAc,qBACd,iBAAiB,wBACjB,aACA,iBACEA,yBAAAA,oBAAoD,WAAWC,sBAAAA,YAAY;;;;;;AAS/E,MAAa,cAAc,cACxB,EAAE,UAAU,cAAc,GAAG,WAAW;CACvC,MAAM,gBAAgBC,iBAAAA,iBAAiB,QAAQ;CAC/C,MAAM,gBAAgBC,iBAAAA,aAAa,eAAe,cAAc;CAChE,MAAM,QAAQC,iBAAAA,gBAAgB,eAAe,WAAW;CACxD,MAAM,gBAAgBC,iBAAAA,gBAAgB,eAAe,WAAW;CAChE,MAAM,EACJ,QACA,iBACA,cACA,eACA,iBACEC,oBAAAA,WAAW,IAAI;CACnB,MAAM,WAAA,GAAUC,MAAAA,QAAAA,QACP;EAAE;EAAQ;EAAiB;EAAc;CAAc,IAC9D;EAAC;EAAQ;EAAiB;EAAc;CAAa,CACvD;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,gBAAD;EAAgB,OAAO;EACrB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;GAAY,GAAI,aAAa;GAC1B,UAAA,gBACC,WAEA,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;IAAgB,GAAI;IAAe,UAAA;GAAsB,CAAA,GACxD,aACD,EAAA,CAAA;EAEM,CAAA;CACE,CAAA;AAEpB,GACA,MACF,CAAC,CAAC,KAAA,IAAY,EAAE,WAAW,UAAU,KAAK,GAAG,YAAY;CACvD,GAAG;CACH,wBAAwBC,YAAAA,QAAQ,WAAW,QAAQ;CACnD,uBAAuBA,YAAAA,QAAQ,UAAU,OAAO;CAChD,iBAAiBA,YAAAA,QAAQ,KAAK,QAAQ;AACxC,EAAE;AAIF,MAAa,iBAAiB,aAC3B,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,EAAE,QAAQ,iBAAiB,kBAAkBC,oBAAAA,kBAAkB;CAErE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,gBAAAA,OAAO,KAAR;EAAY,GAAI,gBAAgB,IAAI;EACjC,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAS,EAAE,IAAI,GAAG,UACtC,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;GAA0B,GAAI,cAAc,EAAE,MAAM,CAAC;GAClD;EACW,GAFK,KAEL,CACf;CACS,CAAA;AAEhB,GACA,SACF,CAAC,CAAC;AAEF,MAAM,eAAe,YAAY,OAAO,OAAO,CAAC,CAAC;AAIjD,MAAa,cAAc,YAAqC,OAAO,MAAM,CAAC,CAAC;AAW/E,MAAa,cAAc,YAAqC,OAAO,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiBE,oBAAAA,kBAAkB;CAE3C,OAAO,aAAa,KAAK;AAC3B,CACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
//#region src/components/marquee/marquee.style.ts
|
|
2
|
+
const marqueeStyle = require("../../core/system/config.cjs").defineComponentSlotStyle({ base: {
|
|
3
|
+
content: {
|
|
4
|
+
"&:not([data-ready])": { animationName: "none" },
|
|
5
|
+
alignItems: "center",
|
|
6
|
+
animationDelay: "{marquee-delay}",
|
|
7
|
+
animationDirection: "{marquee-direction}",
|
|
8
|
+
animationDuration: "{marquee-duration}",
|
|
9
|
+
animationFillMode: "both",
|
|
10
|
+
animationIterationCount: "{marquee-loop-count}",
|
|
11
|
+
animationPlayState: "{marquee-play-state}",
|
|
12
|
+
animationTimingFunction: "linear",
|
|
13
|
+
display: "flex",
|
|
14
|
+
flex: "0 0 auto",
|
|
15
|
+
minW: "0",
|
|
16
|
+
position: "relative",
|
|
17
|
+
_horizontal: { w: "max-content" },
|
|
18
|
+
_keyframes: { to: { transform: "translate({marquee-translate-x}, {marquee-translate-y})" } },
|
|
19
|
+
_mediaReduceMotion: { animationName: "none" },
|
|
20
|
+
_vertical: {
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
h: "max-content"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
edge: {
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
position: "absolute",
|
|
28
|
+
zIndex: "1",
|
|
29
|
+
_horizontal: {
|
|
30
|
+
bottom: "0",
|
|
31
|
+
top: "0",
|
|
32
|
+
w: "{marquee-edge-size}",
|
|
33
|
+
_end: {
|
|
34
|
+
bgGradient: "linear(to-l, {marquee-edge-color}, transparent)",
|
|
35
|
+
insetInlineEnd: "0",
|
|
36
|
+
_rtl: { bgGradient: "linear(to-r, {marquee-edge-color}, transparent)" }
|
|
37
|
+
},
|
|
38
|
+
_start: {
|
|
39
|
+
bgGradient: "linear(to-r, {marquee-edge-color}, transparent)",
|
|
40
|
+
insetInlineStart: "0",
|
|
41
|
+
_rtl: { bgGradient: "linear(to-l, {marquee-edge-color}, transparent)" }
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
_vertical: {
|
|
45
|
+
h: "{marquee-edge-size}",
|
|
46
|
+
insetInline: "0",
|
|
47
|
+
_end: {
|
|
48
|
+
bgGradient: "linear(to-t, {marquee-edge-color}, transparent)",
|
|
49
|
+
bottom: "0"
|
|
50
|
+
},
|
|
51
|
+
_start: {
|
|
52
|
+
bgGradient: "linear(to-b, {marquee-edge-color}, transparent)",
|
|
53
|
+
top: "0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
group: {
|
|
58
|
+
"&[data-clone]": {
|
|
59
|
+
display: "{marquee-clone-display, flex}",
|
|
60
|
+
position: "absolute",
|
|
61
|
+
_horizontal: {
|
|
62
|
+
transform: "translateX(calc({marquee-copy-offset-x} * {marquee-index}))",
|
|
63
|
+
w: "max-content"
|
|
64
|
+
},
|
|
65
|
+
_vertical: {
|
|
66
|
+
transform: "translateY(calc({marquee-distance} * {marquee-index}))",
|
|
67
|
+
w: "full"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
display: "flex",
|
|
72
|
+
flex: "0 0 auto",
|
|
73
|
+
gap: "{marquee-gap}",
|
|
74
|
+
_horizontal: { pe: "{marquee-gap}" },
|
|
75
|
+
_mediaReduceMotion: { "&[data-clone]": { display: "none" } },
|
|
76
|
+
_vertical: {
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
pb: "{marquee-gap}"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
item: { flexShrink: 0 },
|
|
82
|
+
root: {
|
|
83
|
+
"&[data-pause-on-focus]": { _nativeFocusWithin: {
|
|
84
|
+
"& > [data-marquee-content]": { transform: "none !important" },
|
|
85
|
+
"--marquee-clone-display": "none",
|
|
86
|
+
"--marquee-play-state": "paused",
|
|
87
|
+
overflow: "auto"
|
|
88
|
+
} },
|
|
89
|
+
"&[data-pause-on-hover]": { _hover: { "--marquee-play-state": "paused" } },
|
|
90
|
+
"--marquee-copy-offset-x": "{marquee-distance}",
|
|
91
|
+
"--marquee-edge-color": "colors.bg",
|
|
92
|
+
"--marquee-edge-size": "20%",
|
|
93
|
+
"--marquee-gap": "spaces.4",
|
|
94
|
+
"--marquee-play-state": "running",
|
|
95
|
+
"--marquee-translate-x": "calc({marquee-distance} * -1)",
|
|
96
|
+
"--marquee-translate-y": "0px",
|
|
97
|
+
overflow: "hidden",
|
|
98
|
+
position: "relative",
|
|
99
|
+
rounded: "l2",
|
|
100
|
+
w: "full",
|
|
101
|
+
_complete: {
|
|
102
|
+
"& > [data-marquee-content]": { transform: "none !important" },
|
|
103
|
+
"--marquee-clone-display": "none",
|
|
104
|
+
overflow: "auto"
|
|
105
|
+
},
|
|
106
|
+
_horizontal: { "&[dir=rtl]": {
|
|
107
|
+
"--marquee-copy-offset-x": "calc({marquee-distance} * -1)",
|
|
108
|
+
"--marquee-translate-x": "{marquee-distance}"
|
|
109
|
+
} },
|
|
110
|
+
_mediaReduceMotion: { overflow: "auto" },
|
|
111
|
+
_paused: { "--marquee-play-state": "paused" },
|
|
112
|
+
_vertical: {
|
|
113
|
+
"--marquee-translate-x": "0px",
|
|
114
|
+
"--marquee-translate-y": "calc({marquee-distance} * -1)"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} });
|
|
118
|
+
//#endregion
|
|
119
|
+
exports.marqueeStyle = marqueeStyle;
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=marquee.style.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marquee.style.cjs","names":["defineComponentSlotStyle"],"sources":["../../../../src/components/marquee/marquee.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const marqueeStyle = defineComponentSlotStyle({\n base: {\n content: {\n \"&:not([data-ready])\": { animationName: \"none\" },\n alignItems: \"center\",\n animationDelay: \"{marquee-delay}\",\n animationDirection: \"{marquee-direction}\",\n animationDuration: \"{marquee-duration}\",\n animationFillMode: \"both\",\n animationIterationCount: \"{marquee-loop-count}\",\n animationPlayState: \"{marquee-play-state}\",\n animationTimingFunction: \"linear\",\n display: \"flex\",\n flex: \"0 0 auto\",\n minW: \"0\",\n position: \"relative\",\n _horizontal: { w: \"max-content\" },\n _keyframes: {\n to: {\n transform: \"translate({marquee-translate-x}, {marquee-translate-y})\",\n },\n },\n _mediaReduceMotion: { animationName: \"none\" },\n _vertical: { flexDirection: \"column\", h: \"max-content\" },\n },\n edge: {\n pointerEvents: \"none\",\n position: \"absolute\",\n zIndex: \"1\",\n _horizontal: {\n bottom: \"0\",\n top: \"0\",\n w: \"{marquee-edge-size}\",\n _end: {\n bgGradient: \"linear(to-l, {marquee-edge-color}, transparent)\",\n insetInlineEnd: \"0\",\n _rtl: {\n bgGradient: \"linear(to-r, {marquee-edge-color}, transparent)\",\n },\n },\n _start: {\n bgGradient: \"linear(to-r, {marquee-edge-color}, transparent)\",\n insetInlineStart: \"0\",\n _rtl: {\n bgGradient: \"linear(to-l, {marquee-edge-color}, transparent)\",\n },\n },\n },\n _vertical: {\n h: \"{marquee-edge-size}\",\n insetInline: \"0\",\n _end: {\n bgGradient: \"linear(to-t, {marquee-edge-color}, transparent)\",\n bottom: \"0\",\n },\n _start: {\n bgGradient: \"linear(to-b, {marquee-edge-color}, transparent)\",\n top: \"0\",\n },\n },\n },\n group: {\n \"&[data-clone]\": {\n display: \"{marquee-clone-display, flex}\",\n position: \"absolute\",\n _horizontal: {\n transform:\n \"translateX(calc({marquee-copy-offset-x} * {marquee-index}))\",\n w: \"max-content\",\n },\n _vertical: {\n transform: \"translateY(calc({marquee-distance} * {marquee-index}))\",\n w: \"full\",\n },\n },\n alignItems: \"center\",\n display: \"flex\",\n flex: \"0 0 auto\",\n gap: \"{marquee-gap}\",\n _horizontal: { pe: \"{marquee-gap}\" },\n _mediaReduceMotion: { \"&[data-clone]\": { display: \"none\" } },\n _vertical: { flexDirection: \"column\", pb: \"{marquee-gap}\" },\n },\n item: { flexShrink: 0 },\n root: {\n \"&[data-pause-on-focus]\": {\n _nativeFocusWithin: {\n \"& > [data-marquee-content]\": { transform: \"none !important\" },\n \"--marquee-clone-display\": \"none\",\n \"--marquee-play-state\": \"paused\",\n overflow: \"auto\",\n },\n },\n \"&[data-pause-on-hover]\": {\n _hover: { \"--marquee-play-state\": \"paused\" },\n },\n \"--marquee-copy-offset-x\": \"{marquee-distance}\",\n \"--marquee-edge-color\": \"colors.bg\",\n \"--marquee-edge-size\": \"20%\",\n \"--marquee-gap\": \"spaces.4\",\n \"--marquee-play-state\": \"running\",\n \"--marquee-translate-x\": \"calc({marquee-distance} * -1)\",\n \"--marquee-translate-y\": \"0px\",\n overflow: \"hidden\",\n position: \"relative\",\n rounded: \"l2\",\n w: \"full\",\n _complete: {\n \"& > [data-marquee-content]\": { transform: \"none !important\" },\n \"--marquee-clone-display\": \"none\",\n overflow: \"auto\",\n },\n _horizontal: {\n \"&[dir=rtl]\": {\n \"--marquee-copy-offset-x\": \"calc({marquee-distance} * -1)\",\n \"--marquee-translate-x\": \"{marquee-distance}\",\n },\n },\n _mediaReduceMotion: { overflow: \"auto\" },\n _paused: { \"--marquee-play-state\": \"paused\" },\n _vertical: {\n \"--marquee-translate-x\": \"0px\",\n \"--marquee-translate-y\": \"calc({marquee-distance} * -1)\",\n },\n },\n },\n})\n\nexport type MarqueeStyle = typeof marqueeStyle\n"],"mappings":";AAEA,MAAa,qDAAeA,CAAAA,CAAAA,yBAAyB,EACnD,MAAM;CACJ,SAAS;EACP,uBAAuB,EAAE,eAAe,OAAO;EAC/C,YAAY;EACZ,gBAAgB;EAChB,oBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,yBAAyB;EACzB,oBAAoB;EACpB,yBAAyB;EACzB,SAAS;EACT,MAAM;EACN,MAAM;EACN,UAAU;EACV,aAAa,EAAE,GAAG,cAAc;EAChC,YAAY,EACV,IAAI,EACF,WAAW,0DACb,EACF;EACA,oBAAoB,EAAE,eAAe,OAAO;EAC5C,WAAW;GAAE,eAAe;GAAU,GAAG;EAAc;CACzD;CACA,MAAM;EACJ,eAAe;EACf,UAAU;EACV,QAAQ;EACR,aAAa;GACX,QAAQ;GACR,KAAK;GACL,GAAG;GACH,MAAM;IACJ,YAAY;IACZ,gBAAgB;IAChB,MAAM,EACJ,YAAY,kDACd;GACF;GACA,QAAQ;IACN,YAAY;IACZ,kBAAkB;IAClB,MAAM,EACJ,YAAY,kDACd;GACF;EACF;EACA,WAAW;GACT,GAAG;GACH,aAAa;GACb,MAAM;IACJ,YAAY;IACZ,QAAQ;GACV;GACA,QAAQ;IACN,YAAY;IACZ,KAAK;GACP;EACF;CACF;CACA,OAAO;EACL,iBAAiB;GACf,SAAS;GACT,UAAU;GACV,aAAa;IACX,WACE;IACF,GAAG;GACL;GACA,WAAW;IACT,WAAW;IACX,GAAG;GACL;EACF;EACA,YAAY;EACZ,SAAS;EACT,MAAM;EACN,KAAK;EACL,aAAa,EAAE,IAAI,gBAAgB;EACnC,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,OAAO,EAAE;EAC3D,WAAW;GAAE,eAAe;GAAU,IAAI;EAAgB;CAC5D;CACA,MAAM,EAAE,YAAY,EAAE;CACtB,MAAM;EACJ,0BAA0B,EACxB,oBAAoB;GAClB,8BAA8B,EAAE,WAAW,kBAAkB;GAC7D,2BAA2B;GAC3B,wBAAwB;GACxB,UAAU;EACZ,EACF;EACA,0BAA0B,EACxB,QAAQ,EAAE,wBAAwB,SAAS,EAC7C;EACA,2BAA2B;EAC3B,wBAAwB;EACxB,uBAAuB;EACvB,iBAAiB;EACjB,wBAAwB;EACxB,yBAAyB;EACzB,yBAAyB;EACzB,UAAU;EACV,UAAU;EACV,SAAS;EACT,GAAG;EACH,WAAW;GACT,8BAA8B,EAAE,WAAW,kBAAkB;GAC7D,2BAA2B;GAC3B,UAAU;EACZ;EACA,aAAa,EACX,cAAc;GACZ,2BAA2B;GAC3B,yBAAyB;EAC3B,EACF;EACA,oBAAoB,EAAE,UAAU,OAAO;EACvC,SAAS,EAAE,wBAAwB,SAAS;EAC5C,WAAW;GACT,yBAAyB;GACzB,yBAAyB;EAC3B;CACF;AACF,EACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_marquee = require("./marquee.cjs");
|
|
3
|
+
//#region src/components/marquee/namespace.ts
|
|
4
|
+
var namespace_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
|
+
Content: () => require_marquee.MarqueeContent,
|
|
6
|
+
Edge: () => require_marquee.MarqueeEdge,
|
|
7
|
+
Item: () => require_marquee.MarqueeItem,
|
|
8
|
+
PropsContext: () => require_marquee.MarqueePropsContext,
|
|
9
|
+
Root: () => require_marquee.MarqueeRoot,
|
|
10
|
+
usePropsContext: () => require_marquee.useMarqueePropsContext
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.Content = require_marquee.MarqueeContent;
|
|
14
|
+
exports.Edge = require_marquee.MarqueeEdge;
|
|
15
|
+
exports.Item = require_marquee.MarqueeItem;
|
|
16
|
+
exports.PropsContext = require_marquee.MarqueePropsContext;
|
|
17
|
+
exports.Root = require_marquee.MarqueeRoot;
|
|
18
|
+
Object.defineProperty(exports, "namespace_exports", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return namespace_exports;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
exports.usePropsContext = require_marquee.useMarqueePropsContext;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=namespace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.cjs","names":[],"sources":["../../../../src/components/marquee/namespace.ts"],"sourcesContent":["export {\n MarqueeContent as Content,\n MarqueeEdge as Edge,\n MarqueeItem as Item,\n MarqueePropsContext as PropsContext,\n MarqueeRoot as Root,\n useMarqueePropsContext as usePropsContext,\n} from \"./marquee\"\nexport type {\n MarqueeContentProps as ContentProps,\n MarqueeEdgeProps as EdgeProps,\n MarqueeItemProps as ItemProps,\n MarqueeRootProps as RootProps,\n} from \"./marquee\"\nexport type { MarqueeControl as Control } from \"./use-marquee\"\n"],"mappings":""}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_context = require("../../utils/context.cjs");
|
|
3
|
+
const require_ref = require("../../utils/ref.cjs");
|
|
4
|
+
const require_utils_index = require("../../utils/index.cjs");
|
|
5
|
+
const require_props = require("../../core/components/props.cjs");
|
|
6
|
+
const require_hooks_use_controllable_state_index = require("../../hooks/use-controllable-state/index.cjs");
|
|
7
|
+
const require_i18n_provider = require("../../providers/i18n-provider/i18n-provider.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
//#region src/components/marquee/use-marquee.ts
|
|
10
|
+
const [MarqueeContext, useMarqueeContext] = require_context.createContext({ name: "MarqueeContext" });
|
|
11
|
+
function useMarquee({ controlRef, defaultPaused = false, delay = 0, dir: dirProp, direction = "start", duration: durationProp, loopCount = 0, orientation = "horizontal", paused: pausedProp, pauseOnFocus = false, pauseOnHover = false, reverse = false, speed = 50, onComplete: onCompleteProp, onLoopComplete: onLoopCompleteProp, onPauseChange, ...rest } = {}) {
|
|
12
|
+
const { dir: defaultDir } = require_i18n_provider.useI18n();
|
|
13
|
+
const dir = dirProp ?? defaultDir;
|
|
14
|
+
const vertical = orientation === "vertical";
|
|
15
|
+
const rootRef = (0, react.useRef)(null);
|
|
16
|
+
const contentRef = (0, react.useRef)(null);
|
|
17
|
+
const trackRef = (0, react.useRef)(null);
|
|
18
|
+
const [hovered, setHovered] = (0, react.useState)(false);
|
|
19
|
+
const [focused, setFocused] = (0, react.useState)(false);
|
|
20
|
+
const [completed, setCompleted] = (0, react.useState)(false);
|
|
21
|
+
const [paused, setPaused] = require_hooks_use_controllable_state_index.useControllableState({
|
|
22
|
+
defaultValue: defaultPaused,
|
|
23
|
+
value: pausedProp,
|
|
24
|
+
onChange: onPauseChange
|
|
25
|
+
});
|
|
26
|
+
const onComplete = require_ref.useCallbackRef(onCompleteProp);
|
|
27
|
+
const onLoopComplete = require_ref.useCallbackRef(onLoopCompleteProp);
|
|
28
|
+
const [size, setSize] = (0, react.useState)({
|
|
29
|
+
content: 0,
|
|
30
|
+
root: 0
|
|
31
|
+
});
|
|
32
|
+
const duration = durationProp ?? (speed > 0 ? size.content / speed : 0);
|
|
33
|
+
const ready = size.content > 0 && Number.isFinite(duration) && duration > 0;
|
|
34
|
+
const copies = Math.max(1, size.content > 0 ? Math.ceil(size.root / size.content) : 1);
|
|
35
|
+
const iterations = Number.isFinite(loopCount) && loopCount > 0 ? loopCount : 0;
|
|
36
|
+
const animationDirection = direction === "end" !== reverse ? "reverse" : "normal";
|
|
37
|
+
const animationPaused = paused || pauseOnHover && hovered || pauseOnFocus && focused || completed || !ready;
|
|
38
|
+
const pause = (0, react.useCallback)(() => setPaused(true), [setPaused]);
|
|
39
|
+
const resume = (0, react.useCallback)(() => setPaused(false), [setPaused]);
|
|
40
|
+
const togglePause = (0, react.useCallback)(() => setPaused((prev) => !prev), [setPaused]);
|
|
41
|
+
const restart = (0, react.useCallback)(() => {
|
|
42
|
+
trackRef.current?.getAnimations().forEach((animation) => {
|
|
43
|
+
animation.currentTime = 0;
|
|
44
|
+
});
|
|
45
|
+
setCompleted(false);
|
|
46
|
+
}, []);
|
|
47
|
+
const control = (0, react.useMemo)(() => ({
|
|
48
|
+
pause,
|
|
49
|
+
paused: animationPaused,
|
|
50
|
+
restart,
|
|
51
|
+
resume,
|
|
52
|
+
togglePause
|
|
53
|
+
}), [
|
|
54
|
+
animationPaused,
|
|
55
|
+
pause,
|
|
56
|
+
restart,
|
|
57
|
+
resume,
|
|
58
|
+
togglePause
|
|
59
|
+
]);
|
|
60
|
+
require_ref.assignRef(controlRef, control);
|
|
61
|
+
(0, react.useEffect)(() => {
|
|
62
|
+
const root = rootRef.current;
|
|
63
|
+
const content = contentRef.current;
|
|
64
|
+
if (!root || !content) return;
|
|
65
|
+
const observer = new ResizeObserver((entries) => {
|
|
66
|
+
entries.forEach(({ target, borderBoxSize }) => {
|
|
67
|
+
const box = borderBoxSize[0];
|
|
68
|
+
if (!box) return;
|
|
69
|
+
const key = target === root ? "root" : "content";
|
|
70
|
+
const value = vertical ? box.blockSize : box.inlineSize;
|
|
71
|
+
setSize((prev) => prev[key] === value ? prev : {
|
|
72
|
+
...prev,
|
|
73
|
+
[key]: value
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
observer.observe(root, { box: "border-box" });
|
|
78
|
+
observer.observe(content, { box: "border-box" });
|
|
79
|
+
return () => observer.disconnect();
|
|
80
|
+
}, [vertical]);
|
|
81
|
+
const getRootProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
|
|
82
|
+
style: {
|
|
83
|
+
"--marquee-delay": `${Number.isFinite(delay) ? delay : 0}s`,
|
|
84
|
+
"--marquee-direction": animationDirection,
|
|
85
|
+
"--marquee-distance": `${size.content}px`,
|
|
86
|
+
"--marquee-duration": `${ready ? duration : 0}s`,
|
|
87
|
+
"--marquee-loop-count": iterations || "infinite"
|
|
88
|
+
},
|
|
89
|
+
"aria-keyshortcuts": "Space",
|
|
90
|
+
"aria-live": "off",
|
|
91
|
+
"aria-roledescription": "marquee",
|
|
92
|
+
role: "region",
|
|
93
|
+
tabIndex: 0
|
|
94
|
+
}, rest, props, {
|
|
95
|
+
ref: rootRef,
|
|
96
|
+
"data-complete": (0, require_utils_index.utils_exports.dataAttr)(completed),
|
|
97
|
+
"data-end": (0, require_utils_index.utils_exports.dataAttr)(direction === "end"),
|
|
98
|
+
"data-orientation": orientation,
|
|
99
|
+
"data-pause-on-focus": (0, require_utils_index.utils_exports.dataAttr)(pauseOnFocus),
|
|
100
|
+
"data-pause-on-hover": (0, require_utils_index.utils_exports.dataAttr)(pauseOnHover),
|
|
101
|
+
"data-paused": (0, require_utils_index.utils_exports.dataAttr)(animationPaused),
|
|
102
|
+
"data-start": (0, require_utils_index.utils_exports.dataAttr)(direction === "start"),
|
|
103
|
+
dir,
|
|
104
|
+
onBlurCapture: (ev) => {
|
|
105
|
+
if (ev.currentTarget.contains(ev.relatedTarget)) return;
|
|
106
|
+
setFocused(false);
|
|
107
|
+
if (!pauseOnFocus) return;
|
|
108
|
+
ev.currentTarget.scrollLeft = 0;
|
|
109
|
+
ev.currentTarget.scrollTop = 0;
|
|
110
|
+
},
|
|
111
|
+
onFocusCapture: () => setFocused(true),
|
|
112
|
+
onKeyDown: (ev) => {
|
|
113
|
+
if (ev.target !== ev.currentTarget || ev.key !== " " || ev.altKey || ev.ctrlKey || ev.metaKey || ev.repeat) return;
|
|
114
|
+
ev.preventDefault();
|
|
115
|
+
togglePause();
|
|
116
|
+
},
|
|
117
|
+
onMouseEnter: () => setHovered(true),
|
|
118
|
+
onMouseLeave: () => setHovered(false)
|
|
119
|
+
})(), [
|
|
120
|
+
rest,
|
|
121
|
+
direction,
|
|
122
|
+
orientation,
|
|
123
|
+
pauseOnFocus,
|
|
124
|
+
pauseOnHover,
|
|
125
|
+
animationPaused,
|
|
126
|
+
completed,
|
|
127
|
+
ready,
|
|
128
|
+
dir,
|
|
129
|
+
duration,
|
|
130
|
+
animationDirection,
|
|
131
|
+
delay,
|
|
132
|
+
iterations,
|
|
133
|
+
size.content,
|
|
134
|
+
togglePause
|
|
135
|
+
]);
|
|
136
|
+
return {
|
|
137
|
+
control,
|
|
138
|
+
copies,
|
|
139
|
+
getContentProps: (0, react.useCallback)((props = {}) => require_props.mergeProps(props, {
|
|
140
|
+
ref: trackRef,
|
|
141
|
+
"data-marquee-content": "",
|
|
142
|
+
"data-orientation": orientation,
|
|
143
|
+
"data-ready": (0, require_utils_index.utils_exports.dataAttr)(ready),
|
|
144
|
+
onAnimationEnd: (ev) => {
|
|
145
|
+
if (ev.target !== ev.currentTarget || !iterations) return;
|
|
146
|
+
setCompleted(true);
|
|
147
|
+
onComplete();
|
|
148
|
+
},
|
|
149
|
+
onAnimationIteration: (ev) => {
|
|
150
|
+
if (ev.target === ev.currentTarget) onLoopComplete();
|
|
151
|
+
}
|
|
152
|
+
})(), [
|
|
153
|
+
orientation,
|
|
154
|
+
ready,
|
|
155
|
+
iterations,
|
|
156
|
+
onComplete,
|
|
157
|
+
onLoopComplete
|
|
158
|
+
]),
|
|
159
|
+
getEdgeProps: (0, react.useCallback)(({ direction = "start", ...props } = {}) => require_props.mergeProps(props, {
|
|
160
|
+
"aria-hidden": true,
|
|
161
|
+
"data-end": (0, require_utils_index.utils_exports.dataAttr)(direction === "end"),
|
|
162
|
+
"data-orientation": orientation,
|
|
163
|
+
"data-start": (0, require_utils_index.utils_exports.dataAttr)(direction === "start"),
|
|
164
|
+
dir,
|
|
165
|
+
inert: true
|
|
166
|
+
})(), [dir, orientation]),
|
|
167
|
+
getGroupProps: (0, react.useCallback)(({ id, ref, index = 0, ...props } = {}) => require_props.mergeProps({ style: { "--marquee-index": index } }, props, {
|
|
168
|
+
id: index ? void 0 : id,
|
|
169
|
+
ref: index ? void 0 : require_ref.mergeRefs(ref, contentRef),
|
|
170
|
+
"aria-hidden": index ? true : void 0,
|
|
171
|
+
"data-clone": (0, require_utils_index.utils_exports.dataAttr)(!!index),
|
|
172
|
+
"data-orientation": orientation,
|
|
173
|
+
inert: index ? true : void 0
|
|
174
|
+
})(), [orientation]),
|
|
175
|
+
getRootProps
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
exports.MarqueeContext = MarqueeContext;
|
|
180
|
+
exports.useMarquee = useMarquee;
|
|
181
|
+
exports.useMarqueeContext = useMarqueeContext;
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=use-marquee.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-marquee.cjs","names":["createContext","useI18n","useRef","useState","useControllableState","useCallbackRef","useCallback","useMemo","mergeProps","mergeRefs"],"sources":["../../../../src/components/marquee/use-marquee.ts"],"sourcesContent":["\"use client\"\n\nimport type {\n AnimationEvent,\n FocusEvent,\n KeyboardEvent,\n RefObject,\n} from \"react\"\nimport type {\n HTMLProps,\n Orientation,\n PropGetter,\n SimpleDirection,\n} from \"../../core\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n assignRef,\n createContext,\n dataAttr,\n mergeRefs,\n useCallbackRef,\n} from \"../../utils\"\n\nexport interface MarqueeControl {\n /**\n * Whether the marquee is paused.\n */\n paused: boolean\n /**\n * Pauses the marquee.\n */\n pause: () => void\n /**\n * Restarts the animation, including its delay and loop count.\n */\n restart: () => void\n /**\n * Resumes the marquee.\n */\n resume: () => void\n /**\n * Toggles the pause state.\n */\n togglePause: () => void\n}\n\nexport interface UseMarqueeProps extends HTMLProps {\n /**\n * Ref of the marquee controls.\n */\n controlRef?: RefObject<MarqueeControl | null>\n /**\n * Whether the marquee is initially paused.\n *\n * @default false\n */\n defaultPaused?: boolean\n /**\n * The delay before the animation starts, in seconds.\n *\n * @default 0\n */\n delay?: number\n /**\n * The direction the content scrolls towards.\n *\n * @default 'start'\n */\n direction?: SimpleDirection\n /**\n * The duration of one loop in seconds. Overrides `speed`.\n */\n duration?: number\n /**\n * The number of animation loops. Set to `0` for infinite loops.\n *\n * @default 0\n */\n loopCount?: number\n /**\n * The orientation of the marquee.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * If `true`, the animation is paused.\n *\n * @default false\n */\n paused?: boolean\n /**\n * If `true`, the animation pauses while an item is focused.\n *\n * @default false\n */\n pauseOnFocus?: boolean\n /**\n * If `true`, the animation pauses on hover.\n *\n * @default false\n */\n pauseOnHover?: boolean\n /**\n * If `true`, the scrolling direction is reversed.\n *\n * @default false\n */\n reverse?: boolean\n /**\n * The scrolling speed in pixels per second.\n *\n * @default 50\n */\n speed?: number\n /**\n * The callback invoked when all finite loops finish.\n */\n onComplete?: () => void\n /**\n * The callback invoked after each animation iteration, except the final one.\n */\n onLoopComplete?: () => void\n /**\n * The callback invoked when the persistent pause state changes.\n */\n onPauseChange?: (paused: boolean) => void\n}\n\ninterface MarqueeContext extends Pick<\n UseMarqueeReturn,\n \"copies\" | \"getContentProps\" | \"getEdgeProps\" | \"getGroupProps\"\n> {}\n\nconst [MarqueeContext, useMarqueeContext] = createContext<MarqueeContext>({\n name: \"MarqueeContext\",\n})\n\nexport { MarqueeContext, useMarqueeContext }\n\nexport function useMarquee({\n controlRef,\n defaultPaused = false,\n delay = 0,\n dir: dirProp,\n direction = \"start\",\n duration: durationProp,\n loopCount = 0,\n orientation = \"horizontal\",\n paused: pausedProp,\n pauseOnFocus = false,\n pauseOnHover = false,\n reverse = false,\n speed = 50,\n onComplete: onCompleteProp,\n onLoopComplete: onLoopCompleteProp,\n onPauseChange,\n ...rest\n}: UseMarqueeProps = {}) {\n const { dir: defaultDir } = useI18n()\n const dir = dirProp ?? defaultDir\n const vertical = orientation === \"vertical\"\n const rootRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const [hovered, setHovered] = useState(false)\n const [focused, setFocused] = useState(false)\n const [completed, setCompleted] = useState(false)\n const [paused, setPaused] = useControllableState({\n defaultValue: defaultPaused,\n value: pausedProp,\n onChange: onPauseChange,\n })\n const onComplete = useCallbackRef(onCompleteProp)\n const onLoopComplete = useCallbackRef(onLoopCompleteProp)\n const [size, setSize] = useState({ content: 0, root: 0 })\n const duration = durationProp ?? (speed > 0 ? size.content / speed : 0)\n const ready = size.content > 0 && Number.isFinite(duration) && duration > 0\n const copies = Math.max(\n 1,\n size.content > 0 ? Math.ceil(size.root / size.content) : 1,\n )\n const iterations = Number.isFinite(loopCount) && loopCount > 0 ? loopCount : 0\n const animationDirection =\n (direction === \"end\") !== reverse ? \"reverse\" : \"normal\"\n const interactionPaused =\n (pauseOnHover && hovered) || (pauseOnFocus && focused)\n const animationPaused = paused || interactionPaused || completed || !ready\n\n const pause = useCallback(() => setPaused(true), [setPaused])\n const resume = useCallback(() => setPaused(false), [setPaused])\n const togglePause = useCallback(() => setPaused((prev) => !prev), [setPaused])\n const restart = useCallback(() => {\n trackRef.current?.getAnimations().forEach((animation) => {\n animation.currentTime = 0\n })\n setCompleted(false)\n }, [])\n const control = useMemo<MarqueeControl>(\n () => ({ pause, paused: animationPaused, restart, resume, togglePause }),\n [animationPaused, pause, restart, resume, togglePause],\n )\n\n assignRef(controlRef, control)\n\n useEffect(() => {\n const root = rootRef.current\n const content = contentRef.current\n\n if (!root || !content) return\n\n const observer = new ResizeObserver((entries) => {\n entries.forEach(({ target, borderBoxSize }) => {\n const box = borderBoxSize[0]\n\n if (!box) return\n\n const key = target === root ? \"root\" : \"content\"\n const value = vertical ? box.blockSize : box.inlineSize\n\n setSize((prev) =>\n prev[key] === value ? prev : { ...prev, [key]: value },\n )\n })\n })\n\n observer.observe(root, { box: \"border-box\" })\n observer.observe(content, { box: \"border-box\" })\n\n return () => observer.disconnect()\n }, [vertical])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n style: {\n \"--marquee-delay\": `${Number.isFinite(delay) ? delay : 0}s`,\n \"--marquee-direction\": animationDirection,\n \"--marquee-distance\": `${size.content}px`,\n \"--marquee-duration\": `${ready ? duration : 0}s`,\n \"--marquee-loop-count\": iterations || \"infinite\",\n },\n \"aria-keyshortcuts\": \"Space\",\n \"aria-live\": \"off\",\n \"aria-roledescription\": \"marquee\",\n role: \"region\",\n tabIndex: 0,\n },\n rest,\n props,\n {\n ref: rootRef,\n \"data-complete\": dataAttr(completed),\n \"data-end\": dataAttr(direction === \"end\"),\n \"data-orientation\": orientation,\n \"data-pause-on-focus\": dataAttr(pauseOnFocus),\n \"data-pause-on-hover\": dataAttr(pauseOnHover),\n \"data-paused\": dataAttr(animationPaused),\n \"data-start\": dataAttr(direction === \"start\"),\n dir,\n onBlurCapture: (ev: FocusEvent<HTMLDivElement>) => {\n if (ev.currentTarget.contains(ev.relatedTarget)) return\n\n setFocused(false)\n\n if (!pauseOnFocus) return\n\n ev.currentTarget.scrollLeft = 0\n ev.currentTarget.scrollTop = 0\n },\n onFocusCapture: () => setFocused(true),\n onKeyDown: (ev: KeyboardEvent<HTMLDivElement>) => {\n if (\n ev.target !== ev.currentTarget ||\n ev.key !== \" \" ||\n ev.altKey ||\n ev.ctrlKey ||\n ev.metaKey ||\n ev.repeat\n )\n return\n\n ev.preventDefault()\n togglePause()\n },\n onMouseEnter: () => setHovered(true),\n onMouseLeave: () => setHovered(false),\n },\n )(),\n [\n rest,\n direction,\n orientation,\n pauseOnFocus,\n pauseOnHover,\n animationPaused,\n completed,\n ready,\n dir,\n duration,\n animationDirection,\n delay,\n iterations,\n size.content,\n togglePause,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(props, {\n ref: trackRef,\n \"data-marquee-content\": \"\",\n \"data-orientation\": orientation,\n \"data-ready\": dataAttr(ready),\n onAnimationEnd: (ev: AnimationEvent<HTMLDivElement>) => {\n if (ev.target !== ev.currentTarget || !iterations) return\n\n setCompleted(true)\n onComplete()\n },\n onAnimationIteration: (ev: AnimationEvent<HTMLDivElement>) => {\n if (ev.target === ev.currentTarget) onLoopComplete()\n },\n })(),\n [orientation, ready, iterations, onComplete, onLoopComplete],\n )\n\n const getEdgeProps: PropGetter<\"div\", { direction?: SimpleDirection }> =\n useCallback(\n ({ direction = \"start\", ...props } = {}) =>\n mergeProps(props, {\n \"aria-hidden\": true,\n \"data-end\": dataAttr(direction === \"end\"),\n \"data-orientation\": orientation,\n \"data-start\": dataAttr(direction === \"start\"),\n dir,\n inert: true,\n })(),\n [dir, orientation],\n )\n\n const getGroupProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ id, ref, index = 0, ...props } = {}) =>\n mergeProps({ style: { \"--marquee-index\": index } }, props, {\n id: index ? undefined : id,\n ref: index ? undefined : mergeRefs(ref, contentRef),\n \"aria-hidden\": index ? true : undefined,\n \"data-clone\": dataAttr(!!index),\n \"data-orientation\": orientation,\n inert: index ? true : undefined,\n })(),\n [orientation],\n )\n\n return {\n control,\n copies,\n getContentProps,\n getEdgeProps,\n getGroupProps,\n getRootProps,\n }\n}\n\nexport type UseMarqueeReturn = ReturnType<typeof useMarquee>\n"],"mappings":";;;;;;;;;AAyIA,MAAM,CAAC,gBAAgB,qBAAqB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QAAQ,OAAO,KAAA;EACxB,CAAC,CAAC,CAAC,GACL,CAAC,WAAW,CAQA;EACZ;CACF;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_prose_style = require("./prose.style.cjs");
|
|
3
|
+
const require_prose = require("./prose.cjs");
|
|
4
|
+
exports.Prose = require_prose.Prose;
|
|
5
|
+
exports.ProsePropsContext = require_prose.ProsePropsContext;
|
|
6
|
+
exports.proseStyle = require_prose_style.proseStyle;
|
|
7
|
+
exports.useProsePropsContext = require_prose.useProsePropsContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_create_component = require("../../core/components/create-component.cjs");
|
|
3
|
+
const require_prose_style = require("./prose.style.cjs");
|
|
4
|
+
//#region src/components/prose/prose.tsx
|
|
5
|
+
const { PropsContext: ProsePropsContext, usePropsContext: useProsePropsContext, withContext } = require_create_component.createComponent("prose", require_prose_style.proseStyle);
|
|
6
|
+
/**
|
|
7
|
+
* `Prose` is a component that styles HTML content. By default, it renders a `div` element.
|
|
8
|
+
*
|
|
9
|
+
* @see https://yamada-ui.com/docs/components/prose
|
|
10
|
+
*/
|
|
11
|
+
const Prose = withContext("div")();
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.Prose = Prose;
|
|
14
|
+
exports.ProsePropsContext = ProsePropsContext;
|
|
15
|
+
exports.useProsePropsContext = useProsePropsContext;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=prose.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.cjs","names":["createComponent","proseStyle"],"sources":["../../../../src/components/prose/prose.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ProseStyle } from \"./prose.style\"\nimport { createComponent } from \"../../core\"\nimport { proseStyle } from \"./prose.style\"\n\nexport interface ProseProps\n extends HTMLStyledProps<\"div\">, ThemeProps<ProseStyle> {}\n\nconst {\n PropsContext: ProsePropsContext,\n usePropsContext: useProsePropsContext,\n withContext,\n} = createComponent<ProseProps, ProseStyle>(\"prose\", proseStyle)\n\nexport { ProsePropsContext, useProsePropsContext }\n\n/**\n * `Prose` is a component that styles HTML content. By default, it renders a `div` element.\n *\n * @see https://yamada-ui.com/docs/components/prose\n */\nexport const Prose = withContext(\"div\")()\n"],"mappings":";;;;AAUA,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,gBACEA,yBAAAA,gBAAwC,SAASC,oBAAAA,UAAU;;;;;;AAS/D,MAAa,QAAQ,YAAY,KAAK,CAAC,CAAC"}
|