@ssa-ui-kit/core 3.26.3 → 3.26.4
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/ai/source-map.md +65 -48
- package/dist/components/DropdownOptionGroup/DropdownOptionGroup.d.ts +40 -0
- package/dist/components/DropdownOptionGroup/index.d.ts +2 -0
- package/dist/components/DropdownOptions/useToggleListKeys.d.ts +2 -2
- package/dist/components/DropdownOptions/utils.d.ts +11 -4
- package/dist/components/Typeahead/Typeahead.context.d.ts +1 -1
- package/dist/components/Typeahead/Typeahead.d.ts +1 -1
- package/dist/components/Typeahead/components/TypeaheadOptionGroup.d.ts +43 -0
- package/dist/components/Typeahead/components/index.d.ts +1 -0
- package/dist/components/Typeahead/index.d.ts +1 -0
- package/dist/components/Typeahead/types.d.ts +9 -1
- package/dist/components/Typeahead/useTypeahead.d.ts +3 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +170 -34
- package/dist/index.mjs +169 -35
- package/dist/tsbuildcache +1 -1
- package/package.json +3 -3
package/dist/ai/source-map.md
CHANGED
|
@@ -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
|
-
|
|
7
|
+
196 components · 20 contexts · 23 hooks · 21 functions · 16 constants · 348 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, 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
|
|
19
|
+
**Action & Form Controls** — BreadcrumbMenu, Breadcrumbs, Button, ButtonGroup, ButtonGroupButton, Checkbox, ColorPicker, ContextMenu, DatePicker, DateRangePicker, DateRangePickerFormBridge, Dropdown, DropdownArrow, DropdownBase, DropdownOption, DropdownOptionGroup, 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, TypeaheadOptionGroup, TypeaheadOptions
|
|
20
20
|
|
|
21
21
|
**Form Structure** — Filters, FiltersMultiSelect, FiltersMultiSelectEmpty, FiltersMultiSelectOption, FiltersMultiSelectOptions, Form, FormAction, FormCheckbox, FormGroup, FormHelperText, FormRadioGroup
|
|
22
22
|
|
|
@@ -285,6 +285,13 @@ A single selectable row inside `Dropdown` or `MultipleDropdown`.
|
|
|
285
285
|
- `avatar?: React.ReactNode` — Avatar or icon to display before the option content (e.g. <Avatar size={20} image={url} />)
|
|
286
286
|
- _plus native element attributes_
|
|
287
287
|
|
|
288
|
+
#### DropdownOptionGroup
|
|
289
|
+
A titled section of options inside `Dropdown` or `MultipleDropdown`.
|
|
290
|
+
|
|
291
|
+
- `label: ReactNode` — Group title. Not selectable and skipped by keyboard navigation.
|
|
292
|
+
- `id?: string` — Unique per dropdown. Defaults to one derived from the element key (or position).
|
|
293
|
+
- `children?: ReactNode` — The group's `DropdownOption`s.
|
|
294
|
+
|
|
288
295
|
#### DropdownOptions
|
|
289
296
|
Options menu container for Dropdown component
|
|
290
297
|
|
|
@@ -747,6 +754,7 @@ Advanced autocomplete search component with dropdown functionality
|
|
|
747
754
|
- `placeholder?: string | null` `= 'Select something'` — Placeholder text for the input
|
|
748
755
|
- `filterOptions?: boolean` `= true` — Whether to filter options based on input When false, all options are always shown
|
|
749
756
|
- `autoSelect?: boolean` `= true` — Whether to automatically select the first option on filter
|
|
757
|
+
- `searchByGroup?: boolean` `= false` — Also match the input against `TypeaheadOptionGroup` titles. A group whose title matches is shown with all of…
|
|
750
758
|
- `allowCustomValues?: boolean` `= true` — Allow adding custom values not in the options list. When true, the current input is shown as the first…
|
|
751
759
|
- `onChange?: (selectedItem: TypeaheadValue, isSelected: boolean) => void` — Callback fired when an option is selected/deselected Receives the selected item value and whether it's…
|
|
752
760
|
- `onClearAll?: () => void` — Callback fired when "Clear All" is clicked (multiple mode)
|
|
@@ -781,6 +789,14 @@ Props for TypeaheadOption component Record type that allows any string or number
|
|
|
781
789
|
- `role?: string` — ARIA role for the option (e.g. 'option')
|
|
782
790
|
- `aria-selected?: boolean` — ARIA selected state
|
|
783
791
|
|
|
792
|
+
#### TypeaheadOptionGroup
|
|
793
|
+
A titled section of options inside `Typeahead`.
|
|
794
|
+
|
|
795
|
+
- `label: ReactNode` — Group title. Not selectable and skipped by keyboard navigation.
|
|
796
|
+
- `textValue?: string` — Plain-text form of `label`, matched against the input when the Typeahead has `searchByGroup`. Defaults to…
|
|
797
|
+
- `id?: string` — Unique per Typeahead. Defaults to the group's position among the Typeahead's children.
|
|
798
|
+
- `children?: ReactNode` — The group's `TypeaheadOption`s.
|
|
799
|
+
|
|
784
800
|
#### TypeaheadOptions
|
|
785
801
|
The Typeahead's option list: a `ContextMenu` driven from the Typeahead's input. The options themselves come from the `TypeaheadOption` children of `Typeahead`, filtered…
|
|
786
802
|
|
|
@@ -2454,52 +2470,53 @@ _Names only — read the `.d.ts` for their shape._
|
|
|
2454
2470
|
`DatePickerContextProps` · `DatePickerFormat` · `DatePickerProps` · `DateRangePickerContextProps`
|
|
2455
2471
|
`DateRangePickerFormBridgeProps` · `DateRangePickerFormBridgeValue` · `DateRangePickerOnChangeDates`
|
|
2456
2472
|
`DateRangePickerProps` · `DateRangePresetValue` · `DateRangePreset` · `DateTimeTuple`
|
|
2457
|
-
`DeprecatedOpenStateProps` · `DropdownContextType` · `
|
|
2458
|
-
`
|
|
2459
|
-
`
|
|
2460
|
-
`
|
|
2461
|
-
`
|
|
2462
|
-
`
|
|
2463
|
-
`
|
|
2464
|
-
`
|
|
2465
|
-
`
|
|
2466
|
-
`
|
|
2467
|
-
`
|
|
2468
|
-
`
|
|
2469
|
-
`
|
|
2470
|
-
`
|
|
2471
|
-
`
|
|
2472
|
-
`
|
|
2473
|
-
`
|
|
2474
|
-
`
|
|
2475
|
-
`
|
|
2476
|
-
`
|
|
2477
|
-
`
|
|
2478
|
-
`
|
|
2479
|
-
`
|
|
2480
|
-
`
|
|
2481
|
-
`
|
|
2482
|
-
`
|
|
2483
|
-
`
|
|
2484
|
-
`
|
|
2485
|
-
`
|
|
2486
|
-
`
|
|
2487
|
-
`
|
|
2488
|
-
`
|
|
2489
|
-
`
|
|
2490
|
-
`
|
|
2491
|
-
`
|
|
2492
|
-
`
|
|
2493
|
-
`
|
|
2494
|
-
`
|
|
2495
|
-
`
|
|
2496
|
-
`
|
|
2497
|
-
`
|
|
2498
|
-
`
|
|
2499
|
-
`
|
|
2500
|
-
`
|
|
2501
|
-
`
|
|
2502
|
-
`
|
|
2473
|
+
`DeprecatedOpenStateProps` · `DropdownContextType` · `DropdownOptionGroupProps`
|
|
2474
|
+
`DropdownOptionProps` · `DropdownPositions` · `DropdownProps` · `DropdownToggleProps`
|
|
2475
|
+
`DynamicAlertParams` · `DynamicNotificationParams` · `DynamicToastParams` · `FieldContextValue`
|
|
2476
|
+
`FieldControlProps` · `FieldDescriptionProps` · `FieldErrorProps` · `FieldLabelProps` · `FieldProps`
|
|
2477
|
+
`FieldSuccessProps` · `FileAttachmentFile` · `FileAttachmentProps` · `FileRejectionReason`
|
|
2478
|
+
`FileUploadProgressEntry` · `FileUploadProgress` · `FileUploadProps` · `Filter`
|
|
2479
|
+
`FiltersMultiSelectEmptyProps` · `FiltersMultiSelectOptionProps` · `FiltersMultiSelectProps`
|
|
2480
|
+
`FloatingActionButtonAction` · `FloatingActionButtonColor` · `FloatingActionButtonIcon`
|
|
2481
|
+
`FloatingActionButtonPosition` · `FloatingActionButtonProps` · `FloatingActionButtonSize`
|
|
2482
|
+
`FloatingSurfaceColor` · `FloatingSurfaceSize` · `FooterColumn` · `FooterLink` · `FooterProps`
|
|
2483
|
+
`FooterSize` · `FooterTheme` · `Format` · `FrozenColumns` · `FullscreenModeContextType`
|
|
2484
|
+
`FunnelChartItem` · `FunnelChartProps` · `FunnelChartRender` · `FunnelChartType` · `GaugeBarProps`
|
|
2485
|
+
`GaugeBarThreshold` · `GaugeBarValueFormatter` · `GaugeChartFeature` · `GaugeChartProps`
|
|
2486
|
+
`HeaderNavItem` · `HeaderProps` · `HeaderSize` · `HeaderTheme` · `HistoryItemType` · `HistoryProps`
|
|
2487
|
+
`IFormCheckboxProps` · `IconButtonProps` · `IconProps` · `ImageItemProps` · `IndicatorProps`
|
|
2488
|
+
`InputColors` · `InputProps` · `InputStatusColors` · `InteractionsEnabled` · `Item` · `LabelBadge`
|
|
2489
|
+
`LabelProps` · `LargeTabProps` · `LastFocusedElement` · `LinkProps` · `LinksTabBarProps`
|
|
2490
|
+
`MainColors` · `MainSizes` · `MapIconsType` · `ModalContextProps` · `ModalDialogProps`
|
|
2491
|
+
`ModalProps` · `ModalRootProps` · `MountMode` · `MultipleStylesProps` · `NavBarExtendedGroup`
|
|
2492
|
+
`NavBarExtendedItem` · `NavBarExtendedProps` · `NavBarExtendedSubItem` · `NavBarProps`
|
|
2493
|
+
`NestedTableCellHeaderProps` · `NestedTableContextType` · `NestedTableContextValue`
|
|
2494
|
+
`NestedTableProps` · `NestedTableRowContextType` · `NotificationCardProps`
|
|
2495
|
+
`NotificationDynamicProps` · `NotificationGlobalSharedProps` · `NotificationMenuProps`
|
|
2496
|
+
`NotificationPositions` · `NotificationProps` · `NotificationSharedProps` · `NotificationSizes`
|
|
2497
|
+
`NotificationStyleOverrides` · `NotificationType` · `NotificationVariants` · `NumberFieldProps`
|
|
2498
|
+
`OpenStateProps` · `OpenedAccordion` · `PageButtonProps` · `PaginationButtonsProps`
|
|
2499
|
+
`PaginationContextProps` · `PaginationContextProviderProps` · `PaginationProps` · `PaletteColor`
|
|
2500
|
+
`Palette` · `PeriodOption` · `Period` · `PersonInfoAvatarProps` · `PersonInfoCounterProps`
|
|
2501
|
+
`PersonInfoCounterTooltipUser` · `PersonInfoCounterTooltip` · `PersonInfoLinkAttributes`
|
|
2502
|
+
`PersonInfoProps` · `PersonInfoStyles` · `PersonInfoValueProps` · `PickerType` · `PieChartFeatures`
|
|
2503
|
+
`PieChartLegendItem` · `PieChartLegendProps` · `PieChartProps` · `PieChartTooltipProps`
|
|
2504
|
+
`PieChartTooltipViewProps` · `PopoverArrowProps` · `PopoverContentProps` · `PopoverOptions`
|
|
2505
|
+
`PopoverTriggerProps` · `ProgressBarProps` · `ProgressChartTooltipProps` · `ProgressCircleProps`
|
|
2506
|
+
`ProgressInfoItemProps` · `ProgressInfoProps` · `ProgressInfoResp` · `ProgressInfoTotalsProps`
|
|
2507
|
+
`ProgressProps` · `RGBString` · `RadioGroupProps` · `RadioProps` · `RangePickerType`
|
|
2508
|
+
`RenderContentProps` · `ResizeHandleProps` · `ResolveDeprecatedPropOptions` · `ResolvedOpenState`
|
|
2509
|
+
`ResponsiveImageProps` · `SVGProps` · `SearchBoxProps` · `SelectedFilter` · `SetIDs`
|
|
2510
|
+
`SimpleChartTooltipProps` · `SizeStyles` · `SliderMark` · `SliderProps` · `SliderSize`
|
|
2511
|
+
`SmallTabProps` · `StepperContextType` · `StepperProps` · `SwitchContext` · `SwitchProps`
|
|
2512
|
+
`TabBarContextProps` · `TabBarLink` · `TabBarProps` · `TabBaseProps` · `TabProps`
|
|
2513
|
+
`TableContainerProps` · `TableProps` · `TagsProps` · `TextFieldProps` · `TextareaProps` · `Theme`
|
|
2514
|
+
`ToastProps` · `ToastVariants` · `TooltipArrowProps` · `TooltipColor` · `TooltipContentProps`
|
|
2515
|
+
`TooltipContentSizes` · `TooltipContextType` · `TooltipProps` · `TooltipSize`
|
|
2516
|
+
`TooltipTriggerProps` · `TranslationContextContent` · `TreeItemBase` · `TreeItemLevel2`
|
|
2517
|
+
`TreeItemLevel3` · `TreeItemRenderProps` · `TreeItem` · `TreeLevel` · `TreeMapChartFeature`
|
|
2518
|
+
`TreeMapChartProps` · `TreeNode` · `TreeViewProps` · `TypeaheadItemProps`
|
|
2519
|
+
`TypeaheadItemsListProps` · `TypeaheadOptionGroupProps` · `TypeaheadOptionProps` · `TypeaheadProps`
|
|
2503
2520
|
`TypeaheadValue` · `TypographyProps` · `UseBreadcrumbsOptions` · `UseChartInfo`
|
|
2504
2521
|
`UseColumnResizeOptions` · `UseDrawerOptions` · `UseFiltersMultiSelectOptions`
|
|
2505
2522
|
`UseFiltersMultiSelectStore` · `UsePopover` · `UseTooltipArgs` · `UseTooltipContext` · `UseTooltip`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link DropdownOptionGroup}. */
|
|
3
|
+
export interface DropdownOptionGroupProps {
|
|
4
|
+
/** Group title. Not selectable and skipped by keyboard navigation. */
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Unique per dropdown. Defaults to one derived from the element key
|
|
8
|
+
* (or position).
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/** The group's `DropdownOption`s. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* DropdownOptionGroup - A titled section of options inside `Dropdown` or
|
|
16
|
+
* `MultipleDropdown`.
|
|
17
|
+
*
|
|
18
|
+
* Wrap `DropdownOption` children in it to show them under a title; groups are
|
|
19
|
+
* separated by a divider. Options outside any group can sit next to groups.
|
|
20
|
+
* Like `DropdownOption`, it is read by the parent dropdown rather than rendered
|
|
21
|
+
* as written, so it only works as a direct child of the dropdown.
|
|
22
|
+
*
|
|
23
|
+
* @category Form Controls
|
|
24
|
+
* @subcategory Selection
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Dropdown selectedItem={selected} onChange={setSelected}>
|
|
29
|
+
* <DropdownOptionGroup label="Fruits">
|
|
30
|
+
* <DropdownOption value="apple">Apple</DropdownOption>
|
|
31
|
+
* <DropdownOption value="banana">Banana</DropdownOption>
|
|
32
|
+
* </DropdownOptionGroup>
|
|
33
|
+
* <DropdownOptionGroup label="Vegetables">
|
|
34
|
+
* <DropdownOption value="carrot">Carrot</DropdownOption>
|
|
35
|
+
* </DropdownOptionGroup>
|
|
36
|
+
* </Dropdown>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const DropdownOptionGroup: ({ children }: DropdownOptionGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
40
|
+
export default DropdownOptionGroup;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KeyboardEvent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ContextMenuEntry } from '../ContextMenu';
|
|
3
3
|
import { OptionValue } from './utils';
|
|
4
4
|
/** Options of {@link useToggleListKeys}. */
|
|
5
5
|
export interface UseToggleListKeysOptions {
|
|
@@ -7,7 +7,7 @@ export interface UseToggleListKeysOptions {
|
|
|
7
7
|
listId: string;
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
menuItems:
|
|
10
|
+
menuItems: ContextMenuEntry<OptionValue>[];
|
|
11
11
|
/** Highlighted option. */
|
|
12
12
|
activeValue: OptionValue | null;
|
|
13
13
|
setActiveValue: (value: OptionValue | null) => void;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ContextMenuEntry } from '../ContextMenu';
|
|
3
|
+
import { DropdownItemProps } from '../DropdownOption/DropdownOption';
|
|
3
4
|
/** Value of a Dropdown option as the list sees it. */
|
|
4
5
|
export type OptionValue = string | number;
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The `DropdownOption` children in display order, with any
|
|
8
|
+
* `DropdownOptionGroup` unwrapped.
|
|
8
9
|
*/
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const flattenDropdownOptions: (children: React.ReactNode) => React.ReactElement<DropdownItemProps>[];
|
|
11
|
+
/**
|
|
12
|
+
* Reads `DropdownOption` children into ContextMenu items, and each
|
|
13
|
+
* `DropdownOptionGroup` into a ContextMenu group. The label resolves as
|
|
14
|
+
* `children` → `label` → `value`, as it always has.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toDropdownMenuItems: (children: React.ReactNode) => ContextMenuEntry<OptionValue>[];
|
|
@@ -26,7 +26,7 @@ export declare const TypeaheadContext: React.Context<{
|
|
|
26
26
|
error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
|
|
27
27
|
placeholder: string | null | undefined;
|
|
28
28
|
listId: string;
|
|
29
|
-
menuItems: import("..").
|
|
29
|
+
menuItems: import("..").ContextMenuEntry<import("./types").TypeaheadValue>[];
|
|
30
30
|
activeValue: import("./types").TypeaheadValue | null;
|
|
31
31
|
setActiveValue: React.Dispatch<React.SetStateAction<import("./types").TypeaheadValue | null>>;
|
|
32
32
|
inputAriaProps: {
|
|
@@ -172,4 +172,4 @@ import { TypeaheadProps } from './types';
|
|
|
172
172
|
*
|
|
173
173
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
|
|
174
174
|
*/
|
|
175
|
-
export declare const Typeahead: ({ name, label, labelBadge, value, defaultValue, selectedItems, defaultSelectedItems, isOpen, disabled, isDisabled, isMultiple, singleLine, children, className, startIcon, endIcon, error, success, helperText, validationSchema, placeholder, startIconClassName, endIconClassName, popoverClassName, optionsClassName, wrapperClassName, filterOptions, autoSelect, allowCustomValues, width, onChange, onEmptyChange, onClearAll, onRemoveSelectedClick, renderOption, }: TypeaheadProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
175
|
+
export declare const Typeahead: ({ name, label, labelBadge, value, defaultValue, selectedItems, defaultSelectedItems, isOpen, disabled, isDisabled, isMultiple, singleLine, children, className, startIcon, endIcon, error, success, helperText, validationSchema, placeholder, startIconClassName, endIconClassName, popoverClassName, optionsClassName, wrapperClassName, filterOptions, autoSelect, searchByGroup, allowCustomValues, width, onChange, onEmptyChange, onClearAll, onRemoveSelectedClick, renderOption, }: TypeaheadProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link TypeaheadOptionGroup}. */
|
|
3
|
+
export interface TypeaheadOptionGroupProps {
|
|
4
|
+
/** Group title. Not selectable and skipped by keyboard navigation. */
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Plain-text form of `label`, matched against the input when the Typeahead
|
|
8
|
+
* has `searchByGroup`. Defaults to `label` when that is a string or number.
|
|
9
|
+
*/
|
|
10
|
+
textValue?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Unique per Typeahead. Defaults to the group's position among the
|
|
13
|
+
* Typeahead's children.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/** The group's `TypeaheadOption`s. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* TypeaheadOptionGroup - A titled section of options inside `Typeahead`.
|
|
21
|
+
*
|
|
22
|
+
* Wrap `TypeaheadOption` children in it to show them under a title; groups are
|
|
23
|
+
* separated by a divider. Filtering applies to the options inside, and a group
|
|
24
|
+
* with no matching options is hidden along with its title. With the
|
|
25
|
+
* Typeahead's `searchByGroup`, a group whose title matches is shown whole.
|
|
26
|
+
* Read by the
|
|
27
|
+
* Typeahead rather than rendered as written, so it only works as a direct
|
|
28
|
+
* child of the Typeahead (or of a fragment there).
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Typeahead name="city" label="City">
|
|
33
|
+
* <TypeaheadOptionGroup label="Europe">
|
|
34
|
+
* <TypeaheadOption value="kyiv" label="Kyiv" />
|
|
35
|
+
* <TypeaheadOption value="paris" label="Paris" />
|
|
36
|
+
* </TypeaheadOptionGroup>
|
|
37
|
+
* <TypeaheadOptionGroup label="Asia">
|
|
38
|
+
* <TypeaheadOption value="tokyo" label="Tokyo" />
|
|
39
|
+
* </TypeaheadOptionGroup>
|
|
40
|
+
* </Typeahead>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const TypeaheadOptionGroup: ({ children, }: TypeaheadOptionGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,5 +3,6 @@ export * from './types';
|
|
|
3
3
|
export { useTypeaheadContext } from './Typeahead.context';
|
|
4
4
|
export * from './components/TypeaheadOptions';
|
|
5
5
|
export * from './components/TypeaheadOption';
|
|
6
|
+
export * from './components/TypeaheadOptionGroup';
|
|
6
7
|
export * from './components/TypeaheadItem';
|
|
7
8
|
export * from './utils';
|
|
@@ -180,6 +180,14 @@ export interface TypeaheadProps {
|
|
|
180
180
|
* @default true
|
|
181
181
|
*/
|
|
182
182
|
autoSelect?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Also match the input against `TypeaheadOptionGroup` titles. A group whose
|
|
185
|
+
* title matches is shown with all of its options; otherwise only its
|
|
186
|
+
* matching options are shown, as usual. A title that is not a string or
|
|
187
|
+
* number is matched through the group's `textValue`.
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
searchByGroup?: boolean;
|
|
183
191
|
/**
|
|
184
192
|
* Allow adding custom values not in the options list.
|
|
185
193
|
* When true, the current input is shown as the first dropdown option (highlighted)
|
|
@@ -221,7 +229,7 @@ export interface TypeaheadProps {
|
|
|
221
229
|
* Props used by the useTypeahead hook
|
|
222
230
|
* Internal type that picks specific props from TypeaheadProps
|
|
223
231
|
*/
|
|
224
|
-
export type UseTypeaheadProps = Pick<TypeaheadProps, 'selectedItems' | 'defaultSelectedItems' | 'isDisabled' | 'children' | 'isMultiple' | 'singleLine' | 'onChange' | 'onClearAll' | 'onRemoveSelectedClick' | 'onEmptyChange' | 'renderOption' | 'isOpen' | 'className' | 'startIcon' | 'endIcon' | 'startIconClassName' | 'endIconClassName' | 'name' | 'validationSchema' | 'error' | 'success' | 'placeholder' | 'filterOptions' | 'autoSelect' | 'allowCustomValues' | 'label'>;
|
|
232
|
+
export type UseTypeaheadProps = Pick<TypeaheadProps, 'selectedItems' | 'defaultSelectedItems' | 'isDisabled' | 'children' | 'isMultiple' | 'singleLine' | 'onChange' | 'onClearAll' | 'onRemoveSelectedClick' | 'onEmptyChange' | 'renderOption' | 'isOpen' | 'className' | 'startIcon' | 'endIcon' | 'startIconClassName' | 'endIconClassName' | 'name' | 'validationSchema' | 'error' | 'success' | 'placeholder' | 'filterOptions' | 'autoSelect' | 'searchByGroup' | 'allowCustomValues' | 'label'>;
|
|
225
233
|
/**
|
|
226
234
|
* Props for TypeaheadOptions container component
|
|
227
235
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OpenChangeReason } from '@floating-ui/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ContextMenuEntry } from '../ContextMenu';
|
|
4
4
|
import { TypeaheadOptionProps, TypeaheadValue, UseTypeaheadProps } from './types';
|
|
5
5
|
type HandleChangeParams = {
|
|
6
6
|
value?: string | number;
|
|
7
7
|
shouldClose?: boolean;
|
|
8
8
|
resetInput?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: providedSelectedItems, defaultSelectedItems, isDisabled, isMultiple, singleLine, children, className, startIcon, endIcon, startIconClassName, endIconClassName, validationSchema, error, success, placeholder, filterOptions, autoSelect, allowCustomValues, onChange, onClearAll, onRemoveSelectedClick, onEmptyChange, renderOption, label, }: UseTypeaheadProps) => {
|
|
10
|
+
export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: providedSelectedItems, defaultSelectedItems, isDisabled, isMultiple, singleLine, children, className, startIcon, endIcon, startIconClassName, endIconClassName, validationSchema, error, success, placeholder, filterOptions, autoSelect, searchByGroup, allowCustomValues, onChange, onClearAll, onRemoveSelectedClick, onEmptyChange, renderOption, label, }: UseTypeaheadProps) => {
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
isDisabled: boolean | undefined;
|
|
13
13
|
optionsWithKey: Record<string | number, TypeaheadOptionProps>;
|
|
@@ -32,7 +32,7 @@ export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: p
|
|
|
32
32
|
error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
|
|
33
33
|
placeholder: string | null | undefined;
|
|
34
34
|
listId: string;
|
|
35
|
-
menuItems:
|
|
35
|
+
menuItems: ContextMenuEntry<TypeaheadValue>[];
|
|
36
36
|
activeValue: TypeaheadValue | null;
|
|
37
37
|
setActiveValue: React.Dispatch<React.SetStateAction<TypeaheadValue | null>>;
|
|
38
38
|
inputAriaProps: {
|
|
@@ -32,6 +32,8 @@ export type * from './Dropdown/types';
|
|
|
32
32
|
export { default as DropdownArrow } from './DropdownArrow';
|
|
33
33
|
export { default as DropdownBase } from './DropdownBase';
|
|
34
34
|
export { default as DropdownOption } from './DropdownOption';
|
|
35
|
+
export { default as DropdownOptionGroup } from './DropdownOptionGroup';
|
|
36
|
+
export type { DropdownOptionGroupProps } from './DropdownOptionGroup';
|
|
35
37
|
export { default as DropdownOptions } from './DropdownOptions';
|
|
36
38
|
export type { DropdownOptionProps } from './DropdownOptions';
|
|
37
39
|
export { default as DropdownToggle } from './DropdownToggle';
|