@ssa-ui-kit/core 3.25.0 → 3.25.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.
Files changed (33) hide show
  1. package/dist/ai/source-map.md +44 -14
  2. package/dist/components/Breadcrumbs/styles.d.ts +1 -1
  3. package/dist/components/ContextMenu/ContextMenu.d.ts +74 -0
  4. package/dist/components/ContextMenu/ContextMenuOption.d.ts +18 -0
  5. package/dist/components/ContextMenu/index.d.ts +3 -0
  6. package/dist/components/ContextMenu/styles.d.ts +17 -0
  7. package/dist/components/ContextMenu/types.d.ts +153 -0
  8. package/dist/components/ContextMenu/utils.d.ts +79 -0
  9. package/dist/components/Dropdown/types.d.ts +7 -0
  10. package/dist/components/DropdownOptions/DropdownOptions.d.ts +5 -5
  11. package/dist/components/DropdownOptions/useToggleListKeys.d.ts +33 -0
  12. package/dist/components/DropdownOptions/utils.d.ts +9 -0
  13. package/dist/components/FiltersMultiSelect/FiltersMultiSelectProvider.d.ts +9 -0
  14. package/dist/components/FiltersMultiSelect/components/FiltersMultiSelectOption.d.ts +31 -1
  15. package/dist/components/FiltersMultiSelect/components/FiltersMultiSelectOptions.d.ts +29 -2
  16. package/dist/components/FiltersMultiSelect/utils.d.ts +15 -0
  17. package/dist/components/Header/Header.d.ts +4 -4
  18. package/dist/components/Header/HeaderMobileMenu.d.ts +4 -3
  19. package/dist/components/Header/styles.d.ts +15 -4
  20. package/dist/components/MultipleDropdown/MultipleDropdown.d.ts +4 -1
  21. package/dist/components/MultipleDropdown/types.d.ts +8 -0
  22. package/dist/components/MultipleDropdownOptions/MultipleDropdownOptions.d.ts +27 -0
  23. package/dist/components/Table/ColumnFreezeMenu.d.ts +2 -0
  24. package/dist/components/Typeahead/Typeahead.context.d.ts +9 -1
  25. package/dist/components/Typeahead/components/TypeaheadOptions.d.ts +13 -1
  26. package/dist/components/Typeahead/styles.d.ts +5 -0
  27. package/dist/components/Typeahead/types.d.ts +6 -0
  28. package/dist/components/Typeahead/useTypeahead.d.ts +10 -1
  29. package/dist/components/index.d.ts +2 -0
  30. package/dist/index.js +2532 -1514
  31. package/dist/index.mjs +2529 -1515
  32. package/dist/tsbuildcache +1 -1
  33. package/package.json +3 -3
@@ -4,7 +4,7 @@ Generated from the TypeScript program at build time — do not edit by hand.
4
4
 
5
5
  **Everything below is imported from the package root:** `import { X } from '@ssa-ui-kit/core'`
6
6
 
7
- 192 components · 20 contexts · 23 hooks · 17 functions · 16 constants · 325 exported types
7
+ 193 components · 20 contexts · 23 hooks · 20 functions · 16 constants · 340 exported types
8
8
 
9
9
  ## Reading this file
10
10
 
@@ -16,7 +16,7 @@ Generated from the TypeScript program at build time — do not edit by hand.
16
16
 
17
17
  ## Component roster
18
18
 
19
- **Action & Form Controls** — BreadcrumbMenu, Breadcrumbs, Button, ButtonGroup, ButtonGroupButton, Checkbox, ColorPicker, DatePicker, DateRangePicker, DateRangePickerFormBridge, Dropdown, DropdownArrow, DropdownBase, DropdownOption, DropdownOptions, DropdownToggle, FileAttachment, FileUpload, FloatingActionButton, IconButton, Input, MultipleDropdown, MultipleDropdownNotification, MultipleDropdownOptions, NumberField, Radio, RadioGroup, SearchBox, SearchBoxCrossIcon, SearchBoxInput, SearchBoxWrapper, Slider, SliderInputsRow, SliderLabel, SliderMarkItem, SliderMarkLabel, SliderMarksRow, SliderMarkTick, SliderNumberInput, SliderRangeInput, SliderRoot, SliderTrackBg, SliderTrackFill, SliderTrackRow, SliderTrackWrapper, SliderValueLabel, SliderValueLabelsContainer, Switch, Textarea, TextField, Typeahead, TypeaheadItemIcon, TypeaheadItemImage, TypeaheadOption, TypeaheadOptions
19
+ **Action & Form Controls** — BreadcrumbMenu, Breadcrumbs, Button, ButtonGroup, ButtonGroupButton, Checkbox, ColorPicker, ContextMenu, DatePicker, DateRangePicker, DateRangePickerFormBridge, Dropdown, DropdownArrow, DropdownBase, DropdownOption, DropdownOptions, DropdownToggle, FileAttachment, FileUpload, FloatingActionButton, IconButton, Input, MultipleDropdown, MultipleDropdownNotification, MultipleDropdownOptions, NumberField, Radio, RadioGroup, SearchBox, SearchBoxCrossIcon, SearchBoxInput, SearchBoxWrapper, Slider, SliderInputsRow, SliderLabel, SliderMarkItem, SliderMarkLabel, SliderMarksRow, SliderMarkTick, SliderNumberInput, SliderRangeInput, SliderRoot, SliderTrackBg, SliderTrackFill, SliderTrackRow, SliderTrackWrapper, SliderValueLabel, SliderValueLabelsContainer, Switch, Textarea, TextField, Typeahead, TypeaheadItemIcon, TypeaheadItemImage, TypeaheadOption, TypeaheadOptions
20
20
 
