funuicss 2.7.15 → 3.0.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.
Files changed (120) hide show
  1. package/css/fun.css +6663 -6653
  2. package/index.d.ts +3 -0
  3. package/index.js +7 -1
  4. package/js/google/AnalyticsHandler.d.ts +10 -0
  5. package/js/google/AnalyticsHandler.js +20 -0
  6. package/js/google/analytics.d.ts +6 -0
  7. package/js/google/analytics.js +53 -0
  8. package/package.json +1 -1
  9. package/tsconfig.tsbuildinfo +1 -1
  10. package/ui/flex/Flex.d.ts +3 -8
  11. package/ui/flex/Flex.js +15 -9
  12. package/ui/flex/FlexItem.d.ts +17 -0
  13. package/ui/flex/FlexItem.js +39 -0
  14. package/ui/notification/Notification.d.ts +7 -3
  15. package/ui/notification/Notification.js +18 -14
  16. package/ui/scrolltotop/ScrollToTop.d.ts +3 -0
  17. package/ui/scrolltotop/ScrollToTop.js +61 -0
  18. package/ui/video/Video.d.ts +2 -1
  19. package/ui/video/Video.js +10 -10
  20. package/ui/video/videoShortcuts.d.ts +1 -1
  21. package/ui/video/videoShortcuts.js +2 -2
  22. package/ui/view/View.d.ts +27 -38
  23. package/ui/view/View.js +10 -38
  24. package/ui/vista/Vista.d.ts +6 -1
  25. package/ui/vista/Vista.js +33 -4
  26. package/assets/colors/colors.d.ts +0 -347
  27. package/assets/colors/colors.js +0 -348
  28. package/assets/colors/colors.tsx +0 -697
  29. package/hooks/useHls.tsx +0 -69
  30. package/index.tsx +0 -57
  31. package/js/Cookie.tsx +0 -91
  32. package/js/Fun.jsx +0 -225
  33. package/js/Fun.tsx +0 -239
  34. package/tsconfig.json +0 -20
  35. package/types/react-easy-export.d.ts +0 -4
  36. package/ui/ScrollInView/ScrollInView.tsx +0 -69
  37. package/ui/accordion/Accordion.tsx +0 -125
  38. package/ui/alert/Alert.tsx +0 -106
  39. package/ui/aos/AOS.tsx +0 -24
  40. package/ui/appbar/AppBar.tsx +0 -115
  41. package/ui/appbar/Hamburger.tsx +0 -30
  42. package/ui/avatar/Avatar.tsx +0 -52
  43. package/ui/blob/Blob.tsx +0 -34
  44. package/ui/breadcrumb/BreadCrumb.tsx +0 -48
  45. package/ui/button/Button.tsx +0 -153
  46. package/ui/calendar/ActivityCard.tsx +0 -27
  47. package/ui/calendar/Calendar.tsx +0 -343
  48. package/ui/card/Card.tsx +0 -117
  49. package/ui/card/CardBody.tsx +0 -14
  50. package/ui/card/CardFab.tsx +0 -16
  51. package/ui/card/CardFooter.tsx +0 -14
  52. package/ui/card/CardHeader.tsx +0 -14
  53. package/ui/carousel/Carousel.tsx +0 -148
  54. package/ui/chart/Bar.tsx +0 -121
  55. package/ui/chart/Line.tsx +0 -186
  56. package/ui/chart/Pie.tsx +0 -127
  57. package/ui/container/Container.tsx +0 -38
  58. package/ui/datepicker/DatePicker.tsx +0 -148
  59. package/ui/div/Div.tsx +0 -61
  60. package/ui/drop/Action.tsx +0 -16
  61. package/ui/drop/Down.tsx +0 -18
  62. package/ui/drop/Dropdown.tsx +0 -117
  63. package/ui/drop/Item.tsx +0 -15
  64. package/ui/drop/Menu.tsx +0 -40
  65. package/ui/drop/Up.tsx +0 -18
  66. package/ui/flex/Flex.tsx +0 -115
  67. package/ui/grid/Col.tsx +0 -43
  68. package/ui/grid/Grid.tsx +0 -37
  69. package/ui/input/Iconic.tsx +0 -43
  70. package/ui/input/Input.tsx +0 -409
  71. package/ui/list/Item.tsx +0 -18
  72. package/ui/list/List.tsx +0 -45
  73. package/ui/loader/Loader.tsx +0 -47
  74. package/ui/modal/Action.tsx +0 -14
  75. package/ui/modal/Close.tsx +0 -14
  76. package/ui/modal/Content.tsx +0 -15
  77. package/ui/modal/Header.tsx +0 -19
  78. package/ui/modal/Modal.tsx +0 -140
  79. package/ui/notification/Content.tsx +0 -14
  80. package/ui/notification/Footer.tsx +0 -14
  81. package/ui/notification/Header.tsx +0 -14
  82. package/ui/notification/Notification.tsx +0 -62
  83. package/ui/page/NotFound.tsx +0 -67
  84. package/ui/page/UnAuthorized.tsx +0 -64
  85. package/ui/progress/Bar.tsx +0 -114
  86. package/ui/richtext/RichText.tsx +0 -156
  87. package/ui/sidebar/SideBar.tsx +0 -202
  88. package/ui/sidebar/SideContent.tsx +0 -16
  89. package/ui/slider/Slider.tsx +0 -75
  90. package/ui/snackbar/SnackBar.tsx +0 -56
  91. package/ui/specials/Circle.tsx +0 -49
  92. package/ui/specials/CircleGroup.tsx +0 -49
  93. package/ui/specials/FullCenteredPage.tsx +0 -25
  94. package/ui/specials/Hr.tsx +0 -16
  95. package/ui/specials/RowFlex.tsx +0 -56
  96. package/ui/specials/Section.tsx +0 -18
  97. package/ui/step/Container.tsx +0 -27
  98. package/ui/step/Header.tsx +0 -16
  99. package/ui/step/Line.tsx +0 -17
  100. package/ui/step/Step.tsx +0 -17
  101. package/ui/table/Body.tsx +0 -10
  102. package/ui/table/Data.tsx +0 -15
  103. package/ui/table/Head.tsx +0 -10
  104. package/ui/table/Row.tsx +0 -16
  105. package/ui/table/Table.tsx +0 -372
  106. package/ui/text/Text.tsx +0 -179
  107. package/ui/theme/dark.tsx +0 -45
  108. package/ui/theme/darkenUtils.ts +0 -15
  109. package/ui/theme/theme.tsx +0 -48
  110. package/ui/theme/themes.ts +0 -154
  111. package/ui/tooltip/Tip.tsx +0 -34
  112. package/ui/tooltip/ToolTip.tsx +0 -20
  113. package/ui/video/Video.tsx +0 -347
  114. package/ui/video/videoFunctions.tsx +0 -19
  115. package/ui/video/videoShortcuts.ts +0 -12
  116. package/ui/view/View.tsx +0 -157
  117. package/ui/vista/Vista.tsx +0 -165
  118. package/utils/Emojis.tsx +0 -59
  119. package/utils/Functions.tsx +0 -9
  120. package/utils/getCssVariable.tsx +0 -9
