@lumx/react 4.18.0-next.0 → 4.18.0-next.2
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 +42 -12
- package/index.js +141 -33
- package/index.js.map +1 -1
- package/package.json +3 -3
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
|
-
|
|
1475
|
-
*/
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
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
|
-
/**
|
|
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
|
@@ -6460,6 +6460,12 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6460
6460
|
/** Last notified input value, to re-fire `optionsChange` when the user keeps typing while empty. */
|
|
6461
6461
|
let lastInputValue = '';
|
|
6462
6462
|
|
|
6463
|
+
/** Last notified loading state, used to replay current state to late subscribers. */
|
|
6464
|
+
let lastLoadingState = false;
|
|
6465
|
+
|
|
6466
|
+
/** Number of currently mounted skeleton placeholders. */
|
|
6467
|
+
let skeletonCount = 0;
|
|
6468
|
+
|
|
6463
6469
|
/** Event subscribers managed by the handle. */
|
|
6464
6470
|
const subscribers = {
|
|
6465
6471
|
open: new Set(),
|
|
@@ -6474,6 +6480,20 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6474
6480
|
subscribers[event].forEach(cb => cb(value));
|
|
6475
6481
|
}
|
|
6476
6482
|
|
|
6483
|
+
/** Count visible (non-filtered) options. */
|
|
6484
|
+
function getVisibleOptionCount() {
|
|
6485
|
+
let count = 0;
|
|
6486
|
+
for (const reg of optionRegistrations.values()) {
|
|
6487
|
+
if (!reg.lastFiltered) count += 1;
|
|
6488
|
+
}
|
|
6489
|
+
return count;
|
|
6490
|
+
}
|
|
6491
|
+
|
|
6492
|
+
/** True when the popup has visible content (options or skeletons). */
|
|
6493
|
+
function hasVisibleContent() {
|
|
6494
|
+
return getVisibleOptionCount() > 0 || skeletonCount > 0;
|
|
6495
|
+
}
|
|
6496
|
+
|
|
6477
6497
|
/**
|
|
6478
6498
|
* Notify all registered sections and fire `optionsChange` if the visible option count changed
|
|
6479
6499
|
* or if the input value changed while the list is empty (so `emptyMessage` callbacks get
|
|
@@ -6484,10 +6504,7 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6484
6504
|
for (const [sectionElement] of sectionRegistrations) {
|
|
6485
6505
|
notifySection(sectionElement, sectionRegistrations, optionRegistrations);
|
|
6486
6506
|
}
|
|
6487
|
-
|
|
6488
|
-
for (const reg of optionRegistrations.values()) {
|
|
6489
|
-
if (!reg.lastFiltered) visibleCount += 1;
|
|
6490
|
-
}
|
|
6507
|
+
const visibleCount = getVisibleOptionCount();
|
|
6491
6508
|
const inputValue = trigger?.value ?? '';
|
|
6492
6509
|
const isEmpty = visibleCount === 0;
|
|
6493
6510
|
if (visibleCount !== lastOptionsLength || isEmpty && inputValue !== lastInputValue) {
|
|
@@ -6498,6 +6515,12 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6498
6515
|
inputValue
|
|
6499
6516
|
});
|
|
6500
6517
|
}
|
|
6518
|
+
|
|
6519
|
+
// Re-evaluate aria-expanded when the combobox is open — visible content may have
|
|
6520
|
+
// changed due to filtering, option register/unregister, or skeleton transitions.
|
|
6521
|
+
if (isOpenState) {
|
|
6522
|
+
trigger?.setAttribute('aria-expanded', String(hasVisibleContent()));
|
|
6523
|
+
}
|
|
6501
6524
|
}
|
|
6502
6525
|
|
|
6503
6526
|
// ── Skeleton loading tracking ──────────────────────────────
|
|
@@ -6505,9 +6528,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6505
6528
|
/** Delay before announcing loading in the live region (ms). */
|
|
6506
6529
|
const LOADING_ANNOUNCEMENT_DELAY = 500;
|
|
6507
6530
|
|
|
6508
|
-
/** Number of currently mounted skeleton placeholders. */
|
|
6509
|
-
let skeletonCount = 0;
|
|
6510
|
-
|
|
6511
6531
|
/** Timer for debounced loading announcement. */
|
|
6512
6532
|
let loadingTimer;
|
|
6513
6533
|
|
|
@@ -6533,6 +6553,7 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6533
6553
|
*/
|
|
6534
6554
|
function onSkeletonCountChange() {
|
|
6535
6555
|
const isLoading = skeletonCount > 0;
|
|
6556
|
+
lastLoadingState = isLoading;
|
|
6536
6557
|
notify('loadingChange', isLoading);
|
|
6537
6558
|
if (isLoading) {
|
|
6538
6559
|
startLoadingAnnouncementTimer();
|
|
@@ -6735,8 +6756,8 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6735
6756
|
startLoadingAnnouncementTimer();
|
|
6736
6757
|
}
|
|
6737
6758
|
|
|
6738
|
-
// Update aria-expanded on trigger
|
|
6739
|
-
trigger?.setAttribute('aria-expanded', String(isOpen));
|
|
6759
|
+
// Update aria-expanded on trigger (false when no visible options or skeletons)
|
|
6760
|
+
trigger?.setAttribute('aria-expanded', String(isOpen && hasVisibleContent()));
|
|
6740
6761
|
notify('open', isOpen);
|
|
6741
6762
|
},
|
|
6742
6763
|
select(option) {
|
|
@@ -6871,6 +6892,17 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6871
6892
|
},
|
|
6872
6893
|
subscribe(event, callback) {
|
|
6873
6894
|
subscribers[event].add(callback);
|
|
6895
|
+
// Replay current loading state to late subscribers so that framework wrappers
|
|
6896
|
+
// that subscribe after initial mount (e.g. async Vue watchers) don't miss the
|
|
6897
|
+
// initial events fired during mount.
|
|
6898
|
+
if (event === 'open' && isOpenState) {
|
|
6899
|
+
callback(true);
|
|
6900
|
+
}
|
|
6901
|
+
if (event === 'loadingChange' && lastLoadingState) {
|
|
6902
|
+
callback(true);
|
|
6903
|
+
}
|
|
6904
|
+
|
|
6905
|
+
// Cleanup function
|
|
6874
6906
|
return () => {
|
|
6875
6907
|
subscribers[event].delete(callback);
|
|
6876
6908
|
};
|
|
@@ -6882,6 +6914,7 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6882
6914
|
filterValue = '';
|
|
6883
6915
|
lastOptionsLength = 0;
|
|
6884
6916
|
lastInputValue = '';
|
|
6917
|
+
lastLoadingState = false;
|
|
6885
6918
|
optionRegistrations.clear();
|
|
6886
6919
|
sectionRegistrations.clear();
|
|
6887
6920
|
skeletonCount = 0;
|
|
@@ -7278,6 +7311,10 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7278
7311
|
setHandle
|
|
7279
7312
|
} = useComboboxContext();
|
|
7280
7313
|
const [isOpen] = useComboboxOpen();
|
|
7314
|
+
const state = useComboboxEvent('optionsChange', {
|
|
7315
|
+
optionsLength: 0
|
|
7316
|
+
});
|
|
7317
|
+
const isLoading = useComboboxEvent('loadingChange', false);
|
|
7281
7318
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7282
7319
|
const {
|
|
7283
7320
|
as,
|
|
@@ -7319,7 +7356,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7319
7356
|
value,
|
|
7320
7357
|
labelDisplayMode,
|
|
7321
7358
|
listboxId,
|
|
7322
|
-
isOpen,
|
|
7359
|
+
isOpen: isOpen && (!!state?.optionsLength || isLoading),
|
|
7323
7360
|
ref: mergedRef
|
|
7324
7361
|
}, {
|
|
7325
7362
|
Button: ButtonComp,
|
|
@@ -8112,6 +8149,10 @@ const ComboboxInput = forwardRef((props, ref) => {
|
|
|
8112
8149
|
setHandle
|
|
8113
8150
|
} = useComboboxContext();
|
|
8114
8151
|
const [isOpen, setIsOpen] = useComboboxOpen();
|
|
8152
|
+
const state = useComboboxEvent('optionsChange', {
|
|
8153
|
+
optionsLength: 0
|
|
8154
|
+
});
|
|
8155
|
+
const isLoading = useComboboxEvent('loadingChange', false);
|
|
8115
8156
|
const {
|
|
8116
8157
|
inputRef: externalInputRef,
|
|
8117
8158
|
toggleButtonProps,
|
|
@@ -8160,7 +8201,7 @@ const ComboboxInput = forwardRef((props, ref) => {
|
|
|
8160
8201
|
...otherProps,
|
|
8161
8202
|
ref,
|
|
8162
8203
|
listboxId,
|
|
8163
|
-
isOpen,
|
|
8204
|
+
isOpen: isOpen && (!!state?.optionsLength || isLoading),
|
|
8164
8205
|
filter,
|
|
8165
8206
|
inputRef: mergedInputRef,
|
|
8166
8207
|
textFieldRef: anchorRef,
|
|
@@ -9068,15 +9109,6 @@ const Placement = {
|
|
|
9068
9109
|
LEFT_END: 'left-end',
|
|
9069
9110
|
LEFT_START: 'left-start'
|
|
9070
9111
|
};
|
|
9071
|
-
|
|
9072
|
-
/**
|
|
9073
|
-
* Offset of the popover.
|
|
9074
|
-
*/
|
|
9075
|
-
|
|
9076
|
-
/**
|
|
9077
|
-
* Popover elevation index.
|
|
9078
|
-
*/
|
|
9079
|
-
|
|
9080
9112
|
/**
|
|
9081
9113
|
* Popover fit anchor width options.
|
|
9082
9114
|
*/
|
|
@@ -9092,6 +9124,11 @@ const ARROW_SIZE = 14;
|
|
|
9092
9124
|
*/
|
|
9093
9125
|
const POPOVER_ZINDEX = 9999;
|
|
9094
9126
|
|
|
9127
|
+
/**
|
|
9128
|
+
* Popover height/width sizes
|
|
9129
|
+
*/
|
|
9130
|
+
[Size.m, Size.l, Size.xl, Size.xxl];
|
|
9131
|
+
|
|
9095
9132
|
/**
|
|
9096
9133
|
* Component display name.
|
|
9097
9134
|
*/
|
|
@@ -9275,8 +9312,6 @@ function useRestoreFocusOnClose({
|
|
|
9275
9312
|
});
|
|
9276
9313
|
}
|
|
9277
9314
|
|
|
9278
|
-
/* eslint-disable no-param-reassign */
|
|
9279
|
-
|
|
9280
9315
|
/**
|
|
9281
9316
|
* Parse a Popover placement into floating-ui placement or auto-placement config.
|
|
9282
9317
|
*/
|
|
@@ -9306,6 +9341,29 @@ function parseFitWidth(fitToAnchorWidth) {
|
|
|
9306
9341
|
if (typeof fitToAnchorWidth === 'string') return fitToAnchorWidth;
|
|
9307
9342
|
return FitAnchorWidth.MIN_WIDTH;
|
|
9308
9343
|
}
|
|
9344
|
+
|
|
9345
|
+
/** Resolve a t-shirt size token to its CSS custom property, or pass through as-is. */
|
|
9346
|
+
|
|
9347
|
+
function resolveCssSize(value) {
|
|
9348
|
+
if (value && value in Size) return `var(--lumx-size-${value})`;
|
|
9349
|
+
return value;
|
|
9350
|
+
}
|
|
9351
|
+
|
|
9352
|
+
/** Create a CSS min()/max() combiner function. */
|
|
9353
|
+
function combineSize(combinator) {
|
|
9354
|
+
return (size1, size2) => {
|
|
9355
|
+
if (size1 && size2) return `${combinator}(${size1}, ${size2})`;
|
|
9356
|
+
return size1 || size2 || '';
|
|
9357
|
+
};
|
|
9358
|
+
}
|
|
9359
|
+
|
|
9360
|
+
/** Combine two CSS values with `min()`. */
|
|
9361
|
+
const cssMin = combineSize('min');
|
|
9362
|
+
|
|
9363
|
+
/** Combine two CSS values with `max()`. */
|
|
9364
|
+
const cssMax = combineSize('max');
|
|
9365
|
+
|
|
9366
|
+
/* eslint-disable no-param-reassign */
|
|
9309
9367
|
/**
|
|
9310
9368
|
* Build the floating-ui middleware array for popover positioning.
|
|
9311
9369
|
*
|
|
@@ -9317,10 +9375,24 @@ function buildPopoverMiddleware(options) {
|
|
|
9317
9375
|
hasArrow,
|
|
9318
9376
|
fitWidth,
|
|
9319
9377
|
fitWithinViewportHeight,
|
|
9378
|
+
width: rawWidth,
|
|
9379
|
+
minWidth: rawMinWidth,
|
|
9380
|
+
maxWidth: rawMaxWidth,
|
|
9381
|
+
height: rawHeight,
|
|
9382
|
+
minHeight: rawMinHeight,
|
|
9383
|
+
maxHeight: rawMaxHeight,
|
|
9320
9384
|
boundary,
|
|
9321
9385
|
parsedPlacement,
|
|
9322
9386
|
arrowElement
|
|
9323
9387
|
} = options;
|
|
9388
|
+
|
|
9389
|
+
// Resolve t-shirt sizes to CSS pixel strings for the apply callback.
|
|
9390
|
+
const width = resolveCssSize(rawWidth);
|
|
9391
|
+
const minWidth = resolveCssSize(rawMinWidth);
|
|
9392
|
+
const maxWidth = resolveCssSize(rawMaxWidth);
|
|
9393
|
+
const height = resolveCssSize(rawHeight);
|
|
9394
|
+
const minHeight = resolveCssSize(rawMinHeight);
|
|
9395
|
+
const maxHeight = resolveCssSize(rawMaxHeight);
|
|
9324
9396
|
const middlewares = [];
|
|
9325
9397
|
|
|
9326
9398
|
// Offset middleware
|
|
@@ -9348,8 +9420,9 @@ function buildPopoverMiddleware(options) {
|
|
|
9348
9420
|
} : {}));
|
|
9349
9421
|
}
|
|
9350
9422
|
|
|
9351
|
-
// Size middleware
|
|
9352
|
-
|
|
9423
|
+
// Size middleware — always required when any sizing constraint is set
|
|
9424
|
+
const anySizeConstraint = !!fitWidth || !!fitWithinViewportHeight || width || minWidth || maxWidth || height || minHeight || maxHeight;
|
|
9425
|
+
if (anySizeConstraint) {
|
|
9353
9426
|
middlewares.push(size({
|
|
9354
9427
|
...(boundary ? {
|
|
9355
9428
|
boundary
|
|
@@ -9359,14 +9432,21 @@ function buildPopoverMiddleware(options) {
|
|
|
9359
9432
|
rects,
|
|
9360
9433
|
elements
|
|
9361
9434
|
}) {
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9435
|
+
const anchorWidth = `${rects.reference.width}px`;
|
|
9436
|
+
|
|
9437
|
+
// Width: explicit width wins, else fitToAnchorWidth.
|
|
9438
|
+
elements.floating.style.width = width || (fitWidth === 'width' ? anchorWidth : '');
|
|
9439
|
+
// Min-width: anchor constrained by explicit min-width.
|
|
9440
|
+
elements.floating.style.minWidth = cssMax(minWidth, fitWidth === 'minWidth' ? anchorWidth : '');
|
|
9441
|
+
// Max-width: anchor constrained by explicit max-width.
|
|
9442
|
+
elements.floating.style.maxWidth = cssMin(maxWidth, fitWidth === 'maxWidth' ? anchorWidth : '');
|
|
9443
|
+
|
|
9444
|
+
// Height: explicit values only.
|
|
9445
|
+
elements.floating.style.height = height || '';
|
|
9446
|
+
elements.floating.style.minHeight = minHeight || '';
|
|
9447
|
+
// Max-height: viewport combined with explicit max-height.
|
|
9448
|
+
const adaptedAvailableHeight = `${Math.max(0, availableHeight - ARROW_SIZE)}px`;
|
|
9449
|
+
elements.floating.style.maxHeight = cssMin(maxHeight, fitWithinViewportHeight ? adaptedAvailableHeight : '');
|
|
9370
9450
|
}
|
|
9371
9451
|
}));
|
|
9372
9452
|
}
|
|
@@ -9405,6 +9485,12 @@ function usePopoverStyle({
|
|
|
9405
9485
|
hasArrow,
|
|
9406
9486
|
fitToAnchorWidth,
|
|
9407
9487
|
fitWithinViewportHeight,
|
|
9488
|
+
width,
|
|
9489
|
+
minWidth,
|
|
9490
|
+
maxWidth,
|
|
9491
|
+
height,
|
|
9492
|
+
minHeight,
|
|
9493
|
+
maxHeight,
|
|
9408
9494
|
boundaryRef,
|
|
9409
9495
|
anchorRef,
|
|
9410
9496
|
placement,
|
|
@@ -9421,10 +9507,16 @@ function usePopoverStyle({
|
|
|
9421
9507
|
hasArrow,
|
|
9422
9508
|
fitWidth,
|
|
9423
9509
|
fitWithinViewportHeight,
|
|
9510
|
+
width,
|
|
9511
|
+
minWidth,
|
|
9512
|
+
maxWidth,
|
|
9513
|
+
height,
|
|
9514
|
+
minHeight,
|
|
9515
|
+
maxHeight,
|
|
9424
9516
|
boundary,
|
|
9425
9517
|
parsedPlacement,
|
|
9426
9518
|
arrowElement
|
|
9427
|
-
}), [offset, hasArrow, fitWidth, fitWithinViewportHeight, boundary, parsedPlacement, arrowElement]);
|
|
9519
|
+
}), [offset, hasArrow, fitWidth, fitWithinViewportHeight, width, minWidth, maxWidth, height, minHeight, maxHeight, boundary, parsedPlacement, arrowElement]);
|
|
9428
9520
|
const anchorElement = anchorRef.current;
|
|
9429
9521
|
const {
|
|
9430
9522
|
floatingStyles,
|
|
@@ -9499,6 +9591,12 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
9499
9591
|
fitToAnchorWidth,
|
|
9500
9592
|
fitWithinViewportHeight,
|
|
9501
9593
|
focusTrapZoneElement,
|
|
9594
|
+
width,
|
|
9595
|
+
minWidth,
|
|
9596
|
+
maxWidth,
|
|
9597
|
+
height,
|
|
9598
|
+
minHeight,
|
|
9599
|
+
maxHeight,
|
|
9502
9600
|
offset,
|
|
9503
9601
|
placement = DEFAULT_PROPS$Y.placement,
|
|
9504
9602
|
style,
|
|
@@ -9519,6 +9617,12 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
9519
9617
|
hasArrow,
|
|
9520
9618
|
fitToAnchorWidth,
|
|
9521
9619
|
fitWithinViewportHeight,
|
|
9620
|
+
width,
|
|
9621
|
+
minWidth,
|
|
9622
|
+
maxWidth,
|
|
9623
|
+
height,
|
|
9624
|
+
minHeight,
|
|
9625
|
+
maxHeight,
|
|
9522
9626
|
boundaryRef,
|
|
9523
9627
|
anchorRef,
|
|
9524
9628
|
placement,
|
|
@@ -9781,6 +9885,8 @@ const ComboboxOptionSkeleton = props => {
|
|
|
9781
9885
|
ComboboxOptionSkeleton.displayName = COMPONENT_NAME$1a;
|
|
9782
9886
|
ComboboxOptionSkeleton.className = CLASSNAME$18;
|
|
9783
9887
|
|
|
9888
|
+
const DEFAULT_COMBOBOX_POPOVER_MAX_HEIGHT = '80vh';
|
|
9889
|
+
|
|
9784
9890
|
const COMPONENT_NAME$19 = 'ComboboxPopover';
|
|
9785
9891
|
|
|
9786
9892
|
/**
|
|
@@ -9822,6 +9928,7 @@ const ComboboxPopover$1 = (props, {
|
|
|
9822
9928
|
closeOnEscape = false,
|
|
9823
9929
|
fitToAnchorWidth = true,
|
|
9824
9930
|
isOpen,
|
|
9931
|
+
maxHeight = DEFAULT_COMBOBOX_POPOVER_MAX_HEIGHT,
|
|
9825
9932
|
placement = 'bottom-start',
|
|
9826
9933
|
anchorRef,
|
|
9827
9934
|
handleClose,
|
|
@@ -9831,6 +9938,7 @@ const ComboboxPopover$1 = (props, {
|
|
|
9831
9938
|
...forwardedProps,
|
|
9832
9939
|
placement: placement,
|
|
9833
9940
|
fitToAnchorWidth: fitToAnchorWidth,
|
|
9941
|
+
maxHeight: maxHeight,
|
|
9834
9942
|
className: block$S([className]),
|
|
9835
9943
|
anchorRef: anchorRef,
|
|
9836
9944
|
isOpen: isOpen,
|