@expcat/tigercat-react 0.2.0 → 0.2.27

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.
Files changed (84) hide show
  1. package/README.md +59 -0
  2. package/dist/{chunk-6DYS4PJT.mjs → chunk-2UVQIL26.mjs} +1 -1
  3. package/dist/chunk-4MMT4EJJ.mjs +78 -0
  4. package/dist/chunk-67EK62HG.mjs +65 -0
  5. package/dist/{chunk-VXHBQTZS.js → chunk-GY6D4XS3.js} +13 -5
  6. package/dist/chunk-GZPMLPRW.js +107 -0
  7. package/dist/{chunk-7JQ7LURS.mjs → chunk-H36CWHUP.mjs} +9 -4
  8. package/dist/chunk-HUZVBDHV.js +81 -0
  9. package/dist/chunk-JOHKSMJM.mjs +266 -0
  10. package/dist/{chunk-WEGU7O4J.mjs → chunk-KOLLAGRK.mjs} +1 -1
  11. package/dist/{chunk-IS7YOBR7.mjs → chunk-NDOYQK2R.mjs} +13 -5
  12. package/dist/{chunk-2DOPHSZP.js → chunk-OWUGXP6K.js} +8 -3
  13. package/dist/chunk-Q2GPRAF4.js +66 -0
  14. package/dist/{chunk-6PUSRC6S.js → chunk-T3GSXTDU.js} +2 -2
  15. package/dist/{chunk-UG3I4PCY.js → chunk-VR5OP4MO.js} +2 -2
  16. package/dist/chunk-X4F6NSI5.mjs +104 -0
  17. package/dist/chunk-Y6557RWE.mjs +62 -0
  18. package/dist/chunk-YIF5VX7K.mjs +158 -0
  19. package/dist/chunk-Z5DDULTA.js +72 -0
  20. package/dist/chunk-Z6G4HABF.js +272 -0
  21. package/dist/chunk-ZPWDDAFE.js +162 -0
  22. package/dist/components/Anchor.d.mts +38 -0
  23. package/dist/components/Anchor.d.ts +38 -0
  24. package/dist/components/Anchor.js +20 -0
  25. package/dist/components/Anchor.mjs +1 -0
  26. package/dist/components/AnchorLink.d.mts +23 -0
  27. package/dist/components/AnchorLink.d.ts +23 -0
  28. package/dist/components/AnchorLink.js +17 -0
  29. package/dist/components/AnchorLink.mjs +2 -0
  30. package/dist/components/AreaChart.js +5 -5
  31. package/dist/components/AreaChart.mjs +3 -3
  32. package/dist/components/BackTop.d.mts +21 -0
  33. package/dist/components/BackTop.d.ts +21 -0
  34. package/dist/components/BackTop.js +16 -0
  35. package/dist/components/BackTop.mjs +1 -0
  36. package/dist/components/BarChart.js +5 -5
  37. package/dist/components/BarChart.mjs +3 -3
  38. package/dist/components/Breadcrumb.d.mts +4 -0
  39. package/dist/components/Breadcrumb.d.ts +4 -0
  40. package/dist/components/Breadcrumb.js +3 -3
  41. package/dist/components/Breadcrumb.mjs +1 -1
  42. package/dist/components/BreadcrumbItem.js +3 -3
  43. package/dist/components/BreadcrumbItem.mjs +2 -2
  44. package/dist/components/Carousel.d.mts +26 -0
  45. package/dist/components/Carousel.d.ts +26 -0
  46. package/dist/components/Carousel.js +10 -0
  47. package/dist/components/Carousel.mjs +1 -0
  48. package/dist/components/Collapse.d.mts +29 -0
  49. package/dist/components/Collapse.d.ts +29 -0
  50. package/dist/components/Collapse.js +20 -0
  51. package/dist/components/Collapse.mjs +1 -0
  52. package/dist/components/CollapsePanel.d.mts +24 -0
  53. package/dist/components/CollapsePanel.d.ts +24 -0
  54. package/dist/components/CollapsePanel.js +17 -0
  55. package/dist/components/CollapsePanel.mjs +2 -0
  56. package/dist/components/DonutChart.js +5 -5
  57. package/dist/components/DonutChart.mjs +3 -3
  58. package/dist/components/LineChart.js +5 -5
  59. package/dist/components/LineChart.mjs +3 -3
  60. package/dist/components/Pagination.js +3 -3
  61. package/dist/components/Pagination.mjs +1 -1
  62. package/dist/components/PieChart.js +4 -4
  63. package/dist/components/PieChart.mjs +2 -2
  64. package/dist/components/RadarChart.js +4 -4
  65. package/dist/components/RadarChart.mjs +2 -2
  66. package/dist/components/ScatterChart.js +5 -5
  67. package/dist/components/ScatterChart.mjs +3 -3
  68. package/dist/index.d.mts +6 -0
  69. package/dist/index.d.ts +6 -0
  70. package/dist/index.js +142 -104
  71. package/dist/index.mjs +34 -28
  72. package/package.json +6 -2
  73. package/dist/{chunk-N32MAX4A.js → chunk-2VXA4YOP.js} +1 -1
  74. package/dist/{chunk-VBSK4TGO.mjs → chunk-2WLSB7K2.mjs} +2 -2
  75. package/dist/{chunk-CBALIFPW.mjs → chunk-324UKFG2.mjs} +2 -2
  76. package/dist/{chunk-YER7IQF4.mjs → chunk-5QKBBGIA.mjs} +1 -1
  77. package/dist/{chunk-OONM7FO7.js → chunk-67WZRMD6.js} +2 -2
  78. package/dist/{chunk-QI6WAP6Y.js → chunk-7SOL3UJ2.js} +2 -2
  79. package/dist/{chunk-KBGURVTD.mjs → chunk-AFFSBNYB.mjs} +2 -2
  80. package/dist/{chunk-LZNG2HGC.mjs → chunk-E6GLWHRL.mjs} +1 -1
  81. package/dist/{chunk-ZUUG3WOL.js → chunk-KKHKQP6Z.js} +1 -1
  82. package/dist/{chunk-EJLJYOO7.js → chunk-LWW2LXCP.js} +2 -2
  83. package/dist/{chunk-A2UW5OKX.mjs → chunk-RKBNIEGF.mjs} +2 -2
  84. package/dist/{chunk-42UKIFFQ.js → chunk-ZYF5GI2Q.js} +2 -2
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @expcat/tigercat-react
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@expcat/tigercat-react.svg)](https://www.npmjs.com/package/@expcat/tigercat-react)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ React UI components for [Tigercat](https://github.com/expcats/Tigercat) - A Tailwind CSS based component library.
7
+
8
+ ## 📖 Documentation
9
+
10
+ **[Live Demo & Docs →](https://expcat.github.io/Tigercat/react/)**
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @expcat/tigercat-react
16
+ # or
17
+ npm install @expcat/tigercat-react
18
+ ```
19
+
20
+ **Requirements:** React ≥19, Tailwind CSS ≥3.4
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { ConfigProvider, Button } from '@expcat/tigercat-react'
26
+
27
+ function App() {
28
+ return (
29
+ <ConfigProvider>
30
+ <Button variant="primary">Click me</Button>
31
+ </ConfigProvider>
32
+ )
33
+ }
34
+ ```
35
+
36
+ ## Components
37
+
38
+ | Category | Components |
39
+ | -------------- | ------------------------------------------------------------------------------------- |
40
+ | **Basic** | Alert, Avatar, Badge, Button, Code, Divider, Icon, Link, Tag, Text |
41
+ | **Form** | Input, Select, Checkbox, Radio, Switch, Slider, DatePicker, TimePicker, Upload, Form |
42
+ | **Layout** | Card, Container, Grid (Row/Col), Layout, List, Descriptions, Skeleton, Space |
43
+ | **Navigation** | Menu, Tabs, Breadcrumb, Pagination, Steps, Dropdown, Tree |
44
+ | **Feedback** | Modal, Drawer, Message, Notification, Loading, Popconfirm, Popover, Tooltip, Progress |
45
+ | **Data** | Table, Timeline |
46
+ | **Charts** | BarChart, LineChart, AreaChart, PieChart, DonutChart, RadarChart, ScatterChart |
47
+
48
+ ## Hooks
49
+
50
+ - `useChartInteraction` - Chart interaction utilities
51
+ - `useFormContext` - Form state management
52
+ - `useMenuContext` - Menu state access
53
+ - `useTabsContext` - Tabs state access
54
+ - `useBreadcrumbContext` - Breadcrumb navigation
55
+ - `useStepsContext` - Steps state access
56
+
57
+ ## License
58
+
59
+ [MIT](https://opensource.org/licenses/MIT)
@@ -1,4 +1,4 @@
1
- import { PieChart } from './chunk-LZNG2HGC.mjs';
1
+ import { PieChart } from './chunk-E6GLWHRL.mjs';
2
2
  import { useMemo } from 'react';
3
3
  import { getChartInnerRect, classNames } from '@expcat/tigercat-core';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -0,0 +1,78 @@
1
+ import { useState, useCallback, useEffect, useMemo } from 'react';
2
+ import { getScrollTop, scrollToTop, classNames, backTopButtonClasses, backTopContainerClasses, backTopVisibleClasses, backTopHiddenClasses, backTopIconPath } from '@expcat/tigercat-core';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/BackTop.tsx
6
+ var DefaultIcon = () => /* @__PURE__ */ jsx(
7
+ "svg",
8
+ {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ fill: "none",
11
+ viewBox: "0 0 24 24",
12
+ stroke: "currentColor",
13
+ strokeWidth: 2,
14
+ className: "h-5 w-5",
15
+ "aria-hidden": "true",
16
+ children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: backTopIconPath })
17
+ }
18
+ );
19
+ var BackTop = ({
20
+ visibilityHeight = 400,
21
+ target = () => window,
22
+ duration = 450,
23
+ onClick,
24
+ children,
25
+ className,
26
+ "aria-label": ariaLabel = "Back to top",
27
+ ...props
28
+ }) => {
29
+ const [visible, setVisible] = useState(false);
30
+ const handleScroll = useCallback(() => {
31
+ const targetElement = target();
32
+ if (!targetElement) return;
33
+ const scrollTop = getScrollTop(targetElement);
34
+ setVisible(scrollTop >= visibilityHeight);
35
+ }, [target, visibilityHeight]);
36
+ const handleClick = useCallback(
37
+ (event) => {
38
+ const targetElement = target();
39
+ if (targetElement) {
40
+ scrollToTop(targetElement, duration);
41
+ }
42
+ onClick?.(event);
43
+ },
44
+ [target, duration, onClick]
45
+ );
46
+ useEffect(() => {
47
+ const targetElement = target();
48
+ if (!targetElement) return;
49
+ targetElement.addEventListener("scroll", handleScroll, { passive: true });
50
+ handleScroll();
51
+ return () => {
52
+ targetElement.removeEventListener("scroll", handleScroll);
53
+ };
54
+ }, [target, handleScroll]);
55
+ const buttonClasses = useMemo(() => {
56
+ const targetElement = target();
57
+ const positionClasses = !targetElement || targetElement === window ? backTopButtonClasses : backTopContainerClasses;
58
+ return classNames(
59
+ positionClasses,
60
+ visible ? backTopVisibleClasses : backTopHiddenClasses,
61
+ className
62
+ );
63
+ }, [target, visible, className]);
64
+ return /* @__PURE__ */ jsx(
65
+ "button",
66
+ {
67
+ type: "button",
68
+ className: buttonClasses,
69
+ "aria-label": ariaLabel,
70
+ onClick: handleClick,
71
+ ...props,
72
+ children: children || /* @__PURE__ */ jsx(DefaultIcon, {})
73
+ }
74
+ );
75
+ };
76
+ var BackTop_default = BackTop;
77
+
78
+ export { BackTop, BackTop_default };
@@ -0,0 +1,65 @@
1
+ import { useAnchorContext } from './chunk-YIF5VX7K.mjs';
2
+ import React, { useEffect, useMemo } from 'react';
3
+ import { classNames, getAnchorLinkClasses } from '@expcat/tigercat-core';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var AnchorLink = ({
7
+ href,
8
+ title,
9
+ target,
10
+ className,
11
+ children,
12
+ ...props
13
+ }) => {
14
+ const anchorContext = useAnchorContext();
15
+ useEffect(() => {
16
+ anchorContext?.registerLink(href);
17
+ return () => {
18
+ anchorContext?.unregisterLink(href);
19
+ };
20
+ }, [href, anchorContext]);
21
+ const handleClick = (event) => {
22
+ event.preventDefault();
23
+ anchorContext?.handleLinkClick(href, event);
24
+ };
25
+ const linkClasses = useMemo(() => {
26
+ const isActive = anchorContext?.activeLink === href;
27
+ return classNames(getAnchorLinkClasses(isActive, className));
28
+ }, [anchorContext?.activeLink, href, className]);
29
+ const hasNestedLinks = React.Children.toArray(children).some(
30
+ (child) => React.isValidElement(child) && child.type === AnchorLink
31
+ );
32
+ if (hasNestedLinks) {
33
+ return /* @__PURE__ */ jsxs("div", { className: "anchor-link-wrapper", children: [
34
+ /* @__PURE__ */ jsx(
35
+ "a",
36
+ {
37
+ href,
38
+ target,
39
+ className: linkClasses,
40
+ "data-anchor-href": href,
41
+ onClick: handleClick,
42
+ ...props,
43
+ children: title
44
+ }
45
+ ),
46
+ /* @__PURE__ */ jsx("div", { className: "pl-3 mt-1 space-y-1", children })
47
+ ] });
48
+ }
49
+ const content = children ?? title;
50
+ return /* @__PURE__ */ jsx(
51
+ "a",
52
+ {
53
+ href,
54
+ target,
55
+ className: linkClasses,
56
+ "data-anchor-href": href,
57
+ onClick: handleClick,
58
+ ...props,
59
+ children: content
60
+ }
61
+ );
62
+ };
63
+ var AnchorLink_default = AnchorLink;
64
+
65
+ export { AnchorLink, AnchorLink_default };
@@ -98,6 +98,18 @@ var Pagination = ({
98
98
  },
99
99
  [handleQuickJumperSubmit]
100
100
  );
101
+ const normalizedPageSizeOptions = react.useMemo(() => {
102
+ return pageSizeOptions.map((option) => {
103
+ if (typeof option === "number") {
104
+ return {
105
+ value: option,
106
+ label: `${option} ${labels.itemsPerPageText}`
107
+ };
108
+ }
109
+ const label = option.label ?? `${option.value} ${labels.itemsPerPageText}`;
110
+ return { value: option.value, label };
111
+ });
112
+ }, [pageSizeOptions, labels.itemsPerPageText]);
101
113
  const containerClasses = tigercatCore.getPaginationContainerClasses(align, className);
102
114
  const elements = [];
103
115
  if (showTotal) {
@@ -233,11 +245,7 @@ var Pagination = ({
233
245
  value: currentPageSize,
234
246
  onChange: (e) => handlePageSizeChange(parseInt(e.target.value, 10)),
235
247
  "aria-label": labels.itemsPerPageText,
236
- children: pageSizeOptions.map((sizeOption) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: sizeOption, children: [
237
- sizeOption,
238
- " ",
239
- labels.itemsPerPageText
240
- ] }, sizeOption))
248
+ children: normalizedPageSizeOptions.map((sizeOption) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: sizeOption.value, children: sizeOption.label }, sizeOption.value))
241
249
  },
