@ssa-ui-kit/core 2.33.0 → 3.1.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/dist/components/AccordionGroup/Accordion.d.ts +37 -0
- package/dist/components/AccordionGroup/AccordionContent.d.ts +48 -0
- package/dist/components/AccordionGroup/AccordionContext.d.ts +76 -2
- package/dist/components/AccordionGroup/AccordionGroup.d.ts +56 -0
- package/dist/components/AccordionGroup/AccordionTitle.d.ts +41 -0
- package/dist/components/AccordionGroup/types.d.ts +199 -1
- package/dist/components/Avatar/Avatar.d.ts +33 -0
- package/dist/components/Button/Button.d.ts +61 -0
- package/dist/components/Button/fixtures.d.ts +52 -31
- package/dist/components/Button/styles.d.ts +7 -12
- package/dist/components/Button/types.d.ts +98 -4
- package/dist/components/Charts/BarGaugeChart/components/BarGaugeChartHeader.d.ts +1 -1
- package/dist/components/Charts/BarLineComplexChart/BarLineComplexChartView.d.ts +2 -2
- package/dist/components/Charts/BarLineComplexChart/types.d.ts +2 -2
- package/dist/components/Charts/BigNumberChart/BigNumberChart.d.ts +4 -2
- package/dist/components/Charts/BigNumberChart/components/BigNumberChartHeader.d.ts +1 -1
- package/dist/components/Charts/BigNumberChart/components/TrendLine.d.ts +8 -3
- package/dist/components/Charts/BigNumberChart/components/TrendLineTooltip.d.ts +8 -5
- package/dist/components/Charts/GaugeChart/components/GaugeChartBase.d.ts +3 -1
- package/dist/components/Charts/GaugeChart/components/GaugeChartHeader.d.ts +1 -1
- package/dist/components/Charts/PieChart/PieChartLegendMarker.d.ts +1 -1
- package/dist/components/Charts/PieChart/styles.d.ts +1 -1
- package/dist/components/Charts/PieChart/types.d.ts +1 -1
- package/dist/components/Charts/RadarChart/RadarChart.d.ts +1 -1
- package/dist/components/Charts/RadarChart/components/RadarChartHeader.d.ts +1 -1
- package/dist/components/Charts/TreeMapChart/TreeMapChart.d.ts +1 -1
- package/dist/components/Charts/TreeMapChart/TreeMapChartHeader.d.ts +1 -1
- package/dist/components/Charts/index.d.ts +1 -0
- package/dist/components/Charts/utils/nivoReact19Compat.d.ts +18 -0
- package/dist/components/Checkbox/Checkbox.d.ts +84 -0
- package/dist/components/Checkbox/CheckboxBase.d.ts +1 -1
- package/dist/components/Checkbox/styles.d.ts +2 -2
- package/dist/components/Checkbox/types.d.ts +104 -3
- package/dist/components/Chip/Chip.d.ts +70 -0
- package/dist/components/Chip/constants.d.ts +1 -1
- package/dist/components/Chip/helpers.d.ts +6 -0
- package/dist/components/Chip/types.d.ts +129 -1
- package/dist/components/CollapsibleNavBar/CollapsibleNavBar.d.ts +1 -1
- package/dist/components/CollapsibleNavBar/CollapsibleNavBarContext.d.ts +2 -2
- package/dist/components/CollapsibleNavBar/components/TriggerIcon.d.ts +4 -2
- package/dist/components/CollapsibleNavBar/types.d.ts +9 -2
- package/dist/components/ColorPicker/components/CopyButton.d.ts +1 -1
- package/dist/components/DatePicker/constants.d.ts +22 -0
- package/dist/components/DatePicker/hooks/useDatePicker.d.ts +7 -5
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts +3 -2
- package/dist/components/DatePicker/types.d.ts +10 -2
- package/dist/components/DatePicker/utils/dates.d.ts +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePickerFormBridge.d.ts +46 -0
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +3 -2
- package/dist/components/DateRangePicker/constants.d.ts +1 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +22 -17
- package/dist/components/DateRangePicker/index.d.ts +3 -0
- package/dist/components/DateRangePicker/styles.d.ts +6 -4
- package/dist/components/DateRangePicker/types.d.ts +24 -7
- package/dist/components/DateRangePicker/utils/dates.d.ts +2 -2
- package/dist/components/Drawer/index.d.ts +2 -1
- package/dist/components/Dropdown/Dropdown.d.ts +88 -0
- package/dist/components/Dropdown/types.d.ts +102 -1
- package/dist/components/DropdownOption/DropdownOption.d.ts +2 -0
- package/dist/components/DropdownOptions/DropdownOptions.d.ts +31 -0
- package/dist/components/DropdownOptions/types.d.ts +22 -0
- package/dist/components/DropdownToggle/DropdownToggle.d.ts +3 -2
- package/dist/components/DropdownToggle/types.d.ts +5 -3
- package/dist/components/Field/FieldControl.d.ts +62 -1
- package/dist/components/Field/FieldDescription.d.ts +33 -0
- package/dist/components/Field/FieldError.d.ts +36 -0
- package/dist/components/Field/FieldLabel.d.ts +37 -0
- package/dist/components/Field/FieldProvider.d.ts +19 -1
- package/dist/components/Field/FieldRoot.d.ts +90 -0
- package/dist/components/Field/FieldSuccess.d.ts +34 -0
- package/dist/components/Field/index.d.ts +4 -0
- package/dist/components/Filters/FilterBlockWrapper.d.ts +3 -2
- package/dist/components/Filters/FiltersContext.d.ts +4 -4
- package/dist/components/Filters/hooks/useVisibility.d.ts +2 -2
- package/dist/components/FullscreenModeContext.d.ts +1 -4
- package/dist/components/Icon/icons/Assessment.d.ts +1 -1
- package/dist/components/Icon/icons/Award.d.ts +3 -0
- package/dist/components/Icon/icons/Bench.d.ts +3 -0
- package/dist/components/Icon/icons/Briefcase.d.ts +3 -0
- package/dist/components/Icon/icons/Building.d.ts +3 -0
- package/dist/components/Icon/icons/CalendarSchedule.d.ts +3 -0
- package/dist/components/Icon/icons/Camera.d.ts +3 -0
- package/dist/components/Icon/icons/CardText.d.ts +3 -0
- package/dist/components/Icon/icons/Case.d.ts +3 -0
- package/dist/components/Icon/icons/Comments.d.ts +3 -0
- package/dist/components/Icon/icons/Compensation.d.ts +3 -0
- package/dist/components/Icon/icons/Contacts.d.ts +3 -0
- package/dist/components/Icon/icons/CopyLink.d.ts +3 -0
- package/dist/components/Icon/icons/Delete.d.ts +3 -0
- package/dist/components/Icon/icons/DiamondRing.d.ts +3 -0
- package/dist/components/Icon/icons/Document.d.ts +3 -0
- package/dist/components/Icon/icons/Documents.d.ts +3 -0
- package/dist/components/Icon/icons/Education.d.ts +3 -0
- package/dist/components/Icon/icons/EmployeeProfile.d.ts +3 -0
- package/dist/components/Icon/icons/Export.d.ts +3 -0
- package/dist/components/Icon/icons/FollowLink.d.ts +3 -0
- package/dist/components/Icon/icons/Form.d.ts +3 -0
- package/dist/components/Icon/icons/Gender.d.ts +3 -0
- package/dist/components/Icon/icons/Gift.d.ts +3 -0
- package/dist/components/Icon/icons/Inventory.d.ts +3 -0
- package/dist/components/Icon/icons/Link.d.ts +3 -0
- package/dist/components/Icon/icons/OfficeChair.d.ts +3 -0
- package/dist/components/Icon/icons/OpenBook.d.ts +3 -0
- package/dist/components/Icon/icons/Report.d.ts +1 -1
- package/dist/components/Icon/icons/Results.d.ts +3 -0
- package/dist/components/Icon/icons/Signature.d.ts +3 -0
- package/dist/components/Icon/icons/Summery.d.ts +3 -0
- package/dist/components/Icon/icons/Team.d.ts +3 -0
- package/dist/components/Icon/icons/TechnicalReview.d.ts +3 -0
- package/dist/components/Icon/icons/TennisBall.d.ts +3 -0
- package/dist/components/Icon/icons/Timeline.d.ts +3 -0
- package/dist/components/Icon/icons/UnionCircle.d.ts +3 -0
- package/dist/components/Icon/icons/Url.d.ts +3 -0
- package/dist/components/Icon/icons/all.d.ts +36 -1
- package/dist/components/Icon/icons/iconsList.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +39 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/IconButton/styles.d.ts +2 -0
- package/dist/components/IconButton/types.d.ts +41 -0
- package/dist/components/Indicator/types.d.ts +4 -2
- package/dist/components/Input/types.d.ts +157 -0
- package/dist/components/JsonSchemaForm/fields/DateRangeField.d.ts +15 -1
- package/dist/components/JsonSchemaForm/utils/dateFormats.d.ts +37 -0
- package/dist/components/JsonSchemaForm/utils/dateRangeField.d.ts +24 -0
- package/dist/components/JsonSchemaForm/utils/index.d.ts +1 -0
- package/dist/components/JsonSchemaForm/utils/selectWidget.d.ts +16 -0
- package/dist/components/Modal/Modal.d.ts +60 -0
- package/dist/components/Modal/types.d.ts +21 -1
- package/dist/components/ModalContent/ModalContent.d.ts +42 -1
- package/dist/components/ModalDialog/ModalDialog.d.ts +27 -0
- package/dist/components/ModalDialog/types.d.ts +18 -0
- package/dist/components/ModalDismissButton/ModalDismissButton.d.ts +29 -2
- package/dist/components/ModalOpenButton/ModalOpenButton.d.ts +25 -1
- package/dist/components/MultipleDropdown/index.d.ts +1 -0
- package/dist/components/MultipleDropdown/types.d.ts +74 -0
- package/dist/components/NavBar/types.d.ts +1 -1
- package/dist/components/NotificationMenu/types.d.ts +3 -3
- package/dist/components/Pagination/ArrowButton.d.ts +32 -0
- package/dist/components/Pagination/Pagination.d.ts +81 -0
- package/dist/components/Pagination/PaginationButtons.d.ts +35 -0
- package/dist/components/Pagination/PaginationContext.d.ts +30 -0
- package/dist/components/Pagination/WithPagination.d.ts +47 -4
- package/dist/components/Pagination/components/RowsPerPageDropdown/RowsPerPageDropdown.d.ts +41 -0
- package/dist/components/Pagination/components/RowsPerPageDropdown/types.d.ts +39 -0
- package/dist/components/Pagination/styles.d.ts +1 -1
- package/dist/components/Pagination/types.d.ts +178 -0
- package/dist/components/PersonInfo/styles.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +120 -0
- package/dist/components/Popover/PopoverClose.d.ts +26 -0
- package/dist/components/Popover/PopoverContent.d.ts +33 -0
- package/dist/components/Popover/PopoverDescription.d.ts +22 -1
- package/dist/components/Popover/PopoverHeading.d.ts +22 -1
- package/dist/components/Popover/PopoverTrigger.d.ts +30 -0
- package/dist/components/Popover/hooks/usePopover.d.ts +21 -0
- package/dist/components/Popover/hooks/usePopoverContext.d.ts +23 -0
- package/dist/components/Popover/types.d.ts +86 -0
- package/dist/components/Radio/Radio.d.ts +69 -1
- package/dist/components/Radio/RadioBase.d.ts +1 -1
- package/dist/components/Radio/types.d.ts +109 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/types.d.ts +42 -0
- package/dist/components/SearchBox/SearchBox.d.ts +60 -0
- package/dist/components/SearchBox/SearchBoxInput.d.ts +1 -1
- package/dist/components/SearchBox/types.d.ts +46 -0
- package/dist/components/Slider/Slider.d.ts +53 -0
- package/dist/components/Slider/consts.d.ts +4 -0
- package/dist/components/Slider/index.d.ts +4 -0
- package/dist/components/Slider/styles.d.ts +90 -0
- package/dist/components/Slider/types.d.ts +69 -0
- package/dist/components/Switch/Switch.d.ts +66 -1
- package/dist/components/Switch/SwitchBase.d.ts +5 -1
- package/dist/components/Switch/SwitchContext.d.ts +50 -0
- package/dist/components/Switch/types.d.ts +74 -0
- package/dist/components/Table/Table.d.ts +74 -0
- package/dist/components/TableBody/TableBody.d.ts +55 -0
- package/dist/components/TableCell/TableCell.d.ts +56 -4
- package/dist/components/TableCell/types.d.ts +33 -0
- package/dist/components/TableCellHeader/TableCellHeader.d.ts +63 -2
- package/dist/components/TableCellHeader/types.d.ts +28 -0
- package/dist/components/TableFilters/TableFilters.d.ts +72 -0
- package/dist/components/TableFilters/hooks/useTableData.d.ts +3 -3
- package/dist/components/TableFilters/types.d.ts +130 -2
- package/dist/components/TableHead/TableHead.d.ts +37 -0
- package/dist/components/TableRow/TableRow.d.ts +2 -7
- package/dist/components/TableRow/types.d.ts +34 -0
- package/dist/components/TextField/TextField.d.ts +76 -0
- package/dist/components/TextField/types.d.ts +80 -0
- package/dist/components/Textarea/Textarea.d.ts +81 -0
- package/dist/components/Textarea/TextareaBase.d.ts +6 -1
- package/dist/components/Textarea/types.d.ts +109 -0
- package/dist/components/Tooltip/SimpleChartTooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.d.ts +73 -0
- package/dist/components/Tooltip/types.d.ts +116 -5
- package/dist/components/TooltipContent/TooltipContent.d.ts +45 -0
- package/dist/components/TooltipTrigger/TooltipTrigger.d.ts +27 -1
- package/dist/components/Typeahead/Typeahead.context.d.ts +10 -4
- package/dist/components/Typeahead/Typeahead.d.ts +173 -9
- package/dist/components/Typeahead/components/TypeaheadOption.d.ts +1 -1
- package/dist/components/Typeahead/styles.d.ts +10 -5
- package/dist/components/Typeahead/types.d.ts +191 -1
- package/dist/components/Typeahead/useTypeahead.d.ts +13 -5
- package/dist/components/Typography/Typography.d.ts +50 -0
- package/dist/components/Typography/types.d.ts +67 -0
- package/dist/components/UserProfile/UserProfile.d.ts +76 -0
- package/dist/components/UserProfile/styles.d.ts +6 -4
- package/dist/components/UserProfile/types.d.ts +85 -1
- package/dist/components/WidgetCard/Title.d.ts +1 -1
- package/dist/components/WidgetCard/WidgetCardBase.d.ts +1 -1
- package/dist/components/WithLink.d.ts +1 -1
- package/dist/components/Wrapper/Wrapper.d.ts +83 -2
- package/dist/components/Wrapper/index.d.ts +1 -0
- package/dist/components/index.d.ts +113 -85
- package/dist/index.d.ts +1 -0
- package/dist/index.js +48942 -19624
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +65 -0
- package/dist/utils/react19HocCompat.d.ts +14 -0
- package/package.json +42 -33
- package/dist/components/Icon/icons/Company.d.ts +0 -3
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import { TooltipTriggerProps } from '../Tooltip/types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* TooltipTrigger - Trigger element for tooltip activation
|
|
4
|
+
*
|
|
5
|
+
* Wraps a single React element to make it trigger the tooltip. The wrapped
|
|
6
|
+
* element receives tooltip interaction props (onMouseEnter, onMouseLeave, onClick, etc.)
|
|
7
|
+
* and Floating UI reference props for positioning.
|
|
8
|
+
*
|
|
9
|
+
* Must be used within a Tooltip component and must have a single child element
|
|
10
|
+
* (not a fragment or array). Returns null if children is not a valid element.
|
|
11
|
+
*
|
|
12
|
+
* @category Components
|
|
13
|
+
* @subcategory Overlay
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Tooltip>
|
|
18
|
+
* <TooltipTrigger>
|
|
19
|
+
* <Button>Hover me</Button>
|
|
20
|
+
* </TooltipTrigger>
|
|
21
|
+
* <TooltipContent>Tooltip content</TooltipContent>
|
|
22
|
+
* </Tooltip>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @see {@link Tooltip} - Parent component that provides context
|
|
26
|
+
* @see {@link TooltipContent} - Content component that displays tooltip
|
|
27
|
+
*/
|
|
28
|
+
declare const TooltipTrigger: ({ children, className }: TooltipTriggerProps) => import("react").ReactElement<TooltipTriggerProps, string | import("react").JSXElementConstructor<any>> | null;
|
|
3
29
|
export default TooltipTrigger;
|
|
@@ -6,11 +6,11 @@ export declare const TypeaheadContext: React.Context<{
|
|
|
6
6
|
isDisabled: boolean | undefined;
|
|
7
7
|
optionsWithKey: Record<string | number, import("./types").TypeaheadOptionProps>;
|
|
8
8
|
selectedItems: import("./types").TypeaheadValue[];
|
|
9
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
9
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
10
10
|
firstSuggestion: string;
|
|
11
11
|
isMultiple: boolean | undefined;
|
|
12
12
|
typeaheadId: string;
|
|
13
|
-
triggerRef: React.RefObject<HTMLDivElement>;
|
|
13
|
+
triggerRef: React.RefObject<HTMLDivElement | null>;
|
|
14
14
|
className: string | undefined;
|
|
15
15
|
startIcon: React.ReactNode;
|
|
16
16
|
endIcon: React.ReactNode;
|
|
@@ -23,8 +23,14 @@ export declare const TypeaheadContext: React.Context<{
|
|
|
23
23
|
status: "error" | "success" | "basic";
|
|
24
24
|
error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
|
|
25
25
|
placeholder: string | null | undefined;
|
|
26
|
-
options: (React.ReactElement<
|
|
27
|
-
|
|
26
|
+
options: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | null)[];
|
|
27
|
+
customOptionValue: string | null;
|
|
28
|
+
handleChange: ({ value, shouldClose, resetInput, }: {
|
|
29
|
+
value?: string | number;
|
|
30
|
+
shouldClose?: boolean;
|
|
31
|
+
resetInput?: boolean;
|
|
32
|
+
}) => void;
|
|
33
|
+
useFormResult: UseFormReturn<FieldValues, any, FieldValues>;
|
|
28
34
|
register: import("react-hook-form").UseFormRegister<FieldValues>;
|
|
29
35
|
setValue: import("react-hook-form").UseFormSetValue<FieldValues>;
|
|
30
36
|
onChange: ((selectedItem: import("./types").TypeaheadValue, isSelected: boolean) => void) | undefined;
|
|
@@ -1,11 +1,175 @@
|
|
|
1
1
|
import { TypeaheadProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
* Typeahead - Advanced autocomplete search component with dropdown functionality
|
|
4
|
+
*
|
|
5
|
+
* A powerful autocomplete component that provides search-as-you-type functionality
|
|
6
|
+
* with dropdown suggestions. Supports both single and multiple selection modes,
|
|
7
|
+
* filtering, custom rendering, custom values (user-typed values not in options list),
|
|
8
|
+
* and integrates seamlessly with React Hook Form for validation and form management.
|
|
9
|
+
*
|
|
10
|
+
* Component structure:
|
|
11
|
+
* - Typeahead (root container with context)
|
|
12
|
+
* - TypeaheadTrigger (search input with selected items display)
|
|
13
|
+
* - TypeaheadOptions (filtered dropdown options list)
|
|
14
|
+
* - FormHelperText (validation messages and helper text)
|
|
15
|
+
*
|
|
16
|
+
* @category Form Controls
|
|
17
|
+
* @subcategory Selection
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Single selection with React Hook Form
|
|
22
|
+
* const form = useForm();
|
|
23
|
+
* return (
|
|
24
|
+
* <FormProvider {...form}>
|
|
25
|
+
* <Typeahead
|
|
26
|
+
* name="language"
|
|
27
|
+
* label="Programming Language"
|
|
28
|
+
* placeholder="Select a language"
|
|
29
|
+
* validationSchema={{ required: 'Language is required' }}>
|
|
30
|
+
* {languages.map(lang => (
|
|
31
|
+
* <TypeaheadOption key={lang.id} value={lang.id} label={lang.name}>
|
|
32
|
+
* {lang.name}
|
|
33
|
+
* </TypeaheadOption>
|
|
34
|
+
* ))}
|
|
35
|
+
* </Typeahead>
|
|
36
|
+
* </FormProvider>
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Multiple selection
|
|
43
|
+
* <Typeahead
|
|
44
|
+
* name="tags"
|
|
45
|
+
* isMultiple
|
|
46
|
+
* label="Tags"
|
|
47
|
+
* selectedItems={selected}
|
|
48
|
+
* onChange={(item, isSelected) => handleToggle(item, isSelected)}>
|
|
49
|
+
* {options.map(opt => (
|
|
50
|
+
* <TypeaheadOption key={opt.id} value={opt.id}>
|
|
51
|
+
* {opt.label}
|
|
52
|
+
* </TypeaheadOption>
|
|
53
|
+
* ))}
|
|
54
|
+
* </Typeahead>
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // With custom values - allows users to type and add values not in options
|
|
60
|
+
* <Typeahead
|
|
61
|
+
* name="tags"
|
|
62
|
+
* isMultiple
|
|
63
|
+
* allowCustomValues={true}
|
|
64
|
+
* label="Tags">
|
|
65
|
+
* {options.map(opt => (
|
|
66
|
+
* <TypeaheadOption key={opt.id} value={opt.id}>
|
|
67
|
+
* {opt.label}
|
|
68
|
+
* </TypeaheadOption>
|
|
69
|
+
* ))}
|
|
70
|
+
* </Typeahead>
|
|
71
|
+
* // Users can type "custom-tag" and press Enter to add it
|
|
72
|
+
* // Custom values appear in blue in the dropdown and selected items
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // With custom option rendering
|
|
78
|
+
* <Typeahead
|
|
79
|
+
* name="users"
|
|
80
|
+
* label="Select User"
|
|
81
|
+
* renderOption={({ value, label, input }) => (
|
|
82
|
+
* <div>
|
|
83
|
+
* <Avatar src={users[value].avatar} />
|
|
84
|
+
* <span>{highlightMatch(label, input)}</span>
|
|
85
|
+
* </div>
|
|
86
|
+
* )}>
|
|
87
|
+
* {users.map(user => (
|
|
88
|
+
* <TypeaheadOption key={user.id} value={user.id} label={user.name} />
|
|
89
|
+
* ))}
|
|
90
|
+
* </Typeahead>
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* // Schema validation in Form Builder (JsonSchemaForm)
|
|
96
|
+
* // For single select - use 'required' in schema
|
|
97
|
+
* const schema = {
|
|
98
|
+
* type: 'string',
|
|
99
|
+
* title: 'Select field title',
|
|
100
|
+
* enum: ['Option 1', 'Option 2'],
|
|
101
|
+
* // required: ['selectField'] // Add to top-level required array
|
|
102
|
+
* };
|
|
103
|
+
*
|
|
104
|
+
* // For multiple select (array) - use 'required' + 'minItems'
|
|
105
|
+
* const schema = {
|
|
106
|
+
* type: 'array',
|
|
107
|
+
* title: 'Select multiple fields title',
|
|
108
|
+
* items: {
|
|
109
|
+
* type: 'string',
|
|
110
|
+
* enum: ['Option 1', 'Option 2', 'Option 3'],
|
|
111
|
+
* },
|
|
112
|
+
* minItems: 1, // Ensures at least one item is selected
|
|
113
|
+
* // required: ['selectMultipleField'] // Add to top-level required array
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* // Schema validation in standalone mode (React Hook Form)
|
|
120
|
+
* // For single select - use 'required' in validationSchema
|
|
121
|
+
* <Typeahead
|
|
122
|
+
* name="language"
|
|
123
|
+
* label="Language"
|
|
124
|
+
* validationSchema={{
|
|
125
|
+
* required: 'Language is required',
|
|
126
|
+
* }}>
|
|
127
|
+
* {options.map(opt => (
|
|
128
|
+
* <TypeaheadOption key={opt.id} value={opt.id}>
|
|
129
|
+
* {opt.label}
|
|
130
|
+
* </TypeaheadOption>
|
|
131
|
+
* ))}
|
|
132
|
+
* </Typeahead>
|
|
133
|
+
*
|
|
134
|
+
* // For multiple select - use 'validate' function to check array length
|
|
135
|
+
* <Typeahead
|
|
136
|
+
* name="tags"
|
|
137
|
+
* isMultiple
|
|
138
|
+
* label="Tags"
|
|
139
|
+
* validationSchema={{
|
|
140
|
+
* validate: (value: string[]) => {
|
|
141
|
+
* if (!value || value.length === 0) {
|
|
142
|
+
* return 'At least one tag is required';
|
|
143
|
+
* }
|
|
144
|
+
* return true;
|
|
145
|
+
* },
|
|
146
|
+
* }}>
|
|
147
|
+
* {options.map(opt => (
|
|
148
|
+
* <TypeaheadOption key={opt.id} value={opt.id}>
|
|
149
|
+
* {opt.label}
|
|
150
|
+
* </TypeaheadOption>
|
|
151
|
+
* ))}
|
|
152
|
+
* </Typeahead>
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @note Validation differences:
|
|
156
|
+
* - **Form Builder (JsonSchemaForm)**: Uses JSON Schema validation. For arrays, use `minItems` property
|
|
157
|
+
* (e.g., `minItems: 1` to require at least one selection). The `required` array at the schema root
|
|
158
|
+
* marks fields as required.
|
|
159
|
+
* - **Standalone mode**: Uses React Hook Form validation. For arrays, use a `validate` function to check
|
|
160
|
+
* array length, as React Hook Form doesn't have a built-in `minItems` rule. The `required` rule works
|
|
161
|
+
* for single select fields.
|
|
162
|
+
*
|
|
163
|
+
* @see {@link TypeaheadOption} - Child component for individual options
|
|
164
|
+
* @see {@link Popover} - Used for dropdown positioning
|
|
165
|
+
*
|
|
166
|
+
* @accessibility
|
|
167
|
+
* - ARIA attributes set according to WAI-ARIA combobox pattern
|
|
168
|
+
* - Keyboard navigation (Arrow keys, Enter, Escape, Tab)
|
|
169
|
+
* - Screen reader friendly
|
|
170
|
+
* - Focus management with trap
|
|
171
|
+
* - Search input filtering
|
|
172
|
+
*
|
|
173
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
|
|
174
|
+
*/
|
|
175
|
+
export declare const Typeahead: ({ name, label, selectedItems, defaultSelectedItems, isOpen, isDisabled, isMultiple, 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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TypeaheadItemProps } from '../types';
|
|
2
|
-
export declare const TypeaheadOption: ({ children, avatar, ...rest }: TypeaheadItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TypeaheadOption: ({ children, avatar, isCustomValue, ...rest }: TypeaheadItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -10,13 +10,14 @@ export declare const TypeaheadOption: import("@emotion/styled").StyledComponent<
|
|
|
10
10
|
as?: React.ElementType;
|
|
11
11
|
} & TypeaheadItemProps, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
12
12
|
export declare const TypeaheadInput: (theme: Theme) => string;
|
|
13
|
-
export declare const TypeaheadInputPlaceholder: string;
|
|
13
|
+
export declare const TypeaheadInputPlaceholder: (theme: Theme) => string;
|
|
14
14
|
export declare const TypeaheadInputWrapper: string;
|
|
15
15
|
export declare const TypeaheadItem: import("@emotion/styled").StyledComponent<{
|
|
16
16
|
theme?: Theme;
|
|
17
17
|
as?: React.ElementType;
|
|
18
18
|
} & {
|
|
19
19
|
isDisabled?: boolean;
|
|
20
|
+
isCustomValue?: boolean;
|
|
20
21
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
21
22
|
export declare const TypeaheadItemAvatar: import("@emotion/styled").StyledComponent<{
|
|
22
23
|
theme?: Theme;
|
|
@@ -27,16 +28,20 @@ export declare const TypeaheadItemLabel: import("@emotion/styled").StyledCompone
|
|
|
27
28
|
as?: React.ElementType;
|
|
28
29
|
} & {
|
|
29
30
|
isDisabled?: boolean;
|
|
31
|
+
isCustomValue?: boolean;
|
|
30
32
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
31
|
-
export declare const TypeaheadItemCross: import("@emotion/styled").StyledComponent<import("
|
|
33
|
+
export declare const TypeaheadItemCross: import("@emotion/styled").StyledComponent<import("..").ButtonProps & import("react").RefAttributes<HTMLButtonElement> & {
|
|
32
34
|
theme?: Theme;
|
|
35
|
+
} & {
|
|
36
|
+
isCustomValue?: boolean;
|
|
33
37
|
}, {}, {}>;
|
|
34
38
|
export declare const TypeaheadInputsGroupWrapper: import("@emotion/styled").StyledComponent<{
|
|
35
39
|
theme?: Theme;
|
|
36
40
|
as?: React.ElementType;
|
|
37
41
|
} & {
|
|
38
|
-
direction?:
|
|
39
|
-
alignItems?:
|
|
42
|
+
direction?: import("../Wrapper").WrapperDirection;
|
|
43
|
+
alignItems?: import("../Wrapper").WrapperAlignItems;
|
|
44
|
+
justifyContent?: import("../Wrapper").WrapperJustifyContent;
|
|
40
45
|
fade?: boolean;
|
|
41
46
|
fadeDelay?: number;
|
|
42
47
|
isVisible?: boolean;
|
|
@@ -45,7 +50,7 @@ export declare const TypeaheadInputsGroupWrapper: import("@emotion/styled").Styl
|
|
|
45
50
|
} & {
|
|
46
51
|
isOpen: boolean;
|
|
47
52
|
}, {}, {}>;
|
|
48
|
-
export declare const TypeaheadTrigger: import("@emotion/styled").StyledComponent<Omit<import("react").HTMLProps<HTMLElement> & import("
|
|
53
|
+
export declare const TypeaheadTrigger: import("@emotion/styled").StyledComponent<Omit<import("react").HTMLProps<HTMLElement> & import("..").ButtonProps & import("../Popover/types").PopoverTriggerProps, "ref"> & import("react").RefAttributes<HTMLElement> & {
|
|
49
54
|
theme?: Theme;
|
|
50
55
|
} & {
|
|
51
56
|
isOpen: boolean;
|
|
@@ -1,53 +1,243 @@
|
|
|
1
1
|
import { CommonProps } from '../../types/emotion';
|
|
2
2
|
import { FieldError } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* Allowed value types for Typeahead options
|
|
5
|
+
*/
|
|
3
6
|
export type TypeaheadValue = string | number;
|
|
7
|
+
/**
|
|
8
|
+
* Props for TypeaheadOption component
|
|
9
|
+
* Record type that allows any string or number properties.
|
|
10
|
+
* Common properties include: value, label, children, avatar, etc.
|
|
11
|
+
*/
|
|
4
12
|
export type TypeaheadOptionProps = Record<string, TypeaheadValue>;
|
|
13
|
+
/**
|
|
14
|
+
* Props for the Typeahead component
|
|
15
|
+
*
|
|
16
|
+
* An advanced autocomplete component with search-as-you-type functionality.
|
|
17
|
+
* Supports single and multiple selection, filtering, custom rendering, and
|
|
18
|
+
* React Hook Form integration for validation.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <Typeahead
|
|
23
|
+
* name="language"
|
|
24
|
+
* label="Language"
|
|
25
|
+
* placeholder="Select language"
|
|
26
|
+
* validationSchema={{ required: 'Required' }}>
|
|
27
|
+
* {options.map(opt => (
|
|
28
|
+
* <TypeaheadOption key={opt.id} value={opt.id} label={opt.name}>
|
|
29
|
+
* {opt.name}
|
|
30
|
+
* </TypeaheadOption>
|
|
31
|
+
* ))}
|
|
32
|
+
* </Typeahead>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
5
35
|
export interface TypeaheadProps {
|
|
36
|
+
/**
|
|
37
|
+
* Controlled selected items (array of values)
|
|
38
|
+
* When provided, controls the selected items externally
|
|
39
|
+
*/
|
|
6
40
|
selectedItems?: Array<TypeaheadValue>;
|
|
41
|
+
/**
|
|
42
|
+
* Default selected items for uncontrolled mode
|
|
43
|
+
*/
|
|
7
44
|
defaultSelectedItems?: Array<TypeaheadValue>;
|
|
45
|
+
/**
|
|
46
|
+
* Enable multiple selection mode
|
|
47
|
+
* When true, allows selecting multiple options
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
8
50
|
isMultiple?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the component is disabled
|
|
53
|
+
* Disabled typeahead cannot be interacted with
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
9
56
|
isDisabled?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* TypeaheadOption components as children
|
|
59
|
+
* Each child should be a TypeaheadOption component
|
|
60
|
+
*/
|
|
10
61
|
children?: React.ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Custom CSS class name for the trigger input
|
|
64
|
+
*/
|
|
11
65
|
className?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Custom CSS class name for the popover container
|
|
68
|
+
*/
|
|
12
69
|
popoverClassName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Custom CSS class name for the options list
|
|
72
|
+
*/
|
|
13
73
|
optionsClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Custom CSS class name for the wrapper container
|
|
76
|
+
*/
|
|
14
77
|
wrapperClassName?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Width of the component
|
|
80
|
+
* Can be a number (pixels) or string (CSS value)
|
|
81
|
+
* @default 300
|
|
82
|
+
*/
|
|
15
83
|
width?: string | number;
|
|
84
|
+
/**
|
|
85
|
+
* Controlled open state
|
|
86
|
+
* When provided, controls dropdown open/closed state externally
|
|
87
|
+
*/
|
|
16
88
|
isOpen?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Icon or element to display at the start of the input
|
|
91
|
+
*/
|
|
17
92
|
startIcon?: React.ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* Icon or element to display at the end of the input
|
|
95
|
+
*/
|
|
18
96
|
endIcon?: React.ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* Custom CSS class name for the start icon
|
|
99
|
+
*/
|
|
19
100
|
startIconClassName?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Custom CSS class name for the end icon
|
|
103
|
+
*/
|
|
20
104
|
endIconClassName?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Form field name (required for React Hook Form integration)
|
|
107
|
+
* @default 'typeahead-search'
|
|
108
|
+
*/
|
|
21
109
|
name?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Label text displayed above the input
|
|
112
|
+
*/
|
|
22
113
|
label?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Helper text displayed below the input
|
|
116
|
+
*/
|
|
23
117
|
helperText?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Field error from React Hook Form
|
|
120
|
+
*/
|
|
24
121
|
error?: FieldError;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to show success state
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
25
126
|
success?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Validation schema for React Hook Form
|
|
129
|
+
* Used for form validation rules
|
|
130
|
+
*/
|
|
26
131
|
validationSchema?: Record<string, unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* Placeholder text for the input
|
|
134
|
+
* @default 'Select something'
|
|
135
|
+
*/
|
|
27
136
|
placeholder?: string | null;
|
|
137
|
+
/**
|
|
138
|
+
* Whether to filter options based on input
|
|
139
|
+
* When false, all options are always shown
|
|
140
|
+
* @default true
|
|
141
|
+
*/
|
|
28
142
|
filterOptions?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether to automatically select the first option on filter
|
|
145
|
+
* @default true
|
|
146
|
+
*/
|
|
29
147
|
autoSelect?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Allow adding custom values not in the options list.
|
|
150
|
+
* When true, the current input is shown as the first dropdown option (highlighted)
|
|
151
|
+
* and can be selected or added with Enter.
|
|
152
|
+
* @default true
|
|
153
|
+
*/
|
|
154
|
+
allowCustomValues?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Callback fired when an option is selected/deselected
|
|
157
|
+
* Receives the selected item value and whether it's selected
|
|
158
|
+
*/
|
|
30
159
|
onChange?: (selectedItem: TypeaheadValue, isSelected: boolean) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Callback fired when "Clear All" is clicked (multiple mode)
|
|
162
|
+
*/
|
|
31
163
|
onClearAll?: () => void;
|
|
164
|
+
/**
|
|
165
|
+
* Callback fired when a selected item's remove button is clicked
|
|
166
|
+
* Receives the item value to be removed
|
|
167
|
+
*/
|
|
32
168
|
onRemoveSelectedClick?: (selectedItem: TypeaheadValue) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Callback fired when the selection becomes empty or non-empty
|
|
171
|
+
* Receives a boolean indicating if selection is empty
|
|
172
|
+
*/
|
|
33
173
|
onEmptyChange?: (isEmpty?: boolean) => void;
|
|
174
|
+
/**
|
|
175
|
+
* Custom render function for options
|
|
176
|
+
* Allows customizing the appearance of each option
|
|
177
|
+
* Receives value, input text, and label
|
|
178
|
+
*/
|
|
34
179
|
renderOption?: (data: {
|
|
35
180
|
value: string | number;
|
|
36
181
|
input: string;
|
|
37
182
|
label: string;
|
|
38
183
|
}) => React.ReactNode;
|
|
39
184
|
}
|
|
40
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Props used by the useTypeahead hook
|
|
187
|
+
* Internal type that picks specific props from TypeaheadProps
|
|
188
|
+
*/
|
|
189
|
+
export type UseTypeaheadProps = Pick<TypeaheadProps, 'selectedItems' | 'defaultSelectedItems' | 'isDisabled' | 'children' | 'isMultiple' | 'onChange' | 'onClearAll' | 'onRemoveSelectedClick' | 'onEmptyChange' | 'renderOption' | 'isOpen' | 'className' | 'startIcon' | 'endIcon' | 'startIconClassName' | 'endIconClassName' | 'name' | 'validationSchema' | 'error' | 'success' | 'placeholder' | 'filterOptions' | 'autoSelect' | 'allowCustomValues'>;
|
|
190
|
+
/**
|
|
191
|
+
* Props for TypeaheadOptions container component
|
|
192
|
+
*/
|
|
41
193
|
export interface TypeaheadItemsListProps extends CommonProps {
|
|
42
194
|
children?: React.ReactNode;
|
|
43
195
|
noItemsMessage?: string;
|
|
44
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Props for TypeaheadOption component
|
|
199
|
+
*/
|
|
45
200
|
export interface TypeaheadItemProps extends CommonProps {
|
|
201
|
+
/**
|
|
202
|
+
* Whether this option is currently selected
|
|
203
|
+
*/
|
|
46
204
|
isActive?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Whether this option is disabled
|
|
207
|
+
*/
|
|
47
208
|
isDisabled?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Value of the option (must be unique)
|
|
211
|
+
*/
|
|
48
212
|
value?: string | number;
|
|
213
|
+
/**
|
|
214
|
+
* Label text for the option
|
|
215
|
+
* Used for filtering and display
|
|
216
|
+
*/
|
|
49
217
|
label?: string | number;
|
|
218
|
+
/**
|
|
219
|
+
* Content to display in the option
|
|
220
|
+
* Can be custom React nodes
|
|
221
|
+
*/
|
|
50
222
|
children?: React.ReactNode;
|
|
223
|
+
/**
|
|
224
|
+
* Avatar or icon to display before the option content
|
|
225
|
+
*/
|
|
51
226
|
avatar?: React.ReactNode;
|
|
227
|
+
/**
|
|
228
|
+
* Click handler for the option
|
|
229
|
+
*/
|
|
52
230
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
231
|
+
/**
|
|
232
|
+
* When true, option is a user-typed custom value (shown first, highlighted in blue)
|
|
233
|
+
*/
|
|
234
|
+
isCustomValue?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* ARIA role for the option (e.g. 'option')
|
|
237
|
+
*/
|
|
238
|
+
role?: string;
|
|
239
|
+
/**
|
|
240
|
+
* ARIA selected state
|
|
241
|
+
*/
|
|
242
|
+
'aria-selected'?: boolean;
|
|
53
243
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OpenChangeReason } from '@floating-ui/react';
|
|
3
3
|
import { TypeaheadOptionProps, TypeaheadValue, UseTypeaheadProps } from './types';
|
|
4
|
-
|
|
4
|
+
type HandleChangeParams = {
|
|
5
|
+
value?: string | number;
|
|
6
|
+
shouldClose?: boolean;
|
|
7
|
+
resetInput?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: providedSelectedItems, defaultSelectedItems, isDisabled, isMultiple, children, className, startIcon, endIcon, startIconClassName, endIconClassName, validationSchema, error, success, placeholder, filterOptions, autoSelect, allowCustomValues, onChange, onClearAll, onRemoveSelectedClick, onEmptyChange, renderOption, }: UseTypeaheadProps) => {
|
|
5
10
|
isOpen: boolean;
|
|
6
11
|
isDisabled: boolean | undefined;
|
|
7
12
|
optionsWithKey: Record<string | number, TypeaheadOptionProps>;
|
|
8
13
|
selectedItems: TypeaheadValue[];
|
|
9
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
14
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
10
15
|
firstSuggestion: string;
|
|
11
16
|
isMultiple: boolean | undefined;
|
|
12
17
|
typeaheadId: string;
|
|
13
|
-
triggerRef: React.RefObject<HTMLDivElement>;
|
|
18
|
+
triggerRef: React.RefObject<HTMLDivElement | null>;
|
|
14
19
|
className: string | undefined;
|
|
15
20
|
startIcon: React.ReactNode;
|
|
16
21
|
endIcon: React.ReactNode;
|
|
@@ -23,8 +28,10 @@ export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: p
|
|
|
23
28
|
status: "error" | "success" | "basic";
|
|
24
29
|
error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
|
|
25
30
|
placeholder: string | null | undefined;
|
|
26
|
-
options: (React.ReactElement<
|
|
27
|
-
|
|
31
|
+
options: (React.ReactElement<any, string | React.JSXElementConstructor<any>> | null)[];
|
|
32
|
+
customOptionValue: string | null;
|
|
33
|
+
handleChange: ({ value, shouldClose, resetInput, }: HandleChangeParams) => void;
|
|
34
|
+
useFormResult: import("react-hook-form").UseFormReturn<import("react-hook-form").FieldValues, any, import("react-hook-form").FieldValues>;
|
|
28
35
|
register: import("react-hook-form").UseFormRegister<import("react-hook-form").FieldValues>;
|
|
29
36
|
setValue: import("react-hook-form").UseFormSetValue<import("react-hook-form").FieldValues>;
|
|
30
37
|
onChange: ((selectedItem: TypeaheadValue, isSelected: boolean) => void) | undefined;
|
|
@@ -36,3 +43,4 @@ export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: p
|
|
|
36
43
|
handleRemoveSelectedClick: (value: string | number) => (e: React.MouseEvent) => void;
|
|
37
44
|
};
|
|
38
45
|
export type UseTypeaheadResult = ReturnType<typeof useTypeahead>;
|
|
46
|
+
export {};
|
|
@@ -1,3 +1,53 @@
|
|
|
1
1
|
import { TypographyProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Typography - Text typography component with semantic variants
|
|
4
|
+
*
|
|
5
|
+
* A flexible typography component that provides consistent text styling across
|
|
6
|
+
* the application. Supports semantic HTML variants (headings, body text, captions)
|
|
7
|
+
* with customizable font weights, colors, and spacing. Automatically renders
|
|
8
|
+
* appropriate HTML elements based on variant while allowing semantic override.
|
|
9
|
+
*
|
|
10
|
+
* @category Components
|
|
11
|
+
* @subcategory Display
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Heading
|
|
16
|
+
* <Typography variant="h1">Main Title</Typography>
|
|
17
|
+
* <Typography variant="h2">Section Title</Typography>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Body text
|
|
23
|
+
* <Typography variant="body1">
|
|
24
|
+
* This is regular body text
|
|
25
|
+
* </Typography>
|
|
26
|
+
* <Typography variant="body2" weight="bold" color="#333">
|
|
27
|
+
* This is bold, darker body text
|
|
28
|
+
* </Typography>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Semantic override
|
|
34
|
+
* <Typography variant="h2" as="h1">
|
|
35
|
+
* Looks like h2 but semantically is h1
|
|
36
|
+
* </Typography>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* // With gutter for spacing
|
|
42
|
+
* <Typography variant="body1" gutter>
|
|
43
|
+
* This text has bottom margin
|
|
44
|
+
* </Typography>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @accessibility
|
|
48
|
+
* - Uses semantic HTML elements by default
|
|
49
|
+
* - Supports proper heading hierarchy
|
|
50
|
+
* - Respects user font size preferences
|
|
51
|
+
*/
|
|
2
52
|
declare const Typography: import("react").ForwardRefExoticComponent<Omit<TypographyProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
3
53
|
export default Typography;
|