allaw-ui 4.4.8 → 4.4.9

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.
@@ -30,12 +30,13 @@ var CountrySelect = function (_a) {
30
30
  setSearch("");
31
31
  }, [isOpen]);
32
32
  useEffect(function () {
33
+ if (disablePortal)
34
+ return;
33
35
  if (isOpen && buttonRef.current) {
34
36
  var rect = buttonRef.current.getBoundingClientRect();
35
37
  var btnW = typeof buttonWidth === "number" ? buttonWidth : rect.width;
36
38
  var lstW = typeof listWidth === "number" ? listWidth : rect.width;
37
39
  var left = rect.left + window.scrollX + (btnW - lstW) / 2;
38
- // Décalage intelligent si la liste sort de l'écran
39
40
  var minMargin = 8;
40
41
  if (left < minMargin)
41
42
  left = minMargin;
@@ -47,7 +48,7 @@ var CountrySelect = function (_a) {
47
48
  width: lstW,
48
49
  });
49
50
  }
50
- }, [isOpen, listWidth, buttonWidth]);
51
+ }, [isOpen, listWidth, buttonWidth, disablePortal]);
51
52
  useEffect(function () {
52
53
  if (!isOpen)
53
54
  return;
@@ -99,14 +100,19 @@ var CountrySelect = function (_a) {
99
100
  }
100
101
  };
101
102
  var selectedItem = items.find(function (i) { return i.value === selected; });
102
- // Liste en portal, position fixed, centrée sous le bouton, décalée si besoin
103
- var dropdown = (React.createElement("div", { className: selectStyles.selectList + " " + styles.listOpen, style: {
104
- position: disablePortal ? "absolute" : "fixed",
105
- top: listPos.top,
106
- left: listPos.left,
107
- width: listPos.width,
108
- zIndex: 9999,
109
- }, role: "listbox", tabIndex: -1, onKeyDown: handleKeyDown },
103
+ var dropdown = (React.createElement("div", { className: selectStyles.selectList + " " + styles.listOpen, style: disablePortal
104
+ ? {
105
+ position: "absolute",
106
+ width: listPos.width,
107
+ zIndex: 9999,
108
+ }
109
+ : {
110
+ position: "fixed",
111
+ top: listPos.top,
112
+ left: listPos.left,
113
+ width: listPos.width,
114
+ zIndex: 9999,
115
+ }, onKeyDown: handleKeyDown },
110
116
  React.createElement("div", { className: styles.searchWrapper },
111
117
  React.createElement("i", { className: "allaw-icon-search" }),
112
118
  React.createElement("input", __assign({ className: styles.search, placeholder: "Rechercher...", value: search, onChange: function (e) { return setSearch(e.target.value); }, autoFocus: true, "aria-label": "Rechercher un pays", onBlur: handleBlur }, (disableAutofill && {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "4.4.8",
3
+ "version": "4.4.9",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",