funuicss 3.8.1 → 3.8.3
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/css/fun.css +197 -196
- package/package.json +1 -1
- package/ui/accordion/Accordion.d.ts +56 -13
- package/ui/accordion/Accordion.js +449 -25
- package/ui/appbar/AppBar.d.ts +1 -0
- package/ui/appbar/AppBar.js +2 -2
- package/ui/empty/Empty.d.ts +3 -3
- package/ui/flex/Flex.d.ts +1 -1
- package/ui/notification/Notification.d.ts +69 -12
- package/ui/notification/Notification.js +408 -19
- package/ui/table/Table.d.ts +4 -0
- package/ui/table/Table.js +14 -16
- package/ui/theme/theme.js +1177 -85
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
3
14
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
15
|
if (k2 === undefined) k2 = k;
|
|
5
16
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -42,44 +53,457 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
42
53
|
}
|
|
43
54
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
55
|
};
|
|
45
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
-
};
|
|
48
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.AccordionItem = void 0;
|
|
50
57
|
var react_1 = __importStar(require("react"));
|
|
58
|
+
var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
59
|
+
var componentUtils_1 = require("../../utils/componentUtils");
|
|
60
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
51
61
|
var pi_1 = require("react-icons/pi");
|
|
52
|
-
|
|
62
|
+
// Custom hook for dynamic icons
|
|
63
|
+
var useDynamicIcon = function (iconString) {
|
|
64
|
+
var _a = (0, react_1.useState)(null), iconNode = _a[0], setIconNode = _a[1];
|
|
65
|
+
var _b = (0, react_1.useState)(false), hasValidIcon = _b[0], setHasValidIcon = _b[1];
|
|
66
|
+
(0, react_1.useEffect)(function () {
|
|
67
|
+
if (!iconString || typeof iconString !== 'string' || iconString.trim() === '') {
|
|
68
|
+
setIconNode(null);
|
|
69
|
+
setHasValidIcon(false);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
(0, getDynamicIcon_1.getDynamicIcon)(iconString).then(function (node) {
|
|
73
|
+
if (node) {
|
|
74
|
+
setIconNode(node);
|
|
75
|
+
setHasValidIcon(true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
setIconNode(null);
|
|
79
|
+
setHasValidIcon(false);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}, [iconString]);
|
|
83
|
+
return { iconNode: iconNode, hasValidIcon: hasValidIcon };
|
|
84
|
+
};
|
|
85
|
+
// Icon component with dynamic icon support
|
|
86
|
+
var AccordionIcon = function (_a) {
|
|
87
|
+
var icon = _a.icon, iconColor = _a.iconColor, _b = _a.iconSize, iconSize = _b === void 0 ? 15 : _b, _c = _a.iconClassName, iconClassName = _c === void 0 ? '' : _c, _d = _a.isExpandIcon, isExpandIcon = _d === void 0 ? false : _d, expandIcon = _a.expandIcon, expandIconColor = _a.expandIconColor, _e = _a.expandIconSize, expandIconSize = _e === void 0 ? 15 : _e, _f = _a.expandIconClassName, expandIconClassName = _f === void 0 ? '' : _f, _g = _a.isOpen, isOpen = _g === void 0 ? false : _g, _h = _a.rotate, rotate = _h === void 0 ? true : _h;
|
|
88
|
+
var iconToUse = isExpandIcon ? expandIcon : icon;
|
|
89
|
+
var colorToUse = isExpandIcon ? expandIconColor : iconColor;
|
|
90
|
+
var sizeToUse = isExpandIcon ? expandIconSize : iconSize;
|
|
91
|
+
var classNameToUse = isExpandIcon ? expandIconClassName : iconClassName;
|
|
92
|
+
// Handle string icons (dynamic)
|
|
93
|
+
var isStringIcon = iconToUse && typeof iconToUse === 'string';
|
|
94
|
+
var _j = useDynamicIcon(isStringIcon ? iconToUse : undefined), dynamicIconNode = _j.iconNode, hasValidDynamicIcon = _j.hasValidIcon;
|
|
95
|
+
// Get color class from color name
|
|
96
|
+
var getColorClass = function (color) {
|
|
97
|
+
if (!color)
|
|
98
|
+
return '';
|
|
99
|
+
if (color.startsWith('text-') || color.startsWith('bg-') || color.startsWith('border-')) {
|
|
100
|
+
return color;
|
|
101
|
+
}
|
|
102
|
+
var colorNames = ['primary', 'secondary', 'accent', 'success', 'warning', 'error', 'info', 'dark', 'light'];
|
|
103
|
+
if (colorNames.includes(color)) {
|
|
104
|
+
return "text-".concat(color);
|
|
105
|
+
}
|
|
106
|
+
return '';
|
|
107
|
+
};
|
|
108
|
+
var colorClass = getColorClass(colorToUse);
|
|
109
|
+
var renderIconWithProps = function (iconElement, className, size) {
|
|
110
|
+
if (!react_1.default.isValidElement(iconElement))
|
|
111
|
+
return iconElement;
|
|
112
|
+
var props = {
|
|
113
|
+
className: "".concat(className, " ").concat(colorClass).trim(),
|
|
114
|
+
};
|
|
115
|
+
if (size !== undefined) {
|
|
116
|
+
props.size = size;
|
|
117
|
+
}
|
|
118
|
+
return react_1.default.cloneElement(iconElement, props);
|
|
119
|
+
};
|
|
120
|
+
// If it's a React element icon
|
|
121
|
+
if (iconToUse && typeof iconToUse !== 'string' && react_1.default.isValidElement(iconToUse)) {
|
|
122
|
+
return renderIconWithProps(iconToUse, "".concat(isExpandIcon ? 'accordion-expand-icon' : 'accordion-icon', " ").concat(classNameToUse, " ").concat(isOpen && rotate ? 'accordion-rotated' : '').trim(), sizeToUse);
|
|
123
|
+
}
|
|
124
|
+
// If it's a string icon (dynamic)
|
|
125
|
+
if (isStringIcon && hasValidDynamicIcon && dynamicIconNode) {
|
|
126
|
+
return renderIconWithProps(dynamicIconNode, "".concat(isExpandIcon ? 'accordion-expand-icon' : 'accordion-icon', " ").concat(classNameToUse, " ").concat(isOpen && rotate ? 'accordion-rotated' : '').trim(), sizeToUse);
|
|
127
|
+
}
|
|
128
|
+
// Default expand icon (PiCaretDown)
|
|
129
|
+
if (isExpandIcon && !iconToUse) {
|
|
130
|
+
return (react_1.default.createElement(pi_1.PiCaretDown, { className: "accordion-expand-icon ".concat(expandIconClassName || '', " ").concat(colorClass, " ").concat(isOpen && rotate ? 'accordion-rotated' : '').trim(), style: {
|
|
131
|
+
fontSize: expandIconSize,
|
|
132
|
+
transition: 'transform 0.3s ease',
|
|
133
|
+
} }));
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
};
|
|
137
|
+
// Accordion Item Component
|
|
53
138
|
var AccordionItem = function (_a) {
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
139
|
+
var item = _a.item, index = _a.index, isOpen = _a.isOpen, onToggle = _a.onToggle, globalProps = _a.globalProps, _b = _a.animationDuration, animationDuration = _b === void 0 ? 300 : _b, _c = _a.animationEasing, animationEasing = _c === void 0 ? 'ease' : _c;
|
|
140
|
+
// Merge item props with global props (item props take precedence)
|
|
141
|
+
var mergedProps = __assign(__assign({}, globalProps), item);
|
|
142
|
+
var itemClass = mergedProps.itemClass, titleClass = mergedProps.titleClass, iconClass = mergedProps.iconClass, contentClass = mergedProps.contentClass, activeClass = mergedProps.activeClass, icon = mergedProps.icon, iconColor = mergedProps.iconColor, iconSize = mergedProps.iconSize, iconClassName = mergedProps.iconClassName, _d = mergedProps.iconPosition, iconPosition = _d === void 0 ? 'left' : _d, expandIcon = mergedProps.expandIcon, expandIconColor = mergedProps.expandIconColor, expandIconSize = mergedProps.expandIconSize, expandIconClassName = mergedProps.expandIconClassName, _e = mergedProps.expandIconRotate, expandIconRotate = _e === void 0 ? true : _e, titleSize = mergedProps.titleSize, titleWeight = mergedProps.titleWeight, titleColor = mergedProps.titleColor, contentSize = mergedProps.contentSize, contentWeight = mergedProps.contentWeight, contentColor = mergedProps.contentColor, disabled = mergedProps.disabled, customRender = mergedProps.customRender;
|
|
143
|
+
// Get background class from color name
|
|
144
|
+
var getBgClass = function (color) {
|
|
145
|
+
if (!color)
|
|
146
|
+
return '';
|
|
147
|
+
if (color.startsWith('bg-')) {
|
|
148
|
+
return color;
|
|
149
|
+
}
|
|
150
|
+
var colorNames = ['primary', 'secondary', 'accent', 'success', 'warning', 'error', 'info', 'dark', 'light'];
|
|
151
|
+
if (colorNames.includes(color)) {
|
|
152
|
+
return "bg-".concat(color);
|
|
153
|
+
}
|
|
154
|
+
return '';
|
|
155
|
+
};
|
|
156
|
+
// Get border class from color name
|
|
157
|
+
var getBorderClass = function (color) {
|
|
158
|
+
if (!color)
|
|
159
|
+
return '';
|
|
160
|
+
if (color.startsWith('border-')) {
|
|
161
|
+
return color;
|
|
162
|
+
}
|
|
163
|
+
var colorNames = ['primary', 'secondary', 'accent', 'success', 'warning', 'error', 'info', 'dark', 'light'];
|
|
164
|
+
if (colorNames.includes(color)) {
|
|
165
|
+
return "border-".concat(color);
|
|
166
|
+
}
|
|
167
|
+
// Special handling for borderColor
|
|
168
|
+
if (color === 'borderColor') {
|
|
169
|
+
return 'border-default';
|
|
170
|
+
}
|
|
171
|
+
return '';
|
|
172
|
+
};
|
|
173
|
+
// Get text size class
|
|
174
|
+
var getTextSizeClass = function (size) {
|
|
175
|
+
if (!size)
|
|
176
|
+
return 'text-sm';
|
|
177
|
+
if (size.startsWith('text-')) {
|
|
178
|
+
return size;
|
|
179
|
+
}
|
|
180
|
+
var validSizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'];
|
|
181
|
+
if (validSizes.includes(size)) {
|
|
182
|
+
return "text-".concat(size);
|
|
183
|
+
}
|
|
184
|
+
return 'text-sm';
|
|
185
|
+
};
|
|
186
|
+
// Get text color class
|
|
187
|
+
var getTextColorClass = function (color) {
|
|
188
|
+
if (!color)
|
|
189
|
+
return 'text-default';
|
|
190
|
+
if (color.startsWith('text-')) {
|
|
191
|
+
return color;
|
|
192
|
+
}
|
|
193
|
+
var colorNames = ['primary', 'secondary', 'accent', 'success', 'warning', 'error', 'info', 'dark', 'light', 'default', 'muted'];
|
|
194
|
+
if (colorNames.includes(color)) {
|
|
195
|
+
return "text-".concat(color);
|
|
196
|
+
}
|
|
197
|
+
return 'text-default';
|
|
198
|
+
};
|
|
199
|
+
var getSpacingValue = function (value) {
|
|
200
|
+
if (!value)
|
|
201
|
+
return '';
|
|
202
|
+
if (/^\d+$/.test(value)) {
|
|
203
|
+
return "".concat(parseInt(value) * 0.25, "rem");
|
|
204
|
+
}
|
|
205
|
+
return value;
|
|
206
|
+
};
|
|
207
|
+
if (customRender) {
|
|
208
|
+
return customRender(isOpen);
|
|
209
|
+
}
|
|
210
|
+
var titleContent = typeof item.title === 'string' ? (react_1.default.createElement("div", { className: "\n ".concat(getTextSizeClass(titleSize), " \n ").concat(getTextColorClass(titleColor), "\n ").concat(titleClass || '', "\n ").trim(), style: {
|
|
211
|
+
fontWeight: titleWeight || 400,
|
|
212
|
+
} }, item.title)) : item.title;
|
|
213
|
+
// Get container classes
|
|
214
|
+
var getContainerClasses = function () {
|
|
215
|
+
var classes = ['accordion-item'];
|
|
216
|
+
// Background
|
|
217
|
+
if (globalProps.bg) {
|
|
218
|
+
var bgClass = getBgClass(globalProps.bg);
|
|
219
|
+
if (bgClass) {
|
|
220
|
+
classes.push(bgClass);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// Border
|
|
224
|
+
if (globalProps.border) {
|
|
225
|
+
classes.push('border');
|
|
226
|
+
var borderClass = getBorderClass(globalProps.borderColor);
|
|
227
|
+
if (borderClass) {
|
|
228
|
+
classes.push(borderClass);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Border radius
|
|
232
|
+
if (globalProps.borderRadius) {
|
|
233
|
+
var radius = getSpacingValue(globalProps.borderRadius);
|
|
234
|
+
if (radius === '0.25rem')
|
|
235
|
+
classes.push('rounded-sm');
|
|
236
|
+
else if (radius === '0.5rem')
|
|
237
|
+
classes.push('rounded-md');
|
|
238
|
+
else if (radius === '0.75rem')
|
|
239
|
+
classes.push('rounded-lg');
|
|
240
|
+
else if (radius === '1rem')
|
|
241
|
+
classes.push('rounded-xl');
|
|
242
|
+
}
|
|
243
|
+
// Shadow
|
|
244
|
+
if (globalProps.shadow && globalProps.shadow !== 'none') {
|
|
245
|
+
classes.push("shadow-".concat(globalProps.shadow));
|
|
246
|
+
}
|
|
247
|
+
// State classes
|
|
248
|
+
if (isOpen) {
|
|
249
|
+
classes.push(activeClass || 'active');
|
|
250
|
+
}
|
|
251
|
+
if (disabled) {
|
|
252
|
+
classes.push('disabled');
|
|
253
|
+
}
|
|
254
|
+
// Custom classes
|
|
255
|
+
if (itemClass) {
|
|
256
|
+
classes.push(itemClass);
|
|
257
|
+
}
|
|
258
|
+
return classes.filter(Boolean).join(' ');
|
|
259
|
+
};
|
|
260
|
+
return (react_1.default.createElement("div", { className: getContainerClasses(), style: {
|
|
261
|
+
marginBottom: getSpacingValue(globalProps.gap) || '0.5rem',
|
|
262
|
+
overflow: 'hidden', // Add overflow hidden to prevent content overflow
|
|
263
|
+
} },
|
|
264
|
+
react_1.default.createElement("div", { className: "accordion-header ".concat(titleClass || ''), onClick: !disabled ? function () { return onToggle(index); } : undefined, role: "button", tabIndex: disabled ? -1 : 0, "aria-expanded": isOpen, onKeyDown: function (e) {
|
|
265
|
+
if (!disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
onToggle(index);
|
|
268
|
+
}
|
|
269
|
+
}, style: {
|
|
270
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
271
|
+
opacity: disabled ? 0.6 : 1,
|
|
272
|
+
padding: getSpacingValue(globalProps.padding) || '0',
|
|
273
|
+
display: 'flex',
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
justifyContent: 'space-between',
|
|
276
|
+
} },
|
|
277
|
+
react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '0.5rem', flex: 1 } },
|
|
278
|
+
iconPosition === 'left' && (react_1.default.createElement(AccordionIcon, { icon: icon, iconColor: iconColor, iconSize: iconSize, iconClassName: iconClass || iconClassName, isOpen: isOpen })),
|
|
279
|
+
react_1.default.createElement("div", { className: "col", style: { flex: 1 } }, titleContent),
|
|
280
|
+
iconPosition === 'right' && (react_1.default.createElement(AccordionIcon, { icon: icon, iconColor: iconColor, iconSize: iconSize, iconClassName: iconClass || iconClassName, isOpen: isOpen }))),
|
|
281
|
+
react_1.default.createElement("div", { style: { lineHeight: 0 } },
|
|
282
|
+
react_1.default.createElement(AccordionIcon, { isExpandIcon: true, expandIcon: expandIcon, expandIconColor: expandIconColor, expandIconSize: expandIconSize, expandIconClassName: expandIconClassName, isOpen: isOpen, rotate: expandIconRotate }))),
|
|
283
|
+
react_1.default.createElement("div", { className: "accordion-content ".concat(contentClass || '', " ").concat(isOpen ? 'open' : ''), style: {
|
|
284
|
+
maxHeight: isOpen ? '10000px' : '0',
|
|
285
|
+
overflow: 'hidden',
|
|
286
|
+
transition: "max-height ".concat(animationDuration, "ms ").concat(animationEasing),
|
|
287
|
+
padding: isOpen ? getSpacingValue(globalProps.padding) || '0.5rem 0' : '0',
|
|
288
|
+
backgroundColor: globalProps.contentBg ? getBgClass(globalProps.contentBg) : '',
|
|
289
|
+
borderTop: isOpen && globalProps.border ? "1px solid ".concat((0, getCssVariable_1.getCssVariableValue)(globalProps.borderColor) || 'var(--borderColor)') : 'none',
|
|
290
|
+
} },
|
|
291
|
+
react_1.default.createElement("div", { className: "\n accordion-inner\n ".concat(getTextSizeClass(contentSize), "\n ").concat(getTextColorClass(contentColor), "\n ").trim(), style: {
|
|
292
|
+
opacity: isOpen ? 1 : 0,
|
|
293
|
+
transition: "opacity ".concat(animationDuration, "ms ").concat(animationEasing),
|
|
294
|
+
fontWeight: contentWeight || 400,
|
|
295
|
+
lineHeight: 1.6,
|
|
296
|
+
} }, item.content))));
|
|
64
297
|
};
|
|
65
|
-
|
|
66
|
-
var Accordion = function (
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
var
|
|
298
|
+
// Main Accordion Component
|
|
299
|
+
var Accordion = function (localProps) {
|
|
300
|
+
// Merge props with configuration
|
|
301
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Accordion', localProps.variant).mergeWithLocal;
|
|
302
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
303
|
+
var final = mergedProps;
|
|
304
|
+
var _a = (0, react_1.useState)([]), openIndexes = _a[0], setOpenIndexes = _a[1];
|
|
305
|
+
var _b = (0, react_1.useState)([]), itemsArray = _b[0], setItemsArray = _b[1];
|
|
306
|
+
// Parse items from JSON string if needed
|
|
307
|
+
(0, react_1.useEffect)(function () {
|
|
308
|
+
if (typeof final.items === 'string') {
|
|
309
|
+
try {
|
|
310
|
+
var parsed = JSON.parse(final.items);
|
|
311
|
+
setItemsArray(Array.isArray(parsed) ? parsed : [parsed]);
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
console.error('Error parsing items JSON:', error);
|
|
315
|
+
setItemsArray([]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (Array.isArray(final.items)) {
|
|
319
|
+
setItemsArray(final.items);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
setItemsArray([]);
|
|
323
|
+
}
|
|
324
|
+
}, [final.items]);
|
|
325
|
+
// Initialize open indexes
|
|
326
|
+
(0, react_1.useEffect)(function () {
|
|
327
|
+
if (final.allowMultiple) {
|
|
328
|
+
setOpenIndexes(final.defaultOpenIndexes || []);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
setOpenIndexes(final.defaultOpenIndexes && final.defaultOpenIndexes.length > 0
|
|
332
|
+
? [final.defaultOpenIndexes[0]]
|
|
333
|
+
: []);
|
|
334
|
+
}
|
|
335
|
+
}, [final.defaultOpenIndexes, final.allowMultiple]);
|
|
70
336
|
var toggleIndex = function (index) {
|
|
71
|
-
|
|
337
|
+
var newOpenIndexes = [];
|
|
338
|
+
if (final.allowMultiple) {
|
|
72
339
|
if (openIndexes.includes(index)) {
|
|
73
|
-
|
|
340
|
+
newOpenIndexes = openIndexes.filter(function (i) { return i !== index; });
|
|
74
341
|
}
|
|
75
342
|
else {
|
|
76
|
-
|
|
343
|
+
newOpenIndexes = __spreadArray(__spreadArray([], openIndexes, true), [index], false);
|
|
77
344
|
}
|
|
78
345
|
}
|
|
79
346
|
else {
|
|
80
|
-
|
|
347
|
+
newOpenIndexes = openIndexes.includes(index) ? [] : [index];
|
|
348
|
+
}
|
|
349
|
+
setOpenIndexes(newOpenIndexes);
|
|
350
|
+
// Call callback if provided
|
|
351
|
+
if (final.onItemToggle) {
|
|
352
|
+
final.onItemToggle(index, !openIndexes.includes(index));
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var getContainerClasses = function () {
|
|
356
|
+
var classes = ['accordion'];
|
|
357
|
+
if (final.className) {
|
|
358
|
+
classes.push(final.className);
|
|
81
359
|
}
|
|
360
|
+
if (final.funcss) {
|
|
361
|
+
classes.push(final.funcss);
|
|
362
|
+
}
|
|
363
|
+
return classes.filter(Boolean).join(' ');
|
|
364
|
+
};
|
|
365
|
+
var getContainerStyles = function () {
|
|
366
|
+
var styles = {};
|
|
367
|
+
if (final.margin) {
|
|
368
|
+
var marginValue = getSpacingValue(final.margin);
|
|
369
|
+
if (marginValue) {
|
|
370
|
+
styles.margin = marginValue;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (final.style) {
|
|
374
|
+
Object.assign(styles, final.style);
|
|
375
|
+
}
|
|
376
|
+
return styles;
|
|
377
|
+
};
|
|
378
|
+
var getSpacingValue = function (value) {
|
|
379
|
+
if (!value)
|
|
380
|
+
return '';
|
|
381
|
+
if (/^\d+$/.test(value)) {
|
|
382
|
+
return "".concat(parseInt(value) * 0.25, "rem");
|
|
383
|
+
}
|
|
384
|
+
return value;
|
|
82
385
|
};
|
|
83
|
-
|
|
386
|
+
if (itemsArray.length === 0) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
return (react_1.default.createElement("div", { className: getContainerClasses(), style: getContainerStyles() }, itemsArray.map(function (item, index) { return (react_1.default.createElement(AccordionItem, { key: index, item: item, index: index, isOpen: openIndexes.includes(index), onToggle: toggleIndex, globalProps: final, animationDuration: final.animationDuration, animationEasing: final.animationEasing })); })));
|
|
84
390
|
};
|
|
85
391
|
exports.default = Accordion;
|
|
392
|
+
// 'use client';
|
|
393
|
+
// import React, { useState } from 'react';
|
|
394
|
+
// import { PiCaretDown } from 'react-icons/pi';
|
|
395
|
+
// import RowFlex from '../specials/RowFlex';
|
|
396
|
+
// export type AccordionItemProps = {
|
|
397
|
+
// title: string;
|
|
398
|
+
// content: React.ReactNode;
|
|
399
|
+
// isOpen?: boolean;
|
|
400
|
+
// onToggle?: () => void;
|
|
401
|
+
// index?: number;
|
|
402
|
+
// icon?: React.ReactNode;
|
|
403
|
+
// // Customization
|
|
404
|
+
// itemClass?: string;
|
|
405
|
+
// titleClass?: string;
|
|
406
|
+
// iconClass?: string;
|
|
407
|
+
// contentClass?: string;
|
|
408
|
+
// activeClass?: string;
|
|
409
|
+
// };
|
|
410
|
+
// export const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
411
|
+
// icon,
|
|
412
|
+
// title,
|
|
413
|
+
// content,
|
|
414
|
+
// isOpen,
|
|
415
|
+
// onToggle,
|
|
416
|
+
// itemClass = '',
|
|
417
|
+
// titleClass = '',
|
|
418
|
+
// iconClass = '',
|
|
419
|
+
// contentClass = '',
|
|
420
|
+
// activeClass = '',
|
|
421
|
+
// }) => {
|
|
422
|
+
// return (
|
|
423
|
+
// <div className={`accordion-item ${itemClass} ${isOpen ? activeClass : ''}`}>
|
|
424
|
+
// <div
|
|
425
|
+
// className={`accordion-header ${titleClass}`}
|
|
426
|
+
// onClick={onToggle}
|
|
427
|
+
// role="button"
|
|
428
|
+
// aria-expanded={isOpen}
|
|
429
|
+
// >
|
|
430
|
+
// <RowFlex alignItems="center" gap={0.6}>
|
|
431
|
+
// {icon && <div style={{ lineHeight: 0 }}>{icon}</div>}
|
|
432
|
+
// <div className="col fit">{title}</div>
|
|
433
|
+
// </RowFlex>
|
|
434
|
+
// <div
|
|
435
|
+
// style={{ lineHeight: 0 }}
|
|
436
|
+
// className={`${iconClass} ${isOpen ? 'accordion-rotated' : ''}`}
|
|
437
|
+
// >
|
|
438
|
+
// <PiCaretDown />
|
|
439
|
+
// </div>
|
|
440
|
+
// </div>
|
|
441
|
+
// <div style={{overflow:isOpen?'visible':'hidden'}} className={`accordion-content ${contentClass} ${isOpen ? 'open' : ''}`}>
|
|
442
|
+
// <div className="accordion-inner">{content}</div>
|
|
443
|
+
// </div>
|
|
444
|
+
// </div>
|
|
445
|
+
// );
|
|
446
|
+
// };
|
|
447
|
+
// export type AccordionProps = {
|
|
448
|
+
// items: {
|
|
449
|
+
// title: string;
|
|
450
|
+
// content: React.ReactNode;
|
|
451
|
+
// icon?: React.ReactNode;
|
|
452
|
+
// }[];
|
|
453
|
+
// allowMultiple?: boolean;
|
|
454
|
+
// defaultOpenIndexes?: number[];
|
|
455
|
+
// // Custom styles
|
|
456
|
+
// itemClass?: string;
|
|
457
|
+
// titleClass?: string;
|
|
458
|
+
// iconClass?: string;
|
|
459
|
+
// contentClass?: string;
|
|
460
|
+
// activeClass?: string;
|
|
461
|
+
// funcss?: string;
|
|
462
|
+
// };
|
|
463
|
+
// const Accordion: React.FC<AccordionProps> = ({
|
|
464
|
+
// items,
|
|
465
|
+
// allowMultiple = false,
|
|
466
|
+
// defaultOpenIndexes = [],
|
|
467
|
+
// itemClass,
|
|
468
|
+
// titleClass,
|
|
469
|
+
// iconClass,
|
|
470
|
+
// contentClass,
|
|
471
|
+
// activeClass,
|
|
472
|
+
// funcss = '',
|
|
473
|
+
// }) => {
|
|
474
|
+
// const [openIndexes, setOpenIndexes] = useState<number[]>(
|
|
475
|
+
// allowMultiple ? defaultOpenIndexes : [defaultOpenIndexes[0] ?? -1]
|
|
476
|
+
// );
|
|
477
|
+
// const toggleIndex = (index: number) => {
|
|
478
|
+
// if (allowMultiple) {
|
|
479
|
+
// if (openIndexes.includes(index)) {
|
|
480
|
+
// setOpenIndexes(openIndexes.filter((i) => i !== index));
|
|
481
|
+
// } else {
|
|
482
|
+
// setOpenIndexes([...openIndexes, index]);
|
|
483
|
+
// }
|
|
484
|
+
// } else {
|
|
485
|
+
// setOpenIndexes(openIndexes.includes(index) ? [] : [index]);
|
|
486
|
+
// }
|
|
487
|
+
// };
|
|
488
|
+
// return (
|
|
489
|
+
// <div className={`accordion ${funcss}`}>
|
|
490
|
+
// {items.map((item, index) => (
|
|
491
|
+
// <AccordionItem
|
|
492
|
+
// key={index}
|
|
493
|
+
// index={index}
|
|
494
|
+
// icon={item.icon}
|
|
495
|
+
// title={item.title}
|
|
496
|
+
// content={item.content}
|
|
497
|
+
// isOpen={openIndexes.includes(index)}
|
|
498
|
+
// onToggle={() => toggleIndex(index)}
|
|
499
|
+
// itemClass={itemClass}
|
|
500
|
+
// titleClass={titleClass}
|
|
501
|
+
// iconClass={iconClass}
|
|
502
|
+
// contentClass={contentClass}
|
|
503
|
+
// activeClass={activeClass}
|
|
504
|
+
// />
|
|
505
|
+
// ))}
|
|
506
|
+
// </div>
|
|
507
|
+
// );
|
|
508
|
+
// };
|
|
509
|
+
// export default Accordion;
|
package/ui/appbar/AppBar.d.ts
CHANGED
package/ui/appbar/AppBar.js
CHANGED
|
@@ -85,7 +85,7 @@ var DropdownArrow = function (_a) {
|
|
|
85
85
|
};
|
|
86
86
|
// Link Item Component with Dropdown Support
|
|
87
87
|
var LinkItem = function (_a) {
|
|
88
|
-
var link = _a.link, renderLink = _a.renderLink, _b = _a.linkPadding, linkPadding = _b === void 0 ? '
|
|
88
|
+
var link = _a.link, renderLink = _a.renderLink, _b = _a.linkPadding, linkPadding = _b === void 0 ? '' : _b, _c = _a.activeLinkColor, activeLinkColor = _c === void 0 ? 'primary' : _c, _d = _a.dropdownArrow, dropdownArrow = _d === void 0 ? true : _d, _e = _a.isMobile, isMobile = _e === void 0 ? false : _e;
|
|
89
89
|
var _f = (0, react_1.useState)(false), isOpen = _f[0], setIsOpen = _f[1];
|
|
90
90
|
var _g = (0, react_1.useState)(null), iconNode = _g[0], setIconNode = _g[1];
|
|
91
91
|
var timeoutRef = (0, react_1.useRef)();
|
|
@@ -271,7 +271,7 @@ function AppBar(localProps) {
|
|
|
271
271
|
React.createElement(NavLinks, { links: allLinks, renderLink: final.renderLink, linkGap: "0.5rem", linkPadding: "1rem", activeLinkColor: final.activeLinkColor, dropdownArrow: final.dropdownArrow, isMobile: true })));
|
|
272
272
|
};
|
|
273
273
|
return (React.createElement(React.Fragment, null,
|
|
274
|
-
React.createElement("nav", { id: 'appBar', className: "navigation-bar\n ".concat(isMobileMenuOpen ? 'navbar-mobile-open' : '', "\n ").concat(final.funcss || '', "\n ").concat(final.fixedTop ? 'fixed_top_navbar' : '', "\n ").concat(final.sideBar ? 'there_is_sidebar' : '', "\n ").concat(final.transparent ? 'transparent' : '', "\n ").concat(final.fixedBottom ? 'fixedBottom' : '', "\n "), style: {
|
|
274
|
+
React.createElement("nav", { id: 'appBar', className: "navigation-bar\n ".concat(isMobileMenuOpen ? 'navbar-mobile-open' : '', "\n ").concat(final.funcss || '', "\n ").concat(final.testing ? "" : final.fixedTop ? 'fixed_top_navbar' : '', "\n ").concat(final.sideBar ? 'there_is_sidebar' : '', "\n ").concat(final.transparent ? 'transparent' : '', "\n ").concat(final.fixedBottom ? 'fixedBottom' : '', "\n "), style: {
|
|
275
275
|
padding: "".concat(final.padding || ''),
|
|
276
276
|
justifyContent: "".concat(final.justify || ''),
|
|
277
277
|
} },
|
package/ui/empty/Empty.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface EmptyProps {
|
|
3
|
-
header?: React.ReactNode;
|
|
4
|
-
title?: string;
|
|
3
|
+
header?: React.ReactNode | String;
|
|
4
|
+
title?: string | React.ReactNode;
|
|
5
5
|
titleSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
6
6
|
content?: React.ReactNode;
|
|
7
|
-
description?: string;
|
|
7
|
+
description?: string | React.ReactNode;
|
|
8
8
|
descriptionSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
9
|
action?: React.ReactNode;
|
|
10
10
|
ctaText?: string;
|
package/ui/flex/Flex.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface FlexProps {
|
|
|
10
10
|
justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
11
11
|
alignItems?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline';
|
|
12
12
|
alignContent?: 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around';
|
|
13
|
-
gap?: number;
|
|
13
|
+
gap?: number | string;
|
|
14
14
|
gapX?: number;
|
|
15
15
|
gapY?: number;
|
|
16
16
|
gapUnit?: 'rem' | 'px' | 'em';
|
|
@@ -1,19 +1,76 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type NotificationProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
variant?: string;
|
|
4
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
5
|
+
state?: boolean;
|
|
6
|
+
setOpen?: (state: boolean) => void;
|
|
7
|
+
animation?: 'fadeIn' | 'slideIn' | 'scale' | 'bounce' | 'none';
|
|
6
8
|
duration?: number;
|
|
7
9
|
autoHide?: boolean;
|
|
8
10
|
autoHideDuration?: number;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
avatarUrl?: string;
|
|
12
|
+
avatarAlt?: string;
|
|
13
|
+
avatarSize?: number;
|
|
14
|
+
avatarClassName?: string;
|
|
15
|
+
avatarRounded?: string;
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
titleSize?: string;
|
|
18
|
+
titleWeight?: number;
|
|
19
|
+
titleColor?: string;
|
|
20
|
+
titleClassName?: string;
|
|
21
|
+
titleVariant?: string;
|
|
22
|
+
subtitle?: React.ReactNode;
|
|
23
|
+
subtitleSize?: string;
|
|
24
|
+
subtitleWeight?: number;
|
|
25
|
+
subtitleColor?: string;
|
|
26
|
+
subtitleClassName?: string;
|
|
27
|
+
subtitleVariant?: string;
|
|
28
|
+
timestamp?: string;
|
|
29
|
+
timestampSize?: string;
|
|
30
|
+
timestampColor?: string;
|
|
31
|
+
timestampClassName?: string;
|
|
32
|
+
icon?: string | React.ReactNode;
|
|
33
|
+
iconColor?: string;
|
|
34
|
+
iconSize?: number;
|
|
35
|
+
iconClassName?: string;
|
|
36
|
+
iconPosition?: 'left' | 'right';
|
|
14
37
|
content?: React.ReactNode;
|
|
15
|
-
|
|
38
|
+
contentSize?: string;
|
|
39
|
+
contentWeight?: number;
|
|
40
|
+
contentColor?: string;
|
|
41
|
+
contentClassName?: string;
|
|
42
|
+
contentVariant?: string;
|
|
43
|
+
ctaText?: string;
|
|
44
|
+
ctaUrl?: string;
|
|
45
|
+
ctaVariant?: 'primary' | 'secondary' | 'accent' | 'text' | 'outline';
|
|
46
|
+
ctaOnClick?: () => void;
|
|
47
|
+
ctaClassName?: string;
|
|
48
|
+
ctaCss?: string;
|
|
49
|
+
ctaAlign?: 'left' | 'center' | 'right';
|
|
50
|
+
width?: string;
|
|
51
|
+
maxWidth?: string;
|
|
52
|
+
gap?: string;
|
|
53
|
+
padding?: string;
|
|
54
|
+
margin?: string;
|
|
55
|
+
bg?: string;
|
|
56
|
+
border?: boolean;
|
|
57
|
+
borderColor?: string;
|
|
58
|
+
borderWidth?: string;
|
|
59
|
+
borderRadius?: string;
|
|
60
|
+
shadow?: boolean;
|
|
61
|
+
zIndex?: number;
|
|
62
|
+
headerGap?: string;
|
|
63
|
+
headerAlign?: 'start' | 'center' | 'end';
|
|
64
|
+
headerJustify?: 'start' | 'center' | 'end' | 'between' | 'around';
|
|
65
|
+
className?: string;
|
|
66
|
+
funcss?: string;
|
|
67
|
+
style?: React.CSSProperties;
|
|
68
|
+
testing?: boolean;
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
onClose?: () => void;
|
|
71
|
+
onOpen?: () => void;
|
|
72
|
+
onAction?: (action: string) => void;
|
|
16
73
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export {};
|
|
74
|
+
declare const Notification: React.FC<NotificationProps>;
|
|
75
|
+
export default Notification;
|
|
76
|
+
export type { NotificationProps };
|