21
21
  **Form Structure** — Filters, FiltersMultiSelect, FiltersMultiSelectEmpty, FiltersMultiSelectOption, FiltersMultiSelectOptions, Form, FormAction, FormCheckbox, FormGroup, FormHelperText, FormRadioGroup
22
22
 
@@ -122,6 +122,25 @@ Form control for selecting one or more options
122
122
  - `classnames?: { trigger, content, button, colorPicker, colorDropdown, output }`
123
123
  - `onChange?: (color: string) => void`
124
124
 
125
+ #### ContextMenu<V>
126
+ The list of options shown inside a dropdown, typeahead, filter or action menu.
127
+
128
+ - `items: ContextMenuEntry<V>[]` — Options and groups, in display order.
129
+ - `indicator?: ContextMenuIndicator` — How selected rows are marked. Defaults to `check` for `single`, `checkbox` for `multiple` and `none`…
130
+ - `onAction?: (value: V) => void` — Fires when an option is chosen by click, Enter or Space, in every mode — the hook for closing a popup.
131
+ - `activeValue?: V | null` — Controlled highlighted option (pointer or keyboard).
132
+ - `defaultActiveValue?: V | null` — Initially highlighted option when uncontrolled.
133
+ - `onActiveValueChange?: (value: V | null) => void` — Fires when the highlighted option changes.
134
+ - `renderItem?: (item: ContextMenuItem<V>, state: ContextMenuItemState) => ReactNode` — Replaces the row content between the start and end indicators.
135
+ - `renderGroupLabel?: (group: ContextMenuGroup<V>) => ReactNode` — Replaces the content of group titles.
136
+ - `emptyState?: ReactNode` `= 'No items'` — Shown when `items` has no options.
137
+ - `maxHeight?: string | number` — Scrolls the list beyond this height (px or any CSS length).
138
+ - `selectionMode?: 'none' | 'multiple' | 'single' | 'includeExclude'`
139
+ - `value?: V | V[] | ContextMenuIncludeExcludeEntry<V>[] | null` — Controlled selected value. `null` for none. Controlled selected values. Controlled chosen rows.
140
+ - `defaultValue?: V | V[] | ContextMenuIncludeExcludeEntry<V>[] | null` — Initially selected value when uncontrolled. Initially selected values when uncontrolled. Initially chosen…
141
+ - `onChange?: ((value: V) => void) | ((value: V[], toggled: V) => void) | …(1 more)` — Fires with the newly selected value. Choosing the selected option again keeps it selected. Fires with the new…
142
+ - _plus native element attributes_
143
+
125
144
  #### DatePicker
126
145
  Masked date input with a popover calendar. Use inside **`FormProvider`** (react-hook-form): the field value is the formatted string; **`onChange`** receives a JavaScript…
127
146
 
@@ -407,6 +426,7 @@ Dropdown component for multi-select and single-select
407
426
  - _plus native element attributes_
408
427
 
409
428
  #### MultipleDropdownOptions
429
+ Options menu container for MultipleDropdown
410
430
 
411
431
  - `aria-labelledby?: string` — ARIA label reference Associates the listbox with its label
412
432
  - `ariaLabelledby?: string` — ARIA label reference Associates the listbox with its label
@@ -758,8 +778,9 @@ Props for TypeaheadOption component Record type that allows any string or number
758
778
  - `aria-selected?: boolean` — ARIA selected state
759
779
 
760
780
  #### TypeaheadOptions
781
+ The Typeahead's option list: a `ContextMenu` driven from the Typeahead's input. The options themselves come from the `TypeaheadOption` children of `Typeahead`, filtered…
761
782
 
762
- - `children?: ReactNode`
783
+ - `children?: ReactNode` — Ignored: the options come from the `TypeaheadOption` children of `Typeahead`, through context.
763
784
  - `noItemsMessage?: string`
764
785
 
765
786
  ### Form Structure
@@ -802,12 +823,14 @@ Props for TypeaheadOption component Record type that allows any string or number
802
823
  - _plus native element attributes_
803
824
 
804
825
  #### FiltersMultiSelectOption
826
+ One filter row of a `FiltersMultiSelect`.
805
827
 
806
- - `filter: Filter`
807
- - `children: ReactNode`
828
+ - `filter: Filter` — The filter this row adds. `group: true` makes it a select-only row.
829
+ - `children: ReactNode` — Row content.
808
830
  - `selected?: boolean`
809
831
 
810
832
  #### FiltersMultiSelectOptions
833
+ The options list of a `FiltersMultiSelect`.
811
834
 
812
835
  - `children: React.ReactNode`
813
836
  - _plus native element attributes_
@@ -2327,7 +2350,10 @@ A sticky action bar across the bottom of the panel.
2327
2350
  - `clearButtonStyles`
