@central-ui/react 0.2.0 → 0.4.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 +57 -49
- package/dist/components/autocomplete/index.js +69 -60
- 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 +189 -0
- package/dist/components/carousel/index.js +303 -0
- package/dist/components/checkbox/index.d.ts +12 -11
- package/dist/components/checkbox/index.js +21 -21
- package/dist/components/combobox/index.d.ts +67 -71
- package/dist/components/combobox/index.js +80 -72
- 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/empty/index.d.ts +2 -1
- package/dist/components/empty/index.js +2 -1
- package/dist/components/exception/index.d.ts +98 -0
- package/dist/components/exception/index.js +116 -0
- 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/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 +32 -29
- package/dist/components/select/index.js +45 -35
- package/dist/components/slider/index.d.ts +20 -20
- package/dist/components/slider/index.js +27 -27
- package/dist/components/stepper/index.d.ts +8 -7
- package/dist/components/stepper/index.js +4 -2
- 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 +2 -0
- package/dist/index.js +2 -0
- package/dist/utils/icons.d.ts +92 -23
- package/dist/utils/icons.js +3 -3
- package/package.json +69 -67
- package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -28
- package/src/presets/shopify-polaris/shopify-polaris-carousel.css +62 -0
- package/src/presets/shopify-polaris/shopify-polaris-exception.css +40 -0
- package/src/presets/shopify-polaris/shopify-polaris.css +2 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -28
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-carousel.css +55 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-exception.css +40 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +2 -0
- package/dist/types/Tone.d.ts +0 -3
- package/dist/types/Tone.js +0 -1
- package/dist/utils/Tone.d.ts +0 -2
- package/dist/utils/Tone.js +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { asChildRendering } from "../../utils/asChild.js";
|
|
3
3
|
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
4
|
-
import { cloneElement
|
|
4
|
+
import { cloneElement } from 'react';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { X } from "../../utils/icons.js";
|
|
7
7
|
/**
|
|
@@ -43,10 +43,10 @@ export function Root(props) {
|
|
|
43
43
|
return _jsx(BasePopover.Root, { ...props });
|
|
44
44
|
}
|
|
45
45
|
/** Opens the popover. Pass asChild to give this behavior to your own element, like your app's Button. */
|
|
46
|
-
export
|
|
46
|
+
export function OpenButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
47
47
|
const rendering = asChildRendering({ asChild, children, component: 'popover-openbutton', disableStyle });
|
|
48
48
|
return _jsx(BasePopover.Trigger, { ...props, ref: ref, ...rendering });
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
51
51
|
export function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side = 'bottom', sideOffset = 5, align = 'start', alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }) {
|
|
52
52
|
const baseStyle = {
|
|
@@ -57,31 +57,31 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
|
|
|
57
57
|
? (state) => ({ ...baseStyle, ...style(state) })
|
|
58
58
|
: { ...baseStyle, ...style } }) }) }));
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export function Arrow({ disableStyle, className, style, ref, ...props }) {
|
|
61
61
|
return (_jsxs(BasePopover.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "popover-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": "popover-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": "popover-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": "popover-arrow-3" })] }));
|
|
62
|
-
}
|
|
63
|
-
export
|
|
62
|
+
}
|
|
63
|
+
export function Header({ disableStyle, className, ref, ...props }) {
|
|
64
64
|
return (_jsx("div", { ...props, ref: ref, "data-component": "popover-header", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
65
|
-
}
|
|
66
|
-
export
|
|
65
|
+
}
|
|
66
|
+
export function Body({ disableStyle, className, ref, ...props }) {
|
|
67
67
|
return (_jsx("div", { ...props, ref: ref, "data-component": "popover-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
68
|
-
}
|
|
69
|
-
export
|
|
68
|
+
}
|
|
69
|
+
export function Footer({ disableStyle, className, ref, ...props }) {
|
|
70
70
|
return (_jsx("div", { ...props, ref: ref, "data-component": "popover-footer", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
71
|
-
}
|
|
72
|
-
export
|
|
71
|
+
}
|
|
72
|
+
export function Title({ disableStyle, className, ref, ...props }) {
|
|
73
73
|
return (_jsx(BasePopover.Title, { ...props, ref: ref, "data-component": "popover-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
74
|
-
}
|
|
75
|
-
export
|
|
74
|
+
}
|
|
75
|
+
export function Description({ disableStyle, className, ref, ...props }) {
|
|
76
76
|
return (_jsx(BasePopover.Description, { ...props, ref: ref, "data-component": "popover-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
77
|
-
}
|
|
77
|
+
}
|
|
78
78
|
/** Icon-only: put just a CloseButtonIcon inside, never text like "Close". Name it for screen readers with aria-label instead, e.g. aria-label="Close". Pass asChild to give closing behavior to your own button instead, like a "Done" Button. */
|
|
79
|
-
export
|
|
79
|
+
export function CloseButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
80
80
|
const rendering = asChildRendering({ asChild, children, component: 'popover-closebutton', disableStyle });
|
|
81
81
|
return _jsx(BasePopover.Close, { ...props, ref: ref, ...rendering });
|
|
82
|
-
}
|
|
82
|
+
}
|
|
83
83
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
84
|
-
export
|
|
84
|
+
export function CloseButtonIcon({ disableStyle, children, className, ref, ...props }) {
|
|
85
85
|
return cloneElement(children ?? _jsx(X, {}), {
|
|
86
86
|
...props,
|
|
87
87
|
ref,
|
|
@@ -91,5 +91,6 @@ export const CloseButtonIcon = /* @__PURE__ */ forwardRef(function CloseButtonIc
|
|
|
91
91
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
92
92
|
},
|
|
93
93
|
className: twMerge(children?.props.className, className),
|
|
94
|
+
strokeWidth: props.strokeWidth ?? children?.props.strokeWidth ?? 2,
|
|
94
95
|
});
|
|
95
|
-
}
|
|
96
|
+
}
|
|
@@ -65,30 +65,30 @@ export type RootProps<Value = string> = Omit<BaseRadioGroup.Props<Value>, 'rende
|
|
|
65
65
|
* </Radio.Root>
|
|
66
66
|
*/
|
|
67
67
|
export declare function Root<Value>({ children, validation, ...props }: RootProps<Value>): import("react").JSX.Element;
|
|
68
|
-
export declare
|
|
69
|
-
export declare
|
|
68
|
+
export declare function Container({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
69
|
+
export declare function List({ disableStyle, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
70
70
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
71
|
-
export declare
|
|
71
|
+
export declare function Label({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
72
72
|
type ItemCoreKeys = 'value' | 'disabled' | 'readOnly' | 'required' | 'inputRef';
|
|
73
73
|
export type ItemProps<Value = string> = Omit<ComponentProps<'div'>, 'children'> & Pick<BaseRadio.Root.Props<Value>, ItemCoreKeys> & {
|
|
74
74
|
children: ReactNode;
|
|
75
75
|
} & StyleProps;
|
|
76
76
|
export declare function Item<Value>({ disableStyle, children, value, disabled, readOnly, required, inputRef, id, className, ...props }: ItemProps<Value>): import("react").JSX.Element;
|
|
77
|
-
export declare
|
|
77
|
+
export declare function ItemButton({ disableStyle, className, ref, ...props }: (Omit<BaseRadio.Root.Props, 'value' | 'disabled' | 'readOnly' | 'required' | 'inputRef' | 'id' | 'className' | 'render' | 'nativeButton'> & {
|
|
78
78
|
className?: string;
|
|
79
|
-
} & StyleProps
|
|
79
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
80
80
|
/** Tracks the surrounding item state automatically. Keep it mounted; do not add your own visibility condition. Use the supplied default visual unless customization is needed. */
|
|
81
|
-
export declare
|
|
81
|
+
export declare function ItemIndicator({ disableStyle, children, className, ref, ...props }: (Omit<BaseRadio.Indicator.Props, 'className' | 'render'> & {
|
|
82
82
|
className?: string;
|
|
83
|
-
} & StyleProps
|
|
84
|
-
export declare
|
|
85
|
-
export declare
|
|
86
|
-
export declare
|
|
83
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
84
|
+
export declare function ItemLabel({ disableStyle, className, ref, ...props }: Omit<ComponentProps<'label'>, 'htmlFor'> & StyleProps): import("react").JSX.Element;
|
|
85
|
+
export declare function ItemDescription({ disableStyle, className, id, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
86
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
87
87
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
88
88
|
children?: ValidationMessageChildren;
|
|
89
89
|
};
|
|
90
90
|
/** 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. */
|
|
91
|
-
export declare
|
|
91
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
92
92
|
/** 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. */
|
|
93
|
-
export declare
|
|
93
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
94
94
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
3
|
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
4
|
-
import { createContext, useCallback,
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useId, useState, } from 'react';
|
|
5
5
|
import { readValidation, validationAttributes, validationMessageContent, } from "../../utils/Validation.js";
|
|
6
6
|
/**
|
|
7
7
|
* Root owns the chosen value. For each choice keep Item, ItemButton, ItemIndicator, and ItemLabel together. The indicator follows selection automatically; do not manage a separate checked state for each item.
|
|
@@ -79,16 +79,16 @@ export function Root({ children, validation, ...props }) {
|
|
|
79
79
|
}, children: _jsx(_Fragment, { children: children }) }));
|
|
80
80
|
}, children: children }));
|
|
81
81
|
}
|
|
82
|
-
export
|
|
82
|
+
export function Container({ disableStyle, className, ref, ...props }) {
|
|
83
83
|
return (_jsx("div", { ...props, ref: ref, "data-component": "radio-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
84
|
-
}
|
|
85
|
-
export
|
|
84
|
+
}
|
|
85
|
+
export function List({ disableStyle, ref, ...props }) {
|
|
86
86
|
const context = useRadioContext();
|
|
87
87
|
const { ref: nativeRef, ...nativeProps } = context.elementProps;
|
|
88
88
|
return (_jsx("div", { ...nativeProps, ...props, ref: useRootRef(nativeRef, ref), "data-component": "radio-list", "data-style-disabled": disableStyle ? '' : undefined, className: props.className }));
|
|
89
|
-
}
|
|
89
|
+
}
|
|
90
90
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
91
|
-
export
|
|
91
|
+
export function Label({ disableStyle, className, id, ref, ...props }) {
|
|
92
92
|
const generatedId = useId();
|
|
93
93
|
const labelId = id ?? generatedId;
|
|
94
94
|
const context = useRadioContext();
|
|
@@ -97,7 +97,7 @@ export const Label = /* @__PURE__ */ forwardRef(function Label({ disableStyle, c
|
|
|
97
97
|
return () => context.setLabelIds((current) => current.filter((value) => value !== labelId));
|
|
98
98
|
}, [labelId, context.setLabelIds]);
|
|
99
99
|
return (_jsx("div", { ...props, id: labelId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "radio-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
export function Item({ disableStyle, children, value, disabled, readOnly, required, inputRef, id, className, ...props }) {
|
|
102
102
|
const generatedId = useId();
|
|
103
103
|
const group = useRadioContext();
|
|
@@ -123,22 +123,22 @@ export function Item({ disableStyle, children, value, disabled, readOnly, requir
|
|
|
123
123
|
setMessageIds,
|
|
124
124
|
}, children: _jsx("div", { ...props, "data-component": "radio-item", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children }) }));
|
|
125
125
|
}
|
|
126
|
-
export
|
|
126
|
+
export function ItemButton({ disableStyle, className, ref, ...props }) {
|
|
127
127
|
const item = useItemContext();
|
|
128
128
|
const group = useRadioContext();
|
|
129
129
|
return (_jsx(BaseRadio.Root, { ...props, ...item.coreProps, ref: ref, "aria-describedby": [props['aria-describedby'], ...group.messageIds, ...item.messageIds]
|
|
130
130
|
.filter(Boolean)
|
|
131
131
|
.join(' ') || undefined, "aria-invalid": group.validation.state === 'error' || props['aria-invalid'] || undefined, ...validationAttributes(group.validation), "data-component": "radio-itembutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(RadioButtonSurface, { ...buttonProps, state: state })) }));
|
|
132
|
-
}
|
|
132
|
+
}
|
|
133
133
|
/** Tracks the surrounding item state automatically. Keep it mounted; do not add your own visibility condition. Use the supplied default visual unless customization is needed. */
|
|
134
|
-
export
|
|
134
|
+
export function ItemIndicator({ disableStyle, children, className, ref, ...props }) {
|
|
135
135
|
return (_jsx(BaseRadio.Indicator, { ...props, ref: ref, "data-component": "radio-itemindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children }));
|
|
136
|
-
}
|
|
137
|
-
export
|
|
136
|
+
}
|
|
137
|
+
export function ItemLabel({ disableStyle, className, ref, ...props }) {
|
|
138
138
|
const item = useItemContext();
|
|
139
139
|
return (_jsx("label", { ...props, ref: ref, htmlFor: item.coreProps.id, "data-disabled": item.state.disabled ? '' : undefined, "data-component": "radio-itemlabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
140
|
-
}
|
|
141
|
-
export
|
|
140
|
+
}
|
|
141
|
+
export function ItemDescription({ disableStyle, className, id, ref, ...props }) {
|
|
142
142
|
const generatedId = useId();
|
|
143
143
|
const messageId = id ?? generatedId;
|
|
144
144
|
const item = useItemContext();
|
|
@@ -147,34 +147,34 @@ export const ItemDescription = /* @__PURE__ */ forwardRef(function ItemDescripti
|
|
|
147
147
|
return () => item.setMessageIds((current) => current.filter((value) => value !== messageId));
|
|
148
148
|
}, [messageId, item.setMessageIds]);
|
|
149
149
|
return (_jsx("span", { ...props, ref: ref, id: messageId, "data-disabled": item.state.disabled ? '' : undefined, "data-checked": item.state.checked ? '' : undefined, "data-component": "radio-itemdescription", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
150
|
-
}
|
|
151
|
-
export
|
|
150
|
+
}
|
|
151
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
152
152
|
const messageId = useMessageId(id);
|
|
153
153
|
const context = useRadioContext();
|
|
154
154
|
return (_jsx("div", { ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "radio-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
155
|
-
}
|
|
155
|
+
}
|
|
156
156
|
/** 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. */
|
|
157
|
-
export
|
|
157
|
+
export function Error({ children, ref, ...props }) {
|
|
158
158
|
const context = useRadioContext();
|
|
159
159
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
160
160
|
if (content === undefined)
|
|
161
161
|
return null;
|
|
162
162
|
return (_jsx(Message, { ...props, ref: ref, role: "alert", component: "radio-error", children: content }));
|
|
163
|
-
}
|
|
163
|
+
}
|
|
164
164
|
/** 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. */
|
|
165
|
-
export
|
|
165
|
+
export function Success({ children, ref, ...props }) {
|
|
166
166
|
const context = useRadioContext();
|
|
167
167
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
168
168
|
if (content === undefined)
|
|
169
169
|
return null;
|
|
170
170
|
return (_jsx(Message, { ...props, ref: ref, role: "status", component: "radio-success", children: content }));
|
|
171
|
-
}
|
|
171
|
+
}
|
|
172
172
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the group
|
|
173
|
-
|
|
173
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
174
174
|
const messageId = useMessageId(id);
|
|
175
175
|
const context = useRadioContext();
|
|
176
176
|
return (_jsx("div", { "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, ...validationAttributes(context.validation), "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
177
|
-
}
|
|
177
|
+
}
|
|
178
178
|
const RadioContext = /* @__PURE__ */ createContext(null);
|
|
179
179
|
function useRadioContext() {
|
|
180
180
|
const context = useContext(RadioContext);
|
|
@@ -190,7 +190,7 @@ function useItemContext() {
|
|
|
190
190
|
return context;
|
|
191
191
|
}
|
|
192
192
|
// Rendered by Base UI as the radio element, it reports Base UI's live state back to the item's mirror
|
|
193
|
-
|
|
193
|
+
function RadioButtonSurface({ state, ref, ...props }) {
|
|
194
194
|
const context = useItemContext();
|
|
195
195
|
useEffect(() => {
|
|
196
196
|
context.setState({
|
|
@@ -201,7 +201,7 @@ const RadioButtonSurface = /* @__PURE__ */ forwardRef(function RadioButtonSurfac
|
|
|
201
201
|
});
|
|
202
202
|
}, [state.checked, state.disabled, state.readOnly, state.required, context.setState]);
|
|
203
203
|
return _jsx("span", { ...props, ref: ref });
|
|
204
|
-
}
|
|
204
|
+
}
|
|
205
205
|
// Registering a message part's id in the group's and buttons' aria-describedby while the part is mounted
|
|
206
206
|
function useMessageId(id) {
|
|
207
207
|
const generatedId = useId();
|
|
@@ -40,7 +40,7 @@ export declare function Root({ children, validation, ...props }: Omit<RatingGrou
|
|
|
40
40
|
/** The rating's validation state, with an optional message: `'error'` styles it as invalid, `['error', 'Rate your delivery']` also shows that message in Error. Same for `'success'` and Success. Omit it for a neutral rating. */
|
|
41
41
|
validation?: Validation;
|
|
42
42
|
}): import("react").JSX.Element;
|
|
43
|
-
export declare
|
|
43
|
+
export declare function Container({ disableStyle, children, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
44
44
|
export declare function Label({ disableStyle, className, ...props }: Omit<RatingGroupLabelProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
45
45
|
/** Calls children for each rating index. Pass the supplied index to StarButton; do not create a second hover or selection state. */
|
|
46
46
|
export declare function StarsList({ disableStyle, className, children, ...props }: (Omit<RatingGroupControlProps, 'asChild' | 'children'> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RatingGroup, useRatingGroup, useRatingGroupContext, } from '@ark-ui/react/rating-group';
|
|
3
3
|
import { Star as DefaultStarIcon } from "../../utils/icons.js";
|
|
4
|
-
import { cloneElement, createContext,
|
|
4
|
+
import { cloneElement, createContext, useContext, useId, Fragment } from 'react';
|
|
5
5
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
6
6
|
/**
|
|
7
7
|
* Root configures the scale and selection. StarsList supplies indices; use StarButton with StarIcon for each rating. Highlight, checked, and half-star appearance are built in; do not recreate hover state.
|
|
@@ -39,10 +39,10 @@ export function Root({ children, validation, ...props }) {
|
|
|
39
39
|
const rating = useRatingGroup(props);
|
|
40
40
|
return (_jsx(RootPropsContext.Provider, { value: { validation: readValidation(validation) }, children: _jsx(RatingGroup.RootProvider, { value: rating, asChild: true, children: _jsx(_Fragment, { children: children }) }) }));
|
|
41
41
|
}
|
|
42
|
-
export
|
|
42
|
+
export function Container({ disableStyle, children, className, ref, ...props }) {
|
|
43
43
|
const root = useRootPropsContext();
|
|
44
44
|
return (_jsxs("div", { ...props, ref: ref, ...validationAttributes(root.validation), "data-component": "ratinginput-container", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [children, _jsx(RatingGroup.HiddenInput, { style: { display: 'none' } })] }));
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
export function Label({ disableStyle, className, ...props }) {
|
|
47
47
|
return (_jsx(RatingGroup.Label, { ...props, "data-component": "ratinginput-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
48
48
|
}
|
|
@@ -115,23 +115,23 @@ export type RootProps<T extends readonly GroupShape[], Multiple extends boolean
|
|
|
115
115
|
* </Select.Root>
|
|
116
116
|
*/
|
|
117
117
|
export declare function Root<T extends readonly GroupShape[], Multiple extends boolean | undefined = false>({ children, items, id, validation, defaultOpen, onOpenChange, ...props }: RootProps<T, Multiple>): import("react").JSX.Element;
|
|
118
|
-
export declare
|
|
119
|
-
export declare
|
|
118
|
+
export declare function Container({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
119
|
+
export declare function Label({ disableStyle, className, ref, ...props }: (Omit<BaseSelect.Label.Props, 'className' | 'render'> & {
|
|
120
120
|
className?: string;
|
|
121
|
-
} & StyleProps
|
|
121
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
122
122
|
export declare const Value: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectValueProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
123
|
-
export type OpenButtonValueProps<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null> = Omit<ComponentPropsWithRef<typeof BaseSelect.Value>, 'className' | 'children'> & {
|
|
123
|
+
export type OpenButtonValueProps<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null> = Omit<ComponentPropsWithRef<typeof BaseSelect.Value>, 'className' | 'children' | 'render'> & {
|
|
124
124
|
className?: string;
|
|
125
125
|
/** Omit to keep the automatic formatted selection. Only for a custom display, annotate the callback with ItemType<typeof rootItems> or SelectionsType<typeof rootItems> for multiple selection, using the same items as Root. */
|
|
126
126
|
children?: ReactNode | ((value: Value) => ReactNode);
|
|
127
127
|
} & StyleProps;
|
|
128
128
|
/** Omit children to keep the built-in formatted value. Supply children only for a special display; do not format the selection yourself for the usual case. */
|
|
129
129
|
export declare function OpenButtonValue<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null>({ disableStyle, className, ...props }: OpenButtonValueProps<Value>): import("react").JSX.Element;
|
|
130
|
-
export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseSelect.List>, 'children' | 'className'> & {
|
|
130
|
+
export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseSelect.List>, 'children' | 'className' | 'render'> & {
|
|
131
131
|
className?: string;
|
|
132
132
|
children?: ReactNode;
|
|
133
133
|
} & StyleProps;
|
|
134
|
-
export declare
|
|
134
|
+
export declare function ScrollArea({ disableStyle, className, ref, ...props }: ScrollAreaProps): import("react").JSX.Element;
|
|
135
135
|
export type GroupsListProps<Group extends GroupShape = GroupShape> = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
136
136
|
/** Return Group with ItemsList. Manually annotate group with Select.GroupType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
137
137
|
children: ReactNode | ((group: Group, index: number) => ReactNode);
|
|
@@ -145,58 +145,61 @@ export type ItemsListProps<Item extends ItemShape = ItemShape> = Omit<ComponentP
|
|
|
145
145
|
} & StyleProps;
|
|
146
146
|
/** Let this list render the surrounding group. Manually annotate its callback with Select.ItemType<typeof rootItems>, using the SAME items variable passed to Root. */
|
|
147
147
|
export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item>): import("react").JSX.Element;
|
|
148
|
-
export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Group>, 'className'> & {
|
|
148
|
+
export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Group>, 'className' | 'render'> & {
|
|
149
149
|
className?: string;
|
|
150
150
|
/** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
|
|
151
151
|
items: readonly Item[];
|
|
152
152
|
} & StyleProps;
|
|
153
153
|
export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, items, children, className, ...props }: GroupProps<Item>): import("react").JSX.Element;
|
|
154
|
-
export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Item>, 'value' | 'className'> & {
|
|
154
|
+
export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Item>, 'value' | 'className' | 'render'> & {
|
|
155
155
|
className?: string;
|
|
156
156
|
/** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
|
|
157
157
|
/** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
|
|
158
158
|
value: Item;
|
|
159
159
|
} & StyleProps;
|
|
160
160
|
export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item>): import("react").JSX.Element;
|
|
161
|
-
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseSelect.Popup>, 'className'> & {
|
|
161
|
+
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseSelect.Popup>, 'className' | 'render'> & {
|
|
162
162
|
className?: string;
|
|
163
163
|
} & Pick<BaseSelect.Portal.Props, 'container'> & Pick<BaseSelect.Positioner.Props, 'anchor' | 'positionMethod' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance' | 'alignItemWithTrigger'> & StyleProps;
|
|
164
164
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
165
165
|
export declare function Popup({ disableStyle, container, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, alignItemWithTrigger, className, style, ...props }: PopupProps): import("react").JSX.Element;
|
|
166
|
-
export declare
|
|
166
|
+
export declare function Arrow({ disableStyle, className, style, ref, ...props }: Omit<ComponentProps<'svg'>, 'children' | 'dangerouslySetInnerHTML'> & StyleProps): import("react").JSX.Element;
|
|
167
167
|
/** Opens the select. Pass asChild to make your own button the trigger instead, like a "Sort" Button. */
|
|
168
|
-
export declare
|
|
168
|
+
export declare function OpenButton({ asChild, disableStyle, children, 'aria-describedby': describedBy, ref, ...props }: Omit<BaseSelect.Trigger.Props, 'className' | 'render'> & {
|
|
169
169
|
className?: string;
|
|
170
|
-
} & AsChildProps & StyleProps
|
|
170
|
+
} & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
171
171
|
/** Omit for an unlabeled/flat-looking group; keep the Group wrapper. Supply the heading only when grouping should be visible. */
|
|
172
|
-
export declare
|
|
172
|
+
export declare function GroupLabel({ disableStyle, className, ref, ...props }: (Omit<BaseSelect.GroupLabel.Props, 'className' | 'render'> & {
|
|
173
173
|
className?: string;
|
|
174
|
-
} & StyleProps
|
|
175
|
-
export declare
|
|
174
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
175
|
+
export declare function Separator({ disableStyle, className, ref, ...props }: (Omit<BaseSelect.Separator.Props, 'className' | 'render'> & {
|
|
176
176
|
className?: string;
|
|
177
|
-
} & StyleProps
|
|
178
|
-
export declare
|
|
177
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
178
|
+
export declare function ItemText({ disableStyle, className, ref, ...props }: (Omit<BaseSelect.ItemText.Props, 'className' | 'render'> & {
|
|
179
179
|
className?: string;
|
|
180
|
-
} & StyleProps
|
|
181
|
-
export declare
|
|
180
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
181
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
182
182
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
183
183
|
children?: ValidationMessageChildren;
|
|
184
184
|
};
|
|
185
185
|
/** 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. */
|
|
186
|
-
export declare
|
|
186
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
187
187
|
/** 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. */
|
|
188
|
-
export declare
|
|
189
|
-
/** Built-in icon
|
|
190
|
-
export declare
|
|
188
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
189
|
+
/** Built-in icon. Use it inside its matching control. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
190
|
+
export declare function OpenButtonIcon({ disableStyle, className, strokeWidth, children, ref, ...props }: Omit<SVGIconProps, 'children'> & StyleProps & {
|
|
191
|
+
/** Omit for the supplied default icon; pass a child icon only to replace it. */
|
|
192
|
+
children?: ReactElement<SVGIconProps>;
|
|
193
|
+
}): import("react").FunctionComponentElement<any>;
|
|
191
194
|
/** Tracks the surrounding item state automatically. Keep it mounted; do not add your own visibility condition. Use the supplied default visual unless customization is needed. */
|
|
192
|
-
export declare
|
|
195
|
+
export declare function ItemIndicator({ disableStyle, children, keepMounted, ref, ...props }: Omit<SVGIconProps, 'children'> & Pick<BaseSelect.ItemIndicator.Props, 'keepMounted'> & {
|
|
193
196
|
/** Optional replacement SVG icon. It receives this indicator's props and ref. */
|
|
194
197
|
children?: ReactElement<SVGIconProps>;
|
|
195
|
-
} & StyleProps
|
|
196
|
-
export declare
|
|
198
|
+
} & StyleProps): import("react").JSX.Element;
|
|
199
|
+
export declare function ScrollUpArrow({ disableStyle, children, className, ref, ...props }: (Omit<BaseSelect.ScrollUpArrow.Props, 'className' | 'render'> & {
|
|
197
200
|
className?: string;
|
|
198
|
-
} & StyleProps
|
|
199
|
-
export declare
|
|
201
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
202
|
+
export declare function ScrollDownArrow({ disableStyle, children, className, ref, ...props }: (Omit<BaseSelect.ScrollDownArrow.Props, 'className' | 'render'> & {
|
|
200
203
|
className?: string;
|
|
201
|
-
} & StyleProps
|
|
204
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
202
205
|
export {};
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { asChildRendering } from "../../utils/asChild.js";
|
|
3
3
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
4
4
|
import { Check, ChevronDown, ChevronUp, ChevronsUpDown } from "../../utils/icons.js";
|
|
5
|
-
import { cloneElement, createContext,
|
|
5
|
+
import { cloneElement, createContext, useContext, useEffect, useId, useState, } from 'react';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
7
8
|
/**
|
|
8
9
|
* Prepare groups in items. A flat-looking list is one group with an empty label and no GroupLabel; keep Group around ItemsList. OpenButtonValue already formats the selection: omit children unless a custom display is needed. Keep ScrollArea → GroupsList → Group → ItemsList → Item in Popup.
|
|
@@ -113,21 +114,21 @@ export function Root({ children, items, id, validation, defaultOpen = false, onO
|
|
|
113
114
|
setDescribedByIds,
|
|
114
115
|
}, children: children }) }));
|
|
115
116
|
}
|
|
116
|
-
export
|
|
117
|
+
export function Container({ disableStyle, className, ref, ...props }) {
|
|
117
118
|
return (_jsx("div", { ...props, ref: ref, "data-component": "select-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
118
|
-
}
|
|
119
|
-
export
|
|
119
|
+
}
|
|
120
|
+
export function Label({ disableStyle, className, ref, ...props }) {
|
|
120
121
|
const attributes = usePartAttributes();
|
|
121
122
|
return (_jsx(BaseSelect.Label, { ...attributes, ...props, ref: ref, "data-component": "select-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
122
|
-
}
|
|
123
|
+
}
|
|
123
124
|
export const Value = BaseSelect.Value;
|
|
124
125
|
/** Omit children to keep the built-in formatted value. Supply children only for a special display; do not format the selection yourself for the usual case. */
|
|
125
126
|
export function OpenButtonValue({ disableStyle, className, ...props }) {
|
|
126
127
|
return (_jsx(BaseSelect.Value, { ...props, "data-component": "select-openbuttonvalue", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
127
128
|
}
|
|
128
|
-
export
|
|
129
|
+
export function ScrollArea({ disableStyle, className, ref, ...props }) {
|
|
129
130
|
return (_jsx(BaseSelect.List, { ...props, ref: ref, "data-component": "select-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
130
|
-
}
|
|
131
|
+
}
|
|
131
132
|
/** Let this list render the groups. Manually annotate its children callback with Select.GroupType<typeof rootItems>, using the SAME items variable passed to Root. */
|
|
132
133
|
export function GroupsList({ disableStyle, children, className, ...props }) {
|
|
133
134
|
const context = useSelectContext();
|
|
@@ -156,59 +157,68 @@ export function Popup({ disableStyle, container, anchor, positionMethod, side =
|
|
|
156
157
|
? (state) => ({ ...baseStyle, ...style(state) })
|
|
157
158
|
: { ...baseStyle, ...style } }) }) }));
|
|
158
159
|
}
|
|
159
|
-
export
|
|
160
|
+
export function Arrow({ disableStyle, className, style, ref, ...props }) {
|
|
160
161
|
return (_jsxs(BaseSelect.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "select-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": "select-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": "select-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": "select-arrow-3" })] }));
|
|
161
|
-
}
|
|
162
|
+
}
|
|
162
163
|
/** Opens the select. Pass asChild to make your own button the trigger instead, like a "Sort" Button. */
|
|
163
|
-
export
|
|
164
|
+
export function OpenButton({ asChild, disableStyle, children, 'aria-describedby': describedBy, ref, ...props }) {
|
|
164
165
|
const context = useSelectContext();
|
|
165
166
|
const rendering = asChildRendering({ asChild, children, component: 'select-openbutton', disableStyle });
|
|
166
167
|
return _jsx(BaseSelect.Trigger, { ...validationAttributes(context.validation), "aria-invalid": context.validation.state === 'error' || props['aria-invalid'] || undefined, "aria-describedby": [describedBy, ...context.describedByIds].filter(Boolean).join(' ') || undefined, ...props, ref: ref, ...rendering });
|
|
167
|
-
}
|
|
168
|
+
}
|
|
168
169
|
/** Omit for an unlabeled/flat-looking group; keep the Group wrapper. Supply the heading only when grouping should be visible. */
|
|
169
|
-
export
|
|
170
|
+
export function GroupLabel({ disableStyle, className, ref, ...props }) {
|
|
170
171
|
return (_jsx(BaseSelect.GroupLabel, { ...props, ref: ref, "data-component": "select-grouplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
171
|
-
}
|
|
172
|
-
export
|
|
172
|
+
}
|
|
173
|
+
export function Separator({ disableStyle, className, ref, ...props }) {
|
|
173
174
|
return (_jsx(BaseSelect.Separator, { ...props, ref: ref, "data-component": "select-separator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
174
|
-
}
|
|
175
|
-
export
|
|
175
|
+
}
|
|
176
|
+
export function ItemText({ disableStyle, className, ref, ...props }) {
|
|
176
177
|
return (_jsx(BaseSelect.ItemText, { ...props, ref: ref, "data-component": "select-itemtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
177
|
-
}
|
|
178
|
-
export
|
|
178
|
+
}
|
|
179
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
179
180
|
const describedById = useDescribedById(id);
|
|
180
181
|
const attributes = usePartAttributes();
|
|
181
182
|
return (_jsx("div", { ...attributes, ...props, id: describedById, ref: ref, "data-component": "select-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
182
|
-
}
|
|
183
|
+
}
|
|
183
184
|
/** 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. */
|
|
184
|
-
export
|
|
185
|
+
export function Error({ children, ref, ...props }) {
|
|
185
186
|
const context = useSelectContext();
|
|
186
187
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
187
188
|
if (content === undefined)
|
|
188
189
|
return null;
|
|
189
190
|
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "select-error", children: content });
|
|
190
|
-
}
|
|
191
|
+
}
|
|
191
192
|
/** 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. */
|
|
192
|
-
export
|
|
193
|
+
export function Success({ children, ref, ...props }) {
|
|
193
194
|
const context = useSelectContext();
|
|
194
195
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
195
196
|
if (content === undefined)
|
|
196
197
|
return null;
|
|
197
198
|
return _jsx(Message, { ...props, ref: ref, role: "status", component: "select-success", children: content });
|
|
198
|
-
}
|
|
199
|
+
}
|
|
199
200
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the select
|
|
200
|
-
|
|
201
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
201
202
|
const describedById = useDescribedById(id);
|
|
202
203
|
const attributes = usePartAttributes();
|
|
203
204
|
return _jsx("div", { "aria-atomic": "true", ...attributes, ...props, id: describedById, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
204
|
-
}
|
|
205
|
-
/** Built-in icon
|
|
206
|
-
export
|
|
205
|
+
}
|
|
206
|
+
/** Built-in icon. Use it inside its matching control. Omit children for the supplied default icon; pass an icon only to replace it. Defaults to strokeWidth 1.5. */
|
|
207
|
+
export function OpenButtonIcon({ disableStyle, className, strokeWidth, children, ref, ...props }) {
|
|
207
208
|
const attributes = usePartAttributes();
|
|
208
|
-
return (_jsx(ChevronsUpDown, {
|
|
209
|
-
|
|
209
|
+
return cloneElement(children ?? _jsx(ChevronsUpDown, {}), {
|
|
210
|
+
...attributes,
|
|
211
|
+
'aria-hidden': true,
|
|
212
|
+
...props,
|
|
213
|
+
ref,
|
|
214
|
+
strokeWidth: strokeWidth ?? children?.props.strokeWidth ?? 1.5,
|
|
215
|
+
'data-component': 'select-openbuttonicon',
|
|
216
|
+
'data-style-disabled': disableStyle ? '' : undefined,
|
|
217
|
+
className: twMerge(children?.props.className, className),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
210
220
|
/** Tracks the surrounding item state automatically. Keep it mounted; do not add your own visibility condition. Use the supplied default visual unless customization is needed. */
|
|
211
|
-
export
|
|
221
|
+
export function ItemIndicator({ disableStyle, children, keepMounted, ref, ...props }) {
|
|
212
222
|
const iconProps = {
|
|
213
223
|
'aria-hidden': true,
|
|
214
224
|
strokeWidth: 2,
|
|
@@ -218,13 +228,13 @@ export const ItemIndicator = /* @__PURE__ */ forwardRef(function ItemIndicator({
|
|
|
218
228
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
219
229
|
};
|
|
220
230
|
return (_jsx(BaseSelect.ItemIndicator, { keepMounted: keepMounted, children: null, render: cloneElement(children ?? _jsx(Check, {}), iconProps) }));
|
|
221
|
-
}
|
|
222
|
-
export
|
|
231
|
+
}
|
|
232
|
+
export function ScrollUpArrow({ disableStyle, children, className, ref, ...props }) {
|
|
223
233
|
return (_jsx(BaseSelect.ScrollUpArrow, { ...props, ref: ref, "data-component": "select-scrolluparrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children ?? (_jsx(ChevronUp, { "aria-hidden": true, "data-component": "select-scrolluparrow-1" })) }));
|
|
224
|
-
}
|
|
225
|
-
export
|
|
234
|
+
}
|
|
235
|
+
export function ScrollDownArrow({ disableStyle, children, className, ref, ...props }) {
|
|
226
236
|
return (_jsx(BaseSelect.ScrollDownArrow, { ...props, ref: ref, "data-component": "select-scrolldownarrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children ?? (_jsx(ChevronDown, { "aria-hidden": true, "data-component": "select-scrolldownarrow-1" })) }));
|
|
227
|
-
}
|
|
237
|
+
}
|
|
228
238
|
const ItemsContext = /* @__PURE__ */ createContext(null);
|
|
229
239
|
function useItemsContext() {
|
|
230
240
|
const items = useContext(ItemsContext);
|