@epam/ai-dial-ui-kit 0.16.0-dev.12 → 0.16.0-dev.13

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/dist/grid.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateCellRenderer-xHilQEYj.cjs");exports.DEFAULT_DATE_FORMAT_OPTIONS=e.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=e.DEFAULT_LOCALE;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=e.DEFAULT_DATE_FORMAT_OPTIONS$1;exports.DEFAULT_GRID_DATE_LOCALE=e.DEFAULT_LOCALE$1;exports.DateCellRenderer=e.DateCellRenderer;exports.DialDateCellRenderer=e.DialDateCellRenderer;exports.DialGrid=e.DialGrid;exports.GRID_ALIGN_RIGHT_CLASS=e.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=e.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=e.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=e.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=e.GRID_THEME_PARAMS;exports.Grid=e.Grid;exports.GridColorScheme=e.GridColorScheme;exports.GridSelectionMode=e.GridSelectionMode;exports.baseColumnComparator=e.baseColumnComparator;exports.checkColDefsChanges=e.checkColDefsChanges;exports.convertGridDateToDate=e.convertToDate;exports.convertToDate=e.convertToDate;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateCellRenderer-CkDF66wX.cjs");exports.DEFAULT_DATE_FORMAT_OPTIONS=e.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=e.DEFAULT_LOCALE;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=e.DEFAULT_DATE_FORMAT_OPTIONS$1;exports.DEFAULT_GRID_DATE_LOCALE=e.DEFAULT_LOCALE$1;exports.DateCellRenderer=e.DateCellRenderer;exports.DialDateCellRenderer=e.DialDateCellRenderer;exports.DialGrid=e.DialGrid;exports.GRID_ALIGN_RIGHT_CLASS=e.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=e.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=e.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=e.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=e.GRID_THEME_PARAMS;exports.Grid=e.Grid;exports.GridColorScheme=e.GridColorScheme;exports.GridSelectionMode=e.GridSelectionMode;exports.baseColumnComparator=e.baseColumnComparator;exports.checkColDefsChanges=e.checkColDefsChanges;exports.convertGridDateToDate=e.convertToDate;exports.convertToDate=e.convertToDate;
@@ -2,6 +2,7 @@ import { Placement } from '@floating-ui/react';
2
2
  import { CSSProperties, FC, MouseEvent, ReactNode, RefObject } from 'react';
3
3
  import { DropdownTrigger } from '../../../types/dropdown';
4
4
  import { DropdownItem } from '../../../models/dropdown';
