react-ui-suite 1.1.5 → 1.1.7

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.
@@ -6,14 +6,18 @@
6
6
  border-color: #64748b;
7
7
  }
8
8
 
9
- .rui-combobox__listbox {
10
- max-height: 16rem;
11
- overflow: auto;
12
- padding-left: 0.25rem;
13
- padding-right: 1rem;
14
- margin: 0px;
15
- scrollbar-width: none;
16
- }
9
+ .rui-combobox__listbox {
10
+ max-height: 16rem;
11
+ overflow: auto;
12
+ padding-left: 0.25rem;
13
+ padding-right: 1rem;
14
+ margin: 0px;
15
+ scrollbar-width: none;
16
+ }
17
+
18
+ .rui-popover[data-scrollbar-visible="false"] .rui-combobox__listbox {
19
+ padding-right: 0.25rem;
20
+ }
17
21
 
18
22
  .rui-combobox__listbox::-webkit-scrollbar {
19
23
  width: 0;
@@ -52,14 +52,18 @@
52
52
  font-weight: 600;
53
53
  }
54
54
 
55
- .rui-select__list {
56
- margin: 0;
57
- padding: 0rem 1rem 0rem 0.25rem;
58
- list-style: none;
59
- max-height: 16rem;
60
- overflow: auto;
61
- scrollbar-width: none;
62
- }
55
+ .rui-select__list {
56
+ margin: 0;
57
+ padding: 0rem 1rem 0rem 0.25rem;
58
+ list-style: none;
59
+ max-height: 16rem;
60
+ overflow: auto;
61
+ scrollbar-width: none;
62
+ }
63
+
64
+ .rui-popover[data-scrollbar-visible="false"] .rui-select__list {
65
+ padding-right: 0.25rem;
66
+ }
63
67
 
64
68
  .rui-select__list::-webkit-scrollbar {
65
69
  width: 0;
package/dist/index.js CHANGED
@@ -1062,7 +1062,10 @@ function getAnchorPosition(anchor) {
1062
1062
  width: rect.width
1063
1063
  };
1064
1064
  }
1065
- function Scrollbar({ scrollRef }) {
1065
+ function Scrollbar({
1066
+ scrollRef,
1067
+ onVisibilityChange
1068
+ }) {
1066
1069
  const [{ visible, size, offset }, setThumbState] = React7.useState({
1067
1070
  visible: false,
1068
1071
  size: MIN_THUMB_SIZE,
@@ -1103,6 +1106,9 @@ function Scrollbar({ scrollRef }) {
1103
1106
  cancelAnimationFrame(raf);
1104
1107
  };
1105
1108
  }, [scrollRef]);
1109
+ React7.useEffect(() => {
1110
+ onVisibilityChange == null ? void 0 : onVisibilityChange(visible);
1111
+ }, [onVisibilityChange, visible]);
1106
1112
  React7.useEffect(() => {
1107
1113
  const handlePointerMove = (event) => {
1108
1114
  const drag = dragState.current;
@@ -1188,6 +1194,7 @@ function Scrollbar({ scrollRef }) {
1188
1194
  }
1189
1195
  function Popover({ className, anchorRef, rootRef, children }) {
1190
1196
  const scrollRef = React7.useRef(null);
1197
+ const [scrollbarVisible, setScrollbarVisible] = React7.useState(false);
1191
1198
  const [position, setPosition] = React7.useState(
1192
1199
  () => {
1193
1200
  var _a;
@@ -1228,10 +1235,11 @@ function Popover({ className, anchorRef, rootRef, children }) {
1228
1235
  shouldPortal && "rui-popover--portal",
1229
1236
  className
1230
1237
  ),
1238
+ "data-scrollbar-visible": scrollbarVisible ? "true" : "false",
1231
1239
  style: popoverStyle,
1232
1240
  children: /* @__PURE__ */ jsxs8("div", { className: "rui-popover__inner", children: [
1233
1241
  children({ scrollRef }),
1234
- /* @__PURE__ */ jsx9(Scrollbar, { scrollRef })
1242
+ /* @__PURE__ */ jsx9(Scrollbar, { scrollRef, onVisibilityChange: setScrollbarVisible })
1235
1243
  ] })
1236
1244
  }
1237
1245
  );
@@ -1269,7 +1277,7 @@ function useOutsideClick(refs, handler) {
1269
1277
  // components/Combobox/Listbox.tsx
1270
1278
  import * as React8 from "react";
1271
1279
  import clsx9 from "clsx";
1272
- import "./Combobox-UQBN7KFK.css";
1280
+ import "./Combobox-YP4UGGM7.css";
1273
1281
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1274
1282
  function Listbox({
1275
1283
  id,
@@ -1343,7 +1351,7 @@ function Listbox({
1343
1351
 
1344
1352
  // components/Combobox/Combobox.tsx
1345
1353
  import clsx10 from "clsx";
1346
- import "./Combobox-UQBN7KFK.css";
1354
+ import "./Combobox-YP4UGGM7.css";
1347
1355
  import { jsx as jsx11 } from "react/jsx-runtime";
1348
1356
  function InnerCombobox({
1349
1357
  options,
@@ -1846,7 +1854,7 @@ import * as React12 from "react";
1846
1854
  // components/Select/Select.tsx
1847
1855
  import * as React11 from "react";
1848
1856
  import clsx12 from "clsx";
1849
- import "./Select-UA2CM52H.css";
1857
+ import "./Select-HD5HKBTM.css";
1850
1858
  import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1851
1859
  function Select({
1852
1860
  label,
@@ -1866,6 +1874,7 @@ function Select({
1866
1874
  const containerRef = React11.useRef(null);
1867
1875
  const inputRef = React11.useRef(null);
1868
1876
  const chevronRef = React11.useRef(null);
1877
+ const popoverRef = React11.useRef(null);
1869
1878
  const popoverListRef = React11.useRef(null);
1870
1879
  const suppressToggleRef = React11.useRef(false);
1871
1880
  const id = React11.useId();
@@ -1885,10 +1894,14 @@ function Select({
1885
1894
  );
1886
1895
  const activeIndex = activeIndexState;
1887
1896
  const [selected, setSelected] = useControlledState(value, defaultValue != null ? defaultValue : null);
1888
- useOutsideClick(
1889
- [containerRef],
1890
- () => setOpen(false)
1897
+ const outsideClickRefs = React11.useMemo(
1898
+ () => [
1899
+ containerRef,
1900
+ popoverRef
1901
+ ],
1902
+ []
1891
1903
  );
1904
+ useOutsideClick(outsideClickRefs, () => setOpen(false));
1892
1905
  const selectedOption = (_a = options.find((opt) => opt.value === selected)) != null ? _a : null;
1893
1906
  const selectedIndex = React11.useMemo(
1894
1907
  () => options.findIndex((opt) => opt.value === selected),
@@ -2055,7 +2068,7 @@ function Select({
2055
2068
  }
2056
2069
  setOpen((o) => !o);
2057
2070
  },
2058
- children: open && /* @__PURE__ */ jsx13(Popover, { anchorRef: containerRef, className: listboxHighlight, children: ({ scrollRef }) => {
2071
+ children: open && /* @__PURE__ */ jsx13(Popover, { anchorRef: containerRef, rootRef: popoverRef, className: listboxHighlight, children: ({ scrollRef }) => {
2059
2072
  popoverListRef.current = scrollRef;
2060
2073
  return /* @__PURE__ */ jsx13(
2061
2074
  "ul",