funuicss 2.5.14 → 2.6.1

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.
@@ -1,15 +1,5 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
2
+ 'use client';
13
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
4
  if (k2 === undefined) k2 = k;
15
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -43,44 +33,99 @@ var __importStar = (this && this.__importStar) || (function () {
43
33
  return result;
44
34
  };
45
35
  })();
46
- var __rest = (this && this.__rest) || function (s, e) {
47
- var t = {};
48
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
- t[p] = s[p];
50
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
- t[p[i]] = s[p[i]];
54
- }
55
- return t;
56
- };
57
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
58
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
38
  };
60
39
  Object.defineProperty(exports, "__esModule", { value: true });
61
40
  exports.default = SideBar;
62
- var React = __importStar(require("react"));
41
+ var react_1 = __importStar(require("react"));
63
42
  var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
43
+ var Text_1 = __importDefault(require("../text/Text"));
44
+ var navigation_1 = require("next/navigation");
64
45
  function SideBar(_a) {
65
- var funcss = _a.funcss, position = _a.position, glassy = _a.glassy, header = _a.header, open = _a.open, content = _a.content, close = _a.close, footer = _a.footer, fixed = _a.fixed, rest = __rest(_a, ["funcss", "position", "glassy", "header", "open", "content", "close", "footer", "fixed"]);
66
- if (open) {
67
- return (React.createElement("aside", __assign({ className: "fun_side_bar_wrapper ".concat(fixed ? "fixed_sidebar" : "", " ").concat(glassy ? "glassy" : "") }, rest),
68
- React.createElement("div", { className: "\n fun_sidebar_content ".concat(funcss || "", " ").concat(position || "", " \n ") },
69
- React.createElement(RowFlex_1.default, { justify: 'space-between' },
70
- header &&
71
- React.createElement("div", { className: "col fit" },
72
- " ",
73
- header,
74
- " "),
75
- close && React.createElement("div", { className: "close_sidebar" },
76
- close,
77
- " ")),
78
- content &&
79
- React.createElement("div", null, content),
80
- footer &&
81
- React.createElement("div", null, footer))));
82
- }
83
- else {
84
- return React.createElement(React.Fragment, null);
85
- }
46
+ var _b;
47
+ var _c = _a.funcss, funcss = _c === void 0 ? '' : _c, _d = _a.position, position = _d === void 0 ? 'left' : _d, _e = _a.open, open = _e === void 0 ? false : _e, header = _a.header, content = _a.content, footer = _a.footer, _f = _a.top, top = _f === void 0 ? 0 : _f, _g = _a.sidebarWidth, sidebarWidth = _g === void 0 ? 250 : _g, _h = _a.sidebarCss, sidebarCss = _h === void 0 ? '' : _h, _j = _a.bodyCss, bodyCss = _j === void 0 ? '' : _j, _k = _a.links, links = _k === void 0 ? [] : _k, children = _a.children, onClose = _a.onClose;
48
+ var _l = (0, react_1.useState)(false), isMobile = _l[0], setIsMobile = _l[1];
49
+ var _m = (0, react_1.useState)(open), internalOpen = _m[0], setInternalOpen = _m[1];
50
+ var _o = (0, react_1.useState)('0px'), appBarHeight = _o[0], setAppBarHeight = _o[1];
51
+ var pathname = (0, navigation_1.usePathname)();
52
+ var sidebarRef = (0, react_1.useRef)(null);
53
+ var updateIsMobile = (0, react_1.useCallback)(function () {
54
+ setIsMobile(window.innerWidth <= 992);
55
+ }, []);
56
+ (0, react_1.useEffect)(function () {
57
+ updateIsMobile();
58
+ window.addEventListener('resize', updateIsMobile);
59
+ return function () { return window.removeEventListener('resize', updateIsMobile); };
60
+ }, [updateIsMobile]);
61
+ // Sync internal state with prop changes
62
+ (0, react_1.useEffect)(function () {
63
+ setInternalOpen(open);
64
+ }, [open]);
65
+ (0, react_1.useEffect)(function () {
66
+ var appBar = document.querySelector('#appBar');
67
+ if (appBar) {
68
+ setAppBarHeight("".concat(appBar.offsetHeight, "px"));
69
+ }
70
+ }, []);
71
+ (0, react_1.useEffect)(function () {
72
+ if (!isMobile || !internalOpen)
73
+ return;
74
+ var handleOutsideClick = function (e) {
75
+ if (sidebarRef.current && !sidebarRef.current.contains(e.target)) {
76
+ handleClose();
77
+ }
78
+ };
79
+ document.addEventListener('mousedown', handleOutsideClick);
80
+ document.addEventListener('touchstart', handleOutsideClick);
81
+ return function () {
82
+ document.removeEventListener('mousedown', handleOutsideClick);
83
+ document.removeEventListener('touchstart', handleOutsideClick);
84
+ };
85
+ }, [isMobile, internalOpen]);
86
+ var handleClose = function () {
87
+ setInternalOpen(false);
88
+ onClose === null || onClose === void 0 ? void 0 : onClose();
89
+ };
90
+ var groupedLinks = links.reduce(function (acc, link) {
91
+ acc[link.section] = acc[link.section] || [];
92
+ acc[link.section].push(link);
93
+ return acc;
94
+ }, {});
95
+ var isOverlay = isMobile;
96
+ return (react_1.default.createElement("div", { className: "sidebar-container ".concat(isOverlay ? '' : 'with-content') },
97
+ internalOpen && (react_1.default.createElement("aside", { role: "complementary", ref: sidebarRef, className: "sidebar ".concat(funcss, " ").concat(sidebarCss, " ").concat(isOverlay ? 'nav_overlay' : ''), style: (_b = {
98
+ width: isOverlay ? '100%' : "".concat(sidebarWidth, "px"),
99
+ height: "calc(100vh - ".concat(appBarHeight || top || '0px', ")"),
100
+ position: 'fixed',
101
+ top: appBarHeight || top
102
+ },
103
+ _b[position] = 0,
104
+ _b.padding = '1rem',
105
+ _b) },
106
+ react_1.default.createElement(RowFlex_1.default, { justify: "space-between", funcss: "pl-2 pr-2" }, header && react_1.default.createElement("div", null, header)),
107
+ react_1.default.createElement("section", { className: "sidebar-body mt-3" },
108
+ links.length > 0 && (react_1.default.createElement("nav", { className: "sidebar-links" }, Object.entries(groupedLinks).map(function (_a) {
109
+ var section = _a[0], sectionLinks = _a[1];
110
+ return (react_1.default.createElement("div", { key: section, className: "sidebar-section mb-2 bt pt-2 pb-2" },
111
+ react_1.default.createElement(Text_1.default, { size: "sm", funcss: "opacity-5 p-1 pl-2 pr-2" }, section),
112
+ sectionLinks.map(function (link) {
113
+ var isActive = pathname === link.uri;
114
+ return (react_1.default.createElement("a", { onClick: handleClose, key: link.uri, href: link.uri },
115
+ react_1.default.createElement("div", { className: "p-1 pl-2 pr-2 sidebar-link ".concat(isActive ? 'primary50 outline-primary200' : 'hoverable') },
116
+ react_1.default.createElement("span", { style: { lineHeight: 0 } }, link.icon),
117
+ react_1.default.createElement(Text_1.default, { text: link.text, size: "sm", weight: 400 }))));
118
+ })));
119
+ }))),
120
+ content),
121
+ footer && react_1.default.createElement("footer", { className: "sidebar-footer mt-2" }, footer))),
122
+ react_1.default.createElement("main", { className: "main-content ".concat(bodyCss), style: {
123
+ flex: 1,
124
+ marginLeft: position === 'left' && !isOverlay && internalOpen ? "".concat(sidebarWidth, "px") : 0,
125
+ marginRight: position === 'right' && !isOverlay && internalOpen ? "".concat(sidebarWidth, "px") : 0,
126
+ overflowY: 'auto',
127
+ height: '100vh',
128
+ paddingTop: appBarHeight || top,
129
+ transition: 'margin 0.3s ease',
130
+ } }, children)));
86
131
  }
