@lumx/react 4.18.0-next.0 → 4.18.0-next.1

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/index.d.ts CHANGED
@@ -1457,6 +1457,25 @@ declare const Placement: {
1457
1457
  readonly LEFT_START: "left-start";
1458
1458
  };
1459
1459
  type Placement = ValueOf<typeof Placement>;
1460
+ /**
1461
+ * Popover fit anchor width options.
1462
+ */
1463
+ declare const FitAnchorWidth: {
1464
+ readonly MAX_WIDTH: "maxWidth";
1465
+ readonly MIN_WIDTH: "minWidth";
1466
+ readonly WIDTH: "width";
1467
+ };
1468
+ type FitAnchorWidth = ValueOf<typeof FitAnchorWidth>;
1469
+ /**
1470
+ * Popover height/width sizes
1471
+ */
1472
+ declare const POPOVER_SIZES: readonly ["m", "l", "xl", "xxl"];
1473
+
1474
+ /** Viewport-relative height value, e.g. `50vh`. */
1475
+ type VHSize = `${number}vh`;
1476
+ /** Pixel value, e.g. `12px`. */
1477
+ type PXSize = `${number}px`;
1478
+
1460
1479
  /**
1461
1480
  * Offset of the popover.
1462
1481
  */
@@ -1470,15 +1489,26 @@ interface Offset {
1470
1489
  * Popover elevation index.
1471
1490
  */
1472
1491
  type Elevation = 1 | 2 | 3 | 4 | 5;
1473
- /**
1474
- * Popover fit anchor width options.
1475
- */
1476
- declare const FitAnchorWidth: {
1477
- readonly MAX_WIDTH: "maxWidth";
1478
- readonly MIN_WIDTH: "minWidth";
1479
- readonly WIDTH: "width";
1480
- };
1481
- type FitAnchorWidth = ValueOf<typeof FitAnchorWidth>;
1492
+ /** Popover size value — pixel value, or "t-shirt" size token. */
1493
+ type PopoverSize = PXSize | (typeof POPOVER_SIZES)[number];
1494
+ /** Popover height value — extends PopoverSize with viewport-relative unit. */
1495
+ type PopoverHeight = PopoverSize | VHSize;
1496
+ /** Popover width value — same as PopoverSize (pixels or t-shirt only). */
1497
+ type PopoverWidth = PopoverSize;
1498
+ interface PopoverSizes {
1499
+ /** Exact width (pixels or t-shirt size). Combines with `fitToAnchorWidth`: if both target the same CSS property, the explicit prop wins for `width`. */
1500
+ width?: PopoverWidth;
1501
+ /** Minimum width (pixels or t-shirt size). Combines with `fitToAnchorWidth='minWidth'` as `max(anchor, value)`. */
1502
+ minWidth?: PopoverWidth;
1503
+ /** Maximum width (pixels or t-shirt size). Combines with `fitToAnchorWidth='maxWidth'` as `min(anchor, value)`. */
1504
+ maxWidth?: PopoverWidth;
1505
+ /** Exact height (pixels, vh, or t-shirt size). */
1506
+ height?: PopoverHeight;
1507
+ /** Minimum height (pixels, vh, or t-shirt size). */
1508
+ minHeight?: PopoverHeight;
1509
+ /** Maximum height (pixels, vh, or t-shirt size). Combines with `fitWithinViewportHeight` as `min(maxHeight, available)`. */
1510
+ maxHeight?: PopoverHeight;
1511
+ }
1482
1512
 
1483
1513
  /**
1484
1514
  * Shared popover props used by both React and Vue wrappers.
@@ -1508,7 +1538,7 @@ interface PopoverProps$1 extends HasClassName, HasTheme, HasCloseMode {
1508
1538
  * - `width`: popover equal to the anchor.
1509
1539
  */
1510
1540
  fitToAnchorWidth?: FitAnchorWidth | boolean;
1511
- /** Shrink popover if even after flipping there is not enough space. */
1541
+ /** Constrain popover height to avoid overflowing the viewport. */
1512
1542
  fitWithinViewportHeight?: boolean;
1513
1543
  /** Element to focus when opening the popover. */
1514
1544
  focusElement?: CommonRef;
@@ -1541,7 +1571,7 @@ interface PopoverProps$1 extends HasClassName, HasTheme, HasCloseMode {
1541
1571
  * Extends core PopoverProps, overriding ref-typed props with React-specific `RefObject` types
1542
1572
  * and replacing `handleClose` with the React-idiomatic `onClose` callback.
1543
1573
  */
1544
- interface PopoverProps extends GenericProps$1, ReactToJSX<PopoverProps$1, 'anchorRef' | 'as' | 'boundaryRef' | 'focusElement' | 'parentElement' | 'focusTrapZoneElement' | 'className'> {
1574
+ interface PopoverProps extends GenericProps$1, ReactToJSX<PopoverProps$1, 'anchorRef' | 'as' | 'boundaryRef' | 'focusElement' | 'parentElement' | 'focusTrapZoneElement' | 'className'>, PopoverSizes {
1545
1575
  /** Reference to the DOM element used to set the position of the popover. */
1546
1576
  anchorRef: RefObject<HTMLElement>;
1547
1577
  /** Customize the root element. (Must accept ref forwarding and props forwarding!). */
@@ -5742,4 +5772,4 @@ declare const ThemeProvider: React__default.FC<{
5742
5772
  declare function useTheme(): ThemeContextValue;
5743
5773
 
5744
5774
  export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME$2 as CLASSNAME, COMPONENT_NAME$2 as COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSection, ListSubheader, MenuButton, ListDivider as MenuDivider, MenuItem, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectButton, SelectMultiple, SelectMultipleField, SelectTextField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, CLASSNAME as TIME_PICKER_FIELD_CLASSNAME, COMPONENT_NAME as TIME_PICKER_FIELD_COMPONENT_NAME, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableCellVariant as TableCellVariantType, TableHeader, TableRow, Text, TextField, ThOrder, ThOrder as ThOrderType, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, TimePickerField, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
5745
- export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MenuButtonProps, ListDividerProps as MenuDividerProps, MenuItemActionProps, MenuItemProps, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectButtonProps, SelectListStatus as SelectButtonStatus, SelectButtonTranslations, SelectListStatus, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectListStatus as SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectButtonProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, TimePickerFieldProps, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
5775
+ export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MenuButtonProps, ListDividerProps as MenuDividerProps, MenuItemActionProps, MenuItemProps, MessageProps, MosaicProps, MultipleSelectButtonProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverHeight, PopoverProps, PopoverWidth, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectButtonProps, SelectListStatus as SelectButtonStatus, SelectButtonTranslations, SelectListStatus, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectListStatus as SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectButtonProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, TimePickerFieldProps, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
package/index.js CHANGED
@@ -9068,15 +9068,6 @@ const Placement = {
9068
9068
  LEFT_END: 'left-end',
9069
9069
  LEFT_START: 'left-start'
9070
9070
  };
9071
-
9072
- /**
9073
- * Offset of the popover.
9074
- */
9075
-
9076
- /**
9077
- * Popover elevation index.
9078
- */
9079
-
9080
9071
  /**
9081
9072
  * Popover fit anchor width options.
9082
9073
  */
@@ -9092,6 +9083,11 @@ const ARROW_SIZE = 14;
9092
9083
  */
9093
9084
  const POPOVER_ZINDEX = 9999;
9094
9085
 
9086
+ /**
9087
+ * Popover height/width sizes
9088
+ */
9089
+ [Size.m, Size.l, Size.xl, Size.xxl];
9090
+
9095
9091
  /**
9096
9092
  * Component display name.
9097
9093
  */
@@ -9275,8 +9271,6 @@ function useRestoreFocusOnClose({
9275
9271
  });
9276
9272
  }
9277
9273
 
9278
- /* eslint-disable no-param-reassign */
9279
-
9280
9274
  /**
9281
9275
  * Parse a Popover placement into floating-ui placement or auto-placement config.
9282
9276
  */
@@ -9306,6 +9300,29 @@ function parseFitWidth(fitToAnchorWidth) {
9306
9300
  if (typeof fitToAnchorWidth === 'string') return fitToAnchorWidth;
9307
9301
  return FitAnchorWidth.MIN_WIDTH;
9308
9302
  }
9303
+
9304
+ /** Resolve a t-shirt size token to its CSS custom property, or pass through as-is. */
9305
+
9306
+ function resolveCssSize(value) {
9307
+ if (value && value in Size) return `var(--lumx-size-${value})`;
9308
+ return value;
9309
+ }
9310
+
9311
+ /** Create a CSS min()/max() combiner function. */
9312
+ function combineSize(combinator) {
9313
+ return (size1, size2) => {
9314
+ if (size1 && size2) return `${combinator}(${size1}, ${size2})`;
9315
+ return size1 || size2 || '';
9316
+ };
9317
+ }
9318
+
9319
+ /** Combine two CSS values with `min()`. */
9320
+ const cssMin = combineSize('min');
9321
+
9322
+ /** Combine two CSS values with `max()`. */
9323
+ const cssMax = combineSize('max');
9324
+
9325
+ /* eslint-disable no-param-reassign */
9309
9326
  /**
9310
9327
  * Build the floating-ui middleware array for popover positioning.
9311
9328
  *
@@ -9317,10 +9334,24 @@ function buildPopoverMiddleware(options) {
9317
9334
  hasArrow,
9318
9335
  fitWidth,
9319
9336
  fitWithinViewportHeight,
9337
+ width: rawWidth,
9338
+ minWidth: rawMinWidth,
9339
+ maxWidth: rawMaxWidth,
9340
+ height: rawHeight,
9341
+ minHeight: rawMinHeight,
9342
+ maxHeight: rawMaxHeight,
9320
9343
  boundary,
9321
9344
  parsedPlacement,
9322
9345
  arrowElement
9323
9346
  } = options;
9347
+
9348
+ // Resolve t-shirt sizes to CSS pixel strings for the apply callback.
9349
+ const width = resolveCssSize(rawWidth);
9350
+ const minWidth = resolveCssSize(rawMinWidth);
9351
+ const maxWidth = resolveCssSize(rawMaxWidth);
9352
+ const height = resolveCssSize(rawHeight);
9353
+ const minHeight = resolveCssSize(rawMinHeight);
9354
+ const maxHeight = resolveCssSize(rawMaxHeight);
9324
9355
  const middlewares = [];
9325
9356
 
9326
9357
  // Offset middleware
@@ -9348,8 +9379,9 @@ function buildPopoverMiddleware(options) {
9348
9379
  } : {}));
9349
9380
  }
9350
9381
 
9351
- // Size middleware
9352
- if (fitWidth || fitWithinViewportHeight) {
9382
+ // Size middleware — always required when any sizing constraint is set
9383
+ const anySizeConstraint = !!fitWidth || !!fitWithinViewportHeight || width || minWidth || maxWidth || height || minHeight || maxHeight;
9384
+ if (anySizeConstraint) {
9353
9385
  middlewares.push(size({
9354
9386
  ...(boundary ? {
9355
9387
  boundary
@@ -9359,14 +9391,21 @@ function buildPopoverMiddleware(options) {
9359
9391
  rects,
9360
9392
  elements
9361
9393
  }) {
9362
- if (fitWidth) {
9363
- Object.assign(elements.floating.style, {
9364
- [fitWidth]: `${rects.reference.width}px`
9365
- });
9366
- }
9367
- if (fitWithinViewportHeight) {
9368
- elements.floating.style.maxHeight = `${Math.max(0, availableHeight - ARROW_SIZE)}px`;
9369
- }
9394
+ const anchorWidth = `${rects.reference.width}px`;
9395
+
9396
+ // Width: explicit width wins, else fitToAnchorWidth.
9397
+ elements.floating.style.width = width || (fitWidth === 'width' ? anchorWidth : '');
9398
+ // Min-width: anchor constrained by explicit min-width.
9399
+ elements.floating.style.minWidth = cssMax(minWidth, fitWidth === 'minWidth' ? anchorWidth : '');
9400
+ // Max-width: anchor constrained by explicit max-width.
9401
+ elements.floating.style.maxWidth = cssMin(maxWidth, fitWidth === 'maxWidth' ? anchorWidth : '');
9402
+
9403
+ // Height: explicit values only.
9404
+ elements.floating.style.height = height || '';
9405
+ elements.floating.style.minHeight = minHeight || '';
9406
+ // Max-height: viewport combined with explicit max-height.
9407
+ const adaptedAvailableHeight = `${Math.max(0, availableHeight - ARROW_SIZE)}px`;
9408
+ elements.floating.style.maxHeight = cssMin(maxHeight, fitWithinViewportHeight ? adaptedAvailableHeight : '');
9370
9409
  }
9371
9410
  }));
9372
9411
  }
@@ -9405,6 +9444,12 @@ function usePopoverStyle({
9405
9444
  hasArrow,
9406
9445
  fitToAnchorWidth,
9407
9446
  fitWithinViewportHeight,
9447
+ width,
9448
+ minWidth,
9449
+ maxWidth,
9450
+ height,
9451
+ minHeight,
9452
+ maxHeight,
9408
9453
  boundaryRef,
9409
9454
  anchorRef,
9410
9455
  placement,
@@ -9421,10 +9466,16 @@ function usePopoverStyle({
9421
9466
  hasArrow,
9422
9467
  fitWidth,
9423
9468
  fitWithinViewportHeight,
9469
+ width,
9470
+ minWidth,
9471
+ maxWidth,
9472
+ height,
9473
+ minHeight,
9474
+ maxHeight,
9424
9475
  boundary,
9425
9476
  parsedPlacement,
9426
9477
  arrowElement
9427
- }), [offset, hasArrow, fitWidth, fitWithinViewportHeight, boundary, parsedPlacement, arrowElement]);
9478
+ }), [offset, hasArrow, fitWidth, fitWithinViewportHeight, width, minWidth, maxWidth, height, minHeight, maxHeight, boundary, parsedPlacement, arrowElement]);
9428
9479
  const anchorElement = anchorRef.current;
9429
9480
  const {
9430
9481
  floatingStyles,
@@ -9499,6 +9550,12 @@ const _InnerPopover = forwardRef((props, ref) => {
9499
9550
  fitToAnchorWidth,
9500
9551
  fitWithinViewportHeight,
9501
9552
  focusTrapZoneElement,
9553
+ width,
9554
+ minWidth,
9555
+ maxWidth,
9556
+ height,
9557
+ minHeight,
9558
+ maxHeight,
9502
9559
  offset,
9503
9560
  placement = DEFAULT_PROPS$Y.placement,
9504
9561
  style,
@@ -9519,6 +9576,12 @@ const _InnerPopover = forwardRef((props, ref) => {
9519
9576
  hasArrow,
9520
9577
  fitToAnchorWidth,
9521
9578
  fitWithinViewportHeight,
9579
+ width,
9580
+ minWidth,
9581
+ maxWidth,
9582
+ height,
9583
+ minHeight,
9584
+ maxHeight,
9522
9585
  boundaryRef,
9523
9586
  anchorRef,
9524
9587
  placement,
@@ -9781,6 +9844,8 @@ const ComboboxOptionSkeleton = props => {
9781
9844
  ComboboxOptionSkeleton.displayName = COMPONENT_NAME$1a;
9782
9845
  ComboboxOptionSkeleton.className = CLASSNAME$18;
9783
9846
 
9847
+ const DEFAULT_COMBOBOX_POPOVER_MAX_HEIGHT = '80vh';
9848
+
9784
9849
  const COMPONENT_NAME$19 = 'ComboboxPopover';
9785
9850
 
9786
9851
  /**
@@ -9822,6 +9887,7 @@ const ComboboxPopover$1 = (props, {
9822
9887
  closeOnEscape = false,
9823
9888
  fitToAnchorWidth = true,
9824
9889
  isOpen,
9890
+ maxHeight = DEFAULT_COMBOBOX_POPOVER_MAX_HEIGHT,
9825
9891
  placement = 'bottom-start',
9826
9892
  anchorRef,
9827
9893
  handleClose,
@@ -9831,6 +9897,7 @@ const ComboboxPopover$1 = (props, {
9831
9897
  ...forwardedProps,
9832
9898
  placement: placement,
9833
9899
  fitToAnchorWidth: fitToAnchorWidth,
9900
+ maxHeight: maxHeight,
9834
9901
  className: block$S([className]),
9835
9902
  anchorRef: anchorRef,
9836
9903
  isOpen: isOpen,