@jobber/components 8.3.0 → 8.5.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/ActivityIndicator.d.ts +1 -0
- package/ActivityIndicator.js +17 -0
- package/dist/ActivityIndicator/ActivityIndicator.d.ts +38 -0
- package/dist/ActivityIndicator/index.cjs +9 -0
- package/dist/ActivityIndicator/index.d.ts +2 -0
- package/dist/ActivityIndicator/index.mjs +3 -0
- package/dist/ActivityIndicator-cjs.js +27 -0
- package/dist/ActivityIndicator-es.js +25 -0
- package/dist/Autocomplete/Autocomplete.d.ts +6 -4
- package/dist/Autocomplete/Autocomplete.types.d.ts +3 -137
- package/dist/Autocomplete/components/FloatingMenu.d.ts +6 -6
- package/dist/Autocomplete/components/MenuList.d.ts +4 -4
- package/dist/Autocomplete/components/PersistentRegion.d.ts +3 -3
- package/dist/Autocomplete/index.cjs +25 -1658
- package/dist/Autocomplete/index.d.ts +3 -30
- package/dist/Autocomplete/index.mjs +25 -1647
- package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +15 -15
- package/dist/Autocomplete/useAutocomplete.d.ts +2 -2
- package/dist/Autocomplete-cjs.js +1306 -0
- package/dist/Autocomplete-es.js +1304 -0
- package/dist/Menu-es.js +1 -1
- package/dist/MenuSubmenuTrigger-es.js +1 -1
- package/dist/Spinner/Spinner.d.ts +6 -0
- package/dist/Spinner-cjs.js +3 -0
- package/dist/Spinner-es.js +3 -0
- package/dist/docs/ActivityIndicator/ActivityIndicator.md +67 -0
- package/dist/docs/Autocomplete/{AutocompleteV2.md → Autocomplete.md} +13 -107
- package/dist/docs/Banner/Banner.md +3 -3
- package/dist/docs/Box/Box.md +2 -2
- package/dist/docs/Chips/Chips.md +1 -1
- package/dist/docs/DataList/DataList.md +1 -1
- package/dist/docs/Icon/Icon.md +1 -1
- package/dist/docs/InputGroup/InputGroup.md +1 -1
- package/dist/docs/Menu/Menu.md +1 -1
- package/dist/docs/Modal/Modal.md +3 -3
- package/dist/docs/MultiSelect/MultiSelect.md +1 -1
- package/dist/docs/Spinner/Spinner.md +9 -1
- package/dist/docs/index.md +2 -2
- package/dist/docs/usage-guidelines/usage-guidelines.md +8 -10
- package/dist/floating-ui.react-dom-es.js +1 -1
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm-es.js +1 -1
- package/dist/index.mjs +3 -2
- package/dist/styles.css +308 -153
- package/dist/utils/meta/meta.json +1 -0
- package/package.json +8 -3
- package/dist/Autocomplete/Autocomplete.rebuilt.d.ts +0 -8
- package/dist/Autocomplete/Autocomplete.utils.d.ts +0 -8
- package/dist/Autocomplete/Menu/DefaultMenu.d.ts +0 -16
- package/dist/Autocomplete/Menu/Menu.d.ts +0 -3
- package/dist/Autocomplete/Menu/MenuWrapper.d.ts +0 -23
- package/dist/Autocomplete/Option.d.ts +0 -78
- package/dist/Autocomplete/V1.docgen.d.ts +0 -4
- package/dist/Autocomplete/V2.docgen.d.ts +0 -6
- package/dist/Autocomplete/useKeyboardNavigation.d.ts +0 -35
- package/dist/Autocomplete/useRepositionMenu.d.ts +0 -10
- package/dist/docs/Autocomplete/AutocompleteV1.md +0 -1328
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/ActivityIndicator";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var ActivityIndicator = require("./dist/ActivityIndicator");
|
|
8
|
+
|
|
9
|
+
Object.keys(ActivityIndicator).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return ActivityIndicator[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
export interface ActivityIndicatorProps {
|
|
4
|
+
/**
|
|
5
|
+
* Visual size. `base` renders at 32px, `small` renders at 16px.
|
|
6
|
+
*
|
|
7
|
+
* @default "base"
|
|
8
|
+
*/
|
|
9
|
+
readonly size?: "small" | "base";
|
|
10
|
+
/**
|
|
11
|
+
* Accessible label exposed via `aria-label` on the root element. Override
|
|
12
|
+
* to localize or to describe the specific activity (e.g. "Uploading file").
|
|
13
|
+
*
|
|
14
|
+
* @default "Loading"
|
|
15
|
+
*/
|
|
16
|
+
readonly ariaLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom class name merged onto the root element alongside the component's
|
|
19
|
+
* own classes.
|
|
20
|
+
*/
|
|
21
|
+
readonly className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom inline styles applied to the root element.
|
|
24
|
+
*/
|
|
25
|
+
readonly style?: CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `ActivityIndicator` communicates an indeterminate activity that the user
|
|
29
|
+
* cannot directly control or measure — loading, fetching, or waiting on an
|
|
30
|
+
* external system.
|
|
31
|
+
*
|
|
32
|
+
* For determinate progress (a known fraction completed), use
|
|
33
|
+
* `ProgressIndicator` instead (forthcoming).
|
|
34
|
+
*
|
|
35
|
+
* For now, the legacy `Spinner` component also remains available; new code
|
|
36
|
+
* should prefer `ActivityIndicator`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ActivityIndicator({ size, ariaLabel, className, style, }: ActivityIndicatorProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
|
|
6
|
+
var styles = {"indicator":"YST686vLR3c-","screenReaderOnly":"MmNHh-oCyxc-","small":"_888S5Y2IeZ8-","svg":"Av9z-aLocss-","indicatorLinearRotate":"WvHFS--Nm80-","track":"VDTWabJptKI-","arc":"_9XO0290QNCY-","indicatorRotateArc":"SHHICknKvqA-","indicatorExpandArc":"_0m0Nzc5awnA-","indicatorReducedPulse":"_4dXQsbprq3s-","spinning":"IZCteJUCKio-"};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `ActivityIndicator` communicates an indeterminate activity that the user
|
|
10
|
+
* cannot directly control or measure — loading, fetching, or waiting on an
|
|
11
|
+
* external system.
|
|
12
|
+
*
|
|
13
|
+
* For determinate progress (a known fraction completed), use
|
|
14
|
+
* `ProgressIndicator` instead (forthcoming).
|
|
15
|
+
*
|
|
16
|
+
* For now, the legacy `Spinner` component also remains available; new code
|
|
17
|
+
* should prefer `ActivityIndicator`.
|
|
18
|
+
*/
|
|
19
|
+
function ActivityIndicator({ size = "base", ariaLabel = "Loading", className, style, }) {
|
|
20
|
+
return (React.createElement("div", { role: "status", "aria-label": ariaLabel, className: classnames(styles.indicator, size === "small" && styles.small, className), style: style },
|
|
21
|
+
React.createElement("span", { className: styles.screenReaderOnly }, ariaLabel),
|
|
22
|
+
React.createElement("svg", { className: styles.svg, viewBox: "0 0 48 48", focusable: "false", "aria-hidden": "true" },
|
|
23
|
+
React.createElement("circle", { className: styles.track, cx: "24", cy: "24", r: "20" }),
|
|
24
|
+
React.createElement("circle", { className: styles.arc, cx: "24", cy: "24", r: "20" }))));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.ActivityIndicator = ActivityIndicator;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"indicator":"YST686vLR3c-","screenReaderOnly":"MmNHh-oCyxc-","small":"_888S5Y2IeZ8-","svg":"Av9z-aLocss-","indicatorLinearRotate":"WvHFS--Nm80-","track":"VDTWabJptKI-","arc":"_9XO0290QNCY-","indicatorRotateArc":"SHHICknKvqA-","indicatorExpandArc":"_0m0Nzc5awnA-","indicatorReducedPulse":"_4dXQsbprq3s-","spinning":"IZCteJUCKio-"};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `ActivityIndicator` communicates an indeterminate activity that the user
|
|
8
|
+
* cannot directly control or measure — loading, fetching, or waiting on an
|
|
9
|
+
* external system.
|
|
10
|
+
*
|
|
11
|
+
* For determinate progress (a known fraction completed), use
|
|
12
|
+
* `ProgressIndicator` instead (forthcoming).
|
|
13
|
+
*
|
|
14
|
+
* For now, the legacy `Spinner` component also remains available; new code
|
|
15
|
+
* should prefer `ActivityIndicator`.
|
|
16
|
+
*/
|
|
17
|
+
function ActivityIndicator({ size = "base", ariaLabel = "Loading", className, style, }) {
|
|
18
|
+
return (React__default.createElement("div", { role: "status", "aria-label": ariaLabel, className: classnames(styles.indicator, size === "small" && styles.small, className), style: style },
|
|
19
|
+
React__default.createElement("span", { className: styles.screenReaderOnly }, ariaLabel),
|
|
20
|
+
React__default.createElement("svg", { className: styles.svg, viewBox: "0 0 48 48", focusable: "false", "aria-hidden": "true" },
|
|
21
|
+
React__default.createElement("circle", { className: styles.track, cx: "24", cy: "24", r: "20" }),
|
|
22
|
+
React__default.createElement("circle", { className: styles.arc, cx: "24", cy: "24", r: "20" }))));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { ActivityIndicator as A };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { Ref
|
|
1
|
+
import type { Ref } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import
|
|
4
|
-
declare
|
|
5
|
-
|
|
3
|
+
import type { AutocompleteProps, OptionLike } from "./Autocomplete.types";
|
|
4
|
+
export declare const Autocomplete: <Value extends OptionLike = OptionLike, Multiple extends boolean = false>(props: AutocompleteProps<Value, Multiple> & {
|
|
5
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
6
|
+
}) => ReturnType<typeof AutocompleteInternal>;
|
|
7
|
+
declare function AutocompleteInternal<Value extends OptionLike, Multiple extends boolean = false>(props: AutocompleteProps<Value, Multiple>, forwardedRef: Ref<HTMLInputElement | HTMLTextAreaElement>): React.JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { CSSProperties, Key, Ref
|
|
1
|
+
import type { CSSProperties, Key, Ref } from "react";
|
|
2
2
|
import type { UseAutocompleteListNavReturn } from "./hooks/useAutocompleteListNav";
|
|
3
3
|
import type { createInteractionPointerDownHandler } from "./utils/interactionUtils";
|
|
4
4
|
import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
5
|
-
import type { FormFieldProps } from "../FormField";
|
|
6
5
|
import type { InputTextProps } from "../InputText";
|
|
7
6
|
/**
|
|
8
7
|
* ARIA attributes for Autocomplete with managed/orchestrated behavior.
|
|
@@ -12,139 +11,6 @@ import type { InputTextProps } from "../InputText";
|
|
|
12
11
|
interface AriaInputPropsManaged extends Omit<AriaInputProps, "aria-controls" | "aria-expanded" | "aria-activedescendant" | "aria-autocomplete"> {
|
|
13
12
|
}
|
|
14
13
|
export type ExtraProps = Record<string, unknown>;
|
|
15
|
-
type OptionValue = string | number;
|
|
16
|
-
export interface BaseOption {
|
|
17
|
-
label: string;
|
|
18
|
-
}
|
|
19
|
-
export interface Option extends BaseOption {
|
|
20
|
-
value?: OptionValue;
|
|
21
|
-
description?: string;
|
|
22
|
-
details?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface GroupOption extends BaseOption {
|
|
25
|
-
options: Option[];
|
|
26
|
-
}
|
|
27
|
-
export type OptionCollection = AnyOption[];
|
|
28
|
-
export type AnyOption<GenericOption extends Option | GroupOption = Option | GroupOption> = GenericOption;
|
|
29
|
-
export type OptionInGroup<T extends AnyOption> = T extends GroupOption ? T["options"][number] : T;
|
|
30
|
-
export interface AutocompleteBaseProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> extends Pick<FormFieldProps, "clearable" | "description" | "invalid" | "name" | "onBlur" | "onFocus" | "prefix" | "size" | "suffix"> {
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated
|
|
33
|
-
* Use `ref` instead.
|
|
34
|
-
*/
|
|
35
|
-
readonly inputRef?: FormFieldProps["inputRef"];
|
|
36
|
-
readonly initialOptions?: GenericOption[];
|
|
37
|
-
/**
|
|
38
|
-
* Set Autocomplete value.
|
|
39
|
-
*/
|
|
40
|
-
readonly value: GenericOptionValue | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Allow the autocomplete to use values not from the drop down menu.
|
|
43
|
-
*
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
readonly allowFreeForm?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Debounce in milliseconds for getOptions
|
|
49
|
-
*
|
|
50
|
-
* @default 300
|
|
51
|
-
*/
|
|
52
|
-
readonly debounce?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Simplified onChange handler that only provides the new value.
|
|
55
|
-
* @param newValue
|
|
56
|
-
*/
|
|
57
|
-
onChange(newValue?: GenericOptionValue): void;
|
|
58
|
-
/**
|
|
59
|
-
* Called as the user types in the input. The autocomplete will display what
|
|
60
|
-
* is returned from this method to the user as available options.
|
|
61
|
-
* @param newInputText
|
|
62
|
-
*/
|
|
63
|
-
getOptions(newInputText: string): Array<GenericGetOptionsValue | GenericOption> | Promise<Array<GenericGetOptionsValue | GenericOption>>;
|
|
64
|
-
/**
|
|
65
|
-
* Hint text that goes above the value once the form is filled out.
|
|
66
|
-
*/
|
|
67
|
-
readonly placeholder: string;
|
|
68
|
-
/**
|
|
69
|
-
* Override the content rendered in the menu.
|
|
70
|
-
*/
|
|
71
|
-
readonly customRenderMenu?: (props: CustomOptionsMenuProp<GenericOption | GenericGetOptionsValue, GenericOptionValue>) => React.ReactElement;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated Use the v2 Autocomplete component instead (version={2}).
|
|
75
|
-
*/
|
|
76
|
-
export interface AutocompleteLegacyProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> extends AutocompleteBaseProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> {
|
|
77
|
-
/**
|
|
78
|
-
* Version of the component to use.
|
|
79
|
-
* @default 1
|
|
80
|
-
*/
|
|
81
|
-
readonly version?: 1;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated
|
|
84
|
-
* Use `ref` instead.
|
|
85
|
-
*/
|
|
86
|
-
readonly inputRef?: FormFieldProps["inputRef"];
|
|
87
|
-
/**
|
|
88
|
-
* Initial options to display in the autocomplete.
|
|
89
|
-
*/
|
|
90
|
-
readonly initialOptions?: GenericOption[];
|
|
91
|
-
/**
|
|
92
|
-
* Called as the user types in the input. The autocomplete will display what
|
|
93
|
-
* is returned from this method to the user as available options.
|
|
94
|
-
* @param newInputText
|
|
95
|
-
*/
|
|
96
|
-
readonly getOptions: (newInputText: string) => Array<GenericGetOptionsValue | GenericOption> | Promise<Array<GenericGetOptionsValue | GenericOption>>;
|
|
97
|
-
}
|
|
98
|
-
export type AutocompleteProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> = AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>;
|
|
99
|
-
export type CustomOptionsMenuType<GenericOption extends AnyOption = AnyOption> = (props: CustomOptionsMenuProp<GenericOption>) => React.ReactElement;
|
|
100
|
-
export interface MenuProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option> {
|
|
101
|
-
readonly options: GenericOption[];
|
|
102
|
-
readonly selectedOption?: GenericOptionValue;
|
|
103
|
-
readonly inputFocused: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Element that the menu is attached to when the menu opens.
|
|
106
|
-
*/
|
|
107
|
-
readonly attachTo: HTMLDivElement | null;
|
|
108
|
-
/**
|
|
109
|
-
* Ref to the TextInput element.
|
|
110
|
-
*/
|
|
111
|
-
readonly inputRef: RefObject<HTMLInputElement | null>;
|
|
112
|
-
onOptionSelect(chosenOption?: GenericOptionValue): void;
|
|
113
|
-
readonly customRenderMenu?: (props: CustomOptionsMenuProp<GenericOption, GenericOptionValue>) => React.ReactElement;
|
|
114
|
-
}
|
|
115
|
-
export interface CustomOptionsMenuProp<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option> {
|
|
116
|
-
/**
|
|
117
|
-
* The options to display in the menu
|
|
118
|
-
*/
|
|
119
|
-
options: Array<OptionInGroup<GenericOption> | GenericOption>;
|
|
120
|
-
/**
|
|
121
|
-
* The currently selected option
|
|
122
|
-
*/
|
|
123
|
-
selectedOption?: GenericOptionValue;
|
|
124
|
-
/**
|
|
125
|
-
* The HTML element that wraps the menu content. Used for handling keyboard scroll behavior.
|
|
126
|
-
*/
|
|
127
|
-
readonly menuRef: HTMLElement | null | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Callback to select an option
|
|
130
|
-
*/
|
|
131
|
-
readonly onOptionSelect: (chosenOption?: GenericOptionValue) => void;
|
|
132
|
-
/**
|
|
133
|
-
* Determine if the input is focused. Can be used to conditionally render the menu.
|
|
134
|
-
*/
|
|
135
|
-
readonly inputFocused: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Ref to the TextInput element.
|
|
138
|
-
*/
|
|
139
|
-
readonly inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
140
|
-
/**
|
|
141
|
-
* Component that wraps the menu content. Used for handling keyboard scroll behavior.
|
|
142
|
-
*/
|
|
143
|
-
readonly MenuWrapper: (props: {
|
|
144
|
-
children: React.ReactNode;
|
|
145
|
-
visible: boolean;
|
|
146
|
-
}) => React.ReactElement;
|
|
147
|
-
}
|
|
148
14
|
export interface OptionLike {
|
|
149
15
|
label: string;
|
|
150
16
|
/**
|
|
@@ -230,7 +96,7 @@ export type MenuFooter<Extra extends object = ExtraProps> = Extra & {
|
|
|
230
96
|
};
|
|
231
97
|
export type MenuItem<T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = MenuSection<T, SectionExtra, ActionExtra> | MenuOptions<T, ActionExtra> | MenuHeader<ActionExtra> | MenuFooter<ActionExtra>;
|
|
232
98
|
export type AutocompleteValue<Value extends OptionLike, Multiple extends boolean> = Multiple extends true ? Value[] : Value | undefined;
|
|
233
|
-
interface
|
|
99
|
+
interface AutocompleteBaseProps<Value extends OptionLike, Multiple extends boolean, SectionExtra extends object, ActionExtra extends object> extends AriaInputPropsManaged, Pick<HTMLInputBaseProps, "name" | "disabled" | "readOnly" | "autoFocus">, Pick<RebuiltInputCommonProps, "placeholder" | "error" | "invalid" | "loading" | "clearable" | "description" | "size" | "prefix" | "suffix">, FocusEvents<HTMLInputElement | HTMLTextAreaElement> {
|
|
234
100
|
/**
|
|
235
101
|
* Whether the autocomplete allows multiple selections.
|
|
236
102
|
* When true, selected values are displayed as dismissible chips above the input.
|
|
@@ -486,7 +352,7 @@ interface FreeFormOn<Value extends OptionLike, Multiple extends boolean> {
|
|
|
486
352
|
readonly onChange: (value: AutocompleteValue<Value, Multiple>) => void;
|
|
487
353
|
}
|
|
488
354
|
export type ActionOrigin = "menu" | "empty";
|
|
489
|
-
export type
|
|
355
|
+
export type AutocompleteProps<Value extends OptionLike = OptionLike, Multiple extends boolean = false, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = AutocompleteBaseProps<Value, Multiple, SectionExtra, ActionExtra> & (FreeFormOn<Value, Multiple> | FreeFormOff<Value, Multiple>);
|
|
490
356
|
export declare const menuOptions: <T extends OptionLike, ActionExtra extends object = ExtraProps>(options: T[], actions?: MenuAction<ActionExtra>[]) => MenuOptions<T, ActionExtra>;
|
|
491
357
|
export declare const menuSection: <T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps>(label: string, options: T[], actions?: MenuAction<ActionExtra>[], extra?: SectionExtra) => MenuSection<T, SectionExtra, ActionExtra>;
|
|
492
358
|
export declare function defineMenu<T extends OptionLike, S extends object = ExtraProps, A extends object = ExtraProps>(menu: MenuItem<T, S, A>[]): MenuItem<T, S, A>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { UseFloatingReturn, UseInteractionsReturn } from "@floating-ui/react";
|
|
3
|
-
import type { ActionConfig,
|
|
3
|
+
import type { ActionConfig, AutocompleteProps, MenuFooter, MenuHeader, OptionLike, RenderItem } from "../Autocomplete.types";
|
|
4
4
|
interface FloatingMenuProps<Value extends OptionLike> {
|
|
5
5
|
readonly context: UseFloatingReturn["context"];
|
|
6
6
|
readonly getFloatingProps: UseInteractionsReturn["getFloatingProps"];
|
|
@@ -27,11 +27,11 @@ interface FloatingMenuProps<Value extends OptionLike> {
|
|
|
27
27
|
readonly showEmptyStateMessage: boolean;
|
|
28
28
|
readonly emptyStateMessage?: React.ReactNode;
|
|
29
29
|
readonly customRenderLoading?: React.ReactNode;
|
|
30
|
-
readonly customRenderOption?:
|
|
31
|
-
readonly customRenderSection?:
|
|
32
|
-
readonly customRenderAction?:
|
|
33
|
-
readonly customRenderHeader?:
|
|
34
|
-
readonly customRenderFooter?:
|
|
30
|
+
readonly customRenderOption?: AutocompleteProps<Value, false>["customRenderOption"];
|
|
31
|
+
readonly customRenderSection?: AutocompleteProps<Value, false>["customRenderSection"];
|
|
32
|
+
readonly customRenderAction?: AutocompleteProps<Value, false>["customRenderAction"];
|
|
33
|
+
readonly customRenderHeader?: AutocompleteProps<Value, false>["customRenderHeader"];
|
|
34
|
+
readonly customRenderFooter?: AutocompleteProps<Value, false>["customRenderFooter"];
|
|
35
35
|
readonly slotOverrides?: {
|
|
36
36
|
option?: {
|
|
37
37
|
className?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ActionConfig,
|
|
2
|
+
import type { ActionConfig, AutocompleteProps, OptionLike, RenderItem } from "../Autocomplete.types";
|
|
3
3
|
interface MenuListProps<T extends OptionLike> {
|
|
4
4
|
readonly items: Array<RenderItem<T>>;
|
|
5
5
|
readonly activeIndex: number | null;
|
|
@@ -7,9 +7,9 @@ interface MenuListProps<T extends OptionLike> {
|
|
|
7
7
|
readonly getItemProps: (userProps?: Record<string, unknown>) => Record<string, unknown>;
|
|
8
8
|
readonly listRef: React.RefObject<Array<HTMLElement | null>>;
|
|
9
9
|
readonly listboxId: string;
|
|
10
|
-
readonly customRenderOption?:
|
|
11
|
-
readonly customRenderSection?:
|
|
12
|
-
readonly customRenderAction?:
|
|
10
|
+
readonly customRenderOption?: AutocompleteProps<T, false>["customRenderOption"];
|
|
11
|
+
readonly customRenderSection?: AutocompleteProps<T, false>["customRenderSection"];
|
|
12
|
+
readonly customRenderAction?: AutocompleteProps<T, false>["customRenderAction"];
|
|
13
13
|
readonly getOptionLabel: (option: T) => string;
|
|
14
14
|
readonly onSelect: (option: T) => void;
|
|
15
15
|
readonly onAction: (action: ActionConfig) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ActionConfig,
|
|
2
|
+
import type { ActionConfig, AutocompleteProps, MenuFooter, MenuHeader, OptionLike } from "../Autocomplete.types";
|
|
3
3
|
interface PersistentRegionProps<T extends OptionLike> {
|
|
4
4
|
readonly items: Array<MenuHeader<Record<string, unknown>> | MenuFooter<Record<string, unknown>>>;
|
|
5
5
|
readonly position: "header" | "footer";
|
|
@@ -8,8 +8,8 @@ interface PersistentRegionProps<T extends OptionLike> {
|
|
|
8
8
|
readonly listboxId?: string;
|
|
9
9
|
readonly getItemProps: (args?: Record<string, unknown>) => Record<string, unknown>;
|
|
10
10
|
readonly listRef: React.RefObject<Array<HTMLElement | null>>;
|
|
11
|
-
readonly customRenderHeader?:
|
|
12
|
-
readonly customRenderFooter?:
|
|
11
|
+
readonly customRenderHeader?: AutocompleteProps<T, false>["customRenderHeader"];
|
|
12
|
+
readonly customRenderFooter?: AutocompleteProps<T, false>["customRenderFooter"];
|
|
13
13
|
readonly className?: string;
|
|
14
14
|
readonly style?: React.CSSProperties;
|
|
15
15
|
readonly onAction: (action: ActionConfig) => void;
|