pixelize-design-library 2.1.25 → 2.1.27
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/dist/Components/ContactForm/ContactForm.d.ts +1 -1
- package/dist/Components/ContactForm/ContactForm.js +25 -22
- package/dist/Components/ContactForm/ContactFormProps.d.ts +1 -0
- package/dist/Components/InputTextArea/InputTextArea.d.ts +1 -1
- package/dist/Components/InputTextArea/InputTextArea.js +9 -6
- package/dist/Components/InputTextArea/InputTextArea.style.d.ts +2 -0
- package/dist/Components/InputTextArea/InputTextArea.style.js +76 -0
- package/dist/Components/InputTextArea/InputTextAreaProps.d.ts +3 -1
- package/dist/Components/ProductCard/ProductCard.js +1 -3
- package/dist/Pages/textArea.js +4 -1
- package/dist/Theme/componentStyles.d.ts +1 -0
- package/dist/Theme/componentStyles.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ContactFormProps } from "./ContactFormProps";
|
|
3
|
-
declare const ContactForm: ({ apiKey, customFields, getCustomValues, isDisabled, organizationId, customerId, }: ContactFormProps) => React.JSX.Element;
|
|
3
|
+
declare const ContactForm: ({ apiKey, customFields, getCustomValues, isDisabled, organizationId, customerId, buttonColorScheme }: ContactFormProps) => React.JSX.Element;
|
|
4
4
|
export default ContactForm;
|
|
@@ -78,22 +78,24 @@ var react_2 = require("@chakra-ui/react");
|
|
|
78
78
|
var TextInput_1 = __importDefault(require("../Input/TextInput"));
|
|
79
79
|
var lucide_react_1 = require("lucide-react");
|
|
80
80
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
81
|
+
var InputTextArea_1 = __importDefault(require("../InputTextArea/InputTextArea"));
|
|
82
|
+
var Button_1 = __importDefault(require("../Button/Button"));
|
|
81
83
|
var ContactForm = function (_a) {
|
|
82
84
|
var _b;
|
|
83
|
-
var apiKey = _a.apiKey, customFields = _a.customFields, getCustomValues = _a.getCustomValues, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, organizationId = _a.organizationId, customerId = _a.customerId;
|
|
85
|
+
var apiKey = _a.apiKey, customFields = _a.customFields, getCustomValues = _a.getCustomValues, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, organizationId = _a.organizationId, customerId = _a.customerId, _d = _a.buttonColorScheme, buttonColorScheme = _d === void 0 ? "primary" : _d;
|
|
84
86
|
var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
|
|
85
|
-
var
|
|
87
|
+
var _e = (0, react_1.useState)({
|
|
86
88
|
firstName: "",
|
|
87
89
|
lastName: "",
|
|
88
90
|
email: "",
|
|
89
91
|
phone: "",
|
|
90
92
|
enquiry: "",
|
|
91
|
-
}), formData =
|
|
92
|
-
var
|
|
93
|
+
}), formData = _e[0], setFormData = _e[1];
|
|
94
|
+
var _f = (0, react_1.useState)({
|
|
93
95
|
title: "",
|
|
94
96
|
isSuccess: false,
|
|
95
|
-
}), response =
|
|
96
|
-
var
|
|
97
|
+
}), response = _f[0], setResponse = _f[1];
|
|
98
|
+
var _g = (0, react_1.useState)({}), errors = _g[0], setErrors = _g[1];
|
|
97
99
|
var handleChange = function (field, value) {
|
|
98
100
|
setFormData(function (prev) {
|
|
99
101
|
var _a;
|
|
@@ -108,11 +110,12 @@ var ContactForm = function (_a) {
|
|
|
108
110
|
var newErrors = {};
|
|
109
111
|
if (!formData.firstName.trim())
|
|
110
112
|
newErrors.firstName = "First name is required";
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
if (!formData.email.trim()) {
|
|
114
|
+
// newErrors.email = "Email is required";
|
|
115
|
+
}
|
|
116
|
+
else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) {
|
|
117
|
+
newErrors.email = "Invalid email format";
|
|
118
|
+
}
|
|
116
119
|
if (!formData.phone.trim()) {
|
|
117
120
|
newErrors.phone = "Phone is required";
|
|
118
121
|
}
|
|
@@ -194,22 +197,22 @@ var ContactForm = function (_a) {
|
|
|
194
197
|
react_1.default.createElement(react_2.Box, { as: "form", onSubmit: handleSubmit },
|
|
195
198
|
react_1.default.createElement(react_2.VStack, { spacing: 4 },
|
|
196
199
|
react_1.default.createElement(react_2.SimpleGrid, { columns: { base: 1, md: 2 }, spacing: 4, w: "100%" },
|
|
197
|
-
react_1.default.createElement(react_2.FormControl,
|
|
198
|
-
react_1.default.createElement(TextInput_1.default, { label: "First Name", placeholder: "Enter first name", value: formData.firstName, onChange: function (e) { return handleChange("firstName", e.target.value); }, isRequired: true }),
|
|
199
|
-
react_1.default.createElement(react_2.FormErrorMessage, null, errors.firstName)),
|
|
200
|
+
react_1.default.createElement(react_2.FormControl, null,
|
|
201
|
+
react_1.default.createElement(TextInput_1.default, { label: "First Name", placeholder: "Enter first name", value: formData.firstName, onChange: function (e) { return handleChange("firstName", e.target.value); }, error: Boolean(errors.firstName), errorMessage: errors.firstName, isRequired: true })),
|
|
200
202
|
react_1.default.createElement(react_2.FormControl, null,
|
|
201
203
|
react_1.default.createElement(TextInput_1.default, { label: "Last Name", placeholder: "Enter last name", value: formData.lastName, onChange: function (e) { return handleChange("lastName", e.target.value); } }))),
|
|
202
204
|
react_1.default.createElement(react_2.SimpleGrid, { columns: { base: 1, md: 2 }, spacing: 4, w: "100%" },
|
|
203
|
-
react_1.default.createElement(react_2.FormControl,
|
|
204
|
-
react_1.default.createElement(TextInput_1.default, { label: "Phone", placeholder: "Enter phone number", value: formData.phone, onChange: function (e) { return handleChange("phone", e.target.value); }, isRequired: true }),
|
|
205
|
-
react_1.default.createElement(react_2.FormErrorMessage, null, errors.phone)),
|
|
205
|
+
react_1.default.createElement(react_2.FormControl, null,
|
|
206
|
+
react_1.default.createElement(TextInput_1.default, { label: "Phone", placeholder: "Enter phone number", value: formData.phone, onChange: function (e) { return handleChange("phone", e.target.value); }, isRequired: true, error: Boolean(errors.phone), errorMessage: errors.phone })),
|
|
206
207
|
react_1.default.createElement(react_2.FormControl, { isInvalid: !!errors.email },
|
|
207
|
-
react_1.default.createElement(TextInput_1.default, { label: "Email", placeholder: "Enter email", value: formData.email, onChange: function (e) { return handleChange("email", e.target.value); } }),
|
|
208
|
-
react_1.default.createElement(react_2.FormErrorMessage, null, errors.email))),
|
|
208
|
+
react_1.default.createElement(TextInput_1.default, { label: "Email", placeholder: "Enter email", value: formData.email, onChange: function (e) { return handleChange("email", e.target.value); }, error: Boolean(errors.email), errorMessage: errors.email }))),
|
|
209
209
|
customFields,
|
|
210
|
-
react_1.default.createElement(react_2.FormControl,
|
|
210
|
+
react_1.default.createElement(react_2.FormControl, null,
|
|
211
211
|
react_1.default.createElement(react_2.Text, { fontSize: "sm", mb: 1 }, "Enquiry"),
|
|
212
|
-
react_1.default.createElement(react_2.
|
|
213
|
-
|
|
212
|
+
react_1.default.createElement(react_2.Box, null,
|
|
213
|
+
react_1.default.createElement(InputTextArea_1.default, { placeholder: "Enter your enquiry", rows: 4, width: "100%", value: formData.enquiry, onChange: function (e) { return handleChange("enquiry", e.target.value); } }))),
|
|
214
|
+
react_1.default.createElement(Button_1.default, { type: "submit", isDisabled: isDisabled, colorScheme: buttonColorScheme, width: "full", sx: {
|
|
215
|
+
mt: 2
|
|
216
|
+
} }, "Send Message")))));
|
|
214
217
|
};
|
|
215
218
|
exports.default = ContactForm;
|
|
@@ -6,4 +6,5 @@ export interface ContactFormProps {
|
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
customFields?: ReactNode;
|
|
8
8
|
getCustomValues?: () => Record<string, any>;
|
|
9
|
+
buttonColorScheme?: "primary" | "blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" | "secondary" | "tertiary" | undefined;
|
|
9
10
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { InputTextAreaProps } from "./InputTextAreaProps";
|
|
3
|
-
export default function InputTextArea({ label, placeholder, value, onChange, size, resize, width, isDisabled, errorBorderColor, focusBorderColor, isReadOnly, isRequired, error, errorMessage, helperText, rows, height, }: InputTextAreaProps): React.JSX.Element;
|
|
3
|
+
export default function InputTextArea({ label, placeholder, value, onChange, size, resize, width, isDisabled, errorBorderColor, focusBorderColor, isReadOnly, isRequired, error, errorMessage, helperText, rows, height, isInformation, informationMessage, id, autoComplete }: InputTextAreaProps): React.JSX.Element;
|
|
@@ -5,12 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
7
|
var react_2 = require("@chakra-ui/react");
|
|
8
|
+
var FormLabel_1 = require("../Common/FormLabel");
|
|
9
|
+
var ErrorMessage_1 = __importDefault(require("../Common/ErrorMessage"));
|
|
10
|
+
var HelperText_1 = __importDefault(require("../Common/HelperText"));
|
|
8
11
|
function InputTextArea(_a) {
|
|
9
|
-
var label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.resize, resize = _c === void 0 ? "both" : _c, _d = _a.width, width = _d === void 0 ? 500 : _d, isDisabled = _a.isDisabled, errorBorderColor = _a.errorBorderColor, focusBorderColor = _a.focusBorderColor, isReadOnly = _a.isReadOnly, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, error = _a.error, errorMessage = _a.errorMessage, helperText = _a.helperText, rows = _a.rows, height = _a.height;
|
|
10
|
-
return (react_1.default.createElement(react_2.FormControl,
|
|
11
|
-
label && react_1.default.createElement(
|
|
12
|
-
react_1.default.createElement(react_2.Textarea, { placeholder: placeholder, value: value, onChange: onChange, size: size, resize: resize, isDisabled: isDisabled,
|
|
13
|
-
error && react_1.default.createElement(
|
|
14
|
-
helperText && !error &&
|
|
12
|
+
var label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.resize, resize = _c === void 0 ? "both" : _c, _d = _a.width, width = _d === void 0 ? 500 : _d, isDisabled = _a.isDisabled, errorBorderColor = _a.errorBorderColor, focusBorderColor = _a.focusBorderColor, isReadOnly = _a.isReadOnly, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, error = _a.error, errorMessage = _a.errorMessage, helperText = _a.helperText, rows = _a.rows, height = _a.height, isInformation = _a.isInformation, informationMessage = _a.informationMessage, id = _a.id, _f = _a.autoComplete, autoComplete = _f === void 0 ? "" : _f;
|
|
13
|
+
return (react_1.default.createElement(react_2.FormControl, null,
|
|
14
|
+
label && react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isInformation: isInformation, informationMessage: informationMessage, isRequired: isRequired }),
|
|
15
|
+
react_1.default.createElement(react_2.Textarea, { id: id, placeholder: placeholder, value: value, onChange: onChange, size: size, resize: resize, isDisabled: isDisabled, isReadOnly: isReadOnly, isInvalid: error, width: width, rows: rows, height: height, autoComplete: autoComplete }),
|
|
16
|
+
error && react_1.default.createElement(ErrorMessage_1.default, { errorMessage: errorMessage }),
|
|
17
|
+
helperText && !error && react_1.default.createElement(HelperText_1.default, { helperText: helperText })));
|
|
15
18
|
}
|
|
16
19
|
exports.default = InputTextArea;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Textarea = void 0;
|
|
4
|
+
exports.Textarea = {
|
|
5
|
+
baseStyle: {
|
|
6
|
+
fontWeight: 500,
|
|
7
|
+
fontSize: "0.875rem",
|
|
8
|
+
letterSpacing: "0.044rem",
|
|
9
|
+
pt: "0.813rem",
|
|
10
|
+
pb: "0.813rem",
|
|
11
|
+
borderRadius: "0.25rem",
|
|
12
|
+
_placeholder: {
|
|
13
|
+
fontStyle: "italic",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
sizes: {
|
|
17
|
+
md: {
|
|
18
|
+
fontSize: "0.875rem",
|
|
19
|
+
h: "2.75rem",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
variants: {
|
|
23
|
+
outline: function (props) {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
25
|
+
var theme = props.theme;
|
|
26
|
+
var errorColor = (_c = (_b = (_a = theme.colors.semantic) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b[500]) !== null && _c !== void 0 ? _c : "red.500";
|
|
27
|
+
var borderColor = (_e = (_d = theme.colors.boxborder) === null || _d === void 0 ? void 0 : _d[500]) !== null && _e !== void 0 ? _e : "gray.300";
|
|
28
|
+
var shadowPrimary = (_g = (_f = theme.colors.boxShadow) === null || _f === void 0 ? void 0 : _f.primary) !== null && _g !== void 0 ? _g : "blue.100";
|
|
29
|
+
var shadowError = (_j = (_h = theme.colors.boxShadow) === null || _h === void 0 ? void 0 : _h.error) !== null && _j !== void 0 ? _j : "red.100";
|
|
30
|
+
var primary = (_l = (_k = theme.colors.primary) === null || _k === void 0 ? void 0 : _k[500]) !== null && _l !== void 0 ? _l : "blue.500";
|
|
31
|
+
return {
|
|
32
|
+
border: "0.063rem solid",
|
|
33
|
+
borderColor: borderColor,
|
|
34
|
+
bg: (_o = (_m = theme.colors.gray) === null || _m === void 0 ? void 0 : _m[50]) !== null && _o !== void 0 ? _o : "gray.50",
|
|
35
|
+
_hover: {
|
|
36
|
+
borderColor: primary,
|
|
37
|
+
outline: "0",
|
|
38
|
+
},
|
|
39
|
+
_focus: {
|
|
40
|
+
borderColor: primary,
|
|
41
|
+
boxShadow: "0 0 0 0.125rem ".concat(shadowPrimary),
|
|
42
|
+
outline: "0",
|
|
43
|
+
},
|
|
44
|
+
_invalid: {
|
|
45
|
+
borderColor: errorColor,
|
|
46
|
+
boxShadow: "0 0 0 0.125rem ".concat(shadowError),
|
|
47
|
+
_hover: {
|
|
48
|
+
borderColor: errorColor,
|
|
49
|
+
outline: "0",
|
|
50
|
+
},
|
|
51
|
+
_focus: {
|
|
52
|
+
borderColor: errorColor,
|
|
53
|
+
boxShadow: "0 0 0 0.125rem ".concat(shadowError),
|
|
54
|
+
outline: "0",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
_readOnly: {
|
|
58
|
+
boxShadow: 'inherit',
|
|
59
|
+
},
|
|
60
|
+
_disabled: {
|
|
61
|
+
bg: (_q = (_p = theme.colors.gray) === null || _p === void 0 ? void 0 : _p[100]) !== null && _q !== void 0 ? _q : "gray.100",
|
|
62
|
+
opacity: 1,
|
|
63
|
+
cursor: "not-allowed",
|
|
64
|
+
_hover: {
|
|
65
|
+
border: "0.063rem solid",
|
|
66
|
+
borderColor: borderColor,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
defaultProps: {
|
|
73
|
+
variant: "outline",
|
|
74
|
+
size: "md",
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextareaProps } from "@chakra-ui/react";
|
|
2
|
-
export type InputTextAreaProps = Pick<TextareaProps, "placeholder" | "value" | "onChange" | "size" | "resize" | "isDisabled" | "errorBorderColor" | "focusBorderColor" | "isReadOnly" | "isRequired" | "variant"> & {
|
|
2
|
+
export type InputTextAreaProps = Pick<TextareaProps, "placeholder" | "value" | "onChange" | "id" | "size" | "resize" | "isDisabled" | "errorBorderColor" | "focusBorderColor" | "isReadOnly" | "isRequired" | "variant" | "autoComplete"> & {
|
|
3
3
|
label?: string;
|
|
4
4
|
error?: boolean;
|
|
5
5
|
errorMessage?: string;
|
|
@@ -7,4 +7,6 @@ export type InputTextAreaProps = Pick<TextareaProps, "placeholder" | "value" | "
|
|
|
7
7
|
width?: string | number;
|
|
8
8
|
rows?: number;
|
|
9
9
|
height?: string | number;
|
|
10
|
+
isInformation?: boolean;
|
|
11
|
+
informationMessage?: string;
|
|
10
12
|
};
|
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
var react_1 = __importStar(require("react"));
|
|
30
30
|
var react_2 = require("@chakra-ui/react");
|
|
31
31
|
var ProductTags_1 = __importDefault(require("./ProductTags"));
|
|
32
|
-
|
|
32
|
+
// import ProductReview from './ProductReview';
|
|
33
33
|
var ProductPrice_1 = __importDefault(require("./ProductPrice"));
|
|
34
34
|
var Button_1 = __importDefault(require("../Button/Button"));
|
|
35
35
|
var ProductLabel_1 = __importDefault(require("./ProductLabel"));
|
|
@@ -43,8 +43,6 @@ var ProductCard = function (_a) {
|
|
|
43
43
|
react_1.default.createElement(react_2.VStack, { spacing: 2, align: "start", mt: 3 },
|
|
44
44
|
react_1.default.createElement(ProductLabel_1.default, { label: label, description: description }),
|
|
45
45
|
tags && react_1.default.createElement(ProductTags_1.default, { tags: tags }),
|
|
46
|
-
rating && reviews &&
|
|
47
|
-
react_1.default.createElement(ProductReview_1.default, { rating: rating, reviewCount: reviews }),
|
|
48
46
|
options && react_1.default.createElement(ProductPrice_1.default, { options: options }),
|
|
49
47
|
onAddToCart && react_1.default.createElement(Button_1.default, { colorScheme: "orange", size: "sm", width: "100%", onClick: onAddToCart }, "Add to Cart"))));
|
|
50
48
|
};
|
package/dist/Pages/textArea.js
CHANGED
|
@@ -7,6 +7,9 @@ var react_1 = __importDefault(require("react"));
|
|
|
7
7
|
var InputTextArea_1 = __importDefault(require("../Components/InputTextArea/InputTextArea"));
|
|
8
8
|
var TextAreaPage = function () {
|
|
9
9
|
return (react_1.default.createElement("div", null,
|
|
10
|
-
react_1.default.createElement(InputTextArea_1.default, { label: "hello", helperText: "Hello",
|
|
10
|
+
react_1.default.createElement(InputTextArea_1.default, { label: "hello", helperText: "Hello",
|
|
11
|
+
// errorMessage="Required"
|
|
12
|
+
// error={true}
|
|
13
|
+
rows: 5 })));
|
|
11
14
|
};
|
|
12
15
|
exports.default = TextAreaPage;
|
|
@@ -4,4 +4,5 @@ export declare const componentStyles: {
|
|
|
4
4
|
Button: import("@chakra-ui/theme").ComponentStyleConfig;
|
|
5
5
|
Select: import("@chakra-ui/theme").ComponentStyleConfig;
|
|
6
6
|
Tag: import("@chakra-ui/theme").ComponentStyleConfig;
|
|
7
|
+
Textarea: import("@chakra-ui/theme").ComponentStyleConfig;
|
|
7
8
|
};
|
|
@@ -6,10 +6,12 @@ var Checkbox_styles_1 = require("../Components/Checkbox/Checkbox.styles");
|
|
|
6
6
|
var TextInput_styles_1 = require("../Components/Input/TextInput.styles");
|
|
7
7
|
var Select_styles_1 = require("../Components/Select/Select.styles");
|
|
8
8
|
var Tag_styles_1 = require("../Components/Tag/Tag.styles");
|
|
9
|
+
var InputTextArea_style_1 = require("../Components/InputTextArea/InputTextArea.style");
|
|
9
10
|
exports.componentStyles = {
|
|
10
11
|
Checkbox: Checkbox_styles_1.Checkbox,
|
|
11
12
|
Input: TextInput_styles_1.Input,
|
|
12
13
|
Button: Button_styles_1.Button,
|
|
13
14
|
Select: Select_styles_1.Select,
|
|
14
15
|
Tag: Tag_styles_1.Tag,
|
|
16
|
+
Textarea: InputTextArea_style_1.Textarea,
|
|
15
17
|
};
|