@twreporter/react-typescript-components 0.1.0-beta.10
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/README.md +74 -0
- package/lib/button/constants.d.mts +3 -0
- package/lib/button/constants.d.ts +3 -0
- package/lib/button/constants.js +5 -0
- package/lib/button/constants.mjs +3 -0
- package/lib/button/index.d.mts +160 -0
- package/lib/button/index.d.ts +160 -0
- package/lib/button/index.js +13 -0
- package/lib/button/index.mjs +7 -0
- package/lib/button-DFLYlJJW.js +630 -0
- package/lib/button-DFLYlJJW.js.map +1 -0
- package/lib/button-DyUYGG90.mjs +591 -0
- package/lib/button-DyUYGG90.mjs.map +1 -0
- package/lib/chunk-BxBTb9qk.js +39 -0
- package/lib/constants/external-links.d.mts +16 -0
- package/lib/constants/external-links.d.ts +16 -0
- package/lib/constants/external-links.js +3 -0
- package/lib/constants/external-links.mjs +3 -0
- package/lib/constants/internal-links.d.mts +51 -0
- package/lib/constants/internal-links.d.ts +51 -0
- package/lib/constants/internal-links.js +3 -0
- package/lib/constants/internal-links.mjs +3 -0
- package/lib/constants/release-branch.d.mts +3 -0
- package/lib/constants/release-branch.d.ts +3 -0
- package/lib/constants/release-branch.js +3 -0
- package/lib/constants/release-branch.mjs +3 -0
- package/lib/constants/request-origins.d.mts +68 -0
- package/lib/constants/request-origins.d.ts +68 -0
- package/lib/constants/request-origins.js +47 -0
- package/lib/constants/request-origins.js.map +1 -0
- package/lib/constants/request-origins.mjs +46 -0
- package/lib/constants/request-origins.mjs.map +1 -0
- package/lib/constants/theme.d.mts +3 -0
- package/lib/constants/theme.d.ts +3 -0
- package/lib/constants/theme.js +3 -0
- package/lib/constants/theme.mjs +3 -0
- package/lib/constants-2TRY2zTK.js +38 -0
- package/lib/constants-2TRY2zTK.js.map +1 -0
- package/lib/constants-BS3rPbaX.d.ts +17 -0
- package/lib/constants-BWFuBApI.mjs +14 -0
- package/lib/constants-BWFuBApI.mjs.map +1 -0
- package/lib/constants-B_NgWFML.d.ts +24 -0
- package/lib/constants-BmxSMOOn.js +36 -0
- package/lib/constants-BmxSMOOn.js.map +1 -0
- package/lib/constants-BqeEbkVD.mjs +20 -0
- package/lib/constants-BqeEbkVD.mjs.map +1 -0
- package/lib/constants-BswaTS-y.d.mts +29 -0
- package/lib/constants-Bz-ufaJ2.js +39 -0
- package/lib/constants-Bz-ufaJ2.js.map +1 -0
- package/lib/constants-CEyUZ-jZ.d.mts +11 -0
- package/lib/constants-CMMcn0f-.d.ts +11 -0
- package/lib/constants-CQscYQcW.mjs +25 -0
- package/lib/constants-CQscYQcW.mjs.map +1 -0
- package/lib/constants-DF_II8Fz.js +43 -0
- package/lib/constants-DF_II8Fz.js.map +1 -0
- package/lib/constants-DNr36wyK.d.mts +24 -0
- package/lib/constants-DQxcqnYL.d.ts +29 -0
- package/lib/constants-DRyQ6AuU.js +15 -0
- package/lib/constants-DRyQ6AuU.js.map +1 -0
- package/lib/constants-K2ObjToq.js +26 -0
- package/lib/constants-K2ObjToq.js.map +1 -0
- package/lib/constants-OhAETTiQ.d.mts +17 -0
- package/lib/constants-QF71lY6v.mjs +34 -0
- package/lib/constants-QF71lY6v.mjs.map +1 -0
- package/lib/constants-gCmka4Fp.d.ts +22 -0
- package/lib/constants-jYAxSTFp.d.mts +22 -0
- package/lib/constants-oTHAnh6r.mjs +18 -0
- package/lib/constants-oTHAnh6r.mjs.map +1 -0
- package/lib/constants-t0lkfgqP.mjs +9 -0
- package/lib/constants-t0lkfgqP.mjs.map +1 -0
- package/lib/context-BCesW3fW.mjs +24 -0
- package/lib/context-BCesW3fW.mjs.map +1 -0
- package/lib/context-Bvr0Qj2x.js +37 -0
- package/lib/context-Bvr0Qj2x.js.map +1 -0
- package/lib/customized-link/external-link.d.mts +3 -0
- package/lib/customized-link/external-link.d.ts +3 -0
- package/lib/customized-link/external-link.js +3 -0
- package/lib/customized-link/external-link.mjs +3 -0
- package/lib/customized-link/index.d.mts +13 -0
- package/lib/customized-link/index.d.ts +13 -0
- package/lib/customized-link/index.js +8 -0
- package/lib/customized-link/index.mjs +5 -0
- package/lib/customized-link/internal-link.d.mts +3 -0
- package/lib/customized-link/internal-link.d.ts +3 -0
- package/lib/customized-link/internal-link.js +6 -0
- package/lib/customized-link/internal-link.mjs +6 -0
- package/lib/customized-link/type.d.mts +2 -0
- package/lib/customized-link/type.d.ts +2 -0
- package/lib/customized-link/type.js +0 -0
- package/lib/customized-link/type.mjs +1 -0
- package/lib/customized-link-BkuKVCKQ.mjs +12 -0
- package/lib/customized-link-BkuKVCKQ.mjs.map +1 -0
- package/lib/customized-link-CK7Xlgdt.js +17 -0
- package/lib/customized-link-CK7Xlgdt.js.map +1 -0
- package/lib/divider/constants.d.mts +3 -0
- package/lib/divider/constants.d.ts +3 -0
- package/lib/divider/constants.js +3 -0
- package/lib/divider/constants.mjs +3 -0
- package/lib/divider/index.d.mts +15 -0
- package/lib/divider/index.d.ts +15 -0
- package/lib/divider/index.js +6 -0
- package/lib/divider/index.mjs +4 -0
- package/lib/divider-Bb3tebJO.mjs +15 -0
- package/lib/divider-Bb3tebJO.mjs.map +1 -0
- package/lib/divider-b3Shh7FV.js +29 -0
- package/lib/divider-b3Shh7FV.js.map +1 -0
- package/lib/dropdown-menu/index.d.mts +17 -0
- package/lib/dropdown-menu/index.d.ts +17 -0
- package/lib/dropdown-menu/index.js +14 -0
- package/lib/dropdown-menu/index.mjs +14 -0
- package/lib/dropdown-menu-CCtPuYyJ.js +150 -0
- package/lib/dropdown-menu-CCtPuYyJ.js.map +1 -0
- package/lib/dropdown-menu-Cil4RtSK.mjs +117 -0
- package/lib/dropdown-menu-Cil4RtSK.mjs.map +1 -0
- package/lib/external-link-2XoC1_oL.d.ts +9 -0
- package/lib/external-link-BUhvS4ry.d.mts +9 -0
- package/lib/external-link-CEDvlQYo.js +23 -0
- package/lib/external-link-CEDvlQYo.js.map +1 -0
- package/lib/external-link-Cx9S31Ye.mjs +16 -0
- package/lib/external-link-Cx9S31Ye.mjs.map +1 -0
- package/lib/external-links-2b4M_rcA.mjs +17 -0
- package/lib/external-links-2b4M_rcA.mjs.map +1 -0
- package/lib/external-links-SfJjb48j.js +23 -0
- package/lib/external-links-SfJjb48j.js.map +1 -0
- package/lib/hamburger-menu/index.d.mts +7 -0
- package/lib/hamburger-menu/index.d.ts +6 -0
- package/lib/hamburger-menu/index.js +22 -0
- package/lib/hamburger-menu/index.mjs +22 -0
- package/lib/hamburger-menu-BZ1hA7l5.mjs +472 -0
- package/lib/hamburger-menu-BZ1hA7l5.mjs.map +1 -0
- package/lib/hamburger-menu-Bd_wmcAB.js +487 -0
- package/lib/hamburger-menu-Bd_wmcAB.js.map +1 -0
- package/lib/header/index.d.mts +26 -0
- package/lib/header/index.d.ts +25 -0
- package/lib/header/index.js +465 -0
- package/lib/header/index.js.map +1 -0
- package/lib/header/index.mjs +459 -0
- package/lib/header/index.mjs.map +1 -0
- package/lib/heading-CFSkTbdH.mjs +37 -0
- package/lib/heading-CFSkTbdH.mjs.map +1 -0
- package/lib/heading-DFzj2z0V.js +75 -0
- package/lib/heading-DFzj2z0V.js.map +1 -0
- package/lib/icons/constants.d.mts +3 -0
- package/lib/icons/constants.d.ts +3 -0
- package/lib/icons/constants.js +5 -0
- package/lib/icons/constants.mjs +3 -0
- package/lib/icons/index.d.mts +43 -0
- package/lib/icons/index.d.ts +43 -0
- package/lib/icons/index.js +15 -0
- package/lib/icons/index.mjs +5 -0
- package/lib/icons-DF-7dKxN.js +128 -0
- package/lib/icons-DF-7dKxN.js.map +1 -0
- package/lib/icons-DguoV48M.mjs +60 -0
- package/lib/icons-DguoV48M.mjs.map +1 -0
- package/lib/index-BmIgLA0K.d.mts +5 -0
- package/lib/index-H3peA2d_.d.ts +5 -0
- package/lib/internal-link-CqTu3Yi5.js +2278 -0
- package/lib/internal-link-CqTu3Yi5.js.map +1 -0
- package/lib/internal-link-D8jJal8P.d.mts +9 -0
- package/lib/internal-link-DCSEl1jM.d.ts +9 -0
- package/lib/internal-link-NQb751uB.mjs +2299 -0
- package/lib/internal-link-NQb751uB.mjs.map +1 -0
- package/lib/internal-links-BF-974mA.mjs +52 -0
- package/lib/internal-links-BF-974mA.mjs.map +1 -0
- package/lib/internal-links-CBkMU8cY.js +58 -0
- package/lib/internal-links-CBkMU8cY.js.map +1 -0
- package/lib/logo/constants.d.mts +3 -0
- package/lib/logo/constants.d.ts +3 -0
- package/lib/logo/constants.js +5 -0
- package/lib/logo/constants.mjs +3 -0
- package/lib/logo/index.d.mts +42 -0
- package/lib/logo/index.d.ts +42 -0
- package/lib/logo/index.js +8 -0
- package/lib/logo/index.mjs +5 -0
- package/lib/logo-CC5oU9Qb.mjs +64 -0
- package/lib/logo-CC5oU9Qb.mjs.map +1 -0
- package/lib/logo-D4M-1sGD.js +83 -0
- package/lib/logo-D4M-1sGD.js.map +1 -0
- package/lib/paragraph-BWXQNQtX.mjs +30 -0
- package/lib/paragraph-BWXQNQtX.mjs.map +1 -0
- package/lib/paragraph-CJvb0_cM.js +56 -0
- package/lib/paragraph-CJvb0_cM.js.map +1 -0
- package/lib/release-branch-CRZV4Ivz.js +18 -0
- package/lib/release-branch-CRZV4Ivz.js.map +1 -0
- package/lib/release-branch-CsBbhuYE.d.ts +14 -0
- package/lib/release-branch-DNCD1uH_.mjs +12 -0
- package/lib/release-branch-DNCD1uH_.mjs.map +1 -0
- package/lib/release-branch-DZwlCiWD.d.mts +14 -0
- package/lib/styles.css +1599 -0
- package/lib/tab-bar/constants.d.mts +16 -0
- package/lib/tab-bar/constants.d.ts +16 -0
- package/lib/tab-bar/constants.js +7 -0
- package/lib/tab-bar/constants.mjs +7 -0
- package/lib/tab-bar/index.d.mts +10 -0
- package/lib/tab-bar/index.d.ts +9 -0
- package/lib/tab-bar/index.js +18 -0
- package/lib/tab-bar/index.mjs +18 -0
- package/lib/tab-bar/theme.d.mts +10 -0
- package/lib/tab-bar/theme.d.ts +10 -0
- package/lib/tab-bar/theme.js +4 -0
- package/lib/tab-bar/theme.mjs +4 -0
- package/lib/tab-bar-CBL2tDXk.mjs +62 -0
- package/lib/tab-bar-CBL2tDXk.mjs.map +1 -0
- package/lib/tab-bar-ZRrpziiN.js +78 -0
- package/lib/tab-bar-ZRrpziiN.js.map +1 -0
- package/lib/text/constants.d.mts +3 -0
- package/lib/text/constants.d.ts +3 -0
- package/lib/text/constants.js +4 -0
- package/lib/text/constants.mjs +3 -0
- package/lib/text/heading.d.mts +31 -0
- package/lib/text/heading.d.ts +31 -0
- package/lib/text/heading.js +9 -0
- package/lib/text/heading.mjs +4 -0
- package/lib/text/paragraph.d.mts +25 -0
- package/lib/text/paragraph.d.ts +25 -0
- package/lib/text/paragraph.js +7 -0
- package/lib/text/paragraph.mjs +4 -0
- package/lib/theme-BDGfJ8n-.d.ts +13 -0
- package/lib/theme-BErS2Qs6.mjs +13 -0
- package/lib/theme-BErS2Qs6.mjs.map +1 -0
- package/lib/theme-BG6yZVj-.mjs +11 -0
- package/lib/theme-BG6yZVj-.mjs.map +1 -0
- package/lib/theme-BPB1kPtQ.js +18 -0
- package/lib/theme-BPB1kPtQ.js.map +1 -0
- package/lib/theme-ClamfAy8.d.mts +13 -0
- package/lib/theme-DDBlIbeS.js +17 -0
- package/lib/theme-DDBlIbeS.js.map +1 -0
- package/lib/title-bar/index.d.mts +58 -0
- package/lib/title-bar/index.d.ts +58 -0
- package/lib/title-bar/index.js +153 -0
- package/lib/title-bar/index.js.map +1 -0
- package/lib/title-bar/index.mjs +145 -0
- package/lib/title-bar/index.mjs.map +1 -0
- package/lib/type-C4hJK9H9.d.ts +11 -0
- package/lib/type-FR-fOZvz.d.mts +11 -0
- package/lib/types/index.d.mts +2 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +0 -0
- package/lib/types/index.mjs +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as react12 from "react";
|
|
2
|
+
import React$1, { FC } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/title-bar/components/title-tab/type.d.ts
|
|
5
|
+
type Tab = {
|
|
6
|
+
text: string;
|
|
7
|
+
link: string;
|
|
8
|
+
isExternal?: boolean;
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/title-bar/components/title2.d.ts
|
|
13
|
+
type Title2Props = {
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
renderButton?: React$1.ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const Title2: React$1.FC<Title2Props>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/title-bar/components/title1.d.ts
|
|
22
|
+
type Title1Props = {
|
|
23
|
+
title: string;
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const Title1: FC<Title1Props>;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/title-bar/components/title-tab/index.d.ts
|
|
30
|
+
type TitleTabProps = {
|
|
31
|
+
title: string;
|
|
32
|
+
tabs: Tab[];
|
|
33
|
+
activeTabIndex?: number;
|
|
34
|
+
};
|
|
35
|
+
declare const TitleTab: FC<TitleTabProps>;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/title-bar/index.d.ts
|
|
38
|
+
declare const _default: {
|
|
39
|
+
Title2: react12.FC<{
|
|
40
|
+
title: string;
|
|
41
|
+
subtitle?: string;
|
|
42
|
+
renderButton?: React.ReactNode;
|
|
43
|
+
className?: string;
|
|
44
|
+
}>;
|
|
45
|
+
Title1: react12.FC<{
|
|
46
|
+
title: string;
|
|
47
|
+
subtitle?: string;
|
|
48
|
+
className?: string;
|
|
49
|
+
}>;
|
|
50
|
+
TitleTab: react12.FC<{
|
|
51
|
+
title: string;
|
|
52
|
+
tabs: Tab[];
|
|
53
|
+
activeTabIndex?: number;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Title1, Title2, TitleTab, _default as default };
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_chunk = require('../chunk-BxBTb9qk.js');
|
|
3
|
+
require('../constants-BmxSMOOn.js');
|
|
4
|
+
require('../constants-K2ObjToq.js');
|
|
5
|
+
const require_paragraph = require('../paragraph-CJvb0_cM.js');
|
|
6
|
+
require('../theme-DDBlIbeS.js');
|
|
7
|
+
const require_button = require('../button-DFLYlJJW.js');
|
|
8
|
+
const require_external_link = require('../external-link-CEDvlQYo.js');
|
|
9
|
+
const require_internal_link = require('../internal-link-CqTu3Yi5.js');
|
|
10
|
+
require('../customized-link-CK7Xlgdt.js');
|
|
11
|
+
const require_heading = require('../heading-DFzj2z0V.js');
|
|
12
|
+
let react = require("react");
|
|
13
|
+
react = require_chunk.__toESM(react);
|
|
14
|
+
let clsx = require("clsx");
|
|
15
|
+
clsx = require_chunk.__toESM(clsx);
|
|
16
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
18
|
+
|
|
19
|
+
//#region src/title-bar/components/title2.tsx
|
|
20
|
+
const Title2 = ({ title, subtitle = "", renderButton = null, className = "" }) => {
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22
|
+
className: (0, clsx.default)("flex justify-between flex-col", className),
|
|
23
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
24
|
+
className: "flex flex-row justify-between",
|
|
25
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
26
|
+
className: (0, clsx.default)("flex items-baseline gap-[16px]"),
|
|
27
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_heading.H5, {
|
|
28
|
+
className: "text-gray-800",
|
|
29
|
+
text: title
|
|
30
|
+
}), subtitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_paragraph.P2, {
|
|
31
|
+
className: "text-gray-600",
|
|
32
|
+
text: subtitle
|
|
33
|
+
}) : null]
|
|
34
|
+
}), renderButton || null]
|
|
35
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, clsx.default)("w-full h-[1px] bg-gray-800 mt-[8px]", "desktop:mt-[16px]") })]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var title2_default = Title2;
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/title-bar/components/title1.tsx
|
|
42
|
+
const Title1 = ({ title, subtitle = "", className = "" }) => {
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
44
|
+
className: (0, clsx.default)("flex justify-between flex-col", className),
|
|
45
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
46
|
+
className: (0, clsx.default)("flex items-baseline gap-[16px]"),
|
|
47
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_heading.H2, {
|
|
48
|
+
className: "text-gray-800",
|
|
49
|
+
text: title
|
|
50
|
+
}), subtitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_paragraph.P1, {
|
|
51
|
+
className: "text-gray-600",
|
|
52
|
+
text: subtitle
|
|
53
|
+
}) : null]
|
|
54
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, clsx.default)("w-full h-[1px] bg-gray-300 mt-[8px]", "desktop:mt-[16px]") })]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var title1_default = Title1;
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/title-bar/components/title-tab/hook.ts
|
|
61
|
+
const useScrollStatus = (setShowNext) => {
|
|
62
|
+
const ref = (0, react.useRef)(null);
|
|
63
|
+
(0, react.useEffect)(() => {
|
|
64
|
+
if (!ref.current) return;
|
|
65
|
+
if (ref.current.scrollWidth > ref.current.clientWidth) setShowNext(true);
|
|
66
|
+
}, [setShowNext]);
|
|
67
|
+
(0, react.useEffect)(() => {
|
|
68
|
+
if (!ref.current) return;
|
|
69
|
+
const refEle = ref.current;
|
|
70
|
+
const handleScroll = () => {
|
|
71
|
+
if (refEle.offsetWidth + refEle.scrollLeft >= refEle.scrollWidth) setShowNext(false);
|
|
72
|
+
else setShowNext(true);
|
|
73
|
+
};
|
|
74
|
+
refEle.addEventListener("scroll", handleScroll);
|
|
75
|
+
return () => {
|
|
76
|
+
refEle.removeEventListener("scroll", handleScroll);
|
|
77
|
+
};
|
|
78
|
+
}, [setShowNext]);
|
|
79
|
+
return ref;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/title-bar/components/title-tab/tab-item.tsx
|
|
84
|
+
const TabItem = ({ text, link, isExternal = false, isActive = false, onClick, className = "" }) => {
|
|
85
|
+
const CustomizedLink = isExternal ? require_external_link.external_link_default : require_internal_link.internal_link_default;
|
|
86
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
87
|
+
className: (0, clsx.default)("flex shrink-0 mr-[24px] last:mr-0", className),
|
|
88
|
+
onClick,
|
|
89
|
+
type: "button",
|
|
90
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomizedLink, {
|
|
91
|
+
to: link,
|
|
92
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.text_button_default, {
|
|
93
|
+
text,
|
|
94
|
+
active: isActive,
|
|
95
|
+
size: require_button.text_button_default.Size.l,
|
|
96
|
+
className: "py-[16px]"
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
var tab_item_default = TabItem;
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/title-bar/components/title-tab/index.tsx
|
|
105
|
+
const TitleTab = ({ title, tabs = [], activeTabIndex = 0 }) => {
|
|
106
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(activeTabIndex);
|
|
107
|
+
const [showGradientMask, setShowGradientMask] = (0, react.useState)(false);
|
|
108
|
+
const ref = useScrollStatus(setShowGradientMask);
|
|
109
|
+
(0, react.useEffect)(() => {
|
|
110
|
+
setActiveIndex(activeTabIndex);
|
|
111
|
+
}, [activeTabIndex]);
|
|
112
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
113
|
+
className: "flex flex-col w-full text-gray-800",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_heading.H1, { text: title }),
|
|
116
|
+
tabs.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
117
|
+
ref,
|
|
118
|
+
className: (0, clsx.default)("flex items-center", "overflow-x-scroll scrollbar:!w-0", { "[mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)] [-webkit-mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)]": showGradientMask }),
|
|
119
|
+
children: tabs.map((tab, index) => {
|
|
120
|
+
const tabProps = {
|
|
121
|
+
...tab,
|
|
122
|
+
isActive: index === activeIndex
|
|
123
|
+
};
|
|
124
|
+
const handleClick = () => {
|
|
125
|
+
setActiveIndex(index);
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ (0, react.createElement)(tab_item_default, {
|
|
128
|
+
...tabProps,
|
|
129
|
+
key: `tab-${tab.text}-${index}`,
|
|
130
|
+
onClick: handleClick
|
|
131
|
+
});
|
|
132
|
+
})
|
|
133
|
+
}) : null,
|
|
134
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, clsx.default)("w-full h-[1px] bg-gray-300 mt-[0px]", "desktop:mt-[0px]") })
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
var title_tab_default = TitleTab;
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/title-bar/index.ts
|
|
142
|
+
var title_bar_default = {
|
|
143
|
+
Title2: title2_default,
|
|
144
|
+
Title1: title1_default,
|
|
145
|
+
TitleTab: title_tab_default
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
exports.Title1 = title1_default;
|
|
150
|
+
exports.Title2 = title2_default;
|
|
151
|
+
exports.TitleTab = title_tab_default;
|
|
152
|
+
exports.default = title_bar_default;
|
|
153
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Title2: React.FC<Title2Props>","H5","P2","Title1: FC<Title1Props>","H2","P1","handleScroll: EventListener","TabItem: FC<TabItemProps>","ExternalLink","InternalLink","TextButton","TitleTab: FC<TitleTabProps>","H1","TabItem"],"sources":["../../src/title-bar/components/title2.tsx","../../src/title-bar/components/title1.tsx","../../src/title-bar/components/title-tab/hook.ts","../../src/title-bar/components/title-tab/tab-item.tsx","../../src/title-bar/components/title-tab/index.tsx","../../src/title-bar/index.ts"],"sourcesContent":["import clsx from 'clsx'\nimport type React from 'react'\n// components\nimport { H5 } from '../../text/heading'\nimport { P2 } from '../../text/paragraph'\n\ntype Title2Props = {\n title: string\n subtitle?: string\n renderButton?: React.ReactNode\n className?: string\n}\n\nconst Title2: React.FC<Title2Props> = ({\n title,\n subtitle = '',\n renderButton = null,\n className = '',\n}) => {\n return (\n <div className={clsx('flex justify-between flex-col', className)}>\n <div className=\"flex flex-row justify-between\">\n <div className={clsx('flex items-baseline gap-[16px]')}>\n <H5 className=\"text-gray-800\" text={title} />\n {subtitle ? <P2 className=\"text-gray-600\" text={subtitle} /> : null}\n </div>\n {renderButton || null}\n </div>\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-800 mt-[8px]',\n 'desktop:mt-[16px]'\n )}\n />\n </div>\n )\n}\n\nexport default Title2\n","import clsx from 'clsx'\nimport type { FC } from 'react'\n// components\nimport { H2 } from '../../text/heading'\nimport { P1 } from '../../text/paragraph'\n\ntype Title1Props = {\n title: string\n subtitle?: string\n className?: string\n}\n\nconst Title1: FC<Title1Props> = ({ title, subtitle = '', className = '' }) => {\n return (\n <div className={clsx('flex justify-between flex-col', className)}>\n <div className={clsx('flex items-baseline gap-[16px]')}>\n <H2 className=\"text-gray-800\" text={title} />\n {subtitle ? <P1 className=\"text-gray-600\" text={subtitle} /> : null}\n </div>\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-300 mt-[8px]',\n 'desktop:mt-[16px]'\n )}\n />\n </div>\n )\n}\n\nexport default Title1\n","import { useRef, useEffect } from 'react'\n\nexport const useScrollStatus = (setShowNext: (show: boolean) => void) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!ref.current) return\n\n if (ref.current.scrollWidth > ref.current.clientWidth) {\n // scrollbar occur\n setShowNext(true)\n }\n }, [setShowNext])\n\n useEffect(() => {\n if (!ref.current) return\n\n const refEle = ref.current\n const handleScroll: EventListener = () => {\n if (refEle.offsetWidth + refEle.scrollLeft >= refEle.scrollWidth) {\n // scroll to end\n setShowNext(false)\n } else {\n setShowNext(true)\n }\n }\n\n refEle.addEventListener('scroll', handleScroll)\n\n return () => {\n refEle.removeEventListener('scroll', handleScroll)\n }\n }, [setShowNext])\n\n return ref\n}\n","import clsx from 'clsx'\nimport type { FC } from 'react'\n// type\nimport type { Tab } from './type'\n// component\nimport { ExternalLink, InternalLink } from '../../../customized-link'\nimport { TextButton } from '../../../button'\n\ntype TabItemProps = Tab & {\n onClick: () => void\n className?: string\n}\nconst TabItem: FC<TabItemProps> = ({\n text,\n link,\n isExternal = false,\n isActive = false,\n onClick,\n className = '',\n}) => {\n const CustomizedLink = isExternal ? ExternalLink : InternalLink\n return (\n <button\n className={clsx('flex shrink-0 mr-[24px] last:mr-0', className)}\n onClick={onClick}\n type=\"button\"\n >\n <CustomizedLink to={link}>\n <TextButton\n text={text}\n active={isActive}\n size={TextButton.Size.l}\n className=\"py-[16px]\"\n />\n </CustomizedLink>\n </button>\n )\n}\n\nexport default TabItem\n","import clsx from 'clsx'\nimport { type FC, useState, useEffect } from 'react'\n// hook\nimport { useScrollStatus } from './hook'\n// components\nimport TabItem from './tab-item'\nimport { H1 } from '../../../text/heading'\n// type\nimport type { Tab } from './type'\n\ntype TitleTabProps = {\n title: string\n tabs: Tab[]\n activeTabIndex?: number\n}\nconst TitleTab: FC<TitleTabProps> = ({\n title,\n tabs = [],\n activeTabIndex = 0,\n}) => {\n const [activeIndex, setActiveIndex] = useState(activeTabIndex)\n const [showGradientMask, setShowGradientMask] = useState(false)\n\n const ref = useScrollStatus(setShowGradientMask)\n\n useEffect(() => {\n setActiveIndex(activeTabIndex)\n }, [activeTabIndex])\n\n return (\n <div className=\"flex flex-col w-full text-gray-800\">\n <H1 text={title} />\n {tabs.length > 0 ? (\n <div\n ref={ref}\n className={clsx(\n 'flex items-center',\n 'overflow-x-scroll scrollbar:!w-0',\n {\n '[mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)] [-webkit-mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)]':\n showGradientMask,\n }\n )}\n >\n {tabs.map((tab, index) => {\n const tabProps = { ...tab, isActive: index === activeIndex }\n const handleClick = () => {\n setActiveIndex(index)\n }\n return (\n <TabItem {...tabProps} key={`tab-${tab.text}-${index}`} onClick={handleClick} />\n )\n })}\n </div>\n ) : null}\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-300 mt-[0px]',\n 'desktop:mt-[0px]'\n )}\n />\n </div>\n )\n}\n\nexport default TitleTab\n","import Title2 from './components/title2'\nimport Title1 from './components/title1'\nimport TitleTab from './components/title-tab'\n\nexport { Title2, Title1, TitleTab }\n\nexport default {\n Title2,\n Title1,\n TitleTab,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAMA,UAAiC,EACrC,OACA,WAAW,IACX,eAAe,MACf,YAAY,SACR;AACJ,QACE,4CAAC;EAAI,6BAAgB,iCAAiC,UAAU;aAC9D,4CAAC;GAAI,WAAU;cACb,4CAAC;IAAI,6BAAgB,iCAAiC;eACpD,2CAACC;KAAG,WAAU;KAAgB,MAAM;MAAS,EAC5C,WAAW,2CAACC;KAAG,WAAU;KAAgB,MAAM;MAAY,GAAG;KAC3D,EACL,gBAAgB;IACb,EACN,2CAAC,SACC,6BACE,uCACA,oBACD,GACD;GACE;;AAIV,qBAAe;;;;AC1Bf,MAAMC,UAA2B,EAAE,OAAO,WAAW,IAAI,YAAY,SAAS;AAC5E,QACE,4CAAC;EAAI,6BAAgB,iCAAiC,UAAU;aAC9D,4CAAC;GAAI,6BAAgB,iCAAiC;cACpD,2CAACC;IAAG,WAAU;IAAgB,MAAM;KAAS,EAC5C,WAAW,2CAACC;IAAG,WAAU;IAAgB,MAAM;KAAY,GAAG;IAC3D,EACN,2CAAC,SACC,6BACE,uCACA,oBACD,GACD;GACE;;AAIV,qBAAe;;;;AC3Bf,MAAa,mBAAmB,gBAAyC;CACvE,MAAM,wBAA6B,KAAK;AAExC,4BAAgB;AACd,MAAI,CAAC,IAAI,QAAS;AAElB,MAAI,IAAI,QAAQ,cAAc,IAAI,QAAQ,YAExC,aAAY,KAAK;IAElB,CAAC,YAAY,CAAC;AAEjB,4BAAgB;AACd,MAAI,CAAC,IAAI,QAAS;EAElB,MAAM,SAAS,IAAI;EACnB,MAAMC,qBAAoC;AACxC,OAAI,OAAO,cAAc,OAAO,cAAc,OAAO,YAEnD,aAAY,MAAM;OAElB,aAAY,KAAK;;AAIrB,SAAO,iBAAiB,UAAU,aAAa;AAE/C,eAAa;AACX,UAAO,oBAAoB,UAAU,aAAa;;IAEnD,CAAC,YAAY,CAAC;AAEjB,QAAO;;;;;ACtBT,MAAMC,WAA6B,EACjC,MACA,MACA,aAAa,OACb,WAAW,OACX,SACA,YAAY,SACR;CACJ,MAAM,iBAAiB,aAAaC,8CAAeC;AACnD,QACE,2CAAC;EACC,6BAAgB,qCAAqC,UAAU;EACtD;EACT,MAAK;YAEL,2CAAC;GAAe,IAAI;aAClB,2CAACC;IACO;IACN,QAAQ;IACR,MAAMA,mCAAW,KAAK;IACtB,WAAU;KACV;IACa;GACV;;AAIb,uBAAe;;;;ACxBf,MAAMC,YAA+B,EACnC,OACA,OAAO,EAAE,EACT,iBAAiB,QACb;CACJ,MAAM,CAAC,aAAa,sCAA2B,eAAe;CAC9D,MAAM,CAAC,kBAAkB,2CAAgC,MAAM;CAE/D,MAAM,MAAM,gBAAgB,oBAAoB;AAEhD,4BAAgB;AACd,iBAAe,eAAe;IAC7B,CAAC,eAAe,CAAC;AAEpB,QACE,4CAAC;EAAI,WAAU;;GACb,2CAACC,sBAAG,MAAM,QAAS;GAClB,KAAK,SAAS,IACb,2CAAC;IACM;IACL,6BACE,qBACA,oCACA,EACE,yJACE,kBACH,CACF;cAEA,KAAK,KAAK,KAAK,UAAU;KACxB,MAAM,WAAW;MAAE,GAAG;MAAK,UAAU,UAAU;MAAa;KAC5D,MAAM,oBAAoB;AACxB,qBAAe,MAAM;;AAEvB,YACE,yCAACC;MAAQ,GAAI;MAAU,KAAK,OAAO,IAAI,KAAK,GAAG;MAAS,SAAS;OAAe;MAElF;KACE,GACJ;GACJ,2CAAC,SACC,6BACE,uCACA,mBACD,GACD;;GACE;;AAIV,wBAAe;;;;AC3Df,wBAAe;CACb;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { internal_link_default } from "../internal-link-NQb751uB.mjs";
|
|
2
|
+
import "../constants-oTHAnh6r.mjs";
|
|
3
|
+
import "../constants-BWFuBApI.mjs";
|
|
4
|
+
import { P1, P2 } from "../paragraph-BWXQNQtX.mjs";
|
|
5
|
+
import "../theme-BG6yZVj-.mjs";
|
|
6
|
+
import { text_button_default } from "../button-DyUYGG90.mjs";
|
|
7
|
+
import { external_link_default } from "../external-link-Cx9S31Ye.mjs";
|
|
8
|
+
import "../customized-link-BkuKVCKQ.mjs";
|
|
9
|
+
import { H1, H2, H5 } from "../heading-CFSkTbdH.mjs";
|
|
10
|
+
import { createElement, useEffect, useRef, useState } from "react";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
|
|
14
|
+
//#region src/title-bar/components/title2.tsx
|
|
15
|
+
const Title2 = ({ title, subtitle = "", renderButton = null, className = "" }) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: clsx("flex justify-between flex-col", className),
|
|
18
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "flex flex-row justify-between",
|
|
20
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: clsx("flex items-baseline gap-[16px]"),
|
|
22
|
+
children: [/* @__PURE__ */ jsx(H5, {
|
|
23
|
+
className: "text-gray-800",
|
|
24
|
+
text: title
|
|
25
|
+
}), subtitle ? /* @__PURE__ */ jsx(P2, {
|
|
26
|
+
className: "text-gray-600",
|
|
27
|
+
text: subtitle
|
|
28
|
+
}) : null]
|
|
29
|
+
}), renderButton || null]
|
|
30
|
+
}), /* @__PURE__ */ jsx("div", { className: clsx("w-full h-[1px] bg-gray-800 mt-[8px]", "desktop:mt-[16px]") })]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var title2_default = Title2;
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/title-bar/components/title1.tsx
|
|
37
|
+
const Title1 = ({ title, subtitle = "", className = "" }) => {
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: clsx("flex justify-between flex-col", className),
|
|
40
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
41
|
+
className: clsx("flex items-baseline gap-[16px]"),
|
|
42
|
+
children: [/* @__PURE__ */ jsx(H2, {
|
|
43
|
+
className: "text-gray-800",
|
|
44
|
+
text: title
|
|
45
|
+
}), subtitle ? /* @__PURE__ */ jsx(P1, {
|
|
46
|
+
className: "text-gray-600",
|
|
47
|
+
text: subtitle
|
|
48
|
+
}) : null]
|
|
49
|
+
}), /* @__PURE__ */ jsx("div", { className: clsx("w-full h-[1px] bg-gray-300 mt-[8px]", "desktop:mt-[16px]") })]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var title1_default = Title1;
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/title-bar/components/title-tab/hook.ts
|
|
56
|
+
const useScrollStatus = (setShowNext) => {
|
|
57
|
+
const ref = useRef(null);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!ref.current) return;
|
|
60
|
+
if (ref.current.scrollWidth > ref.current.clientWidth) setShowNext(true);
|
|
61
|
+
}, [setShowNext]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!ref.current) return;
|
|
64
|
+
const refEle = ref.current;
|
|
65
|
+
const handleScroll = () => {
|
|
66
|
+
if (refEle.offsetWidth + refEle.scrollLeft >= refEle.scrollWidth) setShowNext(false);
|
|
67
|
+
else setShowNext(true);
|
|
68
|
+
};
|
|
69
|
+
refEle.addEventListener("scroll", handleScroll);
|
|
70
|
+
return () => {
|
|
71
|
+
refEle.removeEventListener("scroll", handleScroll);
|
|
72
|
+
};
|
|
73
|
+
}, [setShowNext]);
|
|
74
|
+
return ref;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/title-bar/components/title-tab/tab-item.tsx
|
|
79
|
+
const TabItem = ({ text, link, isExternal = false, isActive = false, onClick, className = "" }) => {
|
|
80
|
+
const CustomizedLink = isExternal ? external_link_default : internal_link_default;
|
|
81
|
+
return /* @__PURE__ */ jsx("button", {
|
|
82
|
+
className: clsx("flex shrink-0 mr-[24px] last:mr-0", className),
|
|
83
|
+
onClick,
|
|
84
|
+
type: "button",
|
|
85
|
+
children: /* @__PURE__ */ jsx(CustomizedLink, {
|
|
86
|
+
to: link,
|
|
87
|
+
children: /* @__PURE__ */ jsx(text_button_default, {
|
|
88
|
+
text,
|
|
89
|
+
active: isActive,
|
|
90
|
+
size: text_button_default.Size.l,
|
|
91
|
+
className: "py-[16px]"
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var tab_item_default = TabItem;
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/title-bar/components/title-tab/index.tsx
|
|
100
|
+
const TitleTab = ({ title, tabs = [], activeTabIndex = 0 }) => {
|
|
101
|
+
const [activeIndex, setActiveIndex] = useState(activeTabIndex);
|
|
102
|
+
const [showGradientMask, setShowGradientMask] = useState(false);
|
|
103
|
+
const ref = useScrollStatus(setShowGradientMask);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
setActiveIndex(activeTabIndex);
|
|
106
|
+
}, [activeTabIndex]);
|
|
107
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
108
|
+
className: "flex flex-col w-full text-gray-800",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx(H1, { text: title }),
|
|
111
|
+
tabs.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
112
|
+
ref,
|
|
113
|
+
className: clsx("flex items-center", "overflow-x-scroll scrollbar:!w-0", { "[mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)] [-webkit-mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)]": showGradientMask }),
|
|
114
|
+
children: tabs.map((tab, index) => {
|
|
115
|
+
const tabProps = {
|
|
116
|
+
...tab,
|
|
117
|
+
isActive: index === activeIndex
|
|
118
|
+
};
|
|
119
|
+
const handleClick = () => {
|
|
120
|
+
setActiveIndex(index);
|
|
121
|
+
};
|
|
122
|
+
return /* @__PURE__ */ createElement(tab_item_default, {
|
|
123
|
+
...tabProps,
|
|
124
|
+
key: `tab-${tab.text}-${index}`,
|
|
125
|
+
onClick: handleClick
|
|
126
|
+
});
|
|
127
|
+
})
|
|
128
|
+
}) : null,
|
|
129
|
+
/* @__PURE__ */ jsx("div", { className: clsx("w-full h-[1px] bg-gray-300 mt-[0px]", "desktop:mt-[0px]") })
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
var title_tab_default = TitleTab;
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/title-bar/index.ts
|
|
137
|
+
var title_bar_default = {
|
|
138
|
+
Title2: title2_default,
|
|
139
|
+
Title1: title1_default,
|
|
140
|
+
TitleTab: title_tab_default
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
export { title1_default as Title1, title2_default as Title2, title_tab_default as TitleTab, title_bar_default as default };
|
|
145
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Title2: React.FC<Title2Props>","Title1: FC<Title1Props>","handleScroll: EventListener","TabItem: FC<TabItemProps>","ExternalLink","InternalLink","TextButton","TitleTab: FC<TitleTabProps>","TabItem"],"sources":["../../src/title-bar/components/title2.tsx","../../src/title-bar/components/title1.tsx","../../src/title-bar/components/title-tab/hook.ts","../../src/title-bar/components/title-tab/tab-item.tsx","../../src/title-bar/components/title-tab/index.tsx","../../src/title-bar/index.ts"],"sourcesContent":["import clsx from 'clsx'\nimport type React from 'react'\n// components\nimport { H5 } from '../../text/heading'\nimport { P2 } from '../../text/paragraph'\n\ntype Title2Props = {\n title: string\n subtitle?: string\n renderButton?: React.ReactNode\n className?: string\n}\n\nconst Title2: React.FC<Title2Props> = ({\n title,\n subtitle = '',\n renderButton = null,\n className = '',\n}) => {\n return (\n <div className={clsx('flex justify-between flex-col', className)}>\n <div className=\"flex flex-row justify-between\">\n <div className={clsx('flex items-baseline gap-[16px]')}>\n <H5 className=\"text-gray-800\" text={title} />\n {subtitle ? <P2 className=\"text-gray-600\" text={subtitle} /> : null}\n </div>\n {renderButton || null}\n </div>\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-800 mt-[8px]',\n 'desktop:mt-[16px]'\n )}\n />\n </div>\n )\n}\n\nexport default Title2\n","import clsx from 'clsx'\nimport type { FC } from 'react'\n// components\nimport { H2 } from '../../text/heading'\nimport { P1 } from '../../text/paragraph'\n\ntype Title1Props = {\n title: string\n subtitle?: string\n className?: string\n}\n\nconst Title1: FC<Title1Props> = ({ title, subtitle = '', className = '' }) => {\n return (\n <div className={clsx('flex justify-between flex-col', className)}>\n <div className={clsx('flex items-baseline gap-[16px]')}>\n <H2 className=\"text-gray-800\" text={title} />\n {subtitle ? <P1 className=\"text-gray-600\" text={subtitle} /> : null}\n </div>\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-300 mt-[8px]',\n 'desktop:mt-[16px]'\n )}\n />\n </div>\n )\n}\n\nexport default Title1\n","import { useRef, useEffect } from 'react'\n\nexport const useScrollStatus = (setShowNext: (show: boolean) => void) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!ref.current) return\n\n if (ref.current.scrollWidth > ref.current.clientWidth) {\n // scrollbar occur\n setShowNext(true)\n }\n }, [setShowNext])\n\n useEffect(() => {\n if (!ref.current) return\n\n const refEle = ref.current\n const handleScroll: EventListener = () => {\n if (refEle.offsetWidth + refEle.scrollLeft >= refEle.scrollWidth) {\n // scroll to end\n setShowNext(false)\n } else {\n setShowNext(true)\n }\n }\n\n refEle.addEventListener('scroll', handleScroll)\n\n return () => {\n refEle.removeEventListener('scroll', handleScroll)\n }\n }, [setShowNext])\n\n return ref\n}\n","import clsx from 'clsx'\nimport type { FC } from 'react'\n// type\nimport type { Tab } from './type'\n// component\nimport { ExternalLink, InternalLink } from '../../../customized-link'\nimport { TextButton } from '../../../button'\n\ntype TabItemProps = Tab & {\n onClick: () => void\n className?: string\n}\nconst TabItem: FC<TabItemProps> = ({\n text,\n link,\n isExternal = false,\n isActive = false,\n onClick,\n className = '',\n}) => {\n const CustomizedLink = isExternal ? ExternalLink : InternalLink\n return (\n <button\n className={clsx('flex shrink-0 mr-[24px] last:mr-0', className)}\n onClick={onClick}\n type=\"button\"\n >\n <CustomizedLink to={link}>\n <TextButton\n text={text}\n active={isActive}\n size={TextButton.Size.l}\n className=\"py-[16px]\"\n />\n </CustomizedLink>\n </button>\n )\n}\n\nexport default TabItem\n","import clsx from 'clsx'\nimport { type FC, useState, useEffect } from 'react'\n// hook\nimport { useScrollStatus } from './hook'\n// components\nimport TabItem from './tab-item'\nimport { H1 } from '../../../text/heading'\n// type\nimport type { Tab } from './type'\n\ntype TitleTabProps = {\n title: string\n tabs: Tab[]\n activeTabIndex?: number\n}\nconst TitleTab: FC<TitleTabProps> = ({\n title,\n tabs = [],\n activeTabIndex = 0,\n}) => {\n const [activeIndex, setActiveIndex] = useState(activeTabIndex)\n const [showGradientMask, setShowGradientMask] = useState(false)\n\n const ref = useScrollStatus(setShowGradientMask)\n\n useEffect(() => {\n setActiveIndex(activeTabIndex)\n }, [activeTabIndex])\n\n return (\n <div className=\"flex flex-col w-full text-gray-800\">\n <H1 text={title} />\n {tabs.length > 0 ? (\n <div\n ref={ref}\n className={clsx(\n 'flex items-center',\n 'overflow-x-scroll scrollbar:!w-0',\n {\n '[mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)] [-webkit-mask-image:linear-gradient(to_left,rgba(241,241,241,0),#f1f1f1_48px)]':\n showGradientMask,\n }\n )}\n >\n {tabs.map((tab, index) => {\n const tabProps = { ...tab, isActive: index === activeIndex }\n const handleClick = () => {\n setActiveIndex(index)\n }\n return (\n <TabItem {...tabProps} key={`tab-${tab.text}-${index}`} onClick={handleClick} />\n )\n })}\n </div>\n ) : null}\n <div\n className={clsx(\n 'w-full h-[1px] bg-gray-300 mt-[0px]',\n 'desktop:mt-[0px]'\n )}\n />\n </div>\n )\n}\n\nexport default TitleTab\n","import Title2 from './components/title2'\nimport Title1 from './components/title1'\nimport TitleTab from './components/title-tab'\n\nexport { Title2, Title1, TitleTab }\n\nexport default {\n Title2,\n Title1,\n TitleTab,\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAMA,UAAiC,EACrC,OACA,WAAW,IACX,eAAe,MACf,YAAY,SACR;AACJ,QACE,qBAAC;EAAI,WAAW,KAAK,iCAAiC,UAAU;aAC9D,qBAAC;GAAI,WAAU;cACb,qBAAC;IAAI,WAAW,KAAK,iCAAiC;eACpD,oBAAC;KAAG,WAAU;KAAgB,MAAM;MAAS,EAC5C,WAAW,oBAAC;KAAG,WAAU;KAAgB,MAAM;MAAY,GAAG;KAC3D,EACL,gBAAgB;IACb,EACN,oBAAC,SACC,WAAW,KACT,uCACA,oBACD,GACD;GACE;;AAIV,qBAAe;;;;AC1Bf,MAAMC,UAA2B,EAAE,OAAO,WAAW,IAAI,YAAY,SAAS;AAC5E,QACE,qBAAC;EAAI,WAAW,KAAK,iCAAiC,UAAU;aAC9D,qBAAC;GAAI,WAAW,KAAK,iCAAiC;cACpD,oBAAC;IAAG,WAAU;IAAgB,MAAM;KAAS,EAC5C,WAAW,oBAAC;IAAG,WAAU;IAAgB,MAAM;KAAY,GAAG;IAC3D,EACN,oBAAC,SACC,WAAW,KACT,uCACA,oBACD,GACD;GACE;;AAIV,qBAAe;;;;AC3Bf,MAAa,mBAAmB,gBAAyC;CACvE,MAAM,MAAM,OAAuB,KAAK;AAExC,iBAAgB;AACd,MAAI,CAAC,IAAI,QAAS;AAElB,MAAI,IAAI,QAAQ,cAAc,IAAI,QAAQ,YAExC,aAAY,KAAK;IAElB,CAAC,YAAY,CAAC;AAEjB,iBAAgB;AACd,MAAI,CAAC,IAAI,QAAS;EAElB,MAAM,SAAS,IAAI;EACnB,MAAMC,qBAAoC;AACxC,OAAI,OAAO,cAAc,OAAO,cAAc,OAAO,YAEnD,aAAY,MAAM;OAElB,aAAY,KAAK;;AAIrB,SAAO,iBAAiB,UAAU,aAAa;AAE/C,eAAa;AACX,UAAO,oBAAoB,UAAU,aAAa;;IAEnD,CAAC,YAAY,CAAC;AAEjB,QAAO;;;;;ACtBT,MAAMC,WAA6B,EACjC,MACA,MACA,aAAa,OACb,WAAW,OACX,SACA,YAAY,SACR;CACJ,MAAM,iBAAiB,aAAaC,wBAAeC;AACnD,QACE,oBAAC;EACC,WAAW,KAAK,qCAAqC,UAAU;EACtD;EACT,MAAK;YAEL,oBAAC;GAAe,IAAI;aAClB,oBAACC;IACO;IACN,QAAQ;IACR,MAAMA,oBAAW,KAAK;IACtB,WAAU;KACV;IACa;GACV;;AAIb,uBAAe;;;;ACxBf,MAAMC,YAA+B,EACnC,OACA,OAAO,EAAE,EACT,iBAAiB,QACb;CACJ,MAAM,CAAC,aAAa,kBAAkB,SAAS,eAAe;CAC9D,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,MAAM;CAE/D,MAAM,MAAM,gBAAgB,oBAAoB;AAEhD,iBAAgB;AACd,iBAAe,eAAe;IAC7B,CAAC,eAAe,CAAC;AAEpB,QACE,qBAAC;EAAI,WAAU;;GACb,oBAAC,MAAG,MAAM,QAAS;GAClB,KAAK,SAAS,IACb,oBAAC;IACM;IACL,WAAW,KACT,qBACA,oCACA,EACE,yJACE,kBACH,CACF;cAEA,KAAK,KAAK,KAAK,UAAU;KACxB,MAAM,WAAW;MAAE,GAAG;MAAK,UAAU,UAAU;MAAa;KAC5D,MAAM,oBAAoB;AACxB,qBAAe,MAAM;;AAEvB,YACE,8BAACC;MAAQ,GAAI;MAAU,KAAK,OAAO,IAAI,KAAK,GAAG;MAAS,SAAS;OAAe;MAElF;KACE,GACJ;GACJ,oBAAC,SACC,WAAW,KACT,uCACA,mBACD,GACD;;GACE;;AAIV,wBAAe;;;;AC3Df,wBAAe;CACb;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/customized-link/type.d.ts
|
|
2
|
+
type LinkTarget = '_blank' | '_self' | '_parent' | '_top';
|
|
3
|
+
type CustomizedLinkProps = {
|
|
4
|
+
to: string;
|
|
5
|
+
target?: LinkTarget;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CustomizedLinkProps, LinkTarget };
|
|
11
|
+
//# sourceMappingURL=type-C4hJK9H9.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/customized-link/type.d.ts
|
|
2
|
+
type LinkTarget = '_blank' | '_self' | '_parent' | '_top';
|
|
3
|
+
type CustomizedLinkProps = {
|
|
4
|
+
to: string;
|
|
5
|
+
target?: LinkTarget;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CustomizedLinkProps, LinkTarget };
|
|
11
|
+
//# sourceMappingURL=type-FR-fOZvz.d.mts.map
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twreporter/react-typescript-components",
|
|
3
|
+
"description": "React components using TypeScript and Tailwind CSS",
|
|
4
|
+
"author": "twreporter <developer@twreporter.org>",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"version": "0.1.0-beta.10",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"clean": "rm -rf lib",
|
|
10
|
+
"build:styles": "tailwindcss -i ./src/styles.css -o ./lib/styles.css",
|
|
11
|
+
"build:components": "tsdown",
|
|
12
|
+
"build": "yarn clean && yarn build:components && yarn build:styles",
|
|
13
|
+
"prepublishOnly": "yarn build",
|
|
14
|
+
"storybook": "storybook dev -p 6006",
|
|
15
|
+
"build-storybook": "storybook build"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": "^19.0.0",
|
|
19
|
+
"react-dom": "^19.0.0",
|
|
20
|
+
"tailwindcss": "^4.1.11"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"clsx": "^2.1.1",
|
|
24
|
+
"lodash": "^4.17.21",
|
|
25
|
+
"react-transition-group": "^4.4.5"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@storybook/addon-docs": "^9.1.3",
|
|
29
|
+
"@storybook/react-vite": "^9.1.3",
|
|
30
|
+
"@tailwindcss/cli": "^4.1.11",
|
|
31
|
+
"@tailwindcss/postcss": "^4.1.11",
|
|
32
|
+
"@twreporter/tailwind-config": "^0.1.0-beta.6",
|
|
33
|
+
"@types/lodash": "^4",
|
|
34
|
+
"@types/react": "^19",
|
|
35
|
+
"@types/react-dom": "^19",
|
|
36
|
+
"@types/react-transition-group": "^4",
|
|
37
|
+
"autoprefixer": "^10.4.21",
|
|
38
|
+
"storybook": "^9.1.3",
|
|
39
|
+
"tailwind-scrollbar": "^4.0.2",
|
|
40
|
+
"tsdown": "^0.15.2",
|
|
41
|
+
"typescript": "^5",
|
|
42
|
+
"vite": "^7.1.3"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"lib"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/twreporter/www-public-monorepo.git",
|
|
50
|
+
"directory": "packages/react-typescript-components"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "44eb32c03450c0e52ea0d2f6deb58084b7c3c167"
|
|
53
|
+
}
|