@entur-partner/common 11.1.1 → 11.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.
@@ -699,16 +699,12 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
699
699
  };
700
700
 
701
701
  var _excluded$4 = ["label", "organisations", "onChange", "selectedOrganisationId"];
702
- function isInShadowDom(el) {
703
- return (el == null ? void 0 : el.getRootNode()) instanceof ShadowRoot;
704
- }
705
702
  var OrganisationDropDown = function OrganisationDropDown(_ref) {
706
703
  var label = _ref.label,
707
704
  organisations = _ref.organisations,
708
705
  handleChange = _ref.onChange,
709
706
  selectedOrganisationId = _ref.selectedOrganisationId,
710
707
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
711
- var wrapperRef = react.useRef(null);
712
708
  var _useState = react.useState(),
713
709
  selectedOrganisation = _useState[0],
714
710
  setSelectedOrganisation = _useState[1];
@@ -717,53 +713,27 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
717
713
  return org.organisationId === selectedOrganisationId;
718
714
  }));
719
715
  }, [selectedOrganisationId, organisations]);
720
- var handleMouseDown = function handleMouseDown(e) {
721
- if (!isInShadowDom(wrapperRef.current)) return;
722
- // In shadow DOM, mouse events are retargeted at the shadow boundary,
723
- // causing downshift's window-level outside-click detection to misidentify
724
- // clicks within the dropdown as outside clicks. Stop propagation to prevent
725
- // the retargeted event from reaching window-level listeners.
726
- e.nativeEvent.stopPropagation();
727
- // Prevent default on non-input elements to stop the browser from moving
728
- // focus away from the combobox input, which would trigger a blur that
729
- // closes the dropdown before the click event can register a selection.
730
- if (e.target.tagName !== "INPUT") {
731
- e.preventDefault();
732
- }
733
- };
734
- var handleMouseUp = function handleMouseUp(e) {
735
- if (!isInShadowDom(wrapperRef.current)) return;
736
- e.nativeEvent.stopPropagation();
737
- };
738
- return (
739
- // biome-ignore lint/a11y/noStaticElementInteractions: Temporary fix. See comment above. Will be fixed in design system level in the future.
740
- jsxRuntime.jsx("div", {
741
- ref: wrapperRef,
742
- onMouseDown: handleMouseDown,
743
- onMouseUp: handleMouseUp,
744
- children: jsxRuntime.jsx(dropdown.SearchableDropdown, _extends({
745
- label: label,
746
- items: [].concat(organisations.sort(function (a, b) {
747
- return a.tradingName.localeCompare(b.tradingName, "nb");
748
- }).map(function (organisation) {
749
- return {
750
- value: organisation.organisationId,
751
- label: organisation.tradingName
752
- };
753
- })),
754
- selectedItem: selectedOrganisation ? {
755
- value: selectedOrganisation.organisationId,
756
- label: selectedOrganisation.tradingName
757
- } : null,
758
- onChange: function onChange(selectedValue) {
759
- if (selectedValue) {
760
- handleChange(selectedValue.value);
761
- }
762
- },
763
- clearable: false
764
- }, rest))
765
- })
766
- );
716
+ return jsxRuntime.jsx(dropdown.SearchableDropdown, _extends({
717
+ label: label,
718
+ items: [].concat(organisations.sort(function (a, b) {
719
+ return a.tradingName.localeCompare(b.tradingName, "nb");
720
+ }).map(function (organisation) {
721
+ return {
722
+ value: organisation.organisationId,
723
+ label: organisation.tradingName
724
+ };
725
+ })),
726
+ selectedItem: selectedOrganisation ? {
727
+ value: selectedOrganisation.organisationId,
728
+ label: selectedOrganisation.tradingName
729
+ } : null,
730
+ onChange: function onChange(selectedValue) {
731
+ if (selectedValue) {
732
+ handleChange(selectedValue.value);
733
+ }
734
+ },
735
+ clearable: false
736
+ }, rest));
767
737
  };
768
738
 
769
739
  /**