cetec-design-system 3.2.0-0 → 3.2.1-0

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.js CHANGED
@@ -2649,7 +2649,8 @@ const menuFn = memo((props = {}) => {
2649
2649
  const menuVariantKeys = [
2650
2650
  "layer",
2651
2651
  "density",
2652
- "panel"
2652
+ "panel",
2653
+ "scrollable"
2653
2654
  ];
2654
2655
  const getVariantProps$a = (variants) => ({ ...menuDefaultVariants, ...compact(variants) });
2655
2656
  const menu = /* @__PURE__ */ Object.assign(menuFn, {
@@ -2670,6 +2671,9 @@ const menu = /* @__PURE__ */ Object.assign(menuFn, {
2670
2671
  ],
2671
2672
  "panel": [
2672
2673
  "true"
2674
+ ],
2675
+ "scrollable": [
2676
+ "true"
2673
2677
  ]
2674
2678
  },
2675
2679
  splitVariantProps(props) {
@@ -23238,9 +23242,19 @@ const Select = (props) => {
23238
23242
  middleware: createOverlayMiddleware({
23239
23243
  offset: offset2,
23240
23244
  extras: [
23245
+ // Floating UI only positions the listbox; without a height cap a long
23246
+ // option list overflows the viewport on whichever side flip() picks.
23247
+ // Only measured values are written here; the `menu` recipe's
23248
+ // `scrollable` variant applies the cap and scrolling. `padding`
23249
+ // mirrors the overlay middleware's default `shiftPadding`.
23241
23250
  size({
23242
- apply({ rects, elements }) {
23251
+ padding: 8,
23252
+ apply({ rects, elements, availableHeight }) {
23243
23253
  elements.floating.style.minWidth = `${rects.reference.width}px`;
23254
+ elements.floating.style.setProperty(
23255
+ "--available-height",
23256
+ `${Math.max(availableHeight, 0)}px`
23257
+ );
23244
23258
  }
23245
23259
  })
23246
23260
  ]
@@ -23248,6 +23262,14 @@ const Select = (props) => {
23248
23262
  });
23249
23263
  const itemRefs = useRef([]);
23250
23264
  const labelsRef = useRef([]);
23265
+ const { isPositioned } = floating;
23266
+ useLayoutEffect(() => {
23267
+ var _a;
23268
+ if (!isOpen || !isPositioned || initialActiveIndex === null) {
23269
+ return;
23270
+ }
23271
+ (_a = itemRefs.current[initialActiveIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
23272
+ }, [isOpen, isPositioned]);
23251
23273
  const click = useClick(floating.context, {
23252
23274
  enabled: !disabled
23253
23275
  });
@@ -23279,7 +23301,11 @@ const Select = (props) => {
23279
23301
  );
23280
23302
  const selectedOptions = getSelectedOptions(options, value, multiple);
23281
23303
  const classes = select({ size: size$12, multiple, autoSize });
23282
- const menuClasses = menu({ density, layer: floatingLayer });
23304
+ const menuClasses = menu({
23305
+ density,
23306
+ layer: floatingLayer,
23307
+ scrollable: true
23308
+ });
23283
23309
  const hasValue = value !== null && value !== void 0 && value !== "";
23284
23310
  const chipSize = resolveChipSize(size$12);
23285
23311
  const accessibleName = typeof displayValue === "string" && displayValue.length > 0 ? displayValue : placeholder;