242
250
  "size-changer"
243
251
  )
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ var chunkQ2GPRAF4_js = require('./chunk-Q2GPRAF4.js');
4
+ var react = require('react');
5
+ var tigercatCore = require('@expcat/tigercat-core');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ var CollapsePanel = ({
9
+ panelKey,
10
+ header,
11
+ disabled = false,
12
+ showArrow = true,
13
+ className,
14
+ style,
15
+ extra,
16
+ children
17
+ }) => {
18
+ const collapseContext = chunkQ2GPRAF4_js.useCollapseContext();
19
+ if (!collapseContext) {
20
+ throw new Error("CollapsePanel must be used within a Collapse component");
21
+ }
22
+ const isActive = react.useMemo(() => {
23
+ return tigercatCore.isPanelActive(panelKey, collapseContext.activeKeys);
24
+ }, [panelKey, collapseContext.activeKeys]);
25
+ const panelClasses = react.useMemo(() => {
26
+ return tigercatCore.classNames(tigercatCore.getCollapsePanelClasses(collapseContext.ghost, className));
27
+ }, [collapseContext.ghost, className]);
28
+ const headerClasses = react.useMemo(() => {
29
+ return tigercatCore.getCollapsePanelHeaderClasses(isActive, disabled);
30
+ }, [isActive, disabled]);
31
+ const iconClasses = react.useMemo(() => {
32
+ return tigercatCore.getCollapseIconClasses(isActive, collapseContext.expandIconPosition);
33
+ }, [isActive, collapseContext.expandIconPosition]);
34
+ const handleClick = react.useCallback(() => {
35
+ if (!disabled) {
36
+ collapseContext.handlePanelClick(panelKey);
37
+ }
38
+ }, [disabled, collapseContext, panelKey]);
39
+ const handleKeyDown = react.useCallback(
40
+ (event) => {
41
+ if (disabled) {
42
+ return;
43
+ }
44
+ if (event.key === "Enter" || event.key === " ") {
45
+ event.preventDefault();
46
+ collapseContext.handlePanelClick(panelKey);
47
+ }
48
+ },
49
+ [disabled, collapseContext, panelKey]
50
+ );
51
+ const arrowIcon = /* @__PURE__ */ jsxRuntime.jsx(
52
+ "svg",
53
+ {
54
+ className: iconClasses,
55
+ width: "16",
56
+ height: "16",
57
+ viewBox: "0 0 16 16",
58
+ fill: "none",
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ children: /* @__PURE__ */ jsxRuntime.jsx(
61
+ "path",
62
+ {
63
+ d: "M6 12L10 8L6 4",
64
+ stroke: "currentColor",
65
+ strokeWidth: "2",
66
+ strokeLinecap: "round",
67
+ strokeLinejoin: "round"
68
+ }
69
+ )
70
+ }
71
+ );
72
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: panelClasses, style, children: [
73
+ /* @__PURE__ */ jsxRuntime.jsxs(
74
+ "div",
75
+ {
76
+ className: headerClasses,
77
+ role: "button",
78
+ tabIndex: disabled ? -1 : 0,
79
+ "aria-expanded": isActive,
80
+ "aria-disabled": disabled,
81
+ onClick: handleClick,
82
+ onKeyDown: handleKeyDown,
83
+ children: [
84
+ showArrow && collapseContext.expandIconPosition === "start" && arrowIcon,
85
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: tigercatCore.collapseHeaderTextClasses, children: header }),
86
+ extra && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto", children: extra }),
87
+ showArrow && collapseContext.expandIconPosition === "end" && arrowIcon
88
+ ]
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsxRuntime.jsx(
92
+ "div",
93
+ {
94
+ className: tigercatCore.collapsePanelContentWrapperClasses,
95
+ style: {
96
+ maxHeight: isActive ? "none" : "0",
97
+ opacity: isActive ? "1" : "0"
98
+ },
99
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.collapsePanelContentBaseClasses, children })
100
+ }
101
+ )
102
+ ] });
103
+ };
104
+ var CollapsePanel_default = CollapsePanel;
105
+
106
+ exports.CollapsePanel = CollapsePanel;
107
+ exports.CollapsePanel_default = CollapsePanel_default;
@@ -1,6 +1,6 @@
1
1
  import React, { createContext, useContext } from 'react';
