esewa-ui-library 1.0.4 → 1.0.6

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
@@ -7083,18 +7083,22 @@ var EsewaFullPageLoadingScreen = function EsewaFullPageLoadingScreen(_ref) {
7083
7083
  };
7084
7084
 
7085
7085
  var _templateObject$l;
7086
- var StyledRadio = styled__default.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n .container{\n display:flex;\n align-items: center;\n gap: 8px;\n }\n\n .container input[type=\"radio\" i] {\n margin: 0;\n appearance: none;\n width: 16px;\n height: 16px;\n border: 2px solid var(--secondary);\n border-radius: 50%;\n position: relative;\n cursor: pointer;\n transition: border-color 0.3s ease;\n }\n\n .container input[type=\"radio\"]:checked {\n border-color: var(--primary);\n }\n\n .container input[type=\"radio\"]::before {\n content: '';\n width: 10px;\n height: 10px;\n background-color: transparent;\n border-radius: 50%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n transition: background-color 0.3s ease;\n }\n\n .container input[type=\"radio\"]:checked::before {\n background-color: var(--primary);\n }\n"])));
7086
+ var StyledRadio = styled__default.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n .container{\n display:flex;\n align-items: center;\n gap: 8px;\n }\n\n .container input[type=\"radio\" i] {\n margin: 0;\n appearance: none;\n width: 16px;\n height: 16px;\n border: 2px solid var(--secondary);\n border-radius: 50%;\n position: relative;\n cursor: pointer;\n transition: border-color 0.3s ease;\n }\n\n .container input[type=\"radio\"]:checked {\n border-color: var(--primary);\n }\n\n .container input[type=\"radio\"]::before {\n content: '';\n width: 10px;\n height: 10px;\n background-color: transparent;\n border-radius: 50%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n transition: background-color 0.3s ease;\n }\n\n .container input[type=\"radio\"]:checked::before {\n background-color: var(--primary);\n }\n\n .container input[type=\"radio\"]:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n"])));
7087
7087
  var ESewaRadio = function ESewaRadio(_ref) {
7088
7088
  var label = _ref.label,
7089
+ value = _ref.value,
7089
7090
  name = _ref.name,
7090
7091
  className = _ref.className,
7091
7092
  _ref$labelClass = _ref.labelClass,
7092
7093
  labelClass = _ref$labelClass === void 0 ? '' : _ref$labelClass,
7093
7094
  onChange = _ref.onChange,
7094
- checked = _ref.checked;
7095
+ _ref$checked = _ref.checked,
7096
+ checked = _ref$checked === void 0 ? false : _ref$checked,
7097
+ _ref$disabled = _ref.disabled,
7098
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
7095
7099
  var handleRadioChange = function handleRadioChange(e) {
7096
- if (onChange) {
7097
- onChange(e.target.checked);
7100
+ if (onChange && !disabled) {
7101
+ onChange(value, e.target.checked);
7098
7102
  }
7099
7103
  };
7100
7104
  return React__default.createElement(StyledRadio, null, React__default.createElement("div", {
@@ -7104,8 +7108,10 @@ var ESewaRadio = function ESewaRadio(_ref) {
7104
7108
  }, React__default.createElement("input", {
7105
7109
  type: 'radio',
7106
7110
  name: name,
7111
+ value: value,
7107
7112
  checked: checked,
7108
- onChange: handleRadioChange
7113
+ onChange: handleRadioChange,
7114
+ disabled: disabled
7109
7115
  }), React__default.createElement("span", {
7110
7116
  className: "" + labelClass
7111
7117
  }, label))));
@@ -7685,16 +7691,21 @@ var CONNECT_APP = function CONNECT_APP(data) {
7685
7691
  if ((_window$webkit = window.webkit) !== null && _window$webkit !== void 0 && _window$webkit.messageHandlers.iOSNative) {
7686
7692
  window.webkit.messageHandlers.iOSNative.postMessage(data);
7687
7693
  } else {
7688
- console.warn('iOS interface not available');
7694
+ console.warn('IOS interface not available');
7689
7695
  }
7690
7696
  }
7691
7697
  };
7692
- var requestFromMiniApp = function requestFromMiniApp(data, callbackKey, callback) {
7693
- var _window$webkit2, _window$webkit2$messa;
7694
- if (window.Android && callbackKey in window.Android) {
7695
- window.Android[callbackKey] = callback;
7696
- } else if ((_window$webkit2 = window.webkit) !== null && _window$webkit2 !== void 0 && (_window$webkit2$messa = _window$webkit2.messageHandlers) !== null && _window$webkit2$messa !== void 0 && _window$webkit2$messa.iOSNative && callbackKey in window.webkit.messageHandlers.iOSNative) {
7697
- window.webkit.messageHandlers.iOSNative[callbackKey] = callback;
7698
+ var requestFromMiniApp = function requestFromMiniApp(data, callbackFn) {
7699
+ var callbackKey = data.callbackKey;
7700
+ if (!callbackKey) {
7701
+ throw new Error('Callback key is missing in request data');
7702
+ }
7703
+ if (isAndroid) {
7704
+ window.Android = window.Android || {};
7705
+ window.Android[callbackKey] = callbackFn;
7706
+ } else if (isiOS) {
7707
+ window.iOSNative = window.iOSNative || {};
7708
+ window.iOSNative[callbackKey] = callbackFn;
7698
7709
  }
7699
7710
  CONNECT_APP(JSON.stringify(data));
7700
7711
  };
@@ -7864,11 +7875,13 @@ var useDebounce = function useDebounce(value, delay) {
7864
7875
  };
7865
7876
 
7866
7877
  var loadGoogleFont = function loadGoogleFont() {
7867
- if (!document.querySelector("link[href*='Source+Sans+Pro']")) {
7868
- var link = document.createElement('link');
7869
- link.href = 'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap';
7870
- link.rel = 'stylesheet';
7871
- document.head.appendChild(link);
7878
+ if (typeof window !== 'undefined' && document) {
7879
+ if (!document.querySelector("link[href*='Source+Sans+Pro']")) {
7880
+ var link = document.createElement('link');
7881
+ link.href = 'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap';
7882
+ link.rel = 'stylesheet';
7883
+ document.head.appendChild(link);
7884
+ }
7872
7885
  }
7873
7886
  };
7874
7887
  loadGoogleFont();