@lumx/core 4.26.1-alpha.0 → 4.27.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.
@@ -5039,22 +5039,6 @@ table {
5039
5039
  }
5040
5040
  .lumx-combobox-popover__scroll {
5041
5041
  overflow-y: auto;
5042
- scroll-snap-type: y proximity;
5043
- }
5044
- @media (prefers-reduced-motion: no-preference) {
5045
- .lumx-combobox-popover__scroll {
5046
- scroll-behavior: smooth;
5047
- }
5048
- }
5049
- .lumx-combobox-popover__scroll::before {
5050
- content: "";
5051
- display: block;
5052
- scroll-snap-align: start;
5053
- }
5054
- .lumx-combobox-popover__scroll::after {
5055
- content: "";
5056
- display: block;
5057
- scroll-snap-align: end;
5058
5042
  }
5059
5043
  .lumx-combobox-popover:empty, .lumx-combobox-popover:not(:has(.lumx-listbox-option)):not(:has(.lumx-listbox-state)):not(:has(.lumx-listbox-option-skeleton)) {
5060
5044
  display: none;
@@ -9585,6 +9569,31 @@ table {
9585
9569
  margin-bottom: 0;
9586
9570
  }
9587
9571
 
9572
+ /* ==========================================================================
9573
+ Scroll box
9574
+ ========================================================================== */
9575
+ .lumx-scroll-box {
9576
+ overflow-y: auto;
9577
+ }
9578
+ .lumx-scroll-box--scroll-snap {
9579
+ scroll-snap-type: y proximity;
9580
+ }
9581
+ @media (prefers-reduced-motion: no-preference) {
9582
+ .lumx-scroll-box--scroll-snap {
9583
+ scroll-behavior: smooth;
9584
+ }
9585
+ }
9586
+ .lumx-scroll-box--scroll-snap::before {
9587
+ display: block;
9588
+ content: "";
9589
+ scroll-snap-align: start;
9590
+ }
9591
+ .lumx-scroll-box--scroll-snap::after {
9592
+ display: block;
9593
+ content: "";
9594
+ scroll-snap-align: end;
9595
+ }
9596
+
9588
9597
  /* ==========================================================================
9589
9598
  Select
9590
9599
  ========================================================================== */
@@ -23,8 +23,6 @@ export interface ComboboxPopoverProps extends HasClassName, InheritedPopoverProp
23
23
  export interface ComboboxPopoverComponents {
24
24
  /** Popover component (framework-specific). */
25
25
  Popover: any;
26
- /** FlexBox component (framework-specific). */
27
- FlexBox: any;
28
26
  }
29
27
  /**
30
28
  * ComboboxPopover core template.
@@ -37,5 +35,5 @@ export interface ComboboxPopoverComponents {
37
35
  * @param components Injected framework-specific components.
38
36
  * @return JSX element.
39
37
  */
40
- export declare const ComboboxPopover: (props: ComboboxPopoverProps, { Popover, FlexBox }: ComboboxPopoverComponents) => import("react").JSX.Element;
38
+ export declare const ComboboxPopover: (props: ComboboxPopoverProps, { Popover }: ComboboxPopoverComponents) => import("react").JSX.Element;
41
39
  export {};
@@ -47,6 +47,14 @@ export declare function getActiveOption(): HTMLElement | null;
47
47
  * Exported so TestStories.tsx can reuse the same templates for browser-only tests.
48
48
  */
49
49
  export declare function createTemplates(Combobox: ComboboxNamespace, IconButton: any): {
50
+ inlineTemplate: ({ value, onChange, onSelect, alwaysOpen, }: {
51
+ value: string;
52
+ onChange: (v: string) => void;
53
+ onSelect?: (option: {
54
+ value: string;
55
+ }) => void;
56
+ alwaysOpen?: boolean;
57
+ }) => import("react").JSX.Element;
50
58
  inputTemplate: ({ value, onChange, onSelect, selectionMode, }: {
51
59
  value: string;
52
60
  onChange: (v: string) => void;
@@ -1,3 +1,6 @@
1
+ import type { LumxClassName } from '../../types';
1
2
  import { VHSize } from '../../utils/browser/css/types';
2
3
  export declare const DEFAULT_COMBOBOX_POPOVER_MAX_HEIGHT: VHSize;
3
4
  export declare const COMBOBOX_PROVIDER_COMPONENT_NAME = "ComboboxProvider";
5
+ /** Class name of the `Combobox.Popover` (a listbox outside of it is inline, always open). */
6
+ export declare const COMBOBOX_POPOVER_CLASSNAME: LumxClassName<'ComboboxPopover'>;
@@ -63,8 +63,20 @@ export interface ComboboxHandle {
63
63
  readonly list: ListboxHandle;
64
64
  /** Whether the popup is open (same as `list.isOpen`). */
65
65
  readonly isOpen: boolean;
66
- /** Set the open state and update ARIA. Subscribe to `list` `open` to observe it. */
66
+ /** Whether the listbox is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
67
+ readonly alwaysOpen: boolean;
68
+ /**
69
+ * Set the open state and update ARIA. Subscribe to `list` `open` to observe it.
70
+ * When always open, a close request only clears the active option.
71
+ */
67
72
  setIsOpen(isOpen: boolean): void;
73
+ /**
74
+ * Force the listbox always open (inline listbox, not in a popup) or not. With `false`, the listbox uses the
75
+ * open/close behavior (the listbox closes). When always open, focus out, selection and Escape do not
76
+ * close the listbox. With `undefined` (default), the listbox is always open when it is mounted outside of a
77
+ * `Combobox.Popover`.
78
+ */
79
+ setAlwaysOpen(alwaysOpen: boolean | undefined): void;
68
80
  }
69
81
  /**
70
82
  * Callback invoked when the trigger is attached and the abort controller is ready.
@@ -9,10 +9,8 @@ export interface MenuPopoverProps extends HasClassName, Pick<PopoverProps, 'plac
9
9
  export interface MenuPopoverComponents {
10
10
  /** Popover component (framework-specific). */
11
11
  Popover: any;
12
- /** FlexBox component (framework-specific). */
13
- FlexBox: any;
14
12
  }
15
13
  export declare const COMPONENT_NAME = "MenuPopover";
16
14
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
17
15
  /** MenuPopover core template. Renders a `Popover` with menu-friendly defaults. */
18
- export declare const MenuPopover: (props: MenuPopoverProps, { Popover, FlexBox }: MenuPopoverComponents) => import("react").JSX.Element;
16
+ export declare const MenuPopover: (props: MenuPopoverProps, { Popover }: MenuPopoverComponents) => import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ import { ScrollBoxProps } from '.';
3
+ type SetupProps = Partial<ScrollBoxProps>;
4
+ /**
5
+ * Mounts the component and returns common DOM elements / data needed in multiple tests further down.
6
+ */
7
+ export declare const setup: (props: SetupProps | undefined, { render, ...options }: SetupOptions<ScrollBoxProps>) => {
8
+ props: Partial<ScrollBoxProps>;
9
+ scrollBox: HTMLElement;
10
+ container: any;
11
+ };
12
+ declare const _default: (renderOptions: SetupOptions<ScrollBoxProps>) => void;
13
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
2
+ import { type FlexBoxProps } from '../FlexBox';
3
+ /**
4
+ * Defines the props for the core ScrollBox template.
5
+ */
6
+ export interface ScrollBoxProps extends HasClassName, Pick<FlexBoxProps, 'fillSpace'> {
7
+ /** Content to scroll. */
8
+ children?: JSXElement;
9
+ /**
10
+ * Snap the scroll position to the start and the end of the content, and scroll smoothly
11
+ * (when motion is not reduced). Useful for keyboard navigation in a list of options.
12
+ */
13
+ scrollSnap?: boolean;
14
+ /** Tab index (ex: `-1` to keep the browser from making the scroll container a tab stop). */
15
+ tabIndex?: number;
16
+ /** Additional inline style. */
17
+ style?: Record<string, any>;
18
+ /** Reference to the root element. */
19
+ ref?: CommonRef;
20
+ }
21
+ /**
22
+ * Component display name.
23
+ */
24
+ export declare const COMPONENT_NAME = "ScrollBox";
25
+ /**
26
+ * Component default class name.
27
+ */
28
+ export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
29
+ /**
30
+ * ScrollBox core template (internal).
31
+ * Renders a vertical flex box whose content scrolls on the y axis.
32
+ *
33
+ * @param props Component props.
34
+ * @return JSX element.
35
+ */
36
+ export declare const ScrollBox: {
37
+ (props: ScrollBoxProps): import("react").JSX.Element;
38
+ displayName: string;
39
+ className: "lumx-scroll-box";
40
+ };
@@ -11,11 +11,11 @@ export type Fruit = (typeof FRUITS)[number];
11
11
  /**
12
12
  * Setup SelectTextField stories for a specific framework (React or Vue).
13
13
  */
14
- export declare function setup({ components: { SelectTextField }, decorators: { withValueOnChange }, }: SetupStoriesOptions<{
14
+ export declare function setup({ components: { SelectTextField }, decorators: { withValueOnChange, withWrapper }, }: SetupStoriesOptions<{
15
15
  components: {
16
16
  SelectTextField: any;
17
17
  };
18
- decorators: 'withValueOnChange';
18
+ decorators: 'withValueOnChange' | 'withWrapper';
19
19
  }>): {
20
20
  meta: {
21
21
  component: any;
@@ -106,6 +106,13 @@ export declare function setup({ components: { SelectTextField }, decorators: { w
106
106
  decorators: ((story: any, context: any) => any)[];
107
107
  render: ({ value, onChange }: any) => import("react").JSX.Element;
108
108
  };
109
+ Inline: {
110
+ args: {
111
+ value: undefined;
112
+ };
113
+ decorators: ((story: any, context: any) => any)[];
114
+ render: ({ value, onChange }: any) => import("react").JSX.Element;
115
+ };
109
116
  MultipleSelection: {
110
117
  args: {
111
118
  value: never[];
@@ -27,6 +27,9 @@ export declare function setup({ components: { SelectTextField }, }: SetupStories
27
27
  };
28
28
  };
29
29
  };
30
+ InlineInPopoverDialog: {
31
+ play({ canvas }: any): Promise<void>;
32
+ };
30
33
  ClickOutsideCloses: {
31
34
  render: (args: any) => import("react").JSX.Element;
32
35
  play({ canvas }: any): Promise<void>;
@@ -6,14 +6,29 @@ import { BaseSelectComponents, BaseSelectProps, SelectListStatus } from '../../u
6
6
  export interface SelectTextFieldProps<O = any> extends BaseSelectProps<O> {
7
7
  /** Selected option (single) or options (multiple) — for marking options as selected. */
8
8
  selected?: O | O[];
9
- /** Field label (required). Also used as aria-label for the listbox. */
9
+ /**
10
+ * Field label (required). Also used as aria-label for the listbox.
11
+ * When empty, the listbox uses the input `aria-labelledby`.
12
+ */
10
13
  label: string;
11
14
  /** Whether the listbox supports multiple selection. */
12
15
  isMultiselectable?: boolean;
16
+ /** Accessible label of the input (takes precedence over `inputProps['aria-label']`). */
17
+ 'aria-label'?: string;
18
+ /**
19
+ * Id of the element(s) labelling the input (takes precedence over `inputProps['aria-labelledby']`).
20
+ * Also labels the listbox when `label` is empty.
21
+ */
22
+ 'aria-labelledby'?: string;
13
23
  /** Props forwarded to Combobox.Input. */
14
24
  inputProps?: Record<string, any>;
15
- /** Props forwarded to Combobox.Popover. */
16
- popoverProps?: Record<string, any>;
25
+ /**
26
+ * Props forwarded to Combobox.Popover.
27
+ * Set to `false` to render the list inline below the text field, with no popover (the list is always visible).
28
+ * The parent must give the list a bounded height (flex column) so that the list scrolls.
29
+ * Use it only as the main content of a dedicated container (ex: a picker dialog), not in a form.
30
+ */
31
+ popoverProps?: Record<string, any> | false;
17
32
  /** Props forwarded to Combobox.List (e.g. ref). */
18
33
  listProps?: Record<string, any>;
19
34
  /**
@@ -26,12 +26,6 @@ export interface RenderOptionContext {
26
26
  isSelected: boolean;
27
27
  /** Resolved description string (from `getOptionDescription`), if any. Should be forwarded as `description`. */
28
28
  description?: string | null;
29
- /**
30
- * Selection state icon to render after the option label
31
- * (single selection: check circle when selected, blank radio otherwise; multiple selection: checkbox).
32
- * Should be forwarded as `after` (appended after any custom `after` content).
33
- */
34
- after?: JSXElement;
35
29
  }
36
30
  export interface BaseSelectProps<O> {
37
31
  /** List of option objects. */
@@ -216,7 +210,10 @@ export interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps
216
210
  * @default false
217
211
  */
218
212
  openOnFocus?: boolean;
219
- /** Field label (required). Also used as aria-label for the listbox. */
213
+ /**
214
+ * Field label (required). Also used as aria-label for the listbox.
215
+ * When empty, the listbox uses the input `aria-labelledby`.
216
+ */
220
217
  label: string;
221
218
  /** Input placeholder text. */
222
219
  placeholder?: string;
@@ -244,13 +241,24 @@ export interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps
244
241
  /** Maximum string length (shows character counter). */
245
242
  maxLength?: number;
246
243
  /** Accessible label for the input element (overrides the visual label for screen readers). */
244
+ 'aria-label'?: string;
245
+ /**
246
+ * @deprecated Use `aria-label` instead.
247
+ */
247
248
  ariaLabel?: string;
249
+ /** Id of the element(s) labelling the input (and the listbox when `label` is empty). */
250
+ 'aria-labelledby'?: string;
248
251
  /** Additional props forwarded to the field label (e.g. `className: 'visually-hidden'`, `typography`). */
249
252
  labelProps?: Partial<Omit<InputLabelProps, 'children' | 'htmlFor' | 'id'>>;
250
253
  /** Additional props forwarded to the Combobox.Input (and ultimately to TextField). */
251
254
  inputProps?: Record<string, any>;
252
- /** Props forwarded to the Combobox.Popover. */
253
- popoverProps?: Record<string, any>;
255
+ /**
256
+ * Props forwarded to the Combobox.Popover.
257
+ * Set to `false` to render the list inline below the text field, with no popover (the list is always visible).
258
+ * The parent must give the list a bounded height (flex column) so that the list scrolls.
259
+ * Use it only as the main content of a dedicated container (ex: a picker dialog), not in a form.
260
+ */
261
+ popoverProps?: Record<string, any> | false;
254
262
  /** Labels for the clear button, toggle button, and chip group. */
255
263
  translations: SelectTextFieldTranslations;
256
264
  }
package/lumx.css CHANGED
@@ -5720,22 +5720,6 @@ table {
5720
5720
  }
5721
5721
  .lumx-combobox-popover__scroll {
5722
5722
  overflow-y: auto;
5723
- scroll-snap-type: y proximity;
5724
- }
5725
- @media (prefers-reduced-motion: no-preference) {
5726
- .lumx-combobox-popover__scroll {
5727
- scroll-behavior: smooth;
5728
- }
5729
- }
5730
- .lumx-combobox-popover__scroll::before {
5731
- content: "";
5732
- display: block;
5733
- scroll-snap-align: start;
5734
- }
5735
- .lumx-combobox-popover__scroll::after {
5736
- content: "";
5737
- display: block;
5738
- scroll-snap-align: end;
5739
5723
  }
5740
5724
  .lumx-combobox-popover:empty, .lumx-combobox-popover:not(:has(.lumx-listbox-option)):not(:has(.lumx-listbox-state)):not(:has(.lumx-listbox-option-skeleton)) {
5741
5725
  display: none;
@@ -10266,6 +10250,31 @@ table {
10266
10250
  margin-bottom: 0;
10267
10251
  }
10268
10252
 
10253
+ /* ==========================================================================
10254
+ Scroll box
10255
+ ========================================================================== */
10256
+ .lumx-scroll-box {
10257
+ overflow-y: auto;
10258
+ }
10259
+ .lumx-scroll-box--scroll-snap {
10260
+ scroll-snap-type: y proximity;
10261
+ }
10262
+ @media (prefers-reduced-motion: no-preference) {
10263
+ .lumx-scroll-box--scroll-snap {
10264
+ scroll-behavior: smooth;
10265
+ }
10266
+ }
10267
+ .lumx-scroll-box--scroll-snap::before {
10268
+ display: block;
10269
+ content: "";
10270
+ scroll-snap-align: start;
10271
+ }
10272
+ .lumx-scroll-box--scroll-snap::after {
10273
+ display: block;
10274
+ content: "";
10275
+ scroll-snap-align: end;
10276
+ }
10277
+
10269
10278
  /* ==========================================================================
10270
10279
  Select
10271
10280
  ========================================================================== */
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@floating-ui/dom": "^1.7.5",
10
- "@lumx/icons": "^4.26.1-alpha.0",
10
+ "@lumx/icons": "^4.27.0-next.0",
11
11
  "classnames": "^2.3.2",
12
12
  "focus-visible": "^5.0.2",
13
13
  "lodash": "4.18.1",
@@ -66,7 +66,7 @@
66
66
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
67
67
  },
68
68
  "sideEffects": false,
69
- "version": "4.26.1-alpha.0",
69
+ "version": "4.27.0-next.0",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-typescript": "^12.3.0",
72
72
  "@testing-library/dom": "^10.4.1",
@@ -40,6 +40,7 @@
40
40
  @import "./components/progress/index";
41
41
  @import "./components/progress-tracker/index";
42
42
  @import "./components/radio-button/index";
43
+ @import "./components/scroll-box/index";
43
44
  @import "./components/select/index";
44
45
  @import "./components/side-navigation/index";
45
46
  @import "./components/skeleton/index";
@@ -19,21 +19,6 @@
19
19
 
20
20
  &__scroll {
21
21
  overflow-y: auto;
22
- scroll-snap-type: y proximity;
23
- @media (prefers-reduced-motion: no-preference) {
24
- scroll-behavior: smooth;
25
- }
26
-
27
- &::before {
28
- content: '';
29
- display: block;
30
- scroll-snap-align: start;
31
- }
32
- &::after {
33
- content: '';
34
- display: block;
35
- scroll-snap-align: end;
36
- }
37
22
  }
38
23
 
39
24
  // Hide popover when there is no option, no state, and no skeleton
@@ -0,0 +1,27 @@
1
+ /* ==========================================================================
2
+ Scroll box
3
+ ========================================================================== */
4
+
5
+ .#{$lumx-base-prefix}-scroll-box {
6
+ overflow-y: auto;
7
+
8
+ &--scroll-snap {
9
+ scroll-snap-type: y proximity;
10
+
11
+ @media (prefers-reduced-motion: no-preference) {
12
+ scroll-behavior: smooth;
13
+ }
14
+
15
+ &::before {
16
+ display: block;
17
+ content: "";
18
+ scroll-snap-align: start;
19
+ }
20
+
21
+ &::after {
22
+ display: block;
23
+ content: "";
24
+ scroll-snap-align: end;
25
+ }
26
+ }
27
+ }