funuicss 3.7.16 → 3.8.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/css/fun.css +324 -202
- package/demo/theme.tsx +1311 -0
- package/index.d.ts +2 -0
- package/index.js +5 -1
- package/package.json +1 -1
- package/ui/button/Button.d.ts +2 -1
- package/ui/button/Button.js +3 -3
- package/ui/components/ImageScaler.d.ts +6 -0
- package/ui/components/ImageScaler.js +17 -0
- package/ui/div/Div.d.ts +3 -1
- package/ui/div/Div.js +2 -2
- package/ui/empty/Empty.d.ts +17 -0
- package/ui/empty/Empty.js +66 -0
- package/ui/flex/Flex.d.ts +2 -1
- package/ui/flex/Flex.js +3 -3
- package/ui/modal/Modal.d.ts +1 -1
- package/ui/products/CartModal.d.ts +20 -0
- package/ui/products/CartModal.js +85 -0
- package/ui/products/ProductCard.d.ts +13 -0
- package/ui/products/ProductCard.js +56 -0
- package/ui/products/ProductDetail.d.ts +14 -0
- package/ui/products/ProductDetail.js +249 -0
- package/ui/products/ProductDetailModal.d.ts +17 -0
- package/ui/products/ProductDetailModal.js +99 -0
- package/ui/products/Products.d.ts +60 -0
- package/ui/products/Products.js +312 -0
- package/ui/products/Store.d.ts +99 -0
- package/ui/products/Store.js +515 -0
- package/ui/sidebar/SideBar.d.ts +3 -1
- package/ui/sidebar/SideBar.js +50 -11
- package/ui/specials/Circle.d.ts +2 -1
- package/ui/specials/Circle.js +2 -2
- package/ui/table/Table.d.ts +15 -1
- package/ui/table/Table.js +143 -15
- package/ui/theme/theme.d.ts +90 -0
- package/ui/theme/theme.js +440 -545
- package/utils/Buckets.d.ts +0 -0
- package/utils/Buckets.js +1 -0
package/index.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export { default as Select } from "./ui/select/Select";
|
|
|
58
58
|
export { default as FileUpload } from "./ui/input/FileUpload";
|
|
59
59
|
export { default as Footer } from "./ui/footer/Footer";
|
|
60
60
|
export { default as Feature } from "./ui/feature/Feature";
|
|
61
|
+
export { default as Store } from "./ui/products/Store";
|
|
62
|
+
export { default as Empty } from "./ui/empty/Empty";
|
|
61
63
|
export { default as Cookie } from "./js/Cookie";
|
|
62
64
|
export { useVariable, useAsset, useAssetType, useAssetValue, useAssets, useVariables, } from "./ui/theme/theme";
|
|
63
65
|
export { FunGet } from "./js/Fun";
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.View = exports.ScrollInView = exports.Accordion = exports.Flex = exports.RichText = exports.Carousel = exports.Video = exports.SideBar = exports.ChartPie = exports.Lines = exports.Bars = exports.FullCenteredPage = exports.CircleGroup = exports.Circle = exports.Hr = exports.Section = exports.RowFlex = exports.Tip = exports.AppBar = exports.ToolTip = exports.Notification = exports.FunLoader = exports.ProgressBar = exports.DropMenu = exports.DropItem = exports.Dropdown = exports.DropDown = exports.DropUp = exports.UnAuthorized = exports.NotFound = exports.StepLine = exports.StepHeader = exports.Step = exports.StepContainer = exports.Div = exports.Text = exports.List = exports.Table = exports.Modal = exports.Loader = exports.SearchableInput = exports.Input = exports.Col = exports.Grid = exports.Container = exports.BreadCrumb = exports.Card = exports.Button = exports.ThemeProvider = exports.Alert = void 0;
|
|
7
|
-
exports.GoogleAnalytics = exports.FunGet = exports.useVariables = exports.useAssets = exports.useAssetValue = exports.useAssetType = exports.useAsset = exports.useVariable = exports.Cookie = exports.Feature = exports.Footer = exports.FileUpload = exports.Select = exports.ScrollToTop = exports.FlexItem = exports.Slider = exports.Vista = exports.Calendar = exports.DatePicker = void 0;
|
|
7
|
+
exports.GoogleAnalytics = exports.FunGet = exports.useVariables = exports.useAssets = exports.useAssetValue = exports.useAssetType = exports.useAsset = exports.useVariable = exports.Cookie = exports.Empty = exports.Store = exports.Feature = exports.Footer = exports.FileUpload = exports.Select = exports.ScrollToTop = exports.FlexItem = exports.Slider = exports.Vista = exports.Calendar = exports.DatePicker = void 0;
|
|
8
8
|
var Alert_1 = require("./ui/alert/Alert");
|
|
9
9
|
Object.defineProperty(exports, "Alert", { enumerable: true, get: function () { return __importDefault(Alert_1).default; } });
|
|
10
10
|
var theme_1 = require("./ui/theme/theme");
|
|
@@ -125,6 +125,10 @@ var Footer_1 = require("./ui/footer/Footer");
|
|
|
125
125
|
Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return __importDefault(Footer_1).default; } });
|
|
126
126
|
var Feature_1 = require("./ui/feature/Feature");
|
|
127
127
|
Object.defineProperty(exports, "Feature", { enumerable: true, get: function () { return __importDefault(Feature_1).default; } });
|
|
128
|
+
var Store_1 = require("./ui/products/Store");
|
|
129
|
+
Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return __importDefault(Store_1).default; } });
|
|
130
|
+
var Empty_1 = require("./ui/empty/Empty");
|
|
131
|
+
Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return __importDefault(Empty_1).default; } });
|
|
128
132
|
// js
|
|
129
133
|
var Cookie_1 = require("./js/Cookie");
|
|
130
134
|
Object.defineProperty(exports, "Cookie", { enumerable: true, get: function () { return __importDefault(Cookie_1).default; } });
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.
|
|
2
|
+
"version": "3.8.0",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/button/Button.d.ts
CHANGED
|
@@ -37,10 +37,11 @@ interface ButtonProps {
|
|
|
37
37
|
isLoading?: boolean;
|
|
38
38
|
variant?: string;
|
|
39
39
|
url?: string;
|
|
40
|
+
disabled?: boolean;
|
|
40
41
|
status?: 'success' | 'warning' | 'info' | 'error';
|
|
41
42
|
children?: React.ReactNode;
|
|
42
43
|
style?: React.CSSProperties;
|
|
43
44
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
44
45
|
}
|
|
45
|
-
export default function Button({ variant, color, bg, funcss, startIcon, endIcon, stringPrefix, stringSuffix, prefix, suffix, iconSize, iconLineHeight, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status, bold, children, style, url, onClick, ...rest }: ButtonProps): React.JSX.Element;
|
|
46
|
+
export default function Button({ variant, color, bg, funcss, startIcon, endIcon, stringPrefix, stringSuffix, prefix, suffix, iconSize, iconLineHeight, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status, bold, children, style, url, onClick, disabled, ...rest }: ButtonProps): React.JSX.Element;
|
|
46
47
|
export {};
|
package/ui/button/Button.js
CHANGED
|
@@ -63,10 +63,10 @@ var componentUtils_1 = require("../../utils/componentUtils");
|
|
|
63
63
|
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
64
64
|
function Button(_a) {
|
|
65
65
|
var _b, _c;
|
|
66
|
-
var _d = _a.variant, variant = _d === void 0 ? '' : _d, color = _a.color, bg = _a.bg, funcss = _a.funcss, startIcon = _a.startIcon, endIcon = _a.endIcon, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, prefix = _a.prefix, suffix = _a.suffix, iconSize = _a.iconSize, _e = _a.iconLineHeight, iconLineHeight = _e === void 0 ? 0 : _e, text = _a.text, rounded = _a.rounded, raised = _a.raised, height = _a.height, width = _a.width, float = _a.float, hoverUp = _a.hoverUp, fullWidth = _a.fullWidth, outlined = _a.outlined, small = _a.small, hoverless = _a.hoverless, smaller = _a.smaller, big = _a.big, bigger = _a.bigger, jumbo = _a.jumbo, flat = _a.flat, hoverNone = _a.hoverNone, fillAnimation = _a.fillAnimation, fillDirection = _a.fillDirection, fillTextColor = _a.fillTextColor, outlineSize = _a.outlineSize, isLoading = _a.isLoading, status = _a.status, bold = _a.bold, children = _a.children, style = _a.style, url = _a.url, onClick = _a.onClick, rest = __rest(_a, ["variant", "color", "bg", "funcss", "startIcon", "endIcon", "stringPrefix", "stringSuffix", "prefix", "suffix", "iconSize", "iconLineHeight", "text", "rounded", "raised", "height", "width", "float", "hoverUp", "fullWidth", "outlined", "small", "hoverless", "smaller", "big", "bigger", "jumbo", "flat", "hoverNone", "fillAnimation", "fillDirection", "fillTextColor", "outlineSize", "isLoading", "status", "bold", "children", "style", "url", "onClick"]);
|
|
66
|
+
var _d = _a.variant, variant = _d === void 0 ? '' : _d, color = _a.color, bg = _a.bg, funcss = _a.funcss, startIcon = _a.startIcon, endIcon = _a.endIcon, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, prefix = _a.prefix, suffix = _a.suffix, iconSize = _a.iconSize, _e = _a.iconLineHeight, iconLineHeight = _e === void 0 ? 0 : _e, text = _a.text, rounded = _a.rounded, raised = _a.raised, height = _a.height, width = _a.width, float = _a.float, hoverUp = _a.hoverUp, fullWidth = _a.fullWidth, outlined = _a.outlined, small = _a.small, hoverless = _a.hoverless, smaller = _a.smaller, big = _a.big, bigger = _a.bigger, jumbo = _a.jumbo, flat = _a.flat, hoverNone = _a.hoverNone, fillAnimation = _a.fillAnimation, fillDirection = _a.fillDirection, fillTextColor = _a.fillTextColor, outlineSize = _a.outlineSize, isLoading = _a.isLoading, status = _a.status, bold = _a.bold, children = _a.children, style = _a.style, url = _a.url, onClick = _a.onClick, disabled = _a.disabled, rest = __rest(_a, ["variant", "color", "bg", "funcss", "startIcon", "endIcon", "stringPrefix", "stringSuffix", "prefix", "suffix", "iconSize", "iconLineHeight", "text", "rounded", "raised", "height", "width", "float", "hoverUp", "fullWidth", "outlined", "small", "hoverless", "smaller", "big", "bigger", "jumbo", "flat", "hoverNone", "fillAnimation", "fillDirection", "fillTextColor", "outlineSize", "isLoading", "status", "bold", "children", "style", "url", "onClick", "disabled"]);
|
|
67
67
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Button', variant).mergeWithLocal;
|
|
68
68
|
// Create local props object - these will override config props
|
|
69
|
-
var localProps = __assign({ color: color, bg: bg, funcss: funcss, text: text, rounded: rounded, raised: raised, height: height, width: width, float: float, hoverUp: hoverUp, fullWidth: fullWidth, outlined: outlined, small: small, hoverless: hoverless, smaller: smaller, big: big, bigger: bigger, jumbo: jumbo, flat: flat, hoverNone: hoverNone, fillAnimation: fillAnimation, fillDirection: fillDirection, fillTextColor: fillTextColor, outlineSize: outlineSize, isLoading: isLoading, status: status, bold: bold, stringPrefix: stringPrefix, stringSuffix: stringSuffix }, rest);
|
|
69
|
+
var localProps = __assign({ color: color, bg: bg, funcss: funcss, text: text, rounded: rounded, raised: raised, height: height, width: width, float: float, hoverUp: hoverUp, fullWidth: fullWidth, outlined: outlined, small: small, hoverless: hoverless, smaller: smaller, big: big, bigger: bigger, jumbo: jumbo, flat: flat, hoverNone: hoverNone, fillAnimation: fillAnimation, fillDirection: fillDirection, fillTextColor: fillTextColor, disabled: disabled, outlineSize: outlineSize, isLoading: isLoading, status: status, bold: bold, stringPrefix: stringPrefix, stringSuffix: stringSuffix }, rest);
|
|
70
70
|
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
71
71
|
var mergedProps = mergeWithLocal(localProps).props;
|
|
72
72
|
// Extract final values - local props take precedence
|
|
@@ -213,7 +213,7 @@ function Button(_a) {
|
|
|
213
213
|
return (react_1.default.createElement("span", { className: className, style: iconWrapperStyle }, isReactElement(icon) ? react_1.default.cloneElement(icon, { size: iconSize }) : icon));
|
|
214
214
|
};
|
|
215
215
|
return (react_1.default.createElement("span", null,
|
|
216
|
-
react_1.default.createElement("button", __assign({ className: "".concat(classNames, " ").concat((showPrefix || showSuffix || final.isLoading) ? 'iconic' : ''), style: __assign({ height: (_b = height !== null && height !== void 0 ? height : mergedProps.height) !== null && _b !== void 0 ? _b : '', width: final.fullWidth ? '100%' : (_c = width !== null && width !== void 0 ? width : mergedProps.width) !== null && _c !== void 0 ? _c : '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
|
|
216
|
+
react_1.default.createElement("button", __assign({ disabled: disabled || final.isLoading || false, className: "".concat(classNames, " ").concat((showPrefix || showSuffix || final.isLoading) ? 'iconic' : ''), style: __assign({ height: (_b = height !== null && height !== void 0 ? height : mergedProps.height) !== null && _b !== void 0 ? _b : '', width: final.fullWidth ? '100%' : (_c = width !== null && width !== void 0 ? width : mergedProps.width) !== null && _c !== void 0 ? _c : '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
|
|
217
217
|
final.isLoading ? (renderIcon(react_1.default.createElement(pi_1.PiSpinner, { className: "rotate" }), 'btn_left_icon')) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
218
218
|
final.status && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle },
|
|
219
219
|
final.status === 'success' && react_1.default.createElement(pi_1.PiCheck, { size: iconSize }),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = ImageScaler;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
function ImageScaler(_a) {
|
|
9
|
+
var _b = _a.funcss, funcss = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? "100%" : _c, _d = _a.src, src = _d === void 0 ? '' : _d;
|
|
10
|
+
return (react_1.default.createElement("div", { className: "image-scaler-container ".concat(funcss), style: {
|
|
11
|
+
maxWidth: size,
|
|
12
|
+
width: size,
|
|
13
|
+
maxHeight: size,
|
|
14
|
+
height: size,
|
|
15
|
+
} },
|
|
16
|
+
react_1.default.createElement("img", { src: src, className: "image-scaler-img", loading: "lazy", alt: "" })));
|
|
17
|
+
}
|
package/ui/div/Div.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ type DivProps = {
|
|
|
11
11
|
width?: string;
|
|
12
12
|
padding?: string;
|
|
13
13
|
margin?: string;
|
|
14
|
+
id?: string;
|
|
14
15
|
fit?: boolean;
|
|
16
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
15
17
|
customStyle?: React.CSSProperties;
|
|
16
18
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
17
19
|
};
|
|
18
|
-
declare const Div: ({ children, funcss, content, minHeight, maxHeight, maxWidth, minWidth, height, width, padding, margin, fit, customStyle, ...rest }: DivProps) => React.JSX.Element;
|
|
20
|
+
declare const Div: ({ children, funcss, content, minHeight, maxHeight, maxWidth, minWidth, height, width, padding, margin, id, fit, ref, customStyle, ...rest }: DivProps) => React.JSX.Element;
|
|
19
21
|
export default Div;
|
package/ui/div/Div.js
CHANGED
|
@@ -58,8 +58,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
59
|
var React = __importStar(require("react"));
|
|
60
60
|
var Div = function (_a) {
|
|
61
|
-
var children = _a.children, funcss = _a.funcss, content = _a.content, minHeight = _a.minHeight, maxHeight = _a.maxHeight, maxWidth = _a.maxWidth, minWidth = _a.minWidth, height = _a.height, width = _a.width, padding = _a.padding, margin = _a.margin, fit = _a.fit, customStyle = _a.customStyle, rest = __rest(_a, ["children", "funcss", "content", "minHeight", "maxHeight", "maxWidth", "minWidth", "height", "width", "padding", "margin", "fit", "customStyle"]);
|
|
61
|
+
var children = _a.children, funcss = _a.funcss, content = _a.content, minHeight = _a.minHeight, maxHeight = _a.maxHeight, maxWidth = _a.maxWidth, minWidth = _a.minWidth, height = _a.height, width = _a.width, padding = _a.padding, margin = _a.margin, id = _a.id, fit = _a.fit, ref = _a.ref, customStyle = _a.customStyle, rest = __rest(_a, ["children", "funcss", "content", "minHeight", "maxHeight", "maxWidth", "minWidth", "height", "width", "padding", "margin", "id", "fit", "ref", "customStyle"]);
|
|
62
62
|
return (React.createElement("div", null,
|
|
63
|
-
React.createElement("div", __assign({ className: "".concat(fit ? 'width-100-p height-100-p' : '', " ").concat(funcss), style: __assign({ height: height || '', maxHeight: maxHeight || '', minHeight: minHeight || '', maxWidth: maxWidth || '', minWidth: minWidth || '', width: width || '', padding: padding || '', margin: margin || '' }, customStyle) }, rest), content || children)));
|
|
63
|
+
React.createElement("div", __assign({ ref: ref, className: "".concat(fit ? 'width-100-p height-100-p' : '', " ").concat(funcss), style: __assign({ height: height || '', maxHeight: maxHeight || '', minHeight: minHeight || '', maxWidth: maxWidth || '', minWidth: minWidth || '', width: width || '', padding: padding || '', margin: margin || '' }, customStyle), id: id }, rest), content || children)));
|
|
64
64
|
};
|
|
65
65
|
exports.default = Div;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface EmptyProps {
|
|
3
|
+
header?: React.ReactNode;
|
|
4
|
+
title?: string;
|
|
5
|
+
titleSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
description?: string;
|
|
8
|
+
descriptionSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
action?: React.ReactNode;
|
|
10
|
+
ctaText?: string;
|
|
11
|
+
ctaIcon?: React.ReactNode;
|
|
12
|
+
ctaOnClick?: () => void;
|
|
13
|
+
ctaBg?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
14
|
+
showCta?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function Empty({ header, title, titleSize, content, description, descriptionSize, action, ctaText, ctaIcon, ctaOnClick, ctaBg, showCta, }: EmptyProps): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
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 () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.default = Empty;
|
|
41
|
+
var React = __importStar(require("react"));
|
|
42
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
43
|
+
var pi_1 = require("react-icons/pi");
|
|
44
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
45
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
46
|
+
function Empty(_a) {
|
|
47
|
+
var header = _a.header, _b = _a.title, title = _b === void 0 ? 'No Data Available' : _b, _c = _a.titleSize, titleSize = _c === void 0 ? 'xl' : _c, content = _a.content, _d = _a.description, description = _d === void 0 ? "There's nothing to display at the moment. Try adjusting your filters or check back later." : _d, _e = _a.descriptionSize, descriptionSize = _e === void 0 ? 'md' : _e, action = _a.action, _f = _a.ctaText, ctaText = _f === void 0 ? 'Go Back' : _f, _g = _a.ctaIcon, ctaIcon = _g === void 0 ? React.createElement(pi_1.PiArrowLeft, null) : _g, ctaOnClick = _a.ctaOnClick, _h = _a.ctaBg, ctaBg = _h === void 0 ? 'primary' : _h, _j = _a.showCta, showCta = _j === void 0 ? true : _j;
|
|
48
|
+
var handleCtaClick = function () {
|
|
49
|
+
if (ctaOnClick) {
|
|
50
|
+
ctaOnClick();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
window.history.back();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return (React.createElement("div", null,
|
|
57
|
+
React.createElement("div", null,
|
|
58
|
+
React.createElement("div", { className: "central flex p-3" },
|
|
59
|
+
React.createElement("div", { className: "text-center width-600-max" },
|
|
60
|
+
React.createElement(Flex_1.default, { gap: 1, direction: "column", fit: true },
|
|
61
|
+
React.createElement("div", null, header ? (header) : (React.createElement("div", null,
|
|
62
|
+
React.createElement(Text_1.default, { text: title, size: titleSize, block: true })))),
|
|
63
|
+
React.createElement("div", { className: "article" }, content ? (content) : (React.createElement(Text_1.default, { article: true, opacity: 4, text: description, size: descriptionSize, block: true }))),
|
|
64
|
+
showCta && (React.createElement("div", null, action ? (action) : (React.createElement("div", { className: "row-flex gap", style: { justifyContent: 'center', gap: '0.4rem' } },
|
|
65
|
+
React.createElement(Button_1.default, { startIcon: ctaIcon, bg: ctaBg, onClick: handleCtaClick }, ctaText)))))))))));
|
|
66
|
+
}
|
package/ui/flex/Flex.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ interface FlexProps {
|
|
|
19
19
|
responsiveLarge?: boolean;
|
|
20
20
|
width?: string;
|
|
21
21
|
height?: string;
|
|
22
|
+
fit?: Boolean;
|
|
22
23
|
}
|
|
23
|
-
export default function Flex({ className, funcss, id, children, style, direction, wrap, justify, alignItems, alignContent, gap, gapX, gapY, gapUnit, responsiveSmall, responsiveMedium, responsiveLarge, width, height, ...rest }: FlexProps): React.JSX.Element;
|
|
24
|
+
export default function Flex({ className, funcss, id, children, style, direction, wrap, justify, alignItems, alignContent, gap, gapX, gapY, gapUnit, responsiveSmall, responsiveMedium, responsiveLarge, fit, width, height, ...rest }: FlexProps): React.JSX.Element;
|
|
24
25
|
export {};
|
package/ui/flex/Flex.js
CHANGED
|
@@ -37,9 +37,9 @@ function Flex(_a) {
|
|
|
37
37
|
// Gap
|
|
38
38
|
gap = _a.gap, gapX = _a.gapX, gapY = _a.gapY, _e = _a.gapUnit, gapUnit = _e === void 0 ? 'rem' : _e,
|
|
39
39
|
// Responsive
|
|
40
|
-
responsiveSmall = _a.responsiveSmall, responsiveMedium = _a.responsiveMedium, responsiveLarge = _a.responsiveLarge,
|
|
40
|
+
responsiveSmall = _a.responsiveSmall, responsiveMedium = _a.responsiveMedium, responsiveLarge = _a.responsiveLarge, fit = _a.fit,
|
|
41
41
|
// Size
|
|
42
|
-
width = _a.width, height = _a.height, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "direction", "wrap", "justify", "alignItems", "alignContent", "gap", "gapX", "gapY", "gapUnit", "responsiveSmall", "responsiveMedium", "responsiveLarge", "width", "height"]);
|
|
42
|
+
width = _a.width, height = _a.height, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "direction", "wrap", "justify", "alignItems", "alignContent", "gap", "gapX", "gapY", "gapUnit", "responsiveSmall", "responsiveMedium", "responsiveLarge", "fit", "width", "height"]);
|
|
43
43
|
var combinedClassName = [
|
|
44
44
|
className,
|
|
45
45
|
funcss,
|
|
@@ -49,5 +49,5 @@ function Flex(_a) {
|
|
|
49
49
|
]
|
|
50
50
|
.filter(Boolean)
|
|
51
51
|
.join(' ');
|
|
52
|
-
return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign({ display: 'flex', flexDirection: direction, flexWrap: wrap, justifyContent: justify, alignItems: alignItems, alignContent: alignContent, gap: gap ? "".concat(gap).concat(gapUnit) : 0, columnGap: gapX ? "".concat(gapX).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, rowGap: gapY ? "".concat(gapY).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, width: width ? width : 'fit-content', height: height ? height : 'fit-content' }, style) }, rest), children));
|
|
52
|
+
return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign({ display: 'flex', flexDirection: direction, flexWrap: wrap, justifyContent: justify, alignItems: alignItems, alignContent: alignContent, gap: gap ? "".concat(gap).concat(gapUnit) : 0, columnGap: gapX ? "".concat(gapX).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, rowGap: gapY ? "".concat(gapY).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, width: fit ? "100%" : width ? width : 'fit-content', height: fit ? "100%" : height ? height : 'fit-content' }, style) }, rest), children));
|
|
53
53
|
}
|
package/ui/modal/Modal.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CartItem } from './Store';
|
|
3
|
+
interface CartModalProps {
|
|
4
|
+
cart: CartItem[];
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
setIsOpen: (open: boolean) => void;
|
|
7
|
+
currency?: string;
|
|
8
|
+
updateQuantity: (cartItemId: string, quantity: number) => void;
|
|
9
|
+
removeFromCart: (cartItemId: string) => void;
|
|
10
|
+
clearCart: () => void;
|
|
11
|
+
handleCheckout: () => void;
|
|
12
|
+
cartBadgeColor?: string;
|
|
13
|
+
checkoutText?: string;
|
|
14
|
+
checkoutIcon?: React.ReactNode;
|
|
15
|
+
small?: boolean;
|
|
16
|
+
big?: boolean;
|
|
17
|
+
persistCart?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const CartModal: React.FC<CartModalProps>;
|
|
20
|
+
export default CartModal;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// components/products/CartModal.tsx
|
|
3
|
+
'use client';
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
var react_1 = __importDefault(require("react"));
|
|
9
|
+
var pi_1 = require("react-icons/pi");
|
|
10
|
+
var Modal_1 = __importDefault(require("../modal/Modal"));
|
|
11
|
+
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
12
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
13
|
+
var Input_1 = __importDefault(require("../input/Input"));
|
|
14
|
+
var Div_1 = __importDefault(require("../div/Div"));
|
|
15
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
16
|
+
var Circle_1 = __importDefault(require("../specials/Circle"));
|
|
17
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
18
|
+
var generateCartItemId = function (product, options) {
|
|
19
|
+
var parts = [
|
|
20
|
+
product.id,
|
|
21
|
+
(options === null || options === void 0 ? void 0 : options.color) || '',
|
|
22
|
+
(options === null || options === void 0 ? void 0 : options.size) || ''
|
|
23
|
+
].filter(Boolean);
|
|
24
|
+
return parts.join('_');
|
|
25
|
+
};
|
|
26
|
+
var CartModal = function (_a) {
|
|
27
|
+
var cart = _a.cart, isOpen = _a.isOpen, setIsOpen = _a.setIsOpen, _b = _a.currency, currency = _b === void 0 ? '$' : _b, updateQuantity = _a.updateQuantity, removeFromCart = _a.removeFromCart, clearCart = _a.clearCart, handleCheckout = _a.handleCheckout, _c = _a.cartBadgeColor, cartBadgeColor = _c === void 0 ? 'error' : _c, _d = _a.checkoutText, checkoutText = _d === void 0 ? 'Checkout' : _d, checkoutIcon = _a.checkoutIcon, _e = _a.small, small = _e === void 0 ? false : _e, _f = _a.big, big = _f === void 0 ? false : _f, _g = _a.persistCart, persistCart = _g === void 0 ? true : _g;
|
|
28
|
+
var totalItems = cart.reduce(function (sum, item) { return sum + item.quantity; }, 0);
|
|
29
|
+
var subtotal = cart.reduce(function (sum, item) { return sum + (item.product.price * item.quantity); }, 0);
|
|
30
|
+
var handleRemoveItem = function (item) {
|
|
31
|
+
var cartItemId = generateCartItemId(item.product, {
|
|
32
|
+
color: item.selectedColor,
|
|
33
|
+
size: item.selectedSize
|
|
34
|
+
});
|
|
35
|
+
removeFromCart(cartItemId);
|
|
36
|
+
};
|
|
37
|
+
var handleUpdateQuantity = function (item, newQuantity) {
|
|
38
|
+
var cartItemId = generateCartItemId(item.product, {
|
|
39
|
+
color: item.selectedColor,
|
|
40
|
+
size: item.selectedSize
|
|
41
|
+
});
|
|
42
|
+
updateQuantity(cartItemId, newQuantity);
|
|
43
|
+
};
|
|
44
|
+
return (react_1.default.createElement(Modal_1.default, { animation: "SlideLeft", position: "right", duration: 0.3, open: isOpen, setOpen: setIsOpen, funcss: "funui_products_cart_modal width-400 sm:width-500", title: react_1.default.createElement(Text_1.default, { text: "Your Cart", size: "h3" }), body: react_1.default.createElement(Div_1.default, { funcss: "funui_products_cart_body max-height-70vh overflow-y-auto" }, cart.length === 0 ? (react_1.default.createElement(Div_1.default, { funcss: "flex-center padding-40" },
|
|
45
|
+
react_1.default.createElement(Text_1.default, { text: "Your cart is empty", color: "text-light", size: "large" }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
46
|
+
cart.map(function (item, index) {
|
|
47
|
+
var _a;
|
|
48
|
+
var cartItemId = generateCartItemId(item.product, {
|
|
49
|
+
color: item.selectedColor,
|
|
50
|
+
size: item.selectedSize
|
|
51
|
+
});
|
|
52
|
+
return (react_1.default.createElement(RowFlex_1.default, { key: "".concat(cartItemId, "-").concat(index), funcss: "lighter p round-edge section", alignItems: "center", justify: 'space-between', gap: 1 },
|
|
53
|
+
react_1.default.createElement(Div_1.default, { funcss: " width-80 height-80" }, ((_a = item.product.images) === null || _a === void 0 ? void 0 : _a[0]) ? (react_1.default.createElement("img", { src: item.product.images[0], alt: item.product.name, loading: "lazy", className: "fit round-edge" })) : (react_1.default.createElement(Div_1.default, { funcss: "w-80 h-80 flex central" },
|
|
54
|
+
react_1.default.createElement(Text_1.default, { text: "No Image", color: "text-light", size: "sm" })))),
|
|
55
|
+
react_1.default.createElement(Div_1.default, { funcss: "funui_products_cart_details flex-1 min-width-0" },
|
|
56
|
+
react_1.default.createElement(Text_1.default, { text: item.product.name, block: true }),
|
|
57
|
+
(item.selectedColor || item.selectedSize) && (react_1.default.createElement(Text_1.default, { text: "".concat(item.selectedColor ? "Color: ".concat(item.selectedColor) : '', " ").concat(item.selectedSize ? "Size: ".concat(item.selectedSize) : ''), size: 'sm' })),
|
|
58
|
+
react_1.default.createElement(Text_1.default, { text: "".concat(item.product.currency || currency).concat((item.product.price * item.quantity).toFixed(2)), block: true, size: 'lg' })),
|
|
59
|
+
react_1.default.createElement("div", { className: "col" },
|
|
60
|
+
react_1.default.createElement(Flex_1.default, { width: '100%', gap: 0.5, alignItems: 'center' },
|
|
61
|
+
react_1.default.createElement(Circle_1.default, { size: 2.5, bg: 'bg', body: react_1.default.createElement(pi_1.PiMinus, null), onClick: function () { return handleUpdateQuantity(item, item.quantity - 1); } }),
|
|
62
|
+
react_1.default.createElement("div", { className: "w-90" },
|
|
63
|
+
react_1.default.createElement(Input_1.default, { type: "number", value: item.quantity, onChange: function (e) {
|
|
64
|
+
var value = parseInt(e.target.value);
|
|
65
|
+
if (!isNaN(value)) {
|
|
66
|
+
handleUpdateQuantity(item, Math.max(1, value));
|
|
67
|
+
}
|
|
68
|
+
}, fullWidth: true, bordered: true })),
|
|
69
|
+
react_1.default.createElement(Circle_1.default, { bg: 'bg', size: 2.5, body: react_1.default.createElement(pi_1.PiPlus, null), onClick: function () { return handleUpdateQuantity(item, item.quantity + 1); } }))),
|
|
70
|
+
react_1.default.createElement(Circle_1.default, { size: 2.5, body: react_1.default.createElement(pi_1.PiTrash, null), onClick: function () { return handleRemoveItem(item); }, bg: 'error' })));
|
|
71
|
+
}),
|
|
72
|
+
react_1.default.createElement(Div_1.default, { funcss: "funui_products_cart_summary padding-20 space-y-3" },
|
|
73
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "space-between" },
|
|
74
|
+
react_1.default.createElement(Text_1.default, { text: "Subtotal", color: "text-light" }),
|
|
75
|
+
react_1.default.createElement(Text_1.default, { text: "".concat(currency).concat(subtotal.toFixed(2)) })),
|
|
76
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "space-between" },
|
|
77
|
+
react_1.default.createElement(Text_1.default, { text: "Items", color: "text-light" }),
|
|
78
|
+
react_1.default.createElement(Text_1.default, { text: totalItems.toString() })))))), footer: cart.length > 0 ? (react_1.default.createElement(Div_1.default, { funcss: "funui_products_cart_footer padding-20 border-top border-light" },
|
|
79
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "space-between", alignItems: "center" },
|
|
80
|
+
react_1.default.createElement(Div_1.default, null,
|
|
81
|
+
react_1.default.createElement(Text_1.default, { text: "Total", color: "text-light", size: "sm", block: true }),
|
|
82
|
+
react_1.default.createElement(Text_1.default, { text: "".concat(currency).concat(subtotal.toFixed(2)), size: "h4" })),
|
|
83
|
+
react_1.default.createElement(Button_1.default, { text: checkoutText, bg: "primary", raised: true, onClick: handleCheckout, funcss: "padding-x-30", startIcon: checkoutIcon, small: small, big: big })))) : react_1.default.createElement(react_1.default.Fragment, null) }));
|
|
84
|
+
};
|
|
85
|
+
exports.default = CartModal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Product } from './Store';
|
|
3
|
+
interface ProductCardProps {
|
|
4
|
+
product: Product;
|
|
5
|
+
currency?: string;
|
|
6
|
+
onClick?: (product: Product) => void;
|
|
7
|
+
onAddToCart?: (product: Product) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
funcss?: string;
|
|
10
|
+
showBadges?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const ProductCard: React.FC<ProductCardProps>;
|
|
13
|
+
export default ProductCard;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var Div_1 = __importDefault(require("../div/Div"));
|
|
9
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
10
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
11
|
+
var ProductCard = function (_a) {
|
|
12
|
+
var _b;
|
|
13
|
+
var product = _a.product, _c = _a.currency, currency = _c === void 0 ? '$' : _c, onClick = _a.onClick, onAddToCart = _a.onAddToCart, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.funcss, funcss = _e === void 0 ? '' : _e, _f = _a.showBadges, showBadges = _f === void 0 ? true : _f;
|
|
14
|
+
var hasDiscount = product.comparePrice && product.comparePrice > product.price;
|
|
15
|
+
var discountPercent = hasDiscount
|
|
16
|
+
? Math.round(((product.comparePrice - product.price) / product.comparePrice) * 100)
|
|
17
|
+
: 0;
|
|
18
|
+
var stockAvailable = product.stock === undefined || product.stock > 0;
|
|
19
|
+
var handleClick = function () {
|
|
20
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(product);
|
|
21
|
+
};
|
|
22
|
+
var handleAddToCart = function (e) {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
onAddToCart === null || onAddToCart === void 0 ? void 0 : onAddToCart(product);
|
|
25
|
+
};
|
|
26
|
+
var getDisplayPrice = function () {
|
|
27
|
+
var price = product.price || 0;
|
|
28
|
+
var productCurrency = product.currency || currency;
|
|
29
|
+
return "".concat(productCurrency).concat(price.toFixed(2));
|
|
30
|
+
};
|
|
31
|
+
return (react_1.default.createElement(Div_1.default, { funcss: "funui_store_product-card ".concat(className, " ").concat(funcss), onClick: handleClick, customStyle: { cursor: 'pointer' } },
|
|
32
|
+
react_1.default.createElement(Div_1.default, { funcss: "funui_store_image-container" },
|
|
33
|
+
((_b = product.images) === null || _b === void 0 ? void 0 : _b[0]) ? (react_1.default.createElement("img", { src: product.images[0], alt: product.name, loading: "lazy", className: "funui_store_product-image" })) : (react_1.default.createElement(Div_1.default, { funcss: "funui_store_no-image" },
|
|
34
|
+
react_1.default.createElement(Text_1.default, { text: "No Image", color: "text-muted", size: "sm" }))),
|
|
35
|
+
showBadges && (react_1.default.createElement(Div_1.default, { funcss: "funui_store_product-badges" }, product.isSale && (react_1.default.createElement("span", { className: "funui_store_badge sale" }, "Sale"))))),
|
|
36
|
+
react_1.default.createElement(Div_1.default, { funcss: "funui_store_product-info" },
|
|
37
|
+
react_1.default.createElement(Flex_1.default, { fit: true, justify: 'space-between', alignItems: 'center', gap: 1 },
|
|
38
|
+
product.category && (react_1.default.createElement("span", { className: "funui_store_product-category" }, product.category)),
|
|
39
|
+
product.isNew && (react_1.default.createElement(Text_1.default, { size: 'xs', color: 'success', weight: 600 }, "New"))),
|
|
40
|
+
react_1.default.createElement(Flex_1.default, { gap: 0.5, direction: 'column', width: '100%' },
|
|
41
|
+
react_1.default.createElement(Text_1.default, { block: true, size: 'lg', truncate: 2 }, product.name),
|
|
42
|
+
react_1.default.createElement(Flex_1.default, { width: '100%', gap: 1, justify: 'space-between' },
|
|
43
|
+
react_1.default.createElement(Flex_1.default, { gap: 0.5, alignItems: 'center' },
|
|
44
|
+
react_1.default.createElement("span", { className: "text-lg block" }, getDisplayPrice()),
|
|
45
|
+
hasDiscount && (react_1.default.createElement(Text_1.default, { size: 'xs', color: 'info', weight: 600 },
|
|
46
|
+
discountPercent,
|
|
47
|
+
"% Off"))),
|
|
48
|
+
hasDiscount && (react_1.default.createElement(Text_1.default, { size: "sm", opacity: 4, textDecoration: 'line-through' },
|
|
49
|
+
product.currency || currency,
|
|
50
|
+
product.comparePrice.toFixed(2)))),
|
|
51
|
+
!stockAvailable ? (react_1.default.createElement("span", { className: "funui_store_stock-info out text-xs" }, "Out of Stock")) : product.stock !== undefined && product.stock > 0 && product.stock < 10 ? (react_1.default.createElement("span", { className: "funui_store_stock-info low text-xs" },
|
|
52
|
+
"Only ",
|
|
53
|
+
product.stock,
|
|
54
|
+
" left")) : stockAvailable && (react_1.default.createElement("span", { className: "funui_store_stock-info in text-xs" }, "In Stock"))))));
|
|
55
|
+
};
|
|
56
|
+
exports.default = ProductCard;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Product } from './Store';
|
|
3
|
+
interface ProductDetailProps {
|
|
4
|
+
product: Product;
|
|
5
|
+
open: boolean;
|
|
6
|
+
setOpen: (open: boolean) => void;
|
|
7
|
+
currency?: string;
|
|
8
|
+
onAddToCart?: (product: Product, quantity: number, selectedOptions?: {
|
|
9
|
+
color?: string;
|
|
10
|
+
size?: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ProductDetail: React.FC<ProductDetailProps>;
|
|
14
|
+
export default ProductDetail;
|