opus-toolkit-components 1.1.1 → 1.1.3

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.
@@ -12701,7 +12701,7 @@ const esm_ChevronDownIcon_ForwardRef = /*#__PURE__*/ external_react_.forwardRef(
12701
12701
 
12702
12702
  function Dropdown(_ref) {
12703
12703
  let {
12704
- items,
12704
+ items = [],
12705
12705
  label = 'Test Label',
12706
12706
  isValid = true,
12707
12707
  required = false,
@@ -12712,21 +12712,17 @@ function Dropdown(_ref) {
12712
12712
  tabIndex = '',
12713
12713
  onChange,
12714
12714
  value,
12715
+ // Controlled from parent
12715
12716
  Icon,
12716
12717
  errorMessage = 'This field is required',
12717
12718
  disabled = false,
12718
- dataCy // optional override
12719
+ dataCy
12719
12720
  } = _ref;
12720
- const [selectedItem, setSelectedItem] = (0,external_react_.useState)(null);
12721
12721
  const [isOpen, setIsOpen] = (0,external_react_.useState)(false);
12722
- (0,external_react_.useEffect)(() => {
12723
- const newSelectedItem = items.find(item => item.value === value) || null;
12724
- setSelectedItem(newSelectedItem);
12725
- }, [value, items]);
12722
+ const selectedItem = items.find(item => item.value === value) || null;
12726
12723
  const inputClasses = "inline-flex w-full justify-between items-center rounded-md bg-[--color-input-bg] text-md font-normal border p-2 text-[--color-text-weak] ".concat(isValid ? 'border-[--color-stroke]' : 'border-utilRed1000', " ").concat(disabled ? 'opacity-50 cursor-not-allowed' : '', " ").concat(className);
12727
12724
  const handleSelect = item => {
12728
- if (disabled) return;
12729
- setSelectedItem(item);
12725
+ if (disabled || item.value === value) return; // prevent repeat calls
12730
12726
  const event = {
12731
12727
  target: {
12732
12728
  name,
@@ -12776,7 +12772,7 @@ function Dropdown(_ref) {
12776
12772
  return /*#__PURE__*/external_react_default().createElement("button", {
12777
12773
  type: "button",
12778
12774
  onClick: () => handleSelect(item),
12779
- className: "block w-full px-4 py-2 text-left text-sm text-[--color-text-weak] ".concat(active ? 'bg-[--color-input-bg] text-[--color-text-weak]' : '', " hover:bg-[--color-input-bg]")
12775
+ className: "block w-full px-4 py-2 text-left text-sm text-[--color-text-weak] ".concat(active ? 'bg-[--color-input-bg]' : '', " hover:bg-[--color-input-bg]")
12780
12776
  }, item.label);
12781
12777
  })))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
12782
12778
  className: "text-utilRed1000 text-sm"
@@ -12917,6 +12913,7 @@ function Loader(_ref) {
12917
12913
  }
12918
12914
  ;// external "opus-toolkit-styles/assets/logos/footer-logos.svg"
12919
12915
  const footer_logos_svg_namespaceObject = require("opus-toolkit-styles/assets/logos/footer-logos.svg");
12916
+ var footer_logos_svg_default = /*#__PURE__*/__webpack_require__.n(footer_logos_svg_namespaceObject);
12920
12917
  ;// ./src/components/Cookie/Cookie.js
12921
12918
 
12922
12919
 
@@ -12952,6 +12949,7 @@ const CookieBanner = _ref => {
12952
12949
  }
12953
12950
  }, [imageLoaded, render]);
12954
12951
  if (!render) return null;
12952
+ console.log("DefaultLogo:", (footer_logos_svg_default()));
12955
12953
  return /*#__PURE__*/external_react_default().createElement(Card, {
12956
12954
  intent: "brandSecondary",
12957
12955
  className: "\n md:flex items-center justify-between p-4 space-x-4\n transition-all duration-300 ease-in-out\n ".concat(show ? "opacity-100 translate-y-0" : "opacity-0 translate-y-3", "\n ")
@@ -12959,14 +12957,11 @@ const CookieBanner = _ref => {
12959
12957
  className: "md:flex items-center"
12960
12958
  }, /*#__PURE__*/external_react_default().createElement("div", {
12961
12959
  className: "flex-shrink-0 mr-4"
12962
- }, logo ? /*#__PURE__*/external_react_default().createElement("img", {
12963
- src: logo,
12960
+ }, /*#__PURE__*/external_react_default().createElement("img", {
12961
+ src: logo || (footer_logos_svg_default()),
12964
12962
  alt: "C247 Logo",
12965
12963
  className: "w-full object-contain",
12966
- onLoad: () => setImageLoaded(true),
12967
- loading: "eager"
12968
- }) : /*#__PURE__*/external_react_default().createElement(footer_logos_svg_namespaceObject.ReactComponent, {
12969
- className: "w-full h-full"
12964
+ onLoad: () => setImageLoaded(true)
12970
12965
  })), /*#__PURE__*/external_react_default().createElement("p", {
12971
12966
  className: "mr-4"
12972
12967
  }, policyTxt)), /*#__PURE__*/external_react_default().createElement("div", {
@@ -13004,4 +12999,4 @@ const CookieBanner = _ref => {
13004
12999
  /******/ })()
13005
13000
  ;
13006
13001
  });
13007
- //# sourceMappingURL=main.af7bdb60c408fab716fd.js.map
13002
+ //# sourceMappingURL=main.e0a995fbb7814fd5f6d3.js.map