2
2
  import { classNames, breadcrumbContainerClasses } from '@expcat/tigercat-core';
3
- import { jsx } from 'react/jsx-runtime';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
5
5
  // src/components/Breadcrumb.tsx
6
6
  var BreadcrumbContext = createContext(null);
@@ -11,15 +11,20 @@ var Breadcrumb = ({
11
11
  separator = "/",
12
12
  className,
13
13
  style,
14
+ extra,
14
15
  children,
15
16
  ...props
16
17
  }) => {
18
+ const hasExtra = Boolean(extra);
17
19
  const containerClasses = React.useMemo(
18
- () => classNames(breadcrumbContainerClasses, className),
19
- [className]
20
+ () => classNames(breadcrumbContainerClasses, hasExtra && "w-full", className),
21
+ [className, hasExtra]
20
22
  );
21
23
  const contextValue = React.useMemo(() => ({ separator }), [separator]);
22
- return /* @__PURE__ */ jsx(BreadcrumbContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("nav", { className: containerClasses, "aria-label": "Breadcrumb", style, ...props, children: /* @__PURE__ */ jsx("ol", { className: "flex items-center flex-wrap gap-2", children }) }) });
24
+ return /* @__PURE__ */ jsx(BreadcrumbContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs("nav", { className: containerClasses, "aria-label": "Breadcrumb", style, ...props, children: [
25
+ /* @__PURE__ */ jsx("ol", { className: "flex items-center flex-wrap gap-2", children }),
26
+ hasExtra && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: extra })
27
+ ] }) });
23
28
  };