2328
2351
  - `deriveBreadcrumbs` — Pure derivation of breadcrumb items from a route tree and a pathname. Extracted from the hook so it can be unit-tested without a router.
2329
2352
  - `filterButtonStyles`
2353
+ - `getContextMenuOptionId` — DOM id of an option, for `aria-activedescendant` on an element outside the list (e.g. a combobox input). `menuId` is the `id` given to the ContextMenu. Characters not…
2354
+ - `getNextActiveValue` — Where a navigation key moves the highlight: ArrowDown / ArrowUp step over disabled options and wrap, Home / End jump to the ends. Returns `undefined` for any other key,…
2330
2355
  - `highlightInputMatch`
2356
+ - `nextIncludeExcludeType` — Where Enter moves an `includeExclude` row: none → include → exclude → none, or none ⇄ selected for `selectOnly` rows. For driving that cycle from an input that keeps…
2331
2357
  - `resetDeprecationWarnings` — Clears the once-per-pair warning cache.
2332
2358
  - `resolveAriaProp` — Shorthand for the camelCase-ARIA → native-ARIA renames (issue #656, chunk 3 item 1).
2333
2359
  - `resolveDeprecatedProp` — Resolves a prop that is mid-rename: returns the new prop's value when it is defined, otherwise falls back to the deprecated one and warns in dev.
@@ -2395,15 +2421,19 @@ _Names only — read the `.d.ts` for their shape._
2395
2421
  `CollapsibleNavBarItem` · `ColoredButtonTextProps` · `ColorsKeys` · `ColumnFreezeApi`
2396
2422
  `ColumnFreezeMenuProps` · `ColumnFreezeOptions` · `ColumnId` · `ColumnResizeApi`
2397
2423
  `ColumnResizeHandleProps` · `ColumnResizeMode` · `ColumnResizeOptions` · `CommonProps`
2398
- `ContextType` · `ControlledButtonProps` · `CounterProps` · `CounterSizes` · `CounterVariants`
2399
- `CustomIconProps` · `CustomTagStyles` · `DatePickerContextProps` · `DatePickerFormat`
2400
- `DatePickerProps` · `DateRangePickerContextProps` · `DateRangePickerFormBridgeProps`
2401
- `DateRangePickerFormBridgeValue` · `DateRangePickerOnChangeDates` · `DateRangePickerProps`
2402
- `DateRangePresetValue` · `DateRangePreset` · `DateTimeTuple` · `DeprecatedOpenStateProps`
2403
- `DropdownContextType` · `DropdownOptionProps` · `DropdownPositions` · `DropdownProps`
2404
- `DropdownToggleProps` · `DynamicAlertParams` · `DynamicNotificationParams` · `DynamicToastParams`
2405
- `FieldContextValue` · `FieldControlProps` · `FieldDescriptionProps` · `FieldErrorProps`
2406
- `FieldLabelProps` · `FieldProps` · `FieldSuccessProps` · `FileAttachmentFile`
2424
+ `ContextMenuBaseProps` · `ContextMenuEntry` · `ContextMenuGroup` · `ContextMenuIncludeExcludeEntry`
2425
+ `ContextMenuIncludeExcludeSelectionProps` · `ContextMenuIncludeExcludeType` · `ContextMenuIndicator`
2426
+ `ContextMenuItemState` · `ContextMenuItem` · `ContextMenuMultipleSelectionProps`
2427
+ `ContextMenuNoSelectionProps` · `ContextMenuProps` · `ContextMenuSelectionProps`
2428
+ `ContextMenuSingleSelectionProps` · `ContextMenuValue` · `ContextType` · `ControlledButtonProps`
2429
+ `CounterProps` · `CounterSizes` · `CounterVariants` · `CustomIconProps` · `CustomTagStyles`
2430
+ `DatePickerContextProps` · `DatePickerFormat` · `DatePickerProps` · `DateRangePickerContextProps`
2431
+ `DateRangePickerFormBridgeProps` · `DateRangePickerFormBridgeValue` · `DateRangePickerOnChangeDates`
2432
+ `DateRangePickerProps` · `DateRangePresetValue` · `DateRangePreset` · `DateTimeTuple`
2433
+ `DeprecatedOpenStateProps` · `DropdownContextType` · `DropdownOptionProps` · `DropdownPositions`
2434
+ `DropdownProps` · `DropdownToggleProps` · `DynamicAlertParams` · `DynamicNotificationParams`
2435
+ `DynamicToastParams` · `FieldContextValue` · `FieldControlProps` · `FieldDescriptionProps`
2436
+ `FieldErrorProps` · `FieldLabelProps` · `FieldProps` · `FieldSuccessProps` · `FileAttachmentFile`
2407
2437
  `FileAttachmentProps` · `FileRejectionReason` · `FileUploadProgressEntry` · `FileUploadProgress`
2408
2438
  `FileUploadProps` · `Filter` · `FiltersMultiSelectEmptyProps` · `FiltersMultiSelectOptionProps`
2409
2439
  `FiltersMultiSelectProps` · `FloatingActionButtonAction` · `FloatingActionButtonColor`
@@ -6,4 +6,4 @@ export declare const crumbLink: import("@emotion/react").SerializedStyles;
6
6
  export declare const crumbText: import("@emotion/react").SerializedStyles;
7
7
  export declare const crumbCurrent: import("@emotion/react").SerializedStyles;
8
8
  export declare const menu: import("@emotion/react").SerializedStyles;
9
- export declare const menuItem: import("@emotion/react").SerializedStyles;
9
+ export declare const menuLink: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,74 @@
1
+ import { ReactElement, Ref } from 'react';
2
+ import { ContextMenuProps, ContextMenuValue } from './types';
3
+ /**
4
+ * ContextMenu - The list of options shown inside a dropdown, typeahead,
5
+ * filter or action menu.
6
+ *
7
+ * It renders only the list: open state, the trigger and positioning belong to
8
+ * the component hosting it, which places it inline or inside a `Popover`.
9
+ *
10
+ * ### Selection
11
+ * `selectionMode` picks the behaviour and the shape of `value` / `onChange`:
12
+ * - `none` (default): an action menu (`role="menu"`); rows only fire `onAction`
13
+ * - `single`: one value; marked with a check by default
14
+ * - `multiple`: an array of values; marked with checkboxes by default
15
+ * - `includeExclude`: `{ value, type }` entries; every row has + / − controls,
16
+ * `selectOnly` rows a single check-circle. Clicking the active control clears
17
+ * it; Enter cycles none → include → exclude → none.
18
+ *
19
+ * `indicator` overrides how selected rows are marked. Use `startContent` /
20
+ * `endContent` for anything the design does not cover.
21
+ *
22
+ * ### Rows
23
+ * Each option can carry an avatar, a status dot, a right-hand description and
24
+ * free start / end content. Text labels ellipsise and show the full text in a
25
+ * tooltip after a hover. Pass a `ContextMenuGroup` among `items` for a titled
26
+ * section; groups are separated by a divider.
27
+ *
28
+ * ### Keyboard
29
+ * The list is a single tab stop. Arrow keys, Home and End move the highlight
30
+ * (announced through `aria-activedescendant`), Enter or Space choose, and
31
+ * typing jumps to the next option starting with the typed text. Escape is left
32
+ * to the host. A host that keeps focus elsewhere (e.g. in an input) can drive
33
+ * the highlight with `activeValue` / `onActiveValueChange`.
34
+ *
35
+ * @category Components
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * const [value, setValue] = useState<string | null>(null);
40
+ *
41
+ * <ContextMenu
42
+ * selectionMode="single"
43
+ * value={value}
44
+ * onChange={setValue}
45
+ * items={[
46
+ * {
47
+ * id: 'project',
48
+ * label: 'Project Members',
49
+ * items: [
50
+ * { value: 'ann', label: 'Ann Lee', avatar: annPhotoUrl },
51
+ * { value: 'bob', label: 'Bob Stone', avatar: bobPhotoUrl },
52
+ * ],
53
+ * },
54
+ * ]}
55
+ * />
56
+ * ```
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * // Include / exclude filters
61
+ * <ContextMenu
62
+ * selectionMode="includeExclude"
63
+ * value={filters}
64
+ * onChange={setFilters}
65
+ * items={[
66
+ * { value: 'remote', label: 'Remote' },
67
+ * { value: 'my-team', label: 'My team', selectOnly: true },
68
+ * ]}
69
+ * />
70
+ * ```
71
+ */
72
+ export declare const ContextMenu: <V extends ContextMenuValue = ContextMenuValue>(props: ContextMenuProps<V> & {
73
+ ref?: Ref<HTMLUListElement>;
74
+ }) => ReactElement;
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { ContextMenuIncludeExcludeType, ContextMenuIndicator, ContextMenuItem, ContextMenuItemState, ContextMenuValue } from './types';
3
+ export interface ContextMenuOptionProps<V extends ContextMenuValue> {
4
+ id: string;
5
+ item: ContextMenuItem<V>;
6
+ state: ContextMenuItemState;
7
+ role: 'option' | 'menuitem';
8
+ /** Resolved indicator; `null` in `includeExclude` mode. */
9
+ indicator: ContextMenuIndicator | null;
10
+ renderItem?: (item: ContextMenuItem<V>, state: ContextMenuItemState) => ReactNode;
11
+ /** Row click. Not called for include / exclude rows, whose controls choose. */
12
+ onActivate: () => void;
13
+ /** An include / exclude control was clicked. */
14
+ onIncludeExclude: (type: ContextMenuIncludeExcludeType) => void;
15
+ onHover: () => void;
16
+ }
17
+ /** One option row of a `ContextMenu`. Internal. */
18
+ export declare const ContextMenuOption: <V extends ContextMenuValue>({ id, item, state, role, indicator, renderItem, onActivate, onIncludeExclude, onHover, }: ContextMenuOptionProps<V>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './ContextMenu';
2
+ export type * from './types';
3
+ export { getContextMenuOptionId, getNextActiveValue, nextIncludeExcludeType, } from './utils';
@@ -0,0 +1,17 @@
1
+ import { Theme } from '@emotion/react';
2
+ /** Row height for options and group titles (Figma draws 32 and 34; 34 wins). */
3
+ export declare const ROW_HEIGHT = 34;
4
+ export declare const menu: (theme: Theme) => import("@emotion/react").SerializedStyles;
5
+ export declare const group: (theme: Theme) => import("@emotion/react").SerializedStyles;
6
+ export declare const groupList: import("@emotion/react").SerializedStyles;
7
+ export declare const groupLabel: (theme: Theme) => import("@emotion/react").SerializedStyles;
8
+ export declare const option: (theme: Theme) => import("@emotion/react").SerializedStyles;
9
+ export declare const empty: (theme: Theme) => import("@emotion/react").SerializedStyles;
10
+ export declare const label: import("@emotion/react").SerializedStyles;
11
+ export declare const description: (theme: Theme) => import("@emotion/react").SerializedStyles;
12
+ export declare const status: import("@emotion/react").SerializedStyles;
13
+ export declare const slot: import("@emotion/react").SerializedStyles;
14
+ export declare const checkbox: import("@emotion/react").SerializedStyles;
15
+ export declare const includeExcludeControls: import("@emotion/react").SerializedStyles;
16
+ export declare const includeExcludeControl: import("@emotion/react").SerializedStyles;
17
+ export declare const visuallyHidden: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,153 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ /** Value type a {@link ContextMenu} option can carry. */
3
+ export type ContextMenuValue = string | number;
4
+ /**
5
+ * One selectable row of a {@link ContextMenu}.
6
+ *
7
+ * The row is laid out as `[indicator] [status | avatar] [startContent] label
8
+ * [description] [endContent] [indicator]`; every part but the label is
9
+ * optional.
10
+ */
11
+ export interface ContextMenuItem<V extends ContextMenuValue = ContextMenuValue> {
12
+ /** Identifies the option in `value`, `onChange` and `onAction`. Unique per menu. */
13
+ value: V;
14
+ /** Row content. Strings and numbers ellipsise and get a hover tooltip. */
15
+ label: ReactNode;
16
+ /**
17
+ * Plain-text form of `label`, used for type-to-find and the tooltip when
18
+ * `label` is a node. Defaults to `label` when that is a string or number.
19
+ */
20
+ textValue?: string;
21
+ /** Secondary text at the right of the row, e.g. a date. */
22
+ description?: ReactNode;
23
+ /** Image URL (rendered as a 24px `Avatar`) or any node placed before the label. */
24
+ avatar?: string | ReactNode;
25
+ /** CSS color or gradient of a 12px status dot placed before the label. */
26
+ status?: string;
27
+ /** Extra content placed before the label, after the status dot / avatar. */
28
+ startContent?: ReactNode;
29
+ /** Extra content placed after the label and description. */
30
+ endContent?: ReactNode;
31
+ /** Skipped by keyboard navigation and ignores clicks. */
32
+ disabled?: boolean;
33
+ /**
34
+ * `includeExclude` mode only: the row is selected as a whole (one blue
35
+ * check-circle) instead of being included or excluded — e.g. a saved
36
+ * filter group.
37
+ */
38
+ selectOnly?: boolean;
39
+ /** Class name added to the option's `<li>`. */
40
+ className?: string;
41
+ /** Test id set on the option's `<li>`. */
42
+ 'data-testid'?: string;
43
+ }
44
+ /** A titled group of options. The title is not selectable. */
45
+ export interface ContextMenuGroup<V extends ContextMenuValue = ContextMenuValue> {
46
+ /** Unique per menu. */
47
+ id: string;
48
+ /** Group title. */
49
+ label: ReactNode;
50
+ items: ContextMenuItem<V>[];
51
+ }
52
+ /** A top-level entry of `items`: an option or a group of options. */
53
+ export type ContextMenuEntry<V extends ContextMenuValue = ContextMenuValue> = ContextMenuItem<V> | ContextMenuGroup<V>;
54
+ /**
55
+ * How a selected option is marked. Selected rows also get the selected
56
+ * background, except in `includeExclude` mode.
57
+ * - `check`: a check mark at the end of selected rows
58
+ * - `checkbox`: a checkbox at the start of every row
59
+ * - `checkCircle`: a blue check-circle at the end of every row, filled when selected
60
+ * - `none`: background only
61
+ */
62
+ export type ContextMenuIndicator = 'check' | 'checkbox' | 'checkCircle' | 'none';
63
+ /** State of a row in `includeExclude` mode. `selected` is used by `selectOnly` rows. */
64
+ export type ContextMenuIncludeExcludeType = 'include' | 'exclude' | 'selected';
65
+ /** One chosen row in `includeExclude` mode. */
66
+ export interface ContextMenuIncludeExcludeEntry<V extends ContextMenuValue = ContextMenuValue> {
67
+ value: V;
68
+ type: ContextMenuIncludeExcludeType;
69
+ }
70
+ /** State passed to `renderItem`. */
71
+ export interface ContextMenuItemState {
72
+ /** The option is selected (in `includeExclude` mode: included, excluded or selected). */
73
+ selected: boolean;
74
+ /** The option is highlighted by the pointer or the keyboard. */
75
+ active: boolean;
76
+ disabled: boolean;
77
+ /** `includeExclude` mode only. */
78
+ includeExcludeType?: ContextMenuIncludeExcludeType;
79
+ }
80
+ /** Selection props for an action menu: rows only fire `onAction`. */
81
+ export interface ContextMenuNoSelectionProps {
82
+ selectionMode?: 'none';
83
+ value?: never;
84
+ defaultValue?: never;
85
+ onChange?: never;
86
+ }
87
+ /** Selection props for picking one option. */
88
+ export interface ContextMenuSingleSelectionProps<V extends ContextMenuValue> {
89
+ selectionMode: 'single';
90
+ /** Controlled selected value. `null` for none. */
91
+ value?: V | null;
92
+ /** Initially selected value when uncontrolled. */
93
+ defaultValue?: V | null;
94
+ /** Fires with the newly selected value. Choosing the selected option again keeps it selected. */
95
+ onChange?: (value: V) => void;
96
+ }
97
+ /** Selection props for picking any number of options. */
98
+ export interface ContextMenuMultipleSelectionProps<V extends ContextMenuValue> {
99
+ selectionMode: 'multiple';
100
+ /** Controlled selected values. */
101
+ value?: V[];
102
+ /** Initially selected values when uncontrolled. */
103
+ defaultValue?: V[];
104
+ /** Fires with the new selection and the option that was toggled. */
105
+ onChange?: (value: V[], toggled: V) => void;
106
+ }
107
+ /**
108
+ * Selection props for include / exclude filters. Each row is included,
109
+ * excluded or neither (`selectOnly` rows: selected or not).
110
+ */
111
+ export interface ContextMenuIncludeExcludeSelectionProps<V extends ContextMenuValue> {
112
+ selectionMode: 'includeExclude';
113
+ /** Controlled chosen rows. */
114
+ value?: ContextMenuIncludeExcludeEntry<V>[];
115
+ /** Initially chosen rows when uncontrolled. */
116
+ defaultValue?: ContextMenuIncludeExcludeEntry<V>[];
117
+ /** Fires with the new list and the option that changed. */
118
+ onChange?: (value: ContextMenuIncludeExcludeEntry<V>[], changed: V) => void;
119
+ }
120
+ /** Selection behaviour of a {@link ContextMenu}, keyed by `selectionMode`. */
121
+ export type ContextMenuSelectionProps<V extends ContextMenuValue> = ContextMenuNoSelectionProps | ContextMenuSingleSelectionProps<V> | ContextMenuMultipleSelectionProps<V> | ContextMenuIncludeExcludeSelectionProps<V>;
122
+ /** Props shared by every `selectionMode` of a {@link ContextMenu}. */
123
+ export interface ContextMenuBaseProps<V extends ContextMenuValue> extends Omit<HTMLAttributes<HTMLUListElement>, 'onChange' | 'defaultValue' | 'children'> {
124
+ /** Options and groups, in display order. */
125
+ items: ContextMenuEntry<V>[];
126
+ /**
127
+ * How selected rows are marked. Defaults to `check` for `single`,
128
+ * `checkbox` for `multiple` and `none` otherwise. Ignored by
129
+ * `includeExclude`, which always shows include / exclude controls.
130
+ */
131
+ indicator?: ContextMenuIndicator;
132
+ /**
133
+ * Fires when an option is chosen by click, Enter or Space, in every mode —
134
+ * the hook for closing a popup.
135
+ */
136
+ onAction?: (value: V) => void;
137
+ /** Controlled highlighted option (pointer or keyboard). */
138
+ activeValue?: V | null;
139
+ /** Initially highlighted option when uncontrolled. */
140
+ defaultActiveValue?: V | null;
141
+ /** Fires when the highlighted option changes. */
142
+ onActiveValueChange?: (value: V | null) => void;
143
+ /** Replaces the row content between the start and end indicators. */
144
+ renderItem?: (item: ContextMenuItem<V>, state: ContextMenuItemState) => ReactNode;
145
+ /** Replaces the content of group titles. */
146
+ renderGroupLabel?: (group: ContextMenuGroup<V>) => ReactNode;
147
+ /** Shown when `items` has no options. @default 'No items' */
148
+ emptyState?: ReactNode;
149
+ /** Scrolls the list beyond this height (px or any CSS length). */
150
+ maxHeight?: number | string;
151
+ }
152
+ /** Props of {@link ContextMenu}. */
153
+ export type ContextMenuProps<V extends ContextMenuValue = ContextMenuValue> = ContextMenuBaseProps<V> & ContextMenuSelectionProps<V>;
@@ -0,0 +1,79 @@
1
+ import { ContextMenuEntry, ContextMenuGroup, ContextMenuIncludeExcludeType, ContextMenuItem, ContextMenuValue } from './types';
2
+ /**
3
+ * Long enough that the label tooltip does not fire while the pointer is
4
+ * travelling down the list, short enough to feel like a deliberate hover
5
+ * (#669).
6
+ */
7
+ export declare const LABEL_TOOLTIP_DELAY = 1000;
8
+ /** Keeps a long label from producing a tooltip as wide as the list itself. */
9
+ export declare const LABEL_TOOLTIP_MAX_WIDTH = 320;
10
+ /**
11
+ * Only a primitive is safe to repeat inside a tooltip. Rendering the same
12
+ * element twice mounts two independent copies of it, so labels made of
13
+ * components get no tooltip.
14
+ */
15
+ export declare const asText: (value: unknown) => string | number | undefined;
16
+ export declare const isGroup: <V extends ContextMenuValue>(entry: ContextMenuEntry<V>) => entry is ContextMenuGroup<V>;
17
+ /** Every option in display order, groups unwrapped. */
18
+ export declare const flattenItems: <V extends ContextMenuValue>(entries: ContextMenuEntry<V>[]) => ContextMenuItem<V>[];
19
+ /** Text used for type-to-find and the label tooltip. */
20
+ export declare const getTextValue: <V extends ContextMenuValue>(item: ContextMenuItem<V>) => string | undefined;
21
+ /**
22
+ * Where Enter moves an `includeExclude` row: none → include → exclude → none,
23
+ * or none ⇄ selected for `selectOnly` rows. For driving that cycle from an
24
+ * input that keeps focus while it highlights rows.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * nextIncludeExcludeType(undefined, false); // 'include'
29
+ * nextIncludeExcludeType('include', false); // 'exclude'
30
+ * nextIncludeExcludeType('exclude', false); // undefined
31
+ * nextIncludeExcludeType(undefined, true); // 'selected'
32
+ * ```
33
+ */
34
+ export declare const nextIncludeExcludeType: (current: ContextMenuIncludeExcludeType | undefined, selectOnly: boolean) => ContextMenuIncludeExcludeType | undefined;
35
+ /**
36
+ * The enabled option `step` places away from `from`, wrapping around the
37
+ * ends. With no `from`, ArrowDown lands on the first option and ArrowUp on
38
+ * the last.
39
+ */
40
+ export declare const getSteppedIndex: (enabled: boolean[], from: number, step: 1 | -1) => number;
41
+ /**
42
+ * Makes any string safe inside an id and an IDREF list: characters other than
43
+ * letters, digits and `-` become `_<hex>_`, so distinct inputs stay distinct.
44
+ */
45
+ export declare const escapeId: (value: string) => string;
46
+ /**
47
+ * DOM id of an option, for `aria-activedescendant` on an element outside the
48
+ * list (e.g. a combobox input). `menuId` is the `id` given to the ContextMenu.
49
+ * Characters not allowed in an id are escaped, so any value is safe.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * <input
54
+ * aria-controls="people-menu"
55
+ * aria-activedescendant={
56
+ * active == null ? undefined : getContextMenuOptionId('people-menu', active)
57
+ * }
58
+ * />
59
+ * <ContextMenu id="people-menu" items={items} activeValue={active} />
60
+ * ```
61
+ */
62
+ export declare const getContextMenuOptionId: (menuId: string, value: ContextMenuValue) => string;
63
+ /**
64
+ * Where a navigation key moves the highlight: ArrowDown / ArrowUp step over
65
+ * disabled options and wrap, Home / End jump to the ends. Returns `undefined`
66
+ * for any other key, so a host driving the list from its own input can tell
67
+ * whether the key was a navigation key.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
72
+ * const next = getNextActiveValue(items, active, event.key);
73
+ * if (next === undefined) return; // not a navigation key
74
+ * event.preventDefault();
75
+ * setActive(next);
76
+ * };
77
+ * ```
78
+ */
79
+ export declare const getNextActiveValue: <V extends ContextMenuValue>(entries: ContextMenuEntry<V>[], activeValue: V | null | undefined, key: string) => V | null | undefined;
@@ -232,4 +232,11 @@ export interface DropdownContextType {
232
232
  * Computed by Dropdown based on dropdownPosition prop and available viewport space
233
233
  */
234
234
  placement?: 'top' | 'bottom';
235
+ /**
236
+ * Option highlighted by the keyboard or the pointer. Focus stays on the
237
+ * toggle, so the list is driven from there.
238
+ */
239
+ activeValue?: string | number | null;
240
+ /** Moves the highlight; called by the list on pointer moves. */
241
+ setActiveValue?: (value: string | number | null) => void;
235
242
  }
@@ -2,8 +2,9 @@ import { DropdownItemsListProps } from './types';
2
2
  /**
3
3
  * DropdownOptions - Options menu container for Dropdown component
4
4
  *
5
- * Renders the scrollable list of options that appears when the dropdown is open.
6
- * Provides proper ARIA attributes for accessibility and keyboard navigation.
5
+ * Renders the `DropdownOption` children as a `ContextMenu` placed under (or
6
+ * above) the Dropdown toggle. Focus stays on the toggle; the highlighted
7
+ * option is driven from there and announced through `aria-activedescendant`.
7
8
  *
8
9
  * Placement (opening upward or downward) is driven entirely by the parent
9
10
  * Dropdown via context — this component does not calculate position itself.
@@ -31,9 +32,8 @@ import { DropdownItemsListProps } from './types';
31
32
  * @see {@link DropdownOption} - Individual option components
32
33
  *
33
34
  * @accessibility
34
- * - Uses role="listbox" for proper ARIA semantics
35
- * - Supports keyboard navigation (Arrow keys, Enter, Escape)
36
- * - Screen reader friendly
35
+ * - Uses role="listbox" with role="option" rows
36
+ * - Arrow keys, Home, End, Enter, Space and Escape on the toggle
37
37
  */
38
38
  declare const DropdownOptions: ({ "aria-labelledby": ariaLabelledbyNative, ariaLabelledby, id, children, }: DropdownItemsListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
39
39
  export default DropdownOptions;
@@ -0,0 +1,33 @@
1
+ import { KeyboardEvent } from 'react';
2
+ import { ContextMenuItem } from '../ContextMenu';
3
+ import { OptionValue } from './utils';
4
+ /** Options of {@link useToggleListKeys}. */
5
+ export interface UseToggleListKeysOptions {
6
+ /** Id of the ContextMenu the toggle controls. */
7
+ listId: string;
8
+ isOpen: boolean;
9
+ disabled?: boolean;
10
+ menuItems: ContextMenuItem<OptionValue>[];
11
+ /** Highlighted option. */
12
+ activeValue: OptionValue | null;
13
+ setActiveValue: (value: OptionValue | null) => void;
14
+ /** Opens the list; `key` is the arrow that opened it. */
15
+ open: (key: string) => void;
16
+ close: () => void;
17
+ /** Enter or Space on the highlighted option. */
18
+ onPick: (value: OptionValue) => void;
19
+ /** Consumer handlers, run first; `preventDefault()` skips the built-in keys. */
20
+ onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
21
+ onKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;
22
+ }
23
+ /**
24
+ * Keyboard for a dropdown toggle that keeps focus while it drives its list:
25
+ * arrows open it, then Arrow/Home/End move the highlight, Enter/Space pick,
26
+ * Escape/Tab close. Returns the toggle's handlers and its
27
+ * `aria-activedescendant`.
28
+ */
29
+ export declare const useToggleListKeys: ({ listId, isOpen, disabled, menuItems, activeValue, setActiveValue, open, close, onPick, onKeyDown, onKeyUp, }: UseToggleListKeysOptions) => {
30
+ onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
31
+ onKeyUp: (event: KeyboardEvent<HTMLButtonElement>) => void;
32
+ 'aria-activedescendant': string | undefined;
33
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ContextMenuItem } from '../ContextMenu';
3
+ /** Value of a Dropdown option as the list sees it. */
4
+ export type OptionValue = string | number;
5
+ /**
6
+ * Reads `DropdownOption` children into ContextMenu items. The label resolves
7
+ * as `children` → `label` → `value`, as it always has.
8
+ */
9
+ export declare const toDropdownMenuItems: (children: React.ReactNode) => ContextMenuItem<OptionValue>[];
@@ -1,7 +1,16 @@
1
+ import { MutableRefObject } from 'react';
1
2
  import { UseFiltersMultiSelectStore } from './useFiltersMultiSelect';
3
+ import type { FilterMenuItem } from './utils';
2
4
  export interface FiltersMultiSelectContextValue {
3
5
  store: UseFiltersMultiSelectStore;
4
6
  emptyNode?: React.ReactNode;
7
+ /** Id of the options list, referenced by the search input. */
8
+ listId?: string;
9
+ /** Highlighted option, driven from the search input and the pointer. */
10
+ activeValue?: string | null;
11
+ setActiveValue?: (value: string | null) => void;
12
+ /** The rendered options, kept here for the search input's keyboard. */
13
+ itemsRef?: MutableRefObject<FilterMenuItem[]>;
5
14
  }
6
15
  export declare const FiltersMultiSelectProvider: ({ children, value, }: {
7
16
  value: FiltersMultiSelectContextValue;
@@ -1,7 +1,37 @@
1
1
  import { Filter } from '../useFiltersMultiSelect';
2
2
  export interface FiltersMultiSelectOptionProps {
3
+ /** The filter this row adds. `group: true` makes it a select-only row. */
3
4
  filter: Filter;
5
+ /** Row content. */
4
6
  children: React.ReactNode;
7
+ /**
8
+ * @deprecated Ignored — the row's state comes from the store's selected
9
+ * filters. Removed in the next major release.
10
+ */
5
11
  selected?: boolean;
6
12
  }
7
- export declare const FiltersMultiSelectOption: ({ filter, children, selected, }: FiltersMultiSelectOptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
+ /**
14
+ * FiltersMultiSelectOption - One filter row of a `FiltersMultiSelect`.
15
+ *
16
+ * Declarative: `FiltersMultiSelectOptions` reads its props and renders the
17
+ * row, so it renders nothing on its own. Regular filters get + (include) and
18
+ * − (exclude) controls; `group` filters get a single check-circle.
19
+ *
20
+ * @category Form Controls
21
+ * @subcategory Selection
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <FiltersMultiSelectOptions>
26
+ * <FiltersMultiSelectOption filter={{ id: '1', label: 'Active' }}>
27
+ * Active
28
+ * </FiltersMultiSelectOption>
29
+ * <FiltersMultiSelectOption filter={{ id: 'g', label: 'Saved', group: true }}>
30
+ * Saved
31
+ * </FiltersMultiSelectOption>
32
+ * </FiltersMultiSelectOptions>
33
+ * ```
34
+ *
35
+ * @see {@link FiltersMultiSelectOptions} - The list that renders it
36
+ */
37
+ export declare const FiltersMultiSelectOption: (_props: FiltersMultiSelectOptionProps) => null;