package/ui/table/Row.tsx DELETED
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
-
3
- type TableRowProps = {
4
- children?: React.ReactNode;
5
- funcss?: string;
6
- rowKey?: React.Key;
7
- key?: React.Key;
8
- };
9
-
10
- export default function TableRow({ children, funcss, rowKey , key}: TableRowProps) {
11
- return (
12
- <tr className={`${funcss ? funcss : ''}`} key={key ? key : rowKey }>
13
- {children}
14
- </tr>
15
- );
16
- }
@@ -1,372 +0,0 @@
1
- 'use client'
2
- import * as React from 'react';
3
- import TableHead from './Head';
4
- import TableBody from './Body';
5
- import TableRow from './Row';
6
- import TableData from './Data';
7
- import Input from '../input/Input';
8
- import { useState } from "react";
9
- import RowFlex from '../specials/RowFlex';
10
- import Button from '../button/Button';
11
- import { PiDownload, PiFileCsv} from "react-icons/pi";
12
- import Circle from '../specials/Circle';
13
- import Text from '../text/Text';
14
- import { exportToCSV } from 'react-easy-export';
15
-
16
- type TableProps = {
17
- children?: React.ReactNode;
18
- funcss?: string;
19
- title?: string;
20
- bordered?: boolean;
21
- noStripped?: boolean;
22
- hoverable?: boolean;
23
- showTotal?: boolean;
24
- light?: boolean;
25
- isLoading?: boolean;
26
- hideExport?: boolean;
27
- dark?: boolean;
28
- data?: { "fields": string[], "data": any[], "titles": string[] , "funcss": string[]};
29
- head?: React.ReactNode;
30
- right?: React.ReactNode;
31
- body?: React.ReactNode;
32
- height?: number;
33
- pageSize?: number; // New prop for page size
34
- customColumns?: { title: string; render: (data: any) => React.ReactNode; onClick?: (data: any) => void }[];
35
- filterableFields?: string[]; // New prop for filterable fields
36
- };
37
-
38
- export default function Table({
39
- children,
40
- funcss,
41
- bordered,
42
- noStripped,
43
- hoverable,
44
- title,
45
- showTotal,
46
- light,
47
- dark,
48
- head,
49
- body,
50
- data,
51
- isLoading,
52
- right,
53
- hideExport,
54
- height,
55
- pageSize = data ? 10 : 0, // Default page size,
56
- customColumns,
57
- filterableFields, // New prop
58
- ...rest
59
- }: TableProps) {
60
- // Check if data is null or undefined before accessing its properties
61
- // Replace this in your component
62
- const [search, setSearch] = useState<string | string[]>('');
63
- const [currentPage, setCurrentPage] = useState<number>(1);
64
-
65
- // Determine the total number of pages based on data length and page size
66
- const totalPages = data ? Math.ceil((data?.data?.length || 0) / pageSize) : 0;
67
-
68
- // Calculate start and end indices for data pagination
69
- const startIndex = data ? (currentPage - 1) * pageSize : 0;
70
- const endIndex = data ? Math.min(startIndex + pageSize, data?.data?.length || 0) : 0;
71
-
72
- const [selectedField, setSelectedField] = useState<string | null>(null);
73
- const [selectedValue, setSelectedValue] = useState<string | null>(null);
74
-
75
-
76
-
77
- // Enhanced filter logic:
78
- const normalize = (val: any) => val?.toString().toLowerCase().trim();
79
-
80
- const matchesSearch = (item: any) => {
81
- const searchTerms = Array.isArray(search) ? search : [search];
82
- return searchTerms.some(term =>
83
- Object.values(item).some(value =>
84
- normalize(value).includes(normalize(term))
85
- )
86
- );
87
- };
88
-
89
-
90
-
91
-
92
-
93
- // Function to handle page change
94
- const handleChangePage = (page: number) => {
95
- if(data) {
96
- setCurrentPage(page);
97
- }
98
- };
99
-
100
- const handleFieldChange = (field: string) => {
101
- setSelectedField(field);
102
- setSelectedValue(null); // Reset selected value when field changes
103
- };
104
-
105
- const handleValueChange = (value: string) => {
106
- setSelectedValue(value);
107
- };
108
-
109
- const getNestedValue = (obj: any, path: string) => {
110
- return path.split('.').reduce((acc, part) => acc && acc[part], obj);
111
- };
112
-
113
- const filteredData = data ? data?.data.filter(item => {
114
- if (!search && !selectedField && !selectedValue) return true;
115
- if (selectedField && selectedValue) {
116
- const value = getNestedValue(item, selectedField);
117
- if(value){
118
- return value.toString().toLowerCase() === selectedValue.toString().toLowerCase();
119
- }
120
- }
121
- if (selectedField) {
122
- const value = getNestedValue(item, selectedField);
123
- if(value){
124
- return value.toString().toLowerCase().includes(search.toString().toLowerCase());
125
- }
126
- }
127
- return Object.values(item).some(value => {
128
- if(value){
129
- return value.toString().toLowerCase().includes(search.toString().toLowerCase());
130
- }
131
- });
132
- })
133
- : [];
134
-
135
- // Maximum number of visible pages for pagination
136
- const maxVisiblePages = 5;
137
-
138
- // Determine which pages to display
139
- let startPage = data ? Math.max(1, currentPage - Math.floor(maxVisiblePages / 2)) : 0;
140
- let endPage = data ? Math.min(startPage + maxVisiblePages - 1, totalPages) : 0;
141
-
142
- // Adjust startPage and endPage if there are not enough pages to fill maxVisiblePages
143
- if (endPage - startPage + 1 < maxVisiblePages) {
144
- startPage = Math.max(1, endPage - maxVisiblePages + 1);
145
- }
146
-
147
- // Function to export data to CSV
148
- const Export = () => {
149
- exportToCSV(filteredData, title ? `${title} ${selectedField ? `_${selectedField}` : ''}.csv` : 'data.csv');
150
- }
151
-
152
- // Extract the data array
153
- const dataArray = data ? data.data : []
154
-
155
- // Remove duplicate values
156
- const uniqueValues = selectedField
157
- ? Array.from(new Set(dataArray.map(item => getNestedValue(item, selectedField))))
158
- : [];
159
-
160
- return (
161
- <div className={`${funcss ? funcss : ''} roundEdge`}>
162
- {
163
- data &&
164
- <div className="padding bb">
165
- <RowFlex gap={0.5} justify='space-between'>
166
- {
167
- title ?
168
- <div>
169
- {
170
- showTotal && data &&
171
- <div >
172
- <Text text='Records: ' size='sm' />
173
- <Text text={filteredData.length} size='h6'/>
174
- </div>
175
- }
176
- {
177
- title &&
178
- <div >
179
- <Text text={title || ""} size='h4'/>
180
- </div>
181
-
182
-
183
- }
184
-
185
- </div>
186
- :
187
- <>
188
- {
189
- showTotal && data &&
190
- <div >
191
- <Text text='Records: ' size='sm' />
192
- <Text text={filteredData.length} size='h6'/>
193
- </div>
194
- }
195
- </>
196
- }
197
-
198
- {
199
- data && filterableFields ?
200
- <div className="col width-200-max">
201
- <RowFlex gap={0.7}>
202
- {
203
- !selectedField &&
204
- <select
205
- className=" input borderedInput roundEdgeSmall smallInput"
206
- value={selectedField || ''}
207
- onChange={(e) => {
208
- handleFieldChange(e.target.value)
209
- }}>
210
- <option value="">🔍 Filter</option>
211
- <option value="">All*</option>
212
- {filterableFields?.map(field => (
213
- <option key={field} value={field}>{field}</option>
214
- ))}
215
- </select>
216
- }
217
- {/* {
218
- selectedField && <div>
219
- =
220
- </div>
221
- } */}
222
- {selectedField && (
223
- <select
224
- className=" input borderedInput width-200-max roundEdgeSmall smallInput"
225
- value={selectedValue || ''}
226
- onChange={(e) => {
227
- if(e.target.value === 'clear_all'){
228
- setSelectedField('')
229
- }else{
230
- handleValueChange(e.target.value)
231
- handleChangePage(1)
232
- }
233
- }}
234
- >
235
- <option value="">All*</option>
236
- {uniqueValues.map(item => (
237
- <>
238
- {
239
- item &&
240
- <option key={item} value={item}>
241
- {item.toString()}
242
- </option>
243
- }
244
- </>
245
- ))}
246
- <option value="clear_all">Clear</option>
247
- </select>
248
- )}
249
- </RowFlex>
250
- </div>
251
- :''
252
- }
253
- <>
254
- <RowFlex gap={0.5}>
255
- {
256
- right && right
257
- }
258
- {
259
- !hideExport &&
260
- <Button
261
- small
262
- bold
263
- text='Export'
264
- startIcon={<PiFileCsv />}
265
- color='gradient'
266
- onClick={Export}
267
- />
268
- }
269
- </RowFlex>
270
- </>
271
- </RowFlex>
272
- </div>
273
- }
274
- <main
275
- style={{overflow:"auto" , width:"100%"}}>
276
- <table
277
- className={`table ${bordered ? 'border' : ''} ${
278
- noStripped ? '' : 'stripped'
279
- } ${hoverable ? 'hoverableTr' : ''} ${light ? 'light' : ''} ${dark ? 'dark' : ''}`}
280
- style={{
281
- height: height ? height + "px" : ""
282
- }}
283
- {...rest} >
284
-
285
- { data &&
286
- data?.titles &&
287
- <TableHead>
288
- {
289
- data.titles.map(mdoc => (
290
- <th key={mdoc}>
291
- <Text text={mdoc} weight={500} funcss='text-secondary'/>
292
- </th>
293
- ))
294
- }
295
- </TableHead>
296
- }
297
- {
298
- head && <TableHead>{head}</TableHead>
299
- }
300
- {
301
- body && <TableBody>{body}</TableBody>
302
- }
303
-
304
- { data &&
305
- filteredData.slice(startIndex, endIndex).map((mdoc, index) => (
306
- <TableRow funcss='animated slide-down' rowKey={index} >
307
- {
308
- data.fields.map((fdoc , findex) => (
309
- <TableData key={fdoc} funcss={data.funcss ? data?.funcss?.[findex] || '' : ''}>
310
- {getNestedValue(mdoc, fdoc)}
311
- </TableData>
312
- ))
313
- }
314
- {customColumns ?
315
- customColumns.map((column, columnIndex) => (
316
- <td key={columnIndex}>
317
- {column.render && column.render(mdoc)}
318
- {column.onClick && (
319
- <Button onClick={() => column.onClick && column.onClick(mdoc)}>
320
- {column.title}
321
- </Button>
322
- )}
323
- </td>
324
- )) : ""}
325
- </TableRow>
326
- ))
327
- }
328
- {
329
- isLoading &&
330
- [1,2,3,4,5,6,7,8,9,10].map(() => (
331
- <TableRow funcss='skeleton'/>
332
- ))
333
- }
334
- {children ? children : ''}
335
- </table>
336
- </main>
337
- {
338
- data &&
339
- <>
340
- {
341
- pageSize &&
342
- <>
343
- {
344
- filteredData.length > pageSize &&
345
- <div className="padding bt">
346
- <RowFlex gap={1} justify='center'>
347
-
348
- <div className="pagination">
349
- {Array.from({ length: endPage - startPage + 1 }, (_, i) => (
350
- <Circle
351
- size={2.5}
352
- key={startPage + i}
353
- onClick={() => handleChangePage(startPage + i)}
354
- funcss={currentPage === startPage + i ? 'primary pageCircle' : 'lighter pageCircle text-primary'}
355
- >
356
- <Text text={`${startPage + i}`} bold size='sm'/>
357
- </Circle>
358
- ))}
359
- </div>
360
-
361
- </RowFlex>
362
- </div>
363
- }
364
- </>
365
- }
366
-
367
- </>
368
- }
369
- </div>
370
- );
371
- }
372
-
package/ui/text/Text.tsx DELETED
@@ -1,179 +0,0 @@
1
- import React from 'react';
2
- import { PiQuotesLight } from 'react-icons/pi';
3
-
4
- type TypographyProps = {
5
- id?: string;
6
- text?: React.ReactNode;
7
- funcss?: string;
8
- bg?: string;
9
- color?: string;
10
- hoverBg?: string;
11
- hoverText?: string;
12
- monospace?: boolean;
13
- emp?: boolean;
14
- bold?: boolean;
15
- block?: boolean;
16
- body?: boolean;
17
- article?: boolean;
18
- light?: boolean;
19
- lighter?: boolean;
20
- italic?: boolean;
21
- underline?: boolean;
22
- weight?: number;
23
- quote?: boolean;
24
- align?: "left" | "center" | "right" | "justify";
25
- lineHeight?: string;
26
- letterSpacing?: string;
27
- uppercase?: boolean;
28
- lowercase?: boolean;
29
- capitalize?: boolean;
30
- textDecoration?: "none" | "underline" | "overline" | "line-through";
31
- textTransform?: "none" | "capitalize" | "uppercase" | "lowercase";
32
- whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap";
33
- wordBreak?: "normal" | "break-all" | "keep-all" | "break-word";
34
- fontFamily?: string;
35
- textShadow?: string;
36
- textAlign?: "left" | "center" | "right" | "justify";
37
- opacity?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
38
- zIndex?: number;
39
- truncate?: number;
40
- transform?: string;
41
- customStyles?: React.CSSProperties;
42
- onClick?: () => void;
43
- children?: React.ReactNode;
44
- size?:
45
- | "xs"
46
- | "sm"
47
- | "base"
48
- | "lg"
49
- | "xl"
50
- | "2xl"
51
- | "3xl"
52
- | "4xl"
53
- | "5xl"
54
- | "6xl"
55
- | "7xl"
56
- | "8xl"
57
- | "9xl"
58
- | "h1"
59
- | "h2"
60
- | "h3"
61
- | "h4"
62
- | "h5"
63
- | "h6";
64
- };
65
-
66
- const Text: React.FC<TypographyProps> = ({
67
- id,
68
- bg,
69
- color,
70
- children,
71
- hoverBg,
72
- hoverText,
73
- text,
74
- funcss,
75
- emp,
76
- bold,
77
- block,
78
- body,
79
- article,
80
- light,
81
- lighter,
82
- italic,
83
- weight,
84
- underline,
85
- align,
86
- lineHeight,
87
- letterSpacing,
88
- uppercase,
89
- lowercase,
90
- capitalize,
91
- textDecoration,
92
- textTransform,
93
- whiteSpace,
94
- wordBreak,
95
- fontFamily,
96
- truncate,
97
- textShadow,
98
- textAlign,
99
- customStyles,
100
- monospace,
101
- quote,
102
- opacity,
103
- size = 'base', // default
104
- ...rest
105
- }) => {
106
- const Tag = block ? 'div' : 'span';
107
-
108
- const sizeClass = `${size === 'h1' ? `h1` :
109
- size === 'h2' ? `h2` :
110
- size === 'h3' ? `h3` :
111
- size === 'h4' ? `h4` :
112
- size === 'h5' ? `h5` :
113
- size === 'h6' ? `h6` :
114
- `text-${size}`}`;
115
-
116
- const mergedStyles: React.CSSProperties = {
117
- display: block ? 'block' : undefined,
118
- fontWeight: bold ? 'bold' : weight ? weight : undefined,
119
- lineHeight,
120
- letterSpacing,
121
- textTransform,
122
- textDecoration,
123
- fontFamily,
124
- textShadow,
125
- textAlign,
126
- whiteSpace,
127
- wordBreak,
128
- transform: customStyles?.transform,
129
- ...customStyles,
130
- ...(truncate
131
- ? {
132
- display: '-webkit-box',
133
- WebkitBoxOrient: 'vertical',
134
- WebkitLineClamp: truncate,
135
- overflow: 'hidden',
136
- textOverflow: 'ellipsis',
137
- }
138
- : {}),
139
- };
140
-
141
-
142
- const classNames = [
143
- funcss || '',
144
- sizeClass,
145
- color ? ` text-${color} ` : '',
146
- align ? ` text-${align} ` : '',
147
- monospace ? 'monospace' : '',
148
- bg || '',
149
- hoverText ? `hover-text-${hoverText}` : '',
150
- hoverBg ? `hover-${hoverBg}` : '',
151
- light ? 'lightText' : lighter ? 'lighterText' : '',
152
- italic ? 'italicText' : '',
153
- underline ? 'underlineText' : '',
154
- body ? 'body' : '',
155
- article ? 'article' : '',
156
- emp ? 'emp' : '',
157
- bold ? 'bold' : '',
158
- uppercase ? 'uppercase' : '',
159
- lowercase ? 'lowercase' : '',
160
- capitalize ? 'capitalize' : '',
161
- opacity ? 'opacity-' + opacity : '',
162
- ]
163
- .filter(Boolean)
164
- .join(' ');
165
-
166
- return (
167
- <Tag id={id} className={classNames} style={mergedStyles} {...rest}>
168
- {quote && (
169
- <div>
170
- <PiQuotesLight />
171
- </div>
172
- )}
173
- {children}
174
- {text}
175
- </Tag>
176
- );
177
- };
178
-
179
- export default Text;
package/ui/theme/dark.tsx DELETED
@@ -1,45 +0,0 @@
1
-
2
-
3
- type DarkModeProps = {
4
- state: boolean;
5
- };
6
-
7
- export default function DarkMode({ state }: DarkModeProps) {
8
- if (state) {
9
- const root = document.querySelector(':root') as HTMLElement; // Properly declare the type of root
10
-
11
- const bdColor = "#FFFFFFD9";
12
- let borderColor: string;
13
- let raiseColor: string;
14
-
15
- borderColor = "#444654";
16
- raiseColor = "#1e1e1e";
17
-
18
- root.style.setProperty('--bd-theme', "#141414");
19
- root.style.setProperty('--bd-color', bdColor);
20
- root.style.setProperty('--borderColor', borderColor);
21
- root.style.setProperty('--raiseThemes', raiseColor);
22
- root.style.setProperty('--lighter', "#33333349");
23
- root.style.setProperty('--inputOutline', "#1e1e1e");
24
- root.style.setProperty('--lightThemeDark', bdColor);
25
-
26
- // Dark theme for all the colors
27
- root.style.setProperty('--success', "#1d6640");
28
- root.style.setProperty('--successLight', " #c7e6c8");
29
-
30
- root.style.setProperty('--info', "#2471a3");
31
- root.style.setProperty('--infoLight', "#b3d9ed");
32
-
33
- root.style.setProperty('--warning', "#8c3d00");
34
- root.style.setProperty('--warningLight', "#d8b69c");
35
-
36
- root.style.setProperty('--danger', "#6b0600");
37
- root.style.setProperty('--dangerLight', "#bfbfbf");
38
-
39
- // root.style.setProperty('--info', "#2471a3");
40
- // root.style.setProperty('--infoLight', "#b3d9ed");
41
-
42
- root.style.setProperty('--light', "#c5d8e0");
43
- root.style.setProperty('--deepLight', "#154556");
44
- }
45
- }
@@ -1,15 +0,0 @@
1
- import tinycolor from 'tinycolor2';
2
-
3
- export const getDarkenAmount = (variable: string): number => {
4
- if (variable.includes('50')) return 5;
5
- if (variable.includes('100')) return 10;
6
- if (variable.includes('200')) return 15;
7
- if (variable.includes('300')) return 20;
8
- if (variable.includes('400')) return 25;
9
- return 20;
10
- };
11
-
12
- export const darkenToRgba = (hex: string, darkenAmount: number, alpha = 1): string => {
13
- const color = tinycolor(hex).darken(darkenAmount).toRgb();
14
- return `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
15
- };
@@ -1,48 +0,0 @@
1
- 'use client';
2
- import React, { useEffect } from 'react';
3
- import { colorVarsToDarken, themes } from './themes';
4
- import { getDarkenAmount, darkenToRgba } from './darkenUtils';
5
-
6
- interface ThemeProviderProps {
7
- theme: 'light' | 'dark' | 'dark-blue' | 'light-gray' | 'pastel-green' | 'warm-orange' | 'frosted-glass' | 'midnight-purple' | 'cyber-metal';
8
- children: React.ReactNode;
9
- }
10
-
11
- const ThemeProvider: React.FC<ThemeProviderProps> = ({ theme, children }) => {
12
- useEffect(() => {
13
- const root = document.documentElement;
14
- const selectedTheme = themes[theme] || themes.light;
15
-
16
- // Apply selected theme variables
17
- Object.entries(selectedTheme).forEach(([key, value]) => {
18
- root.style.setProperty(key, value);
19
- });
20
-
21
- // Apply darkened RGBA versions (for dark themes only)
22
- if (theme === 'dark' || theme === 'dark-blue' || theme === 'midnight-purple' || theme === 'cyber-metal') {
23
- colorVarsToDarken.forEach((varName) => {
24
- const original = getComputedStyle(root).getPropertyValue(varName).trim();
25
- if (original) {
26
- const darkAmount = getDarkenAmount(varName);
27
- const rgba = darkenToRgba(original, darkAmount, 0.9);
28
- root.style.setProperty(varName, rgba);
29
- }
30
- });
31
- }
32
- }, [theme]);
33
-
34
- return (
35
- <div
36
- className={`theme-${theme}`}
37
- style={{
38
- backgroundColor: 'var(--page-bg)',
39
- color: 'var(--text-color)',
40
- minHeight: '100vh',
41
- }}
42
- >
43
- {children}
44
- </div>
45
- );
46
- };
47
-
48
- export default ThemeProvider;