@sanvika/ui 0.1.5 → 0.2.0
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/package.json +15 -29
- package/src/components/buttons/Button.jsx +97 -0
- package/src/components/buttons/Button.stories.jsx +110 -0
- package/src/components/buttons/FavoriteHeartButton.jsx +41 -0
- package/src/components/buttons/FavoriteHeartButton.stories.jsx +48 -0
- package/src/components/buttons/ScrollButton.jsx +36 -0
- package/src/components/buttons/ScrollButton.stories.jsx +21 -0
- package/src/components/buttons/ThreeDotButton.jsx +36 -0
- package/src/components/buttons/ThreeDotButton.stories.jsx +14 -0
- package/src/components/common/Container.jsx +38 -0
- package/src/components/common/Section.jsx +60 -0
- package/src/components/common/Section.stories.jsx +64 -0
- package/src/components/icons/BellIcon.jsx +10 -0
- package/src/components/icons/ChevronDown.jsx +20 -0
- package/src/components/icons/EmailIcon.jsx +9 -0
- package/src/components/icons/FaAngleDown.jsx +9 -0
- package/src/components/icons/FaAngleRight.jsx +9 -0
- package/src/components/icons/FaArrowDown.jsx +9 -0
- package/src/components/icons/FaArrowLeft.jsx +9 -0
- package/src/components/icons/FaArrowUp.jsx +9 -0
- package/src/components/icons/FaBell.jsx +9 -0
- package/src/components/icons/FaBullhorn.jsx +10 -0
- package/src/components/icons/FaCalendarAlt.jsx +9 -0
- package/src/components/icons/FaCheck.jsx +9 -0
- package/src/components/icons/FaCheckCircle.jsx +9 -0
- package/src/components/icons/FaCheckDouble.jsx +9 -0
- package/src/components/icons/FaChevronDown.jsx +9 -0
- package/src/components/icons/FaChevronRight.jsx +9 -0
- package/src/components/icons/FaCircle.jsx +9 -0
- package/src/components/icons/FaComments.jsx +9 -0
- package/src/components/icons/FaEye.jsx +9 -0
- package/src/components/icons/FaEyeSlash.jsx +9 -0
- package/src/components/icons/FaHome.jsx +9 -0
- package/src/components/icons/FaKeyboard.jsx +9 -0
- package/src/components/icons/FaLocationArrow.jsx +9 -0
- package/src/components/icons/FaMapMarkerAlt.jsx +9 -0
- package/src/components/icons/FaMoon.jsx +9 -0
- package/src/components/icons/FaPaperPlane.jsx +9 -0
- package/src/components/icons/FaPaperclip.jsx +9 -0
- package/src/components/icons/FaSignInAlt.jsx +9 -0
- package/src/components/icons/FaSmile.jsx +9 -0
- package/src/components/icons/FaStar.jsx +9 -0
- package/src/components/icons/FaTag.jsx +9 -0
- package/src/components/icons/FaThumbsDown.jsx +9 -0
- package/src/components/icons/FaThumbsUp.jsx +9 -0
- package/src/components/icons/FaTrash.jsx +9 -0
- package/src/components/icons/FaUser.jsx +9 -0
- package/src/components/icons/FaUserCircle.jsx +9 -0
- package/src/components/icons/FacebookIcon.jsx +9 -0
- package/src/components/icons/HalfMoonIcon.jsx +18 -0
- package/src/components/icons/HeartIcon.jsx +9 -0
- package/src/components/icons/InstagramIcon.jsx +9 -0
- package/src/components/icons/LinkedInIcon.jsx +9 -0
- package/src/components/icons/MapMarkerIcon.jsx +9 -0
- package/src/components/icons/MdWbSunny.jsx +9 -0
- package/src/components/icons/ReFreshIcon.jsx +49 -0
- package/src/components/icons/SearchIcon.jsx +20 -0
- package/src/components/icons/StarIcon.jsx +9 -0
- package/src/components/icons/TelegramIcon.jsx +9 -0
- package/src/components/icons/TwitterIcon.jsx +9 -0
- package/src/components/icons/UserIcon.jsx +9 -0
- package/src/components/icons/WhatsappIcon.jsx +9 -0
- package/src/components/icons/YoutubeIcon.jsx +9 -0
- package/src/components/icons/index.js +60 -0
- package/src/components/layout/Footer.jsx +53 -0
- package/src/components/layout/Footer.stories.jsx +28 -0
- package/src/components/layout/Navbar.jsx +50 -0
- package/src/components/layout/Navbar.stories.jsx +42 -0
- package/src/components/layout/SubNavbar.jsx +36 -0
- package/src/components/modals/Modal.jsx +74 -0
- package/src/components/modals/Modal.stories.jsx +93 -0
- package/src/components/progressBar/ProgressBar.jsx +113 -0
- package/src/components/progressBar/ProgressBar.stories.jsx +67 -0
- package/src/context/ThemeContext.jsx +91 -0
- package/src/index.js +33 -0
- package/src/layouts/Layout.jsx +24 -0
- package/src/server/index.js +159 -0
- package/README.md +0 -36
- package/dist/EmailIcon-DumDw7u2.js +0 -781
- package/dist/EmailIcon-ssF1iAVu.js +0 -782
- package/dist/icons/index.js +0 -4
- package/dist/index.js +0 -555
package/dist/icons/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
export { B as BellIcon, C as ChevronDown, E as EmailIcon, F as FaAngleDown, a as FaAngleRight, b as FaArrowDown, c as FaArrowLeft, d as FaArrowUp, e as FaBell, f as FaBullhorn, g as FaCalendarAlt, h as FaCheck, i as FaCheckCircle, j as FaCheckDouble, k as FaChevronDown, l as FaChevronRight, m as FaCircle, n as FaComments, o as FaEye, p as FaEyeSlash, q as FaHome, r as FaKeyboard, s as FaLocationArrow, t as FaMapMarker, t as FaMapMarkerAlt, u as FaMoon, v as FaPaperPlane, w as FaPaperclip, x as FaSignInAlt, y as FaSmile, z as FaStar, z as FaStarButton, A as FaTag, D as FaThumbsDown, G as FaThumbsUp, H as FaTrash, I as FaUser, J as FaUserCircle, I as FaUserIcon, K as FacebookIcon, L as HalfMoonIcon, M as HeartIcon, N as InstagramIcon, O as LinkedInIcon, P as MapMarkerIcon, Q as MdWbSunny, R as RefreshIcon, S as SearchIcon, T as StarIcon, R as SyncIcon, U as TelegramIcon, V as TwitterIcon, W as UserIcon, X as WhatsappIcon, Y as YoutubeIcon } from '../EmailIcon-ssF1iAVu.js';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'react/jsx-runtime';
|
package/dist/index.js
DELETED
|
@@ -1,555 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useEffect, useSyncExternalStore, useState, useRef, useCallback, useContext, createContext } from 'react';
|
|
4
|
-
import { M as HeartIcon, d as FaArrowUp, b as FaArrowDown } from './EmailIcon-ssF1iAVu.js';
|
|
5
|
-
export { B as BellIcon, C as ChevronDown, E as EmailIcon, F as FaAngleDown, a as FaAngleRight, c as FaArrowLeft, e as FaBell, f as FaBullhorn, g as FaCalendarAlt, h as FaCheck, i as FaCheckCircle, j as FaCheckDouble, k as FaChevronDown, l as FaChevronRight, m as FaCircle, n as FaComments, o as FaEye, p as FaEyeSlash, q as FaHome, r as FaKeyboard, s as FaLocationArrow, t as FaMapMarker, t as FaMapMarkerAlt, u as FaMoon, v as FaPaperPlane, w as FaPaperclip, x as FaSignInAlt, y as FaSmile, z as FaStar, z as FaStarButton, A as FaTag, D as FaThumbsDown, G as FaThumbsUp, H as FaTrash, I as FaUser, J as FaUserCircle, I as FaUserIcon, K as FacebookIcon, L as HalfMoonIcon, N as InstagramIcon, O as LinkedInIcon, P as MapMarkerIcon, Q as MdWbSunny, R as RefreshIcon, S as SearchIcon, T as StarIcon, R as SyncIcon, U as TelegramIcon, V as TwitterIcon, W as UserIcon, X as WhatsappIcon, Y as YoutubeIcon } from './EmailIcon-ssF1iAVu.js';
|
|
6
|
-
import { createPortal } from 'react-dom';
|
|
7
|
-
|
|
8
|
-
function styleInject(css, ref) {
|
|
9
|
-
if ( ref === void 0 ) ref = {};
|
|
10
|
-
var insertAt = ref.insertAt;
|
|
11
|
-
|
|
12
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
13
|
-
|
|
14
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
15
|
-
var style = document.createElement('style');
|
|
16
|
-
style.type = 'text/css';
|
|
17
|
-
|
|
18
|
-
if (insertAt === 'top') {
|
|
19
|
-
if (head.firstChild) {
|
|
20
|
-
head.insertBefore(style, head.firstChild);
|
|
21
|
-
} else {
|
|
22
|
-
head.appendChild(style);
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
head.appendChild(style);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (style.styleSheet) {
|
|
29
|
-
style.styleSheet.cssText = css;
|
|
30
|
-
} else {
|
|
31
|
-
style.appendChild(document.createTextNode(css));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var css_248z$9 = ".Navbar-module_navbar__2NTiG{align-items:center;background-color:var(--card-bg);border-bottom:1px solid var(--border-color);border-top:1px solid var(--border-color);box-shadow:0 2px 4px rgba(0,0,0,.1);column-gap:clamp(4px,1vw,12px);display:grid;grid-template-columns:auto 1fr auto;left:0;min-height:clamp(40px,10vw,60px);overflow:visible;padding:clamp(4px,1vw,10px) clamp(6px,2vw,18px);position:fixed;right:0;top:0;transition:background-color .3s ease;width:100%;z-index:1000}.Navbar-module_navSectionLeft__zH0WR{align-items:center;color:inherit;cursor:pointer;display:flex;height:100%;justify-content:flex-start;min-width:clamp(48px,16vw,88px);text-decoration:none;user-select:none}.Navbar-module_navSectionCenter__j0wpK{align-items:center;display:flex;height:100%;justify-content:center;min-width:0;width:100%}.Navbar-module_menu__QQfPq{align-items:center;display:flex;flex-wrap:nowrap;gap:clamp(4px,1.2vw,12px);justify-content:center;list-style:none;margin:0;padding:0;width:100%}.Navbar-module_navSectionRight__A4Egv{align-items:center;display:flex;height:100%;justify-content:flex-end;min-width:clamp(48px,16vw,88px);overflow:visible}";
|
|
36
|
-
var styles$9 = {"navbar":"Navbar-module_navbar__2NTiG","navSectionLeft":"Navbar-module_navSectionLeft__zH0WR","navSectionCenter":"Navbar-module_navSectionCenter__j0wpK","menu":"Navbar-module_menu__QQfPq","navSectionRight":"Navbar-module_navSectionRight__A4Egv"};
|
|
37
|
-
styleInject(css_248z$9);
|
|
38
|
-
|
|
39
|
-
// src/components/layout/Navbar.jsx
|
|
40
|
-
const Navbar = ({
|
|
41
|
-
leftSlot,
|
|
42
|
-
centerSlot,
|
|
43
|
-
rightSlot,
|
|
44
|
-
className = "",
|
|
45
|
-
ariaLabel = "Main navigation"
|
|
46
|
-
}) => {
|
|
47
|
-
return /*#__PURE__*/jsxs("nav", {
|
|
48
|
-
className: `${styles$9.navbar} ${className}`.trim(),
|
|
49
|
-
"aria-label": ariaLabel,
|
|
50
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
51
|
-
className: styles$9.navSectionLeft,
|
|
52
|
-
children: leftSlot
|
|
53
|
-
}), /*#__PURE__*/jsx("div", {
|
|
54
|
-
className: styles$9.navSectionCenter,
|
|
55
|
-
children: centerSlot && /*#__PURE__*/jsx("ul", {
|
|
56
|
-
className: styles$9.menu,
|
|
57
|
-
children: centerSlot
|
|
58
|
-
})
|
|
59
|
-
}), /*#__PURE__*/jsx("div", {
|
|
60
|
-
className: styles$9.navSectionRight,
|
|
61
|
-
children: rightSlot
|
|
62
|
-
})]
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var css_248z$8 = ".SubNavbar-module_subNavbar__1hd8N{align-items:center;background-color:var(--card-bg);border-bottom:.5px solid var(--border-color);box-shadow:0 2px 4px rgba(0,0,0,.1);display:flex;justify-content:center;left:0;min-height:clamp(48px,10vw,60px);overflow:visible;padding:clamp(6px,1.5vw,10px) clamp(6px,2vw,18px);position:fixed;right:0;top:clamp(48px,10vw,60px);transition:background-color .3s ease;width:100%;z-index:999}.SubNavbar-module_menu__ejJKq{align-items:center;display:flex;flex-wrap:nowrap;gap:clamp(4px,1.5vw,16px);justify-content:space-evenly;list-style:none;margin:0;max-width:500px;padding:0 clamp(4px,1vw,12px);width:100%}";
|
|
67
|
-
var styles$8 = {"subNavbar":"SubNavbar-module_subNavbar__1hd8N","menu":"SubNavbar-module_menu__ejJKq"};
|
|
68
|
-
styleInject(css_248z$8);
|
|
69
|
-
|
|
70
|
-
// src/components/layout/SubNavbar.jsx
|
|
71
|
-
const SubNavbar = ({
|
|
72
|
-
children,
|
|
73
|
-
afterContent,
|
|
74
|
-
className = "",
|
|
75
|
-
ariaLabel = "Secondary navigation"
|
|
76
|
-
}) => {
|
|
77
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
78
|
-
children: [/*#__PURE__*/jsx("nav", {
|
|
79
|
-
className: `${styles$8.subNavbar} ${className}`.trim(),
|
|
80
|
-
"aria-label": ariaLabel,
|
|
81
|
-
children: /*#__PURE__*/jsx("ul", {
|
|
82
|
-
className: styles$8.menu,
|
|
83
|
-
children: children
|
|
84
|
-
})
|
|
85
|
-
}), afterContent]
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
var css_248z$7 = ".Footer-module_footer__1gTBc{background-color:var(--card-bg);border-bottom:clamp(.5px,.2vw,1px) solid var(--border-color);border-top:clamp(.5px,.2vw,1px) solid var(--border-color);box-shadow:0 -1px 0 0 var(--border-color) inset;display:flex;justify-content:center;min-height:clamp(24px,6vw,36px);padding:clamp(2px,.5vw,4px) clamp(5px,1.5vw,10px);position:relative;text-align:center;transition:background-color .3s ease,color .3s ease;width:100%;z-index:900}.Footer-module_footerContent__sC89p{align-items:center;display:flex;flex-direction:column;gap:clamp(1px,.2vw,2px);max-width:clamp(300px,90vw,400px);width:100%}.Footer-module_topLine__NNJXQ{align-items:center;display:flex;justify-content:center;width:100%}.Footer-module_socialIconsContainer__kNCBG{align-items:center;display:flex;flex:0 0 auto;justify-content:center;padding:clamp(2px,1vw,4px) clamp(4px,1.5vw,6px)}.Footer-module_socialIcons__O-HxQ{align-items:center;display:flex;gap:clamp(8px,2vw,16px);justify-content:center}.Footer-module_legalLinks__fJAsq{align-items:center;display:flex;flex-wrap:nowrap;gap:clamp(4px,1.5vw,8px);justify-content:center;width:100%}.Footer-module_dunsContainer__-mj-b{align-items:center;display:flex;justify-content:center;margin-top:clamp(2px,.5vw,4px);width:100%}";
|
|
90
|
-
var styles$7 = {"footer":"Footer-module_footer__1gTBc","footerContent":"Footer-module_footerContent__sC89p","topLine":"Footer-module_topLine__NNJXQ","socialIconsContainer":"Footer-module_socialIconsContainer__kNCBG","socialIcons":"Footer-module_socialIcons__O-HxQ","legalLinks":"Footer-module_legalLinks__fJAsq","dunsContainer":"Footer-module_dunsContainer__-mj-b"};
|
|
91
|
-
styleInject(css_248z$7);
|
|
92
|
-
|
|
93
|
-
// src/components/layout/Footer.jsx
|
|
94
|
-
const Footer = ({
|
|
95
|
-
socialSlot,
|
|
96
|
-
legalSlot,
|
|
97
|
-
trustSlot,
|
|
98
|
-
className = ""
|
|
99
|
-
}) => {
|
|
100
|
-
return /*#__PURE__*/jsx("footer", {
|
|
101
|
-
className: `${styles$7.footer} ${className}`.trim(),
|
|
102
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
103
|
-
className: styles$7.footerContent,
|
|
104
|
-
children: [socialSlot && /*#__PURE__*/jsx("div", {
|
|
105
|
-
className: styles$7.topLine,
|
|
106
|
-
children: /*#__PURE__*/jsx("div", {
|
|
107
|
-
className: styles$7.socialIconsContainer,
|
|
108
|
-
children: /*#__PURE__*/jsx("div", {
|
|
109
|
-
className: styles$7.socialIcons,
|
|
110
|
-
children: socialSlot
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
}), legalSlot && /*#__PURE__*/jsx("div", {
|
|
114
|
-
className: styles$7.legalLinks,
|
|
115
|
-
children: legalSlot
|
|
116
|
-
}), trustSlot && /*#__PURE__*/jsx("div", {
|
|
117
|
-
className: styles$7.dunsContainer,
|
|
118
|
-
children: trustSlot
|
|
119
|
-
})]
|
|
120
|
-
})
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
var css_248z$6 = ".Button-module_button__uvxtU{align-items:center;background-color:var(--button-bg,var(--btn-primary-bg));border:1px solid var(--button-border,transparent);border-radius:var(--radius-md);color:var(--button-text,var(--btn-primary-text));cursor:pointer;display:inline-flex;flex-shrink:0;font-family:var(--font-sans);font-size:clamp(.8rem,2.5vw,.9rem);font-weight:500;gap:clamp(4px,.5vw,6px);justify-content:center;line-height:1.2;min-height:clamp(32px,8vw,40px);overflow:hidden;padding:clamp(6px,1.2vw,10px) clamp(12px,2.5vw,20px);position:relative;text-decoration:none;transition:background-color .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease;user-select:none;white-space:nowrap}.Button-module_button__uvxtU:hover{background-color:var(--button-hover-bg,var(--btn-primary-hover-bg));box-shadow:0 2px 8px var(--shadow-color);color:var(--button-hover-text,var(--btn-primary-hover-text))}.Button-module_button__uvxtU:active{box-shadow:none}.Button-module_button__uvxtU:focus-visible{outline:2px solid var(--focus-border-color);outline-offset:2px}.Button-module_button__uvxtU:disabled{box-shadow:none;cursor:not-allowed;opacity:.55;pointer-events:none}.Button-module_primary__xPba2{--button-bg:var(--btn-primary-bg);--button-text:var(--btn-primary-text);--button-hover-bg:var(--btn-primary-hover-bg);--button-hover-text:var(--btn-primary-hover-text)}.Button-module_secondary__hn72M{--button-bg:var(--btn-secondary-bg);--button-text:var(--btn-secondary-text);--button-hover-bg:var(--btn-secondary-hover-bg);--button-hover-text:var(--btn-secondary-hover-text)}.Button-module_danger__6UD-N{--button-bg:var(--btn-danger-bg);--button-text:var(--btn-danger-text);--button-hover-bg:var(--btn-danger-hover-bg);--button-hover-text:var(--btn-danger-hover-text)}.Button-module_success__B0AQp{--button-bg:var(--btn-success-bg);--button-text:var(--btn-success-text);--button-hover-bg:var(--btn-success-hover-bg);--button-hover-text:var(--btn-success-hover-text)}.Button-module_outline__zE2nr{--button-bg:transparent;--button-hover-bg:var(--hover-color);--button-text:var(--text-color);--button-hover-text:var(--text-color);--button-border:var(--border-color-light)}.Button-module_ghost__Lw5bx{--button-bg:transparent;--button-hover-bg:var(--hover-color);--button-text:var(--text-color);--button-hover-text:var(--text-color);--button-border:transparent;box-shadow:none}.Button-module_ghost__Lw5bx:hover{box-shadow:none}.Button-module_sm__hHCp3{border-radius:var(--radius-sm);font-size:var(--text-xs);min-height:clamp(24px,6vw,32px);padding:clamp(3px,.8vw,5px) clamp(8px,2vw,12px)}.Button-module_lg__8-o98{border-radius:var(--radius-lg);font-size:var(--text-base);min-height:clamp(40px,10vw,56px);padding:clamp(10px,2vw,14px) clamp(20px,5vw,32px)}.Button-module_full__GaUHE{width:100%}.Button-module_icon__bd--q{align-items:center;color:inherit;display:flex;flex-shrink:0}.Button-module_text__NGnws{color:inherit}.Button-module_badge__64QnL{align-items:center;background-color:var(--error-color);border-radius:var(--radius-full);color:var(--btn-primary-text);display:inline-flex;font-size:.65rem;font-weight:700;height:18px;justify-content:center;margin-left:clamp(2px,.5vw,4px);min-width:18px;padding:0 clamp(2px,.5vw,4px)}";
|
|
125
|
-
var styles$6 = {"button":"Button-module_button__uvxtU","primary":"Button-module_primary__xPba2","secondary":"Button-module_secondary__hn72M","danger":"Button-module_danger__6UD-N","success":"Button-module_success__B0AQp","outline":"Button-module_outline__zE2nr","ghost":"Button-module_ghost__Lw5bx","sm":"Button-module_sm__hHCp3","lg":"Button-module_lg__8-o98","full":"Button-module_full__GaUHE","icon":"Button-module_icon__bd--q","text":"Button-module_text__NGnws","badge":"Button-module_badge__64QnL"};
|
|
126
|
-
styleInject(css_248z$6);
|
|
127
|
-
|
|
128
|
-
// src/components/buttons/Button.jsx
|
|
129
|
-
const Button = ({
|
|
130
|
-
children,
|
|
131
|
-
text,
|
|
132
|
-
icon,
|
|
133
|
-
badge,
|
|
134
|
-
badgeClassName,
|
|
135
|
-
intent = "primary",
|
|
136
|
-
appearance = "solid",
|
|
137
|
-
size = "md",
|
|
138
|
-
fullWidth = false,
|
|
139
|
-
href,
|
|
140
|
-
type = "button",
|
|
141
|
-
disabled = false,
|
|
142
|
-
className,
|
|
143
|
-
style,
|
|
144
|
-
onClick,
|
|
145
|
-
...props
|
|
146
|
-
}) => {
|
|
147
|
-
const label = children ?? text;
|
|
148
|
-
const intentClass = styles$6[intent] ?? styles$6.primary;
|
|
149
|
-
const appearanceClass = appearance === "outline" ? styles$6.outline : appearance === "ghost" ? styles$6.ghost : "";
|
|
150
|
-
const sizeClass = size === "sm" ? styles$6.sm : size === "lg" ? styles$6.lg : "";
|
|
151
|
-
const cls = [styles$6.button, intentClass, appearanceClass, sizeClass, fullWidth ? styles$6.full : "", className ?? ""].filter(Boolean).join(" ");
|
|
152
|
-
const content = /*#__PURE__*/jsxs(Fragment, {
|
|
153
|
-
children: [icon && /*#__PURE__*/jsx("span", {
|
|
154
|
-
className: styles$6.icon,
|
|
155
|
-
"aria-hidden": "true",
|
|
156
|
-
children: icon
|
|
157
|
-
}), label && /*#__PURE__*/jsx("span", {
|
|
158
|
-
className: styles$6.text,
|
|
159
|
-
children: label
|
|
160
|
-
}), badge != null && /*#__PURE__*/jsx("span", {
|
|
161
|
-
className: `${styles$6.badge} ${badgeClassName ?? ""}`.trim(),
|
|
162
|
-
children: badge
|
|
163
|
-
})]
|
|
164
|
-
});
|
|
165
|
-
if (href) {
|
|
166
|
-
return /*#__PURE__*/jsx("a", {
|
|
167
|
-
href: href,
|
|
168
|
-
className: cls,
|
|
169
|
-
style: style,
|
|
170
|
-
...props,
|
|
171
|
-
children: content
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return /*#__PURE__*/jsx("button", {
|
|
175
|
-
type: type,
|
|
176
|
-
className: cls,
|
|
177
|
-
style: style,
|
|
178
|
-
disabled: disabled,
|
|
179
|
-
onClick: onClick,
|
|
180
|
-
...props,
|
|
181
|
-
children: content
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
var css_248z$5 = ".FavoriteHeartButton-module_favoriteHeartButton__ml-Uu{align-items:center;background-color:transparent!important;border:none!important;cursor:pointer;display:flex;gap:0!important;height:clamp(32px,8vw,48px)!important;justify-content:center;max-width:clamp(32px,8vw,48px)!important;min-width:clamp(32px,8vw,48px)!important;padding:clamp(4px,1.5vw,8px)!important;transition:opacity .2s ease}.FavoriteHeartButton-module_favorited__01bVq{color:var(--danger-color,#dc3545)!important}.FavoriteHeartButton-module_notFavorited__gU-Ng{color:var(--secondary-text-color)!important}.FavoriteHeartButton-module_favoriteHeartButton__ml-Uu:disabled{cursor:not-allowed;opacity:.6}.FavoriteHeartButton-module_favoriteHeartButton__ml-Uu:hover:not(:disabled){background-color:transparent!important;border:none!important;opacity:.75}";
|
|
186
|
-
var styles$5 = {"favoriteHeartButton":"FavoriteHeartButton-module_favoriteHeartButton__ml-Uu","favorited":"FavoriteHeartButton-module_favorited__01bVq","notFavorited":"FavoriteHeartButton-module_notFavorited__gU-Ng"};
|
|
187
|
-
styleInject(css_248z$5);
|
|
188
|
-
|
|
189
|
-
// src/components/buttons/FavoriteHeartButton.jsx
|
|
190
|
-
const FavoriteHeartButton = ({
|
|
191
|
-
isFavorited,
|
|
192
|
-
onClick,
|
|
193
|
-
disabled,
|
|
194
|
-
isOwner = false,
|
|
195
|
-
className = "",
|
|
196
|
-
style
|
|
197
|
-
}) => {
|
|
198
|
-
if (isOwner) return null;
|
|
199
|
-
return /*#__PURE__*/jsx(Button, {
|
|
200
|
-
onClick: onClick,
|
|
201
|
-
disabled: disabled,
|
|
202
|
-
className: `${styles$5.favoriteHeartButton} ${isFavorited ? styles$5.favorited : styles$5.notFavorited} ${className}`,
|
|
203
|
-
style: style,
|
|
204
|
-
"aria-label": isFavorited ? "Unfavorite" : "Favorite",
|
|
205
|
-
title: isFavorited ? "Unfavorite" : "Favorite",
|
|
206
|
-
icon: /*#__PURE__*/jsx(HeartIcon, {
|
|
207
|
-
style: {
|
|
208
|
-
width: 20,
|
|
209
|
-
height: 20
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// src/components/buttons/ScrollButton.jsx
|
|
216
|
-
const ScrollButton = ({
|
|
217
|
-
direction = "up",
|
|
218
|
-
onClick,
|
|
219
|
-
className = "",
|
|
220
|
-
style = {}
|
|
221
|
-
}) => {
|
|
222
|
-
const icon = direction === "up" ? /*#__PURE__*/jsx(FaArrowUp, {}) : /*#__PURE__*/jsx(FaArrowDown, {});
|
|
223
|
-
const label = direction === "up" ? "Scroll to top" : "Scroll to bottom";
|
|
224
|
-
return /*#__PURE__*/jsx(Button, {
|
|
225
|
-
icon: icon,
|
|
226
|
-
onClick: onClick,
|
|
227
|
-
className: className,
|
|
228
|
-
appearance: "ghost",
|
|
229
|
-
"aria-label": label,
|
|
230
|
-
title: label,
|
|
231
|
-
style: {
|
|
232
|
-
display: "flex",
|
|
233
|
-
...style
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
var css_248z$4 = ".ThreeDotButton-module_threeDotButton__yBrhU{gap:0!important;height:44px!important;max-width:44px!important;min-width:44px!important;padding:6px!important;width:44px!important}.ThreeDotButton-module_threeDotButton__yBrhU,.ThreeDotButton-module_threeDotButton__yBrhU:active,.ThreeDotButton-module_threeDotButton__yBrhU:hover{background:transparent!important;background-color:transparent!important;border:none!important}.ThreeDotButton-module_threeDotButton__yBrhU:focus-visible{border-radius:var(--radius-sm,4px);outline:2px solid var(--accent-color,#007bff)}.ThreeDotButton-module_dotsWrapper__mDkka{align-items:center;display:inline-flex;flex-direction:column;gap:3px;justify-content:center}.ThreeDotButton-module_dot__pzOIM{background:currentColor;border-radius:50%;display:inline-block;height:4px;width:4px}";
|
|
239
|
-
var styles$4 = {"threeDotButton":"ThreeDotButton-module_threeDotButton__yBrhU","dotsWrapper":"ThreeDotButton-module_dotsWrapper__mDkka","dot":"ThreeDotButton-module_dot__pzOIM"};
|
|
240
|
-
styleInject(css_248z$4);
|
|
241
|
-
|
|
242
|
-
// src/components/buttons/ThreeDotButton.jsx
|
|
243
|
-
const ThreeDotButton = ({
|
|
244
|
-
className = "",
|
|
245
|
-
ariaLabel = "More options",
|
|
246
|
-
onClick
|
|
247
|
-
}) => {
|
|
248
|
-
return /*#__PURE__*/jsx(Button, {
|
|
249
|
-
className: `${styles$4.threeDotButton} ${className}`,
|
|
250
|
-
onClick: onClick,
|
|
251
|
-
"aria-label": ariaLabel,
|
|
252
|
-
title: ariaLabel,
|
|
253
|
-
icon: /*#__PURE__*/jsxs("span", {
|
|
254
|
-
className: styles$4.dotsWrapper,
|
|
255
|
-
"aria-hidden": "true",
|
|
256
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
257
|
-
className: styles$4.dot
|
|
258
|
-
}), /*#__PURE__*/jsx("span", {
|
|
259
|
-
className: styles$4.dot
|
|
260
|
-
}), /*#__PURE__*/jsx("span", {
|
|
261
|
-
className: styles$4.dot
|
|
262
|
-
})]
|
|
263
|
-
})
|
|
264
|
-
});
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
var css_248z$3 = ".Container-module_container__d-oB8{margin-left:auto;margin-right:auto;max-width:var(--container-max-width,1280px);padding-left:var(--section-padding-x);padding-right:var(--section-padding-x);width:100%}.Container-module_narrow__mC8nM{max-width:768px}.Container-module_wide__kBARu{max-width:1536px}.Container-module_full__fv2YK{max-width:none}";
|
|
268
|
-
var styles$3 = {"container":"Container-module_container__d-oB8","narrow":"Container-module_narrow__mC8nM","wide":"Container-module_wide__kBARu","full":"Container-module_full__fv2YK"};
|
|
269
|
-
styleInject(css_248z$3);
|
|
270
|
-
|
|
271
|
-
// src/components/common/Container.jsx
|
|
272
|
-
const Container = ({
|
|
273
|
-
children,
|
|
274
|
-
size = "default",
|
|
275
|
-
className,
|
|
276
|
-
style,
|
|
277
|
-
as: Tag = "div",
|
|
278
|
-
...props
|
|
279
|
-
}) => {
|
|
280
|
-
const sizeClass = size === "narrow" ? styles$3.narrow : size === "wide" ? styles$3.wide : size === "full" ? styles$3.full : "";
|
|
281
|
-
const cls = [styles$3.container, sizeClass, className ?? ""].filter(Boolean).join(" ");
|
|
282
|
-
return /*#__PURE__*/jsx(Tag, {
|
|
283
|
-
className: cls,
|
|
284
|
-
style: style,
|
|
285
|
-
...props,
|
|
286
|
-
children: children
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
var css_248z$2 = ".Section-module_section__fir88{background-color:var(--bg-color);padding-bottom:var(--section-padding-y);padding-top:var(--section-padding-y);width:100%}.Section-module_alternate__Y1rWg{background-color:var(--section-bg)}.Section-module_card__p-Uae{background-color:var(--card-bg);border:1px solid var(--border-color-light);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm)}.Section-module_tight__MBRrm{padding-bottom:calc(var(--section-padding-y)*.5);padding-top:calc(var(--section-padding-y)*.5)}.Section-module_flush__kPYbL{padding-bottom:0;padding-top:0}.Section-module_header__4Xl-D{margin-bottom:var(--space-8);text-align:center}.Section-module_title__XCRy8{color:var(--heading-color);font-size:clamp(var(--text-xl),4vw,var(--text-3xl));font-weight:700;line-height:1.2;margin-bottom:var(--space-3)}.Section-module_subtitle__qJc4y{color:var(--secondary-text-color);font-size:clamp(var(--text-sm),2vw,var(--text-base));margin-left:auto;margin-right:auto;max-width:640px}";
|
|
291
|
-
var styles$2 = {"section":"Section-module_section__fir88","alternate":"Section-module_alternate__Y1rWg","card":"Section-module_card__p-Uae","tight":"Section-module_tight__MBRrm","flush":"Section-module_flush__kPYbL","header":"Section-module_header__4Xl-D","title":"Section-module_title__XCRy8","subtitle":"Section-module_subtitle__qJc4y"};
|
|
292
|
-
styleInject(css_248z$2);
|
|
293
|
-
|
|
294
|
-
// src/components/common/Section.jsx
|
|
295
|
-
const Section = ({
|
|
296
|
-
children,
|
|
297
|
-
variant = "default",
|
|
298
|
-
padding = "default",
|
|
299
|
-
title,
|
|
300
|
-
subtitle,
|
|
301
|
-
containerSize = "default",
|
|
302
|
-
className,
|
|
303
|
-
style,
|
|
304
|
-
as: Tag = "section",
|
|
305
|
-
...props
|
|
306
|
-
}) => {
|
|
307
|
-
const variantClass = variant === "alternate" ? styles$2.alternate : variant === "card" ? styles$2.card : "";
|
|
308
|
-
const paddingClass = padding === "tight" ? styles$2.tight : padding === "flush" ? styles$2.flush : "";
|
|
309
|
-
const cls = [styles$2.section, variantClass, paddingClass, className ?? ""].filter(Boolean).join(" ");
|
|
310
|
-
return /*#__PURE__*/jsx(Tag, {
|
|
311
|
-
className: cls,
|
|
312
|
-
style: style,
|
|
313
|
-
...props,
|
|
314
|
-
children: /*#__PURE__*/jsxs(Container, {
|
|
315
|
-
size: containerSize,
|
|
316
|
-
children: [(title || subtitle) && /*#__PURE__*/jsxs("div", {
|
|
317
|
-
className: styles$2.header,
|
|
318
|
-
children: [title && /*#__PURE__*/jsx("h2", {
|
|
319
|
-
className: styles$2.title,
|
|
320
|
-
children: title
|
|
321
|
-
}), subtitle && /*#__PURE__*/jsx("p", {
|
|
322
|
-
className: styles$2.subtitle,
|
|
323
|
-
children: subtitle
|
|
324
|
-
})]
|
|
325
|
-
}), children]
|
|
326
|
-
})
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
var css_248z$1 = ".Modal-module_modalOverlay__ZH3r4{align-items:center;animation:Modal-module_fadeIn__qc5Zc .25s ease;background-color:rgba(0,0,0,.7);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:10000}.Modal-module_modalContent__qNq5W{animation:Modal-module_slideIn__1Jc8w .25s ease;background-color:var(--card-bg);border:1px solid var(--border-color-light);border-radius:var(--radius-md,8px);box-shadow:0 4px 20px var(--shadow-color,rgba(0,0,0,.2));max-height:90vh;overflow-y:auto;padding:clamp(16px,4vw,24px);position:relative;transition:background-color .3s ease;width:clamp(300px,90vw,480px)}@keyframes Modal-module_fadeIn__qc5Zc{0%{opacity:0}to{opacity:1}}@keyframes Modal-module_slideIn__1Jc8w{0%{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:translateY(0)}}";
|
|
331
|
-
var styles$1 = {"modalOverlay":"Modal-module_modalOverlay__ZH3r4","modalContent":"Modal-module_modalContent__qNq5W"};
|
|
332
|
-
styleInject(css_248z$1);
|
|
333
|
-
|
|
334
|
-
const emptySubscribe = () => () => {};
|
|
335
|
-
const useIsMounted = () => useSyncExternalStore(emptySubscribe, () => true, () => false);
|
|
336
|
-
const Modal = ({
|
|
337
|
-
isOpen,
|
|
338
|
-
onClose,
|
|
339
|
-
children,
|
|
340
|
-
className
|
|
341
|
-
}) => {
|
|
342
|
-
const mounted = useIsMounted();
|
|
343
|
-
|
|
344
|
-
// Lock body scroll when modal is open
|
|
345
|
-
useEffect(() => {
|
|
346
|
-
if (isOpen) {
|
|
347
|
-
document.body.style.overflow = "hidden";
|
|
348
|
-
document.body.style.position = "fixed";
|
|
349
|
-
document.body.style.width = "100%";
|
|
350
|
-
} else {
|
|
351
|
-
document.body.style.overflow = "";
|
|
352
|
-
document.body.style.position = "";
|
|
353
|
-
document.body.style.width = "";
|
|
354
|
-
}
|
|
355
|
-
return () => {
|
|
356
|
-
document.body.style.overflow = "";
|
|
357
|
-
document.body.style.position = "";
|
|
358
|
-
document.body.style.width = "";
|
|
359
|
-
};
|
|
360
|
-
}, [isOpen]);
|
|
361
|
-
|
|
362
|
-
// ESC key closes modal
|
|
363
|
-
useEffect(() => {
|
|
364
|
-
const handleEsc = e => {
|
|
365
|
-
if (e.key === "Escape" && isOpen) onClose();
|
|
366
|
-
};
|
|
367
|
-
if (isOpen) document.addEventListener("keydown", handleEsc);
|
|
368
|
-
return () => document.removeEventListener("keydown", handleEsc);
|
|
369
|
-
}, [isOpen, onClose]);
|
|
370
|
-
if (!isOpen || !mounted) return null;
|
|
371
|
-
const handleBackdropClick = e => {
|
|
372
|
-
if (e.target === e.currentTarget) onClose();
|
|
373
|
-
};
|
|
374
|
-
return /*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
|
|
375
|
-
className: styles$1.modalOverlay,
|
|
376
|
-
onClick: handleBackdropClick,
|
|
377
|
-
role: "dialog",
|
|
378
|
-
"aria-modal": "true",
|
|
379
|
-
children: /*#__PURE__*/jsx("div", {
|
|
380
|
-
className: `${styles$1.modalContent} ${className ?? ""}`,
|
|
381
|
-
children: children
|
|
382
|
-
})
|
|
383
|
-
}), document.body);
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
var css_248z = ".ProgressBar-module_wrapper__Sbkwa{display:flex;flex-direction:column;gap:4px;width:100%}.ProgressBar-module_track__-FjJA{background-color:var(--progress-bg,rgba(0,0,0,.1));border-radius:var(--radius-full,9999px);overflow:hidden;width:100%}.ProgressBar-module_bar__zrEy7{background:var(--primary-color,#007bff);border-radius:var(--radius-full,9999px);height:100%;transition:width 0ms}.ProgressBar-module_label__RpKiv{color:var(--secondary-text-color);font-size:var(--text-xs,11px);text-align:right}";
|
|
387
|
-
var styles = {"wrapper":"ProgressBar-module_wrapper__Sbkwa","track":"ProgressBar-module_track__-FjJA","bar":"ProgressBar-module_bar__zrEy7","label":"ProgressBar-module_label__RpKiv"};
|
|
388
|
-
styleInject(css_248z);
|
|
389
|
-
|
|
390
|
-
const ProgressBar = ({
|
|
391
|
-
progress = 0,
|
|
392
|
-
height = 6,
|
|
393
|
-
color = "var(--primary-color, #007bff)",
|
|
394
|
-
backgroundColor = "var(--progress-bg, rgba(0, 0, 0, 0.1))",
|
|
395
|
-
animate = true,
|
|
396
|
-
speed = 300,
|
|
397
|
-
showLabel = false,
|
|
398
|
-
labelPosition = "top",
|
|
399
|
-
onComplete = null,
|
|
400
|
-
className = "",
|
|
401
|
-
style = {}
|
|
402
|
-
}) => {
|
|
403
|
-
const [animatedProgress, setAnimatedProgress] = useState(0);
|
|
404
|
-
const rafIdRef = useRef(null);
|
|
405
|
-
const startRef = useRef(0);
|
|
406
|
-
const endRef = useRef(progress);
|
|
407
|
-
const startTimeRef = useRef(null);
|
|
408
|
-
const completedRef = useRef(false);
|
|
409
|
-
const easeOutCubic = t => 1 - Math.pow(1 - t, 3);
|
|
410
|
-
useEffect(() => {
|
|
411
|
-
if (!animate) return;
|
|
412
|
-
startRef.current = animatedProgress;
|
|
413
|
-
}, [animatedProgress, animate]);
|
|
414
|
-
useEffect(() => {
|
|
415
|
-
if (!animate) return; // non-animated: use progress directly via clampedProgress below
|
|
416
|
-
if (rafIdRef.current) cancelAnimationFrame(rafIdRef.current);
|
|
417
|
-
endRef.current = progress;
|
|
418
|
-
startTimeRef.current = null;
|
|
419
|
-
if (startRef.current === endRef.current) return;
|
|
420
|
-
const delta = Math.abs(endRef.current - startRef.current);
|
|
421
|
-
const duration = Math.max(speed, Math.min(1500, 20 * delta));
|
|
422
|
-
const step = ts => {
|
|
423
|
-
if (startTimeRef.current === null) startTimeRef.current = ts;
|
|
424
|
-
const elapsed = ts - startTimeRef.current;
|
|
425
|
-
const t = Math.max(0, Math.min(1, elapsed / duration));
|
|
426
|
-
const eased = easeOutCubic(t);
|
|
427
|
-
const next = startRef.current + (endRef.current - startRef.current) * eased;
|
|
428
|
-
setAnimatedProgress(next);
|
|
429
|
-
if (t < 1) {
|
|
430
|
-
rafIdRef.current = requestAnimationFrame(step);
|
|
431
|
-
} else {
|
|
432
|
-
setAnimatedProgress(endRef.current);
|
|
433
|
-
if (endRef.current >= 100 && onComplete && !completedRef.current) {
|
|
434
|
-
completedRef.current = true;
|
|
435
|
-
onComplete();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
rafIdRef.current = requestAnimationFrame(step);
|
|
440
|
-
return () => {
|
|
441
|
-
if (rafIdRef.current) cancelAnimationFrame(rafIdRef.current);
|
|
442
|
-
};
|
|
443
|
-
}, [progress, animate, speed, onComplete]);
|
|
444
|
-
|
|
445
|
-
// When not animated, use progress directly; when animated, use animatedProgress
|
|
446
|
-
const clampedProgress = Math.max(0, Math.min(100, animate ? animatedProgress : progress));
|
|
447
|
-
const label = `${Math.round(clampedProgress)}%`;
|
|
448
|
-
return /*#__PURE__*/jsxs("div", {
|
|
449
|
-
className: `${styles.wrapper} ${className}`,
|
|
450
|
-
style: style,
|
|
451
|
-
role: "progressbar",
|
|
452
|
-
"aria-valuenow": Math.round(clampedProgress),
|
|
453
|
-
"aria-valuemin": 0,
|
|
454
|
-
"aria-valuemax": 100,
|
|
455
|
-
children: [showLabel && labelPosition === "top" && /*#__PURE__*/jsx("span", {
|
|
456
|
-
className: styles.label,
|
|
457
|
-
children: label
|
|
458
|
-
}), /*#__PURE__*/jsx("div", {
|
|
459
|
-
className: styles.track,
|
|
460
|
-
style: {
|
|
461
|
-
height,
|
|
462
|
-
backgroundColor
|
|
463
|
-
},
|
|
464
|
-
children: /*#__PURE__*/jsx("div", {
|
|
465
|
-
className: styles.bar,
|
|
466
|
-
style: {
|
|
467
|
-
width: `${clampedProgress}%`,
|
|
468
|
-
background: color
|
|
469
|
-
}
|
|
470
|
-
})
|
|
471
|
-
}), showLabel && labelPosition === "bottom" && /*#__PURE__*/jsx("span", {
|
|
472
|
-
className: styles.label,
|
|
473
|
-
children: label
|
|
474
|
-
})]
|
|
475
|
-
});
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
const ThemeContext = /*#__PURE__*/createContext();
|
|
479
|
-
const ThemeProvider = ({
|
|
480
|
-
children
|
|
481
|
-
}) => {
|
|
482
|
-
const [mounted, setMounted] = useState(false);
|
|
483
|
-
const [theme, setTheme] = useState("light"); // SSR fallback
|
|
484
|
-
|
|
485
|
-
// Step 1: On mount, load theme from localStorage. Default = dark.
|
|
486
|
-
useEffect(() => {
|
|
487
|
-
try {
|
|
488
|
-
const saved = localStorage.getItem("theme");
|
|
489
|
-
const resolved = saved ?? "dark"; // First visit = dark
|
|
490
|
-
setTheme(resolved);
|
|
491
|
-
document.documentElement.setAttribute("data-theme", resolved);
|
|
492
|
-
|
|
493
|
-
// Listen for OS-level theme changes only if user has not set a preference
|
|
494
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
495
|
-
const onSystemChange = e => {
|
|
496
|
-
if (!localStorage.getItem("theme")) {
|
|
497
|
-
const sys = e.matches ? "dark" : "light";
|
|
498
|
-
setTheme(sys);
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
mq.addEventListener("change", onSystemChange);
|
|
502
|
-
setMounted(true);
|
|
503
|
-
return () => mq.removeEventListener("change", onSystemChange);
|
|
504
|
-
} catch {
|
|
505
|
-
setTheme("dark");
|
|
506
|
-
document.documentElement.setAttribute("data-theme", "dark");
|
|
507
|
-
setMounted(true);
|
|
508
|
-
}
|
|
509
|
-
}, []);
|
|
510
|
-
|
|
511
|
-
// Step 2: Apply theme with smooth transition class
|
|
512
|
-
const applyTheme = useCallback(next => {
|
|
513
|
-
const root = document.documentElement;
|
|
514
|
-
root.classList.add("theme-transition");
|
|
515
|
-
root.setAttribute("data-theme", next);
|
|
516
|
-
localStorage.setItem("theme", next);
|
|
517
|
-
const t = setTimeout(() => root.classList.remove("theme-transition"), 300);
|
|
518
|
-
return () => clearTimeout(t);
|
|
519
|
-
}, []);
|
|
520
|
-
|
|
521
|
-
// Step 3: Apply whenever theme state changes (after mount)
|
|
522
|
-
useEffect(() => {
|
|
523
|
-
if (mounted) applyTheme(theme);
|
|
524
|
-
}, [theme, mounted, applyTheme]);
|
|
525
|
-
|
|
526
|
-
// Step 4: Toggle
|
|
527
|
-
const toggleTheme = useCallback(() => {
|
|
528
|
-
setTheme(prev => prev === "light" ? "dark" : "light");
|
|
529
|
-
}, []);
|
|
530
|
-
|
|
531
|
-
// Step 5: Explicit setter (for admin/testing)
|
|
532
|
-
const setThemeExplicitly = useCallback(next => {
|
|
533
|
-
if (next !== "light" && next !== "dark") return;
|
|
534
|
-
setTheme(next);
|
|
535
|
-
}, []);
|
|
536
|
-
|
|
537
|
-
// React 19 direct context syntax
|
|
538
|
-
return /*#__PURE__*/jsx(ThemeContext, {
|
|
539
|
-
value: {
|
|
540
|
-
theme,
|
|
541
|
-
toggleTheme,
|
|
542
|
-
setTheme: setThemeExplicitly,
|
|
543
|
-
isDarkMode: theme === "dark",
|
|
544
|
-
isThemeReady: mounted
|
|
545
|
-
},
|
|
546
|
-
children: children
|
|
547
|
-
});
|
|
548
|
-
};
|
|
549
|
-
const useTheme = () => {
|
|
550
|
-
const ctx = useContext(ThemeContext);
|
|
551
|
-
if (!ctx) throw new Error("useTheme must be used inside ThemeProvider");
|
|
552
|
-
return ctx;
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
export { Button, Container, FaArrowDown, FaArrowUp, FavoriteHeartButton, Footer, HeartIcon, Modal, Navbar, ProgressBar, ScrollButton, Section, SubNavbar, ThemeProvider, ThreeDotButton, useTheme };
|