@@ -1,62 +1,189 @@
1
- import { ReactNode, useState, useEffect } from 'react';
2
- import * as React from 'react'
1
+ 'use client';
2
+ import React, {
3
+ useEffect,
4
+ useRef,
5
+ useState,
6
+ ReactNode,
7
+ useCallback,
8
+ } from 'react';
3
9
  import RowFlex from '../specials/RowFlex';
10
+ import Text from '../text/Text';
11
+ import { usePathname } from 'next/navigation';
12
+ import { PiX } from 'react-icons/pi';
4
13
 
14
+ interface SideBarLink {
15
+ uri: string;
16
+ icon: React.ReactNode;
17
+ text: string;
18
+ section: string;
19
+ }
5
20
 
6
- interface FunLoaderProps {
21
+ interface SideBarProps {
7
22
  funcss?: string;
8
- position?: "left" | "right";
9
- glassy?: boolean;
10
- open?:boolean
11
- header?: ReactNode ,
12
- content?: ReactNode ,
13
- close?: ReactNode ,
14
- footer?: ReactNode ,
15
- fixed?:boolean
23
+ position?: 'left' | 'right';
24
+ open?: boolean;
25
+ header?: ReactNode;
26
+ content?: ReactNode;
27
+ footer?: ReactNode;
28
+ top?: number;
29
+ sidebarWidth?: number;
30
+ sidebarCss?: string;
31
+ bodyCss?: string;
32
+ links?: SideBarLink[];
33
+ children?: ReactNode;
34
+ onClose?: () => void;
16
35
  }
17
36
 
18
37
  export default function SideBar({
19
- funcss,
20
- position ,
21
- glassy ,
22
- header ,
23
- open ,
24
- content ,
25
- close,
26
- footer ,
27
- fixed,
28
- ...rest
29
- }: FunLoaderProps) {
30
-
31
-
32
-
33
- if(open){
34
- return (
35
- <aside className={`fun_side_bar_wrapper ${fixed ? "fixed_sidebar" : ""} ${glassy ? "glassy" : ""}`} {...rest}>
36
- <div className={`
37
- fun_sidebar_content ${funcss || ""} ${position || ""}
38
- `}
39
- >
40
- <RowFlex justify='space-between'>
41
- {
42
- header &&
43
- <div className="col fit"> {header} </div>
44
- }
45
- {close && <div className="close_sidebar">{close} </div>}
46
-
47
- </RowFlex>
48
- {
49
- content &&
50
- <div>{content}</div>
51
- }
52
- {
53
- footer &&
54
- <div>{footer}</div>
55
- }
38
+ funcss = '',
39
+ position = 'left',
40
+ open = false,
41
+ header,
42
+ content,
43
+ footer,
44
+ top = 0,
45
+ sidebarWidth = 250,
46
+ sidebarCss = '',
47
+ bodyCss = '',
48
+ links = [],
49
+ children,
50
+ onClose,
51
+ }: SideBarProps) {
52
+ const [isMobile, setIsMobile] = useState(false);
53
+ const [internalOpen, setInternalOpen] = useState(open);
54
+ const [appBarHeight, setAppBarHeight] = useState('0px');
55
+ const pathname = usePathname();
56
+ const sidebarRef = useRef<HTMLDivElement>(null);
57
+
58
+ const updateIsMobile = useCallback(() => {
59
+ setIsMobile(window.innerWidth <= 992);
60
+
61
+ }, []);
62
+
63
+ useEffect(() => {
64
+ updateIsMobile();
65
+ window.addEventListener('resize', updateIsMobile);
66
+ return () => window.removeEventListener('resize', updateIsMobile);
67
+ }, [updateIsMobile]);
68
+
69
+ // Sync internal state with prop changes
70
+ useEffect(() => {
71
+ setInternalOpen(open);
72
+ }, [open]);
73
+
74
+ useEffect(() => {
75
+ const appBar = document.querySelector('#appBar') as HTMLElement;
76
+ if (appBar) {
77
+ setAppBarHeight(`${appBar.offsetHeight}px`);
78
+ }
79
+ }, []);
80
+
81
+ useEffect(() => {
82
+ if (!isMobile || !internalOpen) return;
83
+
84
+ const handleOutsideClick = (e: MouseEvent | TouchEvent) => {
85
+ if (sidebarRef.current && !sidebarRef.current.contains(e.target as Node)) {
86
+ handleClose();
87
+ }
88
+ };
89
+
90
+ document.addEventListener('mousedown', handleOutsideClick);
91
+ document.addEventListener('touchstart', handleOutsideClick);
92
+
93
+ return () => {
94
+ document.removeEventListener('mousedown', handleOutsideClick);
95
+ document.removeEventListener('touchstart', handleOutsideClick);
96
+ };
97
+ }, [isMobile, internalOpen]);
98
+
99
+ const handleClose = () => {
100
+ setInternalOpen(false);
101
+ onClose?.();
102
+ };
103
+
104
+ const groupedLinks = links.reduce<Record<string, SideBarLink[]>>((acc, link) => {
105
+ acc[link.section] = acc[link.section] || [];
106
+ acc[link.section].push(link);
107
+ return acc;
108
+ }, {});
109
+
110
+ const isOverlay = isMobile;
111
+
112
+ return (
113
+ <div className={`sidebar-container ${isOverlay ? '' : 'with-content'}`}>
114
+ {internalOpen && (
115
+ <aside
116
+ role="complementary"
117
+ ref={sidebarRef}
118
+ className={`sidebar ${funcss} ${sidebarCss} ${isOverlay ? 'nav_overlay' : ''}`}
119
+ style={{
120
+ width: isOverlay ? '100%' : `${sidebarWidth}px`,
121
+ height: `calc(100vh - ${appBarHeight || top || '0px'})`,
122
+ position: 'fixed',
123
+ top: appBarHeight || top,
124
+ [position]: 0,
125
+ padding: '1rem',
126
+ }}
127
+ >
128
+ {/* {isMobile && (
129
+ <div
130
+ className="hover-text-error pointer"
131
+ onClick={handleClose}
132
+ style={{ cursor: 'pointer' }}
133
+ >
134
+ {close || <PiX size={25}/>}
56
135
  </div>
136
+ )} */}
137
+
138
+ <RowFlex justify="space-between" funcss="pl-2 pr-2">
139
+ {header && <div>{header}</div>}
140
+
141
+ </RowFlex>
142
+
143
+ <section className="sidebar-body mt-3">
144
+ {links.length > 0 && (
145
+ <nav className="sidebar-links">
146
+ {Object.entries(groupedLinks).map(([section, sectionLinks]) => (
147
+ <div key={section} className="sidebar-section mb-2 bt pt-2 pb-2">
148
+ <Text size="sm" funcss="opacity-5 p-1 pl-2 pr-2">{section}</Text>
149
+ {sectionLinks.map(link => {
150
+ const isActive = pathname === link.uri;
151
+ return (
152
+ <a onClick={handleClose} key={link.uri} href={link.uri}>
153
+ <div className={`p-1 pl-2 pr-2 sidebar-link ${
154
+ isActive ? 'primary50 outline-primary200' : 'hoverable'
155
+ }`}>
156
+ <span style={{ lineHeight: 0 }}>{link.icon}</span>
157
+ <Text text={link.text} size="sm" weight={400} />
158
+ </div>
159
+ </a>
160
+ );
161
+ })}
162
+ </div>
163
+ ))}
164
+ </nav>
165
+ )}
166
+ {content}
167
+ </section>
168
+
169
+ {footer && <footer className="sidebar-footer mt-2">{footer}</footer>}
57
170
  </aside>
58
- );
59
- }else{
60
- return <></>
61
- }
62
- }
171
+ )}
172
+
173
+ <main
174
+ className={`main-content ${bodyCss}`}
175
+ style={{
176
+ flex: 1,
177
+ marginLeft: position === 'left' && !isOverlay && internalOpen ? `${sidebarWidth}px` : 0,
178
+ marginRight: position === 'right' && !isOverlay && internalOpen ? `${sidebarWidth}px` : 0,
179
+ overflowY: 'auto',
180
+ height: '100vh',
181
+ paddingTop: appBarHeight || top,
182
+ transition: 'margin 0.3s ease',
183
+ }}
184
+ >
185
+ {children}
186
+ </main>
187
+ </div>
188
+ );
189
+ }
@@ -8,8 +8,9 @@ interface Circle_Props extends HTMLProps<HTMLDivElement> {
8
8
  children?: ReactNode;
9
9
  hoverable?: boolean;
10
10
  raised?: boolean;
11
+ bordered?: boolean;
11
12
  key?: React.Key;
12
13
  onClick?: () => void;
13
14
  }
