s-platform-landing-section 0.1.10-alpha.11 → 0.1.10-alpha.12

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 CHANGED
@@ -7350,13 +7350,18 @@ 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;
7354
7356
  var _useState = React.useState(defaultValue),
7355
7357
  value = _useState[0],
7356
7358
  _setValue = _useState[1];
7357
7359
  var _useState2 = React.useState(""),
7358
7360
  error = _useState2[0],
7359
7361
  _setError = _useState2[1];
7362
+ var _useState3 = React.useState(type),
7363
+ typeInput = _useState3[0],
7364
+ setTypeInput = _useState3[1];
7360
7365
  var refInput = React.useRef();
7361
7366
  React.useImperativeHandle(ref, function () {
7362
7367
  return {
@@ -7387,6 +7392,10 @@ var Input = React.forwardRef(function (props, ref) {
7387
7392
  _setError(e === null || e === void 0 ? void 0 : e.message);
7388
7393
  count++;
7389
7394
  break;
7395
+ } else if ((e === null || e === void 0 ? void 0 : e.type) === "validate" && !(e !== null && e !== void 0 && e.validate)) {
7396
+ _setError(e === null || e === void 0 ? void 0 : e.message);
7397
+ count++;
7398
+ break;
7390
7399
  }
7391
7400
  }
7392
7401
  if (count) {
@@ -7411,6 +7420,11 @@ var Input = React.forwardRef(function (props, ref) {
7411
7420
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
7412
7421
  }
7413
7422
  };
7423
+ var changeHidden = function changeHidden() {
7424
+ if (typeInput === "text") setTypeInput("password");else {
7425
+ setTypeInput("text");
7426
+ }
7427
+ };
7414
7428
  var _className = "h-10 py-1 px-2 border border-stroke rounded " + className;
7415
7429
  var _inputClassName = (isQuantity ? "text-center w-12" : "") + " focus:outline-none focus:ring-0 " + inputClassName;
7416
7430
  var required = !!(rules !== null && rules !== void 0 && rules.find(function (e) {
@@ -7430,7 +7444,7 @@ var Input = React.forwardRef(function (props, ref) {
7430
7444
  return changeQuantity(-1);
7431
7445
  }
7432
7446
  }, /*#__PURE__*/React__default.createElement(fa6.FaMinus, null)) : null, /*#__PURE__*/React__default.createElement("input", {
7433
- type: type,
7447
+ type: typeInput,
7434
7448
  name: name,
7435
7449
  value: value,
7436
7450
  placeholder: placeholder,
@@ -7438,7 +7452,13 @@ var Input = React.forwardRef(function (props, ref) {
7438
7452
  required: required,
7439
7453
  className: _inputClassName,
7440
7454
  ref: refInput
7441
- }), isQuantity ? /*#__PURE__*/React__default.createElement("button", {
7455
+ }), isHidden ? /*#__PURE__*/React__default.createElement("button", {
7456
+ onClick: function onClick() {
7457
+ changeHidden();
7458
+ }
7459
+ }, /*#__PURE__*/React__default.createElement(fa6.FaRegEyeSlash, {
7460
+ className: "font-semibold"
7461
+ })) : null, isQuantity ? /*#__PURE__*/React__default.createElement("button", {
7442
7462
  onClick: function onClick() {
7443
7463
  return changeQuantity(1);
7444
7464
  }
@@ -7448,7 +7468,6 @@ var Input = React.forwardRef(function (props, ref) {
7448
7468
  });
7449
7469
 
7450
7470
  var Select = React.forwardRef(function (props, ref) {
7451
- var _Object$values;
7452
7471
  var _props$label = props.label,
7453
7472
  label = _props$label === void 0 ? "" : _props$label,
7454
7473
  _props$labelClassName = props.labelClassName,
@@ -7501,13 +7520,6 @@ var Select = React.forwardRef(function (props, ref) {
7501
7520
  dropdownPosition = _useState6[0],
7502
7521
  setDropdownPosition = _useState6[1];
7503
7522
  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
7523
  React.useEffect(function () {
7512
7524
  if (isMulti) setValue(defaultValue);
7513
7525
  }, [defaultValue]);
@@ -7619,7 +7631,10 @@ var Select = React.forwardRef(function (props, ref) {
7619
7631
  return (value === null || value === void 0 ? void 0 : value.value) == valueId;
7620
7632
  };
7621
7633
  var handleSelection = function handleSelection(item) {
7622
- if (!isMulti) setValue(item);
7634
+ if (!isMulti) {
7635
+ setValue(item);
7636
+ setIsOpen(false);
7637
+ }
7623
7638
  onClick === null || onClick === void 0 ? void 0 : onClick(item);
7624
7639
  };
7625
7640
  var handleDeleteSelection = function handleDeleteSelection(e, item) {
@@ -7647,14 +7662,12 @@ var Select = React.forwardRef(function (props, ref) {
7647
7662
  className: "flex justify-between items-center w-full"
7648
7663
  }, isEmpty(value) || isMulti ? /*#__PURE__*/React__default.createElement("div", {
7649
7664
  className: "text-gray3 line-clamp-1"
7650
- }, placeholder) : renderItem && !isEmpty(value) && !isMulti ? /*#__PURE__*/React__default.createElement("div", {
7651
- className: "w-full",
7665
+ }, placeholder) : /*#__PURE__*/React__default.createElement("div", {
7666
+ className: "w-full text-start pointer-events-none",
7652
7667
  dangerouslySetInnerHTML: {
7653
- __html: Object === null || Object === void 0 ? void 0 : (_Object$values = Object.values(value)) === null || _Object$values === void 0 ? void 0 : _Object$values[0]
7668
+ __html: value === null || value === void 0 ? void 0 : value.label
7654
7669
  }
7655
- }) : /*#__PURE__*/React__default.createElement("div", {
7656
- className: "line-clamp-1"
7657
- }, value === null || value === void 0 ? void 0 : value.label), isButtonDelete && !isEmpty(value) ? /*#__PURE__*/React__default.createElement("div", {
7670
+ }), isButtonDelete && !isEmpty(value) ? /*#__PURE__*/React__default.createElement("div", {
7658
7671
  onClick: function onClick(e) {
7659
7672
  handleDeleteSelection(e, value);
7660
7673
  }
@@ -7813,13 +7826,18 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
7813
7826
  inputClassName = _props$inputClassName === void 0 ? "" : _props$inputClassName,
7814
7827
  _props$labelClassName = props.labelClassName,
7815
7828
  labelClassName = _props$labelClassName === void 0 ? "" : _props$labelClassName,
7816
- buttonClassName = props.buttonClassName;
7817
- var _useState = React.useState(defaultValue),
7829
+ _props$options = props.options,
7830
+ options = _props$options === void 0 ? [{
7831
+ 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>",
7832
+ country: "Việt Nam",
7833
+ value: "+84"
7834
+ }] : _props$options;
7835
+ var _useState = React.useState(""),
7818
7836
  value = _useState[0],
7819
7837
  _setValue = _useState[1];
7820
7838
  var _useState2 = React.useState({
7821
- 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>",
7822
- label: "Việt Nam",
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",
7823
7841
  value: "+84"
7824
7842
  }),
7825
7843
  countryCode = _useState2[0],
@@ -7827,6 +7845,11 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
7827
7845
  var _useState3 = React.useState(""),
7828
7846
  error = _useState3[0],
7829
7847
  _setError = _useState3[1];
7848
+ React.useEffect(function () {
7849
+ if (defaultValue) {
7850
+ _setValue("+" + defaultValue);
7851
+ }
7852
+ }, []);
7830
7853
  var handleOnChange = function handleOnChange(event) {
7831
7854
  var value = event.target.value;
7832
7855
  _setValue(value);
@@ -7841,8 +7864,10 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
7841
7864
  return _setValue(text);
7842
7865
  },
7843
7866
  getValue: function getValue() {
7844
- var phoneNumber = (countryCode === null || countryCode === void 0 ? void 0 : countryCode.value) + (value === null || value === void 0 ? void 0 : value.slice(1));
7845
- return phoneNumber;
7867
+ if (!(value !== null && value !== void 0 && value.startsWith(countryCode === null || countryCode === void 0 ? void 0 : countryCode.value))) {
7868
+ return (countryCode === null || countryCode === void 0 ? void 0 : countryCode.value) + (value === null || value === void 0 ? void 0 : value.replace(/^0/, ''));
7869
+ }
7870
+ return value;
7846
7871
  },
7847
7872
  setError: function setError(err) {
7848
7873
  return _setError(err);
@@ -7878,40 +7903,36 @@ var InputPhoneNumber = React.forwardRef(function (props, ref) {
7878
7903
  className: "text-danger"
7879
7904
  }, " *") : null;
7880
7905
  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
7906
  return /*#__PURE__*/React__default.createElement("div", {
7887
7907
  className: "flex flex-col " + wrapClassName
7888
7908
  }, label ? /*#__PURE__*/React__default.createElement("label", {
7889
7909
  className: "mb-1 " + labelClassName
7890
7910
  }, label, labelRequired) : null, /*#__PURE__*/React__default.createElement("div", {
7891
- className: "flex items-center h-10 rounded-lg border px-2 py-1 " + className
7911
+ className: "flex items-center h-10 rounded-lg border pr-2 py-1 " + className
7892
7912
  }, /*#__PURE__*/React__default.createElement("button", {
7893
- className: "flex items-center border-r-2 " + buttonClassName
7913
+ className: "border-r-2"
7894
7914
  }, /*#__PURE__*/React__default.createElement(Select$1, {
7895
7915
  className: 'w-max border-0',
7896
7916
  defaultValue: countryCode,
7897
- options: data,
7917
+ options: options,
7898
7918
  optionClassName: "w-max",
7899
7919
  placeholder: "+84",
7900
7920
  onClick: setCountryCode,
7901
- selectClassName: "ps-0 pr-1",
7921
+ selectClassName: "ps-2 pr-1",
7902
7922
  renderItem: function renderItem(item) {
7903
7923
  return /*#__PURE__*/React__default.createElement("div", {
7904
7924
  className: "flex gap-3 items-center w-full"
7905
7925
  }, /*#__PURE__*/React__default.createElement("div", {
7906
7926
  dangerouslySetInnerHTML: {
7907
- __html: item === null || item === void 0 ? void 0 : item.icons
7927
+ __html: item === null || item === void 0 ? void 0 : item.label
7908
7928
  }
7909
7929
  }), /*#__PURE__*/React__default.createElement("div", {
7910
7930
  className: "text-start flex-1 text-sm"
7911
- }, item === null || item === void 0 ? void 0 : item.label), /*#__PURE__*/React__default.createElement("div", {
7931
+ }, item === null || item === void 0 ? void 0 : item.country), /*#__PURE__*/React__default.createElement("div", {
7912
7932
  className: "text-gray3"
7913
7933
  }, item === null || item === void 0 ? void 0 : item.value));
7914
- }
7934
+ },
7935
+ wrapClassName: "w-full"
7915
7936
  })), /*#__PURE__*/React__default.createElement("input", {
7916
7937
  type: type,
7917
7938
  name: name,
@@ -7934,7 +7955,7 @@ var formatCurrency = function formatCurrency(amount) {
7934
7955
  return formattedAmount + " \u20AB";
7935
7956
  };
7936
7957
  var pattern = {
7937
- phoneNumberPattern: /^0[0-9]{9}$/
7958
+ phoneNumberPattern: /^(?:\+84|0)\d{9}$/
7938
7959
  };
7939
7960
  var numberPattern = /^\d+$/;
7940
7961