@central-ui/react 0.3.0 → 0.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/dist/components/accordion/index.d.ts +14 -14
- package/dist/components/accordion/index.js +19 -19
- package/dist/components/autocomplete/index.d.ts +51 -47
- package/dist/components/autocomplete/index.js +57 -57
- package/dist/components/avatar/index.d.ts +7 -6
- package/dist/components/avatar/index.js +9 -9
- package/dist/components/banner/index.js +1 -1
- package/dist/components/carousel/index.d.ts +31 -11
- package/dist/components/carousel/index.js +25 -21
- package/dist/components/checkbox/index.d.ts +12 -11
- package/dist/components/checkbox/index.js +21 -21
- package/dist/components/combobox/index.d.ts +56 -56
- package/dist/components/combobox/index.js +67 -68
- package/dist/components/datepicker/index.d.ts +8 -9
- package/dist/components/datepicker/index.js +13 -13
- package/dist/components/dialog/index.d.ts +18 -18
- package/dist/components/dialog/index.js +22 -21
- package/dist/components/drawer/index.d.ts +24 -24
- package/dist/components/drawer/index.js +28 -27
- package/dist/components/exception/index.d.ts +23 -11
- package/dist/components/exception/index.js +17 -17
- package/dist/components/fileupload/index.d.ts +8 -8
- package/dist/components/input/index.d.ts +14 -14
- package/dist/components/input/index.js +27 -27
- package/dist/components/menu/index.d.ts +37 -37
- package/dist/components/menu/index.js +47 -47
- package/dist/components/numberinput/index.d.ts +22 -22
- package/dist/components/numberinput/index.js +35 -35
- package/dist/components/otpinput/index.d.ts +12 -12
- package/dist/components/otpinput/index.js +21 -21
- package/dist/components/pagination/index.d.ts +158 -0
- package/dist/components/pagination/index.js +157 -0
- package/dist/components/passwordinput/index.d.ts +15 -15
- package/dist/components/passwordinput/index.js +27 -27
- package/dist/components/popover/index.d.ts +16 -16
- package/dist/components/popover/index.js +20 -19
- package/dist/components/radio/index.d.ts +12 -12
- package/dist/components/radio/index.js +25 -25
- package/dist/components/ratinginput/index.d.ts +1 -1
- package/dist/components/ratinginput/index.js +3 -3
- package/dist/components/select/index.d.ts +29 -29
- package/dist/components/select/index.js +33 -33
- package/dist/components/slider/index.d.ts +20 -20
- package/dist/components/slider/index.js +27 -27
- package/dist/components/stepper/index.d.ts +135 -44
- package/dist/components/stepper/index.js +185 -62
- package/dist/components/switch/index.d.ts +9 -9
- package/dist/components/switch/index.js +17 -17
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +16 -16
- package/dist/components/tabs/index.d.ts +10 -10
- package/dist/components/tabs/index.js +11 -11
- package/dist/components/textarea/index.d.ts +13 -13
- package/dist/components/textarea/index.js +25 -25
- package/dist/components/toast/index.d.ts +11 -11
- package/dist/components/toast/index.js +11 -11
- package/dist/components/toggle/index.d.ts +7 -7
- package/dist/components/toggle/index.js +9 -9
- package/dist/components/tooltip/index.d.ts +6 -6
- package/dist/components/tooltip/index.js +6 -7
- package/dist/components/tour/index.d.ts +2 -2
- package/dist/components/tour/index.js +5 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/icons.d.ts +104 -23
- package/dist/utils/icons.js +16 -3
- package/package.json +69 -69
- package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -28
- package/src/presets/shopify-polaris/shopify-polaris-pagination.css +55 -0
- package/src/presets/shopify-polaris/shopify-polaris-stepper.css +63 -27
- package/src/presets/shopify-polaris/shopify-polaris.css +1 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -28
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-pagination.css +49 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +64 -26
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +1 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
3
3
|
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
4
|
-
import type { ReactElement } from 'react';
|
|
4
|
+
import type { ComponentProps, ReactElement } from 'react';
|
|
5
5
|
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
6
6
|
/**
|
|
7
|
-
* Use List → Item → OpenButton and Content. Item owns its expansion; do not add your own visibility conditions. Put the heading inside
|
|
7
|
+
* Use List → Item → OpenButton and Content. Item owns its expansion; do not add your own visibility conditions. Put the heading inside OpenButtonTitle and let OpenButtonIcon reflect expansion.
|
|
8
8
|
*
|
|
9
9
|
* @example Complete composition
|
|
10
10
|
* import { Accordion } from '@central-ui/react'
|
|
@@ -33,8 +33,8 @@ import type { SVGIconProps } from '../../types/Icon.ts';
|
|
|
33
33
|
* {questions.map((question) => (
|
|
34
34
|
* <Accordion.Item key={question.value} value={question.value}>
|
|
35
35
|
* <Accordion.OpenButton>
|
|
36
|
-
* <Accordion.
|
|
37
|
-
* <Accordion.
|
|
36
|
+
* <Accordion.OpenButtonTitle>{question.title}</Accordion.OpenButtonTitle>
|
|
37
|
+
* <Accordion.OpenButtonIcon />
|
|
38
38
|
* </Accordion.OpenButton>
|
|
39
39
|
* <Accordion.Content>
|
|
40
40
|
* <div className="p-3">{question.answer}</div>
|
|
@@ -55,20 +55,20 @@ import type { SVGIconProps } from '../../types/Icon.ts';
|
|
|
55
55
|
* </Accordion.Root>
|
|
56
56
|
*/
|
|
57
57
|
export declare function Root({ children, ...props }: Omit<BaseAccordion.Root.Props, 'render' | 'className'>): import("react").JSX.Element;
|
|
58
|
-
export declare
|
|
59
|
-
export declare
|
|
58
|
+
export declare function List({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
59
|
+
export declare function Item({ disableStyle, className, ref, ...props }: (Omit<BaseAccordion.Item.Props, 'className' | 'render'> & {
|
|
60
60
|
className?: string;
|
|
61
|
-
} & StyleProps
|
|
61
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
62
62
|
/** Expands or collapses its Item. Pass asChild to give this behavior to your own button instead; it keeps the state data attributes (like data-panel-open) but none of this part's styling. */
|
|
63
|
-
export declare
|
|
63
|
+
export declare function OpenButton({ asChild, disableStyle, children, ref, ...props }: Omit<BaseAccordion.Trigger.Props, 'className' | 'render'> & {
|
|
64
64
|
className?: string;
|
|
65
|
-
} & AsChildProps & StyleProps
|
|
66
|
-
export declare
|
|
65
|
+
} & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
66
|
+
export declare function OpenButtonTitle({ disableStyle, className, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
67
67
|
/** Supplies the expansion icon and follows open state automatically. Omit children for the default; pass an icon only to replace it. */
|
|
68
|
-
export declare
|
|
68
|
+
export declare function OpenButtonIcon({ disableStyle, children, className, ref, ...props }: (SVGIconProps & {
|
|
69
69
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
70
70
|
children?: ReactElement<SVGIconProps>;
|
|
71
|
-
} & StyleProps
|
|
72
|
-
export declare
|
|
71
|
+
}) & StyleProps): import("react").FunctionComponentElement<any>;
|
|
72
|
+
export declare function Content({ disableStyle, className, ref, ...props }: (Omit<BaseAccordion.Panel.Props, 'className' | 'render'> & {
|
|
73
73
|
className?: string;
|
|
74
|
-
} & StyleProps
|
|
74
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { asChildRendering } from "../../utils/asChild.js";
|
|
3
3
|
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
4
|
-
import { cloneElement, createContext,
|
|
4
|
+
import { cloneElement, createContext, useContext } from 'react';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { ChevronDown } from "../../utils/icons.js";
|
|
7
7
|
/**
|
|
8
|
-
* Use List → Item → OpenButton and Content. Item owns its expansion; do not add your own visibility conditions. Put the heading inside
|
|
8
|
+
* Use List → Item → OpenButton and Content. Item owns its expansion; do not add your own visibility conditions. Put the heading inside OpenButtonTitle and let OpenButtonIcon reflect expansion.
|
|
9
9
|
*
|
|
10
10
|
* @example Complete composition
|
|
11
11
|
* import { Accordion } from '@central-ui/react'
|
|
@@ -34,8 +34,8 @@ import { ChevronDown } from "../../utils/icons.js";
|
|
|
34
34
|
* {questions.map((question) => (
|
|
35
35
|
* <Accordion.Item key={question.value} value={question.value}>
|
|
36
36
|
* <Accordion.OpenButton>
|
|
37
|
-
* <Accordion.
|
|
38
|
-
* <Accordion.
|
|
37
|
+
* <Accordion.OpenButtonTitle>{question.title}</Accordion.OpenButtonTitle>
|
|
38
|
+
* <Accordion.OpenButtonIcon />
|
|
39
39
|
* </Accordion.OpenButton>
|
|
40
40
|
* <Accordion.Content>
|
|
41
41
|
* <div className="p-3">{question.answer}</div>
|
|
@@ -59,22 +59,22 @@ export function Root({ children, ...props }) {
|
|
|
59
59
|
// Native Root renders a div; the fragment preserves our wrapper-free Root contract.
|
|
60
60
|
return (_jsx(BaseAccordion.Root, { ...props, render: (rootProps) => _jsx(_Fragment, { children: rootProps.children }), children: children }));
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export function List({ disableStyle, className, ref, ...props }) {
|
|
63
63
|
return (_jsx("div", { ...props, ref: ref, "data-component": "accordion-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
64
|
-
}
|
|
65
|
-
export
|
|
64
|
+
}
|
|
65
|
+
export function Item({ disableStyle, className, ref, ...props }) {
|
|
66
66
|
return (_jsx(BaseAccordion.Item, { ...props, ref: ref, "data-component": "accordion-item", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (itemProps, state) => (_jsx(ItemContext.Provider, { value: state.open, children: _jsx("div", { ...itemProps }) })) }));
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
/** Expands or collapses its Item. Pass asChild to give this behavior to your own button instead; it keeps the state data attributes (like data-panel-open) but none of this part's styling. */
|
|
69
|
-
export
|
|
69
|
+
export function OpenButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
70
70
|
const rendering = asChildRendering({ asChild, children, component: 'accordion-openbutton', disableStyle });
|
|
71
71
|
return (_jsx(BaseAccordion.Header, { children: _jsx(BaseAccordion.Trigger, { ...props, ref: ref, ...rendering }) }));
|
|
72
|
-
}
|
|
73
|
-
export
|
|
74
|
-
return (_jsx("span", { ...props, ref: ref, "data-component": "accordion-
|
|
75
|
-
}
|
|
72
|
+
}
|
|
73
|
+
export function OpenButtonTitle({ disableStyle, className, ref, ...props }) {
|
|
74
|
+
return (_jsx("span", { ...props, ref: ref, "data-component": "accordion-openbuttontitle", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
75
|
+
}
|
|
76
76
|
/** Supplies the expansion icon and follows open state automatically. Omit children for the default; pass an icon only to replace it. */
|
|
77
|
-
export
|
|
77
|
+
export function OpenButtonIcon({ disableStyle, children, className, ref, ...props }) {
|
|
78
78
|
const open = useContext(ItemContext);
|
|
79
79
|
return cloneElement(children ?? _jsx(ChevronDown, {}), {
|
|
80
80
|
...props,
|
|
@@ -82,14 +82,14 @@ export const OpenerIndicator = /* @__PURE__ */ forwardRef(function OpenerIndicat
|
|
|
82
82
|
'aria-hidden': true,
|
|
83
83
|
'data-panel-open': open ? '' : undefined,
|
|
84
84
|
...{
|
|
85
|
-
'data-component': 'accordion-
|
|
85
|
+
'data-component': 'accordion-openbuttonicon',
|
|
86
86
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
87
87
|
},
|
|
88
88
|
className: twMerge(children?.props.className, className),
|
|
89
89
|
});
|
|
90
|
-
}
|
|
91
|
-
export
|
|
90
|
+
}
|
|
91
|
+
export function Content({ disableStyle, className, ref, ...props }) {
|
|
92
92
|
return (_jsx(BaseAccordion.Panel, { ...props, ref: ref, "data-component": "accordion-content", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
93
|
-
}
|
|
94
|
-
// Sharing whether the item is open, so
|
|
93
|
+
}
|
|
94
|
+
// Sharing whether the item is open, so OpenButtonIcon can follow it
|
|
95
95
|
const ItemContext = /* @__PURE__ */ createContext(false);
|
|
@@ -3,6 +3,10 @@ import type { SVGIconProps } from '../../types/Icon.ts';
|
|
|
3
3
|
import type { ComponentProps, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
4
4
|
import type { Validation } from '../../types/Validation.ts';
|
|
5
5
|
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
6
|
+
type IconProps = Omit<SVGIconProps, 'strokeWidth'> & {
|
|
7
|
+
/** @default 1.5 */
|
|
8
|
+
strokeWidth?: SVGIconProps['strokeWidth'];
|
|
9
|
+
};
|
|
6
10
|
type StyleProps = {
|
|
7
11
|
/**
|
|
8
12
|
* Disables preset styling for this element.
|
|
@@ -213,22 +217,22 @@ export type RootProps<T extends readonly GroupShape[]> = Omit<BaseAutocomplete.R
|
|
|
213
217
|
*/
|
|
214
218
|
export declare function Root<T extends readonly GroupShape[]>({ children, id, validation, open, defaultOpen, onOpenChange, ...props }: RootProps<T>): import("react").JSX.Element;
|
|
215
219
|
/** Use for the standard stacked layout, or omit when supplying your own layout. */
|
|
216
|
-
export declare
|
|
220
|
+
export declare function Container({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
217
221
|
/** Labels the input automatically using Root's id. Supply the visible label as children; no htmlFor needed. */
|
|
218
|
-
export declare
|
|
222
|
+
export declare function Label({ disableStyle, className, ref, ...props }: Omit<ComponentProps<'label'>, 'htmlFor'> & StyleProps): import("react").JSX.Element;
|
|
219
223
|
/** Let the input handle suggestion filtering and completion. It accepts free text; choosing a suggestion is optional. Label association is automatic. */
|
|
220
|
-
export declare
|
|
224
|
+
export declare function Input({ disableStyle, className, 'aria-describedby': describedBy, ref, ...props }: (Omit<BaseAutocomplete.Input.Props, 'id' | 'className' | 'render'> & {
|
|
221
225
|
className?: string;
|
|
222
|
-
} & StyleProps
|
|
226
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
223
227
|
/** Use only for an additional custom display of the current input text. Do not use it to build the editable input; Input already handles that. */
|
|
224
228
|
export declare const Value: typeof BaseAutocomplete.Value;
|
|
225
|
-
export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.List>, 'children' | 'className'> & {
|
|
229
|
+
export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.List>, 'children' | 'className' | 'render'> & {
|
|
226
230
|
className?: string;
|
|
227
231
|
/** Keep GroupsList inside this listbox rather than nesting another listbox primitive. */
|
|
228
232
|
children?: ReactNode;
|
|
229
233
|
} & StyleProps;
|
|
230
234
|
/** Required listbox and scroll viewport inside Popup. Place GroupsList inside it. Owns keyboard/listbox semantics; do not nest another listbox primitive. */
|
|
231
|
-
export declare
|
|
235
|
+
export declare function ScrollArea({ disableStyle, className, style, ref, ...props }: ScrollAreaProps): import("react").JSX.Element;
|
|
232
236
|
export type GroupsListProps<Group extends GroupShape = GroupShape> = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
233
237
|
/**
|
|
234
238
|
* Return Group with its ItemsList; do not filter the collection again.
|
|
@@ -250,21 +254,21 @@ export type ItemsListProps<Item extends ItemShape = ItemShape> = Omit<ComponentP
|
|
|
250
254
|
} & StyleProps;
|
|
251
255
|
/** Required inside Group. Let the collection filter suggestions; manually annotate its callback with Autocomplete.ItemType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
252
256
|
export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item>): import("react").JSX.Element;
|
|
253
|
-
export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Group>, 'items' | 'className'> & {
|
|
257
|
+
export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Group>, 'items' | 'className' | 'render'> & {
|
|
254
258
|
className?: string;
|
|
255
259
|
/** Pass group.items from GroupsList, including for an unlabeled group. */
|
|
256
260
|
items: readonly Item[];
|
|
257
261
|
} & StyleProps;
|
|
258
262
|
/** Required wrapper around ItemsList, even for a visually flat list. Pass group.items. A GroupLabel is optional; omit it when the group has an empty label. */
|
|
259
263
|
export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: GroupProps<Item>): import("react").JSX.Element;
|
|
260
|
-
export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Item>, 'value' | 'className'> & {
|
|
264
|
+
export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Item>, 'value' | 'className' | 'render'> & {
|
|
261
265
|
className?: string;
|
|
262
266
|
/** Pass the suggestion supplied by ItemsList so built-in completion can resolve its label. */
|
|
263
267
|
value: Item;
|
|
264
268
|
} & StyleProps;
|
|
265
269
|
/** Required suggestion inside ItemsList. Let it fill the input when chosen; do not implement a duplicate click handler. Keep ItemText inside. */
|
|
266
270
|
export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item>): import("react").JSX.Element;
|
|
267
|
-
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Popup>, 'className'> & {
|
|
271
|
+
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Popup>, 'className' | 'render'> & {
|
|
268
272
|
className?: string;
|
|
269
273
|
} & Pick<BaseAutocomplete.Portal.Props, 'container' | 'keepMounted'> & Pick<BaseAutocomplete.Positioner.Props, 'anchor' | 'positionMethod' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance'> & {
|
|
270
274
|
/** Choose which side of the input to prefer; collisions may change it. @default 'bottom' */
|
|
@@ -277,82 +281,82 @@ export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseAutocomplete.Popu
|
|
|
277
281
|
/** Popup containing Empty, an optional Loading message, and ScrollArea, in that order. Already includes the portal and positioner: do not add either yourself. Defaults to bottom/start with a 5px gap. Core available-space and anchor-width inline styles stay active when preset styling is disabled. */
|
|
278
282
|
export declare function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }: PopupProps): import("react").JSX.Element;
|
|
279
283
|
/** Optional decorative popup arrow. Place inside Popup; the SVG and direction handling are supplied. No children needed. */
|
|
280
|
-
export declare
|
|
284
|
+
export declare function Arrow({ disableStyle, className, style, ref, ...props }: Omit<ComponentProps<'svg'>, 'children' | 'dangerouslySetInnerHTML'> & StyleProps): import("react").JSX.Element;
|
|
281
285
|
/** Optional input adornment container inside InputGroup. Wraps icons, text, or buttons without adding trigger behavior. */
|
|
282
|
-
export declare
|
|
286
|
+
export declare function Addon({ disableStyle, variant, className, ref, ...props }: (ComponentProps<'div'> & {
|
|
283
287
|
/** Use emphasized for a shaded addon. Does not add interaction. @default 'normal' */
|
|
284
|
-
variant?:
|
|
285
|
-
} & StyleProps
|
|
288
|
+
variant?: 'normal' | 'emphasized';
|
|
289
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
286
290
|
/** Clones one supplied icon element, forwarding its ref and preserving its classes. Decorative only; does not open the popup or perform an action. */
|
|
287
|
-
export declare
|
|
288
|
-
/** @default 1.5 */
|
|
289
|
-
strokeWidth?: SVGIconProps["strokeWidth"];
|
|
290
|
-
} & {
|
|
291
|
+
export declare function AddonIcon({ disableStyle, children, className, strokeWidth, ref, ...props }: (IconProps & {
|
|
291
292
|
/** Supply your decorative icon; its own classes are preserved. */
|
|
292
293
|
children: ReactElement<SVGIconProps>;
|
|
293
|
-
} & StyleProps
|
|
294
|
+
}) & StyleProps): ReactElement<SVGIconProps & {
|
|
295
|
+
'data-component'?: string;
|
|
296
|
+
'data-style-disabled'?: string;
|
|
297
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
294
298
|
/** Optional general-purpose button inside Addon. Supply its action yourself. Automatically disabled when Root is disabled or readOnly; defaults to type="button". */
|
|
295
|
-
export declare
|
|
299
|
+
export declare function AddonButton({ disableStyle, className, disabled, type, ref, ...props }: Omit<ComponentProps<'button'>, 'type' | 'disabled'> & {
|
|
296
300
|
/** Keep the default to avoid submitting a surrounding form. @default 'button' */
|
|
297
|
-
type?: ComponentProps<
|
|
301
|
+
type?: ComponentProps<'button'>['type'];
|
|
298
302
|
/** Root disabled or readOnly already disables this button; use for an additional condition. */
|
|
299
|
-
disabled?: ComponentProps<
|
|
300
|
-
} & StyleProps
|
|
303
|
+
disabled?: ComponentProps<'button'>['disabled'];
|
|
304
|
+
} & StyleProps): import("react").JSX.Element;
|
|
301
305
|
/** Use Input with optional Addon controls inside. An opener is optional for typing-driven suggestions. Root validation controls its preset validation border. */
|
|
302
|
-
export declare
|
|
306
|
+
export declare function InputGroup({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.InputGroup.Props, 'className' | 'render'> & {
|
|
303
307
|
className?: string;
|
|
304
|
-
} & StyleProps
|
|
308
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
305
309
|
/** Opens and closes the popup automatically; no click handler needed. Supply its content, normally AddonOpenButtonIcon, and an accessible label. */
|
|
306
|
-
export declare
|
|
310
|
+
export declare function AddonOpenButton({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.Trigger.Props, 'className' | 'render'> & {
|
|
307
311
|
className?: string;
|
|
308
|
-
} & StyleProps
|
|
312
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
309
313
|
/** Clears the input automatically; no click handler needed. Supply AddonClearButtonIcon and an accessible label. */
|
|
310
|
-
export declare
|
|
314
|
+
export declare function AddonClearButton({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.Clear.Props, 'className' | 'render'> & {
|
|
311
315
|
className?: string;
|
|
312
|
-
} & StyleProps
|
|
316
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
313
317
|
/** Optional heading inside Group. Supply group.label as children. Omit this part for an empty label; always keep Group and ItemsList. */
|
|
314
|
-
export declare
|
|
318
|
+
export declare function GroupLabel({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.GroupLabel.Props, 'className' | 'render'> & {
|
|
315
319
|
className?: string;
|
|
316
|
-
} & StyleProps
|
|
320
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
317
321
|
/** Required empty-results message inside Popup, before optional Loading and ScrollArea. Keep mounted statically: Base UI renders its children only when no items match. Do not manually toggle, hide, or conditionally mount it. */
|
|
318
|
-
export declare
|
|
322
|
+
export declare function Empty({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.Empty.Props, 'className' | 'render'> & {
|
|
319
323
|
className?: string;
|
|
320
|
-
} & StyleProps
|
|
324
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
321
325
|
/** Optional visual separator inside the popup. Does not replace Group or any required list containers. */
|
|
322
|
-
export declare
|
|
326
|
+
export declare function Separator({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.Separator.Props, 'className' | 'render'> & {
|
|
323
327
|
className?: string;
|
|
324
|
-
} & StyleProps
|
|
328
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
325
329
|
/** Required label content inside Item. Supply item.label as children; does not derive text from the item automatically. */
|
|
326
|
-
export declare
|
|
330
|
+
export declare function ItemText({ disableStyle, className, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
327
331
|
/** Optional decorative text inside Addon. Supply the text as children. */
|
|
328
|
-
export declare
|
|
332
|
+
export declare function AddonText({ disableStyle, className, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
329
333
|
/** Text content inside Empty. Supply your empty-result message; Empty handles its visibility automatically. */
|
|
330
|
-
export declare
|
|
334
|
+
export declare function EmptyText({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
331
335
|
/** Optional supporting text, announced with the input through aria-describedby automatically. */
|
|
332
|
-
export declare
|
|
336
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
333
337
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
334
338
|
children?: ValidationMessageChildren;
|
|
335
339
|
};
|
|
336
340
|
/** Shows itself only while Root's validation is `'error'`: with no children it shows the message from `['error', message]`, a function children formats that message, and other children replace it. */
|
|
337
|
-
export declare
|
|
341
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
338
342
|
/** Shows itself only while Root's validation is `'success'`: with no children it shows the message from `['success', message]`, a function children formats that message, and other children replace it. */
|
|
339
|
-
export declare
|
|
343
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
340
344
|
type BuiltInIconProps = Omit<SVGIconProps, 'children'> & StyleProps & {
|
|
341
345
|
/** Omit for the supplied default icon; pass a child icon only to replace it. */
|
|
342
346
|
children?: ReactElement<SVGIconProps>;
|
|
343
347
|
};
|
|
344
348
|
/** Built-in decorative open-button icon. Place inside AddonOpenButton. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
345
|
-
export declare
|
|
349
|
+
export declare function AddonOpenButtonIcon({ ref, ...props }: BuiltInIconProps): import("react").JSX.Element;
|
|
346
350
|
/** Built-in decorative clear icon. Place inside AddonClearButton. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
347
|
-
export declare
|
|
351
|
+
export declare function AddonClearButtonIcon({ ref, ...props }: BuiltInIconProps): import("react").JSX.Element;
|
|
348
352
|
/** Optional spinner inside Addon. Does not detect requests: you decide when to render it. Defaults to strokeWidth 1.5. */
|
|
349
|
-
export declare
|
|
353
|
+
export declare function AddonLoadingIcon({ ref, ...props }: BuiltInIconProps): import("react").JSX.Element;
|
|
350
354
|
/** Optional async status inside Popup, below Empty and above ScrollArea. Omit entirely for synchronous items. For async items, keep Loading mounted and conditionally render only LoadingIcon and LoadingText from your request state. Does not detect requests or manage visibility. */
|
|
351
|
-
export declare
|
|
355
|
+
export declare function Loading({ disableStyle, className, ref, ...props }: (Omit<BaseAutocomplete.Status.Props, 'className' | 'render'> & {
|
|
352
356
|
className?: string;
|
|
353
|
-
} & StyleProps
|
|
357
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
354
358
|
/** Text inside Loading. Supply the message only while your request is loading; this part does not detect request state. */
|
|
355
|
-
export declare
|
|
359
|
+
export declare function LoadingText({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
356
360
|
/** Built-in decorative spinner for Loading. No children needed; you control when it is rendered. */
|
|
357
|
-
export declare
|
|
361
|
+
export declare function LoadingIcon({ disableStyle, className, strokeWidth, ref, ...props }: SVGIconProps & StyleProps): import("react").JSX.Element;
|
|
358
362
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete';
|
|
3
3
|
import { ChevronsUpDown, LoaderCircle, X } from "../../utils/icons.js";
|
|
4
|
-
import { cloneElement, createContext,
|
|
4
|
+
import { cloneElement, createContext, useContext, useEffect, useId, useState, } from 'react';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
7
7
|
/**
|
|
@@ -184,26 +184,26 @@ export function Root({ children, id, validation, open, defaultOpen = false, onOp
|
|
|
184
184
|
}, children: children }) }));
|
|
185
185
|
}
|
|
186
186
|
/** Use for the standard stacked layout, or omit when supplying your own layout. */
|
|
187
|
-
export
|
|
187
|
+
export function Container({ disableStyle, className, ref, ...props }) {
|
|
188
188
|
return (_jsx("div", { ...props, ref: ref, "data-component": "autocomplete-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
189
|
-
}
|
|
189
|
+
}
|
|
190
190
|
/** Labels the input automatically using Root's id. Supply the visible label as children; no htmlFor needed. */
|
|
191
|
-
export
|
|
191
|
+
export function Label({ disableStyle, className, ref, ...props }) {
|
|
192
192
|
const context = useAutocompleteContext();
|
|
193
193
|
const attributes = usePartAttributes();
|
|
194
194
|
return (_jsx("label", { ...attributes, ...props, ref: ref, htmlFor: context.inputId, "data-component": "autocomplete-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
195
|
-
}
|
|
195
|
+
}
|
|
196
196
|
/** Let the input handle suggestion filtering and completion. It accepts free text; choosing a suggestion is optional. Label association is automatic. */
|
|
197
|
-
export
|
|
197
|
+
export function Input({ disableStyle, className, 'aria-describedby': describedBy, ref, ...props }) {
|
|
198
198
|
const context = useAutocompleteContext();
|
|
199
199
|
return (_jsx(BaseAutocomplete.Input, { "aria-invalid": context.validation.state === 'error' || undefined, ...props, "aria-describedby": [describedBy, ...context.describedByIds].filter(Boolean).join(' ') || undefined, ref: ref, id: context.inputId, "data-component": "autocomplete-input", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
200
|
-
}
|
|
200
|
+
}
|
|
201
201
|
/** Use only for an additional custom display of the current input text. Do not use it to build the editable input; Input already handles that. */
|
|
202
202
|
export const Value = BaseAutocomplete.Value;
|
|
203
203
|
/** Required listbox and scroll viewport inside Popup. Place GroupsList inside it. Owns keyboard/listbox semantics; do not nest another listbox primitive. */
|
|
204
|
-
export
|
|
204
|
+
export function ScrollArea({ disableStyle, className, style, ref, ...props }) {
|
|
205
205
|
return (_jsx(BaseAutocomplete.List, { ...props, ref: ref, style: style, "data-component": "autocomplete-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
206
|
-
}
|
|
206
|
+
}
|
|
207
207
|
/** Required groups container inside ScrollArea. A children callback receives each automatically filtered group; do not filter or map the original groups again. Manually annotate group with Autocomplete.GroupType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
208
208
|
export function GroupsList({ disableStyle, children, className, style, ...props }) {
|
|
209
209
|
return (_jsx("div", { ...props, style: style, "data-component": "autocomplete-groupslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseAutocomplete.Collection, { children: children })) : (children) }));
|
|
@@ -231,15 +231,15 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
|
|
|
231
231
|
: { ...baseStyle, ...style } }) }) }));
|
|
232
232
|
}
|
|
233
233
|
/** Optional decorative popup arrow. Place inside Popup; the SVG and direction handling are supplied. No children needed. */
|
|
234
|
-
export
|
|
234
|
+
export function Arrow({ disableStyle, className, style, ref, ...props }) {
|
|
235
235
|
return (_jsxs(BaseAutocomplete.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "autocomplete-arrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [_jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", "data-component": "autocomplete-arrow-1" }), _jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", "data-component": "autocomplete-arrow-2" }), _jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", "data-component": "autocomplete-arrow-3" })] }));
|
|
236
|
-
}
|
|
236
|
+
}
|
|
237
237
|
/** Optional input adornment container inside InputGroup. Wraps icons, text, or buttons without adding trigger behavior. */
|
|
238
|
-
export
|
|
238
|
+
export function Addon({ disableStyle, variant = 'normal', className, ref, ...props }) {
|
|
239
239
|
return (_jsx("div", { ...props, ref: ref, "data-variant": variant, "data-component": "autocomplete-addon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
240
|
-
}
|
|
240
|
+
}
|
|
241
241
|
/** Clones one supplied icon element, forwarding its ref and preserving its classes. Decorative only; does not open the popup or perform an action. */
|
|
242
|
-
export
|
|
242
|
+
export function AddonIcon({ disableStyle, children, className, strokeWidth = 1.5, ref, ...props }) {
|
|
243
243
|
const attributes = usePartAttributes();
|
|
244
244
|
return cloneElement(children, {
|
|
245
245
|
...attributes,
|
|
@@ -251,95 +251,95 @@ export const AddonIcon = /* @__PURE__ */ forwardRef(function AddonIcon({ disable
|
|
|
251
251
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
252
252
|
className: twMerge(children.props.className, className),
|
|
253
253
|
});
|
|
254
|
-
}
|
|
254
|
+
}
|
|
255
255
|
/** Optional general-purpose button inside Addon. Supply its action yourself. Automatically disabled when Root is disabled or readOnly; defaults to type="button". */
|
|
256
|
-
export
|
|
256
|
+
export function AddonButton({ disableStyle, className, disabled, type = 'button', ref, ...props }) {
|
|
257
257
|
const context = useAutocompleteContext();
|
|
258
258
|
const attributes = usePartAttributes();
|
|
259
259
|
return (_jsx("button", { ...attributes, ...props, ref: ref, type: type, disabled: disabled || context.disabled || context.readOnly, "data-component": "autocomplete-addonbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
260
|
-
}
|
|
260
|
+
}
|
|
261
261
|
/** Use Input with optional Addon controls inside. An opener is optional for typing-driven suggestions. Root validation controls its preset validation border. */
|
|
262
|
-
export
|
|
262
|
+
export function InputGroup({ disableStyle, className, ref, ...props }) {
|
|
263
263
|
const context = useAutocompleteContext();
|
|
264
264
|
return (_jsx(BaseAutocomplete.InputGroup, { ...validationAttributes(context.validation), ...props, ref: ref, "data-component": "autocomplete-inputgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
265
|
-
}
|
|
265
|
+
}
|
|
266
266
|
/** Opens and closes the popup automatically; no click handler needed. Supply its content, normally AddonOpenButtonIcon, and an accessible label. */
|
|
267
|
-
export
|
|
267
|
+
export function AddonOpenButton({ disableStyle, className, ref, ...props }) {
|
|
268
268
|
return (_jsx(BaseAutocomplete.Trigger, { ...props, ref: ref, "data-component": "autocomplete-addonopenbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
269
|
-
}
|
|
269
|
+
}
|
|
270
270
|
/** Clears the input automatically; no click handler needed. Supply AddonClearButtonIcon and an accessible label. */
|
|
271
|
-
export
|
|
271
|
+
export function AddonClearButton({ disableStyle, className, ref, ...props }) {
|
|
272
272
|
return (_jsx(BaseAutocomplete.Clear, { ...props, ref: ref, "data-component": "autocomplete-addonclearbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
273
|
-
}
|
|
273
|
+
}
|
|
274
274
|
/** Optional heading inside Group. Supply group.label as children. Omit this part for an empty label; always keep Group and ItemsList. */
|
|
275
|
-
export
|
|
275
|
+
export function GroupLabel({ disableStyle, className, ref, ...props }) {
|
|
276
276
|
return (_jsx(BaseAutocomplete.GroupLabel, { ...props, ref: ref, "data-component": "autocomplete-grouplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
277
|
-
}
|
|
277
|
+
}
|
|
278
278
|
/** Required empty-results message inside Popup, before optional Loading and ScrollArea. Keep mounted statically: Base UI renders its children only when no items match. Do not manually toggle, hide, or conditionally mount it. */
|
|
279
|
-
export
|
|
279
|
+
export function Empty({ disableStyle, className, ref, ...props }) {
|
|
280
280
|
return (_jsx(BaseAutocomplete.Empty, { ...props, ref: ref, "data-component": "autocomplete-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
281
|
-
}
|
|
281
|
+
}
|
|
282
282
|
/** Optional visual separator inside the popup. Does not replace Group or any required list containers. */
|
|
283
|
-
export
|
|
283
|
+
export function Separator({ disableStyle, className, ref, ...props }) {
|
|
284
284
|
return (_jsx(BaseAutocomplete.Separator, { ...props, ref: ref, "data-component": "autocomplete-separator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
285
|
-
}
|
|
285
|
+
}
|
|
286
286
|
/** Required label content inside Item. Supply item.label as children; does not derive text from the item automatically. */
|
|
287
|
-
export
|
|
287
|
+
export function ItemText({ disableStyle, className, ref, ...props }) {
|
|
288
288
|
const attributes = usePartAttributes();
|
|
289
289
|
return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "autocomplete-itemtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
290
|
-
}
|
|
290
|
+
}
|
|
291
291
|
/** Optional decorative text inside Addon. Supply the text as children. */
|
|
292
|
-
export
|
|
292
|
+
export function AddonText({ disableStyle, className, ref, ...props }) {
|
|
293
293
|
const attributes = usePartAttributes();
|
|
294
294
|
return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "autocomplete-addontext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
295
|
-
}
|
|
295
|
+
}
|
|
296
296
|
/** Text content inside Empty. Supply your empty-result message; Empty handles its visibility automatically. */
|
|
297
|
-
export
|
|
297
|
+
export function EmptyText({ disableStyle, className, ref, ...props }) {
|
|
298
298
|
const attributes = usePartAttributes();
|
|
299
299
|
return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "autocomplete-emptytext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
300
|
-
}
|
|
300
|
+
}
|
|
301
301
|
/** Optional supporting text, announced with the input through aria-describedby automatically. */
|
|
302
|
-
export
|
|
302
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
303
303
|
const describedById = useDescribedById(id);
|
|
304
304
|
const attributes = usePartAttributes();
|
|
305
305
|
return (_jsx("div", { ...attributes, ...props, id: describedById, ref: ref, "data-component": "autocomplete-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
306
|
-
}
|
|
306
|
+
}
|
|
307
307
|
/** Shows itself only while Root's validation is `'error'`: with no children it shows the message from `['error', message]`, a function children formats that message, and other children replace it. */
|
|
308
|
-
export
|
|
308
|
+
export function Error({ children, ref, ...props }) {
|
|
309
309
|
const context = useAutocompleteContext();
|
|
310
310
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
311
311
|
if (content === undefined)
|
|
312
312
|
return null;
|
|
313
313
|
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "autocomplete-error", children: content });
|
|
314
|
-
}
|
|
314
|
+
}
|
|
315
315
|
/** Shows itself only while Root's validation is `'success'`: with no children it shows the message from `['success', message]`, a function children formats that message, and other children replace it. */
|
|
316
|
-
export
|
|
316
|
+
export function Success({ children, ref, ...props }) {
|
|
317
317
|
const context = useAutocompleteContext();
|
|
318
318
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
319
319
|
if (content === undefined)
|
|
320
320
|
return null;
|
|
321
321
|
return _jsx(Message, { ...props, ref: ref, role: "status", component: "autocomplete-success", children: content });
|
|
322
|
-
}
|
|
322
|
+
}
|
|
323
323
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the input
|
|
324
|
-
|
|
324
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
325
325
|
const describedById = useDescribedById(id);
|
|
326
326
|
const attributes = usePartAttributes();
|
|
327
327
|
return _jsx("div", { "aria-atomic": "true", ...attributes, ...props, id: describedById, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
328
|
-
}
|
|
328
|
+
}
|
|
329
329
|
/** Built-in decorative open-button icon. Place inside AddonOpenButton. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
330
|
-
export
|
|
330
|
+
export function AddonOpenButtonIcon({ ref, ...props }) {
|
|
331
331
|
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: ChevronsUpDown, component: "autocomplete-addonopenbuttonicon" });
|
|
332
|
-
}
|
|
332
|
+
}
|
|
333
333
|
/** Built-in decorative clear icon. Place inside AddonClearButton. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
334
|
-
export
|
|
334
|
+
export function AddonClearButtonIcon({ ref, ...props }) {
|
|
335
335
|
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: X, component: "autocomplete-addonclearbuttonicon" });
|
|
336
|
-
}
|
|
336
|
+
}
|
|
337
337
|
/** Optional spinner inside Addon. Does not detect requests: you decide when to render it. Defaults to strokeWidth 1.5. */
|
|
338
|
-
export
|
|
338
|
+
export function AddonLoadingIcon({ ref, ...props }) {
|
|
339
339
|
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: LoaderCircle, component: "autocomplete-addonloadingicon" });
|
|
340
|
-
}
|
|
340
|
+
}
|
|
341
341
|
// The shared body of the built-in decorative icons above, which only differ by their icon and component name
|
|
342
|
-
|
|
342
|
+
function BuiltInIcon({ disableStyle, className, strokeWidth, icon: Icon, component, children, ref, ...props }) {
|
|
343
343
|
const attributes = usePartAttributes();
|
|
344
344
|
return cloneElement(children ?? _jsx(Icon, {}), {
|
|
345
345
|
...attributes,
|
|
@@ -351,19 +351,19 @@ const BuiltInIcon = /* @__PURE__ */ forwardRef(function BuiltInIcon({ disableSty
|
|
|
351
351
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
352
352
|
className: twMerge(children?.props.className, className),
|
|
353
353
|
});
|
|
354
|
-
}
|
|
354
|
+
}
|
|
355
355
|
/** Optional async status inside Popup, below Empty and above ScrollArea. Omit entirely for synchronous items. For async items, keep Loading mounted and conditionally render only LoadingIcon and LoadingText from your request state. Does not detect requests or manage visibility. */
|
|
356
|
-
export
|
|
356
|
+
export function Loading({ disableStyle, className, ref, ...props }) {
|
|
357
357
|
return (_jsx(BaseAutocomplete.Status, { ...props, ref: ref, "data-component": "autocomplete-loading", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
358
|
-
}
|
|
358
|
+
}
|
|
359
359
|
/** Text inside Loading. Supply the message only while your request is loading; this part does not detect request state. */
|
|
360
|
-
export
|
|
360
|
+
export function LoadingText({ disableStyle, className, ref, ...props }) {
|
|
361
361
|
return (_jsx("div", { ...props, ref: ref, "data-component": "autocomplete-loadingtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
362
|
-
}
|
|
362
|
+
}
|
|
363
363
|
/** Built-in decorative spinner for Loading. No children needed; you control when it is rendered. */
|
|
364
|
-
export
|
|
364
|
+
export function LoadingIcon({ disableStyle, className, strokeWidth = 2, ref, ...props }) {
|
|
365
365
|
return (_jsx(LoaderCircle, { "aria-hidden": true, strokeWidth: strokeWidth, ...props, ref: ref, "data-component": "autocomplete-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
366
|
-
}
|
|
366
|
+
}
|
|
367
367
|
const AutocompleteContext =
|
|
368
368
|
/* @__PURE__ */ createContext(null);
|
|
369
369
|
function useAutocompleteContext() {
|