14
- export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, ...rest }: Circle_Props): React.JSX.Element;
15
+ export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, bordered, ...rest }: Circle_Props): React.JSX.Element;
15
16
  export {};
@@ -59,8 +59,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
59
59
  exports.default = Circle;
60
60
  var React = __importStar(require("react"));
61
61
  function Circle(_a) {
62
- var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick"]);
63
- return (React.createElement("div", __assign({ className: "pointer avatar ".concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: {
62
+ var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, _c = _a.bg, bg = _c === void 0 ? 'lighter' : _c, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, bordered = _a.bordered, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick", "bordered"]);
63
+ return (React.createElement("div", __assign({ className: " ".concat(bordered ? "border" : "", "pointer avatar ").concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: {
64
64
  width: "".concat(size + "rem" || '2.3rem'),
65
65
  height: "".concat(size + "rem" || '2.3rem'),
66
66
  }, key: key, onClick: onClick }, rest),
@@ -11,6 +11,7 @@ interface Circle_Props extends HTMLProps<HTMLDivElement> {
11
11
  children?: ReactNode;
12
12
  hoverable?: boolean;
13
13
  raised?:boolean
14
+ bordered?:boolean
14
15
  key?:React.Key
15
16
  onClick?: ()=> void
16
17
  }
@@ -19,18 +20,19 @@ interface Circle_Props extends HTMLProps<HTMLDivElement> {
19
20
  export default function Circle({
20
21
  size = 2,
21
22
  funcss,
22
- bg,
23
+ bg = 'lighter',
23
24
  color,
24
25
  children,
25
26
  hoverable,
26
27
  raised ,
27
28
  key ,
28
29
  onClick ,
30
+ bordered,
29
31
  ...rest
30
32
  }: Circle_Props) {
31
33
  return (
32
34
  <div
33
- className={`pointer avatar ${funcss || ''} ${`text-` + color?.trim() || ''} ${raised ? "raised" : ''} ${bg || 'lighter'} ${
35
+ className={` ${bordered ? "border" : ""}pointer avatar ${funcss || ''} ${`text-` + color?.trim() || ''} ${raised ? "raised" : ''} ${bg || 'lighter'} ${
34
36
  hoverable ? 'hoverable' : ''
35
37
  }`}
36
38
  style={{
package/ui/text/Text.d.ts CHANGED
@@ -32,7 +32,7 @@ type TypographyProps = {
32
32
  fontFamily?: string;
33
33
  textShadow?: string;
34
34
  textAlign?: "left" | "center" | "right" | "justify";
35
- opacity?: number;
35
+ opacity?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
36
36
  zIndex?: number;
37
37
  truncate?: number;
38
38
  transform?: string;
package/ui/text/Text.js CHANGED
@@ -28,8 +28,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  var react_1 = __importDefault(require("react"));
29
29
  var pi_1 = require("react-icons/pi");
30
30
  var Text = function (_a) {
31
- var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, _b = _a.size, size = _b === void 0 ? 'base' : _b, // default
32
- rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "size"]);
31
+ var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, opacity = _a.opacity, _b = _a.size, size = _b === void 0 ? 'base' : _b, // default
32
+ rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "opacity", "size"]);
33
33
  var Tag = block ? 'div' : 'span';
34
34
  var sizeClass = "".concat(size === 'h1' ? "h1" :
35
35
  size === 'h2' ? "h2" :
@@ -66,6 +66,7 @@ var Text = function (_a) {
66
66
  uppercase ? 'uppercase' : '',
67
67
  lowercase ? 'lowercase' : '',
68
68
  capitalize ? 'capitalize' : '',
69
+ opacity ? 'opacity-' + opacity : '',
69
70
  ]
70
71
  .filter(Boolean)
71
72
  .join(' ');
package/ui/text/Text.tsx CHANGED
@@ -34,7 +34,7 @@ type TypographyProps = {
34
34
  fontFamily?: string;
35
35
  textShadow?: string;
36
36
  textAlign?: "left" | "center" | "right" | "justify";
37
- opacity?: number;
37
+ opacity?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
38
38
  zIndex?: number;
39
39
  truncate?: number;
40
40
  transform?: string;
@@ -100,8 +100,8 @@ const Text: React.FC<TypographyProps> = ({
100
100
  customStyles,
101
101
  monospace,
102
102
  quote,
103
+ opacity,
103
104
  size = 'base', // default
104
-
105
105
  ...rest
106
106
  }) => {
107
107
  const Tag = block ? 'div' : 'span';
@@ -159,6 +159,7 @@ const mergedStyles: React.CSSProperties = {
159
159
  uppercase ? 'uppercase' : '',
160
160
  lowercase ? 'lowercase' : '',
161
161
  capitalize ? 'capitalize' : '',
162
+ opacity ? 'opacity-' + opacity : '',
162
163
  ]
163
164
  .filter(Boolean)
164
165
  .join(' ');
package/ui/theme/theme.js CHANGED
@@ -42,14 +42,14 @@ var ThemeProvider = function (_a) {
42
42
  var lightTheme = {
43
43
  '--page-bg': '#FFFFFF',
44
44
  '--text-color': '#000000',
45
- '--raiseThemes': '#FFFFFF',
46
45
  };
47
46
  var darkTheme = {
48
47
  '--page-bg': '#121212',
49
48
  '--text-color': '#FFFFFF',
50
- '--raiseThemes': '#202020',
49
+ '--raiseThemes': 'rgba(32, 32, 32, 0.8)',
50
+ '--raiseOpaque': 'rgba(32, 32, 32, 0.94)',
51
51
  '--borderColor': '#333333',
52
- '--lighter': '#202020',
52
+ '--lighter': '#101010',
53
53
  };
54
54
  var selectedTheme = theme === 'dark' ? darkTheme : lightTheme;
55
55
  Object.entries(selectedTheme).forEach(function (_a) {
@@ -13,15 +13,15 @@ const ThemeProvider: React.FC<ThemeProviderProps> = ({ theme, children }) => {
13
13
  const lightTheme = {
14
14
  '--page-bg': '#FFFFFF',
15
15
  '--text-color': '#000000',
16
- '--raiseThemes': '#FFFFFF',
17
16
  };
18
17
 
19
18
  const darkTheme = {
20
19
  '--page-bg': '#121212',
21
20
  '--text-color': '#FFFFFF',
22
- '--raiseThemes': '#202020',
21
+ '--raiseThemes': 'rgba(32, 32, 32, 0.8)',
22
+ '--raiseOpaque': 'rgba(32, 32, 32, 0.94)',
23
23
  '--borderColor': '#333333',
24
- '--lighter': '#202020',
24
+ '--lighter': '#101010',
25
25
  };
26
26
 
27
27
  const selectedTheme = theme === 'dark' ? darkTheme : lightTheme;
@@ -0,0 +1 @@
1
+ export declare function getCssVariableValue(name: string): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCssVariableValue = getCssVariableValue;
4
+ function getCssVariableValue(name) {
5
+ // Convert name like "primary" into "--primary"
6
+ var variableName = name.startsWith('--') ? name : "--".concat(name);
7
+ // Get value from :root style
8
+ var rootStyles = getComputedStyle(document.documentElement);
9
+ return rootStyles.getPropertyValue(variableName).trim();
10
+ }
@@ -0,0 +1,8 @@
1
+ export function getCssVariableValue(name: string): string {
2
+ // Convert name like "primary" into "--primary"
3
+ const variableName = name.startsWith('--') ? name : `--${name}`;
4
+
5
+ // Get value from :root style
6
+ const rootStyles = getComputedStyle(document.documentElement);
7
+ return rootStyles.getPropertyValue(variableName).trim();
8
+ }