24
29
 
25
30
  export { Breadcrumb, useBreadcrumbContext };
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var tigercatCore = require('@expcat/tigercat-core');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ // src/components/BackTop.tsx
8
+ var DefaultIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
9
+ "svg",
10
+ {
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ fill: "none",
13
+ viewBox: "0 0 24 24",
14
+ stroke: "currentColor",
15
+ strokeWidth: 2,
16
+ className: "h-5 w-5",
17
+ "aria-hidden": "true",
18
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: tigercatCore.backTopIconPath })
19
+ }
20
+ );
21
+ var BackTop = ({
22
+ visibilityHeight = 400,
23
+ target = () => window,
24
+ duration = 450,
25
+ onClick,
26
+ children,
27
+ className,
28
+ "aria-label": ariaLabel = "Back to top",
29
+ ...props
30
+ }) => {
31
+ const [visible, setVisible] = react.useState(false);
32
+ const handleScroll = react.useCallback(() => {
33
+ const targetElement = target();
34
+ if (!targetElement) return;
35
+ const scrollTop = tigercatCore.getScrollTop(targetElement);
36
+ setVisible(scrollTop >= visibilityHeight);
37
+ }, [target, visibilityHeight]);
38
+ const handleClick = react.useCallback(
39
+ (event) => {
40
+ const targetElement = target();
41
+ if (targetElement) {
42
+ tigercatCore.scrollToTop(targetElement, duration);
43
+ }
44
+ onClick?.(event);
45
+ },
46
+ [target, duration, onClick]
47
+ );
48
+ react.useEffect(() => {
49
+ const targetElement = target();
50
+ if (!targetElement) return;
51
+ targetElement.addEventListener("scroll", handleScroll, { passive: true });
52
+ handleScroll();
53
+ return () => {
54
+ targetElement.removeEventListener("scroll", handleScroll);
55
+ };
56
+ }, [target, handleScroll]);
57
+ const buttonClasses = react.useMemo(() => {
58
+ const targetElement = target();
59
+ const positionClasses = !targetElement || targetElement === window ? tigercatCore.backTopButtonClasses : tigercatCore.backTopContainerClasses;
60
+ return tigercatCore.classNames(
61
+ positionClasses,
62
+ visible ? tigercatCore.backTopVisibleClasses : tigercatCore.backTopHiddenClasses,
63
+ className
64
+ );
65
+ }, [target, visible, className]);
66
+ return /* @__PURE__ */ jsxRuntime.jsx(
67
+ "button",
68
+ {
69
+ type: "button",
70
+ className: buttonClasses,
71
+ "aria-label": ariaLabel,
72
+ onClick: handleClick,
73
+ ...props,
74
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {})
75
+ }
76
+ );
77
+ };
78
+ var BackTop_default = BackTop;
79
+
80
+ exports.BackTop = BackTop;
81
+ exports.BackTop_default = BackTop_default;