funuicss 2.5.3 → 2.5.4

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.
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ var react_1 = __importStar(require("react"));
28
+ var ThemeProvider = function (_a) {
29
+ var theme = _a.theme, children = _a.children;
30
+ (0, react_1.useEffect)(function () {
31
+ var root = document.documentElement;
32
+ var lightTheme = {
33
+ '--page-bg': '#FFFFFF',
34
+ '--text-color': '#000000',
35
+ '--raiseThemes': '#FFFFFF',
36
+ '--borderColor': '#CCCCCC',
37
+ };
38
+ var darkTheme = {
39
+ '--page-bg': '#121212',
40
+ '--text-color': '#FFFFFF',
41
+ '--raiseThemes': '#202020',
42
+ '--borderColor': '#333333',
43
+ };
44
+ var selectedTheme = theme === 'dark' ? darkTheme : lightTheme;
45
+ Object.entries(selectedTheme).forEach(function (_a) {
46
+ var key = _a[0], value = _a[1];
47
+ root.style.setProperty(key, value);
48
+ });
49
+ }, [theme]);
50
+ return (react_1.default.createElement("div", { className: "theme-".concat(theme), style: { backgroundColor: 'var(--page-bg)', color: 'var(--text-color)', minHeight: '100vh' } }, children));
51
+ };
52
+ exports.default = ThemeProvider;
@@ -0,0 +1,41 @@
1
+ 'use client'
2
+ import React, { useEffect } from 'react';
3
+
4
+ interface ThemeProviderProps {
5
+ theme: 'light' | 'dark';
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ const ThemeProvider: React.FC<ThemeProviderProps> = ({ theme, children }) => {
10
+ useEffect(() => {
11
+ const root = document.documentElement;
12
+
13
+ const lightTheme = {
14
+ '--page-bg': '#FFFFFF',
15
+ '--text-color': '#000000',
16
+ '--raiseThemes': '#FFFFFF',
17
+ '--borderColor': '#CCCCCC',
18
+ };
19
+
20
+ const darkTheme = {
21
+ '--page-bg': '#121212',
22
+ '--text-color': '#FFFFFF',
23
+ '--raiseThemes': '#202020',
24
+ '--borderColor': '#333333',
25
+ };
26
+
27
+ const selectedTheme = theme === 'dark' ? darkTheme : lightTheme;
28
+
29
+ Object.entries(selectedTheme).forEach(([key, value]) => {
30
+ root.style.setProperty(key, value);
31
+ });
32
+ }, [theme]);
33
+
34
+ return (
35
+ <div className={`theme-${theme}`} style={{ backgroundColor: 'var(--page-bg)', color: 'var(--text-color)', minHeight: '100vh' }}>
36
+ {children}
37
+ </div>
38
+ );
39
+ };
40
+
41
+ export default ThemeProvider;
package/ui/tooltip/Tip.js CHANGED
@@ -48,13 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  var React = __importStar(require("react"));
49
49
  function Tip(_a) {
50
50
  var tip = _a.tip, funcss = _a.funcss, children = _a.children, content = _a.content, message = _a.message, animation = _a.animation, duration = _a.duration, rest = __rest(_a, ["tip", "funcss", "children", "content", "message", "animation", "duration"]);
51
- // Calculate width only if content is a string
52
51
  var text = message || content || children;
53
- // Check if content is a plain string to calculate width
54
- var isString = typeof text === 'string';
55
- var minWidth = isString
56
- ? "".concat(text.replace(/\s+/g, '').length * 8, "px")
57
- : 'auto';
58
- return (React.createElement("span", __assign({ className: "tip-".concat(tip, " tip ").concat(funcss ? funcss : ''), style: { animation: " ".concat(duration ? duration : 0, "s ").concat(animation ? animation : ''), minWidth: minWidth } }, rest), text));
52
+ return (React.createElement("span", __assign({ className: "tip-".concat(tip, " tip ").concat(funcss ? funcss : ''), style: { animation: " ".concat(duration ? duration : 0, "s ").concat(animation ? animation : '') } }, rest), text));
59
53
  }
60
54
  exports.default = Tip;
@@ -20,17 +20,11 @@ export default function Tip({
20
20
  duration,
21
21
  ...rest
22
22
  }: TipProps) {
23
- // Calculate width only if content is a string
24
23
  const text = message || content || children;
25
- // Check if content is a plain string to calculate width
26
- const isString = typeof text === 'string';
27
- const minWidth = isString
28
- ? `${text.replace(/\s+/g, '').length * 8}px`
29
- : 'auto';
30
24
  return (
31
25
  <span
32
26
  className={`tip-${tip} tip ${funcss ? funcss : ''}`}
33
- style={{ animation: ` ${duration ? duration : 0}s ${animation ? animation : ''}`, minWidth: minWidth }}
27
+ style={{ animation: ` ${duration ? duration : 0}s ${animation ? animation : ''}`}}
34
28
  {...rest}
35
29
  >
36
30
  {text}