5
+ import { DropdownItemFilter } from './search';
5
6
  export interface DropdownProps {
6
7
  children: ReactNode;
7
8
  items?: DropdownItem[];
@@ -46,6 +47,34 @@ export interface DropdownProps {
46
47
  * opens, matching the pre-existing behavior.
47
48
  */
48
49
  initialFocus?: 0 | -1 | RefObject<HTMLElement | null>;
50
+ /**
51
+ * Puts a search field above `items` that narrows them as the user types and
52
+ * highlights the match in each remaining label. The query is cleared when
53
+ * the menu closes.
54
+ */
55
+ searchable?: boolean;
56
+ /** Controlled query of the search field; when omitted, the dropdown keeps its own. */
57
+ searchValue?: string;
58
+ /** Fired with every edit of the search field, and with `''` when the menu closes. */
59
+ onSearchChange?: (value: string) => void;
60
+ /** Placeholder and accessible name of the search field. */
61
+ searchPlaceholder?: string;
62
+ /** Accessible name of the search field's clear button. */
63
+ searchClearLabel?: string;
64
+ /** Text shown, and announced, when the query leaves no items. */
65
+ noResultsLabel?: string;
66
+ /**
67
+ * Decides whether an item matches the query, which arrives trimmed and
68
+ * lower-cased. Defaults to a substring match on a string `label`. A submenu
69
+ * whose own row matches keeps all its children; otherwise it keeps only the
70
+ * matching ones, and disappears when none do.
71
+ */
72
+ filterItem?: DropdownItemFilter;
73
+ /**
74
+ * Number of rows the item list shows before it scrolls. The cap applies to
75
+ * the list alone, so a search field or header stays in view above it.
76
+ */
77
+ maxVisibleItems?: number;
49
78
  }
50
79
  /**
51
80
  *
@@ -83,6 +112,11 @@ export interface DropdownProps {
83
112
  * <Dropdown closable renderOverlay={() => <div className="p-3">Custom content</div>}>
84
113
  * <button type="button" className="px-3 py-2 rounded border">Custom</button>
85
114
  * </Dropdown>
115
+ *
116
+ * // Searchable menu, seven rows tall before it scrolls
117
+ * <Dropdown searchable maxVisibleItems={7} items={items}>
118
+ * <button type="button" className="px-3 py-2 rounded border">Create</button>
119
+ * </Dropdown>
86
120
  * ```
87
121
  *
88
122
  * @param children - Trigger element(s) to anchor and open the menu
@@ -111,5 +145,13 @@ export interface DropdownProps {
111
145
  * @param [matchReferenceWidth=true] - Whether to match the reference element's width
112
146
  * @param [maxDropdownHeight] - Maximum height of the dropdown menu; when omitted, no limit is applied
113
147
  * @param [initialFocus] - Initial focus target inside the overlay on open, forwarded to `FloatingFocusManager`; when omitted, matches pre-existing behavior
148
+ * @param [searchable=false] - Show a search field above `items` that filters them and highlights the match
149
+ * @param [searchValue] - Controlled query of the search field
150
+ * @param [onSearchChange] - Fired with every edit of the search field, and with `''` when the menu closes
151
+ * @param [searchPlaceholder="Search"] - Placeholder and accessible name of the search field
152
+ * @param [searchClearLabel="Clear search"] - Accessible name of the search field's clear button
153
+ * @param [noResultsLabel="No results found"] - Text shown and announced when the query leaves no items
154
+ * @param [filterItem] - Item matcher; defaults to a case-insensitive substring match on a string `label`
155
+ * @param [maxVisibleItems] - Rows the item list shows before it scrolls
114
156
  */
115
157
  export declare const Dropdown: FC<DropdownProps>;
@@ -11,5 +11,11 @@ export declare const dropdownItemListClassName: string;
11
11
  */
12
12
  export declare const dropdownItemBaseClassName: string;
13
13
  export declare const dropdownDividerClassName = "my-1 border-t border-tertiary";
14
+ /** The search row of a `searchable` dropdown: pinned above the item list, which scrolls on its own. */
15
+ export declare const dropdownSearchClassName = "shrink-0 px-1 pt-1";
16
+ /** The no-results line of a `searchable` dropdown, styled as a `PlainText` row. */
17
+ export declare const dropdownNoResultsClassName = "px-3 py-2 text-secondary dial-caption-text";
18
+ /** Height of the item list that shows exactly `rows` rows before it scrolls. */
19
+ export declare const getDropdownListHeight: (rows: number) => number;
14
20
  export declare const dropdownGap = 4;
15
21
  export declare const submenuCaretIcon: import('react/jsx-runtime').JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { DropdownItem } from '../../../models/dropdown';
2
+ /** Decides whether an item matches a non-empty, trimmed, lower-cased query. */
3
+ export type DropdownItemFilter = (item: DropdownItem, query: string) => boolean;
4
+ /** Case-insensitive substring match on a string `label`; an item with a non-string label never matches. */
5
+ export declare const matchDropdownItemLabel: DropdownItemFilter;
6
+ /** Returns `items` narrowed to the rows matching `query`; an empty query returns `items` unchanged. */
7
+ export declare const filterDropdownItems: (items: DropdownItem[], query: string, isMatch?: DropdownItemFilter) => DropdownItem[];
8
+ /** Returns `items` with every string row label, submenus included, rendered through a single-line `Highlight` of `query`. */
9
+ export declare const highlightDropdownItems: (items: DropdownItem[], query: string) => DropdownItem[];
@@ -74,6 +74,8 @@ export declare const DIAL_KIT_CLASS: {
74
74
  * on a submenu's own list. It is *not* the floating panel.
75
75
  */
76
76
  readonly dropdownList: "dial-kit-dropdown-list";
77
+ /** The search row above the item list of a `searchable` `Dropdown`. */
78
+ readonly dropdownSearch: "dial-kit-dropdown-search";
77
79
  /**
78
80
  * One row of a floating overlay: a dropdown item, a `Select` option, a
79
81
  * submenu trigger, or a submenu child. It sits on the element that draws the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-ui-kit",
3
- "version": "0.16.0-dev.12",
3
+ "version": "0.16.0-dev.13",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A modern UI kit for building AI DIAL interfaces with React",