@lumx/react 4.25.1-next.1 → 4.26.0-next.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/index.d.ts CHANGED
@@ -1857,6 +1857,11 @@ interface ComboboxListProps$1 extends HasClassName {
1857
1857
  * Omit (or set to `undefined`) when not loading — the attribute is not rendered as `"false"`.
1858
1858
  */
1859
1859
  'aria-busy'?: boolean;
1860
+ /**
1861
+ * Allow selecting several options (`aria-multiselectable`).
1862
+ * Also read by `Combobox.SelectionIcon` to pick the checkbox icons.
1863
+ */
1864
+ 'aria-multiselectable'?: boolean | 'true' | 'false';
1860
1865
  /** Content (should be ComboboxOption elements). */
1861
1866
  children?: JSXElement;
1862
1867
  /** The ID of the listbox element. */
@@ -2307,6 +2312,11 @@ declare const Combobox: {
2307
2312
  displayName: string;
2308
2313
  className: "lumx-combobox-option-skeleton";
2309
2314
  };
2315
+ /** Selection state icon (check circle / radio, or checkbox in multiple lists) for the `after` slot of an option. Reads the option `isSelected` and the list `aria-multiselectable`. */
2316
+ SelectionIcon: {
2317
+ (): react_jsx_runtime.JSX.Element;
2318
+ displayName: string;
2319
+ };
2310
2320
  /** Floating popover container that auto-binds to the combobox anchor and open/close state. */
2311
2321
  Popover: {
2312
2322
  (props: ComboboxPopoverComponentProps): react_jsx_runtime.JSX.Element;
@@ -4482,6 +4492,8 @@ interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps<O>, 'o
4482
4492
  maxLength?: number;
4483
4493
  /** Accessible label for the input element (overrides the visual label for screen readers). */
4484
4494
  ariaLabel?: string;
4495
+ /** Additional props forwarded to the field label (e.g. `className: 'visually-hidden'`, `typography`). */
4496
+ labelProps?: Partial<Omit<InputLabelProps$1, 'children' | 'htmlFor' | 'id'>>;
4485
4497
  /** Additional props forwarded to the Combobox.Input (and ultimately to TextField). */
4486
4498
  inputProps?: Record<string, any>;
4487
4499
  /** Props forwarded to the Combobox.Popover. */
package/index.js CHANGED
@@ -20,6 +20,9 @@ import { mdiCheckCircle } from '@lumx/icons/esm/check-circle.js';
20
20
  import { mdiCloseCircle } from '@lumx/icons/esm/close-circle.js';
21
21
  import { mdiInformationOutline } from '@lumx/icons/esm/information-outline.js';
22
22
  import castArray from 'lodash/castArray.js';
23
+ import { mdiCheckboxBlankOutline } from '@lumx/icons/esm/checkbox-blank-outline.js';
24
+ import { mdiCheckboxMarked } from '@lumx/icons/esm/checkbox-marked.js';
25
+ import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank.js';
23
26
  import noop$1 from 'lodash/noop.js';
24
27
  import concat from 'lodash/concat.js';
25
28
  import dropRight from 'lodash/dropRight.js';
@@ -48,7 +51,6 @@ import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline.js';
48
51
  import chunk from 'lodash/chunk.js';
49
52
  import { mdiDotsVertical } from '@lumx/icons/esm/dots-vertical.js';
50
53
  import take from 'lodash/take.js';
51
- import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank.js';
52
54
  import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked.js';
53
55
  import { mdiArrowDown } from '@lumx/icons/esm/arrow-down.js';
54
56
  import { mdiArrowUp } from '@lumx/icons/esm/arrow-up.js';
@@ -8083,7 +8085,7 @@ const TextField$1 = props => {
8083
8085
  ...labelProps,
8084
8086
  id: labelId,
8085
8087
  htmlFor: textFieldId,
8086
- className: element$N('label'),
8088
+ className: classnames(labelProps?.className, element$N('label')),
8087
8089
  isRequired,
8088
8090
  theme,
8089
8091
  children: [label, charCounter]
@@ -8732,9 +8734,11 @@ const ComboboxList = forwardRef((props, ref) => {
8732
8734
  } = props;
8733
8735
  const internalRef = useRef(null);
8734
8736
  const mergedRef = useMergeRefs(ref, internalRef);
8737
+ const selectionType = String(forwardedProps['aria-multiselectable']) === 'true' ? 'multiple' : 'single';
8735
8738
  const listContextValue = useMemo(() => ({
8736
- type
8737
- }), [type]);
8739
+ type,
8740
+ selectionType
8741
+ }), [type, selectionType]);
8738
8742
  const [isOpen] = useComboboxOpen();
8739
8743
  const options = useComboboxEvent('optionsChange', undefined);
8740
8744
  const visibleCount = options?.optionsLength ?? 0;
@@ -9007,7 +9011,7 @@ const ComboboxOptionContext = /*#__PURE__*/createContext(undefined);
9007
9011
  function useComboboxOptionContext() {
9008
9012
  const context = useContext(ComboboxOptionContext);
9009
9013
  if (!context) {
9010
- throw new Error('Combobox.OptionMoreInfo must be used within a Combobox.Option `after` slot');
9014
+ throw new Error('Combobox.Option sub-components must be used within a Combobox.Option `after` slot');
9011
9015
  }
9012
9016
  return context;
9013
9017
  }
@@ -9074,8 +9078,9 @@ const ComboboxOption = forwardRef((props, ref) => {
9074
9078
  // Wrap `after` content in an option context so sub-components (e.g. OptionMoreInfo)
9075
9079
  // can access the parent option's ID for keyboard highlight detection.
9076
9080
  const optionContextValue = useMemo(() => ({
9077
- optionId
9078
- }), [optionId]);
9081
+ optionId,
9082
+ isSelected: Boolean(isSelected)
9083
+ }), [optionId, isSelected]);
9079
9084
  const wrappedAfter = after ? /*#__PURE__*/jsx(ComboboxOptionContext.Provider, {
9080
9085
  value: optionContextValue,
9081
9086
  children: after
@@ -10690,6 +10695,45 @@ const ComboboxSection = forwardRef((props, ref) => {
10690
10695
  ComboboxSection.displayName = COMPONENT_NAME$19;
10691
10696
  ComboboxSection.className = CLASSNAME$16;
10692
10697
 
10698
+ /**
10699
+ * Selection state icon of an option. The icon is always rendered after the label.
10700
+ *
10701
+ * - `single`: a check circle icon when selected, a blank radio icon otherwise.
10702
+ * - `multiple`: a checkbox icon, marked or blank.
10703
+ */
10704
+ const ComboboxSelectionIcon$1 = ({
10705
+ selectionType,
10706
+ isSelected
10707
+ }) => {
10708
+ let icon;
10709
+ if (selectionType === 'multiple') {
10710
+ icon = isSelected ? mdiCheckboxMarked : mdiCheckboxBlankOutline;
10711
+ } else if (selectionType === 'single') {
10712
+ icon = isSelected ? mdiCheckCircle : mdiRadioboxBlank;
10713
+ } else {
10714
+ return null;
10715
+ }
10716
+ return /*#__PURE__*/jsx(Icon$1, {
10717
+ icon: icon,
10718
+ color: isSelected ? 'primary' : undefined,
10719
+ className: "lumx-combobox-option__selection-icon"
10720
+ });
10721
+ };
10722
+
10723
+ const ComboboxSelectionIcon = () => {
10724
+ const {
10725
+ isSelected
10726
+ } = useComboboxOptionContext();
10727
+ const {
10728
+ selectionType
10729
+ } = useComboboxListContext();
10730
+ return /*#__PURE__*/jsx(ComboboxSelectionIcon$1, {
10731
+ selectionType: selectionType,
10732
+ isSelected: isSelected
10733
+ });
10734
+ };
10735
+ ComboboxSelectionIcon.displayName = 'ComboboxSelectionIcon';
10736
+
10693
10737
  /**
10694
10738
  * Component display name.
10695
10739
  */
@@ -11189,6 +11233,8 @@ const Combobox = {
11189
11233
  OptionMoreInfo: ComboboxOptionMoreInfo,
11190
11234
  /** Loading placeholder skeleton(s) that auto-register loading state with the combobox handle. */
11191
11235
  OptionSkeleton: ComboboxOptionSkeleton,
11236
+ /** Selection state icon (check circle / radio, or checkbox in multiple lists) for the `after` slot of an option. Reads the option `isSelected` and the list `aria-multiselectable`. */
11237
+ SelectionIcon: ComboboxSelectionIcon,
11192
11238
  /** Floating popover container that auto-binds to the combobox anchor and open/close state. */
11193
11239
  Popover: ComboboxPopover,
11194
11240
  /** Labelled group of options that auto-hides when all its child options are filtered out. */
@@ -19110,6 +19156,7 @@ const SelectTextField$1 = props => {
19110
19156
  // Text field
19111
19157
  className,
19112
19158
  label,
19159
+ labelProps,
19113
19160
  placeholder,
19114
19161
  icon,
19115
19162
  isDisabled,
@@ -19267,6 +19314,7 @@ const SelectTextField$1 = props => {
19267
19314
  errorTryReloadMessage: translations.errorTryReloadMessage,
19268
19315
  inputProps: {
19269
19316
  ...consumerInputProps,
19317
+ labelProps: labelProps ?? consumerInputProps?.labelProps,
19270
19318
  placeholder,
19271
19319
  icon,
19272
19320
  value: displayValue,