@pelcro/react-pelcro-js 4.0.0-alpha.93 → 4.0.0-alpha.95

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.cjs.js CHANGED
@@ -21729,6 +21729,8 @@ var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
21729
21729
  });
21730
21730
  var StateManagedSelect$1 = StateManagedSelect;
21731
21731
 
21732
+ // Custom option component to show images and labels
21733
+
21732
21734
  const customSingleValue = ({
21733
21735
  data
21734
21736
  }) => /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21752,11 +21754,7 @@ const customOption = props => {
21752
21754
  return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
21753
21755
  ref: innerRef
21754
21756
  }, innerProps, {
21755
- className: "custom-option",
21756
- style: {
21757
- display: "flex",
21758
- alignItems: "center"
21759
- }
21757
+ className: "custom-option"
21760
21758
  }), /*#__PURE__*/React__default['default'].createElement("img", {
21761
21759
  src: data.image,
21762
21760
  alt: data.label,
@@ -21772,9 +21770,9 @@ const ImageSelect = ({
21772
21770
  ...props
21773
21771
  }) => {
21774
21772
  const options = optionsArray.map(option => ({
21775
- value: option.id,
21776
- label: option.name,
21777
- image: option.image
21773
+ value: option === null || option === void 0 ? void 0 : option.id,
21774
+ label: option === null || option === void 0 ? void 0 : option.name,
21775
+ image: option === null || option === void 0 ? void 0 : option.image
21778
21776
  }));
21779
21777
  return /*#__PURE__*/React__default['default'].createElement(StateManagedSelect$1, Object.assign({
21780
21778
  className: "plc-px-5",
@@ -26988,13 +26986,16 @@ class SelectModal extends React.Component {
26988
26986
  disableGifting
26989
26987
  } = this.props;
26990
26988
  const items = this.state.planList.map(plan => {
26991
- var _plan$entitlements, _this$state;
26989
+ var _this$state;
26992
26990
 
26993
26991
  // const isChecked = this.state.plan.id === plan.id ? true : false;
26994
26992
  let itemsArray = [];
26995
26993
 
26996
- if (plan.entitlements && ((_plan$entitlements = plan.entitlements) === null || _plan$entitlements === void 0 ? void 0 : _plan$entitlements.length) > 0) {
26997
- itemsArray = plan.entitlements.map(itemSkuId => window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId)));
26994
+ if (plan.entitlements && plan.entitlements.length > 0) {
26995
+ itemsArray = plan.entitlements.map(itemSkuId => {
26996
+ const skuNumber = Number(itemSkuId);
26997
+ return isNaN(skuNumber) ? null : window.Pelcro.ecommerce.products.getBySkuId(skuNumber);
26998
+ }).filter(item => item !== null);
26998
26999
  }
26999
27000
 
27000
27001
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -27013,7 +27014,7 @@ class SelectModal extends React.Component {
27013
27014
  className: "plc-px-8 plc-py-6 plc-text-center plc-w-full"
27014
27015
  }, /*#__PURE__*/React__default['default'].createElement("p", {
27015
27016
  className: "plc-text-xs plc-mt-1 pelcro-select-plan-description plc-text-gray-500"
27016
- }, plan.description)), plan.entitlements && /*#__PURE__*/React__default['default'].createElement(ImageSelect, {
27017
+ }, plan.description)), plan.entitlements && itemsArray && itemsArray.length > 0 && /*#__PURE__*/React__default['default'].createElement(ImageSelect, {
27017
27018
  optionsArray: itemsArray,
27018
27019
  onChange: e => {
27019
27020
  console.log(e.value);
package/dist/index.esm.js CHANGED
@@ -21699,6 +21699,8 @@ var StateManagedSelect = /*#__PURE__*/forwardRef(function (props, ref) {
21699
21699
  });
21700
21700
  var StateManagedSelect$1 = StateManagedSelect;
21701
21701
 
21702
+ // Custom option component to show images and labels
21703
+
21702
21704
  const customSingleValue = ({
21703
21705
  data
21704
21706
  }) => /*#__PURE__*/React__default.createElement("div", {
@@ -21722,11 +21724,7 @@ const customOption = props => {
21722
21724
  return /*#__PURE__*/React__default.createElement("div", Object.assign({
21723
21725
  ref: innerRef
21724
21726
  }, innerProps, {
21725
- className: "custom-option",
21726
- style: {
21727
- display: "flex",
21728
- alignItems: "center"
21729
- }
21727
+ className: "custom-option"
21730
21728
  }), /*#__PURE__*/React__default.createElement("img", {
21731
21729
  src: data.image,
21732
21730
  alt: data.label,
@@ -21742,9 +21740,9 @@ const ImageSelect = ({
21742
21740
  ...props
21743
21741
  }) => {
21744
21742
  const options = optionsArray.map(option => ({
21745
- value: option.id,
21746
- label: option.name,
21747
- image: option.image
21743
+ value: option === null || option === void 0 ? void 0 : option.id,
21744
+ label: option === null || option === void 0 ? void 0 : option.name,
21745
+ image: option === null || option === void 0 ? void 0 : option.image
21748
21746
  }));
21749
21747
  return /*#__PURE__*/React__default.createElement(StateManagedSelect$1, Object.assign({
21750
21748
  className: "plc-px-5",
@@ -26958,13 +26956,16 @@ class SelectModal extends Component {
26958
26956
  disableGifting
26959
26957
  } = this.props;
26960
26958
  const items = this.state.planList.map(plan => {
26961
- var _plan$entitlements, _this$state;
26959
+ var _this$state;
26962
26960
 
26963
26961
  // const isChecked = this.state.plan.id === plan.id ? true : false;
26964
26962
  let itemsArray = [];
26965
26963
 
26966
- if (plan.entitlements && ((_plan$entitlements = plan.entitlements) === null || _plan$entitlements === void 0 ? void 0 : _plan$entitlements.length) > 0) {
26967
- itemsArray = plan.entitlements.map(itemSkuId => window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId)));
26964
+ if (plan.entitlements && plan.entitlements.length > 0) {
26965
+ itemsArray = plan.entitlements.map(itemSkuId => {
26966
+ const skuNumber = Number(itemSkuId);
26967
+ return isNaN(skuNumber) ? null : window.Pelcro.ecommerce.products.getBySkuId(skuNumber);
26968
+ }).filter(item => item !== null);
26968
26969
  }
26969
26970
 
26970
26971
  return /*#__PURE__*/React__default.createElement("div", {
@@ -26983,7 +26984,7 @@ class SelectModal extends Component {
26983
26984
  className: "plc-px-8 plc-py-6 plc-text-center plc-w-full"
26984
26985
  }, /*#__PURE__*/React__default.createElement("p", {
26985
26986
  className: "plc-text-xs plc-mt-1 pelcro-select-plan-description plc-text-gray-500"
26986
- }, plan.description)), plan.entitlements && /*#__PURE__*/React__default.createElement(ImageSelect, {
26987
+ }, plan.description)), plan.entitlements && itemsArray && itemsArray.length > 0 && /*#__PURE__*/React__default.createElement(ImageSelect, {
26987
26988
  optionsArray: itemsArray,
26988
26989
  onChange: e => {
26989
26990
  console.log(e.value);
package/dist/pelcro.css CHANGED
@@ -1943,6 +1943,22 @@ Add the correct display in Chrome and Safari.
1943
1943
  display: flex !important;
1944
1944
  }
1945
1945
 
1946
+ .custom-option {
1947
+ display: flex;
1948
+ align-items: center;
1949
+ cursor: pointer; /* Show pointer cursor on hover */
1950
+ padding: 10px; /* Add padding for better hover area */
1951
+ }
1952
+
1953
+ .custom-option:hover {
1954
+ background-color: #f0f0f0; /* Highlight background on hover */
1955
+ }
1956
+
1957
+ .custom-single-value {
1958
+ display: flex;
1959
+ align-items: center;
1960
+ }
1961
+
1946
1962
  /*
1947
1963
  styling is copied from react-easy-crop/react-easy-crop.css
1948
1964
  in order to scope selectors under pelcro-root
@@ -4087,6 +4103,45 @@ apple-pay-button {
4087
4103
 
4088
4104
  /* purgecss start ignore */
4089
4105
 
4106
+ .custom-single-value {
4107
+ display: flex;
4108
+ align-items: center;
4109
+ }
4110
+
4111
+ .custom-option {
4112
+ display: flex;
4113
+ align-items: center;
4114
+ padding: 5px;
4115
+ }
4116
+
4117
+ .custom-option img {
4118
+ margin-right: 10px;
4119
+ }
4120
+
4121
+ .css-hlgwow {
4122
+ display: flex !important;
4123
+ }
4124
+
4125
+ .custom-option {
4126
+ display: flex;
4127
+ align-items: center;
4128
+ cursor: pointer; /* Show pointer cursor on hover */
4129
+ padding: 10px; /* Add padding for better hover area */
4130
+ }
4131
+
4132
+ .custom-option:hover {
4133
+ background-color: #f0f0f0; /* Highlight background on hover */
4134
+ }
4135
+
4136
+ .custom-single-value {
4137
+ display: flex;
4138
+ align-items: center;
4139
+ }
4140
+
4141
+ /* purgecss end ignore */
4142
+
4143
+ /* purgecss start ignore */
4144
+
4090
4145
  .toggle-switch {
4091
4146
  position: relative;
4092
4147
  display: inline-block;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "4.0.0-alpha.93",
4
+ "version": "4.0.0-alpha.95",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",