s-platform-landing-section 0.1.10-alpha.11 → 0.1.10-alpha.14
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/index.js +68 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +70 -41
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7350,13 +7350,21 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7350
7350
|
_props$min = props.min,
|
|
7351
7351
|
min = _props$min === void 0 ? 0 : _props$min,
|
|
7352
7352
|
_props$max = props.max,
|
|
7353
|
-
max = _props$max === void 0 ? null : _props$max
|
|
7353
|
+
max = _props$max === void 0 ? null : _props$max,
|
|
7354
|
+
_props$isHidden = props.isHidden,
|
|
7355
|
+
isHidden = _props$isHidden === void 0 ? false : _props$isHidden,
|
|
7356
|
+
icons = props.icons,
|
|
7357
|
+
_props$iconsClassName = props.iconsClassName,
|
|
7358
|
+
iconsClassName = _props$iconsClassName === void 0 ? "" : _props$iconsClassName;
|
|
7354
7359
|
var _useState = React.useState(defaultValue),
|
|
7355
7360
|
value = _useState[0],
|
|
7356
7361
|
_setValue = _useState[1];
|
|
7357
7362
|
var _useState2 = React.useState(""),
|
|
7358
7363
|
error = _useState2[0],
|
|
7359
7364
|
_setError = _useState2[1];
|
|
7365
|
+
var _useState3 = React.useState(type),
|
|
7366
|
+
typeInput = _useState3[0],
|
|
7367
|
+
setTypeInput = _useState3[1];
|
|
7360
7368
|
var refInput = React.useRef();
|
|
7361
7369
|
React.useImperativeHandle(ref, function () {
|
|
7362
7370
|
return {
|
|
@@ -7377,7 +7385,7 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7377
7385
|
var _validateData = function _validateData() {
|
|
7378
7386
|
var count = 0;
|
|
7379
7387
|
for (var _iterator = _createForOfIteratorHelperLoose(rules), _step; !(_step = _iterator()).done;) {
|
|
7380
|
-
var _e$pattern;
|
|
7388
|
+
var _e$pattern, _e$validate;
|
|
7381
7389
|
var e = _step.value;
|
|
7382
7390
|
if ((e === null || e === void 0 ? void 0 : e.type) === 'required' && value === '') {
|
|
7383
7391
|
_setError(e === null || e === void 0 ? void 0 : e.message);
|
|
@@ -7387,6 +7395,10 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7387
7395
|
_setError(e === null || e === void 0 ? void 0 : e.message);
|
|
7388
7396
|
count++;
|
|
7389
7397
|
break;
|
|
7398
|
+
} else if ((e === null || e === void 0 ? void 0 : e.type) === "validate" && e !== null && e !== void 0 && e.validate && !(e !== null && e !== void 0 && (_e$validate = e.validate) !== null && _e$validate !== void 0 && _e$validate.call(e))) {
|
|
7399
|
+
_setError(e === null || e === void 0 ? void 0 : e.message);
|
|
7400
|
+
count++;
|
|
7401
|
+
break;
|
|
7390
7402
|
}
|
|
7391
7403
|
}
|
|
7392
7404
|
if (count) {
|
|
@@ -7411,6 +7423,11 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7411
7423
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
7412
7424
|
}
|
|
7413
7425
|
};
|
|
7426
|
+
var changeHidden = function changeHidden() {
|
|
7427
|
+
if (typeInput === "text") setTypeInput("password");else {
|
|
7428
|
+
setTypeInput("text");
|
|
7429
|
+
}
|
|
7430
|
+
};
|
|
7414
7431
|
var _className = "h-10 py-1 px-2 border border-stroke rounded " + className;
|
|
7415
7432
|
var _inputClassName = (isQuantity ? "text-center w-12" : "") + " focus:outline-none focus:ring-0 " + inputClassName;
|
|
7416
7433
|
var required = !!(rules !== null && rules !== void 0 && rules.find(function (e) {
|
|
@@ -7429,8 +7446,13 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7429
7446
|
onClick: function onClick() {
|
|
7430
7447
|
return changeQuantity(-1);
|
|
7431
7448
|
}
|
|
7432
|
-
}, /*#__PURE__*/React__default.createElement(fa6.FaMinus, null)) : null, /*#__PURE__*/React__default.createElement("
|
|
7433
|
-
|
|
7449
|
+
}, /*#__PURE__*/React__default.createElement(fa6.FaMinus, null)) : null, icons ? /*#__PURE__*/React__default.createElement("div", {
|
|
7450
|
+
className: "object-cover\t " + iconsClassName,
|
|
7451
|
+
dangerouslySetInnerHTML: {
|
|
7452
|
+
__html: icons
|
|
7453
|
+
}
|
|
7454
|
+
}) : null, /*#__PURE__*/React__default.createElement("input", {
|
|
7455
|
+
type: typeInput,
|
|
7434
7456
|
name: name,
|
|
7435
7457
|
value: value,
|
|
7436
7458
|
placeholder: placeholder,
|
|
@@ -7438,7 +7460,13 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7438
7460
|
required: required,
|
|
7439
7461
|
className: _inputClassName,
|
|
7440
7462
|
ref: refInput
|
|
7441
|
-
}),
|
|
7463
|
+
}), isHidden ? /*#__PURE__*/React__default.createElement("button", {
|
|
7464
|
+
onClick: function onClick() {
|
|
7465
|
+
changeHidden();
|
|
7466
|
+
}
|
|
7467
|
+
}, /*#__PURE__*/React__default.createElement(fa6.FaRegEyeSlash, {
|
|
7468
|
+
className: "font-semibold"
|
|
7469
|
+
})) : null, isQuantity ? /*#__PURE__*/React__default.createElement("button", {
|
|
7442
7470
|
onClick: function onClick() {
|
|
7443
7471
|
return changeQuantity(1);
|
|
7444
7472
|
}
|
|
@@ -7448,7 +7476,6 @@ var Input = React.forwardRef(function (props, ref) {
|
|
|
7448
7476
|
});
|
|
7449
7477
|
|
|
7450
7478
|
var Select = React.forwardRef(function (props, ref) {
|
|
7451
|
-
var _Object$values;
|
|
7452
7479
|
var _props$label = props.label,
|
|
7453
7480
|
label = _props$label === void 0 ? "" : _props$label,
|
|
7454
7481
|
_props$labelClassName = props.labelClassName,
|
|
@@ -7501,13 +7528,6 @@ var Select = React.forwardRef(function (props, ref) {
|
|
|
7501
7528
|
dropdownPosition = _useState6[0],
|
|
7502
7529
|
setDropdownPosition = _useState6[1];
|
|
7503
7530
|
var inputRef = React.useRef(null);
|
|
7504
|
-
React.useEffect(function () {
|
|
7505
|
-
if (isMulti) return;else {
|
|
7506
|
-
setIsOpen(false);
|
|
7507
|
-
setInputSearch("");
|
|
7508
|
-
setListOptions(options);
|
|
7509
|
-
}
|
|
7510
|
-
}, [value]);
|
|
7511
7531
|
React.useEffect(function () {
|
|
7512
7532
|
if (isMulti) setValue(defaultValue);
|
|
7513
7533
|
}, [defaultValue]);
|
|
@@ -7619,7 +7639,10 @@ var Select = React.forwardRef(function (props, ref) {
|
|
|
7619
7639
|
return (value === null || value === void 0 ? void 0 : value.value) == valueId;
|
|
7620
7640
|
};
|
|
7621
7641
|
var handleSelection = function handleSelection(item) {
|
|
7622
|
-
if (!isMulti)
|
|
7642
|
+
if (!isMulti) {
|
|
7643
|
+
setValue(item);
|
|
7644
|
+
setIsOpen(false);
|
|
7645
|
+
}
|
|
7623
7646
|
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
7624
7647
|
};
|
|
7625
7648
|
var handleDeleteSelection = function handleDeleteSelection(e, item) {
|
|
@@ -7647,14 +7670,12 @@ var Select = React.forwardRef(function (props, ref) {
|
|
|
7647
7670
|
className: "flex justify-between items-center w-full"
|
|
7648
7671
|
}, isEmpty(value) || isMulti ? /*#__PURE__*/React__default.createElement("div", {
|
|
7649
7672
|
className: "text-gray3 line-clamp-1"
|
|
7650
|
-
}, placeholder) :
|
|
7651
|
-
className: "w-full",
|
|
7673
|
+
}, placeholder) : /*#__PURE__*/React__default.createElement("div", {
|
|
7674
|
+
className: "w-full text-start pointer-events-none",
|
|
7652
7675
|
dangerouslySetInnerHTML: {
|
|
7653
|
-
__html:
|
|
7676
|
+
__html: value === null || value === void 0 ? void 0 : value.label
|
|
7654
7677
|
}
|
|
7655
|
-
})
|
|
7656
|
-
className: "line-clamp-1"
|
|
7657
|
-
}, value === null || value === void 0 ? void 0 : value.label), isButtonDelete && !isEmpty(value) ? /*#__PURE__*/React__default.createElement("div", {
|
|
7678
|
+
}), isButtonDelete && !isEmpty(value) ? /*#__PURE__*/React__default.createElement("div", {
|
|
7658
7679
|
onClick: function onClick(e) {
|
|
7659
7680
|
handleDeleteSelection(e, value);
|
|
7660
7681
|
}
|
|
@@ -7813,13 +7834,18 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
|
|
|
7813
7834
|
inputClassName = _props$inputClassName === void 0 ? "" : _props$inputClassName,
|
|
7814
7835
|
_props$labelClassName = props.labelClassName,
|
|
7815
7836
|
labelClassName = _props$labelClassName === void 0 ? "" : _props$labelClassName,
|
|
7816
|
-
|
|
7817
|
-
|
|
7837
|
+
_props$options = props.options,
|
|
7838
|
+
options = _props$options === void 0 ? [{
|
|
7839
|
+
label: "<svg width=\"20\" height=\"20\" viewBox=\"0 0 36 36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--twemoji\" preserveAspectRatio=\"xMidYMid meet\"><path fill=\"#DA251D\" d=\"M32 5H4a4 4 0 0 0-4 4v18a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4V9a4 4 0 0 0-4-4z\"></path><path fill=\"#FF0\" d=\"M19.753 16.037L18 10.642l-1.753 5.395h-5.672l4.589 3.333l-1.753 5.395L18 21.431l4.589 3.334l-1.753-5.395l4.589-3.333z\"></path></svg>",
|
|
7840
|
+
country: "Việt Nam",
|
|
7841
|
+
value: "+84"
|
|
7842
|
+
}] : _props$options;
|
|
7843
|
+
var _useState = React.useState(""),
|
|
7818
7844
|
value = _useState[0],
|
|
7819
7845
|
_setValue = _useState[1];
|
|
7820
7846
|
var _useState2 = React.useState({
|
|
7821
|
-
|
|
7822
|
-
|
|
7847
|
+
label: "<svg width=\"20\" height=\"20\" viewBox=\"0 0 36 36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--twemoji\" preserveAspectRatio=\"xMidYMid meet\"><path fill=\"#DA251D\" d=\"M32 5H4a4 4 0 0 0-4 4v18a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4V9a4 4 0 0 0-4-4z\"></path><path fill=\"#FF0\" d=\"M19.753 16.037L18 10.642l-1.753 5.395h-5.672l4.589 3.333l-1.753 5.395L18 21.431l4.589 3.334l-1.753-5.395l4.589-3.333z\"></path></svg>",
|
|
7848
|
+
country: "Việt Nam",
|
|
7823
7849
|
value: "+84"
|
|
7824
7850
|
}),
|
|
7825
7851
|
countryCode = _useState2[0],
|
|
@@ -7827,6 +7853,11 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
|
|
|
7827
7853
|
var _useState3 = React.useState(""),
|
|
7828
7854
|
error = _useState3[0],
|
|
7829
7855
|
_setError = _useState3[1];
|
|
7856
|
+
React.useEffect(function () {
|
|
7857
|
+
if (defaultValue) {
|
|
7858
|
+
_setValue("+" + defaultValue);
|
|
7859
|
+
}
|
|
7860
|
+
}, []);
|
|
7830
7861
|
var handleOnChange = function handleOnChange(event) {
|
|
7831
7862
|
var value = event.target.value;
|
|
7832
7863
|
_setValue(value);
|
|
@@ -7841,8 +7872,10 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
|
|
|
7841
7872
|
return _setValue(text);
|
|
7842
7873
|
},
|
|
7843
7874
|
getValue: function getValue() {
|
|
7844
|
-
|
|
7845
|
-
|
|
7875
|
+
if (!(value !== null && value !== void 0 && value.startsWith(countryCode === null || countryCode === void 0 ? void 0 : countryCode.value))) {
|
|
7876
|
+
return (countryCode === null || countryCode === void 0 ? void 0 : countryCode.value) + (value === null || value === void 0 ? void 0 : value.replace(/^0/, ''));
|
|
7877
|
+
}
|
|
7878
|
+
return value;
|
|
7846
7879
|
},
|
|
7847
7880
|
setError: function setError(err) {
|
|
7848
7881
|
return _setError(err);
|
|
@@ -7878,40 +7911,36 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
|
|
|
7878
7911
|
className: "text-danger"
|
|
7879
7912
|
}, " *") : null;
|
|
7880
7913
|
var _inputClassName = "h-full w-full px-2 focus:outline-none focus:ring-0 " + inputClassName;
|
|
7881
|
-
var data = React.useCallback([{
|
|
7882
|
-
icons: "<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 36 36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--twemoji\" preserveAspectRatio=\"xMidYMid meet\"><path fill=\"#DA251D\" d=\"M32 5H4a4 4 0 0 0-4 4v18a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4V9a4 4 0 0 0-4-4z\"></path><path fill=\"#FF0\" d=\"M19.753 16.037L18 10.642l-1.753 5.395h-5.672l4.589 3.333l-1.753 5.395L18 21.431l4.589 3.334l-1.753-5.395l4.589-3.333z\"></path></svg>",
|
|
7883
|
-
label: "Việt Nam",
|
|
7884
|
-
value: "+84"
|
|
7885
|
-
}], []);
|
|
7886
7914
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
7887
7915
|
className: "flex flex-col " + wrapClassName
|
|
7888
7916
|
}, label ? /*#__PURE__*/React__default.createElement("label", {
|
|
7889
7917
|
className: "mb-1 " + labelClassName
|
|
7890
7918
|
}, label, labelRequired) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
7891
|
-
className: "flex items-center h-10 rounded-lg border
|
|
7919
|
+
className: "flex items-center h-10 rounded-lg border pr-2 py-1 " + className
|
|
7892
7920
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
7893
|
-
className: "
|
|
7921
|
+
className: "border-r-2"
|
|
7894
7922
|
}, /*#__PURE__*/React__default.createElement(Select$1, {
|
|
7895
7923
|
className: 'w-max border-0',
|
|
7896
7924
|
defaultValue: countryCode,
|
|
7897
|
-
options:
|
|
7925
|
+
options: options,
|
|
7898
7926
|
optionClassName: "w-max",
|
|
7899
7927
|
placeholder: "+84",
|
|
7900
7928
|
onClick: setCountryCode,
|
|
7901
|
-
selectClassName: "ps-
|
|
7929
|
+
selectClassName: "ps-2 pr-1",
|
|
7902
7930
|
renderItem: function renderItem(item) {
|
|
7903
7931
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
7904
7932
|
className: "flex gap-3 items-center w-full"
|
|
7905
7933
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
7906
7934
|
dangerouslySetInnerHTML: {
|
|
7907
|
-
__html: item === null || item === void 0 ? void 0 : item.
|
|
7935
|
+
__html: item === null || item === void 0 ? void 0 : item.label
|
|
7908
7936
|
}
|
|
7909
7937
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
7910
7938
|
className: "text-start flex-1 text-sm"
|
|
7911
|
-
}, item === null || item === void 0 ? void 0 : item.
|
|
7939
|
+
}, item === null || item === void 0 ? void 0 : item.country), /*#__PURE__*/React__default.createElement("div", {
|
|
7912
7940
|
className: "text-gray3"
|
|
7913
7941
|
}, item === null || item === void 0 ? void 0 : item.value));
|
|
7914
|
-
}
|
|
7942
|
+
},
|
|
7943
|
+
wrapClassName: "w-full"
|
|
7915
7944
|
})), /*#__PURE__*/React__default.createElement("input", {
|
|
7916
7945
|
type: type,
|
|
7917
7946
|
name: name,
|
|
@@ -7934,7 +7963,7 @@ var formatCurrency = function formatCurrency(amount) {
|
|
|
7934
7963
|
return formattedAmount + " \u20AB";
|
|
7935
7964
|
};
|
|
7936
7965
|
var pattern = {
|
|
7937
|
-
phoneNumberPattern: /^0
|
|
7966
|
+
phoneNumberPattern: /^(?:\+84|0)\d{9}$/
|
|
7938
7967
|
};
|
|
7939
7968
|
var numberPattern = /^\d+$/;
|
|
7940
7969
|
|